/* ==========================================================================
   Sublinea · components v2 · needs tokens.css first
   Namespace: sb-. Works in canvas boards (.dc.html), the site, and the
   app's WKWebView (macOS 11 / Safari 14.1 WebKit and later).

   House rules baked in here:
   - The resting frame is the final frame. Reveal and scroll effects only
     start from a fogged state when the page opts in (.sb-motion on the
     root, set by a script that also checks reduced motion). Without the
     script, or without scroll timelines, everything is simply visible.
   - Hover effects live inside (hover: hover) and (pointer: fine).
   - Focus = box-shadow ring (round on pills in every WebKit), shown on
     :focus and hidden again by :focus:not(:focus-visible). Old WebKit
     drops the second rule, so the ring is always shown there.
   - Parallax moves with `translate`, reveals with `transform`, presses
     with `scale`: three properties that never fight each other.
   - Load order: tokens.css, components.css, motion.css.
     OWNERSHIP (director merge, 20/11): this file owns every component
     STATE (rest, hover, press, focus, disabled, busy, error, success) and
     static fog ([data-depth], [data-pass], [data-recall]).
     motion.css owns ENTRANCES and SCROLL SCENES (.sb-reveal, .sb-gesture,
     .sb-parallax, .sb-rotate, .sb-story, app step changes). Never style a
     component's states in motion.css.
   ========================================================================== */


/* --------------------------------------------------------------------------
   0. Page base and the browser surfaces we didn't draw
   -------------------------------------------------------------------------- */

.sb-page {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-x: clip;          /* clip, not hidden: a hidden ancestor becomes the scroll container and breaks view() timelines */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  caret-color: var(--ink);
}
.sb-app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--app-fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
}
.sb-app input, .sb-app textarea, .sb-app .sb-selectable { -webkit-user-select: text; user-select: text; }

.sb-page ::selection, .sb-app ::selection { background: var(--butter-aura); color: var(--ink); }
.sb-page ::-moz-selection { background: var(--butter-aura); color: var(--ink); }

.sb-scroll { scrollbar-width: thin; scrollbar-color: rgba(var(--ink-rgb), 0.22) transparent; }
.sb-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.sb-scroll::-webkit-scrollbar-track { background: transparent; }
.sb-scroll::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: var(--r-pill); background: rgba(var(--ink-rgb), 0.22); background-clip: padding-box; }
.sb-scroll::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--ink-rgb), 0.4); }

.sb-num { font-variant-numeric: tabular-nums; }
.sb-nowrap { white-space: nowrap; }
.sb-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Generic focus for anything focusable that has no component of its own.
   Zero specificity (:where), so every component's own shadow and ring win.
   The transparent outline is what Windows high-contrast mode paints. */
:where(.sb-page, .sb-app) :where(a, button, summary, input, select, textarea, [tabindex]):focus { outline: 2px solid transparent; outline-offset: 3px; }
:where(.sb-page, .sb-app) :where(a, button, summary, [tabindex]):focus { box-shadow: var(--focus-ring); }
:where(.sb-page, .sb-app) :where(a, button, summary, [tabindex]):where(:focus:not(:focus-visible)) { box-shadow: none; }
:where(.sb-page, .sb-app) :where([tabindex="-1"]):focus { box-shadow: none; }


/* --------------------------------------------------------------------------
   1. Layout
   -------------------------------------------------------------------------- */

.sb-container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); box-sizing: border-box; }
.sb-section { position: relative; padding-top: var(--space-section); }
.sb-stack > * + * { margin-top: var(--stack-gap, var(--sp-4)); }


/* --------------------------------------------------------------------------
   2. Type
   -------------------------------------------------------------------------- */

.sb-display, .sb-h1, .sb-h2, .sb-h3, .sb-app-title, .sb-app-title-sm { margin: 0; font-weight: var(--fw-semibold); color: var(--ink); text-wrap: balance; }
.sb-display { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--track-display); }
.sb-h1 { font-size: var(--fs-h1); line-height: 1.04; letter-spacing: var(--track-display); }
.sb-h2 { font-size: var(--fs-h2); line-height: var(--lh-heading); letter-spacing: var(--track-heading); }
.sb-h3 { font-size: var(--fs-h3); line-height: 1.25; letter-spacing: var(--track-snug); }
.sb-lede { margin: 0; max-width: var(--measure-lede); font-size: var(--fs-lede); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.sb-body { margin: 0; max-width: var(--measure-prose); font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink-2); text-wrap: pretty; }
.sb-quote { margin: 0; max-width: var(--measure-quote); font-size: var(--fs-quote); line-height: var(--lh-quote); letter-spacing: var(--track-snug); color: var(--ink); text-wrap: pretty; quotes: none; }
.sb-quote--lg { font-size: var(--fs-quote-lg); line-height: 1.45; }
.sb-caption { margin: 0; font-size: var(--fs-caption); line-height: var(--lh-ui); color: var(--ink-2); }

.sb-app-title { font-size: var(--app-fs-title); line-height: var(--lh-title); letter-spacing: var(--track-heading); }
.sb-app-title-sm { font-size: var(--app-fs-title-sm); line-height: 1.25; letter-spacing: -0.02em; }
.sb-app-lede { margin: 12px 0 0; font-size: var(--app-fs-body); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }


/* --------------------------------------------------------------------------
   3. Light: aura, glass, depth
   -------------------------------------------------------------------------- */

/* Diffuse highlighter light at the edges. Place inside a positioned parent.
   Four spans: .y butter (top left) .p rose (top right) .b sky (bottom left) .o peach (bottom right). */
.sb-aura { position: absolute; inset: 0; z-index: var(--z-aura); pointer-events: none; overflow: hidden; }
.sb-aura > span { position: absolute; border-radius: 50%; filter: blur(var(--blur-aura)); }
.sb-aura[data-drift] > span { will-change: transform; }
.sb-aura > .y { left: -12%; top: -18%; width: 52%; height: 70%; background: radial-gradient(closest-side, rgba(var(--butter-rgb), 0.95), rgba(var(--butter-rgb), 0)); }
.sb-aura > .p { right: -12%; top: -16%; width: 48%; height: 64%; background: radial-gradient(closest-side, rgba(var(--rose-rgb), 0.9), rgba(var(--rose-rgb), 0)); }
.sb-aura > .b { left: -14%; bottom: -22%; width: 52%; height: 66%; background: radial-gradient(closest-side, rgba(var(--sky-rgb), 0.95), rgba(var(--sky-rgb), 0)); }
.sb-aura > .o { right: -14%; bottom: -20%; width: 50%; height: 64%; background: radial-gradient(closest-side, rgba(var(--peach-rgb), 0.9), rgba(var(--peach-rgb), 0)); }
/* Grain over the light: removes gradient banding. sb-grain.png (128 px, alpha
   baked in) ships next to this file; normal blend, because .sb-aura is an
   isolated group and soft-light would blend against transparency. */
.sb-aura::after { content: ""; position: absolute; inset: 0; background: url(sb-grain.png) repeat 0 0 / 128px 128px; pointer-events: none; }
/* The light breathes. Pause it offscreen with .sb-paused (set by the observer). */
@media (prefers-reduced-motion: no-preference) {
  .sb-aura[data-drift] > span { animation: sb-aura-drift var(--dur-drift) var(--ease-in-out) infinite alternate; }
  .sb-aura[data-drift] > .p { animation-delay: calc(var(--dur-drift) / -3); animation-direction: alternate-reverse; }
  .sb-aura[data-drift] > .b { animation-delay: calc(var(--dur-drift) / -2); }
  .sb-aura[data-drift] > .o { animation-delay: calc(var(--dur-drift) / -1.4); animation-direction: alternate-reverse; }
}
/* Optional: the light leans toward the pointer. JS sets --px/--py in -1..1 on the aura. */
.sb-aura[data-follow] > span { translate: calc(var(--px, 0) * 28px) calc(var(--py, 0) * 20px); transition: translate var(--dur-slow) var(--ease-out); }
.sb-paused, .sb-paused * { animation-play-state: paused !important; }

