/*
 * Refactor Studio shared system. Marketing pages (site.css) and the signed-in app
 * (app.css) both sit on this file. Keep every custom property name; add, do not rename.
 *
 * World: the slot reel that is also a film reel. Ink field, bone type, one
 * amber for the win and the one action per screen. Archivo (expanded, heavy)
 * is the printed numbers; the same family at normal width is everything read.
 *
 * SCALES
 *   radius   --r-xs 4 (chips, tags)  --r-sm 6 (buttons, fields)  --r 10 (menus, inner panels)
 *            --r-lg 16 (cards, plans)  --r-pill 99
 *   space    --s-1 4  --s-2 8  --s-3 12  --s-4 16  --s-5 24  --s-6 40  --s-7 64   (4px base)
 *   type     --fs-xs .78  --fs-sm .875  --fs-md 1  --fs-lg 1.125  --fs-xl 1.5  --fs-2xl clamp(1.75..2.5)
 *   border   always 1px hairline: var(--line) at rest, var(--line-2) on controls, amber when selected
 *
 * COMPONENTS (class names the other pages can use)
 *   .btn .btn-amber .btn-ghost .btn-sm .btn-lg .btn-block .btn-icon .linkish   buttons, one amber per screen
 *   .field > label + control + .hint + .field-error     one field system. 44px+ controls, amber focus ring.
 *     [aria-invalid=true] on a control draws the error border; .field-error is the inline message under it.
 *     .field.is-saved shows "Saved" via .saved-note.
 *   .kinds / .seg                    chip group / joined segmented control. Markup: fieldset > label > input[type=radio] + span
 *   .badge .badge-amber .badge-bone .badge-danger .badge-quiet     small state words
 *   .menu > summary + .menu-list     details based menu; .menu-label heads a group, .menu-sep splits
 *   .toast / .flash[role=status]     calm confirmation, fixed, fades itself out
 *   .skeleton .skel-line             loading placeholders (opacity pulse, no gradients)
 *   .empty-state > h2 + p + .btn     designed empty state with one next step
 *   .numeral                         heavy expanded tabular numerals for money and multipliers
 *   .eyebrow-label                   small caps label
 *   .stack > * + *                   vertical rhythm helper (--gap)
 *   .stack-rows                      table that becomes stacked row cards under 700px (admin.css)
 */
