/* ============================================================
   ARFID.co.uk — faded 70s print, magazine folios, torch cursor
   ============================================================ */

:root {
  --bg: #efe6d0;
  --bg-2: #e6dabf;
  --surface: #f6efdd;
  --ink: #3a2f1a;
  --ink-soft: #5c4d2e;
  --ink-faint: #8a7a55;
  --a: #a67c00;
  --b: #6b7a3a;
  --c: #c04e1a;
  --rule: rgba(58, 47, 26, 0.22);
  --rule-soft: rgba(58, 47, 26, 0.12);
  --shadow: 0 1px 0 rgba(58, 47, 26, 0.08), 0 12px 30px -22px rgba(58, 47, 26, 0.5);
  --wrap: 1180px;
  --gutter: clamp(1.1rem, 4vw, 3.25rem);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --torch: 1;
}

/* Dark mode — same faded-print family, inverted to a warm darkroom */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1811;
    --bg-2: #14110c;
    --surface: #241f16;
    --ink: #ece0c6;
    --ink-soft: #c9b993;
    --ink-faint: #8d7f60;
    --a: #d9a72b;
    --b: #9aab5c;
    --c: #e2703a;
    --rule: rgba(236, 224, 198, 0.24);
    --rule-soft: rgba(236, 224, 198, 0.12);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 18px 40px -26px rgba(0, 0, 0, 0.9);
  }
}

:root[data-theme="dark"] {
  --bg: #1c1811;
  --bg-2: #14110c;
  --surface: #241f16;
  --ink: #ece0c6;
  --ink-soft: #c9b993;
  --ink-faint: #8d7f60;
  --a: #d9a72b;
  --b: #9aab5c;
  --c: #e2703a;
  --rule: rgba(236, 224, 198, 0.24);
  --rule-soft: rgba(236, 224, 198, 0.12);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 18px 40px -26px rgba(0, 0, 0, 0.9);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 90% at 12% -10%, color-mix(in srgb, var(--a) 12%, transparent), transparent 60%),
    radial-gradient(90% 70% at 100% 0%, color-mix(in srgb, var(--c) 8%, transparent), transparent 55%);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.55vw + 0.9rem, 1.12rem);
  line-height: 1.68;
  font-variation-settings: "SOFT" 0, "WONK" 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video { max-width: 100%; height: auto; display: block; }

a { color: var(--c); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--a); }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: 1rem; top: 1rem; z-index: 50;
  background: var(--surface);
  padding: 0.6rem 1rem;
  border: 1px solid var(--rule);
}

/* ---------- grain overlay ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='0.22'/></svg>");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .grain { mix-blend-mode: screen; opacity: 0.32; }
}
:root[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.32; }

/* ---------- torch cursor ---------- */
.torch {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms ease;
  background: radial-gradient(
    circle 260px at var(--tx, 50%) var(--ty, 40%),
    transparent 0%,
    color-mix(in srgb, var(--bg) 55%, transparent) 45%,
    color-mix(in srgb, var(--bg) 92%, transparent) 78%,
    var(--bg) 100%
  );
}
body.torch-on .torch { opacity: 1; }
body.torch-on .masthead,
body.torch-on main,
body.torch-on .site-footer { position: relative; z-index: 31; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 35;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding-block: 0.85rem;
}
.wordmark {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.wordmark span { color: var(--a); }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  margin-inline-start: auto;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.55rem 0.15rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--c); border-bottom-color: var(--c); }

.torch-toggle {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.6rem 0.9rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.torch-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--a);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--a) 60%, transparent);
}
.torch-toggle[aria-pressed="true"] .dot { animation: pulse 2.4s ease-in-out infinite; }
.torch-toggle:hover { border-color: var(--c); color: var(--c); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--a) 60%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--a) 0%, transparent); }
}

/* ---------- folio strip ---------- */
.folio-strip {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--bg-2) 60%, transparent);
}
.folio-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  padding-block: 0.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.folio-date { margin-inline-start: auto; }

