/* Fifth Voice. Mobile first; self-hosted fonts; no external requests.
   Brand guide v3: palette, type and contrast pairs below. Every text pair is
   checked by tests/brand.test.mjs (WCAG AA, 4.5:1). Orange is never text on a
   light ground (2.7:1): on light, orange text is Ember. */

@font-face {
  font-family: "Archivo Black";
  src: url("/assets/fonts/archivo-black-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  /* Palette (brand guide v3) */
  --leeloo-orange: #FF6A13;
  --deep-navy: #0B1F3A;
  --spark-white: #FBF7F2;
  --ember: #B8430A;
  --slate: #5B6B82;
  --signal-teal: #1FB5A8;
  --beam-blue: #3A86FF;

  /* Roles, light theme */
  --bg: var(--spark-white);
  --surface: var(--spark-white);
  --text: var(--deep-navy);
  --muted: var(--slate);
  --heading: var(--deep-navy);
  --link: var(--deep-navy);
  --link-hover: var(--ember);
  --border: rgb(91 107 130 / 35%);
  --button-bg: var(--leeloo-orange);
  --button-ink: var(--deep-navy);
  --button-hover-bg: var(--deep-navy);
  --button-hover-ink: var(--spark-white);
  --secondary-ink: var(--deep-navy);
  --secondary-border: var(--deep-navy);
  --header-bg: var(--deep-navy);
  --header-ink: var(--spark-white);
  --banner-bg: var(--leeloo-orange);
  --banner-text: var(--deep-navy);
  --badge-bg: var(--deep-navy);
  --badge-text: var(--spark-white);
  --tip-bg: #EDEAE7; /* off-guide: 6% Navy over Spark White */
  --tip-text: var(--deep-navy);
  --placeholder-bg: #fff8e1;
  --placeholder-border: #b7791f;
  --placeholder-ink: #7a4d0b;
  --focus: var(--ember);
  --focus-on-navy: var(--leeloo-orange);
  --font-head: "Archivo Black", "Arial Black", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--deep-navy);
    --surface: var(--deep-navy);
    --text: var(--spark-white);
    /* Slate on Navy is 3.0:1, too low for text. Off-guide, set by Reigen: 6.5:1 on Navy. */
    --muted: #9BA3AF;
    --heading: var(--spark-white);
    --link: var(--signal-teal);
    --link-hover: var(--spark-white);
    --border: rgb(91 107 130 / 70%);
    --button-hover-bg: var(--spark-white);
    --button-hover-ink: var(--deep-navy);
    --secondary-ink: var(--spark-white);
    --secondary-border: var(--leeloo-orange);
    --header-bg: var(--deep-navy);
    --badge-bg: var(--leeloo-orange);
    --badge-text: var(--deep-navy);
    --tip-bg: #1E3049; /* off-guide: 8% Spark White over Navy */
    --tip-text: var(--spark-white);
    --placeholder-bg: #2c2410;
    --placeholder-ink: #f0c06a;
    --focus: var(--leeloo-orange);
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.55 var(--font-body);
}

.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1rem; }

a { color: var(--link); text-underline-offset: .15em; }
a:hover { color: var(--link-hover); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; }

.site-header { background: var(--header-bg); color: var(--header-ink); border-bottom: 4px solid var(--leeloo-orange); --focus: var(--focus-on-navy); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .75rem; padding-bottom: .75rem; }
.brand { margin: 0; }
.brand a { display: inline-flex; align-items: center; gap: .55rem; color: var(--header-ink); text-decoration: none; min-height: 44px; }
.brand-mark { width: 2.6rem; height: 2.6rem; flex: none; }
.brand-text { display: flex; flex-direction: column; }
.wordmark { font-family: var(--font-head); font-size: 1.45rem; line-height: 1; letter-spacing: .01em; text-transform: uppercase; }
.wordmark-voice { color: var(--leeloo-orange); }
.tagline { font-size: .85rem; font-weight: 600; line-height: 1.3; margin-top: .2rem; }
nav a { color: var(--header-ink); }
nav a:hover { color: var(--leeloo-orange); }
nav ul { list-style: none; display: flex; gap: 1rem; margin: 0; padding: 0; }
nav a { display: inline-block; padding: .4rem 0; min-height: 44px; line-height: 2; }
nav a[aria-current="page"] { font-weight: 700; text-decoration-color: var(--leeloo-orange); text-decoration-thickness: 3px; }

