/* ─── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:   #f5f2ed;
  --paper:   #ede9e2;
  --ink:     #1a1916;
  --ink-mid: #4a4843;
  --ink-dim: #8c8880;
  --accent:  #b5956b;
  --rule:    #d8d3ca;
  --serif:   'EB Garamond', Georgia, serif;
  --sans:    'Inter', system-ui, sans-serif;
  --page-w:  1100px;
  --page-h:  100svh;
  --thumb-h: 44px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #2a2825;
  -webkit-font-smoothing: antialiased;
}

/* ─── FLIPBOOK SHELL ─────────────────────────────────────────────────────────── */
#flipbook {
  position: fixed;
  inset: 0;
  bottom: var(--thumb-h);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ─── PAGES TRACK ────────────────────────────────────────────────────────────── */
#pages-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.77, 0, 0.18, 1);
  will-change: transform;
}

/* ─── INDIVIDUAL PAGE ────────────────────────────────────────────────────────── */
.page {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  background: var(--cream);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.page::-webkit-scrollbar { width: 4px; }
.page::-webkit-scrollbar-thumb { background: var(--rule); }

/* ─── PAGE COUNTER ───────────────────────────────────────────────────────────── */
#page-counter {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  background: rgba(245, 242, 237, 0.85);
  backdrop-filter: blur(8px);
  padding: 0.35rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--rule);
}

.counter-sep { opacity: 0.4; }

/* ─── NAV ARROWS ─────────────────────────────────────────────────────────────── */
.nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(245, 242, 237, 0.9);
  border: 1px solid var(--rule);
  color: var(--ink-mid);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}

.nav-arrow:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.nav-arrow:disabled { opacity: 0.25; pointer-events: none; }

#prev-btn { left: 1.25rem; }
#next-btn { right: 1.25rem; }

/* ─── THUMBNAIL STRIP ────────────────────────────────────────────────────────── */
#thumb-strip {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--thumb-h);
  background: #1e1c1a;
  border-top: 1px solid #333;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  z-index: 50;
}

#thumb-strip::-webkit-scrollbar { display: none; }

#thumb-track {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 2px;
  padding: 0 1rem;
  min-width: max-content;
}

.thumb {
  background: none;
  border: none;
  color: #666;
  font-family: var(--sans);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 3px;
  transition: all 0.15s ease;
  height: 28px;
}