/* ---------- opening ---------- */
.opening { padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(1.5rem, 4vw, 3rem); }
.kicker {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c);
  margin: 0 0 1rem;
}
h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.3rem, 7.2vw, 5.1rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  max-width: 18ch;
  text-wrap: balance;
  font-variation-settings: "SOFT" 20, "WONK" 1;
}
.caret {
  color: var(--c);
  font-weight: 300;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 0 0 1.6rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--rule);
}
.standfirst {
  font-size: clamp(1.15rem, 1.6vw + 0.8rem, 1.55rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0;
  font-style: italic;
  font-variation-settings: "SOFT" 40;
}

/* ---------- body sections ---------- */
.body-section { padding-block: clamp(2.2rem, 5vw, 4rem); }
.body-section + .body-section { border-top: 1px solid var(--rule-soft); }

h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 2.6vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 1.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  text-wrap: balance;
}
h2 .num {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--c);
  padding-top: 0.2em;
}
h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.005em;
}

.columns {
  column-count: 3;
  column-gap: clamp(1.5rem, 3vw, 2.75rem);
  column-rule: 1px solid var(--rule-soft);
}
.columns p { margin: 0 0 1.05em; break-inside: avoid-column; }
.columns p:last-child { margin-bottom: 0; }

.dropcap::first-letter {
  float: left;
  font-size: 3.6em;
  line-height: 0.82;
  padding: 0.06em 0.1em 0 0;
  color: var(--c);
  font-weight: 600;
  font-variation-settings: "SOFT" 0, "WONK" 1;
}

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

/* ---------- cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
}
.card {
  background: var(--surface);
  padding: clamp(1.1rem, 2vw, 1.6rem);
}
.card p { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }
.card h3 { color: var(--ink); }

/* ---------- note ---------- */
.note {
  margin-top: 2.2rem;
  padding: 1.2rem 1.4rem;
  border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 7%, var(--surface));
}
.note p { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }
.note-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c);
  margin-bottom: 0.5rem !important;
}

/* ---------- myths ---------- */
.myths { margin: 0; }
.myth {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  padding-block: 1.2rem;
  border-top: 1px solid var(--rule-soft);
}
.myth:first-child { border-top: 0; padding-top: 0; }
.myth dt {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--c);
}
.myth dd { margin: 0; color: var(--ink-soft); max-width: 74ch; }

/* ---------- contact form ---------- */
.contact-form {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1.1rem 1.4rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-wide { grid-column: 1 / -1; }
.field label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.field input,
.field select,
.field textarea {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.75rem 0.85rem;
  min-height: 44px;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { outline: 2px solid var(--c); outline-offset: 1px; }

.contact-form button {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0.9rem 1.6rem;
  min-height: 48px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
.contact-form button:hover { background: var(--c); border-color: var(--c); color: #fff8e8; }
.contact-form button:disabled { opacity: 0.6; cursor: progress; }
.form-status {
  margin: 0.9rem 0 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--b);
}
.form-status[data-state="error"] { color: var(--c); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: clamp(2rem, 5vw, 4rem);
  padding-block: 2.4rem 3.2rem;
  background: color-mix(in srgb, var(--bg-2) 55%, transparent);
}
.footer-inner { display: grid; gap: 0.9rem; }
.footer-mark {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink);
}
.footer-note { margin: 0; max-width: 62ch; color: var(--ink-faint); font-size: 0.88rem; }
.attribution {
  position: static;
  margin: 0.4rem 0 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  opacity: 0.6;
}
.attribution a { color: inherit; }

/* ---------- scroll reveal ---------- */
@keyframes fadeRise {
  from { opacity: 0; translate: 0 14px; }
  to { opacity: 1; translate: 0 0; }
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .body-section, .opening > .wrap > * {
      animation: fadeRise 440ms cubic-bezier(.2, .7, .1, 1) both;
      animation-timeline: view();
      animation-range: entry 0% cover 22%;
    }
  }
}
@supports not (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .body-section { animation: fadeRise 440ms cubic-bezier(.2, .7, .1, 1) both; }
  }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .columns { column-count: 2; }
}
@media (max-width: 640px) {
  .columns { column-count: 1; column-rule: 0; }
  .folio-date { margin-inline-start: 0; }
  .nav { margin-inline-start: 0; width: 100%; order: 3; }
  .torch-toggle { margin-inline-start: auto; }
  .myth { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .caret { animation: none; opacity: 1; }
  .torch { transition: none; }
}
