/*
 * Ask Clueless — the shared look: fonts, tokens, the Dark and Light ramps, base, mark, Button, Field.
 *
 * Every page of askclueless.com loads this first: the chat app (app.css) and the site pages (site.css).
 * Values are the Clueless design system's own (ACMAGI7/Clueless-MACOS-ARM64 desktop/src/styles/tokens.css,
 * docs/design/CLUELESS-DESIGN-RULES.md), at the Large interface size (DECISIONS W.1). Token names are the
 * app's. One source for the site (rules §18.2): a value changes here, not in a page's stylesheet.
 */
@font-face {
  font-family: "Google Sans Flex Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 1 1000;
  src: url("/fonts/google-sans-flex-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Google Sans Flex Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 1 1000;
  src: url("/fonts/google-sans-flex-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Thai (rules §4.4, audit M9): Noto Sans Thai Variable, Thai subset only, our own file (no font CDN). Listed second
   in --font-sans, so only Thai glyphs (and the ฿ sign) fall through to it; the browser fetches it only for a page
   that shows Thai. */
@font-face {
  font-family: "Noto Sans Thai Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/noto-sans-thai-thai-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

/* ── 1. The absolutes (tokens.css §1, Large §1b) ──────────────────────────── */
:root {
  --tint: #9fe870;
  --tint-pressed: #8edb5b;
  --on-tint: #163300;
  --forest: #163300;
  --logo-plate: #2a5210;
  --logo-ink: #bbf8a0;
  --white: #fff;
  --ink-on-white: #0e0f0c;

  --r-row: 14px;
  --r-card: 20px;
  --r-panel: 28px;
  --r-surface: 32px;
  --r-chip: 99px;
  --r-control: 999px;

  --sp-2: 2px;
  --sp-4: 4px;
  --sp-6: 6px;
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-20: 20px;
  --sp-24: 24px;
  --sp-32: 32px;
  --sp-48: 48px;
  --grid-size: 36px;

  /* the Large control ladder (§6.2): icon controls --ctl-*, text controls --ctl-text-* */
  --ctl-md: 34px;
  --ctl-text-sm: 34px;
  --ctl-text-md: 40px;
  --ctl-text-lg: 44px;
  --btn-px-sm: 18px;
  --btn-px-md: 20px;
  --btn-px-lg: 22px;
  --btn-fs-sm: 13px;
  --btn-fs-md: 13px;
  --btn-fs-lg: 14px;
  --sb-row-h: 36px;
  --sb-row-px: 12px;

  /* the Large type ramp (§4.2) */
  --text-body: 14px;
  --text-body-lh: 22px;
  --text-title-xs: 16px;
  --text-title-xs-lh: 22px;
  --text-meta: 12px;
  --text-meta-lh: 16px;
  --text-meta-sm: 11px;
  --kicker-size: 10px;
  --heading-weight: 600;

  --font-sans: "Google Sans Flex Variable", "Noto Sans Thai Variable", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --dur-fast: 180ms;
  --dur-micro: 240ms;
  --dur-dialog: 350ms;
  --dur-slow: 450ms;
  --press-scale: 0.97;
  --lift-1: -1px;

  --z-raised: 1;
  --z-drawer: 55;

  /* Measured from claude.ai (docs/style-from-claude.md) */
  --nav-h: 84px;
  --page-px: 64px;
  --login-col: 404px;
  --rail-w: 288px;
  --thread-w: 672px;

  /* Added for the site pages (rules §5.1, §6.2, §7.1, §8.1, §10.2, §3.3; DECISIONS W.7-W.10) */
  --sp-40: 40px;
  --sp-80: 80px;
  --r-bar: 4px;
  --r-check: 8px;
  --r-tile: 12px;
  --r-card-lg: 24px;
  --ctl-text-xl: 48px;
  --btn-px-xl: 28px;
  --btn-fs-xl: 15px;
  --lift-2: -2px;
  --dur-instant: 120ms;
  --dur-base: 350ms;
  --dur-hero: 700ms;
  --dur-exit: 160ms;
  --stagger: 80ms;
  --tint-wash: rgba(159, 232, 112, 0.16);
  --tint-line: rgba(159, 232, 112, 0.3);
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --ui-maxw: 1180px;
}

/* ── 2. The ramp: Dark (tokens.css §2), the default, and the login view in every look (DEC 0.8) ── */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --chrome: #101010;
  --sand: #202020;
  --sand-raised: #292929;
  --surface-raise: #303030;
  --sand-line: rgba(255, 255, 255, 0.08);
  --sand-line-2: rgba(255, 255, 255, 0.16);
  --text-1: #ffffff;
  --text-2: #d6d6d6;
  --text-3: #a2a2a2;
  --text-disabled: rgba(255, 255, 255, 0.36);
  --link: #9fe870;
  --link-hover: #c6f2a8;
  --destructive-ink: #ed9285;
  --fill-3: rgba(237, 238, 235, 0.08);
  --glass-raised: color-mix(in srgb, var(--text-1) 7%, transparent);
  --glass-line: color-mix(in srgb, var(--text-1) 14%, transparent);
  --rail-wash: 255 255 255;
  --rail-ink: #fff;
  --rail-selected: #303030;
  --rail-selected-ink: #ffffff;
  --tab-selected: #303030;
  --grid-line: rgba(237, 238, 235, 0.035);
  --cl-scrim: rgba(22, 19, 13, 0.5);
  --elev-2: 0 4px 12px rgba(0, 0, 0, 0.22);
  --elev-3: 0 12px 30px rgba(0, 0, 0, 0.28);
  --elev-4: 0 24px 60px rgba(0, 0, 0, 0.45);
  --focus-color: var(--tint);
  /* Google's Dark sign-in button (branding guidelines): fill, stroke, ink, and an 8% ink state layer on hover */
  --g-fill: #131314;
  --g-stroke: #8e918f;
  --g-ink: #e3e3e3;
  --g-hover: color-mix(in srgb, #e3e3e3 8%, #131314);
  color: var(--text-1);
}

/* Light (tokens.css §5), when the system asks for it. The login view stays Dark: app.js stamps
   data-theme="dark" on <html> while it shows (DEC 0.8: pre-app screens are Dark in every look). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --chrome: #e6e6ea;
    --sand: #dddde3;
    --sand-raised: #f8f8fb;
    --surface-raise: #ffffff;
    --sand-line: rgba(20, 20, 30, 0.08);
    --sand-line-2: rgba(20, 20, 30, 0.15);
    --text-1: #111114;
    --text-2: #3d3d43;
    /* WCAG AA on every Light ground down to #cfcfd5 (audit M8): text-3 4.99:1 there, link 5.27:1 on --sand */
    --text-3: #52525a;
    --text-disabled: rgba(17, 17, 20, 0.36);
    --link: #256510;
    --link-hover: #1d500c;
    --destructive-ink: #a8200d;
    --fill-3: rgba(0, 0, 0, 0.05);
    --rail-wash: 0 0 0;
    --rail-ink: #57565b;
    --rail-selected: #ffffff;
    --rail-selected-ink: #111114;
    --tab-selected: #ffffff;
    --grid-line: rgba(0, 0, 0, 0.045);
    --cl-scrim: rgba(0, 0, 0, 0.28);
    /* the shadows (--elev-*) are the same in both looks, as in the app */
    /* §14.1's fix: lime is 1.1:1 on the Light page, forest is 10:1 or more */
    --focus-color: var(--forest);
    /* Google's Light sign-in button */
    --g-fill: #ffffff;
    --g-stroke: #747775;
    --g-ink: #1f1f1f;
    --g-hover: color-mix(in srgb, #1f1f1f 8%, #ffffff);
  }
}

/* ── 3. Base ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { background: var(--sand); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--sand);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
h1, h2, h3 { font-weight: var(--heading-weight); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }
[hidden] { display: none !important; }
/* Thai (rules §4.4): no tracking; stacked vowels and tone marks get the larger of the Latin line height and
   ceil(size × k), k = 1.5 to 17 px, 1.4 from 22 px. The chat tags text that holds Thai lang="th" (app.js). */
:lang(th) { letter-spacing: 0; }
.meta:lang(th), .fine:lang(th), .msg-tool:lang(th) { line-height: 18px; }

/* ── 4. The mark lockup (§2.2): two-tone on the app ground, the dot apart from the figure ── */
.lockup { display: inline-flex; align-items: center; gap: 8px; color: var(--text-1); text-decoration: none; }
.lockup:hover { color: var(--text-1); }
.mark { width: 24px; height: 24px; stroke: none; }
.mark .plate { fill: var(--logo-plate); }
.mark .ink { fill: var(--logo-ink); filter: drop-shadow(1.71px 2.14px 2.14px rgba(8, 33, 34, 0.34)); }
.mark-lg { width: 44px; height: 44px; }
.mark-lg .ink { filter: drop-shadow(3.14px 3.93px 3.93px rgba(8, 33, 34, 0.34)); }
.wordmark { font-size: 20px; line-height: 24px; font-weight: 600; letter-spacing: -0.015em; }

/* ── 5. Button (§11.1): the pill. primary = the one green commit; outline = everything else ── */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--ctl-text-md);
  padding: 0 var(--btn-px-md);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-control);
  background: var(--glass-raised);
  color: var(--text-1);
  font-size: var(--btn-fs-md);
  font-weight: 600;
  line-height: 1;
  letter-spacing: normal;
  white-space: nowrap;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.pill:active:not(:disabled) { transform: scale(var(--press-scale)); }
.pill:disabled { opacity: 0.45; }
.pill svg { width: 18px; height: 18px; stroke-width: 1.7; }
.pill-primary { background: var(--tint); border-color: transparent; color: var(--on-tint); box-shadow: var(--elev-2); }
.pill-secondary, .pill-soft { background: var(--glass-raised); border-color: var(--glass-line); color: var(--text-1); }
.pill-ghost { background: none; border-color: transparent; color: var(--text-3); }
@media (hover: hover) {
  .pill:hover:not(:disabled) { transform: translateY(var(--lift-1)); }
  .pill-primary:hover:not(:disabled) { background: var(--tint-pressed); color: var(--on-tint); }
  .pill-secondary:hover:not(:disabled), .pill-soft:hover:not(:disabled) { border-color: var(--text-3); color: var(--text-1); }
  .pill-ghost:hover:not(:disabled) { background: var(--glass-raised); color: var(--text-1); }
}
.pill-sm { height: var(--ctl-text-sm); padding: 0 var(--btn-px-sm); font-size: var(--btn-fs-sm); gap: 7px; }
.pill-tall { height: var(--ctl-text-lg); padding: 0 var(--btn-px-lg); font-size: var(--btn-fs-lg); gap: 9px; }
.pill-block { display: flex; width: 100%; padding-left: 0; padding-right: 0; }
/* Sign in with Google (developers.google.com/identity/branding-guidelines, 2026-07): Google's own Light or Dark
   button, never our green. Fill, 1px stroke and ink are Google's (--g-*); Google Sans Medium 14/20 (Google Sans
   Flex at 500); the standard colour G (public/img/google-g.png, Google's g-logo.png) at 20px, 10px from the label.
   The pill is one of Google's shapes. After the sizes, so its own gap and type win. */
.pill-google { background: var(--g-fill); border-color: var(--g-stroke); color: var(--g-ink); font-weight: 500; font-size: 14px; line-height: 20px; gap: 10px; }
.pill-google img { width: 20px; height: 20px; flex: none; }
@media (hover: hover) {
  .pill-google:hover:not(:disabled) { background: var(--g-hover); border-color: var(--g-stroke); color: var(--g-ink); }
}

/* IconButton (§11.2): a circle, ghost in chrome */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--ctl-md); height: var(--ctl-md);
  border: 0; border-radius: 50%; background: transparent; color: var(--text-3);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.icon-btn svg { width: 18px; height: 18px; stroke-width: 1.7; }