/* Frosted glass: fill + blur only. Add elevation separately. */
.sb-glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--edge);
}
.sb-glass--card { background: var(--glass-card); -webkit-backdrop-filter: var(--glass-blur-sm); backdrop-filter: var(--glass-blur-sm); }
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .sb-glass, .sb-glass--card { background: rgba(255, 255, 255, 0.9); }
}

/* Depth: one attribute sets blur, opacity and the parallax speed that
   motion.css (.sb-parallax) reads. No layout side effects here: depth
   layers keep whatever position their board gives them.
   Depth layers are decorative (aria-hidden) and never interactive.
   To move something WITHOUT fogging it (aura spans, the hero card, wall
   columns) use data-speed (motion.css), not data-depth. */
[data-depth] { pointer-events: none; }
[data-depth="0"] { --depth-speed: var(--depth-0-speed); }
[data-depth="1"] { --depth-speed: var(--depth-1-speed); filter: blur(var(--depth-1-blur)); opacity: var(--depth-1-opacity); }
[data-depth="2"] { --depth-speed: var(--depth-2-speed); filter: blur(var(--depth-2-blur)); opacity: var(--depth-2-opacity); }
[data-depth="3"] { --depth-speed: var(--depth-3-speed); filter: blur(var(--depth-3-blur)); opacity: var(--depth-3-opacity); }
/* data-recall: a fogged memory comes back into focus under the pointer */
[data-depth][data-recall] { pointer-events: auto; transition: filter var(--dur-slow) var(--ease-defog), opacity var(--dur-slow) var(--ease-defog); }
@media (hover: hover) and (pointer: fine) {
  [data-depth][data-recall]:hover { filter: blur(0); opacity: 1; }
  [data-depth][data-recall]:hover .sb-mark { animation: sb-sweep var(--dur-sweep-short) var(--ease-sweep) both; }
}


/* --------------------------------------------------------------------------
   4. Buttons
   The face is ::after, the bloom is ::before, so the button itself can
   carry the focus ring and move with translate/scale freely.
   -------------------------------------------------------------------------- */

.sb-btn {
  --btn-h: 48px;
  --btn-px: 26px;
  --btn-fs: var(--fs-small);
  --btn-face: var(--ink);
  --btn-face-hover: var(--ink-hover);
  --btn-text: #FFFFFF;
  --btn-lift: 0px;
  --btn-scale: 1;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--btn-h);
  padding: 0 var(--btn-px);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--btn-text);
  font-family: var(--font);
  font-size: var(--btn-fs);
  font-weight: var(--fw-medium);
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  translate: var(--mx, 0px) calc(var(--my, 0px) + var(--btn-lift));
  scale: var(--btn-scale);
  transition:
    translate var(--dur-calm) var(--ease-out),
    scale var(--dur-base) var(--ease-overshoot),
    color var(--dur-quick) var(--ease-out),
    box-shadow var(--dur-quick) var(--ease-out);
}
.sb-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-color: var(--btn-face);
  /* a narrow specular streak parked off to the right, screened onto the ink;
     hover pulls it across (a broad butter wash read khaki). Spec 7.2 item 17. */
  background-image: linear-gradient(100deg, rgba(255, 250, 225, 0) 45.5%, rgba(255, 250, 225, 0.28) 50%, rgba(255, 250, 225, 0) 54.5%);
  background-blend-mode: screen;   /* mix-blend-mode cannot reach a background layer */
  background-repeat: no-repeat;
  background-size: 260% 100%;
  background-position: 130% 0;
  box-shadow: var(--elev-button);
  transition:
    background-color var(--dur-quick) var(--ease-out),
    background-position var(--dur-slow) var(--ease-sweep),
    box-shadow var(--dur-calm) var(--ease-out);
}
.sb-btn::before {
  content: "";
  position: absolute;
  inset: -6px -18px -16px;   /* the light pools a little below, like a lamp under paper */
  z-index: -2;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--butter-mark-rgb), 1), rgba(var(--rose-mark-rgb), 1) 36%, rgba(var(--sky-mark-rgb), 1) 66%, rgba(var(--peach-mark-rgb), 1));
  filter: blur(var(--blur-glow));
  opacity: 0;
  scale: 0.72 0.6;
  transition: opacity var(--dur-calm) var(--ease-out), scale var(--dur-slow) var(--ease-out);
  pointer-events: none;
}
.sb-btn__icon { display: inline-flex; flex: none; transition: translate var(--dur-calm) var(--ease-overshoot); }
.sb-btn svg { flex: none; }

@media (hover: hover) and (pointer: fine) {
  .sb-btn:hover { --btn-lift: var(--lift); }
  .sb-btn:hover::after { background-color: var(--btn-face-hover); background-position: -30% 0; box-shadow: var(--elev-button-hover); }
  .sb-btn:hover::before { opacity: 0.95; scale: 1 1; }
  .sb-btn:hover .sb-btn__icon { translate: var(--nudge) 0; }
  .sb-btn:hover .sb-btn__icon--down { translate: 0 var(--nudge); }
}
.sb-btn:active { --btn-scale: var(--press-scale); --btn-lift: 0px; transition-duration: var(--dur-calm), var(--dur-instant), var(--dur-quick), var(--dur-quick); transition-timing-function: var(--ease-out), var(--ease-press), var(--ease-out), var(--ease-out); }
.sb-btn:active::before { opacity: 0.45; scale: 0.92 0.8; }

.sb-btn:focus { outline: 2px solid transparent; outline-offset: 3px; box-shadow: var(--focus-ring), var(--focus-halo); }
.sb-btn:focus:not(:focus-visible) { box-shadow: none; }

/* Disabled: looks disabled (the old dark-grey #4A4E55 read as enabled) */
.sb-btn:disabled, .sb-btn[aria-disabled="true"] { --btn-lift: 0px; --btn-scale: 1; --mx: 0px; --my: 0px; cursor: default; color: var(--ink-2); }
.sb-btn:disabled::after, .sb-btn[aria-disabled="true"]::after { background-color: rgba(var(--ink-rgb), 0.1); background-image: none; box-shadow: none; }
.sb-btn:disabled::before, .sb-btn[aria-disabled="true"]::before { display: none; }

/* Working: stays dark, a marker glint reads across it.
   Busy beats disabled: aria-disabled blocks a second press, but the ink face
   and the white label stay (15:1). Never set `disabled` on a busy ink button. */
.sb-btn[aria-busy="true"] { cursor: progress; }
.sb-btn[aria-busy="true"]::after { background-color: var(--ink); }
.sb-btn[aria-busy="true"][aria-disabled="true"] { color: var(--surface); }
/* ...and the sheen (the glint's streak) and the contact shadow stay too */
.sb-btn[aria-busy="true"][aria-disabled="true"]::after {
  background-image: linear-gradient(100deg, rgba(255, 250, 225, 0) 45.5%, rgba(255, 250, 225, 0.28) 50%, rgba(255, 250, 225, 0) 54.5%);
  box-shadow: var(--elev-button);
}
@media (prefers-reduced-motion: no-preference) {
  .sb-btn[aria-busy="true"]::after { animation: sb-glint 1.8s var(--ease-in-out) infinite; }
}