/* Metric-matched stand-in while Archivo loads, so swapping the real face in moves nothing. */
@font-face { font-family: 'Archivo Fallback'; src: local('Arial'); size-adjust: 104%; ascent-override: 87%; descent-override: 21%; line-gap-override: 0%; }
:root {
  --ink: #0e0d0c;
  --ink-2: #151411;
  --ink-3: #1d1b17;
  --line: rgba(238, 231, 216, 0.12);
  --line-2: rgba(238, 231, 216, 0.22);
  --bone: #eee7d8;
  --bone-2: rgba(238, 231, 216, 0.72);
  --bone-3: rgba(238, 231, 216, 0.62);
  --amber: #ffb23f;
  --amber-2: #ffc56b;
  --amber-ink: #1b1206;
  --amber-glow: rgba(255, 178, 63, 0.16);
  --danger: #ff7a66;
  --danger-ink: #ffd4cc;
  --ink-4: #26231e;

  --display: 'Archivo', 'Archivo Fallback', system-ui, sans-serif;
  --text: 'Archivo', 'Archivo Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-xs: 4px;
  --r-pill: 99px;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 40px; --s-7: 64px;
  --fs-xs: 0.78rem; --fs-sm: 0.875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.5rem; --fs-2xl: clamp(1.75rem, 3.6vw, 2.5rem);
  --tap: 44px;
  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1240px;
  --edge: max(var(--gutter), calc((100% - var(--maxw)) / 2));
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t: 180ms;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font: 400 1rem/1.6 var(--text);
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, video, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3 {
  font-family: var(--display);
  font-variation-settings: 'wdth' 112;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
a { color: var(--bone); text-decoration-color: rgba(255, 178, 63, 0.6); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { color: var(--amber-2); }
::selection { background: var(--amber); color: var(--amber-ink); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
html { scrollbar-color: #3a352d var(--ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #3a352d; border-radius: 10px; border: 2px solid var(--ink); }

.sr, .sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--amber); color: var(--amber-ink); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 600; }
.skip:focus { top: 12px; }
.num, .tabular { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- mark --- */
.pointer { width: 0.72em; height: 0.84em; fill: var(--amber); flex: none; }
/* Logo: the R mark plus the name set live in the same cut as the outlined
   lockup in public/brand (Archivo 800, width 112). Mark = 1.3x cap height. */
.wordmark {
  display: inline-flex; align-items: center; gap: 0.36em;
  font-family: var(--display); font-weight: 800; font-variation-settings: 'wdth' 112;
  letter-spacing: 0; font-size: 1.2rem; line-height: 1;
  text-decoration: none; color: var(--bone); white-space: nowrap;
}
.wordmark:hover { color: var(--bone); }
.brand-mark { height: 0.9em; width: auto; flex: none; fill: currentColor; overflow: visible; }
.brand-mark .bowl { fill: var(--amber); }
@media (max-width: 380px) { .wordmark { font-size: 1.08rem; } }

/* ------------------------------------------------------------- buttons --- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--h); padding: 0 20px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  font: 600 0.95rem/1 var(--text); letter-spacing: 0.005em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn-amber, .btn-chip { background: var(--amber); color: var(--amber-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset; }
.btn-amber:hover, .btn-chip:hover { background: var(--amber-2); color: var(--amber-ink); }
.btn-ghost, .btn-line { background: transparent; color: var(--bone); border-color: var(--line-2); }
.btn-ghost:hover, .btn-line:hover { border-color: rgba(238, 231, 216, 0.5); color: var(--bone); background: rgba(238, 231, 216, 0.04); }
.btn-sm { --h: 40px; padding: 0 14px; font-size: 0.88rem; }
/* On touch screens every button is a full thumb-size target. */
@media (pointer: coarse) { .btn-sm { --h: 44px; } }
.btn-lg { --h: 52px; padding: 0 26px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; transform: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--bone-2); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 0.22em; }
.linkish:hover { color: var(--bone); }
.linkish.danger:hover { color: var(--danger); }
form.inline { display: inline; }

/* -------------------------------------------------------------- fields --- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5) var(--s-4); }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .field legend, .field > span.label { font-size: var(--fs-sm); font-weight: 600; color: var(--bone); }
.opt { font-weight: 400; color: var(--bone-3); }
input, select, textarea {
  width: 100%; min-height: var(--tap);
  background: var(--ink-2); color: var(--bone);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 10px 12px; font: 400 1rem/1.4 var(--text);
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  caret-color: var(--amber);
}
textarea { resize: vertical; min-height: 96px; }
input::placeholder, textarea::placeholder { color: rgba(238, 231, 216, 0.56); }
input:hover, select:hover, textarea:hover { border-color: rgba(238, 231, 216, 0.36); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); background: var(--ink-3); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }
input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true'] { border-color: var(--danger); }
input[aria-invalid='true']:focus, textarea[aria-invalid='true']:focus { box-shadow: 0 0 0 1px var(--danger); }
input[type='checkbox'], input[type='radio'] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--amber); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23eee7d8' stroke-opacity='.7' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.hint { font-size: var(--fs-sm); color: var(--bone-3); line-height: 1.5; }
.hint.center, .center { text-align: center; }
.small { font-size: var(--fs-sm); }
.field-error, .error-inline { color: var(--danger); font-size: var(--fs-sm); margin: 0; }
.saved-note { color: var(--bone-2); font-size: var(--fs-sm); }
.saved-note::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--amber); vertical-align: 1px; }
.flash, .error {
  padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); font-size: 0.95rem;
  border: 1px solid; margin: 0 0 var(--s-4);
}
.flash { border-color: rgba(255, 178, 63, 0.45); background: rgba(255, 178, 63, 0.08); color: var(--bone); }
.error { border-color: rgba(255, 122, 102, 0.5); background: rgba(255, 122, 102, 0.08); color: var(--danger-ink); }
.or { display: flex; align-items: center; gap: var(--s-3); color: var(--bone-3); font-size: var(--fs-sm); margin: var(--s-5) 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 640px) {
  .form { grid-template-columns: 1fr; }
}

/* ------------------------------------------------- chips and segments --- */
.kinds, .seg { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.kinds legend, .seg legend { padding: 0; }
.kinds label, .seg label { position: relative; cursor: pointer; font-size: 0.93rem; color: var(--bone-2); }
.kinds label > input, .seg label > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kinds label > span, .seg label > span {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 var(--s-4);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); text-align: center; line-height: 1.25;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.kinds label:hover > span, .seg label:hover > span { border-color: rgba(238, 231, 216, 0.5); color: var(--bone); }
.kinds label > input:checked + span, .seg label > input:checked + span { background: var(--bone); color: var(--ink); border-color: var(--bone); font-weight: 600; }
.kinds label > input:focus-visible + span, .seg label > input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.kinds label > input:disabled + span { opacity: 0.5; cursor: not-allowed; }
/* Joined: one control with a single outer hairline, the selected segment filled. */
.seg { gap: 0; flex-wrap: nowrap; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--ink-2); overflow: hidden; }
.seg label { flex: 1 1 auto; min-width: 0; }
.seg label > span { width: 100%; white-space: nowrap; border: 0; border-radius: 0; padding: 0 var(--s-3); }
.seg label + label > span { border-left: 1px solid var(--line); }
.seg label:hover > span { background: rgba(238, 231, 216, 0.05); }
.seg label > input:checked + span { background: var(--bone); }
.seg label > input:checked + span, .seg label:has(input:checked) + label > span { border-left-color: transparent; }
.seg label > input:focus-visible + span { outline-offset: -3px; }

/* --------------------------------------------------------------- badge --- */
.badge, .tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 650; line-height: 1;
  padding: 5px 8px; border-radius: var(--r-xs); border: 1px solid var(--line-2); color: var(--bone-2); white-space: nowrap; letter-spacing: 0.02em;
}
.badge-amber, .tag-amber { border-color: rgba(255, 178, 63, 0.55); color: var(--amber-2); }
.badge-bone { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.badge-danger { border-color: rgba(255, 122, 102, 0.5); color: var(--danger-ink); }
.badge-quiet { border-color: var(--line); color: var(--bone-3); }

/* ---------------------------------------------------------------- menu --- */
.menu > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 var(--s-4);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); font: 600 0.9rem var(--text); color: var(--bone);
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { border-color: rgba(238, 231, 216, 0.5); background: rgba(238, 231, 216, 0.04); }
.menu > summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.menu-list {
  position: absolute; z-index: 40; display: grid; padding: 6px; min-width: 240px;
  background: var(--ink-3); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}
.menu-list form { display: contents; }
.menu-list a, .menu-list button {
  display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3); border: 0; border-radius: var(--r-sm); background: none; cursor: pointer;
  font: 500 0.93rem var(--text); color: var(--bone); text-align: left; text-decoration: none; width: 100%;
}
.menu-list a:hover, .menu-list button:hover, .menu-list a:focus-visible, .menu-list button:focus-visible { background: rgba(238, 231, 216, 0.07); color: var(--bone); outline: none; }
.menu-label { margin: 6px var(--s-3) 2px; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bone-3); }
.menu-sep { height: 1px; margin: 6px 0; background: var(--line); }

