:root {
  --paper: #F6F3EE;
  --ink: #171717;
  --muted: #6B6B6B;
  --hairline: rgba(0,0,0,.08);
  --accent: #E9D9B8;

  --max: 1120px;
  --pad: 64px;
  --pad-m: 24px;

  --serif: "Cormorant Garamond", ui-serif, Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}

/* Subtle paper grain texture */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: .10;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  z-index: 1000;
}

/* ============================================
   TOP BAR
   ============================================ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad);
  gap: 16px;
  background: linear-gradient(to bottom, rgba(246,243,238,.92), rgba(246,243,238,.72), rgba(246,243,238,0));
}

.brand {
  text-decoration: none;
  color: var(--ink);
  letter-spacing: .18em;
  font-size: 12px;
  font-weight: 500;
}

.topbar-social {
  color: var(--muted);
  transition: color .2s ease;
}

.topbar-social:hover {
  color: var(--ink);
}

/* ============================================
   VIEWS
   ============================================ */
#app { min-height: 100vh; }
.view { display: none; min-height: 100vh; }
.view.is-active { display: block; }

/* ============================================
   LANDING PAGE
   ============================================ */
.view-landing {
  min-height: 100vh;
}

.landing-wrap {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: 100px var(--pad) 80px var(--pad);
  z-index: 1;
}

/* Oversized right-side hero background */
.hero-bg {
  position: fixed;
  top: -1vh;
  right: -5vw;
  width: min(900px, 80vw);
  height: min(1100px, 120vh);
  background: url("assets/hero.webp") no-repeat right top / contain;
  opacity: 0.92;
  filter: grayscale(1) contrast(1.2);
  pointer-events: none;
  z-index: 0;
}

.landing-header {
  margin-bottom: 48px;
}

.landing-h1 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0;
  font-size: clamp(44px, 6vw, 84px);
  line-height: .95;
  letter-spacing: .04em;
}

.landing-sub {
  margin: 14px 0 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.landing-section {
  margin-bottom: 48px;
}

.section-label {
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--muted);
  margin-bottom: 16px;
  text-transform: uppercase;
}

/* Album grid */
.album-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.album-card {
  display: block;
  text-decoration: none;
  color: inherit;
  width: 220px;
  transition: transform .15s ease;
}

.album-card:hover {
  transform: translateY(-2px);
}

.album-card img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--hairline);
}

.album-info {
  padding: 12px 2px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.album-label {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.album-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}

.album-pages {
  font-size: 12px;
  color: var(--muted);
}

/* Concept art grid (thumbnails) */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.concept-thumb {
  display: block;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

.concept-thumb:hover {
  transform: scale(1.02);
}

.concept-thumb img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--hairline);
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================
   READER DIALOG
   ============================================ */
.reader-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.reader-dialog:not([open]) {
  display: none;
}

.reader-dialog[open] {
  display: block;
}

.reader-dialog::backdrop {
  background: transparent;
}

/* Cover mode (Page 00) */
.reader-cover {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.reader-cover.is-active {
  display: block;
}

.cover-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,.7) 0%,
    rgba(0,0,0,.4) 40%,
    rgba(0,0,0,.2) 100%
  );
}

.cover-content {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  text-align: center;
  max-width: 720px;
  width: 90%;
  color: rgba(255,255,255,.95);
}

.cover-label {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
  margin-bottom: 12px;
}

.cover-title {
  font-family: var(--serif);
  font-size: clamp(42px, 5.4vw, 72px);
  font-weight: 500;
  letter-spacing: .06em;
  line-height: 1.05;
  margin: 0 0 18px 0;
}

.cover-subtitle {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: rgba(255,255,255,.6);
  margin: 0 0 40px 0;
}

.cover-subtitle:empty {
  display: none;
}

.cover-cta {
  display: inline-block;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .24em;
  text-transform: uppercase;
  padding: 14px 26px;
  border: 1px solid rgba(255,255,255,.4);
  background: transparent;
  color: rgba(255,255,255,.95);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.cover-cta:hover {
  background: rgba(255,255,255,.95);
  color: var(--ink);
  border-color: transparent;
}

.cover-back {
  display: block;
  margin: 24px auto 0;
  font-family: var(--sans);
  font-size: 13px;
  color: rgba(255,255,255,.5);
  background: none;
  border: none;
  cursor: pointer;
  transition: color .2s ease;
}

.cover-back:hover {
  color: rgba(255,255,255,.8);
}

/* Reading mode (Page 01+) */
.reader-content {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,.96);
  flex-direction: column;
}

.reader-content.is-active {
  display: flex;
}

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(0,0,0,.4);
  color: rgba(255,255,255,.9);
  flex-shrink: 0;
}

.reader-counter {
  font-size: 14px;
  color: rgba(255,255,255,.6);
  letter-spacing: .06em;
}

.reader-close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.7);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease;
}

.reader-close:hover {
  color: #fff;
}

.reader-zoom {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.7);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease;
}

.reader-zoom:hover {
  color: #fff;
}