.thumb:hover { color: #ccc; background: #2a2825; }
.thumb.active { color: var(--accent); background: #2a2825; }

/* ═══════════════════════════════════════════════════════════════════════════════
   PAGE LAYOUTS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Shared padding for page content */
.cover-layout,
.about-layout,
.toc-layout,
.project-intro-layout,
.project-spread-layout,
.journal-layout,
.ack-layout,
.back-cover-layout {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ─── COVER ──────────────────────────────────────────────────────────────────── */
.cover-layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 3.5rem 4rem;
  background: var(--cream);
}

.cover-top {
  display: flex;
  justify-content: space-between;
}

.cover-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.cover-name {
  display: flex;
  align-items: center;
  padding: 2rem 0;
}

.cover-name h1 {
  font-family: var(--serif);
  font-size: clamp(5rem, 12vw, 10rem);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cover-bottom p {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
}

/* ─── ABOUT ──────────────────────────────────────────────────────────────────── */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 0;
}

.about-left {
  padding: 3.5rem 3rem 3.5rem 4rem;
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  scrollbar-width: thin;
}

.about-right {
  padding: 3.5rem 4rem 3.5rem 3rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.about-section { margin-bottom: 2.5rem; }
.about-section:last-child { margin-bottom: 0; }

.sidebar-heading {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.precis {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.78;
  color: var(--ink);
}

.cv-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cv-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.cv-place {
  font-family: var(--sans);
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  min-width: 2.25rem;
  padding-top: 0.15rem;
}

.cv-list li div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cv-list li strong {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--ink);
}

.cv-list li span {
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.skills-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.skills-group {
  font-size: 0.75rem;
  color: var(--ink-mid);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

/* ─── TABLE OF CONTENTS ──────────────────────────────────────────────────────── */
.toc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 0.6fr;
  gap: 0;
}

.toc-col {
  padding: 3.5rem 3rem;
  border-right: 1px solid var(--rule);
}

.toc-col:first-child { padding-left: 4rem; }

.toc-label-col {
  padding: 3.5rem 3rem 3.5rem 2rem;
  display: flex;
  align-items: flex-end;
}

.toc-category {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1.5rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.toc-list li {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--rule);
}

.toc-num {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.08em;
  min-width: 1.5rem;
  padding-top: 0.1rem;
}

.toc-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.toc-item strong {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--ink);
}

.toc-item span {
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.toc-big-label {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--ink);
}

/* ─── PROJECT INTRO (image + text) ──────────────────────────────────────────── */
.project-intro-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.project-intro-layout--flip {
  direction: rtl;
}

.project-intro-layout--flip > * {
  direction: ltr;
}

.project-intro-image {
  overflow: hidden;
  background: var(--paper);
  min-height: 100%;
}

.project-intro-text {
  padding: 3.5rem 3.5rem 3.5rem 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.proj-tag-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.proj-num {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.12em;
}

.proj-cat {
  font-family: var(--sans);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.proj-title {
  font-family: var(--serif);
  font-size: clamp(2.25rem, 4.5vw, 3.75rem);
  font-weight: 400;
  line-height: 1.0;
  color: var(--ink);
  margin-bottom: 1.25rem;
}

.proj-meta-block {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.proj-meta-block p {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--ink-dim);
  line-height: 1.6;
}

.proj-body {
  font-family: var(--serif);
  font-size: 0.9375rem;
  line-height: 1.78;
  color: var(--ink-mid);
  margin-bottom: 1rem;
}

.proj-body:last-child { margin-bottom: 0; }

.proj-body--nda {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--ink-dim);
  margin-top: 0.5rem;
}

.proj-body--credit {
  font-size: 0.75rem;
  color: var(--ink-dim);
  margin-top: 0.5rem;
}

/* ─── PROJECT SPREAD ─────────────────────────────────────────────────────────── */
.project-spread-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
}

.spread-image {
  background: var(--paper);
  overflow: hidden;
}

.spread-image--tall { height: 100%; }

.spread-text {
  padding: 3.5rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.spread-heading {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

/* ─── PLACEHOLDERS ───────────────────────────────────────────────────────────── */
.ph {
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: repeating-linear-gradient(
    -45deg,
    transparent, transparent 10px,
    rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.02) 11px
  );
}

.ph--nda { background-color: #e8e4dd; }
.ph--tall { min-height: 400px; }

.ph-n {
  font-family: var(--serif);
  font-size: 4rem;
  font-weight: 400;
  color: rgba(26,25,22,0.1);
  line-height: 1;
}

.ph-t {
  font-family: var(--sans);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(26,25,22,0.25);
  text-align: center;
  padding: 0 1.5rem;
  max-width: 260px;
}

/* Real images */
.ph img { width:100%; height:100%; object-fit:cover; display:block; }

/* ─── JOURNAL ────────────────────────────────────────────────────────────────── */
.journal-layout {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 3rem 4rem 2rem;
}

.journal-header {
  margin-bottom: 1.75rem;
}

.journal-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-dim);
  margin-top: 0.5rem;
}

.journal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  flex: 1;
}

.journal-item { overflow: hidden; }
.journal-item--wide { grid-column: span 2; }
.journal-item .ph { min-height: 0; height: 100%; }

/* ─── ACKNOWLEDGMENTS ────────────────────────────────────────────────────────── */
.ack-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0;
}

.ack-left {
  padding: 3.5rem 3rem 3.5rem 4rem;
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  scrollbar-width: thin;
}

.ack-right {
  padding: 3.5rem 4rem 3.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.ack-heading {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.ack-body {
  font-size: 0.875rem;
  color: var(--ink-mid);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.ack-section {
  margin-bottom: 1.75rem;
}

.ack-section h4 {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.ack-section ul { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }

.ack-section li {
  font-size: 0.8125rem;
  color: var(--ink-mid);
  line-height: 1.5;
}

.ack-section li strong { color: var(--ink); font-weight: 400; }

.ack-contact h3 {
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 1rem;
}

.ack-contact {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ack-contact a {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration: none;
}

.ack-contact a:hover { text-decoration: underline; }

.ack-extracurricular h4 {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.ack-extracurricular ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.ack-extracurricular li { font-size: 0.8125rem; color: var(--ink-mid); display: flex; gap: 0.75rem; }

.cv-place-sm {
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ─── BACK COVER ─────────────────────────────────────────────────────────────── */
.back-cover-layout {
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 3.5rem 4rem;
  background: var(--ink);
  color: var(--cream);
}

.back-cover-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
}

.back-name {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  color: var(--cream);
}

.back-tagline {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  color: rgba(245,242,237,0.5);
}

.back-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.75rem;
}

.back-links a {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}

.back-cover-footer p {
  font-family: var(--sans);
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(245,242,237,0.3);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --thumb-h: 40px; }

  .cover-name h1 { font-size: clamp(3rem, 14vw, 6rem); }
  .cover-layout { padding: 2rem 1.5rem; }

  .about-layout,
  .toc-layout,
  .project-intro-layout,
  .project-spread-layout,
  .ack-layout {
    grid-template-columns: 1fr;
  }

  .project-intro-layout--flip { direction: ltr; }

  .project-intro-image { min-height: 260px; }

  .about-left { border-right: none; border-bottom: 1px solid var(--rule); }
  .about-left, .about-right,
  .toc-col, .ack-left, .ack-right,
  .project-intro-text, .spread-text { padding: 2rem 1.5rem; }

  .toc-label-col { display: none; }

  .journal-layout { padding: 2rem 1.5rem 1.5rem; }
  .journal-grid { grid-template-columns: 1fr 1fr; }
  .journal-item--wide { grid-column: span 2; }

  #prev-btn { left: 0.5rem; }
  #next-btn { right: 0.5rem; }

  .back-cover-layout { padding: 2rem 1.5rem; }
}