/* Quiet: white pill; on hover the marker sweeps across it under the label.
   The band's head is soft (16 px feather), not a loading-bar edge (spec 7.2 item 18). */
.sb-btn--quiet { --btn-face: var(--glass-card); --btn-face-hover: var(--surface); --btn-text: var(--ink); --btn-px: 22px; }
.sb-btn--quiet::after {
  background-image: linear-gradient(90deg, var(--butter-mark) calc(100% - 16px), rgba(var(--butter-mark-rgb), 0));
  background-blend-mode: normal;
  background-size: 0% 100%;
  background-position: right -16px top 0;   /* at rest the band is anchored right, so on leave it retracts to the right: a stroke completed */
  box-shadow: inset 0 0 0 1px var(--line-strong), var(--elev-1);
  transition: background-color var(--dur-quick) var(--ease-out), background-size var(--dur-exit) var(--ease-in), box-shadow var(--dur-calm) var(--ease-out);
}
.sb-btn--quiet::before { background: radial-gradient(closest-side, rgba(var(--butter-rgb), 0.9), rgba(var(--butter-rgb), 0)); }
@media (hover: hover) and (pointer: fine) {
  .sb-btn--quiet:hover::after { background-size: calc(100% + 16px) 100%; background-position: left 0 top 0; box-shadow: inset 0 0 0 1px rgba(var(--butter-mark-rgb), 1), var(--elev-2); transition: background-color var(--dur-quick) var(--ease-out), background-size var(--dur-sweep-short) var(--ease-sweep), box-shadow var(--dur-calm) var(--ease-out); }
  .sb-btn--quiet:hover::before { opacity: 0.55; }
}

/* Keyboard parity: focus shows the same light as hover. Kept as separate
   rules so a WebKit without :focus-visible drops only these. */
.sb-btn:focus-visible::before { opacity: 0.95; scale: 1 1; }
.sb-btn--quiet:focus-visible::before { opacity: 0.55; }
.sb-btn--quiet:focus-visible::after { background-size: calc(100% + 16px) 100%; background-position: left 0 top 0; }
.sb-link:focus-visible { background-size: 100% 0.82em, 100% 1px; background-position: 0 88%, 0 100%; }

/* [data-safe]: the quiet button in a destructive confirmation ("Cancel" next
   to "Delete everything"). Focus shows ring + halo only: no band, no bloom. */
.sb-btn[data-safe]::before { opacity: 0; }
.sb-btn[data-safe]:focus { box-shadow: var(--focus-ring), var(--focus-halo); }
.sb-btn[data-safe]:focus:not(:focus-visible) { box-shadow: none; }
.sb-btn[data-safe]:focus-visible::before { opacity: 0; }
.sb-btn[data-safe]:focus-visible::after { background-size: 0 100%; }

/* Sizes */
.sb-btn--lg { --btn-h: 56px; --btn-px: 32px; --btn-fs: 1.0625rem; }
.sb-btn--sm { --btn-h: 40px; --btn-px: 18px; --btn-fs: 0.875rem; }
.sb-btn--xs { --btn-h: 32px; --btn-px: 14px; --btn-fs: 14px; }   /* app row actions and step buttons ("Edit", "Open Google ↗") */
.sb-btn--icon { --btn-px: 0; width: var(--btn-h); }
.sb-app .sb-btn { --btn-h: 44px; --btn-px: 24px; --btn-fs: var(--app-fs-body); }
.sb-app .sb-btn--sm { --btn-h: 40px; --btn-px: 16px; --btn-fs: var(--app-fs-label); }
.sb-app .sb-btn--quiet { --btn-px: 20px; }
.sb-app .sb-btn--xs { --btn-h: 32px; --btn-px: 14px; --btn-fs: var(--app-fs-label); }


/* --------------------------------------------------------------------------
   5. Text link: the underline becomes a highlight (sublinhar → marcar)
   -------------------------------------------------------------------------- */

.sb-link {
  --link-mark: var(--butter-mark);
  --link-line: currentColor;
  position: relative;
  color: var(--ink);
  font-weight: var(--fw-medium);
  text-decoration: none;
  padding: 0 0.06em;
  margin: 0 -0.06em;
  border-radius: 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background-image: linear-gradient(var(--link-mark), var(--link-mark)), linear-gradient(var(--link-line), var(--link-line));
  background-repeat: no-repeat;
  background-size: 0% 0.82em, 100% 1px;
  background-position: 100% 88%, 0 100%;
  transition: background-size var(--dur-exit) var(--ease-in);
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .sb-link:hover { background-size: 100% 0.82em, 100% 1px; background-position: 0 88%, 0 100%; transition: background-size var(--dur-sweep-short) var(--ease-sweep); }
}
/* Each nav or footer link may carry the reader's colour */
.sb-link[data-color="yellow"], .sb-link[data-color="butter"] { --link-mark: var(--butter-mark); }
.sb-link[data-color="pink"], .sb-link[data-color="rose"] { --link-mark: var(--rose-mark); }
.sb-link[data-color="blue"], .sb-link[data-color="sky"] { --link-mark: var(--sky-mark); }
.sb-link[data-color="orange"], .sb-link[data-color="peach"] { --link-mark: var(--peach-mark); }
.sb-link--quiet { color: var(--ink-2); --link-line: var(--line-signal); }
@media (hover: hover) and (pointer: fine) { .sb-link--quiet:hover { color: var(--ink); } }
/* Nav links: no resting underline, the band only */
.sb-link--nav { --link-line: transparent; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; margin: 0; color: var(--ink-2); background-position: 12px 64%, 0 100%; background-size: 0% 0.8em, 0 0; }
@media (hover: hover) and (pointer: fine) { .sb-link--nav:hover { color: var(--ink); background-size: calc(100% - 24px) 0.8em, 0 0; } }
.sb-link--nav[aria-current="page"], .sb-link--nav[aria-current="true"] { color: var(--ink); background-size: calc(100% - 24px) 0.8em, 0 0; }


/* --------------------------------------------------------------------------
   6. Pill (status, never an eyebrow above a heading)
   -------------------------------------------------------------------------- */

.sb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--glass-card);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: middle;
}
.sb-pill--sm { height: 24px; padding: 0 10px; }
.sb-pill--ink { background: var(--ink); color: #FFFFFF; box-shadow: none; }
.sb-pill[data-color] { color: var(--ink); box-shadow: none; }
.sb-pill[data-color="yellow"], .sb-pill[data-color="butter"] { background: var(--butter-mark-solid); }
.sb-pill[data-color="pink"], .sb-pill[data-color="rose"] { background: var(--rose-mark-solid); }
.sb-pill[data-color="blue"], .sb-pill[data-color="sky"] { background: var(--sky-mark-solid); }
.sb-pill[data-color="orange"], .sb-pill[data-color="peach"] { background: var(--peach-mark-solid); }
/* Coming soon: a dot that breathes, like something not quite in focus yet */
.sb-pill--soon::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--butter-signal); }
@media (prefers-reduced-motion: no-preference) {
  .sb-pill--soon::before { animation: sb-breathe 2.4s var(--ease-in-out) infinite; }
}


/* --------------------------------------------------------------------------
   7. Chips (app: Your rhythm). Radio = ink. Toggle = a highlight.
   -------------------------------------------------------------------------- */

