/* Beyond The Dark Horizon — samizdat / risograph aesthetic
   ---------------------------------------------------------
   Warm newsprint cream, single-pass ink black, one forest-green
   accent, one rust punctuation mark. Type-driven. Hairlines only.
*/

:root {
  --paper:        #ede5d3;
  --paper-2:      #e2d8c0;
  --paper-edge:   #c9bea0;
  --ink:          #1a1613;
  --ink-soft:     #3b342b;
  --ink-mute:     #6a6358;
  --green:        #3d5c2c;
  --green-deep:   #243619;
  --rust:         #b85428;

  --max:          1320px;
  --gutter:       clamp(1.5rem, 5vw, 2.5rem);

  --t-display:    'Special Elite', ui-monospace, Menlo, monospace;
  --t-body:       'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --t-mono:       'Courier Prime', ui-monospace, 'Courier New', monospace;
}

/* --- reset-ish ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--t-body);
  font-size: clamp(17px, 1.05vw + 14px, 21px);
  line-height: 1.55;
  font-feature-settings: "kern", "liga", "onum";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* Paper grain — fixed overlay, very low opacity, multiplies into the warm cream. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: .09;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
/* Subtle ink dust at the page edges, like a photocopy vignette. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 201;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(26,22,19,.10) 100%);
}

/* --- thin top ticker (publication meta) -------------------------------- */
.ticker {
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  overflow: hidden;
  position: relative;
}
.ticker__track {
  display: flex;
  gap: 3rem;
  padding: .55rem 0;
  white-space: nowrap;
  width: max-content;
  animation: ticker 80s linear infinite;
}
.ticker__track span::before {
  content: "✦";
  color: var(--rust);
  margin-right: 1rem;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
}

/* --- container --------------------------------------------------------- */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* --- masthead ---------------------------------------------------------- */
.masthead {
  /* top/bottom only — horizontal padding comes from .wrap. Using the
     shorthand here would zero out the gutter on the masthead alone. */
  padding-top:    clamp(1.75rem, 5vw, 3.75rem);
  padding-bottom: clamp(1rem, 3vw, 2rem);
  position: relative;
}
.masthead__kicker {
  font-family: var(--t-mono);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  /* Fluid breathing room above the big title — scales with viewport
     so the gap stays proportional to the title's clamp() size. */
  margin: 0 0 clamp(.75rem, 1.6vw, 1.5rem);
}
.masthead__kicker .roman {
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: .15em .55em;
  font-weight: 700;
  letter-spacing: .12em;
}

/* The title — risograph misregistration. Black ink layer + green screen layer. */
.title {
  position: relative;
  font-family: var(--t-display);
  font-weight: 400;
  margin: 0;
  /* Capped at 5.5rem so "Beyond The Dark Horizon" stays single-line on
     desktop content widths. Above that the title overflows to two lines
     with "Horizon" stranded on its own — looks like a wrap accident
     rather than a design choice. */
  font-size: clamp(2.2rem, 7vw, 5.5rem);
  line-height: .95;
  text-wrap: balance;
  color: var(--ink);
  letter-spacing: -0.005em;
  --offX: 6px;
  --offY: 4px;
}
.title a {
  text-decoration: none;
  color: inherit;
  position: relative;
  display: inline-block;
}
.title a::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--green);
  z-index: -1;
  transform: translate(var(--offX), var(--offY));
  mix-blend-mode: multiply;
  opacity: .85;
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}
.title a:hover::before {
  transform: translate(calc(var(--offX) * 1.8), calc(var(--offY) * 1.6));
}

.masthead__sub {
  font-family: var(--t-mono);
  font-size: clamp(12px, 1vw + 8px, 14px);
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--ink-soft);
  margin: 1.4rem 0 0;
}
.masthead__sub b { color: var(--rust); font-weight: 400; }

