/* base.css · architect-owned. Reset, type, global elements (nav, skip), and the shared object classes
   every builder uses: .btn, .keys, .band, .dot, .giant/.roll, .device, .floor, .scan, rebuilt-state steps,
   [data-when] mode switching, the .intro entrance, reduced motion. Sections style only their own ids. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); color: var(--ink); scroll-padding-top: var(--nav-h); }
body { min-height: 100svh; font: 400 var(--t-body)/1.6 var(--f-sans); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg, video, iframe { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
ol, ul { padding: 0; list-style: none; }
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
bdi { unicode-bidi: isolate; }
[hidden] { display: none !important; }
@media (max-width: 767.98px) { body { line-height: 1.5; } }

/* ---------- type ---------- */
h1, h2, h3 { font-weight: 500; line-height: 1.3; text-wrap: balance; }
.h1 { font-size: var(--t-h1-he); line-height: 1.3; font-weight: 500; }
.h2 { font-size: var(--t-h2); line-height: 1.3; font-weight: 500; }
html[lang="en"] .h1, html[lang="en"] .h2, html[lang="en"] .wide {
  font-family: var(--f-wide); line-height: 1.04; letter-spacing: -.02em;
}
html[lang="en"] .h1 { font-size: var(--t-h1-en); font-stretch: 118%; font-weight: 420; }
html[lang="en"] .h2 { font-stretch: 112%; font-weight: 460; }
html[lang="en"] :is(.h1, .h2) bdi { font-family: var(--f-sans); font-stretch: 100%; letter-spacing: 0; }   /* order numbers: SG's 0 is a box */
.soft { color: var(--ink-2); }
.small { font-size: var(--t-small); color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums lining-nums; }
.code { font-family: var(--f-code); font-weight: 420; font-variant-numeric: tabular-nums slashed-zero; }
.cur { font-family: var(--f-sans); font-size: .74em; font-stretch: 100%; font-weight: 500; }   /* the ₪ inside Science Gothic runs */
.wordmark { font-family: var(--f-wide); font-stretch: 160%; font-weight: 620; font-size: 20px; line-height: 1; letter-spacing: 0; white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.wrap { max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- focus ---------- */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 2px var(--bg); border-radius: 4px; }
.on-night :focus-visible, html[data-nav="night"] .nav :focus-visible { outline-color: var(--night-ink); box-shadow: 0 0 0 2px var(--night); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-key);
  font: 600 15px/1.2 var(--f-sans); text-decoration: none; white-space: nowrap;
  transition: transform var(--d-hover) var(--e-lift);
}
.btn--accent { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 0 0 1px var(--ink); }
.btn--line { box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn--text { padding: 0 4px; font-weight: 500; text-decoration: underline; }
.btn--cta { min-height: 48px; font-size: 16px; padding: 0 22px; }
.btn--xl { min-height: 56px; font-size: 18px; padding: 0 28px; }
@media (hover: hover) { .btn:hover { transform: translateY(-1px); } }
.btn:active { transform: translateY(0); }

/* ---------- button groups (keys.js): one sliding key, manual activation ---------- */
.keys { position: relative; display: inline-flex; padding: 2px; border-radius: var(--r-key); background: var(--wash); isolation: isolate; }
.keys > button { position: relative; z-index: 1; min-height: 40px; padding: 0 14px; border-radius: var(--r-thumb); font: 500 14px/1.2 var(--f-sans); color: var(--ink-2); white-space: nowrap; transition: color var(--d-hover); }
.keys > button[aria-pressed="true"] { color: var(--on-accent); }
.keys__thumb {
  position: absolute; z-index: 0; top: 2px; bottom: 2px; left: 0;   /* physical: keys.js measures offsetLeft */
  width: var(--w, 0); transform: translateX(var(--x, 0));
  border-radius: var(--r-thumb); background: var(--accent); box-shadow: inset 0 0 0 1px var(--ink);
  transition: transform var(--d-key) var(--e-key), width var(--d-key) var(--e-key);
}
@media (max-width: 1023.98px) { .keys > button { min-height: 44px; } }

/* ---------- the top band row and the live dot ---------- */
.band { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 48px; font-size: var(--t-small); color: var(--ink-2); }
.band__rule { height: 1px; background: var(--line); transform-origin: 50% 50%; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--ink); flex: none; transition: background-color var(--d-hover); }
html[data-box="live"] .dot { background: var(--accent); }