.reader-zoom.is-zoomed {
  color: rgba(255,255,255,.95);
}

.reader-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.reader-viewport.is-zoomed {
  overflow: auto;
  align-items: flex-start;
  justify-content: flex-start;
  cursor: grab;
}

.reader-viewport.is-zoomed:active {
  cursor: grabbing;
}

.reader-page {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transition: opacity .15s ease;
}

.reader-page.is-loaded {
  opacity: 1;
}

.reader-viewport.is-zoomed .reader-page {
  max-width: none;
  max-height: none;
  object-fit: none;
  cursor: grab;
}

.reader-viewport.is-zoomed:active .reader-page {
  cursor: grabbing;
}

.reader-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 80px;
  border: none;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  font-size: 36px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
  z-index: 10;
}

.reader-nav:hover:not(:disabled) {
  background: rgba(255,255,255,.15);
  color: #fff;
}

.reader-nav:disabled {
  opacity: .25;
  cursor: default;
}

.reader-nav--prev {
  left: 20px;
  border-radius: 4px;
}

.reader-nav--next {
  right: 20px;
  border-radius: 4px;
}

/* ============================================
   CONCEPT ART MODAL
   ============================================ */
.concept-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(10,10,10,.96);
}

.concept-dialog:not([open]) {
  display: none;
}

.concept-dialog[open] {
  display: flex;
  flex-direction: column;
}

.concept-dialog::backdrop {
  background: transparent;
}

.concept-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(0,0,0,.4);
  color: rgba(255,255,255,.9);
  flex-shrink: 0;
}

.concept-counter {
  font-size: 14px;
  color: rgba(255,255,255,.6);
  letter-spacing: .06em;
}

.concept-close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.7);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease;
}

.concept-close:hover {
  color: #fff;
}

.concept-zoom {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.7);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease;
}

.concept-zoom:hover {
  color: #fff;
}

.concept-zoom.is-zoomed {
  color: rgba(255,255,255,.95);
}

.concept-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.concept-viewport.is-zoomed {
  overflow: auto;
  align-items: flex-start;
  justify-content: flex-start;
  cursor: grab;
}

.concept-viewport.is-zoomed:active {
  cursor: grabbing;
}

.concept-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transition: opacity .15s ease;
}

.concept-img.is-loaded {
  opacity: 1;
}

.concept-viewport.is-zoomed .concept-img {
  max-width: none;
  max-height: none;
  object-fit: none;
  cursor: grab;
}

.concept-viewport.is-zoomed:active .concept-img {
  cursor: grabbing;
}

.concept-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 80px;
  border: none;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  font-size: 36px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
  z-index: 10;
}

.concept-nav:hover:not(:disabled) {
  background: rgba(255,255,255,.15);
  color: #fff;
}

.concept-nav:disabled {
  opacity: .25;
  cursor: default;
}

.concept-nav--prev {
  left: 20px;
  border-radius: 4px;
}

.concept-nav--next {
  right: 20px;
  border-radius: 4px;
}

.concept-caption {
  padding: 16px 24px;
  text-align: center;
  flex-shrink: 0;
}

.concept-caption:empty,
.concept-caption:has(.concept-title:empty):has(.concept-note:empty) {
  display: none;
}

.concept-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: rgba(255,255,255,.9);
}

.concept-title:empty {
  display: none;
}

.concept-note {
  margin: 6px 0 0 0;
  font-size: 14px;
  color: rgba(255,255,255,.5);
}

.concept-note:empty {
  display: none;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1023px) {
  :root { --pad: 32px; }

  .reader-nav,
  .concept-nav { width: 50px; height: 70px; font-size: 30px; }
  .reader-nav--prev,
  .concept-nav--prev { left: 10px; }
  .reader-nav--next,
  .concept-nav--next { right: 10px; }
}

@media (max-width: 767px) {
  :root { --pad: var(--pad-m); }

  .topbar { padding: 18px var(--pad); }

  .landing-wrap { padding-top: 80px; }

  .album-grid {
    flex-direction: column;
    gap: 20px;
  }

  .album-card {
    width: 100%;
    max-width: 280px;
  }

  .concept-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .hero-bg {
    right: -50vw;
    opacity: 0.08;
  }

  .reader-header,
  .concept-header { padding: 12px 16px; }
  .reader-counter,
  .concept-counter { font-size: 12px; }
  .reader-close,
  .concept-close { width: 40px; height: 40px; font-size: 28px; }
  .reader-zoom,
  .concept-zoom { width: 40px; height: 40px; font-size: 18px; }
  .reader-viewport,
  .concept-viewport { padding: 10px; }
  .reader-nav,
  .concept-nav { width: 44px; height: 60px; font-size: 26px; }
  .reader-nav--prev,
  .concept-nav--prev { left: 6px; }
  .reader-nav--next,
  .concept-nav--next { right: 6px; }

  .cover-content {
    top: 65%;
  }

  .cover-cta {
    padding: 12px 20px;
    font-size: 11px;
  }
}