/* Hand-drawn horizon hairline. */
.horizon {
  width: 100%;
  height: 14px;
  margin: clamp(1rem, 3vw, 2rem) 0 0;
  display: block;
  overflow: visible;
  color: var(--ink);
}
.horizon path {
  stroke: currentColor;
  stroke-width: 1;
  fill: none;
  vector-effect: non-scaling-stroke;
}
.horizon path.echo {
  stroke: var(--green);
  opacity: .6;
  transform: translate(4px, 2px);
  transform-box: fill-box;
}

/* --- hero block: quote + actions --------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: clamp(1.25rem, 4vw, 3rem) 0 clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
}

.quote {
  font-family: var(--t-body);
  font-style: italic;
  font-size: clamp(1.15rem, 1vw + 1.05rem, 1.7rem);
  line-height: 1.4;
  color: var(--ink);
  border-left: 1px solid var(--ink);
  padding: .1rem 0 .1rem 1.2rem;
  margin: 0;
  hanging-punctuation: first;
}
.quote .turn {
  display: block;
  margin-top: .65em;
  font-style: normal;
  font-family: var(--t-mono);
  font-size: .65em;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.quote .turn::before { content: "— "; color: var(--rust); }

/* Tape-label CTAs */
.shelf {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem .65rem;
  align-items: flex-start;
}
.tape {
  --tilt: -1deg;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1rem .5rem;
  font-family: var(--t-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255,250,232,.55);
  border: 1px solid var(--ink);
  position: relative;
  transform: rotate(var(--tilt));
  transition: transform .25s ease, color .25s ease, background .25s ease;
  cursor: pointer;
}
.tape:nth-child(2n) { --tilt: .8deg; }
.tape:nth-child(3n) { --tilt: -.5deg; }
.tape:nth-child(5n) { --tilt: 1.2deg; }
.tape .vol {
  font-weight: 700;
  font-family: var(--t-display);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}
.tape .size { color: var(--ink-mute); font-size: 10.5px; letter-spacing: .1em; }
.tape:hover {
  transform: rotate(0) translateY(-2px);
  color: var(--green-deep);
  background: rgba(255,250,232,.85);
}
.tape.tape--green {
  background: rgba(61,92,44,.08);
  border-color: var(--green-deep);
}
.tape.tape--green:hover {
  background: var(--green);
  color: var(--paper);
  border-color: var(--green-deep);
}

/* --- gallery section --------------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: .55rem 0;
  font-family: var(--t-mono);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 1rem 0 1.25rem;
}
.section-head em {
  font-style: normal;
  color: var(--rust);
}

.gallery {
  columns: 5 220px;
  column-gap: 10px;
  padding-bottom: 4rem;
}
.gallery figure {
  break-inside: avoid;
  margin: 0 0 10px;
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--ink);
  cursor: zoom-in;
  transition: transform .25s ease;
}
.gallery figure:hover {
  transform: translateY(-2px);
}
.gallery figure::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed transparent;
  pointer-events: none;
  transition: border-color .2s ease;
}
.gallery figure:hover::after {
  border-color: rgba(26,22,19,.25);
}
.gallery img {
  width: 100%;
  height: auto;
  /* width/height attrs come from PHP — browser uses them to set
     aspect-ratio and reserve space before the bitmap loads, so the
     masonry doesn't reshuffle as each thumbnail arrives. */
  display: block;
  filter: contrast(1.05) saturate(.95);
  transition: filter .35s ease;
  background: var(--paper-2);
}
.gallery figure:hover img {
  filter: contrast(1.12) saturate(1);
}
.gallery figcaption {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--t-mono);
  font-size: 10px;
  letter-spacing: .08em;
  padding: 2px 6px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .25s ease, transform .25s ease;
  text-transform: lowercase;
  pointer-events: none;
  max-width: calc(100% - 12px);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.gallery figure:hover figcaption { opacity: 1; transform: translateY(0); }

