/*
 * Download pages (/f/<code> file + folder), the password page and the
 * 403/404 pages — redesign 2026-10-13, ported from
 * docs/design/2026-10-13-file-host/styles.css ("DOWNLOAD PAGE (one-screen)",
 * "file stack", "right column content" and the 900/760 px breakpoints).
 *
 * Dark is the default; light follows prefers-color-scheme. Each category
 * theme sets --accent / --accent-ink on <html> (get-file/*.blade.php);
 * text that sits on the accent always uses --accent-ink. Text never sits on
 * the accent blobs in a colour lighter than --ink-2.
 *
 * Every font is served from this site (public/fonts, the latin subsets of
 * the SPA's @fontsource-variable packages; SIL Open Font License).
 */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
}

/* ─── tokens: dark (default) ─── */
:root {
  --ink: #F4EFE6;
  --ink-2: #C9C2B5;
  --ink-3: #9A9485;          /* design #888273 lifted: 5.2:1 on --surface */
  --paper: #14161C;
  --paper-2: #1C1F27;
  --surface: #20232C;
  --on-ink: #14161C;         /* text on an --ink surface */
  --line-strong: color-mix(in oklab, var(--ink) 30%, transparent);
  --line-soft: color-mix(in oklab, var(--ink) 12%, transparent);
  --good: #3DBE84;
  --danger-bg: #2A1215;
  --danger-fg: #FCA5A5;
  --danger-line: #7F1D1D;
  --blob-opacity: .22;

  --accent: #FF6A3D;
  --accent-ink: #0E1116;
  --accent-soft: var(--paper-2);
  --accent-soft: color-mix(in oklab, var(--accent) 16%, var(--paper));

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 36px;
  --r-pill: 999px;

  --shadow-card: 0 2px 0 rgba(0,0,0,.5), 0 14px 40px -22px rgba(0,0,0,.6);
  --shadow-pop: 0 4px 0 rgba(0,0,0,.5), 0 24px 60px -28px rgba(0,0,0,.7);

  --font-display: "Bricolage Grotesque", "Geist", system-ui, sans-serif;
  --font-body: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: dark;
}

/* ─── tokens: light ─── */
@media (prefers-color-scheme: light) {
  :root {
    --ink: #0E1116;
    --ink-2: #2A2D38;
    --ink-3: #5A5E6B;
    --paper: #F4EFE6;
    --paper-2: #ECE5D6;
    --surface: #FFFFFF;
    --on-ink: #F4EFE6;
    --good: #147049;
    --danger-bg: #FEF2F2;
    --danger-fg: #B91C1C;
    --danger-line: #FECACA;
    --blob-opacity: .45;
    --accent-soft: color-mix(in oklab, var(--accent) 22%, var(--paper));
    --shadow-card: 0 2px 0 var(--ink), 0 14px 40px -22px rgba(14,17,22,.35);
    --shadow-pop: 0 4px 0 var(--ink), 0 24px 60px -28px rgba(14,17,22,.45);
    color-scheme: light;
  }
}

/* ─── base ─── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
.dl-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; }
.dl-body button { font: inherit; }
.dl-icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }

/* the toggles download-logic uses */
.hidden { display: none !important; }
.animate-spin { animation: dl-spin 1s linear infinite; }
@keyframes dl-spin { to { transform: rotate(360deg); } }

/* ─── top bar ─── */
.dl-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  background: color-mix(in oklab, var(--paper) 84%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.dl-top-row {
  width: min(1040px, 100% - 32px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}
.dl-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.02em;
  border-radius: 10px;
}
.dl-brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent);
  border: 2px solid var(--ink);
  display: grid; place-items: center;
  position: relative;
  transform: rotate(-4deg);
  flex: none;
  color: var(--accent-ink);
}
.dl-brand-mark::after {
  content: "";
  position: absolute;
  inset: 4px 4px auto auto;
  width: 8px; height: 8px;
  background: var(--accent-ink);
  border-radius: 2px;
}
.dl-brand-mark .dl-icon { width: 18px; height: 18px; }
.dl-brand-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.dl-brand-cat .dl-icon { width: 14px; height: 14px; }
.dl-top-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.dl-top-cta:hover { border-color: var(--ink); background: var(--surface); }

