/* ============================================================
   RightThing · Manifesto site
   Tokens · type · sections · scrims · grain · form
   ============================================================ */

:root {
  --black: #0a0908;
  --paper: #efe7d7;
  --brass: #c9a24e;
  --brass-deep: #b08c3d;
  --paper-strong: rgba(239, 231, 215, 0.82);
  --muted: rgba(239, 231, 215, 0.52);
  --line: rgba(239, 231, 215, 0.15);
  --steel: #8a8f98;

  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, Menlo, monospace;

  --pad: clamp(22px, 4vw, 52px);
  --gutter: clamp(22px, 4vw, 52px);
  --copy-max: min(560px, 92%);

  --grain-url: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============ RESET / BASE ============ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-snap-type: none; scroll-behavior: auto; }
}

/* Mobile: disable scroll-snap entirely.
   iOS Safari with `y mandatory` plus `100svh` sections will pull the viewport
   to section 2 when the user is scrolling within the hero — feels broken.
   Native free scroll is the right call on small screens. */
@media (max-width: 720px) {
  html { scroll-snap-type: none; }
}

/* Short viewports (landscape phones / tiny windows): soften to proximity */
@media (max-height: 620px) {
  html { scroll-snap-type: y proximity; }
}
body {
  background: var(--black);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: clamp(15px, 1.6vw, 19px);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ============ TYPOGRAPHY ============ */

h1, h2, h3 { font-family: var(--font-display); color: var(--paper); }

h1 {
  font-weight: 700;
  font-size: clamp(42px, 8.2vw, 94px);
  line-height: 0.97;
  letter-spacing: -0.025em;
}

h2 {
  font-weight: 700;
  font-size: clamp(32px, 5.5vw, 64px);
  line-height: 1.0;
  letter-spacing: -0.02em;
}

h3 {
  font-weight: 500;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sub {
  margin-top: 22px;
  font-weight: 400;
  font-size: clamp(15px, 1.6vw, 19px);
  line-height: 1.5;
  color: var(--paper-strong);
  max-width: 34ch;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-block;
}

.cta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
  display: inline-block;
}

.brule {
  width: 46px;
  height: 2px;
  background: var(--brass);
  margin: 26px 0 16px;
  border: 0;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(16px, 2vw, 19px);
  letter-spacing: -0.01em;
  color: var(--paper);
  display: inline-block;
}
.wordmark b { color: var(--brass); font-weight: 700; }

/* ============ SECTION FRAMEWORK ============ */

.section {
  position: relative;
  min-height: 100svh;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.page-footer { scroll-snap-align: start; }

/* full-bleed graded photo */
.section__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: var(--black);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

/* directional scrim — transparent over subject, dark under text */
.section::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.section--text-right::before {
  background:
    linear-gradient(90deg, rgba(10, 9, 8, 0) 30%, rgba(10, 9, 8, 0.55) 62%, rgba(10, 9, 8, 0.86) 100%),
    radial-gradient(120% 90% at 30% 40%, rgba(10, 9, 8, 0) 40%, rgba(10, 9, 8, 0.5) 100%);
}

.section--text-left::before {
  background:
    linear-gradient(270deg, rgba(10, 9, 8, 0) 30%, rgba(10, 9, 8, 0.55) 62%, rgba(10, 9, 8, 0.86) 100%),
    radial-gradient(120% 90% at 70% 40%, rgba(10, 9, 8, 0) 40%, rgba(10, 9, 8, 0.5) 100%);
}

.section--text-over::before {
  background:
    linear-gradient(180deg, rgba(10, 9, 8, 0.45) 0%, rgba(10, 9, 8, 0.65) 60%, rgba(10, 9, 8, 0.88) 100%);
}

/* Per-section scrim reinforcement (AA over busy / mid-tone imagery) */
#choice::before {
  background:
    linear-gradient(90deg, rgba(10, 9, 8, 0) 18%, rgba(10, 9, 8, 0.68) 50%, rgba(10, 9, 8, 0.95) 100%),
    radial-gradient(120% 90% at 30% 40%, rgba(10, 9, 8, 0) 35%, rgba(10, 9, 8, 0.6) 100%);
}

#frontier::before {
  background:
    linear-gradient(90deg, rgba(10, 9, 8, 0) 12%, rgba(10, 9, 8, 0.72) 48%, rgba(10, 9, 8, 0.96) 100%),
    radial-gradient(120% 90% at 30% 40%, rgba(10, 9, 8, 0) 35%, rgba(10, 9, 8, 0.65) 100%);
}

/* film grain overlay — identical on every section */
.section::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: var(--grain-url);
  background-repeat: repeat;
}

.section__inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  width: 100%;
}

.section--text-right .section__inner { justify-content: flex-end; }
.section--text-left .section__inner { justify-content: flex-start; }
.section--text-over .section__inner { justify-content: flex-end; align-items: center; }

.copy {
  max-width: var(--copy-max);
  text-align: left;
}

.copy .eyebrow { margin-bottom: 18px; }

/* ============ HERO (matches rightthing-hero.html) ============ */

.section--hero { padding: var(--pad); }

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.topbar .eyebrow {
  text-align: right;
  max-width: 60ch;
}

.section--hero .section__inner { justify-content: flex-end; }

.hero__footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============ CLOSE + CONTACT (section 06) ============ */

.section--close {
  background: var(--black);
}

.section--close .section__media--faint {
  opacity: 0.12;
  filter: grayscale(0.4) contrast(0.9);
  background-size: cover;
}

