/* ============================================================
   AJProd — Shared Design System (single source of truth)
   Warm-dark editorial. Used by homepage + every tool route so
   no page ever visually switches brand. Tokens copied verbatim
   from the homepage (the canonical reference).
   Fonts: load via <link> to Fontshare in each page <head>:
   https://api.fontshare.com/v2/css?f[]=boska@400,500,700&f[]=satoshi@300,400,500,700&display=swap
   ============================================================ */

/* ── Design tokens (DARK = default) ── */
:root {
  /* type scale */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);

  /* spacing */
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem;
  --space-4: 1rem;   --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem;   --space-10: 2.5rem; --space-12: 3rem;
  --space-16: 4rem;  --space-20: 5rem;   --space-24: 6rem;

  /* radius */
  --radius-sm: .375rem; --radius-md: .5rem;
  --radius-lg: .75rem;  --radius-xl: 1rem; --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;

  /* fonts */
  --font-display: 'Boska', 'Georgia', serif;
  --font-body: 'Satoshi', 'Inter', -apple-system, sans-serif;

  /* colors — warm dark */
  --color-bg:              #141210;
  --color-surface:         #1a1816;
  --color-surface-2:       #1f1d1b;
  --color-surface-offset:  #252220;
  --color-surface-dynamic: #2e2b28;
  --color-divider:         #302d2a;
  --color-border:          #3a3733;
  --color-text:            #e8e5e0;
  --color-text-muted:      #8a8783;
  --color-text-faint:      #5a5754;
  --color-text-inverse:    #141210;

  --color-primary:         #3da69c;
  --color-primary-hover:   #2d8f85;
  --color-primary-active:  #1f7870;
  --color-primary-highlight: #1e3535;

  --color-amber:           #d4933a;
  --color-amber-hover:     #b8782a;
  --color-amber-highlight: #3d2d1a;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.45);
  --shadow-glow: 0 0 20px oklch(0.55 0.12 190 / 0.15);
}

/* explicit light toggle */
[data-theme="light"] {
  --color-bg: #f5f3ef; --color-surface: #f9f7f4; --color-surface-2: #fdfcfb;
  --color-surface-offset: #eeebe6; --color-surface-dynamic: #e6e3dd;
  --color-divider: #dbd8d2; --color-border: #d0cdc6;
  --color-text: #26231c; --color-text-muted: #706d67; --color-text-faint: #aaa8a3;
  --color-text-inverse: #f9f7f4;
  --color-primary: #1a7a72; --color-primary-hover: #156560;
  --color-primary-active: #104f4b; --color-primary-highlight: #cde5e3;
  --color-amber: #b57228; --color-amber-hover: #9a5e1e; --color-amber-highlight: #f0dfc7;
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.09);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
  --shadow-glow: 0 0 20px oklch(0.45 0.1 190 / 0.12);
}
/* auto light when no explicit theme set */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg: #f5f3ef; --color-surface: #f9f7f4; --color-surface-2: #fdfcfb;
    --color-surface-offset: #eeebe6; --color-surface-dynamic: #e6e3dd;
    --color-divider: #dbd8d2; --color-border: #d0cdc6;
    --color-text: #26231c; --color-text-muted: #706d67; --color-text-faint: #aaa8a3;
    --color-text-inverse: #f9f7f4;
    --color-primary: #1a7a72; --color-primary-hover: #156560;
    --color-primary-active: #104f4b; --color-primary-highlight: #cde5e3;
    --color-amber: #b57228; --color-amber-hover: #9a5e1e; --color-amber-highlight: #f0dfc7;
    --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
    --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.09);
    --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
    --shadow-glow: 0 0 20px oklch(0.45 0.1 190 / 0.12);
  }
}

/* ── Base reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
}
img, svg { display: block; max-width: 100%; height: auto; }
ul { list-style: none; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { text-wrap: balance; line-height: 1.15; font-family: var(--font-display); }
p, li { text-wrap: pretty; }

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
::selection { background: oklch(from var(--color-primary) l c h / 0.25); color: var(--color-text); }

a, button, [role="button"], input, select, textarea {
  transition: color var(--transition-interactive), background var(--transition-interactive),
              border-color var(--transition-interactive), box-shadow var(--transition-interactive),
              opacity var(--transition-interactive), transform var(--transition-interactive);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Skip link ── */
