/* Tailr design system - tokens + shared components for tailrcrm.com (home, every site page, sign-up).
   One file, no build step. Every colour, size, radius, shadow and motion value on the site comes from a token below;
   components never hard-code values. Light and dark themes swap tokens only (data-theme on <html>, or the visitor's
   system setting). White-label: swap --brand-* tokens.
   Identity: "the receipt" - ink on warm paper, one ember accent, monospace for sources and dates (the proof). */

/* ------------------------------------------------------------------ 1. tokens */
:root {
  /* brand (fixed) */
  --brand-ink: #0b1020;
  --brand-ember: #ff6a1a;
  /* Resources covers + books (site_resources.py): always-dark covers, so the same in both themes */
  --res-navy-1: #1c2c52; --res-navy-2: #101a33; --res-navy-3: #0b1224; --res-ember-2: #ff8a47;
  --bk-navy: #13213f; --bk-cream: #f6efe3; --bk-sand: #eadcc4; --bk-sand-ink: #3a2414; --bk-sand-ac: #c2410c; --bk-slate: #2a3448; --bk-peach: #ffb27a;
  --shelf-1: #d8c4a0; --shelf-2: #b99c6e; --shelf-d1: #3a3326; --shelf-d2: #2a241b;
  --brand-ember-600: #e4570a;
  --brand-ember-700: #b83f00;          /* ember text on light backgrounds: 5.6:1 on white */
  --brand-paper: #fbfaf6;

  /* neutrals */
  --n-0: #ffffff; --n-25: #fbfaf6; --n-50: #f5f4ef; --n-100: #ecebe4; --n-200: #dedcd3; --n-300: #c6c3b8;
  --n-500: #6b6a63; --n-600: #55544e; --n-700: #3a3a36; --n-800: #22231f; --n-900: #14151a; --n-950: #0b1020;

  /* semantic - light */
  --bg: var(--n-25);                    /* page: warm paper */
  --surface: var(--n-0);                /* cards, app windows */
  --surface-2: var(--n-50);             /* insets, table heads */
  --surface-inv: var(--n-950);          /* dark bands */
  --text: var(--n-950);
  --text-2: var(--n-600);               /* 7.1:1 on paper */
  --text-3: var(--n-500);               /* 5.2:1 on paper - small print only */
  --text-inv: #f4f3ee;
  --text-inv-2: #b9b8b0;
  --line: var(--n-200);
  --line-2: var(--n-100);
  --accent: var(--brand-ember);
  --accent-hover: var(--brand-ember-600);
  --on-accent: var(--brand-ink);        /* ink on ember: 6.9:1 (white on ember fails AA) */
  --accent-text: var(--brand-ember-700);
  --accent-soft: #fff1e6;
  --accent-line: #ffd2b3;
  --ok: #157f3b; --ok-soft: #e7f6ec;
  --warn: #9a5b00; --warn-soft: #fff4dc;
  --bad: #b42318; --bad-soft: #fdeceb;
  --focus: #2f6bff;
  /* text on the always-dark ink bands (call-to-action box, dark sections): the same in both themes */
  --on-ink: #f4f3ee; --on-ink-2: #c6cbd8; --on-ink-accent: #ffb27a;
  --inverse-bg: var(--brand-ink);       /* the always-dark bands; in dark mode a lifted ink so they still read as a band */
  --header-bg: rgba(251,250,246,.86);

  /* type */
  --font-sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: .75rem;      /* 12 */
  --fs-sm: .875rem;     /* 14 */
  --fs-md: 1rem;        /* 16 */
  --fs-lg: 1.125rem;    /* 18 */
  --fs-xl: clamp(1.2rem, 1.1rem + .4vw, 1.375rem);
  --fs-2xl: clamp(1.45rem, 1.2rem + 1vw, 1.875rem);
  --fs-3xl: clamp(1.8rem, 1.3rem + 2vw, 2.625rem);
  --fs-4xl: clamp(2.3rem, 1.5rem + 3.4vw, 3.75rem);
  --fs-5xl: clamp(2.6rem, 1.4rem + 5vw, 4.75rem);
  --fw-reg: 400; --fw-med: 550; --fw-semi: 650; --fw-bold: 750; --fw-black: 820;
  --lh-tight: 1.04; --lh-snug: 1.2; --lh-body: 1.6;
  --tracking-tight: -.035em; --tracking-snug: -.015em; --tracking-caps: .08em;

  /* space (4px base) */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.25rem; --s-6: 1.5rem; --s-7: 2rem;
  --s-8: 2.5rem; --s-9: 3rem; --s-10: 4rem; --s-11: 5rem; --s-12: 7rem;
  --section: clamp(3.5rem, 2rem + 6vw, 7rem);       /* vertical rhythm between page sections */
  --gutter: clamp(1rem, .5rem + 2vw, 2rem);
  --w-page: 1200px; --w-text: 720px; --w-narrow: 820px;

  /* radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;

  /* elevation */
  --sh-1: 0 1px 2px rgba(11,16,32,.06);
  --sh-2: 0 1px 2px rgba(11,16,32,.05), 0 8px 24px rgba(11,16,32,.08);
  --sh-3: 0 2px 6px rgba(11,16,32,.06), 0 30px 80px rgba(11,16,32,.16);
  --sh-accent: 0 8px 24px rgba(255,106,26,.28);

  /* motion */
  --dur-1: 120ms; --dur-2: 220ms; --dur-3: 480ms;
  --ease: cubic-bezier(.2,.7,.2,1);

  --z-header: 30; --z-pop: 40;
  color-scheme: light;
}