.banners { background: var(--banner-bg); color: var(--banner-text); }
.banner-inner { display: flex; flex-direction: column; gap: .5rem; padding-top: .75rem; padding-bottom: .75rem; }
.banner-text { margin: 0; font-weight: 700; min-height: 3em; }
.banners { --focus: var(--deep-navy); }
.banner-controls { display: flex; gap: .5rem; }
.banner-controls button {
  background: transparent; color: var(--banner-text);
  border: 1px solid currentColor; border-radius: 999px;
  padding: .35rem .9rem; min-height: 44px; font: inherit; font-size: .9rem; cursor: pointer;
}

h1 { font-family: var(--font-head); font-weight: 400; text-transform: uppercase; letter-spacing: .01em; color: var(--heading); font-size: 1.75rem; line-height: 1.1; margin: 1.5rem 0 .5rem; }
h2 { color: var(--heading); }
.lede { color: var(--muted); margin-top: 0; }

.posts { display: grid; gap: 1rem; margin: 1.25rem 0 2rem; }

.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.post-header { display: flex; justify-content: flex-end; min-height: 0; }
.badge {
  background: var(--badge-bg); color: var(--badge-text);
  border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 600;
}
.post-image { display: block; width: 100%; height: auto; border-radius: 8px; margin: .5rem 0; }
.post-text { margin: .5rem 0; font-size: 1.15rem; white-space: pre-line; }
.version-count { margin: 0; color: var(--muted); font-size: .85rem; }
.own-words { color: var(--muted); font-size: .95rem; }
.tip { background: var(--tip-bg); color: var(--tip-text); border-left: 4px solid var(--leeloo-orange); border-radius: 8px; padding: .6rem .8rem; font-size: .95rem; }
.post-link { font-size: .95rem; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.button {
  border-radius: 999px; padding: .6rem 1.1rem; min-height: 44px;
  font: inherit; font-weight: 700; cursor: pointer; border: 2px solid var(--button-bg);
}
.button.primary { background: var(--button-bg); color: var(--button-ink); }
.button.primary:hover { background: var(--button-hover-bg); border-color: var(--button-hover-bg); color: var(--button-hover-ink); }
.button.secondary { background: transparent; color: var(--secondary-ink); border-color: var(--secondary-border); }
.button.secondary:hover { background: var(--secondary-border); color: var(--bg); }

.share-list { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.share-link {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: .3rem .85rem; border: 1px solid var(--border); border-radius: 999px;
  text-decoration: none; font-size: .95rem;
}

.notice { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.notice h2 { margin-top: 0; font-size: 1.2rem; }
.loading { color: var(--muted); }

.prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: .75rem; }

/* The rules: a numbered list whose items each carry an h2, so screen readers
   get both the list position and the heading outline. */
.prose .rules { list-style: none; counter-reset: rule; padding-left: 0; margin: 1.5rem 0; }
.rules > li { counter-increment: rule; margin-bottom: 1.5rem; }
.rules > li > h2 { font-size: 1.25rem; margin: 0 0 .5rem; }
.rules > li > h2::before { content: counter(rule) ". "; }
.rules > li > p, .rules > li > ul { margin: .5rem 0; }
.rules ul { padding-left: 1.25rem; }
.rules ul li { margin-bottom: .4rem; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0 1rem; }
.rules-note { color: var(--muted); }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding: 1rem 0 2rem; }

@media (min-width: 40rem) {
  h1 { font-size: 2.4rem; }
  .wordmark { font-size: 1.7rem; }
  .banner-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .post { padding: 1.25rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: .5rem 0 0; padding: 0; }
.footer-links a { display: inline-block; min-height: 44px; line-height: 44px; }
.placeholder-inline { background: var(--placeholder-bg); color: var(--placeholder-ink); border: 1px dashed var(--placeholder-border); padding: 0 .3rem; font-family: ui-monospace, monospace; }