.skip-link {
  position: absolute; top: -100px; left: var(--space-4); z-index: 9999;
  background: var(--color-primary); color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 600;
}
.skip-link:focus { top: var(--space-4); }

/* ── Containers ── */
.container { max-width: var(--content-default); margin-inline: auto; padding-inline: clamp(var(--space-4), 4vw, var(--space-12)); }
.container--wide { max-width: var(--content-wide); margin-inline: auto; padding-inline: clamp(var(--space-4), 4vw, var(--space-12)); }
.container--narrow { max-width: var(--content-narrow); margin-inline: auto; padding-inline: clamp(var(--space-4), 4vw, var(--space-12)); }

/* ══════════════ NAVIGATION ══════════════ */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.06); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px;
  max-width: var(--content-wide); margin-inline: auto; padding-inline: clamp(var(--space-4), 4vw, var(--space-12)); }
.nav__logo { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--color-text); }
.nav__logo svg { color: var(--color-primary); }
.nav__links { display: flex; align-items: center; gap: var(--space-8); }
.nav__links a { font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted); }
.nav__links a:hover { color: var(--color-text); }
.nav__actions { display: flex; align-items: center; gap: var(--space-3); }
.nav__login { font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted); }
.nav__login:hover { color: var(--color-text); }
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: var(--radius-full); color: var(--color-text-muted); border: 1px solid oklch(from var(--color-text) l c h / 0.1); }
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-offset); }
.nav__mobile-toggle { display: none; align-items: center; justify-content: center; width: 36px; height: 36px; color: var(--color-text-muted); }
.nav__mobile-menu { display: none; position: fixed; top: 64px; left: 0; right: 0; background: var(--color-surface);
  border-bottom: 1px solid var(--color-border); padding: var(--space-6) clamp(var(--space-4), 4vw, var(--space-12)); z-index: 99; }
.nav__mobile-menu.is-open { display: block; }
.nav__mobile-menu a { display: block; font-size: var(--text-base); font-weight: 500; color: var(--color-text-muted);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--color-divider); }
.nav__mobile-menu a:last-child { border-bottom: none; }
.nav__mobile-menu a:hover { color: var(--color-text); }
@media (max-width: 768px) { .nav__links { display: none; } .nav__mobile-toggle { display: flex; } }

/* ══════════════ BUTTONS ══════════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-6); font-size: var(--text-sm); font-weight: 600;
  border-radius: var(--radius-md); white-space: nowrap; }
.btn--primary { background: var(--color-primary); color: var(--color-text-inverse); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-md), var(--shadow-glow); transform: translateY(-1px); }
.btn--primary:active { background: var(--color-primary-active); transform: none; }
.btn--secondary { background: var(--color-surface-offset); color: var(--color-text); border: 1px solid var(--color-border); }
.btn--secondary:hover { background: var(--color-surface-dynamic); border-color: var(--color-text-muted); }
.btn--ghost { color: var(--color-text-muted); border: 1px solid var(--color-border); }
.btn--ghost:hover { color: var(--color-text); background: var(--color-surface-offset); }
.btn--amber { background: var(--color-amber); color: #fff; }
.btn--amber:hover { background: var(--color-amber-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); border-radius: var(--radius-lg); }
.btn--cta-nav { background: var(--color-primary); color: var(--color-text-inverse); padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm); font-weight: 600; border-radius: var(--radius-md); }
.btn--cta-nav:hover { background: var(--color-primary-hover); transform: translateY(-1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none; }

/* ══════════════ FOOTER ══════════════ */
.footer { padding-block: var(--space-12); margin-top: var(--space-24); border-top: 1px solid var(--color-divider); }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }
.footer__logo { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--color-text); }
.footer__logo span { color: var(--color-primary); }
.footer__links { display: flex; gap: var(--space-6); flex-wrap: wrap; }
.footer__links a { font-size: var(--text-sm); color: var(--color-text-muted); }
.footer__links a:hover { color: var(--color-text); }
.footer__line { margin-top: var(--space-6); font-size: var(--text-sm); color: var(--color-text-faint); }

