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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

::selection {
  background: var(--accent);
  color: var(--black);
}

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

/* ---------- typography helpers ---------- */

.display {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 115%;
  letter-spacing: -0.02em;
  line-height: 0.98;
  text-transform: uppercase;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey);
}

.serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.accent {
  color: var(--accent);
}

/* ---------- buttons & fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.85rem 1.6rem;
  border: 1px solid var(--line);
  color: var(--white);
  background: transparent;
  transition: border-color var(--dur-hover) var(--ease-out),
    color var(--dur-hover) var(--ease-out),
    background var(--dur-hover) var(--ease-out);
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--black);
}

.btn-solid:hover {
  background: var(--white);
  border-color: var(--white);
  color: var(--black);
}

.field {
  width: 100%;
  background: var(--black-2);
  border: 1px solid var(--line);
  color: var(--white);
  font: inherit;
  padding: 0.85rem 1rem;
  transition: border-color var(--dur-hover) var(--ease-out);
}

.field:focus {
  outline: none;
  border-color: var(--accent);
}

textarea.field {
  resize: vertical;
  min-height: 8rem;
}

label.lbl {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey);
  margin: 1.1rem 0 0.4rem;
}

/* ---------- film grain overlay ---------- */

.grain {
  position: fixed;
  inset: -100px;
  z-index: 9990;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: no-preference) {
  .grain {
    animation: grain-jump 0.8s steps(10) infinite;
  }
}

@keyframes grain-jump {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-30px, 20px); }
  40% { transform: translate(20px, -35px); }
  60% { transform: translate(-25px, -20px); }
  80% { transform: translate(30px, 25px); }
  100% { transform: translate(0, 0); }
}

/* ---------- reveals ---------- */

/* pre-state must not clip the box — IntersectionObserver ignores fully clipped targets */
.reveal {
  opacity: 0;
}

.reveal.in {
  opacity: 1;
  animation: reveal-wipe var(--dur-reveal) var(--ease-out) both;
}

@keyframes reveal-wipe {
  from {
    clip-path: inset(0 0 100% 0);
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    clip-path: inset(0 0 -10% 0);
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* ---------- letterbox frame ---------- */

.frame-239 {
  aspect-ratio: 2.39 / 1;
  overflow: hidden;
  background: var(--charcoal);
}

.frame-169 {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--charcoal);
}

.frame-239 > img,
.frame-239 > video,
.frame-169 > img,
.frame-169 > video,
.frame-169 > iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

/* ---------- rich content (page sections + editor preview) ---------- */

.rich {
  max-width: 52rem;
  color: var(--grey);
  font-size: 1.05rem;
  line-height: 1.75;
}

.rich > * + * {
  margin-top: 1.1em;
}

.rich h2,
.rich h3,
.rich h4 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--white);
}

.rich h2 { font-size: clamp(1.5rem, 3.2vw, 2.2rem); margin-top: 1.8em; }
.rich h3 { font-size: clamp(1.2rem, 2.4vw, 1.6rem); margin-top: 1.6em; }
.rich h4 { font-size: 1.05rem; margin-top: 1.4em; }

.rich h2:first-child,
.rich h3:first-child,
.rich h4:first-child {
  margin-top: 0;
}

.rich strong,
.rich b {
  color: var(--white);
  font-weight: 600;
}

.rich a {
  color: var(--accent);
  border-bottom: 1px solid rgba(232, 197, 71, 0.35);
  transition: border-color var(--dur-hover);
}

.rich a:hover {
  border-bottom-color: var(--accent);
}

.rich ul,
.rich ol {
  padding-left: 1.4rem;
}

.rich li + li {
  margin-top: 0.35em;
}

.rich li::marker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.rich blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.4rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.5;
  color: var(--white);
}

.rich hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4em 0;
}

.rich img {
  display: block;
  width: 100%;
  background: var(--charcoal);
  filter: contrast(1.05) saturate(0.92);
}

.rich figure {
  margin: 1.8em 0;
}

.rich figcaption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey);
  padding-top: 0.6rem;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 150%);
  z-index: 9999;
  background: var(--black-2);
  border: 1px solid var(--line);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.8rem 1.4rem;
  transition: transform 300ms var(--ease-out);
  max-width: min(90vw, 480px);
}

.toast.show {
  transform: translate(-50%, 0);
}

.toast.err {
  border-color: #d9534f;
}

.toast.good {
  border-color: var(--accent);
}
