/* Classic = original Google Fonts Regular (optically heavy single cut used before).
       Light Italic = upstream cut for "terity" only. */
    @font-face {
      font-family: "Young Serif";
      src: url("../fonts/YoungSerif-Classic.ttf") format("truetype");
      font-weight: 400;
      font-style: normal;
      font-display: swap;
    }
    @font-face {
      font-family: "Young Serif";
      src: url("../fonts/YoungSerif-LightItalic.woff2") format("woff2");
      font-weight: 300;
      font-style: italic;
      font-display: swap;
    }
    @font-face {
      font-family: "Young Serif";
      src: url("../fonts/YoungSerif-RegularItalic.woff2") format("woff2");
      font-weight: 400;
      font-style: italic;
      font-display: swap;
    }
    :root {
      --bg: #EDE1CD;
      --surface: #F9F3E8;
      --ink: #2E2218;
      --muted: #6B5643;
      --line: #D6C3A5;
      --accent: #3F4B2F;
      --accent-ink: #F9F3E8;
      --second: #2A605E;
      --good: #3D7533;
      --cat-1: #5B8A3E;
      --cat-2: #B88A12;
      --cat-3: #C46A30;
      --cat-4: #A84A33;
      --cat-5: #8A5E36;
      --cat-6: #6E5A9E;
      --cat-7: #2F7F7C;
      --cat-8: #6B7A45;
      --flow-1: #7D5E0C;
      --flow-2: #9A4E22;
      --flow-3: #A0452F;
      --flow-4: #4F6E33;
      --flow-ink: #F9F3E8;
      --glass-hl: 0.55;
      --radius-card: 14px;
      --radius-control: 10px;
      --font-display: "Young Serif", "Iowan Old Style", Georgia, serif;
      --display-weight: 400;
      --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
      --font-mono: "Fragment Mono", ui-monospace, Menlo, monospace;
      --gutter: clamp(20px, 5vw, 48px);
      --soft: color-mix(in srgb, var(--ink) 6%, var(--surface));
      --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
      --glass-bg: color-mix(in srgb, var(--surface) 62%, transparent);
      --glass-border: color-mix(in srgb, var(--ink) 12%, transparent);
      --flow-grad: linear-gradient(110deg, var(--flow-1), var(--flow-2), var(--flow-3), var(--flow-4), var(--flow-1));
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      background: var(--bg);
      color: var(--ink);
      font-family: var(--font-body);
      font-size: 16px;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
    }
    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
      }
    }

    a { color: var(--second); }
    :focus-visible { outline: 2px solid var(--second); outline-offset: 2px; }
    h1, h2, h3 {
      margin: 0;
      font-family: var(--font-display);
      font-weight: var(--display-weight);
      letter-spacing: -0.01em;
      line-height: 1.15;
      text-wrap: balance;
    }
    p { margin: 0; }
    button, input, select, textarea { font: inherit; color: inherit; }

    .icon {
      fill: none;
      stroke: currentColor;
      stroke-width: 1.75;
      stroke-linecap: round;
      stroke-linejoin: round;
      flex: none;
    }
    .icon-filled { fill: currentColor; stroke: none; }

    .flow-text {
      background: var(--flow-grad);
      background-size: 300% 100%;
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      animation: flow-move 8s linear infinite;
    }
    @keyframes flow-move {
      to { background-position: 300% 0; }
    }
    @keyframes flow-border {
      to { background-position: 0 0, 300% 0; }
    }

    /* —— Chrome —— */
    .site-nav {
      position: fixed;
      inset: 12px var(--gutter) auto;
      z-index: 40;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 10px 14px;
      border-radius: 999px;
      background: var(--glass-bg);
      border: 1px solid var(--glass-border);
      -webkit-backdrop-filter: blur(22px) saturate(1.6);
      backdrop-filter: blur(22px) saturate(1.6);
      box-shadow: inset 0 1px 0 rgb(255 255 255 / var(--glass-hl)), 0 8px 28px rgb(0 0 0 / 0.08);
    }
    .brand {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      text-decoration: none;
      color: var(--ink);
    }
    .brand-mark {
      width: 32px;
      height: 32px;
      border-radius: 10px;
      display: grid;
      place-items: center;
      background: var(--accent-soft);
      color: var(--accent);
    }
    .brand-mark svg { width: 22px; height: 22px; display: block; }
    .brand-name {
      font-family: var(--font-display);
      font-size: 1.25rem;
      font-weight: 400;
      letter-spacing: -0.01em;
    }
    .nav-links {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .nav-links a:not(.btn) {
      text-decoration: none;
      color: var(--muted);
      font-weight: 500;
      font-size: 0.95rem;
      padding: 8px 12px;
      border-radius: 999px;
    }
    .nav-links a:not(.btn):hover { color: var(--ink); background: var(--soft); }
    @media (max-width: 640px) {
      .nav-links a:not(.btn) { display: none; }
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-height: 40px;
      padding: 0 18px;
      border: 1px solid transparent;
      border-radius: 999px;
      font-weight: 600;
      font-size: 0.95rem;
      text-decoration: none;
      cursor: pointer;
      transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    }
    .btn:active { transform: scale(0.98); }
    .btn-primary {
      background: var(--accent);
      color: var(--accent-ink);
    }
    .btn-primary:hover { filter: brightness(1.06); }
    .btn-ghost {
      background: transparent;
      border-color: var(--line);
      color: var(--ink);
    }
    .btn-ghost:hover { background: var(--soft); }
    .btn-flow {
      border: 1.5px solid transparent;
      background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        var(--flow-grad) border-box;
      background-size: 100% 100%, 300% 100%;
      color: var(--ink);
      animation: flow-border 8s linear infinite;
    }
    .btn-flow:hover {
      background:
        linear-gradient(var(--soft), var(--soft)) padding-box,
        var(--flow-grad) border-box;
      background-size: 100% 100%, 300% 100%;
    }
    .btn-flow-fill {
      border-color: transparent;
      background: var(--flow-grad);
      background-size: 300% 100%;
      color: var(--flow-ink);
      animation: flow-move 8s linear infinite;
    }
    .btn-flow-fill:hover { filter: brightness(1.05); }

    /* —— Hero —— */
    .hero {
      position: relative;
      min-height: clamp(380px, 56svh, 520px);
      display: grid;
      place-items: center;
      overflow: hidden;
      isolation: isolate;
    }
    .hero-ambient {
      position: absolute;
      inset: 0;
      z-index: 0;
      pointer-events: none;
    }
    .hero-ambient canvas {
      width: 100%;
      height: 100%;
      display: block;
    }
    .hero-veil {
      position: absolute;
      inset: 0;
      z-index: 1;
      background:
        radial-gradient(ellipse 70% 60% at 50% 42%, color-mix(in srgb, var(--surface) 78%, transparent), transparent 72%),
        linear-gradient(180deg, color-mix(in srgb, var(--bg) 35%, transparent) 0%, color-mix(in srgb, var(--bg) 18%, transparent) 55%, var(--bg) 100%);
      pointer-events: none;
    }
    .hero-copy {
      position: relative;
      z-index: 2;
      width: min(720px, 100%);
      padding: calc(88px + env(safe-area-inset-top, 0px)) var(--gutter) 40px;
      text-align: center;
      display: grid;
      justify-items: center;
    }
    .hero-brand-lockup {
      display: grid;
      justify-items: center;
      gap: 10px;
      margin-bottom: 40px;
      opacity: 0;
      animation: rise 0.9s ease 0.08s forwards;
    }
    .hero-brand {
      display: flex;
      align-items: baseline;
      justify-content: center;
      flex-wrap: wrap;
      font-family: var(--font-display);
      font-size: clamp(3.25rem, 11vw, 5.5rem);
      letter-spacing: -0.02em;
      line-height: 1;
    }
    /* Dot is positioned against Dex's cap-height (≈ X cross), not the full em box. */
    .hero-brand .brand-dex-group {
      position: relative;
      display: inline-block;
      line-height: 1;
      padding-right: 0.545em;
    }
    .hero-brand .brand-dex {
      font-weight: 400;
      font-style: normal;
      line-height: 1;
      background: var(--flow-grad);
      background-size: 300% 100%;
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      animation: flow-move 8s linear infinite;
    }
    .hero-brand .brand-dot {
      position: absolute;
      left: calc(100% - 0.345em);
      top: 0;
      width: 0.145em;
      height: 0.145em;
      margin: 0;
      border-radius: 50%;
      background: color-mix(in srgb, var(--muted) 48%, var(--line));
      transform: translateY(-50%);
    }
    .hero-brand .brand-terity {
      font-family: var(--font-display);
      font-weight: 300;
      font-style: italic;
      letter-spacing: -0.02em;
      color: color-mix(in srgb, var(--muted) 68%, var(--bg));
    }
    .hero-gloss {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      justify-content: center;
      gap: 0.45em;
      max-width: 28rem;
      margin: 0;
      padding: 0 0.5rem;
      color: color-mix(in srgb, var(--muted) 70%, var(--bg));
      font-size: clamp(0.92rem, 1.7vw, 1.05rem);
      font-weight: 400;
      line-height: 1.45;
    }
    .hero-gloss .gloss-pos {
      font-family: var(--font-mono);
      font-size: 0.78em;
      font-weight: 400;
      letter-spacing: 0.04em;
      color: color-mix(in srgb, var(--muted) 55%, var(--bg));
    }
    .hero-gloss .gloss-def {
      font-family: var(--font-display);
      font-style: italic;
      font-weight: 400;
      letter-spacing: -0.01em;
      color: color-mix(in srgb, var(--muted) 62%, var(--bg));
    }
    .hero h1 {
      font-size: clamp(1.55rem, 3.6vw, 2.35rem);
      margin-top: 4px;
      margin-bottom: 24px;
      opacity: 0;
      animation: rise 0.9s ease 0.24s forwards;
    }
    .hero-cta {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 12px;
      opacity: 0;
      animation: rise 0.9s ease 0.4s forwards;
    }
    @keyframes rise {
      from { opacity: 0; transform: translateY(14px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* —— Sections —— */
    .section {
      padding: clamp(64px, 10vh, 112px) var(--gutter);
    }
    .section-head {
      max-width: 40rem;
      margin-bottom: clamp(28px, 5vw, 40px);
    }
    .eyebrow {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 10px;
    }
    .section-head h2 {
      font-size: clamp(1.75rem, 3.5vw, 2.5rem);
      margin-bottom: 10px;
    }
    .section-head p { color: var(--muted); max-width: 42ch; }

    /* —— Features —— */
    .features {
      background: color-mix(in srgb, var(--surface) 55%, var(--bg));
      border-block: 1px solid var(--line);
    }
    .features .section-head {
      max-width: 1100px;
      margin-left: auto;
      margin-right: auto;
      text-align: center;
    }
    .features .section-head p {
      margin-left: auto;
      margin-right: auto;
    }
    .feature-shell {
      display: grid;
      gap: 20px;
      max-width: 1100px;
      margin: 0 auto;
    }
    .feature-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .feature-tab {
      appearance: none;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 8px 14px 8px 10px;
      min-height: 40px;
      font-weight: 600;
      font-size: 0.9rem;
      color: var(--muted);
      cursor: pointer;
    }
    .feature-tab .tab-icon {
      width: 28px;
      height: 28px;
      border-radius: 9px;
      display: grid;
      place-items: center;
      background: var(--soft);
      color: var(--accent);
    }
    .feature-tab .tab-icon svg { width: 16px; height: 16px; }
    .feature-tab:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 28%, var(--line)); }
    .feature-tab[aria-selected="true"] {
      background: var(--cat-3);
      border-color: var(--cat-3);
      color: #F9F3E8;
    }
    .feature-tab[aria-selected="true"] .tab-icon {
      background: color-mix(in srgb, #F9F3E8 18%, transparent);
      color: #F9F3E8;
    }
    .feature-tab[data-ask="true"][aria-selected="true"] {
      background: transparent;
      border: 1.5px solid transparent;
      background-image:
        linear-gradient(var(--surface), var(--surface)),
        var(--flow-grad);
      background-origin: border-box;
      background-clip: padding-box, border-box;
      background-size: 100% 100%, 300% 100%;
      color: var(--ink);
      animation: flow-border 8s linear infinite;
    }
    .feature-tab[data-ask="true"][aria-selected="true"] .tab-icon {
      background: var(--accent-soft);
      color: var(--accent);
    }
    .feature-panel {
      display: none;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: var(--radius-card);
      padding: clamp(20px, 3vw, 28px);
      min-height: 320px;
    }
    .feature-panel.active { display: grid; gap: 20px; }
    @media (min-width: 840px) {
      .feature-panel.active:not(.ask-panel) {
        grid-template-columns: 1.05fr 0.95fr;
        align-items: stretch;
      }
    }
    .feature-title {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 10px;
    }
    .feature-badge {
      width: 44px;
      height: 44px;
      border-radius: 14px;
      display: grid;
      place-items: center;
      background: var(--accent-soft);
      color: var(--accent);
      flex: none;
    }
    .feature-badge svg { width: 24px; height: 24px; }
    .feature-badge.ask {
      background: transparent;
      border: 1.5px solid transparent;
      background-image:
        linear-gradient(var(--accent-soft), var(--accent-soft)),
        var(--flow-grad);
      background-origin: border-box;
      background-clip: padding-box, border-box;
      background-size: 100% 100%, 300% 100%;
      animation: flow-border 8s linear infinite;
      color: var(--accent);
    }
    .feature-copy h3 {
      font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    }
    .feature-copy > p { color: var(--muted); margin-bottom: 16px; }
    .feature-points {
      list-style: none;
      padding: 0;
      margin: 0;
      display: grid;
      gap: 10px;
    }
    .feature-points li {
      display: grid;
      grid-template-columns: 28px 1fr;
      gap: 10px;
      align-items: start;
      color: var(--ink);
      font-size: 0.95rem;
    }
    .point-icon {
      width: 28px;
      height: 28px;
      border-radius: 9px;
      display: grid;
      place-items: center;
      background: color-mix(in srgb, var(--dot, var(--cat-1)) 18%, var(--surface));
      color: var(--dot, var(--cat-1));
    }
    .point-icon svg { width: 15px; height: 15px; }

    .feature-mock {
      background: var(--soft);
      border: 1px solid var(--line);
      border-radius: var(--radius-control);
      padding: 16px;
      display: grid;
      gap: 10px;
      align-content: start;
    }
    .mock-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 14px;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 10px;
      font-size: 0.92rem;
    }
    .mock-row-main {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      min-width: 0;
    }
    .mock-row-icon {
      width: 30px;
      height: 30px;
      border-radius: 9px;
      display: grid;
      place-items: center;
      background: var(--accent-soft);
      color: var(--accent);
      flex: none;
    }
    .mock-row-icon svg { width: 16px; height: 16px; }
    .mock-row strong { font-weight: 600; display: block; }
    .mock-meta {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--muted);
      letter-spacing: 0.02em;
    }
    .mock-chip {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 0 10px;
      border-radius: 999px;
      font-size: 0.75rem;
      font-weight: 600;
      background: var(--accent-soft);
      color: var(--accent);
      white-space: nowrap;
    }
    .mock-chip.warn {
      background: color-mix(in srgb, var(--cat-2) 18%, var(--surface));
      color: color-mix(in srgb, var(--cat-2) 80%, var(--ink));
    }

    /* Ask Dex */
    .ask-panel.active {
      grid-template-columns: 1fr;
      gap: 18px;
    }
    .prompt-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .prompt-chip {
      appearance: none;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 8px 14px 8px 10px;
      font-size: 0.88rem;
      font-weight: 500;
      color: var(--ink);
      cursor: pointer;
      text-align: left;
    }
    .prompt-chip .chip-icon {
      width: 26px;
      height: 26px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      background: var(--soft);
      color: var(--accent);
      flex: none;
    }
    .prompt-chip .chip-icon svg { width: 14px; height: 14px; }
    .prompt-chip:hover,
    .prompt-chip[aria-pressed="true"] {
      border-color: var(--second);
      background: color-mix(in srgb, var(--second) 10%, var(--surface));
    }
    .ask-composer {
      display: grid;
      gap: 12px;
    }
    .ask-input-wrap {
      position: relative;
      border-radius: 999px;
      padding: 1.5px;
      background: var(--line);
    }
    .ask-input-wrap.working {
      border: 1.5px solid transparent;
      padding: 0;
      background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        var(--flow-grad) border-box;
      background-size: 100% 100%, 300% 100%;
      animation: flow-border 8s linear infinite;
    }
    .ask-input-inner {
      display: flex;
      align-items: center;
      gap: 10px;
      min-height: 52px;
      padding: 8px 8px 8px 18px;
      border-radius: 999px;
      background: var(--surface);
    }
    .ask-input-inner span.prompt-text {
      flex: 1;
      color: var(--ink);
      font-size: 0.95rem;
      text-align: left;
    }
    .ask-go {
      width: 40px;
      height: 40px;
      border: 0;
      border-radius: 999px;
      background: var(--accent);
      color: var(--accent-ink);
      display: grid;
      place-items: center;
      cursor: default;
    }
    .ask-input-wrap.working .ask-go {
      background: var(--flow-grad);
      background-size: 300% 100%;
      animation: flow-move 8s linear infinite;
      color: var(--flow-ink);
    }
    .ask-reply {
      background: var(--soft);
      border: 1px solid var(--line);
      border-radius: var(--radius-card);
      padding: 16px 18px;
      min-height: 120px;
    }
    .ask-reply .label-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
      min-height: 22px;
    }
    .ask-reply .label {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .reply-stage {
      position: relative;
      min-height: 4.75rem;
    }
    .ask-reply .body {
      color: var(--ink);
      min-height: 1.5em;
      transition: opacity 0.2s ease;
    }
    .ask-reply.is-thinking .body {
      opacity: 0;
    }
    .ask-reply .body em {
      font-style: normal;
      color: var(--second);
      font-weight: 600;
    }
    .ask-reply .body .stream-caret {
      display: inline-block;
      width: 2px;
      height: 0.95em;
      margin-left: 1px;
      vertical-align: -0.12em;
      background: var(--accent);
      border-radius: 1px;
      animation: caret-blink 1s step-end infinite;
    }
    @keyframes caret-blink {
      50% { opacity: 0; }
    }
    .chat-thinking {
      position: absolute;
      inset: 0 auto auto 0;
      display: inline-flex;
      align-items: center;
      gap: 10px;
      color: var(--muted);
      font-size: 0.95rem;
      opacity: 0;
      transform: translateY(4px);
      pointer-events: none;
      transition: opacity 0.28s ease, transform 0.28s ease;
    }
    .ask-reply.is-thinking .chat-thinking {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    .chat-thinking .orbit-logo {
      color: var(--accent);
      display: block;
    }

    /* —— Beta / contact —— */
    .beta {
      max-width: 640px;
      margin: 0 auto;
    }
    .beta-card {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: var(--radius-card);
      padding: clamp(22px, 4vw, 32px);
    }
    .form-grid {
      display: grid;
      gap: 16px;
    }
    @media (min-width: 640px) {
      .form-grid.two { grid-template-columns: 1fr 1fr; }
    }
    .field { display: grid; gap: 6px; }
    .field label {
      font-size: 0.88rem;
      font-weight: 600;
    }
    .field .hint {
      font-size: 0.8rem;
      color: var(--muted);
      font-weight: 400;
    }
    .field input,
    .field select,
    .field textarea {
      width: 100%;
      min-height: 44px;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius-control);
      background: var(--bg);
      color: var(--ink);
    }
    .field select {
      appearance: none;
      -webkit-appearance: none;
      height: 44px;
      min-height: 44px;
      padding: 0 40px 0 12px;
      line-height: 44px;
      background-color: var(--bg);
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B5643' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 12px center;
      background-size: 14px;
      cursor: pointer;
    }
    .field textarea { min-height: 96px; resize: vertical; line-height: 1.5; padding-top: 10px; }
    .field input:focus,
    .field select:focus,
    .field textarea:focus {
      outline: 2px solid var(--second);
      outline-offset: 1px;
      border-color: var(--second);
    }
    .hp-field {
      position: absolute;
      left: -10000px;
      top: auto;
      width: 1px;
      height: 1px;
      overflow: hidden;
    }
    .form-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 12px;
      margin-top: 4px;
    }
    .form-note { font-size: 0.85rem; color: var(--muted); }
    .form-alert {
      display: none;
      margin-top: 14px;
      padding: 12px 14px;
      border-radius: var(--radius-control);
      border: 1px solid var(--line);
      background: color-mix(in srgb, var(--good) 12%, var(--surface));
      color: var(--ink);
      font-size: 0.92rem;
    }
    .form-alert.show { display: block; }

    footer {
      padding: 28px var(--gutter) 40px;
      color: var(--muted);
      font-size: 0.9rem;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      gap: 12px;
      border-top: 1px solid var(--line);
    }
    footer .proto-tag {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      letter-spacing: 0.04em;
    }
