*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@font-face {
  font-family: 'Spectral';
  src: url('/assets/fonts/spectral-latin-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Spectral';
  src: url('/assets/fonts/spectral-latin-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Spectral';
  src: url('/assets/fonts/spectral-latin-400italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Spectral';
  src: url('/assets/fonts/spectral-latin-600italic.woff2') format('woff2');
  font-weight: 600; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Syne';
  src: url('/assets/fonts/syne-latin-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Syne';
  src: url('/assets/fonts/syne-latin-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Syne';
  src: url('/assets/fonts/syne-latin-800.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}

:root {
  --bg: #f5f0e8;
  --dark: #0e0d0c;
  --text: #1a1815;
  --muted: #625b53;
  --turquoise: #1fa898;
  --focus: #0b766b;
  --faint: #ddd8ce;
  /* Quadrant colors */
  --q-north: #1a1816;
  --q-east: #6b1515;
  --q-south: #7a5a0a;
  --q-west: #ddd8ce;
}

html, body {
  height: 100%;
  font-family: 'Spectral', Georgia, serif;
  background: var(--bg);
  color: var(--text);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.back {
  position: fixed;
  top: 32px;
  left: 40px;
  font-family: 'Syne', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  z-index: 300;
  transition: color 0.2s;
  animation: fadeIn 1s ease both 0.3s;
}
.back:hover { color: var(--text); }

.skip-link {
  position: absolute; top: -48px; left: 0;
  background: var(--turquoise); color: #1a1815;
  padding: 8px 16px; font-family: 'Spectral', sans-serif;
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
  z-index: 9999; border-radius: 0 0 4px 0; transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ─── PAGE LAYOUT ─── */
.page {
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px 60px;
  animation: fadeIn 1s ease both;
}

/* Project introduction */
.book-intro {
  width: 100%;
  max-width: 700px;
  margin-bottom: 48px;
  text-align: center;
}

.project-status {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.book-intro h1 {
  font-size: clamp(1.85rem, 4.2vw, 2.8rem);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

.book-summary {
  font-size: 1rem;
  line-height: 1.75;
  max-width: 60ch;
  margin: 24px auto 16px;
}

.wheel-overview {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 52ch;
  margin: 0 auto;
}

/* ─── HEADER TEXT ─── */
.wheel-header {
  font-family: 'Spectral', serif;
  font-style: italic;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.01em;
  min-height: 2.8em;
  position: relative;
}
.wheel-header .cardinal-text,
.wheel-header .diagonal-text {
  transition: opacity 0.4s ease;
}
.wheel-header .cardinal-text,
.wheel-header .diagonal-text {
  display: block;
  width: 100%;
  text-align: center;
}
.wheel-header .cardinal-text {
  opacity: 1;
  filter: blur(0px);
  transition: opacity 0.5s ease 1.3s, filter 0.5s ease 1.3s;
}
.wheel-header .diagonal-text {
  opacity: 0;
  filter: blur(8px);
  position: absolute;
  left: 0; right: 0;
  top: 0;
  transition: opacity 0.3s ease, filter 0.3s ease;
}
.wheel-container.rotated .wheel-header .cardinal-text {
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.3s ease, filter 0.3s ease;
}
.wheel-container.rotated .wheel-header .diagonal-text {
  opacity: 1;
  filter: blur(0px);
  position: absolute;
  transition: opacity 0.5s ease 1.3s, filter 0.5s ease 1.3s;
}

/* ─── THE WHEEL ─── */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.wheel-outer {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  position: relative;
  width: min(460px, 78vw);
  height: min(460px, 78vw);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.wheel {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}

.wheel-container.rotated .wheel {
  transform: rotate(45deg);
}

/* Cross dividers */
.wheel::before {
  content: '';
  position: absolute;
  width: 3px;
  height: 100%;
  background: var(--bg);
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  z-index: 2;
}
.wheel::after {
  content: '';
  position: absolute;
  height: 3px;
  width: 100%;
  background: var(--bg);
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 2;
}

.wheel-center {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

/* Quadrants — positioned as N(top-left+top-right), E(top-right+bottom-right), etc.
   Using CSS grid approach: NW=North+West overlap, NE=North+East, etc.
   For the cardinal wheel:
   - top-left = North (black)
   - top-right = East (red)
   - bottom-left = West (white/cream)
   - bottom-right = South (yellow/gold)
*/
.quadrant {
  position: absolute;
  width: 50%;
  height: 50%;
}

.q-north { top: 0; left: 0;     background: var(--q-north); }
.q-east  { top: 0; right: 0;    background: var(--q-east); }
.q-south { bottom: 0; right: 0; background: var(--q-south); }
.q-west  { bottom: 0; left: 0;  background: var(--q-west); }

/*
  Text is positioned OUTSIDE the rotating wheel, overlaid on top.
  This avoids all rotation/counter-rotation issues.
  The .quote-overlay sits on top of .wheel and doesn't rotate.
*/
.quote-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

/* Both overlays use the same positioning method: absolute + translate(-50%,-50%) at wedge centroids */
.quote-overlay .quote-text {
  display: block;
  position: absolute;
  font-size: clamp(0.74rem, 1.45vw, 0.82rem);
  font-style: italic;
  line-height: 1.5;
  text-align: center;
  padding: 0 4px;
  transform: translate(-50%, -50%);
}

/* Cardinal text — pulled inward toward wheel center */
.qtext-north { top: 30%; left: 30%; width: 34%; color: #e8e2d8; }
.qtext-east  { top: 30%; left: 70%; width: 34%; color: #e8e2d8; }
.qtext-south { top: 70%; left: 70%; width: 34%; color: #e8e2d8; }
.qtext-west  { top: 70%; left: 30%; width: 34%; color: #1a1815; }

/* Diagonal text — corrected: shifted counter-clockwise to true diamond centers */
.qtext-ne { top: 22%; left: 50%; width: 30%; color: #e8e2d8; }
.qtext-se { top: 50%; left: 78%; width: 30%; color: #e8e2d8; }
.qtext-sw { top: 78%; left: 50%; width: 30%; color: #e8e2d8; }
.qtext-nw { top: 50%; left: 22%; width: 30%; color: #1a1815; }

/* Dissolve sequencing — bidirectional:
   Forward:  cardinal out fast (0.3s) → wheel turns → diagonal in delayed (1.3s)
   Reverse:  diagonal out fast (0.3s) → wheel turns → cardinal in delayed (1.3s) */
.overlay-cardinal .quote-text {
  opacity: 1; filter: blur(0px);
  transition: opacity 0.5s ease 1.3s, filter 0.5s ease 1.3s;
}
.overlay-diagonal .quote-text {
  opacity: 0; filter: blur(8px);
  transition: opacity 0.3s ease, filter 0.3s ease;
}
.wheel-container.rotated .overlay-cardinal .quote-text {
  opacity: 0; filter: blur(8px);
  transition: opacity 0.3s ease, filter 0.3s ease;
}
.wheel-container.rotated .overlay-diagonal .quote-text {
  opacity: 1; filter: blur(0px);
  transition: opacity 0.5s ease 1.3s, filter 0.5s ease 1.3s;
}

/* Tap hint */
.tap-hint {
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
  color: var(--muted);
  max-width: 46ch;
  margin-top: 18px;
}

.wheel-outer:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 6px;
  border-radius: 50%;
}

/* ─── YEAR BLOCK ─── */
.year-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  animation: riseIn 1s ease both 0.8s;
}
.year {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
.year-number {
  display: block;
  font-family: 'Syne', sans-serif;
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--dark);
  user-select: none;
  text-align: center;
  margin-bottom: 8px;
}
.year-note {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  max-width: 260px;
  line-height: 1.6;
  text-align: center;
}

/* ─── BOTTOM ─── */
.bottom-text {
  border-top: 1px solid var(--faint);
  padding-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  max-width: 700px;
  animation: riseIn 1s ease both 1s;
}
.bottom-left {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.7;
  max-width: 320px;
}
.bottom-right {
  font-family: 'Spectral', serif;
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--dark);
  text-align: right;
}
.bottom-right .period { color: var(--turquoise); }

/* ─── MOBILE FALLBACK ─── */
/* Above 640px: visually hidden but screen-reader reachable (the wheel
   overlays are aria-hidden; this is the accessible statement text). */
.theses-list {
  list-style: none;
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.theses-list li {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.75;
  padding: 18px 0;
  border-top: 1px solid var(--faint);
}
.theses-list li:last-child { border-bottom: 1px solid var(--faint); }
.theses-section-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .back { left: 24px; top: 24px; }
  .page { padding: 32px 24px 48px; justify-content: flex-start; }
  .book-intro { margin-bottom: 32px; text-align: left; }
  .wheel-container { margin-bottom: 0; }
  .wheel-outer { display: none; }
  .tap-hint { display: none; }
  .theses-list {
    display: block;
    position: static;
    width: 100%;
    height: auto;
    margin: 0 0 40px;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    max-width: 500px;
  }
  .theses-section-label {
    display: block;
    position: static;
    width: auto;
    height: auto;
    margin: 32px 0 4px;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
  }
  .year-number { font-size: clamp(3.5rem, 20vw, 6rem); }
  .bottom-text { flex-direction: column; gap: 24px; align-items: flex-start; }
  .bottom-right { text-align: left; }
}

.book-view-controls { text-align: center; margin-bottom: 28px; }
.book-reading-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--focus);
  font: 600 0.875rem/1.5 'Syne', sans-serif;
  text-underline-offset: 4px;
}
.book-view-controls .tap-hint { margin: 4px auto 0; font-size: 0.875rem; }
.wheel-position { font: 600 0.875rem/1.5 'Syne', sans-serif; color: var(--muted); margin-top: 20px; }
.book-statements { width: 100%; max-width: 700px; margin: 20px 0 48px; }
.book-statements h2 { font-size: 1.8rem; line-height: 1.25; margin-bottom: 12px; }
.statements-intro { color: var(--muted); font-size: 1rem; line-height: 1.7; margin-bottom: 24px; }
.book-statements .theses-list,
.book-statements .theses-section-label {
  position: static;
  width: 100%;
  height: auto;
  max-width: none;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
}
.book-statements .theses-section-label { margin: 28px 0 12px; }
.book-statements .theses-list { margin: 0; }
.book-statements .theses-list li { font-size: 1rem; line-height: 1.75; padding: 18px 0; }
.bottom-left { font-size: 0.9rem; }
@media (max-width: 640px) {
  .book-view-controls { width: 100%; text-align: left; margin-bottom: 0; }
  .wheel-container { display: none; }
  .book-statements { margin-top: 24px; }
}

@media print {
  .book-view-controls, .wheel-position { display: none; }
  @page { margin: 18mm; }

  html,
  body {
    background: #ffffff !important;
    color: #171513 !important;
    height: auto;
  }

  body::before,
  .skip-link,
  .wheel-outer,
  .tap-hint {
    display: none !important;
  }

  .back {
    animation: none;
    color: #171513;
    display: inline-block;
    margin-bottom: 24px;
    position: static;
  }

  .page {
    align-items: stretch;
    animation: none;
    display: block;
    min-height: auto;
    padding: 0;
  }

  .book-intro {
    margin-bottom: 28px;
    max-width: none;
    text-align: left;
  }

  .book-intro h1 { font-size: 2rem; }

  .book-summary,
  .wheel-overview { margin-left: 0; }

  .wheel-container {
    align-items: flex-start;
    margin-bottom: 8px;
  }

  .wheel-header {
    color: #171513;
    margin-bottom: 20px;
    min-height: auto;
    text-align: left;
  }

  .wheel-header .cardinal-text {
    filter: none !important;
    opacity: 1;
    position: static;
    transition: none;
  }

  .wheel-header .diagonal-text {
    display: none;
  }

  .theses-section-label {
    clip: auto;
    clip-path: none;
    color: #3f3933;
    display: block;
    height: auto;
    margin: 24px 0 4px;
    overflow: visible;
    position: static;
    white-space: normal;
    width: auto;
  }

  .theses-list {
    clip: auto;
    clip-path: none;
    display: block;
    height: auto;
    list-style: disc;
    margin: 0 0 18px;
    max-width: 72ch;
    overflow: visible;
    padding-left: 1.25rem;
    position: static;
    white-space: normal;
    width: auto;
  }

  .theses-list li {
    border-color: #c9c2b8;
    color: #171513;
    font-size: 0.9rem;
    padding: 10px 0;
  }

  .year-block {
    align-items: flex-start;
    animation: none;
    break-inside: avoid;
    margin: 28px 0;
  }

  .bottom-text {
    animation: none;
    border-color: #c9c2b8;
    break-inside: avoid;
    max-width: none;
  }

  .year,
  .year-number,
  .year-note,
  .bottom-left,
  .bottom-right {
    color: #171513;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}
