/*
 * Festive Pass — the finance system's "ink & porcelain" language, carried over by hand (docs/design/design-language.md).
 * Porcelain canvas, white surfaces, deep ink for action, the brand's terracotta for the mark and nothing else.
 * No framework: every token below is the same value as in the system's app/globals.css, so the two look like one thing.
 */

@font-face {
  font-family: "Heebo";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/heebo-hebrew.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Heebo";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/heebo-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --canvas: oklch(0.967 0.007 264);
  --background: oklch(0.995 0.002 264);
  --foreground: oklch(0.21 0.03 266);
  --card: oklch(1 0 0);
  --muted: oklch(0.958 0.008 264);
  --muted-foreground: oklch(0.49 0.025 266);
  --primary: oklch(0.32 0.005 286);
  --primary-foreground: oklch(0.99 0 0);
  --border: oklch(0.912 0.009 264);
  --input: oklch(0.885 0.012 264);
  --ring: oklch(0.56 0.14 264);
  --brand: oklch(0.62 0.155 45);
  --success: oklch(0.52 0.12 158);
  --warning: oklch(0.74 0.15 72);
  /* the same split the finance system makes: --warning paints, --warning-ink is the one you are allowed to read */
  --warning-ink: oklch(0.45 0.1 58);
  --destructive: oklch(0.55 0.2 27);
  --radius: 0.7rem;
  --shadow-surface: 0 1px 2px oklch(0.21 0.03 266 / 6%);
  --shadow-raised: 0 4px 16px -8px oklch(0.21 0.03 266 / 22%), 0 0 0 1px oklch(0.21 0.03 266 / 5%);
  --shadow-float: 0 18px 40px -24px oklch(0.21 0.03 266 / 38%), 0 0 0 1px oklch(0.21 0.03 266 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: oklch(0.155 0.012 266);
    --background: oklch(0.185 0.014 266);
    --foreground: oklch(0.96 0.006 264);
    --card: oklch(0.205 0.016 266);
    --muted: oklch(0.255 0.016 266);
    --muted-foreground: oklch(0.73 0.02 264);
    --primary: oklch(0.92 0.006 264);
    --primary-foreground: oklch(0.2 0.02 266);
    --border: oklch(1 0 0 / 9%);
    --input: oklch(1 0 0 / 14%);
    --ring: oklch(0.66 0.13 264);
    --brand: oklch(0.7 0.14 48);
    --success: oklch(0.74 0.13 158);
    --warning: oklch(0.8 0.14 78);
    --warning-ink: oklch(0.86 0.11 82);
    --destructive: oklch(0.7 0.19 22);
    --shadow-surface: 0 1px 2px oklch(0 0 0 / 40%);
    --shadow-raised: 0 4px 16px -8px oklch(0 0 0 / 60%), 0 0 0 1px oklch(1 0 0 / 8%);
    --shadow-float: 0 18px 40px -24px oklch(0 0 0 / 70%), 0 0 0 1px oklch(1 0 0 / 10%);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/*
 * `hidden` is only a `display: none` in the user-agent sheet, so any rule of ours that sets a display beats it —
 * and the element stays on screen while the code believes it is gone. Found on the home screen (22.09.2026), where
 * the empty state and the clock warning were both visible under a perfectly correct `element.hidden = true`.
 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--canvas);
  color: var(--foreground);
  font-family:
    "Heebo",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* the notch and the home indicator, on a page that fills the screen */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* digits are always read left to right, whatever the page direction */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

.screen {
  display: none;
  min-height: 100svh;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1rem 2rem;
  max-width: 30rem;
  margin-inline: auto;
}
.screen[data-active] {
  display: flex;
}

h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}
h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
p {
  margin: 0;
  color: var(--muted-foreground);
}
.lead {
  color: var(--foreground);
}

/* ── the bar at the top ───────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
}
.wordmark img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-surface);
}

/* ── the code, which is the whole point of the screen ─────────────────────── */

/* the first screen a person meets, and the one after it, sit in the middle of a tall phone rather than under the bar */
#screen-install h1,
#screen-setup h1 {
  margin-top: auto;
}
#screen-install > p:last-of-type,
#screen-setup > div:last-of-type {
  margin-bottom: auto;
}

.code-card {
  /* the code is the screen; on a tall phone it sits in the middle of it, not stranded under the bar */
  margin-block: auto;
  background: var(--card);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-raised);
  padding: 1.75rem 1.25rem 1.5rem;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  text-align: center;
}

