/* ==========================================================================
   FLET — Field Linguistics Extension Tools
   Design tokens: light theme by default, dark via system preference or
   the header toggle (data-theme attribute on <html> overrides the system).
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --bg-raised: #ffffff;
  --bg-inset: #eef2f8;
  --border: #d9e1ec;
  --border-strong: #c3cfdf;
  --text: #182233;
  --text-secondary: #46556b;
  --muted: #5d6b80;
  --accent: #1d63d8;
  --accent-hover: #174fae;
  --accent-soft: #e3edfc;
  --accent-contrast: #ffffff;
  --cyan: #0e7490;
  --early-bg: #fdf3dc;
  --early-text: #7a5410;
  --early-border: #ecd9a8;
  --suite-bg: #e0f1f4;
  --suite-text: #0d5c70;
  --suite-border: #b7dde5;
  --hero-glow-1: rgba(59, 130, 246, 0.14);
  --hero-glow-2: rgba(6, 182, 212, 0.12);
  --shadow-sm: 0 1px 2px rgba(16, 30, 54, 0.06);
  --shadow-md: 0 4px 14px -4px rgba(16, 30, 54, 0.12);
  --shadow-lg: 0 12px 28px -10px rgba(16, 30, 54, 0.18);
  --radius: 12px;
  --radius-lg: 16px;
  --header-bg: rgba(247, 249, 252, 0.85);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-raised: #131a2e;
  --bg-inset: #0e1526;
  --border: #232e47;
  --border-strong: #33405e;
  --text: #e8edf6;
  --text-secondary: #b4c0d4;
  --muted: #93a1b8;
  --accent: #5b9bf8;
  --accent-hover: #7fb1fa;
  --accent-soft: #16233f;
  --accent-contrast: #071021;
  --cyan: #38bdd8;
  --early-bg: #2c2410;
  --early-text: #e8c15e;
  --early-border: #4d3f1a;
  --suite-bg: #0d2a33;
  --suite-text: #67d3e8;
  --suite-border: #14495a;
  --hero-glow-1: rgba(59, 130, 246, 0.16);
  --hero-glow-2: rgba(6, 182, 212, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px -4px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 28px -10px rgba(0, 0, 0, 0.55);
  --header-bg: rgba(11, 16, 32, 0.85);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1020;
    --bg-raised: #131a2e;
    --bg-inset: #0e1526;
    --border: #232e47;
    --border-strong: #33405e;
    --text: #e8edf6;
    --text-secondary: #b4c0d4;
    --muted: #93a1b8;
    --accent: #5b9bf8;
    --accent-hover: #7fb1fa;
    --accent-soft: #16233f;
    --accent-contrast: #071021;
    --cyan: #38bdd8;
    --early-bg: #2c2410;
    --early-text: #e8c15e;
    --early-border: #4d3f1a;
    --suite-bg: #0d2a33;
    --suite-text: #67d3e8;
    --suite-border: #14495a;
    --hero-glow-1: rgba(59, 130, 246, 0.16);
    --hero-glow-2: rgba(6, 182, 212, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 14px -4px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 28px -10px rgba(0, 0, 0, 0.55);
    --header-bg: rgba(11, 16, 32, 0.85);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08em 0.35em;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -3.5rem;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; color: var(--accent-contrast); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
}
.brand img { border-radius: 6px; display: block; }
.brand:hover { color: var(--accent); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-inline: auto;
}
.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
}
.site-nav a:hover {
  color: var(--text);
  background: var(--bg-inset);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.site-nav + .header-actions { margin-left: 0; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* Show the icon for the theme you'd switch TO */
.icon-moon { display: block; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: none; }
  :root:not([data-theme="light"]) .icon-sun { display: block; }
}

.header-github {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.42rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
}
.header-github:hover { color: var(--text); border-color: var(--border-strong); }

