/* Nick Daulton — the page reads like his comics: white paper, then ink, then the red room. */

:root {
  --paper: #ffffff;
  --ink: #000000;
  --wash: #9a9a9a;          /* his grey ink wash */
  --red: #ee0303;           /* sampled from The Man in the Red Room red pages */
  --red-deep: #8f0000;

  --display: "Big Shoulders Display", Impact, sans-serif;
  --letter: "Comic Neue", "Comic Sans MS", sans-serif;   /* comic lettering */

  --gutter: clamp(10px, 1.4vw, 18px);
  --pad: clamp(16px, 5vw, 72px);
  --border: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 1.125rem/1.5 var(--letter);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; }
.skip:focus { left: 8px; background: var(--paper); color: var(--ink); padding: 8px 12px; }

/* ---------- Comic vocabulary ---------- */

/* Caption box: the rectangular narration boxes from his pages. */
.caption {
  display: inline-block;
  margin: 0;
  padding: .55em .8em;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  font: 700 .95rem/1.3 var(--letter);
  text-transform: uppercase;
  letter-spacing: .02em;
  max-width: 34ch;
}

/* Speech balloon with a tail. */
.balloon {
  position: relative;
  margin: 0;
  padding: 1.4em 1.8em;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 50% / 46%;
  font: 700 1.05rem/1.3 var(--letter);
  text-transform: uppercase;
  text-align: center;
  max-width: 30ch;
}
.balloon::after {
  content: "";
  position: absolute;
  left: 22%;
  bottom: -26px;
  width: 34px; height: 30px;
  background: var(--paper);
  border-right: 3px solid var(--ink);
  clip-path: polygon(0 0, 100% 0, 30% 100%);
}

/* A panel: art inside a heavy black border, sitting on paper-white gutter. */
.panel {
  margin: 0;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  outline: var(--gutter) solid var(--paper);
  overflow: hidden;
}
.panel img { width: 100%; height: 100%; object-fit: cover; }

.title {
  margin: 0 0 .35em;
  font: 900 clamp(3rem, 9vw, 8.5rem)/.86 var(--display);
  text-transform: uppercase;
  letter-spacing: -.01em;
}

.btn {
  display: inline-block;
  padding: .7em 1.2em;
  background: var(--red);
  color: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  font: 700 1rem/1 var(--letter);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn--ink { background: var(--ink); box-shadow: 5px 5px 0 var(--paper); border-color: var(--paper); }
.btn--ink:hover { box-shadow: 7px 7px 0 var(--paper); }
.btn--ghost { background: var(--paper); color: var(--ink); }

/* ---------- Masthead ---------- */

.masthead {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px var(--pad);
  pointer-events: none;
}
.masthead > * { pointer-events: auto; }
.masthead__name { text-decoration: none; font-size: 1rem; }
.masthead__nav { display: flex; gap: 4px; }
.masthead__nav a {
  padding: .4em .7em;
  background: var(--ink); color: var(--paper);
  border: 2px solid var(--paper);
  font: 700 .85rem/1 var(--letter);
  text-transform: uppercase; text-decoration: none;
}
.masthead__nav a:hover { background: var(--red); }

/* ---------- 1. Hero ---------- */

.hero {
  position: relative;
  height: 100svh;
  background: var(--paper);
  overflow: hidden;
}
.hero__stage {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 72px var(--pad) 40px;
}
.hero__cover {
  height: 100%; width: auto; max-height: calc(100svh - 112px);
  object-fit: contain;
  /* Zoom target: the black bridge between the monster's goggles (keep in sync with main.js). */
  transform-origin: 51.6% 32.4%;
  will-change: transform;
}
.hero__ink { position: absolute; inset: -60px; pointer-events: none; filter: url(#bleed); }
.hero__blot { position: absolute; inset: 0; background: var(--ink); clip-path: circle(0% at 50% 50%); }
.hero__hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-size: .8rem;
}

/* ---------- 2. Book one ---------- */

.book--monster { position: relative; background: var(--ink); }

/* Fixed birch forest behind everything in this section. */
.forest {
  position: sticky; top: 0;
  height: 100svh; margin-bottom: -100svh;
  overflow: hidden;
}
.forest img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: .22;
  filter: contrast(1.3);
}

.drift {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 9vw;
  gap: var(--gutter);
  padding: 30vh var(--pad) 20vh;
}
.panel--a { grid-column: 1 / 8;  grid-row: 1 / 5; }
.panel--b { grid-column: 8 / 13; grid-row: 3 / 6; }
.panel--c { grid-column: 3 / 9;  grid-row: 7 / 12; }
.panel--d { grid-column: 9 / 13; grid-row: 8 / 13; }
.panel--e { grid-column: 1 / 7;  grid-row: 13 / 17; }
.drift__cap { align-self: start; justify-self: start; z-index: 2; }
.drift__cap--1 { grid-column: 6 / 11; grid-row: 6; }
.drift__cap--2 { grid-column: 7 / 13; grid-row: 14; justify-self: end; }

/* Horizontal reading strip. JS pins it and slides the track. */
.strip { position: relative; height: 100svh; overflow: hidden; display: flex; align-items: center; }
.strip__track {
  display: flex; align-items: center;
  gap: calc(var(--gutter) * 3);
  padding: 0 var(--pad);
  height: 72svh;
  will-change: transform;
}
.strip .panel { height: 100%; flex: 0 0 auto; }
.strip .panel img { height: 100%; width: auto; }

.issue {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--pad); align-items: center;
  padding: 22vh var(--pad);
}
.issue__cover { border: var(--border) solid var(--paper); max-height: 80svh; width: auto; justify-self: end; }
.issue__copy > * + * { margin-top: 1.2rem; }
.issue__meta { color: var(--wash); font-weight: 700; }
/* Stack narration boxes rather than letting short ones sit side by side. */
.issue__copy .caption { display: table; max-width: 44ch; }

