/* Hitchhiker: shared styles for the landing page and reader.
   No external fonts or resources, so the Content Security Policy can stay strict. */

:root {
  --bg: #0b0a0f;
  --bg-raised: #15131b;
  --ink: #efe9e1;
  --ink-soft: #b9b1a7;
  --ink-faint: #7d766e;
  --accent: #e8a24a;          /* sunset amber from the key art */
  --accent-ink: #1a1208;
  --line: rgba(239, 233, 225, 0.14);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --gutter: 16px;
  --radius: 999px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
  z-index: 10;
}
.skip-link:focus { top: var(--gutter); }

/* ---------- Buttons ---------- */

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 1rem/1 var(--sans);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.button:hover { background: #f3b866; }

.button--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.button--ghost:hover { background: rgba(239, 233, 225, 0.08); }

[hidden] { display: none !important; }

/* ---------- Landing: mobile first ---------- */

.hero {
  display: grid;
  grid-template-areas:
    "art"
    "copy";
}

.hero-art {
  grid-area: art;
  margin: 0;
  position: relative;
}
.hero-art img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}
/* Fade the bottom of the art into the page so the copy flows out of it. */
.hero-art::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 22%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

/* A soft dark fade at the top of the art keeps the title readable on phones. */
.hero-art::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 26%;
  background: linear-gradient(to bottom, rgba(11, 10, 15, 0.85), rgba(11, 10, 15, 0.45) 55%, transparent);
  pointer-events: none;
}

/* On phones the title sits in the quiet headliner area at the top of the art. */
.hero-title {
  grid-area: art;
  align-self: start;
  position: relative;
  z-index: 1;
  padding: calc(env(safe-area-inset-top, 0px) + 28px) var(--gutter) 0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 11.5vw, 4.5rem);
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.credit {
  margin: 10px 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.credit span { color: var(--ink); }

.hero-copy {
  grid-area: copy;
  padding: 8px var(--gutter) 56px;
  max-width: 34rem;
}

.logline {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.4;
}

.question {
  margin: 20px 0 0;
  color: var(--ink-soft);
}

.meta {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.series-note {
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.7;
}
.series-note strong,
.series-available { color: var(--ink); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 24px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 24px);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Landing: desktop two-column ---------- */

@media (min-width: 900px) {
  .hero {
    min-height: calc(100vh - 4rem);
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "art title"
      "art copy";
    grid-template-rows: auto 1fr;
    column-gap: clamp(32px, 6vw, 96px);
    padding: 2rem clamp(24px, 5vw, 72px);
    align-items: start;
  }
  .hero-art img {
    width: auto;
    height: calc(100vh - 4rem);
    max-height: 1100px;
  }
  .hero-art::after,
  .hero-art::before { display: none; }
  .credit { font-size: 0.78rem; letter-spacing: 0.14em; }
  .hero-title {
    grid-area: title;
    align-self: end;
    padding: 12vh 0 0;
    text-shadow: none;
  }
  .hero-copy {
    padding: 32px 0 0;
  }
  .logline { font-size: 1.6rem; }
  .site-footer { padding-inline: clamp(24px, 5vw, 72px); }
}

/* ---------- Reader ---------- */

body.reader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.reader-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) var(--gutter) 10px;
  font-size: 0.9rem;
}
.reader-home { text-decoration: none; color: var(--ink-soft); }
.reader-home:hover { color: var(--ink); }
.reader-count { margin: 0; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.reader-progress {
  height: 3px;
  background: var(--line);
}
.reader-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}

.reader-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 12px 0;
  touch-action: pan-y;
}

.reader-page {
  width: 100%;
  max-width: calc((100vh - 140px) * 0.5625);
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: var(--bg-raised);
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.reader-status,
.reader-noscript {
  margin: 0;
  padding: 24px var(--gutter);
  text-align: center;
  color: var(--ink-soft);
}
.reader-status button {
  margin-left: 6px;
  background: none;
  border: 0;
  color: var(--accent);
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
}

.reader-end {
  max-width: 28rem;
  padding: 48px var(--gutter);
  text-align: center;
}
.reader-end h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2rem;
}
.reader-end p { color: var(--ink-soft); }
.reader-end .cta { justify-content: center; }
.reader-more {
  display: inline-block;
  margin-top: 24px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 14px);
}
.reader-nav button {
  flex: 1;
  max-width: 200px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 500 1rem/1 var(--sans);
  cursor: pointer;
}
.reader-nav button:hover:not(:disabled) { background: rgba(239, 233, 225, 0.08); }
.reader-nav button:disabled { opacity: 0.35; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Continuous comic: preserve image proportions with a pause between pages. */
.reader-stage {
  display: block;
  padding: 0;
  touch-action: pan-y;
}
.comic-pages {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 800px;
  margin-inline: auto;
}
.comic-page,
.comic-spacer {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}
.reader-end { margin-inline: auto; }

@media (min-width: 900px) {
  .comic-pages { gap: 32px; }
}
