/* DVENT · Issue #01
   A printed comic book. Paper, ink, one red. Red and ink own whole panels; gray is only print shading.
   Art breaks out of its frames. Missing art shows as an un-inked "pencils" panel with a label. */

:root {
  --paper: #f6f4ef;
  --white: #ffffff;
  --ink: #111111;
  --ink-2: #3a3a3a;
  --ink-soft: #5c5c5c;
  --rule: #d9d6cf;
  --red: #c51e1e;
  --red-deep: #9e1515;

  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-tag: "Permanent Marker", "Marker Felt", cursive;

  --frame: 0.1875rem;
  --gutter: clamp(0.625rem, 1.1vw, 0.875rem);
  --wrap: 77.5rem;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --dots-ink: radial-gradient(rgba(17, 17, 17, 0.16) 1px, transparent 1.4px) 0 0 / 7px 7px;
  --dots-paper: radial-gradient(rgba(246, 244, 239, 0.14) 1px, transparent 1.4px) 0 0 / 7px 7px;
  --dots-red: radial-gradient(rgba(17, 17, 17, 0.22) 1.1px, transparent 1.5px) 0 0 / 7px 7px;
  --hatch: repeating-linear-gradient(-45deg, rgba(17, 17, 17, 0.07) 0 1px, transparent 1px 9px);
  color-scheme: light;
}

/* ---------- Base + browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scrollbar-color: var(--ink) var(--paper);
  font-size: 16px;
}
/* The whole page scales as one printed sheet: every size is in rem, and on desktop the root
   grows with the window (16px at 1440 wide), so a big screen shows a bigger comic, not wider margins. */