.icon-btn:active { transform: scale(var(--press-scale)); }
@media (hover: hover) { .icon-btn:hover { background: var(--glass-raised); color: var(--text-1); } }

/* Field (§11.10): label above, a pill box, the border brightens on focus, the ring only on Tab */
.field { display: flex; flex-direction: column; gap: var(--sp-6); text-align: left; }
.field > span { font-size: var(--text-meta); line-height: var(--text-meta-lh); font-weight: 500; color: var(--text-2); }
.field input {
  height: var(--ctl-text-lg);
  padding: 0 16px;
  border: 1px solid var(--sand-line-2);
  border-radius: var(--r-control);
  background: var(--glass-raised);
  color: var(--text-1);
  font-size: 16px; /* 16 or more, or iOS zooms the page (§6.4) */
  font-weight: 400;
  transition: border-color var(--dur-fast) var(--ease);
}
.field input[type="password"] { font-family: var(--font-system); }
.field input::placeholder { color: var(--text-3); }
@media (hover: hover) { .field input:hover { border-color: var(--text-3); } }
.field input:focus { border-color: var(--text-1); outline: none; } /* focus-ok: the border brightens; Tab adds the ring below */
.field input:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }

/* Sign-in parts the login page and the home hero card share (W.13): the "OR" line, and sign-in links as plain
   text (DEC 7.3), a button on the login page and a link on the home page */
.or { display: flex; align-items: center; gap: var(--sp-12); margin: 0; font-size: var(--text-meta); line-height: var(--text-meta-lh); color: var(--text-3); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--sand-line); }
.text-btn {
  align-self: center; border: 0; background: none; padding: 2px 4px; color: var(--text-3);
  font-size: var(--text-meta); line-height: var(--text-meta-lh); font-weight: 500; text-decoration: none;
}
.text-btn:hover { color: var(--text-3); }
@media (hover: hover) { .text-btn:hover { color: var(--text-1); } }

.badge {
  display: inline-flex; align-items: center; margin-left: auto; padding: 0 8px; height: 20px;
  border-radius: var(--r-chip); background: var(--fill-3);
  font-size: var(--kicker-size); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3);
}
.badge-lg { margin: 0 auto var(--sp-12); }

/* Reduced motion (§10.4): every duration to zero, no press or lift. Pages add their own animation: none. */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-instant: 0ms; --dur-fast: 0ms; --dur-micro: 0ms; --dur-base: 0ms; --dur-dialog: 0ms; --dur-slow: 0ms; --dur-hero: 0ms; --dur-exit: 0ms; --stagger: 0ms; --press-scale: 1; --lift-1: 0px; --lift-2: 0px; }
}