.sb-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background-color: var(--glass-card);
  background-image: linear-gradient(var(--butter-aura), var(--butter-aura));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  box-shadow: inset 0 0 0 1px var(--line-control);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--app-fs-label);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-out), background-size var(--dur-sweep-short) var(--ease-sweep), color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), scale var(--dur-base) var(--ease-overshoot);
}
@media (hover: hover) and (pointer: fine) {
  .sb-chip:hover { background-color: var(--surface); box-shadow: inset 0 0 0 1px var(--line-signal); }
}
.sb-chip:active { scale: var(--press-scale); transition-duration: var(--dur-instant); }
.sb-chip[aria-checked="true"] { background-color: var(--ink); color: #FFFFFF; box-shadow: var(--elev-button); }
.sb-chip[aria-pressed="true"] { background-size: 100% 100%; box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), 0.14); }
.sb-chip:focus { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.sb-chip:focus:not(:focus-visible) { box-shadow: inset 0 0 0 1px var(--line-control); }
.sb-chip[aria-checked="true"]:focus:not(:focus-visible) { box-shadow: var(--elev-button); }
.sb-chip[aria-pressed="true"]:focus:not(:focus-visible) { box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), 0.14); }
/* A selected radio chip rests on elev-1, not the ink button's contact shadow */
.sb-chip[role="radio"][aria-checked="true"] { box-shadow: var(--elev-1); }
.sb-chip[role="radio"][aria-checked="true"]:focus { box-shadow: var(--focus-ring); }
.sb-chip[role="radio"][aria-checked="true"]:focus:not(:focus-visible) { box-shadow: var(--elev-1); }
/* Switch chip (Settings): on = the butter toggle look, off = a white chip.
   Without role="switch", every [aria-checked="true"] would paint as an ink radio. */
.sb-chip[role="switch"][aria-checked="true"] { background-color: var(--glass-card); color: var(--ink); background-size: 100% 100%; box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), 0.14); }
.sb-chip[role="switch"][aria-checked="true"]:focus { box-shadow: var(--focus-ring); }
.sb-chip[role="switch"][aria-checked="true"]:focus:not(:focus-visible) { box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), 0.14); }
.sb-chip[role="switch"][aria-checked="false"] { background-color: var(--surface); background-size: 0 100%; }


/* --------------------------------------------------------------------------
   8. Field: label, input, help, error
   The input has a "writing line": the underline you write on. It is the
   3:1 boundary (WCAG 1.4.11) and the brand's sublinhar in one stroke.
   -------------------------------------------------------------------------- */

.sb-field { display: block; }
.sb-label { display: block; margin: 0 0 8px; font-size: var(--app-fs-label); font-weight: var(--fw-semibold); line-height: 1.3; color: var(--ink); }
.sb-input {
  --field-h: 48px;
  --field-px: 16px;
  display: block;
  width: 100%;
  height: var(--field-h);
  box-sizing: border-box;
  padding: 0 var(--field-px);
  border: 0;
  border-radius: var(--r-md);
  background-color: var(--glass-solid);
  background-image: linear-gradient(var(--line-signal), var(--line-signal));
  background-repeat: no-repeat;
  background-size: calc(100% - var(--field-px) * 2) 1.5px;
  background-position: var(--field-px) calc(100% - 9px);
  box-shadow: inset 0 0 0 1px var(--line-control);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: 1.2;
  caret-color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  transition: box-shadow var(--dur-quick) var(--ease-out), background-color var(--dur-base) var(--ease-out), background-size var(--dur-calm) var(--ease-sweep);
}
.sb-app .sb-input { --field-h: 44px; --field-px: 14px; font-size: var(--app-fs-body); }
.sb-input::placeholder { color: var(--ink-3); opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .sb-input:hover { box-shadow: inset 0 0 0 1px var(--line-signal); }
}
.sb-input:focus { outline: 2px solid transparent; background-color: var(--surface); background-image: linear-gradient(var(--ink), var(--ink)); background-size: calc(100% - var(--field-px) * 2) 2px; box-shadow: var(--focus-ring-inset), 0 0 0 4px rgba(var(--butter-rgb), 0.7); }
/* In the app, focus turns the writing line into an 8 px marker band (about 18 % of the field) */
.sb-app .sb-input:focus { background-image: linear-gradient(var(--butter-mark), var(--butter-mark)); background-size: calc(100% - var(--field-px) * 2) 8px; background-position: var(--field-px) calc(100% - 7px); }
.sb-input[aria-invalid="true"] { background-color: var(--rose-wash); background-image: linear-gradient(var(--rose-signal), var(--rose-signal)); box-shadow: inset 0 0 0 1.5px rgba(var(--ink-rgb), 0.32); }
/* after the invalid rule, so a focused invalid field still shows its ring */
.sb-input[aria-invalid="true"]:focus { box-shadow: var(--focus-ring-inset), 0 0 0 4px rgba(var(--butter-rgb), .7); }
/* Only :disabled fades; read-only (a locked address) keeps full ink */
.sb-input:disabled { opacity: 0.55; cursor: not-allowed; }
.sb-input[readonly] { opacity: 1; color: var(--ink); cursor: default; }
/* data-pulse: the value blurs for a breath (never the ring). Re-add to replay. */
@media (prefers-reduced-motion: no-preference) {
  .sb-input[data-pulse] { animation: sb-input-pulse 360ms cubic-bezier(0.45, 0, 0.3, 1) 1; }
}

.sb-help { margin: 8px 0 0; font-size: var(--app-fs-small); line-height: 1.45; color: var(--ink-2); text-wrap: pretty; }
/* Errors are never red: ink on rose light, with a drawn icon (role="alert" on the element) */
.sb-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 0;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--rose-wash);
  color: var(--ink);
  font-size: var(--app-fs-small);
  line-height: 1.45;
  text-wrap: pretty;
}
.sb-error svg { flex: none; margin-top: 1px; }
.sb-error:empty { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .sb-error:not(:empty) { animation: sb-defog-in var(--dur-calm) var(--ease-defog) both; }
}
/* The attention dot: 16 px, rose-aura halo (r 6.5) + rose-signal core (r 3.5).
   <svg class="sb-attention-dot" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
     <circle cx="8" cy="8" r="6.5" style="fill: var(--rose-aura)"/><circle cx="8" cy="8" r="3.5" style="fill: var(--rose-signal)"/></svg>
   Use style="fill: var(...)": the fill="var(...)" attribute is not resolved. */
.sb-attention-dot { display: block; flex: none; width: 16px; height: 16px; }
.sb-error .sb-attention-dot { margin-top: 1px; }
/* A note: the error's shape on butter light, for information that needs no
   action. No alert role. --glass sits it on the white glass instead. */
.sb-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 0;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--butter-wash);
  color: var(--ink);
  font-size: var(--app-fs-small);
  line-height: 1.45;
  text-wrap: pretty;
}
.sb-note--glass { background: var(--glass-card); box-shadow: inset 0 0 0 1px var(--line); }
.sb-note svg { flex: none; margin-top: 1px; }
.sb-note:empty { display: none; }


/* --------------------------------------------------------------------------
   9. Code input: 6 boxes, grouped 3 + 3
   Markup: one real <input> (autocomplete="one-time-code", inputmode="numeric",
   maxlength="6") laid over six aria-hidden .sb-code__box spans that app.js
   fills. Paste, autofill and screen readers all see one field.
   When a digit lands, the marker passes behind it; on a full paste the six
   bands join into one stroke across the code.
   -------------------------------------------------------------------------- */

