/* RFS project page styles, shared by every Real-Fruit-Snacks tool page. Tokens: rfs.css.
   Follows BRAND.md 1.2.0: body 16px, the Ember focus ring, on-primary on Ember fills,
   line-strong on control borders, motion tokens. Every class from the 1.1 file is kept,
   so a tool page can take this file as-is. Page-specific styles go in their own file. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); }

/* ---------- page tokens (BRAND.md §2; colours, space and motion come from rfs.css) ---------- */
:root {
  color-scheme: dark;
  --night: 1;                       /* 1 in Nightshift, 0 in Dayshift: drives the glow */
  --card-shadow: 0 0 0 transparent;
  --glow-shadow: 0 0 80px color-mix(in srgb, var(--rfs-primary) 14%, transparent);   /* Nightshift only */
  --fs-display: 48px; --lh-display: 1.05; --ls-display: -0.03em;
  --fs-h1: 32px;      --lh-h1: 1.1;       --ls-h1: -0.02em;
  --fs-h2: 22px;      --lh-h2: 1.2;       --ls-h2: -0.01em;
  --fs-body: 16px;    --lh-body: 1.6;
  --fs-small: 13px;   --lh-small: 1.5;
  --fs-label: 11px;   --ls-label: 0.08em;
  --fs-code: 13px;    --lh-code: 1.7;
  --ls-wordmark: -0.05em;
  --r-card: 10px; --r-chip: 5px;
  --wrap: 1040px; --gutter: var(--rfs-space-5);
  --measure: 68ch;
}
:root[data-theme="dayshift"] { color-scheme: light; --night: 0; --card-shadow: 0 1px 0 rgb(0 0 0 / .04); --glow-shadow: 0 0 0 transparent; }
@media (prefers-color-scheme: light) { :root:not([data-theme="nightshift"]) { color-scheme: light; --night: 0; --card-shadow: 0 1px 0 rgb(0 0 0 / .04); --glow-shadow: 0 0 0 transparent; } }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { background: var(--rfs-bg); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--rfs-bg); color: var(--rfs-text); font-family: var(--rfs-font-sans);
  font-size: var(--fs-body); line-height: var(--lh-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: color-mix(in srgb, var(--rfs-primary) 30%, transparent); color: var(--rfs-text); }
:focus-visible { outline: 2px solid var(--rfs-primary); outline-offset: 3px; border-radius: 2px; }   /* BRAND.md §1 focus */
img, svg { max-width: 100%; }
a { color: var(--rfs-text); text-decoration: underline; text-decoration-color: var(--rfs-line-strong); text-decoration-thickness: 1px; text-underline-offset: 3px;
  transition: text-decoration-color var(--rfs-dur-fast) var(--rfs-ease), color var(--rfs-dur-fast) var(--rfs-ease); }
@media (hover: hover) { a:hover { text-decoration-color: var(--rfs-primary); } }
code, kbd { font-family: var(--rfs-font-mono); font-size: var(--fs-code); }
code { background: var(--rfs-raised); border: 1px solid var(--rfs-line); border-radius: 4px; padding: 1px 6px; }
pre { font-family: var(--rfs-font-mono); font-size: var(--fs-code); line-height: var(--lh-code); background: var(--rfs-code-bg); color: var(--rfs-text);
  border: 1px solid var(--rfs-line); border-radius: 8px; padding: var(--rfs-space-4) var(--rfs-space-5); overflow-x: auto; margin: 0; tab-size: 2; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
/* BRAND.md §9: code is text, comments mute, strings Amber. Terminal output: prompt Ember, ok Mint, warn Amber, fail Raspberry. */
pre .c { color: var(--rfs-mute); } pre .str { color: var(--rfs-accent); }
pre .p { color: var(--rfs-primary); font-weight: 600; } pre .a { color: var(--rfs-accent); } pre .s { color: var(--rfs-signal); } pre .f { color: var(--rfs-fault); } pre .o { color: var(--rfs-mute); }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: var(--ls-h1); text-wrap: balance; }
h2 { font-size: var(--fs-h2); font-weight: 600; letter-spacing: var(--ls-h2); line-height: var(--lh-h2); margin-bottom: var(--rfs-space-4); }
p { margin: 0 0 var(--rfs-space-3); text-wrap: pretty; }
.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.label { font-family: var(--rfs-font-mono); font-size: var(--fs-label); font-weight: 500; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--rfs-mute); margin: 0 0 var(--rfs-space-3); }
.label::before { content: ""; display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--rfs-primary); vertical-align: middle; margin-right: 10px; }
.mute { color: var(--rfs-mute); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--rfs-space-4); top: -100px; z-index: 20; background: var(--rfs-surface); color: var(--rfs-text); padding: var(--rfs-space-2) var(--rfs-space-4); border: 1px solid var(--rfs-line-strong); border-radius: 6px; }
.skip:focus { top: var(--rfs-space-3); }