/* --- lightbox ---------------------------------------------------------- */
.lightbox {
  border: none;
  padding: 0;
  background: rgba(26,22,19,.94);
  color: var(--paper);
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  margin: 0;
}
.lightbox::backdrop { background: rgba(26,22,19,.95); }
.lightbox__img {
  position: absolute;
  inset: 5vh 5vw;
  width: 90vw;
  height: 90vh;
  object-fit: contain;
  filter: drop-shadow(0 0 30px rgba(0,0,0,.45));
}
.lightbox__btn {
  position: absolute;
  background: transparent;
  border: 1px solid var(--paper);
  color: var(--paper);
  font-family: var(--t-mono);
  font-size: 14px;
  padding: .5rem .8rem;
  cursor: pointer;
  letter-spacing: .14em;
  text-transform: uppercase;
  z-index: 2;
  transition: background .15s ease, color .15s ease;
}
.lightbox__btn:hover { background: var(--paper); color: var(--ink); }
.lightbox__close { top: 1rem; right: 1rem; }
.lightbox__prev  { top: 50%; left: 1rem; transform: translateY(-50%); }
.lightbox__next  { top: 50%; right: 1rem; transform: translateY(-50%); }
.lightbox__cap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1rem;
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--paper);
  opacity: .7;
}

/* --- contact page ------------------------------------------------------ */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 640px;
  padding: clamp(1rem, 3vw, 2.5rem) 0 5rem;
}
.contact h2 {
  font-family: var(--t-display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 .25rem;
  line-height: 1;
}
.contact .lede {
  font-family: var(--t-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 2rem;
}
.contact form { display: grid; gap: 1.4rem; }
.field {
  display: grid;
  gap: .35rem;
}
.field label {
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field input, .field textarea {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink);
  padding: .5rem 0;
  font-family: var(--t-body);
  font-size: 1.05rem;
  color: var(--ink);
  width: 100%;
  border-radius: 0;
  transition: border-color .2s ease;
}
.field textarea {
  border: 1px solid var(--ink);
  padding: .75rem;
  min-height: 160px;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--green);
  background: rgba(61,92,44,.04);
}

.send {
  justify-self: start;
  font-family: var(--t-display);
  font-size: 1.3rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: .65rem 1.6rem;
  cursor: pointer;
  letter-spacing: .02em;
  transition: transform .15s ease, background .2s ease, color .2s ease;
}
.send::before { content: "→ "; color: var(--rust); }
.send:hover {
  background: var(--green);
  border-color: var(--green-deep);
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 var(--ink);
}

.flash {
  font-family: var(--t-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: .8rem 1rem;
  border: 1px solid currentColor;
}
.flash.success { color: var(--green-deep); }
.flash.error   { color: var(--rust); }

/* --- footer ------------------------------------------------------------ */
.coda {
  border-top: 1px solid var(--ink);
  /* top/bottom only — horizontal padding comes from .wrap. */
  padding-top:    1.4rem;
  padding-bottom: 3rem;
  font-family: var(--t-mono);
  font-size: 11.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: space-between;
}
.coda .mark { color: var(--rust); }

/* --- reveal-on-load ----------------------------------------------------
   Tight stagger — total span ~.4s — so the page settles fast. Translate
   is compositor-only, so no layout shift (no CLS contribution). The
   reveal waits for web fonts via the .fonts-ready gate set in btdh.js,
   which prevents the visible swap-shift on the title and body copy. */
.reveal {
  opacity: 0;
  transform: translateY(6px);
  animation: rise .55s cubic-bezier(.2,.7,.2,1) forwards;
  animation-play-state: paused;
}
.fonts-ready .reveal { animation-play-state: running; }
.reveal:nth-child(1) { animation-delay: .00s; }
.reveal:nth-child(2) { animation-delay: .06s; }
.reveal:nth-child(3) { animation-delay: .12s; }
.reveal:nth-child(4) { animation-delay: .18s; }
.reveal:nth-child(5) { animation-delay: .24s; }
@keyframes rise {
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
}

/* --- mobile nudges ----------------------------------------------------- */
@media (max-width: 540px) {
  .masthead__kicker { flex-wrap: wrap; gap: .7rem; }
  .gallery { columns: 2 140px; }
  .lightbox__btn { font-size: 12px; padding: .4rem .6rem; }
  .lightbox__close { top: .5rem; right: .5rem; }
  .lightbox__prev  { left: .5rem; }
  .lightbox__next  { right: .5rem; }
}