.sb-code {
  --code-w: 52px;
  --code-h: 62px;
  --code-gap: 10px;
  --code-split: 14px;
  --code-band: var(--butter-mark);
  position: relative;
  display: inline-flex;
}
/* margins, not flex gap: gap needs Safari 14.1 and a never-updated macOS 11.0-11.2 WebKit lacks it.
   The code must stay legible there; other layouts accept the 14.1 floor (SYSTEM §7). */
.sb-code__box + .sb-code__box { margin-left: var(--code-gap); }
.sb-code__box:nth-of-type(4) { margin-left: calc(var(--code-gap) + var(--code-split)); }
.sb-code--lg { --code-w: 58px; --code-h: 70px; --code-gap: 12px; --code-split: 18px; }
.sb-code__input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;            /* no zoom on phones */
  color: transparent;
  caret-color: transparent;
  background: transparent;
  cursor: text;
}
.sb-code__box {
  --i: 0;
  position: relative;
  isolation: isolate;          /* the band (::before, z -1) paints above the box face, under the digit */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--code-w);
  height: var(--code-h);
  border-radius: var(--r-md);
  background-color: var(--glass-solid);
  background-image: none, linear-gradient(var(--line-signal), var(--line-signal));   /* layer 1 = the writing line; the band is ::before */
  background-repeat: no-repeat;
  background-size: 0% 34px, 18px 1.5px;
  background-position: 7px 50%, 50% calc(100% - 12px);
  box-shadow: inset 0 0 0 1px var(--line-control);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--app-fs-code);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--track-code);
  line-height: 1;
  transition:
    background-size var(--dur-sweep-short) var(--ease-sweep),
    background-color var(--dur-base) var(--ease-out),
    box-shadow var(--dur-quick) var(--ease-out);
}
/* The band: drawn on ::before (inset 4 px, radius 3 px) and swept with scaleX,
   so it never repaints the box and stays inside the blur budget. */
.sb-code__box::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 34px;
  margin-top: -17px;
  border-radius: 3px;
  background: linear-gradient(180deg, transparent 0%, var(--code-band) 18%, var(--code-band) 84%, transparent 100%);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--dur-sweep-short) var(--ease-sweep);
}
.sb-code__box[data-filled]::before { transform: none; }
/* a pasted or autofilled code draws ONE stroke: the bands follow each other 50 ms apart.
   Typed digits get no delay (a typing lag would feel broken). app.js sets data-pasted. */
.sb-code[data-pasted] .sb-code__box { transition-delay: calc(var(--i) * var(--stagger-tight)), 0s, 0s; }
.sb-code[data-pasted] .sb-code__box::before { transition-delay: calc(var(--i) * var(--stagger-tight)); }
.sb-code--lg .sb-code__box { font-size: 30px; }
/* filled: the band passes behind the digit, the writing line steps aside */
.sb-code__box[data-filled] { background-size: 0 34px, 0 1.5px; background-color: var(--surface); }
/* the box that takes the next digit */
.sb-code__box[data-active] { box-shadow: var(--focus-ring-inset), 0 0 0 4px rgba(var(--butter-rgb), 0.7); background-color: var(--surface); }
.sb-code__box[data-active]::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 28px; margin: -14px 0 0 -1px; border-radius: 1px; background: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .sb-code__box[data-active]::after { animation: sb-caret 1.1s steps(1, end) infinite; }
}
/* a digit surfaces as it lands (typed: at once; pasted: in order) */
@media (prefers-reduced-motion: no-preference) {
  .sb-code__box[data-filled] { animation: sb-digit 180ms cubic-bezier(0.23, 1, 0.32, 1) both; }
  .sb-code[data-pasted] .sb-code__box[data-filled] { animation-delay: calc(var(--i) * var(--stagger-tight)); }
}
/* boxes already filled when the view arrives (a sheet reopening, a re-render)
   do not replay their entry: set data-noreplay on .sb-code. Scoped to the entry
   only, so the error pulse and the success ring still play with data-noreplay set. */
.sb-code[data-noreplay]:not([data-state="error"]):not([data-state="success"]) .sb-code__box[data-filled] { animation: none; }
/* error: rose light, rose band, the digits blur for a breath (a memory losing focus):
   a text-shadow pulse on the digits only, never a per-box filter (blur budget).
   No shake, no red. Digits stay and are selected for retyping. */
.sb-code[data-state="error"] { --code-band: var(--rose-mark); }
.sb-code[data-state="error"] .sb-code__box { background-color: var(--rose-wash); box-shadow: inset 0 0 0 1.5px rgba(var(--ink-rgb), 0.32); }
@media (prefers-reduced-motion: no-preference) {
  .sb-code[data-state="error"] .sb-code__box { animation: sb-fogpulse 360ms cubic-bezier(0.45, 0, 0.3, 1) 1; }
}
/* success: one butter light passes over the whole stroke (multiplied, so it
   reads on white), then each box takes an ink ring, left to right. The
   digits do not replay their entry. */