/* ══════════════════════════════════════════════════════════
   TOOL SHELL — shared structure for every tool route
   Hero · Input panel · Analyze · Result panel · actions · upgrade
   ══════════════════════════════════════════════════════════ */
.tool-main { padding-top: calc(64px + var(--space-12)); padding-bottom: var(--space-12); }

.tool-hero { text-align: center; max-width: var(--content-narrow); margin-inline: auto; margin-bottom: var(--space-12); }
.tool-eyebrow { display: inline-block; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 2px;
  font-weight: 600; color: var(--color-primary); margin-bottom: var(--space-3); }
.tool-hero h1 { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
.tool-hero p { font-size: var(--text-lg); color: var(--color-text-muted); margin-inline: auto; }

.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); align-items: start; }
@media (max-width: 768px) { .tool-grid { grid-template-columns: 1fr; } }

.panel { background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: clamp(var(--space-5), 4vw, var(--space-8)); box-shadow: var(--shadow-sm); }
.panel__title { font-family: var(--font-display); font-size: var(--text-lg); margin-bottom: var(--space-4); }
.panel__hint { font-size: var(--text-sm); color: var(--color-text-faint); margin-bottom: var(--space-5); }

/* form controls */
.field { margin-bottom: var(--space-5); }
.field > label { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted);
  letter-spacing: .2px; margin-bottom: var(--space-2); }
.input, .textarea, .select {
  width: 100%; font-family: var(--font-body); font-size: var(--text-base); color: var(--color-text);
  background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); line-height: 1.5; }
.textarea { min-height: 120px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--color-text-faint); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-highlight); outline: none; }

.tool-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-2); }

/* result panel + empty state */
.result-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; min-height: 240px; color: var(--color-text-faint); gap: var(--space-3); }
.result-empty svg, .result-empty i { color: var(--color-primary); opacity: .6; }

/* score badge / meter */
.score-badge { display: inline-flex; align-items: baseline; gap: var(--space-1); font-family: var(--font-display);
  font-weight: 700; }
.score-badge__num { font-size: var(--text-2xl); color: var(--color-primary); line-height: 1; }
.score-badge__den { font-size: var(--text-base); color: var(--color-text-faint); }
.score-row { margin-bottom: var(--space-4); }
.score-row__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-2); }
.score-row__label { font-size: var(--text-sm); font-weight: 600; color: var(--color-text); }
.score-row__val { font-family: var(--font-display); font-size: var(--text-sm); color: var(--color-primary); }
.meter { height: 8px; background: var(--color-surface-dynamic); border-radius: var(--radius-full); overflow: hidden; }
.meter__fill { height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-amber)); border-radius: var(--radius-full); transition: width .5s cubic-bezier(0.16,1,0.3,1); }
.score-row__note { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-2); }

/* signal chips */
.signal { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); margin-bottom: var(--space-2); }
.signal--up { color: var(--color-primary); }
.signal--down { color: var(--color-amber); }
.chip { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs);
  background: var(--color-surface-offset); border: 1px solid var(--color-border); color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); }

/* upgrade nudge / paywall preview */
.upgrade-nudge { margin-top: var(--space-6); background: var(--color-primary-highlight);
  border: 1px solid color-mix(in oklab, var(--color-primary) 40%, transparent);
  border-radius: var(--radius-lg); padding: var(--space-5); display: flex; gap: var(--space-4);
  align-items: center; justify-content: space-between; flex-wrap: wrap; }
.upgrade-nudge__text { font-size: var(--text-sm); color: var(--color-text); }
.locked { position: relative; }
.locked__blur { filter: blur(6px); pointer-events: none; user-select: none; opacity: .6; }
.locked__overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-3); text-align: center; }

/* section headline helpers (shared with homepage look) */
.section__headline { font-family: var(--font-display); font-size: var(--text-xl); text-align: center; margin-bottom: var(--space-3); }
.section__sub { color: var(--color-text-muted); text-align: center; margin-inline: auto; max-width: 56ch; }

/* utility */
.is-hidden { display: none !important; }
.fade-in { opacity: 0; transform: translateY(12px); animation: fadeIn .6s forwards; }
@keyframes fadeIn { to { opacity: 1; transform: none; } }