/* ---------- header ---------- */
header.site { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--rfs-bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--rfs-line); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: var(--rfs-space-4); }
.brand { display: flex; align-items: center; gap: var(--rfs-space-3); text-decoration: none; min-height: 40px; }
.brand img { height: 26px; width: auto; display: block; }
.brand .sep { width: 1px; height: 20px; background: var(--rfs-line); }
.brand .name { font-family: var(--rfs-font-mono); font-weight: 600; font-size: 15px; letter-spacing: -0.02em; color: var(--rfs-text); }
nav { display: flex; align-items: center; gap: var(--rfs-space-5); }
nav a { color: var(--rfs-mute); font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; }
@media (hover: hover) { nav a:hover { color: var(--rfs-text); } }
nav a[aria-current="true"] { color: var(--rfs-text); }
/* Theme switch: both names visible, the live one underlined with the Ember rule. */
.toggle { font-family: var(--rfs-font-mono); font-size: var(--fs-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--rfs-mute);
  background: var(--rfs-surface); border: 1px solid var(--rfs-line-strong); border-radius: 6px; padding: 0 var(--rfs-space-3); min-height: 32px;
  display: inline-flex; align-items: center; gap: var(--rfs-space-3); cursor: pointer;
  transition: border-color var(--rfs-dur-fast) var(--rfs-ease), color var(--rfs-dur-fast) var(--rfs-ease); }
.toggle .night, .toggle .day { position: relative; padding: 3px 0; }
.toggle .night::after, .toggle .day::after { content: ""; position: absolute; left: 0; right: .08em; bottom: -1px; height: 2px; border-radius: 1px; background: var(--rfs-primary);
  transform-origin: left; transition: transform var(--rfs-dur-base) var(--rfs-ease); }
.toggle .night { color: var(--rfs-text); } .toggle .day::after { transform: scaleX(0); }
:root[data-theme="dayshift"] .toggle .night { color: inherit; } :root[data-theme="dayshift"] .toggle .night::after { transform: scaleX(0); }
:root[data-theme="dayshift"] .toggle .day { color: var(--rfs-text); } :root[data-theme="dayshift"] .toggle .day::after { transform: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="nightshift"]) .toggle .night { color: inherit; } :root:not([data-theme="nightshift"]) .toggle .night::after { transform: scaleX(0); }
  :root:not([data-theme="nightshift"]) .toggle .day { color: var(--rfs-text); } :root:not([data-theme="nightshift"]) .toggle .day::after { transform: none; }
}
@media (hover: hover) { .toggle:hover { color: var(--rfs-text); border-color: var(--rfs-mute); } }
@media (max-width: 760px) { nav a:not(.keep) { display: none; } }
@media (max-width: 480px) { nav { gap: var(--rfs-space-3); } nav a.keep.wide { display: none; } }

/* ---------- tool-page hero (kept for the tool pages) ---------- */
.hero { padding: 72px 0 40px; position: relative; overflow: hidden; }
.hero .grid-bg { position: absolute; inset: 0; background-image: radial-gradient(var(--rfs-line) 1px, transparent 1px); background-size: 26px 26px; opacity: .55;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent); mask-image: linear-gradient(to bottom, #000 40%, transparent); pointer-events: none; }
.hero .glow { position: absolute; left: -10%; top: -30%; width: 60%; height: 120%; opacity: var(--night);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--rfs-primary) 22%, transparent), transparent); pointer-events: none; }
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: var(--rfs-space-7); align-items: center; }
.hero .wrap > * { min-width: 0; }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: 1fr; } }
.hero h1 { font-family: var(--rfs-font-mono); font-size: 56px; line-height: 1.05; letter-spacing: var(--ls-wordmark); font-weight: 600; width: fit-content; }
.hero h1::after { content: ""; display: block; width: 100%; height: 4px; border-radius: 2px; background: var(--rfs-primary); margin-top: var(--rfs-space-4); transform-origin: left; }
@media (prefers-reduced-motion: no-preference) { .hero h1::after { animation: rfs-draw var(--rfs-dur-slow) var(--rfs-ease) 150ms both; } }
.hero .lead { font-size: var(--fs-h2); font-weight: 600; letter-spacing: var(--ls-h2); margin: 22px 0 10px; line-height: 1.3; }
.hero .sub { color: var(--rfs-mute); max-width: 48ch; }
.hero h1.long { font-size: 46px; }
.hero .full { grid-column: 1 / -1; margin-top: var(--rfs-space-2); }
@keyframes rfs-draw { from { transform: scaleX(0); } }