/* -------------------------------------------- toast, skeleton, empty --- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--s-5) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90;
  max-width: min(92vw, 460px); padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--ink-4); color: var(--bone);
  border: 1px solid var(--line-2); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55); font-size: 0.95rem;
  animation: toast-life 7s var(--ease) both;
}
@keyframes toast-life { 0% { opacity: 0; transform: translate(-50%, 8px); } 6% { opacity: 1; transform: translate(-50%, 0); } 88% { opacity: 1; } 100% { opacity: 0; visibility: hidden; pointer-events: none; } }
.skeleton { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--ink-2); animation: breathe 1.4s ease-in-out infinite alternate; }
.skel-line { display: block; height: 12px; border-radius: var(--r-xs); background: var(--ink-4); }
@keyframes breathe { from { opacity: 0.45; } to { opacity: 0.9; } }
.empty-state { max-width: 560px; padding: var(--s-6) 0; display: grid; gap: var(--s-3); justify-items: start; }
.empty-state h2 { font-size: var(--fs-2xl); margin: 0; }
.empty-state p { color: var(--bone-2); margin: 0; max-width: 46ch; }
.empty-state .btn { margin-top: var(--s-2); }

/* ------------------------------------------------------------- numerals --- */
.numeral { font-family: var(--display); font-weight: 850; font-variation-settings: 'wdth' 118; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1; }
.eyebrow-label { font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bone-3); }
.stack > * + * { margin-top: var(--gap, var(--s-4)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
  .toast { animation-duration: 7s !important; }
}
