/* ================================================================
   Pace IAS Pronunciation Practice — download page styles

   Themed to match the app (Global Pathways Tauri client, src/theme.css):
   "calm, non-punitive — supportive coach, not graded test" (FRD §4.7).
   Warm off-white ground, sage-green primary action, soft cards,
   editorial type (Fraunces display + Inria Sans body).

   Fonts are self-hosted (latin subset) — no CDN, no third-party request.
   Both families are OFL-1.1; see fonts/Fraunces-OFL.txt and
   fonts/InriaSans-OFL.txt.
   ================================================================ */

/* ── Self-hosted fonts ────────────────────────────────────────── */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;          /* one variable file covers the range */
  font-display: swap;
  src: url("fonts/fraunces-latin-var.woff2") format("woff2");
}

@font-face {
  font-family: "Inria Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inria-sans-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Inria Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/inria-sans-latin-700.woff2") format("woff2");
}

/* ── Theme tokens (ported from the app's theme.css) ───────────── */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #f0ece4;
  --ink: #25241f;
  --ink-soft: #5b5950;
  --ink-faint: #8a8779;
  --accent: #6f8b6e;            /* sage green — primary action */
  --accent-strong: #4f6c4e;
  --accent-soft: #e3ecdf;
  --warn: #b07a3a;             /* warm amber — flagged, not red */
  --warn-soft: #f3e6cf;
  --line: #e2ddd2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;

  --font-display: "Fraunces", "Charter", "Iowan Old Style", "Georgia", serif;
  --font-body: "Inria Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

/* ── Reset / base ─────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-strong);
}

::selection {
  background: var(--accent-soft);
}

/* ── Layout ───────────────────────────────────────────────────── */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem 4.5rem;
  animation: page-fade-in 220ms ease-out both;
}

@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .container { animation: none; }
}

/* ── Header / hero ────────────────────────────────────────────── */

#os-region {
  margin-bottom: 2rem;
}

#os-region h1 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 96;
  font-size: 2.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.subtitle {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 56ch;
}

/* The "no download for your system" panel (non-Windows/non-macOS). */
.os-notice {
  margin: 1rem 0 0;
  padding: 0.85rem 1.1rem;
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.97rem;
}

.releases-link {
  font-weight: 600;
}

/* ── Action area (download) ───────────────────────────────────── */

.action-area {
  margin: 0 0 2.5rem;
  padding: 1.6rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#action-slot {
  min-height: 3rem;
}

/* The render layer injects an <a> download button (or a fallback link). */
#action-slot a,
#action-slot button {
  display: inline-block;
  padding: 0.75rem 1.6rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 120ms ease, transform 80ms ease;
}

#action-slot a:hover,
#action-slot button:hover {
  background: var(--accent-strong);
}

#action-slot a:active,
#action-slot button:active {
  transform: translateY(1px);
}

#action-slot a:focus-visible,
#action-slot button:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 3px;
}

/* Notes under the button — e.g. the Apple Silicon caveat, or the
   "not published yet" / fetch-failed fallback explanations. */
#action-slot .note {
  margin: 0.7rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}

.version-label {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
  min-height: 1.2em;   /* reserve space so layout doesn't shift */
}

/* ── Instructions ─────────────────────────────────────────────── */

#instructions {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 2rem;
}

#instructions h2 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 40;
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 1.75rem 0 0.6rem;
}

#instructions h2:first-child {
  margin-top: 0;
}

#instructions h3 {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
  margin: 1.1rem 0 0.5rem;
}

#instructions ol,
#instructions ul {
  margin: 0 0 0.5rem;
  padding-left: 1.4rem;
}

#instructions li {
  margin-bottom: 0.8rem;
  color: var(--ink-soft);
}

#instructions li strong {
  color: var(--ink);
}

#instructions li:last-child {
  margin-bottom: 0;
}

#instructions code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--surface-soft);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: var(--ink);
}

#instructions p {
  margin: 0 0 0.5rem;
  color: var(--ink-soft);
}

#instructions .os-notice {
  color: var(--ink);
}

/* ── Responsive (phone: <640px) ───────────────────────────────── */

@media (max-width: 639px) {
  .container {
    padding: 1.75rem 1.1rem 6rem;
  }

  #os-region h1 {
    font-size: 1.85rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  /* Full-width tap target per WCAG 2.5.5 (~46px with 16px font). */
  #action-slot a,
  #action-slot button {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.9rem 1.2rem;
  }

  .action-area,
  #instructions {
    padding: 1.25rem 1.1rem;
  }
}

/* ── Footer ───────────────────────────────────────────────────── */

.footer {
  max-width: 720px;
  margin: 2.5rem auto 0;
  padding: 1.5rem 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-faint);
}
