/* Outfoxed Labs: shared styles.
   Palette "A fox in a winter wood", plus Cream for the light ground.
   Light mode is the default. Dark mode follows the system, or the
   Day/Night switch, which sets data-theme on <html>. */

/* ---------- fonts (self-hosted, latin only) ---------- */
@font-face {
  font-family: "Young Serif";
  src: url("/assets/fonts/young-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/hanken-grotesk-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/hanken-grotesk-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("/assets/fonts/dm-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("/assets/fonts/dm-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  /* palette */
  --cream: #FFF4E8;
  --frost: #E8EBE5;
  --pine:  #1F3B2F;
  --night: #13221B;
  --bark:  #2A1D17;
  --fox:   #E2621B;
  --ember: #A9431A;

  /* light mode roles */
  --ground: var(--cream);
  --ink: var(--pine);                 /* 11.2:1 on Cream */
  --dim: #57695D;                     /* Pine at 75%, 5.4:1 on Cream */
  --rule: rgba(31, 59, 47, .18);
  --rule-strong: var(--pine);
  --accent-big: var(--fox);           /* text 24px and up only (3.2:1) */
  --accent: var(--ember);             /* small orange text (5.5:1) */
  --underline: var(--fox);
  --disc: #FBDEC9;                    /* Fox 15% over Cream */
  --star: transparent;
  --tile: #F3E2CF;
  --tile-ink: var(--pine);
  --panel: var(--fox);
  --panel-head: var(--cream);         /* 30px, 3.2:1 */
  --panel-ink: var(--night);          /* 4.7:1 on Fox */
  --panel-line: var(--night);
  --panel-link: var(--night);
  --label: var(--cream);
  --groove-a: var(--night);
  --groove-b: var(--bark);
  --spindle: var(--night);

  /* the fox mark */
  --fx-body: var(--fox);
  --fx-inner: var(--ember);
  --fx-muzzle: #FFFFFF;
  --fx-eye: var(--bark);
  --fx-nose: var(--bark);
  --fx-ring: transparent;

  /* type */
  --display: "Young Serif", "Iowan Old Style", Georgia, serif;
  --body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, monospace;

  /* space scale: 4 8 12 16 24 32 48 64 96 128 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  color-scheme: light;
}

/* dark mode: Night ground, Pine panels, Frost text, Fox accents */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: var(--night); --ink: var(--frost); --dim: #A8AFA8;
    --rule: rgba(232, 235, 229, .14); --rule-strong: var(--frost);
    --accent-big: var(--fox); --accent: var(--fox); --underline: var(--fox);
    --disc: var(--pine); --star: var(--frost); --tile: var(--pine); --tile-ink: var(--frost);
    --panel: var(--pine); --panel-head: var(--frost); --panel-ink: #A8AFA8;
    --panel-line: var(--fox); --panel-link: var(--frost);
    --label: var(--fox);
    --fx-eye: var(--night); --fx-nose: var(--night); --fx-ring: var(--fox);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: var(--night); --ink: var(--frost); --dim: #A8AFA8;
  --rule: rgba(232, 235, 229, .14); --rule-strong: var(--frost);
  --accent-big: var(--fox); --accent: var(--fox); --underline: var(--fox);
  --disc: var(--pine); --star: var(--frost); --tile: var(--pine); --tile-ink: var(--frost);
  --panel: var(--pine); --panel-head: var(--frost); --panel-ink: #A8AFA8;
  --panel-line: var(--fox); --panel-link: var(--frost);
  --label: var(--fox);
  --fx-eye: var(--night); --fx-nose: var(--night); --fx-ring: var(--fox);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
  hanging-punctuation: first;
}
@media (max-width: 520px) { body { font-size: 17px; } }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--disc); color: var(--ink); }
:focus-visible { outline: 2px solid var(--underline); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: var(--s4); top: -100px;
  background: var(--ink); color: var(--ground);
  padding: var(--s2) var(--s3); border-radius: 4px; text-decoration: none; font-size: 15px;
}
.skip:focus { top: var(--s4); }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(var(--s4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--s4), env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) {
  .wrap { padding-left: var(--s6); padding-right: var(--s6); }
}
.mono {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ---------- the fox mark (inline SVG, colors follow the theme) ---------- */
.fox .b { fill: var(--fx-body); stroke: var(--fx-body); stroke-width: 1.5; stroke-linejoin: round; }
.fox .i { fill: var(--fx-inner); }
.fox .m { fill: var(--fx-muzzle); }
.fox .e { fill: var(--fx-eye); }
.fox .n { fill: var(--fx-nose); stroke: var(--fx-ring); stroke-width: 1.6; }

/* ---------- header ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); padding-block: var(--s5);
}
.brand { display: inline-flex; align-items: center; gap: var(--s3); text-decoration: none; }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand span { font-family: var(--display); font-size: 21px; line-height: 1; white-space: nowrap; }
.nav-links {
  list-style: none; display: flex; align-items: center; gap: var(--s5);
  margin: 0; padding: 0; font-size: 15px;
}
.nav-links a { color: var(--dim); text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"] {
  text-decoration: underline; text-decoration-color: var(--underline);
  text-decoration-thickness: 1px; text-underline-offset: 6px;
}

/* Day / Night switch */
.mode {
  font: 400 11.5px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 9px 6px;
  cursor: pointer;
}
.mode:hover { color: var(--ink); border-color: var(--rule-strong); }
.mode .to-day { display: none; }
:root[data-theme="dark"] .mode .to-day { display: inline; }
:root[data-theme="dark"] .mode .to-night { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mode .to-day { display: inline; }
  :root:not([data-theme="light"]) .mode .to-night { display: none; }
}

@media (max-width: 520px) {
  .nav { padding-block: var(--s4); }
  .nav-links { gap: var(--s3); font-size: 14px; }
  .nav-links .opt { display: none; }
  .brand svg { width: 34px; height: 34px; }
  .brand span { font-size: 19px; }
}
@media (max-width: 380px) {
  .brand span { display: none; }
}

/* ---------- entry pages: hero, disc, field notes (home and app pages) ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 5fr);
  gap: var(--s7);
  align-items: center;
  padding-block: var(--s8) var(--s9);
}
.hero .entry { color: var(--dim); margin-bottom: var(--s5); }
.hero h1 {
  font-size: clamp(44px, 6.8vw, 80px);
  line-height: 1.02;
  letter-spacing: -.018em;
  text-wrap: pretty;
}
.hero h1 em { font-style: normal; color: var(--accent-big); }
.define { margin-top: var(--s5); font-size: 16px; color: var(--dim); max-width: 56ch; }
.define b { font-family: var(--display); font-weight: 400; color: var(--ink); font-size: 17px; }
.define .pos { font-family: var(--mono); font-size: 12px; margin: 0 6px 0 5px; }
.lede { margin-top: var(--s4); font-size: 18.5px; line-height: 1.55; max-width: 40ch; }

.plate { justify-self: end; width: min(100%, 380px); display: grid; gap: var(--s3); }
.disc {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--disc);
  display: grid;
  place-items: center;
}
.disc svg { width: 58%; height: auto; position: relative; }
.star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--star); opacity: .55; }
.s1 { left: 16%; top: 22%; }
.s2 { left: 78%; top: 15%; }
.s3 { left: 86%; top: 64%; }
.s4 { left: 22%; top: 80%; }
.s5 { left: 52%; top: 7%; }
.cap { font-size: 13.5px; line-height: 1.45; color: var(--dim); font-style: italic; padding-inline: var(--s1); }
.cap span { font-family: var(--mono); font-style: normal; font-size: 11.5px; letter-spacing: .06em; margin-right: 6px; }

.notes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
}
.notes div { padding: var(--s4) var(--s5) var(--s4) 0; display: grid; gap: 6px; align-content: start; }
.notes div + div { padding-left: var(--s5); border-left: 1px solid var(--rule); }
.notes dt { color: var(--dim); font-size: 11.5px; }
.notes dd { font-size: 16px; line-height: 1.45; }

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--s6); padding-block: var(--s6) var(--s8); }
  .plate { justify-self: start; width: min(100%, 280px); }
  .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes div:nth-child(3) { padding-left: 0; border-left: 0; }
  .notes div:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* ---------- the record (Outfoxed Records) ---------- */
.vinyl {
  width: var(--vinyl, 120px); height: var(--vinyl, 120px);
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, var(--groove-a) 0 2px, var(--groove-b) 2px 4px);
  display: grid; place-items: center;
  box-shadow: 0 12px 26px -14px rgba(19, 34, 27, .7);
}
.vinyl span { width: 40%; height: 40%; border-radius: 50%; background: var(--label); display: grid; place-items: center; }
.vinyl span::after { content: ""; width: 14%; height: 14%; border-radius: 50%; background: var(--spindle); }
@media (prefers-reduced-motion: no-preference) {
  .vinyl { animation: turn 9s linear infinite; }
  @keyframes turn { to { transform: rotate(360deg); } }
}

/* ---------- light and dark versions of one picture (app icons) ---------- */
.ic-dark { display: none; }
:root[data-theme="dark"] .ic-light { display: none; }
:root[data-theme="dark"] .ic-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ic-light { display: none; }
  :root:not([data-theme="light"]) .ic-dark { display: block; }
}

/* ---------- footer ---------- */
.foot {
  margin-top: var(--s8);
  border-top: 1px solid var(--rule);
  padding-block: var(--s5) var(--s7);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3) var(--s5);
  font-size: 14px; color: var(--dim);
}
.foot nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

@media (prefers-reduced-motion: no-preference) {
  body { transition: background-color .25s ease, color .25s ease; }
}