/* dark: the visitor's choice (data-theme) wins; otherwise follow the system */
:root[data-theme="dark"] {
  --bg: #0b0e17; --surface: #131826; --surface-2: #1a2030; --surface-inv: #f4f3ee;
  --text: #f1f0ea; --text-2: #b5b6bd; --text-3: #9a9ba3; --text-inv: #0b1020; --text-inv-2: #3a3a36;
  --line: #262c3d; --line-2: #1d2231;
  --accent-text: #ff8a47; --accent-soft: #2a1a10; --accent-line: #5a2f14;
  --ok: #4ade80; --ok-soft: #10281a; --warn: #fbbf24; --warn-soft: #2a2110; --bad: #f87171; --bad-soft: #2c1414;
  --focus: #7aa2ff; --header-bg: rgba(11,14,23,.82); --inverse-bg: #1c2436;
  --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); --sh-3: 0 2px 6px rgba(0,0,0,.4), 0 30px 80px rgba(0,0,0,.55);
  color-scheme: dark;
}
/* Shawn, 2 Dec 2026: the site is light by default; the system dark setting no longer switches it (only the theme switch does). */
@media not all {
  :root:not([data-theme="light"]) {
    --bg: #0b0e17; --surface: #131826; --surface-2: #1a2030; --surface-inv: #f4f3ee;
    --text: #f1f0ea; --text-2: #b5b6bd; --text-3: #9a9ba3; --text-inv: #0b1020; --text-inv-2: #3a3a36;
    --line: #262c3d; --line-2: #1d2231;
    --accent-text: #ff8a47; --accent-soft: #2a1a10; --accent-line: #5a2f14;
    --ok: #4ade80; --ok-soft: #10281a; --warn: #fbbf24; --warn-soft: #2a2110; --bad: #f87171; --bad-soft: #2c1414;
    --focus: #7aa2ff; --header-bg: rgba(11,14,23,.82); --inverse-bg: #1c2436;
    --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); --sh-3: 0 2px 6px rgba(0,0,0,.4), 0 30px 80px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ 2. base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body.ds { margin: 0; background: var(--bg); color: var(--text); font: var(--fw-reg) var(--fs-md)/var(--lh-body) var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.ds img, .ds svg, .ds video { max-width: 100%; }
.ds a { color: inherit; text-underline-offset: 3px; }
.ds :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ds h1, .ds h2, .ds h3 { font-family: var(--font-display); letter-spacing: var(--tracking-snug); line-height: var(--lh-snug); margin: 0; text-wrap: balance; }
.ds p { text-wrap: pretty; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--surface); color: var(--text); padding: var(--s-2) var(--s-4); border-radius: var(--r-md); box-shadow: var(--sh-2); }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: 0; }

.container { width: 100%; max-width: var(--w-page); margin-inline: auto; padding-inline: var(--gutter); }
.container.text { max-width: calc(var(--w-text) + 2 * var(--gutter)); }
.section { padding-block: var(--section); }
.section.tight { padding-block: calc(var(--section) * .55); }
.band-inv { background: var(--brand-ink); color: #f4f3ee; }
.band-2 { background: var(--surface-2); }

/* ------------------------------------------------------------------ 3. components */
/* button: default / hover / focus / active / disabled / loading */
.btn-t { --_bg: var(--accent); --_fg: var(--on-accent); --_bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 44px; padding: var(--s-3) var(--s-5);
  border: 1px solid var(--_bd); border-radius: var(--r-pill); background: var(--_bg); color: var(--_fg) !important; text-decoration: none;
  font: var(--fw-bold) var(--fs-md)/1.1 var(--font-sans); letter-spacing: -.005em; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease); }
