/* The home page's own styles (home.html): the fold, the four stages, the upload's dialog.
   Moved out of the templates in Step 18b; served as /static/css/home.<hash>.css
   with a content hash (app/services/assets.py). Edit here. */

/* ---- home.html ---- */
  /* What only this page needs (Step 17a.1): a display size that stops at
     5.25rem — past it a two-line slogan needs three and reads as shouting —
     and the space under the last stage. */
  :root { --text-display: clamp(2.6rem, 4.6vw + .6rem, 5.25rem); --space-4xl: 9rem; }
  .wrap { max-width: 84rem; margin-inline: auto; }
  .nav { padding-block: var(--space-lg) var(--space-md); }

  /* The fold: two columns, the statement and the upload beside a published page. */
  .hero {
    display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-2xl) var(--space-3xl);
    align-items: center; padding-block: var(--space-2xl) var(--space-3xl); max-width: none;
  }
  .hero .say { display: grid; gap: var(--space-lg); }
  .hero h1 {
    font-size: var(--text-display); font-weight: 300; line-height: 1.06; letter-spacing: -.015em;
    font-variation-settings: "opsz" 144; max-width: 18ch;
  }
  .hero h1 em { font-style: italic; color: var(--accent); }
  :lang(zh) .hero h1 { letter-spacing: 0; line-height: 1.22; max-width: 13em; }
  :lang(zh) .hero h1 em { font-style: normal; }
  .hero .sub { font-size: 1.15rem; line-height: 1.6; max-width: 48ch; margin-top: 0; }
  .hero .upload { margin-top: var(--space-sm); }
  .hero figure {
    margin: 0 calc(-1 * var(--space-xl)) 0 0; min-width: 0; aspect-ratio: 4 / 5; max-width: 100%; overflow: clip;
    border: var(--rule) solid var(--line-strong); box-shadow: 0 1px 2px var(--shade); background: var(--surface);
  }
  .hero figure img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
  .upload { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-md); }
  .upload span { color: var(--muted); font-size: var(--text-sm); }
  .hb-btn {
    font: inherit; font-weight: 600; line-height: 1; min-height: 48px; padding: var(--space-sm) var(--space-lg);
    border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: var(--on-accent, #fff);
    cursor: pointer; white-space: nowrap; transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out);
  }
  .hb-btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
  .hb-btn:active { transform: translateY(1px); }
  .trust { list-style: none; padding: 0; margin: var(--space-md) 0 0; font-size: var(--text-sm); color: var(--muted);
           display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-lg); }
  /* Step 02.3, C: on a phone the file is usually on a computer; shown up to 52rem. */
  .handoff-link { display: none; margin-top: var(--space-sm); font-size: var(--text-sm); color: var(--accent); }

  /* A stage: its label stacked over the heading, text beside a picture; space is the divider. */
  .band {
    padding-block: var(--space-3xl) var(--space-2xl); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--space-xl) var(--space-3xl); align-items: center;
  }
  .band.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .band.flip > .text { order: 2; }
  .band .text { display: grid; gap: var(--space-md); align-content: center; }
  .stage { font-family: var(--mono); font-size: var(--text-sm); color: var(--muted); letter-spacing: .06em; display: flex; gap: var(--space-sm); }
  .stage b { font-weight: 400; color: var(--accent); }
  .band h2 { font-size: var(--text-2xl); line-height: 1.15; letter-spacing: -.01em; }
  .band p { max-width: 52ch; }
  .band figure { margin: 0; min-width: 0; }
  .band figure img { width: 100%; border: var(--rule) solid var(--line-strong); box-shadow: 0 1px 2px var(--shade); }
  .band figcaption { margin-top: var(--space-xs); font-size: var(--text-xs); color: var(--muted); }
  .band figcaption a { font-family: var(--mono); color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
  .band figcaption a:hover { color: var(--accent); border-color: var(--accent); }
  .band .inset img { max-width: 440px; }
  .band .job img { max-width: 420px; }
  .band .vis img { max-width: 440px; }
  .band.last { padding-bottom: var(--space-4xl); }

  /* Stage 02: the page goes live here — the dark surface is the divider, its own colours by name. */
  .live { background: var(--band); color: var(--band-ink); }
  .live .band { padding-block: var(--space-3xl); }
  .live .stage { color: var(--band-muted); }
  .live .stage b { color: var(--band-accent); }
  .live .band figcaption { color: var(--band-muted); }
  .live .band figcaption a { color: var(--band-ink); border-color: var(--band-line); }
  .live .band figcaption a:hover { color: var(--band-accent); border-color: var(--band-accent); }
  .live .band figure img { border-color: var(--band-line); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
  .live :focus-visible { outline-color: var(--band-accent); }

  /* The questions on the white surface: every answer showing, the same list as the JSON-LD. */
  .panel { background: var(--surface); }
  .qs {
    padding-block: var(--space-3xl);
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-xl) var(--space-2xl);
  }
  .qs h2 { font-size: var(--text-2xl); }
  .qs dl { margin: 0; display: grid; gap: var(--space-xl); min-width: 0; }
  .qs dt { font-family: var(--serif); font-size: var(--text-xl); font-weight: 500; line-height: 1.25; }
  .qs dd { margin: var(--space-sm) 0 0; max-width: 62ch; }

  .start { padding-block: var(--space-3xl); font-family: var(--serif); font-size: var(--text-2xl); }
  .start a { text-decoration: none; border-bottom: 2px solid var(--ink); padding-bottom: .05em; white-space: nowrap; }
  .start a:hover { color: var(--accent); border-color: var(--accent); }

/* ---- home.html, after the footer's ---- */
  /* The upload's dialog: the old page's markup (_uploader_overlay.html), in B. */
  .scrim { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--space-md); background: rgba(16, 18, 22, .55); }
  .uploader {
    width: min(28rem, 100%); display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-lg);
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
  }
  .uploader h3 { font-size: 1.2rem; }
  .uploader .file { display: flex; align-items: center; gap: var(--space-xs); font-family: var(--mono); font-size: var(--text-xs); color: var(--muted); overflow-wrap: anywhere; }
  .uploader .fdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
  .uploader .track { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
  .uploader .fill { height: 100%; background: var(--accent); transition: width .18s linear; }
  .uploader .pct { font-family: var(--mono); font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
  .uploader .tip { font-size: var(--text-sm); color: var(--muted); }
  .uploader .tip b { color: var(--ink); font-weight: 600; }
  .uploader .err { font-size: var(--text-sm); color: var(--danger); }
  .uploader .acts { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
  .uploader .btn {
    font: inherit; font-size: var(--text-sm); font-weight: 600; min-height: 44px; padding: 0 var(--space-md); cursor: pointer;
    border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--accent);
  }
  .uploader .btn:hover { border-color: var(--accent); background: var(--accent-soft); }
  .uploader .btn-primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent, #fff); }
  .uploader .btn-primary:hover { border-color: var(--accent-ink); background: var(--accent-ink); }
  .uploader .btn[disabled] { opacity: .7; cursor: default; }
  .keep { display: flex; flex-direction: column; gap: var(--space-xs); border-top: 1px solid var(--line); padding-top: var(--space-sm); }
  .keep-title { font-weight: 600; font-size: var(--text-sm); }
  .keep-lead, .keep-small { font-size: var(--text-xs); line-height: 1.5; color: var(--muted); }
  .keep-label { font-size: var(--text-xs); font-weight: 600; }
  .keep-input {
    font: inherit; font-size: 1rem; min-height: 44px; padding: 0 var(--space-sm); width: 100%;
    border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  }
  .keep-input[readonly] { color: var(--muted); background: var(--panel); }
  .keep-input[aria-invalid="true"] { border-color: var(--danger); }
  .keep-error { font-size: var(--text-xs); color: var(--danger); }
  .keep-sent { font-size: var(--text-sm); line-height: 1.5; }

  /* The veil: with script only. The bottom of the first screen softened, so the
     eye stays on the fold and still sees there is more; the script thins it out
     over the first half screen of scrolling. Never takes a click. */
  .veil { display: none; }
  .js .veil {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; height: 26vh; z-index: 5; pointer-events: none;
    background: linear-gradient(to bottom, transparent, var(--paper) 88%);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%); mask-image: linear-gradient(to bottom, transparent, #000 45%);
    opacity: var(--veil, 1); transition: opacity .12s linear;
  }

  /* Motion — only with script (html.js), once, transform and opacity only. */
  .js .rise { opacity: 0; transform: translateY(12px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
  .js .rise.in { opacity: 1; transform: none; }
  .js .band > * { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
  .js .band > figure { transition-delay: .12s; }
  .js .band.in > * { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) {
    .js .rise, .js .band > * { opacity: 1; transform: none; transition: none; }
    .js .veil { transition: none; }
    .uploader .fill { transition: none; }
  }

  @media (max-width: 62rem) {
    .hero { grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); padding-block: var(--space-xl) var(--space-2xl); }
    .hero figure { margin-right: 0; aspect-ratio: 4 / 3; }
  }
  @media (max-width: 52rem) {
    .band, .band.flip, .qs { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
    .band { padding-block: var(--space-2xl) var(--space-lg); }
    .band.last { padding-bottom: var(--space-2xl); }
    .live .band { padding-block: var(--space-2xl); }
    .band.flip > .text { order: 0; }
    .band .job img, .band .vis img, .band .inset img { max-width: 100%; }
    .hero { padding-block: var(--space-md) var(--space-2xl); }
    .start { padding-block: var(--space-2xl); }
    .handoff-link { display: inline-block; }
  }
  @media (max-width: 34rem) {
    .nav nav { gap: var(--space-md); }
    .hb-btn { width: 100%; }
    .upload span { width: 100%; text-align: center; }
    .trust { flex-direction: column; }
    .start a { white-space: normal; }
    /* One line at 320px too (spec §8). */
    .handoff-link { font-size: var(--text-xs); }
  }
