:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1d1b18;
  --muted: #6b655c;
  --line: #e7e1d7;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --radius: 14px;
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1d1b18;
    --text: #f2eee8;
    --muted: #a39d93;
    --line: #2e2b26;
    --accent: #fb923c;
    --accent-ink: #1d1b18;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 "Inter", system-ui, sans-serif;
}

a { color: inherit; }

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
}
.logo {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}
.logo span { color: var(--accent); }
.nav nav { display: flex; gap: 22px; }
.nav nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav nav a:hover { color: var(--text); }

/* Layout */
main { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 32px; }
.section-head h2 { font-size: 2.2rem; }
.section-head p { color: var(--muted); margin: 8px 0 0; }

/* Hero */
.hero { padding: 96px 0 88px; }
.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}
.hero h1 { font-size: clamp(3rem, 9vw, 6rem); letter-spacing: -0.02em; }
.lede {
  max-width: 34ch;
  font-size: 1.3rem;
  color: var(--muted);
  margin: 20px 0 32px;
}
.hero-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { font-size: 1.1rem; padding: 16px 28px; }

/* Book */
.book {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 56px;
  align-items: center;
}
.cover {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px 8px 8px 3px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  transform: rotate(-2deg);
  transition: transform 0.3s ease;
}
.cover:hover { transform: rotate(0deg) scale(1.02); }
.status {
  color: var(--muted);
  font-weight: 500;
}
.book-info h2 { font-size: clamp(2.5rem, 6vw, 4rem); }
.book-tagline { font-size: 1.3rem; font-family: "Fraunces", Georgia, serif; margin: 12px 0; }
.book-info p:not(.eyebrow):not(.book-tagline) { color: var(--muted); max-width: 52ch; margin: 0 0 28px; }