/* ---------- 3. The red room ---------- */

.book--red { background: var(--red); color: var(--ink); position: relative; }
.redroom {
  min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--pad); align-items: center;
  padding: 16vh var(--pad);
}
/* Three pages stacked in one cell: page 51 front and center, the others tilted behind.
   Native scans are ~1250px wide; the largest shown here stays around 500px. */
.redroom__pages {
  display: grid; place-items: center;
  width: 100%; max-width: 820px; justify-self: center;
}
.redroom__pages > * { grid-area: 1 / 1; }
.panel--red { outline: none; border: 4px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); }
.redroom__p51 { width: 60%; z-index: 2; }
.redroom__p1  { width: 44%; justify-self: start; align-self: start; transform: rotate(-6deg); }
.redroom__p56 { width: 44%; justify-self: end; align-self: end; transform: rotate(5deg); }
.redroom__copy { display: grid; gap: 1.6rem; justify-items: start; }
.redroom__copy .title { color: var(--ink); }
.redroom__blurb { margin: 0; max-width: 40ch; font-weight: 700; }
.redroom__meta { margin: 0; max-width: 40ch; font-size: .9rem; font-weight: 700; }

/* ---------- 4. Shop ---------- */

.shop { background: var(--paper); color: var(--ink); padding: 18vh var(--pad); }
.shop__note { margin-bottom: 3rem; }
.shop__grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: calc(var(--gutter) * 2);
}
.product {
  display: grid; grid-template-rows: auto 1fr auto auto; gap: .6rem;
  padding: 12px;
  border: var(--border) solid var(--ink);
  background: var(--paper);
}
.product img { aspect-ratio: 3 / 4; width: 100%; object-fit: cover; border: 2px solid var(--ink); }
.product--red img { background: var(--red); object-fit: contain; }
.product h3 { margin: .3rem 0 0; font: 800 1.7rem/1 var(--display); text-transform: uppercase; }
.product__price { margin: 0; font-weight: 700; }
.product .btn { justify-self: start; }

/* ---------- 2. About ---------- */

/* Sits inside book one after the strip, so the fixed forest shows through. */
.about {
  position: relative; color: var(--paper);
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 3fr);
  gap: calc(var(--gutter) * 2); align-items: center;
  padding: 10vh var(--pad) 18vh;
}
.about__copy { display: grid; gap: 1rem; justify-items: start; }
.about__copy .caption { max-width: 46ch; }
.about__photo { aspect-ratio: 3 / 4; }
/* Grey it down so the photo sits in the book's black-and-white world. */
.about__photo img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1); }
.photo-slot {
  height: 100%; display: grid; place-items: center; text-align: center; padding: 1rem;
  background: repeating-linear-gradient(135deg, #fff 0 10px, #ececec 10px 20px);
  font-weight: 700; text-transform: uppercase;
}

/* ---------- 6. Contact ---------- */

.contact {
  background: var(--ink);
  padding: 18vh var(--pad);
  display: grid; justify-items: center; gap: 2rem;
}
.contact__email { max-width: 640px; text-align: center; }
.balloon--form {
  width: min(640px, 100%); max-width: none;
  border-radius: 48px;
  padding: clamp(28px, 5vw, 56px);
  display: grid; gap: 1rem;
  text-align: left; text-transform: none;
}
.balloon--form label { display: grid; gap: .3rem; font-weight: 700; text-transform: uppercase; font-size: .9rem; }
.balloon--form input, .balloon--form select, .balloon--form textarea {
  font: 400 1.05rem/1.4 var(--letter);
  padding: .6em .7em;
  border: 2px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink);
}
.balloon--form .btn { justify-self: start; }
.form-status { margin: 0; min-height: 1.4em; font-weight: 700; }

/* ---------- Footer ---------- */

.footer {
  background: var(--paper); color: var(--ink);
  display: grid; justify-items: center; gap: 1.5rem;
  padding: 12vh var(--pad) 40px;
}
.footer__walk { width: min(420px, 80vw); }
.footer__links { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: center; font-weight: 700; margin: 4rem 0 0; }

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .masthead__nav a { padding: .35em .45em; font-size: .72rem; }
  .masthead__name { font-size: .8rem; }
  .drift { grid-auto-rows: 22vw; padding-top: 18vh; }
  .panel--a { grid-column: 1 / 13; grid-row: 1 / 4; }
  .panel--b { grid-column: 4 / 13; grid-row: 4 / 7; }
  .panel--c { grid-column: 1 / 10; grid-row: 8 / 11; }
  .panel--d { grid-column: 5 / 13; grid-row: 11 / 15; }
  .panel--e { grid-column: 1 / 13; grid-row: 16 / 19; }
  .drift__cap--1 { grid-column: 1 / 13; grid-row: 7; }
  .drift__cap--2 { grid-column: 1 / 13; grid-row: 15; justify-self: start; }
  .strip__track { height: 60svh; }
  .issue, .redroom, .about { grid-template-columns: 1fr; }
  .issue__cover { justify-self: center; max-height: 60svh; }
  .redroom { padding-top: 12vh; }
  .redroom__pages { padding: 4vh 0; }
  .about__photo { max-width: 260px; }
}

/* No motion: everything sits still, strip becomes a scrollable row. */
@media (prefers-reduced-motion: reduce) {
  .strip { height: auto; padding: 10vh 0; overflow-x: auto; }
  .strip__track { height: 60svh; }
  .btn { transition: none; }
}