.sb-code[data-state="success"]::after {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: 1;
  border-radius: var(--r-lg);
  background-image: linear-gradient(100deg, rgba(var(--butter-rgb), 0) 35%, rgba(var(--butter-rgb), 0.9) 50%, rgba(var(--butter-rgb), 0) 65%);
  background-repeat: no-repeat;
  background-size: 260% 100%;
  background-position: 130% 0;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.sb-code[data-state="success"] .sb-code__box { box-shadow: inset 0 0 0 1.5px var(--state-done); transition: box-shadow 240ms cubic-bezier(0.23, 1, 0.32, 1) calc(300ms + var(--i) * 60ms); animation: none; }
@media (prefers-reduced-motion: no-preference) {
  .sb-code[data-state="success"]::after { animation: sb-shine 900ms var(--ease-sweep) 300ms both; }
  .sb-code[data-state="success"] .sb-code__box, .sb-code[data-state="success"][data-pasted] .sb-code__box[data-filled] { animation: sb-ring-in 240ms cubic-bezier(0.23, 1, 0.32, 1) calc(300ms + var(--i) * 60ms) both; }
}
/* reduced motion: every ring arrives at once, one short cross-fade (no stagger) */
@media (prefers-reduced-motion: reduce) {
  .sb-code[data-state="success"] .sb-code__box { transition-delay: 0s; }
}
/* waiting for the code to arrive / sending again: locked, neutral (no band, no wash) */
.sb-code[data-state="locked"] { --code-band: transparent; }
.sb-code[data-state="locked"] .sb-code__box { background-color: transparent; box-shadow: inset 0 0 0 1px var(--line-control); }
.sb-code[data-state="locked"] .sb-code__input { cursor: not-allowed; }


/* --------------------------------------------------------------------------
   10. Card: a highlight on white glass
   -------------------------------------------------------------------------- */

.sb-card {
  --card-pad: 24px 26px 22px;
  position: relative;
  margin: 0;
  padding: var(--card-pad);
  box-sizing: border-box;
  border-radius: var(--r-lg);
  background: var(--glass-card);
  box-shadow: var(--edge), var(--elev-2);
  color: var(--ink);
}
.sb-card--glass { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.sb-card--flat { box-shadow: var(--edge), var(--elev-1); }
.sb-card--lg { --card-pad: 30px 32px 26px; border-radius: var(--r-xl); }
.sb-app .sb-card { --card-pad: 18px 18px 16px; }
.sb-card__quote { margin: 0; font-size: var(--fs-quote); line-height: var(--lh-quote); letter-spacing: var(--track-snug); text-wrap: pretty; quotes: none; }
.sb-card--lg .sb-card__quote { font-size: var(--fs-quote-lg); line-height: 1.45; }
.sb-app .sb-card__quote { font-size: var(--app-fs-quote); font-weight: var(--fw-medium); line-height: 1.5; }
.sb-card__source { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.sb-card__source--rule { padding-top: 16px; border-top: 1px solid var(--line); }
.sb-card__title { font-size: 0.875rem; font-weight: var(--fw-semibold); line-height: 1.35; color: var(--ink); }
.sb-card__author { font-size: var(--fs-caption); line-height: 1.35; color: var(--ink-2); }
.sb-app .sb-card__title { font-size: var(--app-fs-small); }
.sb-app .sb-card__author { font-size: 12px; }

/* Interactive card: lifts toward the light, the light blooms behind it,
   its marks pass again. */
.sb-card[data-interactive] { cursor: pointer; transition: translate var(--dur-calm) var(--ease-out), box-shadow var(--dur-calm) var(--ease-out); }
.sb-card[data-interactive]::before {
  content: "";
  position: absolute;
  inset: 8% 6% -6%;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(closest-side, rgba(var(--butter-rgb), 0.9), rgba(var(--rose-rgb), 0.5) 60%, rgba(var(--rose-rgb), 0));
  filter: blur(28px);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .sb-card[data-interactive]:hover { translate: 0 var(--lift-card); box-shadow: var(--edge), var(--elev-4); }
  .sb-card[data-interactive]:hover::before { opacity: 1; }
  .sb-card[data-interactive]:hover .sb-mark { animation: sb-sweep var(--dur-sweep-short) var(--ease-sweep) both; }
}
.sb-card[data-interactive]:focus-within { box-shadow: var(--edge), var(--elev-4), var(--focus-ring); }


/* --------------------------------------------------------------------------
   11. Glass window (the app, 760 × 480) and its parts
   In the app the OS draws the window and its lights: use .sb-window--native.
   On canvas boards it sits on .sb-stage (880 × 560) with the aura behind.
   -------------------------------------------------------------------------- */

.sb-stage { position: relative; width: 880px; height: 560px; overflow: hidden; background: var(--paper); font-family: var(--font); color: var(--ink); }
.sb-stage > .sb-window { position: absolute; left: 60px; top: 40px; }
.sb-window {
  position: relative;
  width: var(--app-w);
  height: var(--app-h);
  box-sizing: border-box;
  overflow: hidden;
  border-radius: var(--r-xl);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--edge), var(--elev-3);
  z-index: var(--z-content);
}
.sb-window--native { width: 100vw; height: 100vh; min-width: var(--app-w); min-height: var(--app-h); border-radius: 0; box-shadow: none; }
.sb-window--native .sb-window__lights { display: none; }
.sb-window__lights { position: absolute; left: 20px; top: 20px; display: flex; gap: 8px; z-index: 3; }
.sb-window__lights > span { display: block; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.14); }
.sb-window__lights > span:nth-child(1) { background: var(--sys-red); }
.sb-window__lights > span:nth-child(2) { background: var(--sys-yellow); }
.sb-window__lights > span:nth-child(3) { background: var(--sys-green); }
.sb-window__bar { position: absolute; left: 0; right: 0; top: var(--app-bar-y); height: 24px; display: flex; align-items: center; justify-content: center; gap: 12px; z-index: 2; }
.sb-window__title { margin: 0; font-size: var(--app-fs-micro); font-weight: var(--fw-semibold); line-height: 24px; color: var(--ink-2); }
.sb-window__body { position: absolute; left: var(--app-pad-x); right: var(--app-pad-x); top: var(--app-pad-top); bottom: var(--app-foot-h); }
.sb-window__foot { position: absolute; left: 0; right: 0; bottom: 0; height: var(--app-foot-h); box-sizing: border-box; padding: 0 var(--app-foot-pad); display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); }
.sb-window__foot-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Step changes (old step fogs out 180 ms, new one defogs in 420 ms,
   direction-aware) live in motion.css: .sb-step-out / .sb-step-in on
   .sb-window__body, [data-dir="back"] on the window mirrors them.
   The bar (step indicator) and the foot never move. */

/* Sheet over the panel (Notion): the panel behind fogs under a paper veil */
/* Sheets are in-window (no separate Settings window). While one is open:
   - the window bar (title, gear) stays OUTSIDE .sb-behind, sharp; the gear
     goes inactive (.sb-iconbtn--idle, 50 %);
   - .sb-behind (body + foot) recedes: opacity .4 at a fixed blur 4. Only the
     opacity animates on entry (motion.css), never the filter;
   - [data-fogged="deep"] (I-03): .28 and desaturated, so the sheet's button
     is the only dark object in view;
   - .sb-veil lays the paper veil from just under the bar;
   - the sheet hangs 6 px under the veil: top 44, 424 high (never over the lights). */
.sb-behind { transition: opacity var(--dur-calm) var(--ease-out); }
.sb-behind[data-fogged] { filter: blur(var(--blur-veil)); opacity: 0.4; pointer-events: none; }
.sb-behind[data-fogged="deep"] { opacity: 0.28; filter: blur(var(--blur-veil)) saturate(0.7); }
.sb-veil { position: absolute; left: 0; right: 0; top: 38px; bottom: 0; z-index: 30; background: var(--veil); pointer-events: none; }
.sb-sheet { position: absolute; left: 60px; top: 44px; width: 640px; height: 424px; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-lg); background: var(--glass-solid); box-shadow: var(--edge), var(--elev-3); z-index: var(--z-sheet); }
.sb-sheet__body { flex: 1 1 auto; min-height: 0; padding: 32px var(--app-sheet-pad) 28px; }
.sb-sheet__foot { flex: none; height: 72px; box-sizing: border-box; margin-top: auto; padding: 0 var(--app-sheet-pad); display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.sb-sheet__foot-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }
@media (prefers-reduced-motion: no-preference) {
  .sb-sheet[data-entering] { animation: sb-sheet-in var(--dur-calm) var(--ease-out) both; }
}

