/* virtsync store — base stylesheet (loaded on every page).
 * Served at /static/base.css: by nginx from disk in production, by the app's own
 * /static handler in dev (make dev) / when nginx isn't in front.
 *
 * Design intent (audience = sysadmins / infra engineers): restrained, text-first,
 * "serious tool" not "SaaS template". Dark by default (this audience lives in
 * terminals); a light variant tracks the OS setting. The code/demo block is a
 * first-class element — it does the selling. It's a plain <pre> on a slightly
 * different background, not fake window chrome.
 *
 * Scope: normalisation, the shell from base.html (header/footer/brand column),
 * global typography, and everything the home page (index.html) renders — the
 * demo block, the pricing tiers and the buttons. Pages that need more pull in
 * their own stylesheet via base.html's {% block head %} (forms.css, admin.css).
 *
 * Two sections only:
 *   1. NORMALISATION — cross-browser reset; no site styling.
 *   2. SITE          — everything virtsync-specific.
 */

/* ── 1. NORMALISATION ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg {
  display: block;
  max-width: 100%;
}
input, button, select {
  font: inherit;
  color: inherit;
}

/* ── 2. SITE ────────────────────────────────────────────────────────────────── */

/* Design tokens. Dark is the default; the light block below only overrides what
 * changes (the terminal deliberately stays dark in light mode). */
:root {
  /* Declared, not just implied by the tokens: the OS draws a <select>'s open
     popup and the scrollbars itself, and follows this rather than our colours. */
  color-scheme: dark;
  --bg: #111;
  --surface: #112;
  --surface-2: #122;
  --border: #233;
  --fg: #eee;
  --muted: #9ab;
  --accent: #59f;
  --accent-hover: #7af;
  --on-accent: #012;
  --term-bg: #111;
  --term-fg: #dde;
  --ok: #2f2;
  --slow: #f00;
  --radius: 10px;
  --wrap: 64rem;              /* the one shared column (~1024px) */
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #eff;
    --surface: #fff;
    --surface-2: #eee;
    --border: #dee;
    --fg: #223;
    --muted: #567;
    --accent: #26e;
    --accent-hover: #25d;
    --on-accent: #fff;
  }
}

/* The original virtsync title face (Fertigo Pro Regular, exljbris). */
@font-face {
  font-family: 'Fertigo Pro';
  src: url(/static/fonts/fertigo-pro-regular.woff) format('woff'),
       url(/static/fonts/fertigo-pro-regular.ttf) format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.3rem;
  color: var(--fg);
  background: var(--bg);
}

/* Layout: full-bleed header/footer, one centred column. `100% - 2rem` keeps a
 * gutter on narrow screens; `%` (not vw) is the containing block, so no sideways
 * shift when a scrollbar appears. .wrap is used by the header, <main> and footer. */
.wrap {
  width: min(100% - 2rem, var(--wrap));
  margin-inline: auto;
}
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header .wrap { padding-block: .9rem; }
.brand {
  font-family: 'Fertigo Pro', Georgia, serif;
  color: var(--fg);
  font-weight: normal;
  font-size: 3rem;
}
.brand:hover { text-decoration: none; }
main { padding-block: 2.5rem 3.5rem; }
footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
footer .wrap { padding-block: 1.5rem; }
footer small { color: var(--muted); }

/* Typography.
 *
 * h1 and h2 share the brand's title face (see `.brand`), set smaller and centred.
 * Two details are load-bearing:
 *
 *   * `font-weight: normal`.  The only Fertigo Pro face loaded is Regular, and
 *     headings are bold by default, so without this the browser synthesises the
 *     bold - which smears the strokes of a serif display face.  `.brand` says
 *     normal for the same reason.
 *   * `letter-spacing: normal`.  The slight negative tracking these carried suits
 *     the system sans; on a serif at display size it closes the counters up.
 *     `.brand` sets none, and these now match it.
 *
 * h3 deliberately stays in the sans: it labels pricing tiers, FAQ questions and
 * admin sub-sections, which are read as text rather than seen as titles. */
h1, h2 {
  font-family: 'Fertigo Pro', Georgia, serif;
  font-weight: normal;
  letter-spacing: normal;
  text-align: center;
}
h1 {
  font-size: 2.1rem;
  margin-bottom: .4rem;
}
h2 {
  font-size: 1.7rem;
  margin: 2.5rem 0 .6rem;
}
h3 {
  font-size: 1.3rem;
  /* More above than below, so a heading binds to the text it introduces rather
     than floating between two blocks.  The 3:2 ratio is what the FAQ needed: with
     equal margins each question sat exactly midway between the answer before it
     and its own.  Margins collapse, so the value above must exceed the preceding
     paragraph's .5rem to have any effect at all. */
  margin-block: .75rem .5rem;
}
/* No top margin when the h3 is the first thing in its box (the pricing tier
   cards): there is nothing above it to separate from, and the card's own padding
   already sets the inset. */