@media (min-width: 901px) { html { font-size: clamp(16px, 100vw / 90, 26px); } } /* never smaller than phones get (landscape tablets, small laptops) */
body {
  margin: 0;
  background: var(--paper) url("/assets/brand/paper-1200.webp") 0 0 / 1200px repeat;
  background-blend-mode: multiply;
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--f-display);
  font-variation-settings: "wdth" 100;
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: hidden;
  caret-color: var(--red);
}
::selection { background: var(--red); color: var(--white); }
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
button, a, [role="button"] { touch-action: manipulation; }
:focus-visible { outline: 0.1875rem solid var(--red); outline-offset: 0.1875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1em; height: 1em; flex: none; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Type roles ---------- */
.t-mast { font-weight: 900; font-variation-settings: "wdth" 125; letter-spacing: -0.03em; line-height: 0.82; text-transform: uppercase; }
.t-title { font-weight: 800; font-variation-settings: "wdth" 72; letter-spacing: -0.01em; line-height: 0.92; text-transform: uppercase; }
.t-label { font-weight: 700; font-variation-settings: "wdth" 88; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.8125rem; line-height: 1.2; }

/* ---------- Masthead ---------- */
.top {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-block: max(0.875rem, env(safe-area-inset-top, 0px)) 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  flex-wrap: wrap;
  view-transition-name: top;
}
.logo {
  font: 400 clamp(2.75rem, 6.2vw, 4.25rem)/1 var(--f-tag);
  text-decoration: none;
  display: inline-block;
}
.logo img { display: block; height: 6.5rem; width: auto; transition: transform 200ms var(--ease-out); } /* the hand-drawn DVENT lettering */
@media (max-width: 640px) { .logo img { height: 4.25rem; } }
@media (hover: hover) and (pointer: fine) { .logo:hover img { transform: rotate(-2deg) scale(1.03); } }
.nav { display: flex; gap: 2px clamp(0.875rem, 2.2vw, 1.75rem); align-items: center; flex-wrap: wrap; }
.nav a {
  position: relative;
  padding: 0.625rem 0;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 800;
  font-variation-settings: "wdth" 80;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav a::after { /* underline draws */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.25rem;
  height: 0.1875rem;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--ease-out);
}
.nav a[aria-current="page"]::after { transform: scaleX(1); }

/* breadcrumb */
.trail {
  max-width: var(--wrap);
  margin: 0 auto 0.75rem;
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center;
  color: var(--ink-soft);
}
.trail a { text-decoration: none; color: var(--ink); }
.trail span[aria-hidden] { color: var(--rule); }

/* ---------- Sheet + grid ---------- */
.page { max-width: var(--wrap); margin: 0 auto; padding-block: 0 3rem; }
.sheet { background: var(--white); padding: var(--gutter); }
.sheet-zoom { view-transition-name: zoom; }
.grid { display: grid; gap: var(--gutter); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; }
.c6 { grid-column: span 6; } .c5 { grid-column: span 5; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; }

/* ---------- Panels ---------- */
.panel {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background: var(--paper) url("/assets/brand/paper-1200.webp") 0 0 / 1200px repeat;
  background-blend-mode: multiply;
  color: var(--ink);
  text-decoration: none;
}
.panel::before { /* the ink frame, above the art */
  content: "";
  position: absolute; inset: 0;
  border: var(--frame) solid var(--ink);
  z-index: 6;
  pointer-events: none;
  transition: border-width 160ms var(--ease-out);
}
.panel.ink { background-color: var(--ink); background-image: radial-gradient(rgba(246, 244, 239, 0.14) 1px, transparent 1.4px); background-size: 7px 7px; color: var(--paper); }
.panel.red { background: var(--red); color: var(--white); }
.panel.red::after, .panel.ink::after { z-index: 7; }
.panel.white { background: var(--white); }
.panel.dots { background: var(--dots-ink), var(--paper); }
.pad { padding: clamp(1.125rem, 2.2vw, 1.75rem); }

.art { position: absolute; inset: 0; z-index: 1; overflow: hidden; }
.art img {
  width: 100%; height: 100%;
  object-fit: contain;
  transition: transform 320ms var(--ease-out);
}
.art.cover img { object-fit: cover; }
.art.multiply img { mix-blend-mode: multiply; }

/* Missing asset: an un-inked pencils panel, labeled */
.pencils {
  position: absolute; inset: 0; z-index: 1;
  background: var(--hatch), var(--paper);
  display: grid; place-items: center;
  transition: transform 320ms var(--ease-out);
}
.ink .pencils { background: repeating-linear-gradient(-45deg, rgba(246, 244, 239, 0.08) 0 1px, transparent 1px 9px), var(--ink); }
.pencils .tag {
  display: inline-flex; align-items: center; gap: 0.5rem;
  max-width: 82%;
  padding: 0.4375rem 0.6875rem;
  background: var(--white);
  border: 1.5px solid var(--ink);
  color: var(--ink);
  text-align: center;
}
.pencils .tag svg { color: var(--ink-soft); font-size: 0.9375rem; }

/* Narration box */
.caption {
  position: absolute; top: 0; left: 0; z-index: 5;
  max-width: 80%;
  padding: 0.5625rem 0.8125rem 0.5rem;
  background: var(--white);
  color: var(--ink);
  border-right: var(--frame) solid var(--ink);
  border-bottom: var(--frame) solid var(--ink);
}
.caption.in-flow { position: static; align-self: flex-start; margin: calc(-1 * clamp(1.125rem, 2.2vw, 1.75rem)) 0 1.125rem calc(-1 * clamp(1.125rem, 2.2vw, 1.75rem)); }

/* Speech bubble (tail is an authored SVG) */
.bubble {
  position: absolute; z-index: 5;
  max-width: min(18.75rem, 70%);
  padding: 0.8125rem 1.125rem;
  background: var(--white);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 1.75rem;
  font-weight: 700;
  font-variation-settings: "wdth" 90;
  font-size: 0.9375rem;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.bubble .tail { position: absolute; left: 2.125rem; bottom: -1.1875rem; width: 1.625rem; height: 1.3125rem; overflow: visible; }

/* Panel foot: title + action */
.foot-label {
  position: relative; z-index: 5;
  margin-top: auto;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 0.375rem 0.875rem; flex-wrap: wrap;
  padding: clamp(0.875rem, 1.8vw, 1.375rem);
}
.foot-label h2, .foot-label h3 { margin: 0; font-size: clamp(1.875rem, 3.4vw, 2.875rem); }
.foot-label .t-label { font-size: 0.8125rem; }
.go { display: inline-flex; align-items: center; gap: 0.4375rem; white-space: nowrap; }
.go .icon { transition: transform 200ms var(--ease-out); }
.on-art { text-shadow: 0 1px 0.875rem rgba(17, 17, 17, 0.35); }

/* Sound effect on hover */
.panel[data-sfx]::after {
  content: attr(data-sfx);
  position: absolute; top: 1rem; right: 1rem; z-index: 7;
  font: italic 900 clamp(1.875rem, 3.2vw, 2.875rem)/1 var(--f-display);
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.02em;
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  opacity: 0;
  transform: scale(0.7) rotate(-12deg);
  transition: opacity 120ms var(--ease-out), transform 200ms var(--ease-out);
  pointer-events: none;
}
.panel.red[data-sfx]::after { color: var(--white); }

@media (hover: hover) and (pointer: fine) {
  .nav a:hover::after { transform: scaleX(1); }
  a.panel:hover::before { border-width: 0.3125rem; }
  a.panel:hover .art img, a.panel:hover .pencils { transform: scale(1.03); }
  a.panel:hover::after { opacity: 1; transform: scale(1) rotate(-8deg); }
  a.panel:hover .go .icon { transform: translateX(0.25rem); }
  .btn:hover { transform: translateY(-2px); box-shadow: 0 0.5rem 1.125rem -0.625rem rgba(17, 17, 17, 0.55); }
  .text-link:hover { background-size: 100% 2px; }
}
a.panel:focus-visible { outline-offset: 0.25rem; }
a.panel:focus-visible::before { border-width: 0.3125rem; }
a.panel:focus-visible::after { opacity: 1; transform: scale(1) rotate(-8deg); }
a.panel:active .art img, a.panel:active .pencils { transform: scale(1.015); transition-duration: 100ms; }

/* ---------- Type panels (no art needed) ---------- */
.type-panel { justify-content: space-between; }
.type-panel .big { margin: 0; font-size: clamp(2.5rem, 4.6vw, 4rem); }
.cast-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.cast-list li { font-size: clamp(1.75rem, 3.1vw, 2.75rem); }
.cast-list li:nth-child(even) { color: var(--red); }

/* ---------- Buttons, links, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.375rem;
  border: 2.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: 800 0.9375rem/1 var(--f-display);
  font-variation-settings: "wdth" 85;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  user-select: none; -webkit-user-select: none;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn.red { background: var(--red); border-color: var(--red); color: var(--white); }
.btn[disabled] { opacity: 0.4; cursor: default; transform: none; box-shadow: none; }
.text-link {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat;
  transition: background-size 220ms var(--ease-out);
  font-weight: 700;
}
.text-link.red { color: var(--red); }
input[type="email"] {
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  border: 2.5px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font: 600 1rem/1 var(--f-display);
  min-width: 0;
}
input::placeholder { color: var(--ink-soft); }

/* ---------- Text panels ---------- */
.prose { max-width: 62ch; }
.prose p { margin: 0 0 0.75rem; }
.prose h2 { margin: 0 0 0.75rem; font-size: clamp(1.875rem, 3.4vw, 2.75rem); }
.prose ul { margin: 0 0 0.875rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.375rem; }
.prose b { font-weight: 800; }
.muted { color: var(--ink-soft); }
.ink .muted { color: #c9c6bf; }
.red .muted { color: #f7dcdc; }
.note-slot {
  margin-top: 0.375rem;
  padding: 1rem;
  background: var(--hatch), var(--paper);
  border: 1.5px dashed var(--ink-soft);
  color: var(--ink-soft);
}

/* Title panel (top of every interior page) */
.title-panel { min-height: clamp(13.75rem, 26vw, 20rem); justify-content: flex-end; }
.title-panel:has(> .caption) { padding-top: calc(clamp(1.125rem, 2.2vw, 1.75rem) + 2.75rem); } /* keep the narration box off the title */
.title-panel h1 { margin: 0; font-size: clamp(3.5rem, 10vw, 8.5rem); text-wrap: balance; }
.title-panel .lede { margin: 0.75rem 0 0; max-width: 54ch; font-size: clamp(1.0625rem, 1.5vw, 1.25rem); }
.title-panel .art { left: auto; width: min(44%, 26.25rem); }
.title-panel .art img { object-position: right bottom; }

/* product */
.price { font-weight: 800; font-variation-settings: "wdth" 80; font-size: clamp(1.875rem, 3vw, 2.5rem); color: var(--red); line-height: 1; }
.product-card .art, .product-card .pencils { position: relative; inset: auto; aspect-ratio: 4 / 5; }
.product-card .art img { position: absolute; inset: 0; padding: 12%; }
.product-card .meta { position: relative; z-index: 5; display: grid; gap: 0.25rem; padding: 0.75rem 0.875rem 0.875rem; background: var(--white); border-top: var(--frame) solid var(--ink); }
.product-card .meta h2 { margin: 0; font-size: 1.125rem; font-weight: 800; font-variation-settings: "wdth" 85; text-transform: uppercase; line-height: 1.15; }
.product-card .meta .price { font-size: 1.25rem; }

.section-head { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; flex-wrap: wrap; margin: 0.875rem 2px 2px; }
.section-head h2 { margin: 0; font-size: clamp(1.875rem, 3.6vw, 3rem); }

/* ---------- Next-issue strip + footer ---------- */
.signup { display: flex; flex-wrap: wrap; gap: 0.625rem; }
.signup input { flex: 1 1 13.75rem; }
.signup-msg { flex-basis: 100%; margin: 0; min-height: 1.4em; font-weight: 700; }
.site-foot { max-width: var(--wrap); margin: 1.875rem auto 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.625rem 1.5rem; color: var(--ink-soft); font-size: 0.9375rem; }
/* back-cover credits box */
.credits { flex-basis: 100%; display: grid; gap: 0.5rem; padding: 1rem 1.125rem; border: 2px solid var(--ink); background: var(--white); color: var(--ink); }
.credits-title { margin: 0; color: var(--red); }
.credits dl { margin: 0; display: flex; flex-wrap: wrap; gap: 0.375rem 2.25rem; }
.credits dl div { display: grid; gap: 0; }
.credits dt { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.credits dd { margin: 0; font-weight: 800; font-variation-settings: "wdth" 80; font-size: 1.25rem; text-transform: uppercase; }
.site-foot .tagline { font: 400 1.375rem/1.2 var(--f-tag); color: var(--ink); transform: rotate(-1.5deg); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0.375rem 1.125rem; }
.site-foot a { text-decoration: none; color: var(--ink); }

/* copy-to-clipboard */
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem 0.875rem; }
.email-link { font: 700 clamp(1.0625rem, 1.8vw, 1.375rem)/1.2 var(--f-display); color: inherit; text-decoration: underline 2px var(--red); text-underline-offset: 0.25em; word-break: break-all; }
@media (hover: hover) and (pointer: fine) { .email-link:hover { text-decoration-thickness: 0.25rem; } }

/* ---------- View transition: a panel zooms into its page ---------- */
@view-transition { navigation: auto; }
::view-transition-group(zoom) { animation-duration: 480ms; animation-timing-function: var(--ease-in-out); }
::view-transition-old(zoom), ::view-transition-new(zoom) { height: 100%; width: 100%; object-fit: cover; }
::view-transition-old(zoom) { animation: 240ms var(--ease-out) both vt-out; }
::view-transition-new(zoom) { animation: 320ms var(--ease-out) 120ms both vt-in; }
::view-transition-old(root) { animation: 200ms var(--ease-out) both vt-out; }
::view-transition-new(root) { animation: 260ms var(--ease-out) 80ms both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .c3, .c4 { grid-column: span 6; }
  .c5, .c7, .c8 { grid-column: span 12; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c12, .c8, .c7, .c6, .c5, .c4, .c3 { grid-column: span 2; }
  .grid > .product-card { grid-column: span 1; }
  .product-card .meta { padding: 0.625rem 0.625rem 0.75rem; }
  .product-card .meta h2 { font-size: 0.9375rem; }
  .nav a { font-size: 0.9375rem; }
  .title-panel .art { width: 46%; opacity: 0.95; }
  .btn { width: 100%; }
  .signup .btn { width: auto; flex: 1 1 100%; }
}

/* big art: fills the panel, the title sits on its own white strip */
.art.clear img { transform: scale(1.06); object-position: 50% 35%; }
.panel:has(.art.clear) .foot-label {
  background: var(--white);
  color: var(--ink);
  border-top: var(--frame) solid var(--ink);
  padding-block: 0.75rem 0.875rem;
}
.panel:has(.art.clear) .foot-label h2, .panel:has(.art.clear) .foot-label h3 { font-size: clamp(1.625rem, 2.6vw, 2.25rem); }
.panel:has(.art.clear) .foot-label.on-art { text-shadow: none; }
@media (hover: hover) and (pointer: fine) { a.panel:hover .art.clear img { transform: scale(1.1); } }

/* gutter between stacked grids on a sheet */
.sheet > .grid + .grid { margin-top: var(--gutter); }

/* Print Club signup options */
.club-opts { flex-basis: 100%; margin: 0.25rem 0 0; padding: 0; border: 0; display: grid; gap: 0.625rem; }
.club-opts label { display: flex; align-items: center; gap: 0.625rem; min-height: 1.75rem; cursor: pointer; font-weight: 600; }
.club-opts input { flex: none; width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--red); }

.ink .signup .btn { background: var(--red); border-color: var(--red); color: var(--white); }
.prose h2 em, .title-panel h1 em { font-style: normal; color: var(--red); }
.red .title-panel h1 em, .title-panel.red h1 em { color: var(--paper); }

/* smaller title on small art cards */
.panel:has(.art.clear) .foot-label h3.t-label { font-size: clamp(0.9375rem, 1.3vw, 1.1875rem); }

/* ---------- Tiles: a real photo cropped into a small framed panel (used on every page) ---------- */
.tile { position: relative; display: block; overflow: hidden; min-height: 0; background: var(--ink); border: 0.1875rem solid var(--paper); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 320ms var(--ease-out); }

/* ---------- Sound effects: a red starburst with an ink offset shadow ---------- */
.burst {
  --size: 7.5rem;
  position: absolute; z-index: 6;
  width: var(--size); aspect-ratio: 1;
  display: grid; place-items: center;
  pointer-events: none;
  animation: burst-in 560ms cubic-bezier(0.34, 1.56, 0.64, 1) 260ms both;
}
.burst svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.burst-face { fill: var(--red); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.burst-shadow { fill: var(--ink); }
.burst-word {
  position: relative;
  font: italic 900 calc(var(--size) * var(--fs)) / 0.9 var(--f-display);
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.02em;
  color: var(--white);
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  white-space: nowrap;
  rotate: -8deg;
}
@keyframes burst-in { 0% { scale: 0; opacity: 0; } 60% { opacity: 1; } 100% { scale: 1; opacity: 1; } }

/* ---------- Every page closes like a comic page ---------- */
.tbc {
  display: table;
  margin: var(--gutter) 0 0 auto;
  padding: 0.5625rem 0.875rem 0.5rem;
  background: var(--white);
  border: var(--frame) solid var(--ink);
  box-shadow: 0.25rem 0.25rem 0 var(--red);
}

/* ================= Touch screens: every standalone link is a finger-sized target (44px) ================= */
@media (pointer: coarse) {
  .site-foot nav a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 0.375rem; }
  .section-head .text-link, .meta > .text-link, .viewer-info .text-link { display: inline-flex; align-items: center; min-height: 44px; }
}
/* smallest phones (320–374px, iPhone SE, many Androids): the five menu links stay on one line */
@media (max-width: 374px) { .top .nav { gap: 2px 0.5rem; } .top .nav a { font-size: 0.8125rem; letter-spacing: 0.03em; } }
@media (pointer: coarse) { .top .nav a { min-height: 44px; display: inline-flex; align-items: center; } }
@media (pointer: coarse) { .email-link { display: inline-flex; align-items: center; min-height: 44px; } }