/* ---------- install box (tabs + copy) ---------- */
.install { margin-top: 26px; background: var(--rfs-surface); border: 1px solid var(--rfs-line); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--card-shadow); }
.install.side { margin-top: 0; }
.install .tabs { display: flex; border-bottom: 1px solid var(--rfs-line); background: var(--rfs-raised); }
.install .tabs button { font-family: var(--rfs-font-mono); font-size: var(--fs-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--rfs-mute);
  background: none; border: 0; border-right: 1px solid var(--rfs-line); padding: 0 var(--rfs-space-4); min-height: 40px; cursor: pointer; }
.install .tabs button[aria-selected="true"] { color: var(--rfs-text); background: var(--rfs-surface); box-shadow: inset 0 -2px 0 var(--rfs-primary); }
.install .pane { display: none; padding: 14px var(--rfs-space-4); }
.install .pane[data-active] { display: flex; align-items: center; justify-content: space-between; gap: var(--rfs-space-3); }
.install pre { border: 0; padding: 0; background: none; flex: 1; min-width: 0; }
.install .foot { border-top: 1px solid var(--rfs-line); padding: 10px var(--rfs-space-4); font-size: var(--fs-small); color: var(--rfs-mute); }
.install .foot a { color: var(--rfs-text); }
.copy { font-family: var(--rfs-font-mono); font-size: var(--fs-label); letter-spacing: .06em; text-transform: uppercase; color: var(--rfs-mute);
  border: 1px solid var(--rfs-line-strong); background: var(--rfs-raised); border-radius: 6px; padding: 0 10px; min-height: 32px; min-width: 64px; cursor: pointer; white-space: nowrap;
  transition: color var(--rfs-dur-fast) var(--rfs-ease), border-color var(--rfs-dur-fast) var(--rfs-ease); }
@media (hover: hover) { .copy:hover { color: var(--rfs-text); border-color: var(--rfs-mute); } }
.copy:active { transform: translateY(1px); }
.copy[data-done] { color: var(--rfs-signal); border-color: currentColor; }

/* ---------- terminal (BRAND.md §7 panel, §9 palette) ---------- */
.term { background: var(--rfs-code-bg); border: 1px solid var(--rfs-line); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--card-shadow), var(--glow-shadow); }
.term .bar { display: flex; align-items: center; gap: 7px; padding: 0 14px; height: 34px; background: var(--rfs-surface); border-bottom: 1px solid var(--rfs-line); position: relative; }
.term .bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--rfs-line); }
.term .bar span { position: absolute; left: 50%; transform: translateX(-50%); font-family: var(--rfs-font-mono); font-size: 12px; color: var(--rfs-mute); }
.term pre { border: 0; border-radius: 0; padding: var(--rfs-space-5); font-size: 14px; line-height: 26px; }
.term .ln { display: block; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 26px; }
.term .rest { color: transparent; }
.term .cursor { display: inline-block; width: .6em; height: 16px; margin-right: -.6em; vertical-align: -3px; background: var(--rfs-primary); }
.term .ln.wait { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) { .term .cursor.blink { animation: rfs-blink 1s steps(1) 2; } }
@keyframes rfs-blink { 50% { opacity: 0; } }

/* ---------- sections and shared blocks ---------- */
section { padding: var(--rfs-space-8) 0; border-top: 1px solid var(--rfs-line); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 760px) { .two { grid-template-columns: minmax(0, 1fr); } }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 14px; }
.card { background: var(--rfs-surface); border: 1px solid var(--rfs-line); border-radius: var(--r-card); padding: 18px 20px; box-shadow: var(--card-shadow); }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: var(--rfs-space-2); }
.card p { margin: 0; color: var(--rfs-mute); font-size: 14px; }
.card p code, li code, .mute code { font-size: 12px; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--rfs-font-mono); font-size: var(--fs-label); font-weight: 500; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--rfs-mute);
  padding: 0 10px 10px; border-bottom: 1px solid var(--rfs-line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--rfs-line); vertical-align: top; overflow-wrap: anywhere; }