/* ─── page + background ─── */
.dl-page {
  position: relative;
  flex: 1;
  padding: 40px 16px 56px;
  overflow: hidden;
  isolation: isolate;
}
/* Owner, 2026-10-14: no grid. A plain page with a little grain and an
   uneven, warm glow — loose on purpose, not a geometric pattern. */
.dl-bg {
  position: absolute; inset: 0;
  z-index: -1;
  background: var(--paper);
  pointer-events: none;
  overflow: hidden;
}
.dl-blob {
  position: absolute;
  filter: blur(70px);
  opacity: calc(var(--blob-opacity) * .8);
}
.dl-blob-1 {
  top: -14%; left: -6%;
  width: 560px; height: 420px;
  border-radius: 62% 38% 55% 45% / 48% 60% 40% 52%;
  transform: rotate(-12deg);
  background: var(--accent);
  background: color-mix(in oklab, var(--accent) 85%, #FFB347);
}
.dl-blob-2 {
  bottom: -18%; right: -12%;
  width: 620px; height: 480px;
  border-radius: 45% 55% 38% 62% / 58% 42% 60% 40%;
  transform: rotate(18deg);
  background: var(--accent);
  background: color-mix(in oklab, var(--accent) 45%, var(--paper));
  opacity: calc(var(--blob-opacity) * .6);
}
/* The class keeps its old name (four templates use it); it is grain now. */
.dl-grid {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: .16;
  mix-blend-mode: soft-light;
}
@media (prefers-color-scheme: light) {
  .dl-grid { opacity: .14; mix-blend-mode: multiply; }
}

.dl-shell {
  position: relative;
  width: min(980px, 100%);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ─── sender bubble → uploader line ─── */
.dl-sender {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-pill);
  padding: 8px 20px 8px 8px;
  box-shadow: var(--shadow-card);
  max-width: 100%;
  width: fit-content;
  margin: 0 auto;
}
.dl-avatar {
  width: 40px; height: 40px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
}
.dl-sender-text { display: flex; flex-direction: column; min-width: 0; }
.dl-sender-name { font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.dl-sender-msg {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

/* ─── hero: file stack + intro ─── */
.dl-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 40px;
  align-items: center;
}
.dl-stack {
  position: relative;
  height: 360px;
  display: grid;
  place-items: center;
}
.dl-stack-card {
  position: absolute;
  width: 280px;
  height: 320px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
}
.dl-card-3 { transform: translate(-26px, 16px) rotate(-7deg); background: var(--paper-2); height: 300px; width: 250px; }
.dl-card-2 { transform: translate(22px, 8px) rotate(5deg); height: 310px; width: 260px; }
.dl-card-1 {
  position: relative;
  display: flex; flex-direction: column;
  padding: 18px;
  transform: rotate(-2deg);
}
.dl-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dl-ftype {
  display: inline-grid; place-items: center;
  min-width: 44px; height: 44px;
  padding: 0 6px;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}
.dl-ftype .dl-icon { width: 20px; height: 20px; }
.sticker {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transform: rotate(-2deg);
  box-shadow: 0 2px 0 var(--ink);
  white-space: nowrap;
}
.dl-preview {
  flex: 1;
  margin: 14px 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  display: grid; place-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  background:
    radial-gradient(circle at 30% 30%, color-mix(in oklab, var(--accent) 80%, white) 0%, transparent 55%),
    radial-gradient(circle at 70% 70%, color-mix(in oklab, var(--accent) 55%, #0E1116) 0%, transparent 60%),
    linear-gradient(135deg, var(--accent) 0%, color-mix(in oklab, var(--accent) 55%, #0E1116) 100%);
}
.dl-preview .dl-icon { width: 64px; height: 64px; stroke-width: 1.6; filter: drop-shadow(0 2px 0 rgba(14,17,22,.25)); }
.dl-card-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dl-filename {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dl-filesize {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

.dl-intro {
  display: flex; flex-direction: column; gap: 14px; align-items: stretch;
  min-width: 0;
}
.dl-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
.dl-title-sm { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.08; }
.dl-sub {
  margin: 0;
  font-size: 16px;
  color: var(--ink-2);
  max-width: 40ch;
}
.dl-folder-name {
  display: flex; align-items: center; gap: 8px;
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.dl-hint {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
  max-width: 44ch;
}

/* ─── buttons + per-file controls ─── */
.dl-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.dl-controls-lg .dl-controls { justify-content: flex-start; }
.dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .18s, color .18s;
}
.dl-btn .dl-icon, .download-button svg { width: 18px; height: 18px; flex: none; }
.dl-btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 3px 0 var(--ink);
}
.dl-btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 0 4px 0 var(--ink); }
.dl-btn-primary:active { transform: translate(0, 1px); box-shadow: 0 1px 0 var(--ink); }
.dl-btn-ink { background: var(--ink); color: var(--on-ink); box-shadow: 0 3px 0 var(--ink); }
.dl-btn-ink:hover { transform: translate(-1px, -1px); }
.dl-btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.dl-btn-ghost:hover { border-color: var(--ink); }
.dl-btn:disabled, .dl-btn[disabled] {
  cursor: not-allowed;
  background: var(--paper-2);
  color: var(--ink-2);
  border-style: dashed;
  border-color: var(--line-strong);
  box-shadow: none;
  transform: none;
}
.download-button .text-green-500 { color: var(--good); }
.dl-btn:focus-visible,
.dl-top-cta:focus-visible,
.dl-brand:focus-visible,
.dl-foot a:focus-visible,
.error-toast-close:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.dl-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.dl-controls-lg .dl-btn {
  flex: 1 1 220px;
  min-height: 56px;
  padding: 15px 26px;
  font-size: 16px;
}

/* ─── folder file list ─── */
.dl-files {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-lg);
  padding: 8px;
  box-shadow: var(--shadow-card);
}
.dl-file-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 14px;
  padding: 10px 12px;
  border-radius: 14px;
  transition: background .15s;
}
.dl-file-row + .dl-file-row { border-top: 1px solid var(--line-soft); border-top-left-radius: 0; border-top-right-radius: 0; }
.dl-file-row:hover { background: var(--paper); }
.dl-file-ext {
  width: 42px; height: 42px;
  background: var(--paper-2);
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
}
.dl-file-meta { min-width: 0; }
.dl-file-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.dl-file-size { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.dl-captcha { display: flex; justify-content: center; }
.dl-captcha:empty { display: none; }

/* ─── meta strip ─── */
.dl-meta {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 12px 28px;
  padding: 16px 28px;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: var(--r-pill);
  flex-wrap: wrap;
}
.dl-meta-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl-meta-item + .dl-meta-item { padding-left: 28px; border-left: 1px solid color-mix(in oklab, var(--on-ink) 18%, transparent); }
.dl-meta-k {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: color-mix(in oklab, var(--on-ink) 68%, var(--ink));
}
.dl-meta-v {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.dl-meta-v .dl-icon { width: 14px; height: 14px; }

/* ─── error toast (download-logic: #error-toast / #error-message / .show) ─── */
.error-toast {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 60;
  display: flex; align-items: center; gap: 10px;
  max-width: min(28rem, calc(100vw - 32px));
  padding: 12px 44px 12px 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-fg);
  box-shadow: var(--shadow-card);
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.error-toast.show { opacity: 1; visibility: visible; transform: translateY(0); }
.error-toast-close {
  position: absolute; top: 50%; right: 6px;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0; background: transparent; color: inherit;
  border-radius: 999px;
  cursor: pointer;
}

/* ─── error, 403/404 and password cards ─── */
.dl-error-card, .dl-lock-card {
  width: min(560px, 100%);
  margin: 24px auto;
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 32px;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
}
.dl-error-page { width: min(680px, 100%); }
.dl-lock-card { width: min(440px, 100%); }
.dl-error-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 1.5px solid var(--ink);
  background: var(--accent);
  color: var(--accent-ink);
  transform: rotate(-4deg);
}
.dl-error-icon .dl-icon { width: 26px; height: 26px; }
.dl-error-msg, .dl-lock-text { margin: 0; color: var(--ink-2); font-size: 16px; overflow-wrap: anywhere; }
.dl-lock-name { color: var(--ink); font-weight: 600; }
.dl-error-code {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(72px, 16vw, 128px);
  line-height: .9;
  letter-spacing: -0.04em;
  color: var(--ink);
  -webkit-text-stroke: 0;
}
.dl-error-code::after {
  content: "";
  display: block;
  width: 72px; height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--accent);
}
.dl-error-reasons { color: var(--ink-2); font-size: 15px; }
.dl-error-reasons p { margin: 0 0 6px; font-weight: 600; color: var(--ink); }
.dl-error-reasons ul { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.dl-error-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.dl-lock-error {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-fg);
  font-size: 14px;
}
.dl-lock-form { width: 100%; display: grid; gap: 8px; }
.dl-lock-form label { font-weight: 600; font-size: 14px; }
.dl-lock-form input[type=password] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.dl-lock-form input[type=password]:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.dl-lock-form .dl-btn { margin-top: 8px; width: 100%; min-height: 52px; }

/* ─── footer ─── */
.dl-foot { border-top: 1px solid var(--line-soft); background: var(--paper); }
.dl-foot-row {
  width: min(1040px, 100% - 32px);
  margin-inline: auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 20px;
  padding: 18px 0;
  font-size: 14px;
  color: var(--ink-2);
}
.dl-foot-links { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.dl-foot-links a { display: inline-block; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; border-radius: 4px; }
.dl-foot-links a:hover { color: var(--ink); }

/* ─── responsive ─── */
@media (max-width: 900px) {
  .dl-hero { grid-template-columns: 1fr; }
  .dl-stack { height: 300px; }
  .dl-stack-card { height: 280px; width: 250px; }
  .dl-card-3 { height: 262px; width: 224px; }
  .dl-card-2 { height: 270px; width: 232px; }
  .dl-intro { align-items: stretch; }
  .dl-meta { flex-direction: column; align-items: flex-start; border-radius: var(--r-lg); padding: 18px 22px; }
  .dl-meta-item + .dl-meta-item { padding-left: 0; border-left: 0; }
}
@media (max-width: 760px) {
  .dl-page { padding: 24px 16px 40px; }
  .dl-sender { border-radius: var(--r-lg); width: 100%; }
  .dl-file-row { grid-template-columns: 42px minmax(0, 1fr); }
  .dl-file-row .dl-controls { grid-column: 1 / -1; justify-content: stretch; }
  .dl-file-row .dl-btn { flex: 1 1 auto; }
  .dl-error-card, .dl-lock-card { padding: 24px 20px; }
}
@media (max-width: 560px) {
  .dl-top-cta { width: 44px; padding: 0; justify-content: center; }
  .dl-top-cta-label { display: none; }
}
@media (max-width: 520px) {
  .dl-brand { font-size: 19px; gap: 8px; }
  .dl-brand-mark { width: 30px; height: 30px; }
  .dl-stack { height: 270px; }
  .dl-stack-card { height: 250px; width: 220px; border-radius: 28px; }
  .dl-card-3 { height: 232px; width: 196px; }
  .dl-card-2 { height: 240px; width: 204px; }
  .dl-card-1 { padding: 14px; }
  .dl-preview .dl-icon { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .dl-btn, .error-toast, .dl-file-row { transition: none; }
  .animate-spin { animation-duration: 2.5s; }
}

/* Browsers without color-mix() (Chrome < 111, Safari < 16.2, older Android
   WebViews): a custom property holding color-mix() is still "valid" there, so
   a plain fallback line before it would be overridden — give them flat
   colours here instead (final review, 2026-10-13). */
@supports not (color: color-mix(in oklab, red, blue)) {
  :root {
    --line-strong: rgba(244, 239, 230, .30);
    --line-soft: rgba(244, 239, 230, .12);
    --accent-soft: #3A2620;
  }
  .dl-top { background: rgba(20, 22, 28, .84); }
  .dl-grid {
    background-image:
      linear-gradient(to right, rgba(244, 239, 230, .06) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(244, 239, 230, .06) 1px, transparent 1px);
  }
  .dl-meta-item + .dl-meta-item { border-left-color: rgba(20, 22, 28, .18); }
  .dl-meta-v { color: rgba(20, 22, 28, .75); }
  @media (prefers-color-scheme: light) {
    :root {
      --line-strong: rgba(14, 17, 22, .30);
      --line-soft: rgba(14, 17, 22, .12);
      --accent-soft: #F6D2C1;
    }
    .dl-top { background: rgba(244, 239, 230, .84); }
    .dl-grid {
      background-image:
        linear-gradient(to right, rgba(14, 17, 22, .06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(14, 17, 22, .06) 1px, transparent 1px);
    }
    .dl-meta-item + .dl-meta-item { border-left-color: rgba(244, 239, 230, .18); }
    .dl-meta-v { color: rgba(244, 239, 230, .75); }
  }
}