/* Project cards */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08); }
.thumb {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: flex-end;
  padding: 14px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb span {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.card-body { padding: 20px 22px 22px; }
.card-body h3 { font-size: 1.35rem; }
.card-body p { color: var(--muted); margin: 8px 0 14px; font-size: 0.97rem; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.tags li {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

/* Image buttons that open the viewer */
.shot {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: zoom-in;
  overflow: hidden;
}
.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.shot:hover img { transform: scale(1.04); }
.shot img.top { object-position: top; }
.shot:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.thumb.shot { padding: 0; }
.badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font: 600 0.75rem/1 "Inter", sans-serif;
  padding: 6px 10px;
  border-radius: 999px;
}
.kicker {
  color: var(--accent) !important;
  font-size: 0.75rem !important;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 4px !important;
}

/* Featured project */
.feature {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
}
.feature .shot { min-height: 100%; aspect-ratio: 16 / 10; }
.feature-body { padding: 32px; }
.feature-body h3 { font-size: 2rem; margin-bottom: 10px; }
.feature-body > p:not(.eyebrow) { color: var(--muted); margin: 0 0 16px; }
.status.live { color: #22c55e; }
.highlights { margin: 0 0 24px; padding-left: 1.1em; color: var(--muted); font-size: 0.95rem; }
.highlights li { margin-bottom: 4px; }
.highlights li::marker { color: var(--accent); }

/* Book release signup */
.signup { max-width: 460px; }
.signup-label { display: block; font-weight: 600; margin-bottom: 10px; }
.signup-row { display: flex; gap: 10px; flex-wrap: wrap; }
.signup-row[hidden] { display: none; }
.signup input[type="email"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.signup input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.signup button { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.signup button:disabled { opacity: 0.6; cursor: wait; }
.signup-note { color: var(--muted) !important; font-size: 0.85rem; margin: 10px 0 0 !important; }
.signup-note.ok { color: #22c55e !important; font-size: 1rem; font-weight: 600; }
.signup-note.error { color: #ef4444 !important; }
.signup-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Upcoming project: Unfold Saga pop-up book */
.subhead {
  font-size: 1.5rem;
  margin: 56px 0 18px;
}
.upcoming { grid-template-columns: 1fr 1fr; }
.domain { color: var(--muted); font-size: 0.9rem; letter-spacing: 0.02em; margin: 0; }

.popup {
  --rx: 0deg;
  --ry: 0deg;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 24px;
  background: radial-gradient(ellipse at 50% 40%, #4a3524, #241a12 75%);
  perspective: 900px;
}
.storybook {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 440px;
  transform-style: preserve-3d;
  transform: rotateX(calc(18deg + var(--rx))) rotateY(var(--ry));
  transition: transform 0.25s ease-out;
}
.page {
  position: relative;
  width: 100%;
  align-self: start;
  aspect-ratio: 200 / 260;
  background: #efe3c8;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.45);
  transform-style: preserve-3d;
}
.page-left { border-radius: 6px 0 0 6px; background: linear-gradient(90deg, #efe3c8 85%, #d8c7a5); }
.page-right {
  border-radius: 0 6px 6px 0;
  background: linear-gradient(90deg, #d8c7a5, #efe3c8 15%);
  padding: 9% 9% 0;
}
.layer {
  position: absolute;
  inset: 6%;
  transform-origin: 50% 100%;
  transform: translateZ(var(--z)) rotateX(-90deg);
  opacity: 0;
  transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.25), opacity 0.3s ease;
  transition-delay: var(--d);
  filter: drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.45));
}
.layer svg { display: block; width: 100%; height: 100%; }
.l-back  { --z: 2px;  --d: 0s; }
.l-mid   { --z: 14px; --d: 0.15s; }
.l-char  { --z: 26px; --d: 0.3s; }
.l-front { --z: 38px; --d: 0.45s; }
.l-fx    { --z: 46px; --d: 0.6s; filter: drop-shadow(0 0 3px #ffb347); }
.popup.open .layer { transform: translateZ(var(--z)) rotateX(0deg); opacity: 1; }

.ink {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  color: #3a2c1e;
  font-size: clamp(0.62rem, 1.6vw, 0.82rem);
  line-height: 1.45;
  margin: 0 0 0.7em;
  opacity: 0;
  transition: opacity 0.8s ease 0.9s;
}
.ink + .ink { transition-delay: 1.4s; }
.popup.open .ink { opacity: 1; }
.pulltab {
  position: absolute;
  right: -12px;
  bottom: 16%;
  background: #b4532a;
  color: #fbeedd;
  font: 600 clamp(0.55rem, 1.3vw, 0.7rem)/1 "Inter", sans-serif;
  padding: 6px 12px 6px 9px;
  border-radius: 3px 8px 8px 3px;
  box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.35);
  transform: translateZ(4px);
}

@media (prefers-reduced-motion: reduce) {
  .layer, .ink, .storybook { transition: none; }
}

/* Lightbox */
.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.88); }
.lightbox figure { margin: 0; max-width: min(1200px, 88vw); text-align: center; }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 6px; }
.lightbox figcaption { margin-top: 12px; font-size: 0.9rem; color: #d4d4d4; }
.lightbox button {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox button:hover { background: rgba(255, 255, 255, 0.25); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox button[hidden] { display: none; }

/* Now */
.now-list { margin: 0; padding-left: 1.2em; font-size: 1.15rem; }
.now-list li { margin-bottom: 8px; }
.now-list li::marker { color: var(--accent); }
time { font-style: italic; }

/* Contact */
.contact { text-align: center; padding-bottom: 96px; }
.contact h2 { font-size: clamp(2.2rem, 6vw, 3.5rem); }
.contact p { color: var(--muted); margin: 12px 0 28px; }

/* Footer */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 28px 24px 40px;
  border-top: 1px solid var(--line);
}

@media (max-width: 600px) {
  .nav { padding: 14px 16px; }
  .nav nav { gap: 12px; }
  .nav nav a { font-size: 0.85rem; }
  .logo { font-size: 1.1rem; }
  main { padding: 0 16px; }
  .hero { padding: 64px 0; }
  .section { padding: 56px 0; }
  .book { grid-template-columns: 1fr; gap: 36px; }
  .cover { width: 60%; margin: 0 auto; }
}

@media (max-width: 860px) {
  .feature, .upcoming { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .feature-body { padding: 24px 22px; }
}

@media (max-width: 400px) {
  .nav nav a[href="#now"] { display: none; }
}