/* Icon button (the panel's Settings gear): 32 px round, quiet until hovered */
.sb-iconbtn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r-pill); background-color: transparent; color: var(--ink-2); text-decoration: none; cursor: pointer; transition: background-color var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick) var(--ease-out), opacity var(--dur-quick) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .sb-iconbtn:hover { background-color: var(--glass-card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
}
.sb-iconbtn:focus { outline: 2px solid transparent; color: var(--ink); box-shadow: var(--focus-ring); }
.sb-iconbtn:focus:not(:focus-visible) { box-shadow: none; }
.sb-iconbtn--idle { opacity: 0.5; pointer-events: none; }

/* Panel rows: 52 high; 32 px icon pill | 104 px label | value | action (.sb-btn--xs) */
.sb-rows { margin: 16px 0 0; padding: 0 10px 0 14px; list-style: none; border-radius: var(--r-lg); background: var(--glass-card); box-shadow: var(--edge), var(--elev-1); }
.sb-row { display: grid; grid-template-columns: 32px 104px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; height: 52px; box-sizing: border-box; }
.sb-row + .sb-row { border-top: 1px solid var(--line); }
.sb-row__icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-pill); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink); }
.sb-row__icon-dot { position: absolute; right: -1px; top: -1px; width: 10px; height: 10px; box-sizing: border-box; border-radius: 50%; background: var(--rose-signal); box-shadow: 0 0 0 2px var(--surface); }
.sb-row__label { margin: 0; font-size: var(--app-fs-label); font-weight: var(--fw-semibold); line-height: 1.3; color: var(--ink); }
.sb-row__value { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: var(--app-fs-label); line-height: 1.3; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sb-row__value > span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Attention row: rose light on the rows' grid (32 px dot slot, 14 px gap, text on the label column) */
.sb-attention { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; height: 52px; box-sizing: border-box; margin-top: 16px; padding: 0 10px 0 14px; border-radius: var(--r-md); background: var(--rose-wash); }
.sb-attention > .sb-attention-dot { justify-self: center; }
.sb-attention__text { min-width: 0; margin: 0; font-size: var(--app-fs-body); font-weight: var(--fw-semibold); line-height: 1.3; color: var(--ink); }

/* Step indicator: 3 segments + "Step n of 3" (Welcome and Done show none) */
.sb-steps { display: flex; align-items: center; gap: 12px; }
.sb-steps__segs { display: flex; gap: 4px; }
.sb-steps__segs > i { position: relative; display: block; width: 20px; height: 4px; overflow: hidden; border-radius: var(--r-pill); background: rgba(var(--ink-rgb), 0.12); }
.sb-steps__segs > i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--ink); transform: scaleX(0); transform-origin: left center; transition: transform var(--dur-calm) var(--ease-sweep); }
.sb-steps__segs > i.on::after, .sb-steps__segs > i[data-on]::after { transform: scaleX(1); }
.sb-steps__label { font-size: var(--app-fs-micro); font-weight: var(--fw-medium); line-height: 24px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Progress (reading your Kindle, first review) */
.sb-track { position: relative; height: 4px; overflow: hidden; border-radius: var(--r-pill); background: rgba(var(--ink-rgb), 0.1); }
.sb-track__fill { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: var(--ink); transform: scaleX(var(--progress, 0)); transform-origin: left center; transition: transform var(--dur-calm) var(--ease-out); }
.sb-track__fill::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 60%; transform: translateX(-100%); background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)); }   /* white glint on the ink fill */
/* Indeterminate (no count yet): no fill, an ink glint alone. Its resting and
   reduced pose is centred (the glint is 60 % wide, so 33.333 % centres it);
   data-running moves it. Markup: style="--progress: 1" on the fill. */
.sb-track[data-indeterminate] .sb-track__fill { background: transparent; }
.sb-track[data-indeterminate] .sb-track__fill::after { transform: translateX(33.333%); background: linear-gradient(90deg, rgba(var(--ink-rgb), 0), rgba(var(--ink-rgb), 0.6), rgba(var(--ink-rgb), 0)); }
@media (prefers-reduced-motion: no-preference) {
  .sb-track[data-running] .sb-track__fill::after { animation: sb-track-glint 2.8s var(--ease-in-out) 0.6s infinite; }
}


/* --------------------------------------------------------------------------
   12. Marker band ("o traço")
   Colour = the one the reader used on their Kindle. Text on it: ink only.
   -------------------------------------------------------------------------- */

.sb-mark {
  --mark: var(--butter-mark);
  padding: 0 0.18em;
  margin: 0 -0.1em;
  border-radius: var(--r-mark);
  color: var(--ink);
  /* slice (director merge): a multi-line mark is one stroke laid line after
     line, like Kindle's own highlight; the sweep then travels line 1, then
     line 2. Only the first and last fragments get the rounded ends. */
  -webkit-box-decoration-break: slice;
  box-decoration-break: slice;
  background-color: transparent;
  background-image: linear-gradient(180deg, transparent 0%, var(--mark) 18%, var(--mark) 84%, transparent 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: 0 0;
}
mark.sb-mark { background-color: transparent; }
.sb-mark[data-color="yellow"], .sb-mark[data-color="butter"], .sb-mark.yellow { --mark: var(--butter-mark); }
.sb-mark[data-color="pink"], .sb-mark[data-color="rose"], .sb-mark.pink { --mark: var(--rose-mark); }
.sb-mark[data-color="blue"], .sb-mark[data-color="sky"], .sb-mark.blue { --mark: var(--sky-mark); }
.sb-mark[data-color="orange"], .sb-mark[data-color="peach"], .sb-mark.orange { --mark: var(--peach-mark); }

/* The full gesture on load is motion.css .sb-gesture-load; on scroll it is
   .sb-gesture / .sb-sweep. Here only the instant UI mark: a chip or a saved
   value gets marked now (re-add the class to replay). */
@media (prefers-reduced-motion: no-preference) {
  .sb-mark-now { animation: sb-sweep var(--dur-sweep-short) var(--ease-sweep) both; }
}


/* --------------------------------------------------------------------------
   13. Book cover
   -------------------------------------------------------------------------- */

.sb-cover {
  --cover: var(--cover-1);
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: var(--r-xs) var(--r-sm) var(--r-sm) var(--r-xs);
  background: var(--cover);
  box-shadow: var(--elev-cover);
  color: #FFFFFF;
  font-family: var(--font);
  font-weight: var(--fw-semibold);
  line-height: 1.15;
}
.sb-cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.sb-cover > span:last-child:not(:first-child) { font-weight: var(--fw-regular); opacity: 0.85; }
.sb-cover--xs { width: 26px; height: 38px; padding: 4px 3px; font-size: 5.5px; }
.sb-cover--sm { width: 32px; height: 46px; padding: 5px 4px; font-size: 6.5px; }
.sb-cover--md { width: 40px; height: 60px; padding: 6px 5px; font-size: 7.5px; border-radius: 3px 6px 6px 3px; }   /* = the email cover */
.sb-cover--lg { width: 52px; height: 76px; padding: 7px 6px; font-size: 9px; }
.sb-cover--xl { width: 76px; height: 112px; padding: 10px 9px; font-size: 12px; }
.sb-cover--blank > span { display: none; }
/* In the app, 6.5-7.5 px lettering is below the 12 px floor: the source row names the book.
   (A-06b's mini email keeps lettering, like the email itself.) */
.sb-app .sb-cover--sm > span, .sb-app .sb-cover--md > span { display: none; }
.sb-cover[data-cover="1"] { --cover: var(--cover-1); }
.sb-cover[data-cover="2"] { --cover: var(--cover-2); }
.sb-cover[data-cover="3"] { --cover: var(--cover-3); }
.sb-cover[data-cover="4"] { --cover: var(--cover-4); }
.sb-cover[data-cover="5"] { --cover: var(--cover-5); }
.sb-cover[data-cover="6"] { --cover: var(--cover-6); }


/* --------------------------------------------------------------------------
   14. Wordmark: the band + the underline, then "Sublinea"
   SVG (64-unit grid):
   <svg class="sb-wordmark__symbol" viewBox="0 0 64 64" aria-hidden="true">
     <g transform="rotate(-7 32 30.5)"><rect class="sb-wordmark__band" x="9" y="21" width="46" height="19" rx="9.5"/></g>
     <line class="sb-wordmark__line" x1="5" y1="35.5" x2="59" y2="35.5" pathLength="1"/>
   </svg>
   The rotate lives on <g> so CSS can scale the <rect> without losing it.
   -------------------------------------------------------------------------- */

.sb-wordmark {
  --wm-size: 19px;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 44px;
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--wm-size);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.025em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.sb-wordmark--lg { --wm-size: 52px; letter-spacing: -0.032em; gap: 0.32em; }
.sb-wordmark__symbol { width: 1.42em; height: 1.42em; flex: none; overflow: visible; }
.sb-wordmark__band { fill: var(--brand-band); transform-box: fill-box; transform-origin: left center; }
.sb-wordmark__line { stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; fill: none; stroke-dasharray: 1; stroke-dashoffset: 0; }
/* First paint: the line is drawn, then the band is laid over it */
@media (prefers-reduced-motion: no-preference) {
  .sb-wordmark[data-intro] .sb-wordmark__line { animation: sb-line-draw 520ms var(--ease-out) 120ms both; }
  .sb-wordmark[data-intro] .sb-wordmark__band { animation: sb-band-in 640ms var(--ease-sweep) 420ms both; }
}
@media (hover: hover) and (pointer: fine) {
  .sb-wordmark:hover .sb-wordmark__band { animation: sb-band-in 520ms var(--ease-sweep) both; }
}
/* Menu bar template image: one colour, band at 40 % (see SYSTEM.md) */


/* --------------------------------------------------------------------------
   14b. App icon tile: one recipe at 44 / 56 / 92 (--sm / default / --lg).
   macOS grid (824 of 1024, about 10 % transparent margin), superellipse-like
   radius, soft drop shadow, four-colour aura on white. The symbol inside
   uses the icon geometry: band y 21-40, line at y 33.
   <span class="sb-app-icon"><svg viewBox="0 0 64 64" aria-hidden="true">
     <g transform="rotate(-7 32 30.5)"><rect class="sb-app-icon__band" x="9" y="21" width="46" height="19" rx="9.5"/></g>
     <line class="sb-app-icon__line" x1="5" y1="33" x2="59" y2="33"/></svg></span>
   -------------------------------------------------------------------------- */

.sb-app-icon {
  --icon-size: 56px;
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--icon-size);
  height: var(--icon-size);
  border-radius: calc(var(--icon-size) * 0.228);
  background:
    radial-gradient(60% 60% at 8% 6%, rgba(var(--butter-rgb), 0.95), rgba(var(--butter-rgb), 0)),
    radial-gradient(56% 56% at 96% 4%, rgba(var(--rose-rgb), 0.8), rgba(var(--rose-rgb), 0)),
    radial-gradient(58% 58% at 4% 98%, rgba(var(--sky-rgb), 0.85), rgba(var(--sky-rgb), 0)),
    radial-gradient(58% 58% at 98% 96%, rgba(var(--peach-rgb), 0.85), rgba(var(--peach-rgb), 0)),
    var(--surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), 0 0 0 0.5px rgba(var(--ink-rgb), 0.12), 0 calc(var(--icon-size) * 0.022) calc(var(--icon-size) * 0.044) rgba(var(--contact-rgb), 0.12), 0 calc(var(--icon-size) * 0.13) calc(var(--icon-size) * 0.24) calc(var(--icon-size) * -0.11) rgba(var(--contact-rgb), 0.38);
}
.sb-app-icon--sm { --icon-size: 44px; }
.sb-app-icon--lg { --icon-size: 92px; }
.sb-app-icon::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 46%); pointer-events: none; }
.sb-app-icon > svg { position: relative; z-index: 1; width: 87%; height: 87%; overflow: visible; }
.sb-app-icon__band { fill: var(--brand-band); }
.sb-app-icon__line { stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }


/* --------------------------------------------------------------------------
   15. The rotating word lives in motion.css (.sb-rotate): one engine for
       the site hero and, when a second source ships, the app's step 2.
   -------------------------------------------------------------------------- */


/* --------------------------------------------------------------------------
   16. Scroll: "pass" only. Reveals, parallax, scenes and the pinned story
       are motion.css (.sb-reveal, .sb-fog-in, .sb-gesture, .sb-stagger,
       .sb-sweep, .sb-scene + .sb-parallax, .sb-story). The old
       [data-reveal] + .sb-motion observer API is retired (two reveal APIs
       would drift); production uses motion.css's .sb-latch fallback.
   [data-pass]: quotes are sharp in the middle of the viewport and fog
   slightly at the edges, as you pass over them. Decorative quotes only.
   -------------------------------------------------------------------------- */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    [data-pass] { animation: sb-pass linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
  }
}


/* --------------------------------------------------------------------------
   17. Keyframes
   -------------------------------------------------------------------------- */

/* Keyframes the app uses carry literal values: old WebKit mishandles var() inside @keyframes */
@keyframes sb-defog-in { from { filter: blur(12px); opacity: 0.2; transform: translateY(8px); } to { filter: blur(0); opacity: 1; transform: none; } }
@keyframes sb-defog-out { from { filter: blur(0); opacity: 1; } to { filter: blur(6px); opacity: 0; } }
@keyframes sb-sweep { from { background-size: 0% 100%; } to { background-size: 100% 100%; } }
@keyframes sb-pass {
  0% { filter: blur(var(--blur-pass)); opacity: 0.55; }
  30%, 70% { filter: blur(0); opacity: 1; }
  100% { filter: blur(var(--blur-pass)); opacity: 0.55; }
}
@keyframes sb-aura-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(3%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 2%, 0) scale(0.98); }
}
@keyframes sb-glint { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@keyframes sb-shine { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@keyframes sb-track-glint { from { transform: translateX(-100%); } to { transform: translateX(185%); } }
@keyframes sb-caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes sb-digit { from { opacity: 0.2; filter: blur(3px); transform: scale(0.92); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes sb-fogpulse { 35% { color: transparent; text-shadow: 0 0 4px rgba(35, 38, 43, 0.75); } }   /* digits only, no filter */
@keyframes sb-input-pulse { 40% { -webkit-text-fill-color: transparent; text-shadow: 0 0 5px rgba(35, 38, 43, 0.75); } }
@keyframes sb-ring-in { from { box-shadow: inset 0 0 0 1px rgba(35, 38, 43, 0.24); } }
@keyframes sb-breathe { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }
@keyframes sb-sheet-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes sb-line-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
/* The band extends like a marker (clip), so its round caps never squash (was scaleX). Intro and hover. */
@keyframes sb-band-in { from { clip-path: inset(0 88% 0 0 round 9.5px); } to { clip-path: inset(0 0 0 0 round 9.5px); } }


/* --------------------------------------------------------------------------
   18. Preferences and modes
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .sb-btn, .sb-chip, .sb-card[data-interactive], .sb-link, .sb-input, .sb-code__box { transition-duration: var(--dur-quick) !important; }
  .sb-aura > span { animation: none !important; }
  [data-pass], .sb-parallax { animation: none !important; translate: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .sb-glass, .sb-glass--card, .sb-window, .sb-card--glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
/* The app: WebKit has no reduced-transparency query. app.js reads
   NSWorkspace.accessibilityDisplayShouldReduceTransparency and sets this class on <html>. */
.sb-reduce-transparency .sb-glass, .sb-reduce-transparency .sb-glass--card, .sb-reduce-transparency .sb-window, .sb-reduce-transparency .sb-card--glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (forced-colors: active) {
  .sb-mark { forced-color-adjust: none; background: Mark; color: MarkText; }
  .sb-btn { border: 1px solid ButtonText; }
  .sb-btn::before, .sb-btn::after { display: none; }
  .sb-input, .sb-code__box, .sb-chip { border: 1px solid CanvasText; }
  .sb-chip[aria-checked="true"], .sb-chip[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  [data-depth] { filter: none; opacity: 1; }
}
@media print {
  .sb-aura, [data-depth] { display: none; }
  .sb-glass, .sb-window, .sb-card { background: #FFFFFF; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