h3:first-child { margin-top: 0; }
p {
  color: var(--muted);
  margin: .5rem 0;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Inline code + the demo block (monospace, always dark). `.terminal` is just a
 * <pre> that floats slightly; the prompt/ok/slow spans colour the transcript. */
code, pre {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}
code {
  background: var(--surface-2);
  padding: .12rem .38rem;
  border-radius: 5px;
  font-size: 1.3rem;
}
pre {
  background: var(--term-bg);
  color: var(--term-fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Fluid inset. The vw terms hit the upper bounds — the original 1rem/1.1rem —
     at ~1140px/~1100px wide, so the desktop look is unchanged; below that the
     padding eases down to a .45rem/.5rem floor rather than holding a fixed gutter
     that eats a phone's screen width. */
  padding: clamp(.45rem, 1.4vw, 1rem) clamp(.5rem, 1.6vw, 1.1rem);
  overflow-x: auto;
  font-size: 1.3rem;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.terminal {
  /* Two transcripts sit one above the other on the home page (rsync, then
     virtsync as a separate run).  Adjacent vertical margins collapse, so the gap
     between them is this value once, not twice. */
  margin: 1.6rem 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}

/* Green 12-point "sticker" over the terminal's top-right corner. It lives in a wrapper
 * around the <pre> (not inside it — the <pre> is overflow:auto and would clip it), and
 * is purely decorative (aria-hidden, pointer-events:none). */
.term-wrap { position: relative; }
.term-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;                     /* one tenth of the terminal width */
  aspect-ratio: 1;
  container-type: inline-size;    /* so the text scales with the badge (cqi below) */
  transform: translate(30%, -30%) rotate(-10deg);  /* straddle the corner, poke past the right, 10deg CCW */
  clip-path: polygon(50.0% 0.0%, 59.6% 14.3%, 75.0% 6.7%, 76.2% 23.8%, 93.3% 25.0%, 85.7% 40.4%, 100.0% 50.0%, 85.7% 59.6%, 93.3% 75.0%, 76.2% 76.2%, 75.0% 93.3%, 59.6% 85.7%, 50.0% 100.0%, 40.4% 85.7%, 25.0% 93.3%, 23.8% 76.2%, 6.7% 75.0%, 14.3% 59.6%, 0.0% 50.0%, 14.3% 40.4%, 6.7% 25.0%, 23.8% 23.8%, 25.0% 6.7%, 40.4% 14.3%);
  background: color-mix(in srgb, var(--ok) 62%, #000);  /* on-brand green, dark enough for white text */
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.06;
  font-weight: 800;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
  pointer-events: none;
  z-index: 2;
}
.term-badge span {
  display: block;
  font-size: 15cqi;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
}
.prompt {
  color: var(--accent);
  user-select: none;
}
.ok { color: var(--ok); }
.slow { color: var(--slow); }

/* Supported-distribution row, just above the pricing tiers.  The marks are inline
 * single-path SVGs taking `currentColor`, so one set serves both themes and the page
 * makes no extra requests for them.  Names are real text beside each mark, so the
 * row still reads if an icon means nothing to you - and the SVGs are aria-hidden so
 * a screen reader announces each distribution once, not twice. */
.distros {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.3rem 1.9rem;
  list-style: none;
  padding: 0;
  margin: 1.1rem 0 0;
}
.distros li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  width: 5.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.25;
}
.distros svg {
  width: clamp(1.9rem, 5vw, 2.4rem);
  height: auto;
  fill: currentColor;
}

/* Pricing tiers — equal-height cards; the CTA is pinned to the bottom (margin-top
 * auto on the last child) so the three buttons line up. */
.tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}
.tier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
}
.tier.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.tier .price {
  color: var(--fg);
  font-size: 2rem;
  font-weight: 700;
  margin: .1rem 0 .4rem;
}
.tier .price small {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
}
.tier p { margin: .2rem 0 1rem; }
.tier > :last-child { margin-top: auto; }
/* In a card the form is the CTA: no chrome. */
.tier form {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
}
.tier form button { margin-bottom: 0; }
@media (max-width: 40rem) {
  .tiers { grid-template-columns: 1fr; }
}

/* Inputs + buttons. Home-page primitives (the free-tier email field, every CTA);
 * standalone-form chrome (card, labels, radios) lives in forms.css. */
form > input, form > button { margin: .55rem 0; }
/* `select` shares every declaration here. It had no rule at all, so it fell back
 * to the browser default - white - in a theme whose default is dark. */
input, select {
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .55rem .65rem;
  width: 100%;
  margin-top: .3rem;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}
button, .button, .button-outline, .button-disabled {
  display: inline-block;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border-radius: 7px;
  padding: .6rem 1.1rem;
  width: 100%;
}
button, .button {
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
}
button:hover, .button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  text-decoration: none;
}
.button-outline {
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--border);
}
.button-outline:hover {
  border-color: var(--accent);
  text-decoration: none;
}
/* A placeholder in the Subscribe slot when SUBSCRIPTION_BUTTON=DISABLE: greyed
 * out and inert (not a link, no hover), same size so the card doesn't reflow. */
/* A real <button disabled> looks the same as the `.button-disabled` span used for
 * "coming soon": greyed, no hover lift.  The subscribe form disables its button
 * until the country / VAT / business combination is valid. */
button:disabled, button:disabled:hover {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--border);
  cursor: not-allowed;
}
.button-disabled {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: default;
}

/* A campaign link lands on #pricing rather than the top of the page.  The margin
   keeps the heading off the very edge of the viewport when it does: the header is
   not sticky, so this is breathing room and not a correction for an overlap. */
#pricing { scroll-margin-top: 1rem; }