/* ---------- the giant (roll.js builds .roll inside it) ---------- */
.giant {
  display: inline-block; font-family: var(--f-wide); font-stretch: 200%; font-weight: 180;
  line-height: 1; letter-spacing: 0; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink); transition: opacity 400ms ease-out;
}
.giant.is-standby { opacity: .5; }                  /* = --giant-standby on white; opacity, never colour */
@media (max-width: 1023.98px) { .giant { font-stretch: 118%; font-weight: 220; } }
.roll { display: inline-flex; direction: ltr; transform: scale(var(--fit, 1)); transform-origin: var(--fit-origin, 100% 100%); }
html[dir="ltr"] .roll { --fit-origin: 0% 100%; }
.roll__col { display: inline-block; height: 1em; overflow: clip; clip-path: inset(.12em 0 .15em); }   /* the window is the digits' cap band (SG: cap .1425–.85em): a rolling neighbour never shows under the baseline or over the cap */
.roll__in { display: block; }
.roll__strip { display: block; transform: translateY(calc(var(--d, 0) * -10%)); }
.roll__strip > i { display: block; height: 1em; font-style: normal; text-align: center; }
.roll__ch .roll__in { white-space: pre; }
/* Science Gothic draws 0 as a rounded box; the giant's 0 gets a dot so "0" and "#0044" never read as tofu.
   Glyph and advance are centred in the 1em cell at every wdth/wght (asc 1.088, desc .388, 0 = 0….70em). */
.roll__strip > i:first-child { position: relative; }
.roll__strip > i:first-child::after { content: ""; position: absolute; left: 50%; top: 50%; width: .085em; height: .085em; margin: -.0425em 0 0 -.0425em; border-radius: 50%; background: currentColor; }
.roll__in.cur { line-height: 1.351; }  /* 1 / .74: the ₪ column keeps the digits' 1em height */

/* ---------- the device: .device (console transforms it) > .device__lift (lift) > .device__screen ---------- */
.device { position: relative; width: calc(var(--screen-w) + 2 * var(--rim-w)); transform-origin: 50% 100%; }
.device__lift {
  position: relative; padding: var(--rim-w); border-radius: 36px;
  background: var(--rim); box-shadow: inset 0 1px 0 var(--rim-hi);
  transition: transform var(--d-lift) var(--e-lift);
}
.device__lift::before, .device__lift::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; transition: opacity var(--d-lift) var(--e-lift); }
.device__lift::before { box-shadow: var(--shadow-rest); }
.device__lift::after { box-shadow: var(--shadow-lift); opacity: 0; }
.device__screen {
  position: relative; width: var(--screen-w); height: var(--screen-h); border-radius: 28px;
  overflow: clip; background: #F5F4F0; isolation: isolate; overscroll-behavior: contain;
}
.device__poster, .device__poster > * { position: absolute; inset: 0; }
.device__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #F5F4F0; opacity: 0; z-index: 2; }
html[data-box="failed"] .device__frame { visibility: hidden; }   /* the failed state's buttons sit under it */
@media (hover: hover) { html[data-box="off"] .device:hover .device__lift::after { opacity: .5; transition-duration: var(--d-hover); } }   /* no lift at rest: the shadow deepens */
html[data-box="live"] .device__lift { transform: translateY(-14px) scale(1.015); }
html[data-box="live"] .device__lift::before { opacity: 0; }
html[data-box="live"] .device__lift::after { opacity: 1; }
/* < 1024: no rim, no phone inside the phone. The box is laid out once at its live size; console moves it by transform only. */
@media (max-width: 1023.98px) {
  .device { width: min(100%, 560px); margin-inline: auto; }
  .device__lift { padding: 0; background: none; box-shadow: none; border-radius: 24px 24px 0 0; transform: none !important; }
  .device__screen { width: 100%; height: max(480px, calc(100svh - 144px)); border-radius: 24px 24px 0 0; border: 1px solid var(--line-strong); border-bottom: 0; }
}