.btn-t:hover { --_bg: var(--accent-hover); }
.btn-t.primary { box-shadow: var(--sh-accent); }
.btn-t:active { transform: translateY(1px); box-shadow: none; }
.btn-t[disabled], .btn-t[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-t.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn-t.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--on-accent); border-right-color: transparent; animation: ds-spin .7s linear infinite; }
.btn-t.lg { min-height: 54px; padding: var(--s-4) var(--s-7); font-size: var(--fs-lg); }
.btn-t.sm { min-height: 36px; padding: var(--s-2) var(--s-4); font-size: var(--fs-sm); }
.btn-t.secondary { --_bg: var(--surface); --_fg: var(--text); --_bd: var(--line); }
.btn-t.secondary:hover { --_bg: var(--surface-2); }
.btn-t.ink { --_bg: var(--brand-ink); --_fg: #f4f3ee; }
.btn-t.ink:hover { --_bg: #232a40; }
.btn-t.link { --_bg: transparent; --_fg: var(--text); padding-inline: var(--s-2); min-height: 44px; text-decoration: underline; text-decoration-thickness: 1px; }
.btn-t.link:hover { --_bg: transparent; text-decoration-thickness: 2px; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

.eyebrow-t { display: inline-flex; align-items: center; gap: var(--s-2); font: var(--fw-bold) var(--fs-xs)/1 var(--font-sans); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--accent-text); }
.eyebrow-t::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }

.chip-t { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  font: var(--fw-med) var(--fs-sm)/1.3 var(--font-sans); color: var(--text-2); white-space: nowrap; }
.chip-t.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.chip-t.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); font-weight: var(--fw-semi); }
.chip-t.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip-t.ink { background: var(--brand-ink); border-color: transparent; color: #f4f3ee; }

.badge-t { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); font: var(--fw-bold) 11px/1.5 var(--font-sans); letter-spacing: .06em; text-transform: uppercase; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.badge-t.soon { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.card-t { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--sh-1); }
.card-t.hover { transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); text-decoration: none; display: block; }
.card-t.hover:hover { border-color: var(--text-3); transform: translateY(-2px); box-shadow: var(--sh-2); }

/* the receipt: the brand's signature surface - paper, perforated edges, mono details */
.receipt-t { --_paper: var(--surface); position: relative; background: var(--_paper); border-radius: var(--r-md); box-shadow: var(--sh-3); padding: var(--s-6) var(--s-6) var(--s-7);
  border: 1px solid var(--line); }
.receipt-t::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 10px;
  background: radial-gradient(circle at 8px -2px, transparent 7px, var(--_paper) 7.5px) 0 0 / 16px 10px repeat-x; filter: drop-shadow(0 1px 0 var(--line)); }
.receipt-t .r-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); padding-bottom: var(--s-3); border-bottom: 1px dashed var(--line); font: var(--fw-semi) var(--fs-xs)/1.4 var(--font-mono); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.receipt-t .r-line { display: grid; grid-template-columns: 26px 1fr; gap: var(--s-3); padding: var(--s-4) 0; border-bottom: 1px dashed var(--line); }
.receipt-t .r-line:last-of-type { border-bottom: 0; }
.receipt-t .r-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font: var(--fw-bold) var(--fs-xs)/1 var(--font-mono); color: var(--text-2); }
.receipt-t .r-line.on .r-n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.receipt-t .r-k { display: block; font: var(--fw-bold) 11px/1.3 var(--font-sans); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.receipt-t .r-v { display: block; font-weight: var(--fw-semi); font-size: var(--fs-md); line-height: 1.35; }
.receipt-t .r-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-2); }

/* app window (product pictures) */
.app-t { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-3); overflow: hidden; }
.app-t .a-bar { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 var(--s-3); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.app-t .a-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.app-t .a-bar span { margin-left: var(--s-2); font: var(--fs-xs)/1 var(--font-mono); color: var(--text-3); }
.app-t .a-bar em { margin-left: auto; font: normal var(--fw-bold) 10px/1 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

/* form fields: default / hover / focus / error / disabled */
.field-t { display: grid; gap: 6px; }
.field-t label { font-weight: var(--fw-semi); font-size: var(--fs-sm); }
.field-t input, .field-t select, .field-t textarea { width: 100%; min-height: 46px; padding: var(--s-3) var(--s-4); font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--n-300); border-radius: var(--r-md); transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.field-t input:hover, .field-t select:hover, .field-t textarea:hover { border-color: var(--text-3); }
.field-t input:focus, .field-t select:focus, .field-t textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-t [aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.field-t input:disabled { opacity: .55; cursor: not-allowed; }
.field-t .hint { font-size: var(--fs-sm); color: var(--text-3); }
.field-t .err { font-size: var(--fs-sm); color: var(--bad); }

/* skeleton (loading) */
.skel-t { background: linear-gradient(90deg, var(--surface-2), var(--line-2), var(--surface-2)); background-size: 200% 100%; animation: ds-skel 1.2s linear infinite; border-radius: var(--r-sm); min-height: 1em; }
@keyframes ds-skel { to { background-position: -200% 0; } }

/* theme switch */
.theme-t { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.theme-t:hover { color: var(--text); border-color: var(--text-3); }
.theme-t svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