.section--close::before {
  background:
    radial-gradient(80% 60% at 50% 40%, rgba(10, 9, 8, 0.4) 0%, rgba(10, 9, 8, 0.9) 80%);
}

.close__inner {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(48px, 8vh, 96px);
  padding: clamp(48px, 8vh, 96px) 0;
}

.close__creed {
  text-align: center;
  max-width: 820px;
}

.close__creed .eyebrow { margin-bottom: 18px; }
.close__creed h2 { line-height: 1.05; }
.close__creed .sub { margin-left: auto; margin-right: auto; max-width: 40ch; }
.close__creed .brule { margin-left: auto; margin-right: auto; }

/* ============ CONTACT FORM ============ */

.contact {
  width: 100%;
  max-width: 560px;
  text-align: left;
}

.contact__heading {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 28px;
  font-weight: 400;
}

.contact__form { display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 8px; }

.field label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field textarea {
  font: inherit;
  font-size: 16px; /* prevent iOS zoom */
  color: var(--paper);
  background: rgba(239, 231, 215, 0.03);
  border: 1px solid var(--line);
  padding: 14px 14px;
  border-radius: 2px;
  transition: border-color 200ms ease, background 200ms ease;
  resize: vertical;
  font-family: var(--font-display);
}

.field textarea { min-height: 110px; line-height: 1.45; }

.field input:hover,
.field textarea:hover { border-color: rgba(239, 231, 215, 0.28); }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brass);
  background: rgba(239, 231, 215, 0.05);
  box-shadow: 0 0 0 1px var(--brass);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--brass);
}

.field__err {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--brass);
  min-height: 0;
  display: none;
}
.field__err:not(:empty) { display: block; }

.contact__send {
  align-self: flex-start;
  margin-top: 8px;
  padding: 14px 28px;
  background: var(--brass);
  color: var(--black);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-radius: 2px;
  transition: background 200ms ease, transform 200ms ease;
}

.contact__send:hover { background: var(--brass-deep); }
.contact__send:disabled { opacity: 0.6; cursor: wait; }

.contact__status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--brass);
  margin-top: 8px;
}

.contact__success {
  text-align: left;
  padding: 32px 0;
}

.contact__success h3 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 500;
  color: var(--paper);
  letter-spacing: -0.01em;
}

/* ============ PAGE FOOTER ============ */

.page-footer {
  background: var(--black);
  border-top: 1px solid var(--line);
  padding: clamp(32px, 4vw, 48px) var(--pad);
  color: var(--muted);
}

.page-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: space-between;
  align-items: flex-end;
}

.page-footer__lockup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-footer__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-footer__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-footer__meta a { color: var(--paper); }
.page-footer__meta a:hover { color: var(--brass); }

/* ============ REVEAL MOTION ============ */

@keyframes rt-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.reveal { opacity: 0; }
.reveal.is-revealed > *,
.reveal--load > * {
  animation: rt-up 0.95s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.reveal.is-revealed,
.reveal--load { opacity: 1; }

/* staggered children (~120ms) */
.reveal.is-revealed > *:nth-child(1),
.reveal--load > *:nth-child(1) { animation-delay: 0.12s; }
.reveal.is-revealed > *:nth-child(2),
.reveal--load > *:nth-child(2) { animation-delay: 0.24s; }
.reveal.is-revealed > *:nth-child(3),
.reveal--load > *:nth-child(3) { animation-delay: 0.36s; }
.reveal.is-revealed > *:nth-child(4),
.reveal--load > *:nth-child(4) { animation-delay: 0.48s; }
.reveal.is-revealed > *:nth-child(5),
.reveal--load > *:nth-child(5) { animation-delay: 0.60s; }
.reveal.is-revealed > *:nth-child(6),
.reveal--load > *:nth-child(6) { animation-delay: 0.72s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; }
  .reveal > * { animation: none !important; }
}

/* ============ RESPONSIVE: mobile flips scrim to bottom-up, copy to lower third ============ */

@media (max-width: 720px) {
  :root { --copy-max: 100%; }

  .section { padding: clamp(20px, 5vw, 28px); }

  /* Vertical scrim on mobile — copy reads against bottom-up gradient */
  .section--text-right::before,
  .section--text-left::before {
    background: linear-gradient(180deg, rgba(10, 9, 8, 0.15) 30%, rgba(10, 9, 8, 0.6) 62%, rgba(10, 9, 8, 0.94) 100%);
  }

  .section__inner,
  .section--text-right .section__inner,
  .section--text-left .section__inner {
    align-items: flex-end;
    justify-content: flex-start;
  }

  .copy { max-width: 100%; }
  .sub { max-width: 40ch; }

  .topbar { padding-bottom: 12px; }
  .hero__footer { padding-top: 12px; gap: 12px; flex-wrap: wrap; }

  /* per-section mobile background positions — keep the subject in frame */
  .section--hero .section__media { background-position: 30% 22% !important; }
  #choice .section__media { background-position: 40% 30% !important; }
  #who .section__media { background-position: 80% 30% !important; }
  #frontier .section__media { background-position: 50% 40% !important; }
  #next .section__media { background-position: 70% 30% !important; }

  .close__inner { gap: clamp(36px, 6vh, 64px); padding: clamp(32px, 6vh, 56px) 0; }

  .page-footer__inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .page-footer__meta { align-items: flex-start; }
}

@media (max-width: 420px) {
  .field input,
  .field textarea { padding: 12px; }
}