/* the floor shadow: console positions .floor (90% of the device width × 36px, 12px under its foot); lift widens and softens it */
.floor { position: absolute; height: 36px; pointer-events: none; }
.floor::before { content: ""; position: absolute; inset: 0; background: var(--floor); transition: transform var(--d-lift) var(--e-lift), opacity var(--d-lift) var(--e-lift); }
html[data-box="live"] .floor::before { transform: scaleX(1.18); opacity: .44; }

/* the scan line (scan.js appends it; power-on and the finale only) */
.scan { position: absolute; top: 0; left: 0; height: 1px; background: rgb(14 15 17 / .45); pointer-events: none; z-index: 5; }
.scan--night { background: var(--night-ink); }

/* ---------- box modes: [data-when="frame away account"] shows an element only in those modes ---------- */
html[data-mode="frame"] [data-when]:not([data-when~="frame"]),
html[data-mode="away"] [data-when]:not([data-when~="away"]),
html[data-mode="account"] [data-when]:not([data-when~="account"]) { display: none !important; }
html[data-mode="away"] [data-power]::after { content: "\00a0↗" / ""; }   /* alt "": not part of the name; box.js adds "(opens in a new tab)" */
html[data-mode="away"][dir="rtl"] [data-power]::after { content: "\00a0↖" / ""; }   /* directional icons mirror */

/* ---------- nav (global) ---------- */
.skip { position: absolute; z-index: 100; inset-inline-start: var(--s4); top: var(--s2); padding: 10px 14px; border-radius: var(--r-key); background: var(--ink); color: var(--bg); transform: translateY(-200%); }
.skip:focus { transform: none; }
.nav { position: sticky; top: 0; z-index: 50; height: var(--nav-h); background: var(--bg); color: var(--ink); transition: background-color 150ms, color 150ms, box-shadow 150ms; }
html[data-scrolled] .nav { box-shadow: 0 1px 0 var(--line); }
html[data-nav="night"] .nav { background: var(--night); color: var(--night-ink); box-shadow: 0 1px 0 var(--night-line); }
.nav__in { display: flex; align-items: center; gap: var(--s5); height: 100%; padding-inline: var(--gutter); }
.nav__mark { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.nav__links { display: flex; gap: var(--s5); margin-inline-start: auto; }
.nav__links a, .nav__lang { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; text-decoration: none; }
@media (hover: hover) { .nav__links a:hover, .nav__lang:hover { text-decoration: underline; } }
.nav__cta { min-height: 40px; }
@media (max-width: 767.98px) {
  .nav__links { display: none; }
  .nav__lang { margin-inline-start: auto; }
  .nav__in { gap: var(--s3); }
  .nav__cta { min-height: 44px; padding: 0 12px; }
}
@media (max-width: 400px) { .nav .wordmark { font-size: 17px; } }   /* 20px overflows 320–390 with the two keys */
@media (max-width: 340px) { .nav__in { gap: var(--s2); } .nav .wordmark { font-size: 15px; font-stretch: 130%; }
}

/* ---------- entrance (once a session, ≤ 900 ms, CSS only; the head script adds html.intro) ---------- */
@keyframes ls-floor { from { transform: translateY(110%); } }
@keyframes ls-rise { from { opacity: 0; transform: translateY(8px); } }
html.intro .giant .roll__in { animation: ls-floor 600ms var(--e-roll) both; animation-delay: calc(300ms + var(--i, 0) * 45ms); }
/* while it rises, a column shows only its own digit (not its strip neighbours); the clip ends by itself at 1.2 s */
@keyframes ls-solo { from, to { clip-path: inset(calc(var(--d) * 10%) 0 calc((9 - var(--d)) * 10%) 0); } }
html.intro .giant .roll__strip { animation: ls-solo 1200ms linear; }
html.intro .intro-rise { animation: ls-rise 200ms var(--e-rise) 700ms both; }

/* ---------- reduced motion: shorter and calmer, nothing hidden ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.intro * { animation: none !important; }
  *, *::before, *::after { animation-duration: 150ms !important; }   /* only elements that animate; transitions keep their own (short) lists */
  .device__lift, .btn { transform: none !important; }
  .keys__thumb, .floor::before { transition: none !important; }
  .floor::before { transform: none !important; }
}