td:first-child { font-family: var(--rfs-font-mono); font-size: var(--fs-code); white-space: nowrap; overflow-wrap: normal; }
td .k { background: var(--rfs-raised); border: 1px solid var(--rfs-line); border-radius: 4px; padding: 1px 6px; }
ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin: 6px 0; }
ul.plain li::marker { color: var(--rfs-primary); }
.gallery { display: grid; gap: 28px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: auto; display: block; border: 1px solid var(--rfs-line); border-radius: var(--r-card); }
.gallery figcaption { font-size: var(--fs-small); color: var(--rfs-mute); margin-top: 10px; }
.gallery .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.gallery .side { align-self: center; color: var(--rfs-mute); font-size: 15px; }
.gallery .side p { margin: 0 0 10px; }
@media (max-width: 760px) { .gallery .pair { grid-template-columns: 1fr; } }
.cli-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.shot { width: 100%; height: auto; display: block; border: 1px solid var(--rfs-line); border-radius: 12px; box-shadow: var(--card-shadow); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--rfs-space-3); }
.sw { border: 1px solid var(--rfs-line); border-radius: var(--r-card); overflow: hidden; background: var(--rfs-surface); }
.sw i { display: block; height: 64px; }
.sw div { padding: 10px 12px; font-size: var(--fs-small); }
.sw b { display: block; font-weight: 600; }
.sw code { background: none; border: 0; padding: 0; color: var(--rfs-mute); font-size: 12px; }

/* buttons: Ember fill carries on-primary text (dark in Nightshift, white in Dayshift) */
.btn { display: inline-flex; align-items: center; gap: var(--rfs-space-2); font-family: var(--rfs-font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; color: var(--rfs-text); background: var(--rfs-surface); border: 1px solid var(--rfs-line-strong); border-radius: 8px; padding: 0 var(--rfs-space-4); min-height: 40px; cursor: pointer;
  transition: border-color var(--rfs-dur-fast) var(--rfs-ease), background-color var(--rfs-dur-fast) var(--rfs-ease), transform var(--rfs-dur-fast) var(--rfs-ease); }
@media (hover: hover) { .btn:hover { border-color: var(--rfs-mute); } }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--rfs-primary); border-color: var(--rfs-primary); color: var(--rfs-on-primary); font-weight: 600; }
@media (hover: hover) { .btn.primary:hover { background: var(--rfs-primary-hover); border-color: transparent; } }
/* after the hover rule, so pressing wins while the pointer is over the button */
.btn.primary:active { background: var(--rfs-primary-press); border-color: transparent; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: var(--rfs-space-3); }
ol.steps li { counter-increment: s; position: relative; padding-left: 40px; }
ol.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 1px; font-family: var(--rfs-font-mono); font-size: 12px; color: var(--rfs-primary); }

footer { border-top: 1px solid var(--rfs-line); padding: 28px 0 40px; color: var(--rfs-mute); font-size: var(--fs-small); }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--rfs-space-3); align-items: center; }
footer a { color: var(--rfs-mute); }

@media (max-width: 480px) {
  td:first-child { font-size: 12px; padding-right: 6px; }
  .hero h1, .hero h1.long { font-size: 34px; }
  .card p code, li code, .mute code, p code { white-space: normal; overflow-wrap: anywhere; }
  .brand .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
}

/* theme-specific images: !important so .gallery img / .shot can't re-show the hidden one */
.only-day { display: none !important; }
:root[data-theme="dayshift"] .only-night { display: none !important; } :root[data-theme="dayshift"] .only-day { display: block !important; }
@media (prefers-color-scheme: light) { :root:not([data-theme="nightshift"]) .only-night { display: none !important; } :root:not([data-theme="nightshift"]) .only-day { display: block !important; } }

/* theme switch: the new theme sweeps in from the control (site.js); this stops the default cross-fade */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

@media print {
  header.site, .toggle, .copy, .hero .glow, .hero .grid-bg { display: none !important; }
  body { background: #fff; color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 11px; color: #555; }
}
