/*
 * Storange checkout — design tokens, extracted from Tibor's v13 prototype.
 *
 * 🔴 EVERY VALUE BELOW IS EXACT. Earlier this file carried a mix of exact, derived and
 * INFERRED values, and marked the dark theme "not reconstructed". That was wrong, and the
 * error was mine: the export does not only bind these at runtime, it also SHIPS the two
 * palettes as `light` and `dark` objects inside `themeVars()`. I had stopped at the CSS
 * `var(--token, fallback)` declarations, which cover only five tokens.
 *
 * Several of my inferences were wrong, which is the argument for going back for the source
 * rather than living with a plausible guess:
 *
 *     --surface2   inferred #EDEBE8   actually #F7F6F4   (#EDEBE8 is `desk`, the page ground)
 *     --line       inferred #EDEBE8   actually #E4E0DB
 *     --muted3     see the note below
 *     --accentSoft invented           does not exist in the palette at all
 *
 * These are generated from `themeVars()` rather than transcribed, so there is no copying
 * error between the design and this file.
 *
 * ⚠️ ONE CONFLICT, RESOLVED IN FAVOUR OF THE RUNTIME. The stylesheet declares
 * `var(--muted3, #6E675F)` while `themeVars()` sets `#78716A`. A CSS fallback only applies
 * when the variable is undefined, and it never is — so #78716A is what customers actually
 * saw and is what is used here. Tibor's own hard-coded fallback disagrees with his own
 * theme; worth mentioning to him, but not a reason to render a colour nobody has seen.
 *
 * RADII: `themeVars()` offers two sets and `const soft = true` selects the rounded one.
 * The sharp variant (2/3/4px) is kept as a comment rather than deleted, because it is a
 * deliberate alternative rather than dead code.
 */

:root {
  color-scheme: light dark;

  --desk: #EDEBE8;
  --frame: #FFFFFF;
  --surface: #FFFFFF;
  --surface2: #F7F6F4;
  --surface3: #F1EFEC;
  --tint: #FFF4ED;
  --ink: #201C19;
  --ink2: #4A443E;
  --muted: #6B655F;
  --muted2: #716A63;
  --muted3: #78716A;
  --line: #E4E0DB;
  --line2: #C9C2BA;
  --lineStrong: #989086;
  --accent: #E05A00;
  --accentHover: #C44F00;
  --accentText: #B34700;
  --accentSolid: #BC4B00;
  --accentSolidHover: #A84300;
  --shadow1: rgba(32,28,25,0.06);
  --shadow2: rgba(32,28,25,0.09);

  /* [exact] `themeVars()` does not carry this one, so in the prototype it ALWAYS falls back
   * to the value hard-coded in the stylesheet — which makes that fallback authoritative. */
  --accentTint: rgba(224, 90, 0, 0.06);

  /* soft = true in the prototype. Sharp alternative: 2px / 3px / 4px */
  --r1: 8px;
  --r2: 12px;
  --r3: 16px;
}

/*
 * Dark theme. These are Tibor's real values, not an inversion — note that `tint` becomes a
 * warm brown rather than a tinted grey, and `accentText` LIGHTENS to #FF9052 because the
 * light theme's #B34700 has no contrast on a dark ground. Only the tokens change; no
 * component rule should ever need a dark-specific override.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #0D2C31;
    --frame: radial-gradient(120% 110% at 100% 0%, #0f4e60 0%, #0a3644 45%, #082a35 100%) #082a35;
    --surface: #0D2C31;
    --surface2: #12343A;
    --surface3: #173B42;
    --tint: #37210F;
    --ink: #EEF3F1;
    --ink2: #C6D3D1;
    --muted: #A3B3B1;
    --muted2: #94A5A3;
    --muted3: #829390;
    --line: #1E4147;
    --line2: #2C565D;
    --lineStrong: #55838B;
    --accent: #E05A00;
    --accentHover: #FF6B12;
    --accentText: #FF9052;
    --accentSolid: #BC4B00;
    --accentSolidHover: #A84300;
    --shadow1: rgba(0,0,0,0.35);
    --shadow2: rgba(0,0,0,0.45);
    /* [ours] Tibor has no dark counterpart. A 6 % wash is invisible on #0D2C31, so the
     * alpha is raised to carry the same weight; the hue is unchanged. */
    --accentTint: rgba(224, 90, 0, 0.14);
  }
}

:root[data-theme="dark"] {
  --desk: #0D2C31;
  --frame: radial-gradient(120% 110% at 100% 0%, #0f4e60 0%, #0a3644 45%, #082a35 100%) #082a35;
  --surface: #0D2C31;
  --surface2: #12343A;
  --surface3: #173B42;
  --tint: #37210F;
  --ink: #EEF3F1;
  --ink2: #C6D3D1;
  --muted: #A3B3B1;
  --muted2: #94A5A3;
  --muted3: #829390;
  --line: #1E4147;
  --line2: #2C565D;
  --lineStrong: #55838B;
  --accent: #E05A00;
  --accentHover: #FF6B12;
  --accentText: #FF9052;
  --accentSolid: #BC4B00;
  --accentSolidHover: #A84300;
  --shadow1: rgba(0,0,0,0.35);
  --shadow2: rgba(0,0,0,0.45);
  --accentTint: rgba(224, 90, 0, 0.14);
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/*
 * Focus is specified here rather than left to component CSS: half of checkout traffic is
 * mobile, a visible ring is the only affordance a keyboard or switch user has, and it is
 * the first thing lost when someone writes `outline: none` to tidy a border.
 *
 * ⚠️ The prototype carries `[aria-invalid="true"]:focus-visible { outline: none }`, which
 * strips the ring from precisely the fields that just failed validation. Deliberately not
 * ported.
 */
:focus-visible {
  outline: 2px solid var(--accentText);
  outline-offset: 2px;
}

[aria-invalid="true"] {
  border-color: var(--accentText);
}