@media (max-width: 720px) {
  .site-nav { display: none; }
  .header-actions { margin-left: auto; }
  .header-github span { display: none; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 5.5rem 1.25rem 4.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 320px at 20% 0%, var(--hero-glow-1), transparent 70%),
    radial-gradient(600px 320px at 80% 10%, var(--hero-glow-2), transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
}

.hero-eyebrow {
  display: inline-block;
  margin: 0 0 1.25rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}

.hero h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.accent-text {
  background: linear-gradient(100deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .tagline {
  margin: 0 auto 2rem;
  max-width: 640px;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-md);
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { color: var(--text); border-color: var(--muted); }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

section { padding: 4rem 1.25rem; }
section:nth-of-type(even):not(.hero) { background: var(--bg-inset); }

.container { max-width: 1140px; margin: 0 auto; }

.section-header { max-width: 720px; margin-bottom: 0.5rem; }

.section-eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-header h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.section-lede {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.02rem;
}

/* --------------------------------------------------------------------------
   Tool cards
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  margin-top: 2rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.4rem 1.4rem 1.3rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.tool-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tool-card.is-featured {
  grid-column: 1 / -1;
  border-color: var(--suite-border);
  background:
    linear-gradient(120deg, var(--accent-soft), transparent 55%),
    var(--bg-raised);
}

.tool-card h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.tool-card p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--text-secondary);
  flex-grow: 1;
}

.badge {
  align-self: flex-start;
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-inset);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-early {
  background: var(--early-bg);
  color: var(--early-text);
  border-color: var(--early-border);
}
.badge-suite {
  background: var(--suite-bg);
  color: var(--suite-text);
  border-color: var(--suite-border);
}

.card-link {
  align-self: flex-start;
  margin-top: 0.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
}
.card-link::after {
  content: "→";
  transition: transform 0.18s ease;
}
.card-link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.card-link:hover::after { transform: translateX(3px); }

/* --------------------------------------------------------------------------
   Download link panels
   -------------------------------------------------------------------------- */

.link-panels {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-top: 2rem;
}

.link-panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.link-panel h3 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.link-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
}
.link-list li:first-child { border-top: 0; padding-top: 0; }
.link-list li:last-child { padding-bottom: 0; }
.link-list a {
  font-weight: 600;
  text-decoration: none;
}
.link-list a:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-list span {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Roadmap
   -------------------------------------------------------------------------- */

.roadmap-list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.roadmap-list li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1.1rem 0.9rem 2.1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.roadmap-list li::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 1.35rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
}
.roadmap-list strong { font-size: 0.97rem; }
.roadmap-list span { font-size: 0.9rem; color: var(--text-secondary); }
.roadmap-list a { text-decoration: none; }
.roadmap-list a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   About & license
   -------------------------------------------------------------------------- */

.about-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  margin-top: 2rem;
  align-items: start;
}
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
}

.prose p { margin: 0 0 1rem; color: var(--text-secondary); font-size: 1.02rem; }
.prose p:last-child { margin-bottom: 0; }

.license-box {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}
.license-box h3 { margin: 0 0 0.7rem; font-size: 1rem; }
.license-box p { margin: 0 0 0.75rem; font-size: 0.92rem; color: var(--text-secondary); }
.license-box p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.25rem 3rem;
  background: var(--bg-inset);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.footer-brand img { border-radius: 5px; display: block; }

.site-footer p {
  margin: 0;
  font-size: 0.87rem;
  color: var(--muted);
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   Motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   FLEx List Migrator — page-specific additions
   ========================================================================== */

/* Download buttons in the hero */
.hero-download {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.btn-download {
  gap: 0.55rem;
  padding: 0.85rem 1.6rem;
  font-size: 1.02rem;
}
.btn-download svg { flex: none; }
.hero-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.hero-meta a { color: var(--accent); text-decoration: none; }
.hero-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Platform note pill under the hero */
.hero-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1.4rem auto 0;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
}

/* Feature cards with a leading icon */
.feature-card .feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.feature-card .feature-icon svg { width: 1.3rem; height: 1.3rem; }

/* Numbered "how it works" steps */
.steps {
  counter-reset: step;
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 1.1rem 1.3rem 1.1rem 3.6rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1.05rem;
  width: 1.9rem;
  height: 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}
.steps li strong { display: block; margin-bottom: 0.15rem; }
.steps li p { margin: 0; color: var(--text-secondary); font-size: 0.94rem; }

/* Callout note */
.callout {
  margin-top: 2rem;
  display: flex;
  gap: 0.75rem;
  padding: 1.1rem 1.3rem;
  background: var(--accent-soft);
  border: 1px solid var(--suite-border);
  border-radius: var(--radius);
}
.callout svg { flex: none; color: var(--accent); width: 1.3rem; height: 1.3rem; margin-top: 0.15rem; }
.callout p { margin: 0; font-size: 0.94rem; color: var(--text-secondary); }
.callout strong { color: var(--text); }

/* Code block */
pre.code-block {
  margin: 1.2rem 0 0;
  padding: 1rem 1.2rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text);
}
pre.code-block code { background: none; border: 0; padding: 0; font-size: inherit; }

/* Simple prose blocks inside sections */
.doc-prose { max-width: 780px; margin-top: 1.5rem; }
.doc-prose p { color: var(--text-secondary); }
.doc-prose ul { color: var(--text-secondary); padding-left: 1.2rem; }
.doc-prose li { margin-bottom: 0.4rem; }

/* FAQ */
.faq { margin-top: 2rem; display: grid; gap: 0.9rem; max-width: 820px; }
.faq details {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.7rem 0;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "＋"; color: var(--accent); font-weight: 700; margin-right: 0.6rem; }
.faq details[open] summary::before { content: "－"; }
.faq details p { margin: 0 0 0.9rem; color: var(--text-secondary); font-size: 0.94rem; }

/* Screenshot figure */
.screenshot {
  padding-top: 0;
}
.screenshot-figure {
  margin: 0 auto;
  max-width: 980px;
}
.screenshot-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--bg-raised);
}
.screenshot-figure figcaption {
  margin-top: 0.9rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