.ring {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
  display: grid;
  place-items: center;
}
.ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.ring .track {
  stroke: var(--muted);
}
.ring .arc {
  stroke: var(--brand);
  transition: stroke-dashoffset 1s linear;
}
.ring[data-soon] .arc {
  /* the darker tone: at 2.37:1 the pale warning failed even the 3:1 a graphic needs (measured 22.09.2026) */
  stroke: var(--warning-ink);
}
.ring .remaining {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1.1rem;
}

.code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(2.5rem, 13vw, 3.25rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  background: none;
  border: 0;
  color: inherit;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 200ms ease;
}
.code:active {
  opacity: 0.6;
}
.code[data-hidden] {
  filter: blur(14px);
  user-select: none;
}
.code-rolling {
  animation: code-in 200ms ease;
}
@keyframes code-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .code-rolling {
    animation: none;
  }
  .ring .arc {
    transition: none;
  }
}

.account-name {
  font-weight: 600;
}
.account-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.soon {
  color: var(--warning-ink);
  font-size: 0.875rem;
  font-weight: 500;
  min-height: 1.25rem;
}

/* ── other accounts ───────────────────────────────────────────────────────── */

.account-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
  padding: 0.75rem 1rem;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
  min-height: 3.25rem;
}
.account-card .mini-code {
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}

/* ── controls ─────────────────────────────────────────────────────────────── */

button,
.button {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0.75rem 1.25rem;
  min-height: 2.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  transition:
    transform 120ms ease,
    opacity 120ms ease;
}
button:active {
  transform: scale(0.985);
}
button[disabled] {
  opacity: 0.5;
  cursor: default;
}
button.secondary {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
  box-shadow: var(--shadow-surface);
}
button.ghost {
  background: none;
  color: var(--muted-foreground);
  border-color: transparent;
  font-weight: 500;
}
button.danger {
  background: var(--destructive);
  color: white;
}
button.block {
  width: 100%;
}
button.icon {
  padding: 0.5rem;
  min-width: 2.75rem;
  background: none;
  color: var(--muted-foreground);
  border-color: transparent;
}

:where(button, a, input):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

input {
  font: inherit;
  width: 100%;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  min-height: 2.75rem;
}
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-surface);
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.banner {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  font-size: 0.875rem;
  background: color-mix(in oklch, var(--warning) 16%, var(--card));
  color: var(--foreground);
  border: 1px solid color-mix(in oklch, var(--warning) 35%, transparent);
}
.banner.info {
  background: color-mix(in oklch, var(--ring) 10%, var(--card));
  border-color: color-mix(in oklch, var(--ring) 28%, transparent);
}

.steps {
  display: flex;
  gap: 0.4rem;
}
.steps span {
  height: 0.25rem;
  flex: 1;
  border-radius: 999px;
  background: var(--muted);
}
.steps span[data-done] {
  background: var(--brand);
}

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  margin-inline: auto;
  width: fit-content;
  max-width: 90vw;
  background: var(--foreground);
  color: var(--background);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-float);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
  z-index: 50;
}
.toast[data-shown] {
  opacity: 1;
  transform: translateY(0);
}

/* ── the scanner ──────────────────────────────────────────────────────────── */

.scanner {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 1rem;
  overflow: hidden;
  background: black;
}
.scanner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scanner .frame {
  position: absolute;
  inset: 12%;
  border: 3px solid white;
  border-radius: 1rem;
  box-shadow: 0 0 0 100vmax oklch(0 0 0 / 45%);
}

/* ── the opening animation, the ribbon F ──────────────────────────────────── */

.splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--canvas);
  z-index: 60;
  transition: opacity 320ms ease;
}
.splash[data-gone] {
  opacity: 0;
  pointer-events: none;
}
.splash img {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 1rem;
  animation: breathe 2.2s ease-in-out infinite;
}
@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .splash img {
    animation: none;
  }
}

.rows {
  display: grid;
  gap: 0.6rem;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child {
  border-bottom: 0;
}
.muted {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}
.spacer {
  flex: 1;
}

/*
 * `style-src 'self'` forbids style attributes as well as <style> blocks, and Chrome proved it by refusing every one
 * of them (22.09.2026). These carry what those attributes used to say. The policy is not negotiable; the markup is.
 */
.gap-top {
  margin-top: 1rem;
}
.gap-top-sm {
  margin-top: 0.75rem;
}
.full {
  width: 100%;
}
.lock-mark {
  width: 4.5rem;
  border-radius: 1rem;
}
.stack-center {
  display: grid;
  justify-items: center;
  gap: 1rem;
  text-align: center;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
