/* ==========================================================================
   Sasha Pinto — styles
   Editorial minimalism after Khaite (wide serif mark, italic display type)
   and Toteme (small grotesk, monochrome, quiet space).
   ========================================================================== */

:root {
  --ivory: #f5f2ed;
  --paper: #fbf9f5;
  --stone: #e7e1d8;
  --sand: #d6cec2;
  --ink: #141312;
  --ink-soft: #3a3734;
  --muted: #8a847c;
  --line: rgba(20, 19, 18, 0.14);

  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --gutter: clamp(16px, 3.2vw, 48px);
  --header-h: 72px;
}

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

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.8s var(--ease);
}

body[data-view="thinking"] {
  background: var(--paper);
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--ink);
  color: var(--ivory);
}

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

/* ---------- Links: underline that retracts and redraws ---------- */

.intro-thesis a,
.index-name a,
.text-link,
.contact-email,
.social a {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  padding-bottom: 1px;
}

.text-link {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro-thesis a:hover,
.index-name a:hover,
.text-link:hover,
.contact-email:hover,
.social a:hover {
  animation: redraw 0.7s var(--ease-in-out);
}

@keyframes redraw {
  0% {
    background-size: 100% 1px;
    background-position: 100% 100%;
  }
  45% {
    background-size: 0% 1px;
    background-position: 100% 100%;
  }
  46% {
    background-size: 0% 1px;
    background-position: 0 100%;
  }
  100% {
    background-size: 100% 1px;
    background-position: 0 100%;
  }
}

/* External-link arrow */
.ext::after {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.3em;
  background: currentColor;
  -webkit-mask: url("../icons/arrow-ne.svg") center / contain no-repeat;
  mask: url("../icons/arrow-ne.svg") center / contain no-repeat;
  transition: transform 0.4s var(--ease);
}

.ext:hover::after {
  transform: translate(2px, -2px);
}

/* ---------- Loader ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--ivory);
  transition: transform 1.1s var(--ease-in-out) 0.15s;
}

.loader-mark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(20px, 3vw, 34px);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  padding-left: 0.42em;
}

.loader-mark .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.4em);
  animation: ch-in 0.8s var(--ease) forwards;
  animation-delay: calc(var(--i) * 45ms);
}

@keyframes ch-in {
  to {
    opacity: 1;
    transform: none;
  }
}

html:not(.is-loading) .loader {
  transform: translateY(-100%);
  pointer-events: none;
}

/* ---------- Announcement bar ---------- */

.announce {
  position: relative;
  height: 32px;
  background: var(--ink);
  color: var(--ivory);
  font-size: 11px;
  letter-spacing: 0.08em;
  overflow: hidden;
}

.announce-track li {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 var(--gutter);
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(100%);
  transition:
    transform 0.8s var(--ease),
    opacity 0.8s var(--ease);
}

.announce-track li.is-active {
  opacity: 1;
  transform: none;
}

.announce-track li.is-leaving {
  opacity: 0;
  transform: translateY(-100%);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--header-h);
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--ivory) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition:
    border-color 0.4s var(--ease),
    background-color 0.8s var(--ease),
    height 0.5s var(--ease);
}

body[data-view="thinking"] .site-header {
  background: color-mix(in srgb, var(--paper) 86%, transparent);
}

body.is-scrolled .site-header {
  border-color: var(--line);
  height: 60px;
}

.nav {
  position: relative;
  display: flex;
  gap: clamp(16px, 2vw, 28px);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.nav-link {
  position: relative;
  padding: 6px 0;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
}

.nav-indicator {
  position: absolute;
  left: 0;
  bottom: 2px;
  height: 1px;
  width: 0;
  background: var(--ink);
  transition:
    transform 0.55s var(--ease),
    width 0.55s var(--ease);
}

.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(18px, 2vw, 24px);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  white-space: nowrap;
  transition: letter-spacing 0.9s var(--ease);
}

.wordmark:hover {
  letter-spacing: 0.4em;
}

.wordmark .ch {
  display: inline-block;
  transition: transform 0.6s var(--ease);
}

.wordmark:hover .ch {
  transform: translateY(-1px);
}

.header-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: clamp(16px, 2vw, 28px);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.clock .sep {
  transition: opacity 0.3s;
}

.clock .sep.is-off {
  opacity: 0.2;
}

.header-contact {
  display: inline-block;
  padding: 6px 0;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: 2px;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  height: 100%;
  background: var(--ink);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- Views ---------- */

main {
  min-height: 70vh;
}

.view {
  padding: 0 var(--gutter);
}

.view[hidden] {
  display: none;
}

.view.is-entering {
  animation: view-in 0.9s var(--ease) both;
}

.view.is-leaving {
  animation: view-out 0.4s var(--ease-in-out) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes view-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ---------- Type ---------- */

.eyebrow,
.chapter-num,
.index-label,
.entry-no,
.entry-status,
.read-no {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(48px, 7.4vw, 112px);
  line-height: 0.98;
  letter-spacing: -0.015em;
}

.display em {
  font-style: italic;
  font-weight: 300;
}

.lede {
  max-width: 34ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* Word-by-word headline reveal */
[data-split] .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

[data-split] .w > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1.1s var(--ease);
  transition-delay: calc(var(--i) * 70ms + 0.1s);
}

[data-split].is-in .w > span {
  transform: none;
}

/* Generic scroll reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 1s var(--ease),
    transform 1s var(--ease);
  transition-delay: var(--d, 0s);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Fill-sweep button */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 30px;
  border: 1px solid var(--ink);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  overflow: hidden;
  isolation: isolate;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.55s var(--ease);
}

.btn span {
  transition: color 0.35s var(--ease);
}

.btn:hover::before {
  transform: scaleY(1);
}

.btn:hover span {
  color: var(--ivory);
}

/* ---------- Chapters ---------- */

.chapter {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(20px, 5vw, 96px);
  padding: clamp(56px, 8vw, 120px) 0;
  border-top: 1px solid var(--line);
}

.chapter-head {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  align-self: start;
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.chapter-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
}

/* Index rows */
.index-label {
  margin: 0 0 12px;
}

.index-label:not(:first-child) {
  margin-top: 48px;
}

.index {
  border-top: 1px solid var(--line);
}

.index-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(110px, 2fr) 5fr 24px;
  align-items: baseline;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}

.index-row::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--gutter) * -0.5);
  z-index: -1;
  background: var(--stone);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.5s var(--ease);
}

.index-row:hover::before {
  transform: scaleY(1);
}

.index-role {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.index-name {
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.25;
  transition: transform 0.5s var(--ease);
}

.index-row:hover .index-name {
  transform: translateX(10px);
}

.times {
  font-style: italic;
  color: var(--muted);
  margin: 0 0.2em;
}

.index-arrow,
.read-arrow {
  width: 14px;
  height: 14px;
  justify-self: end;
  background: currentColor;
  -webkit-mask: url("../icons/arrow-ne.svg") center / contain no-repeat;
  mask: url("../icons/arrow-ne.svg") center / contain no-repeat;
  opacity: 0;
  transform: translate(-8px, 8px);
  transition:
    opacity 0.4s var(--ease),
    transform 0.5s var(--ease);
}

.index-row:hover .index-arrow {
  opacity: 1;
  transform: none;
}

/* ---------- For fun: marquee + cards ---------- */

.chapter--wide {
  grid-template-columns: minmax(0, 1fr);
}

.chapter--wide .chapter-head {
  position: static;
}

.marquee {
  overflow: hidden;
  margin: 0 calc(var(--gutter) * -1);
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 0.5em;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1.15;
  white-space: nowrap;
  will-change: transform;
}

.marquee-track i {
  font-style: normal;
  color: var(--sand);
}

.marquee-track span {
  transition: color 0.4s var(--ease);
}

.marquee-track span:hover {
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
  padding: 24px;
  background: var(--ivory);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition:
    background-color 0.5s var(--ease),
    opacity 1s var(--ease),
    transform 0.6s var(--ease);
}

.card.is-in {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}

.card:hover {
  background: var(--paper);
  transition:
    background-color 0.5s var(--ease),
    opacity 1s var(--ease),
    transform 0.12s linear;
}

.card-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--muted);
}

.card-title {
  margin-top: auto;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.05;
}

.card-text {
  min-height: 3.2em;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Contact ---------- */

.contact-kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--muted);
  margin-bottom: 8px;
}

.contact-email {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(32px, 5.4vw, 80px);
  line-height: 1.1;
  word-break: break-word;
}

.contact-actions {
  display: flex;
  gap: 32px;
  align-items: center;
  margin-top: 24px;
}

.contact-loc {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.social span {
  color: var(--muted);
}

/* ---------- Thinking & Reading heads ---------- */

.page-head {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: clamp(40px, 7vw, 110px) 0 clamp(48px, 7vw, 96px);
  border-bottom: 1px solid var(--line);
}

/* ---------- Thinking ---------- */

.view--paper {
  position: relative;
  min-height: 80vh;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 39px,
    rgba(20, 19, 18, 0.045) 39px,
    rgba(20, 19, 18, 0.045) 40px
  );
}

.journal {
  counter-reset: entry;
}

.entry {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: baseline;
  gap: 24px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}

.entry-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(26px, 3.2vw, 44px);
  line-height: 1.1;
  transition:
    font-style 0s,
    transform 0.6s var(--ease),
    color 0.6s var(--ease);
}

.entry:hover .entry-title {
  font-style: italic;
  transform: translateX(8px);
}

.entry-status {
  position: relative;
  padding-left: 14px;
}

.entry-status::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--sand);
  animation: breathe 2.4s var(--ease-in-out) infinite;
}

@keyframes breathe {
  50% {
    background: var(--ink);
    transform: scale(1.3);
  }
}

.paper-hint {
  padding: 48px 0 96px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--muted);
}

.read {
  margin-bottom: 32px;
}

.read {
  position: relative;
  display: grid;
  grid-template-columns: 120px 200px 1fr 24px;
  align-items: baseline;
  gap: 24px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  isolation: isolate;
}

.read::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--gutter) * -0.5);
  z-index: -1;
  background: var(--stone);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.6s var(--ease);
}

.read:hover::before {
  transform: scaleX(1);
}

.read-source {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.read-title {
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.2;
  transition: transform 0.5s var(--ease);
}

.read:hover .read-title {
  font-style: italic;
  transform: translateX(10px);
}

.read:hover .read-arrow {
  opacity: 1;
  transform: none;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: clamp(48px, 8vw, 120px);
  padding: 0 var(--gutter);
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.footer-mark {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 15.4vw;
  line-height: 0.82;
  letter-spacing: -0.03em;
  white-space: nowrap;
  text-align: center;
  margin: 0 calc(var(--gutter) * -1) -0.08em;
  user-select: none;
}

.footer-mark .ch {
  display: inline-block;
  transition:
    transform 0.8s var(--ease),
    font-style 0s;
}

.footer-mark .ch:hover {
  transform: translateY(-0.1em);
  font-style: italic;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--ivory);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition:
    opacity 0.5s var(--ease),
    transform 0.5s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Custom cursors ---------- */

.cursor,
.ink {
  display: none;
}

html.has-cursor,
html.has-cursor * {
  cursor: none !important;
}

html.has-cursor .cursor {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  pointer-events: none;
  will-change: transform;
}

.cursor img {
  max-width: none;
}

html.has-cursor .ink {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
}

/* Baby portrait cursor */
.cursor--baby {
  width: 0;
  height: 0;
}

.cursor--baby img {
  position: absolute;
  left: -22px;
  top: -22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 1.5px var(--ivory),
    0 6px 18px rgba(20, 19, 18, 0.22);
  transform: scale(var(--s, 1)) rotate(var(--r, 0deg));
  transition:
    transform 0.45s var(--ease),
    opacity 0.3s var(--ease);
}

.cursor--baby.is-hover img {
  --s: 1.75;
}

.cursor--baby.is-down img {
  --s: 0.82;
}

.cursor--baby.is-hover.is-down img {
  --s: 1.5;
}

.cursor-label {
  position: absolute;
  left: 30px;
  top: -34px;
  padding: 5px 9px 4px;
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-6px, 6px) scale(0.9);
  transform-origin: 0 100%;
  transition:
    opacity 0.3s var(--ease),
    transform 0.45s var(--ease);
}

.cursor--baby.is-hover .cursor-label:not(:empty) {
  opacity: 1;
  transform: none;
}

/* Quill cursor (Thinking) */
.cursor--quill img {
  position: absolute;
  left: -6px;
  top: -90px;
  width: 96px;
  height: 96px;
  transform-origin: 6px 90px;
  transform: rotate(var(--r, 0deg)) scale(var(--s, 1));
  transition: transform 0.25s var(--ease);
  filter: drop-shadow(0 6px 6px rgba(20, 19, 18, 0.14));
}

.cursor--quill.is-down img {
  --s: 0.92;
}

.cursor.is-hidden {
  opacity: 0;
}

html.has-cursor .cursor--quill {
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

html.has-cursor .cursor--baby {
  transition: opacity 0.3s var(--ease);
}

body.is-quill .cursor--quill {
  opacity: 1;
}

body.is-quill .cursor--baby {
  opacity: 0;
}

/* ---------- Stage (hero): portrait centred in a draggable moodboard ---------- */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  height: calc(100svh - var(--header-h) - 32px);
  min-height: 640px;
  max-height: 960px;
  margin: 0 calc(var(--gutter) * -1);
  overflow: hidden;
}

.stage-word {
  position: absolute;
  z-index: 1;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(96px, 16vw, 280px);
  line-height: 0.8;
  letter-spacing: -0.035em;
  pointer-events: none;
  user-select: none;
  transition:
    transform 1.6s var(--ease) 0.4s,
    opacity 1.6s var(--ease) 0.4s;
}

.stage-word em {
  font-style: italic;
}

.stage-word--left {
  left: 2.5%;
  top: 7%;
}

.stage-word--right {
  right: 2.5%;
  bottom: 9%;
}

html.is-loading .stage-word--left {
  transform: translateX(-12%);
  opacity: 0;
}

html.is-loading .stage-word--right {
  transform: translateX(12%);
  opacity: 0;
}

.collage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pola {
  position: absolute;
  z-index: 2;
  left: var(--x);
  top: var(--y);
  width: clamp(112px, 11vw, 172px);
  margin: 0;
  padding: 8px 8px 0;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(20, 19, 18, 0.06),
    0 14px 30px -12px rgba(20, 19, 18, 0.35);
  transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) rotate(var(--r));
  scale: 1;
  opacity: 1;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  will-change: transform;
  transition:
    box-shadow 0.35s var(--ease),
    scale 0.9s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.6s var(--ease);
  transition-delay: 0s, var(--delay, 0s), var(--delay, 0s);
}

html.is-loading .pola {
  scale: 0.4;
  opacity: 0;
}

.pola--sm {
  width: clamp(92px, 8.4vw, 132px);
}

.pola img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  pointer-events: none;
}

.pola figcaption {
  padding: 6px 0 8px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.1;
  text-align: center;
  color: var(--ink-soft);
}

.pola:hover {
  scale: 1.05;
  transition-delay: 0s;
}

.pola.is-dragging {
  z-index: 20;
  scale: 1.1;
  box-shadow:
    0 2px 4px rgba(20, 19, 18, 0.08),
    0 34px 50px -18px rgba(20, 19, 18, 0.45);
  transition-delay: 0s;
}

.portrait {
  position: relative;
  z-index: 3;
  width: clamp(220px, 22vw, 340px);
  margin: 0;
}

.portrait-arch {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 999px 999px 0 0;
  background: var(--stone);
  box-shadow: 0 40px 70px -40px rgba(20, 19, 18, 0.55);
}

/* Curtain that lifts to reveal the portrait after the intro */
.portrait-arch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ivory);
  transform-origin: 50% 0;
  transform: scaleY(0);
  transition: transform 1.5s var(--ease-in-out) 0.3s;
}

html.is-loading .portrait-arch::after {
  transform: scaleY(1);
}

.portrait-arch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  transform: scale(1.08);
  transition: transform 1.4s var(--ease);
}

.portrait:hover .portrait-arch img {
  transform: scale(1.01);
}

.badge {
  position: absolute;
  top: -26px;
  right: -46px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--ivory);
  box-shadow: 0 0 0 1px var(--line);
  font-family: var(--sans);
  font-size: 9.6px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  fill: var(--ink);
  animation: spin 22s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.stage-copy {
  position: relative;
  z-index: 4;
  text-align: center;
}

.stage-hello {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.1;
}

.stage-roles {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.roles {
  display: inline-grid;
  overflow: hidden;
  vertical-align: top;
}

.role {
  grid-area: 1 / 1;
  text-align: center;
  opacity: 0;
  transform: translateY(100%);
  transition:
    transform 0.7s var(--ease),
    opacity 0.7s var(--ease);
}

.role.is-active {
  opacity: 1;
  transform: none;
}

.role.is-leaving {
  opacity: 0;
  transform: translateY(-100%);
}

.stage-hint {
  position: absolute;
  z-index: 4;
  left: var(--gutter);
  bottom: 22px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--muted);
  animation: bob 2.6s var(--ease-in-out) infinite;
}

@keyframes bob {
  50% {
    transform: translateY(5px);
  }
}

/* ---------- Intro ---------- */

.intro-big {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(32px, 3.8vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.intro-big em {
  font-style: italic;
}

.path {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 56px;
}

.path::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 1.6s var(--ease-in-out) 0.2s;
}

.path.is-in::before {
  transform: scaleX(1);
}

.path li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 16px 0 0;
}

.path li::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--ivory);
  transition:
    background-color 0.4s var(--ease),
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.path li:last-child::before {
  background: var(--ink);
  animation: breathe 2.4s var(--ease-in-out) infinite;
}

.path li:hover::before {
  background: var(--ink);
  transform: scale(1.5);
}

.path span {
  font-family: var(--serif);
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.1;
}

.path small {
  font-size: 12px;
  color: var(--muted);
}

.intro-thesis {
  max-width: 58ch;
  margin-top: 48px;
  font-size: 16px;
  color: var(--ink-soft);
}

.intro-thesis em {
  font-family: var(--serif);
  font-size: 1.14em;
}

.stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

.sticker {
  padding: 10px 18px 9px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 12px;
  letter-spacing: 0.06em;
  transform: rotate(var(--r));
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sticker:hover {
  transform: rotate(0deg) translateY(-4px) scale(1.08);
}

.sticker--ink {
  background: var(--ink);
  color: var(--ivory);
}

.sticker--stone {
  background: var(--stone);
  border-color: var(--stone);
}

/* ---------- Row headers ---------- */

.chapter-head--row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 24px;
}

.chapter-head--row > div {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.chapter-aside {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--muted);
}

/* ---------- Places strip ---------- */

.strip {
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.strip::-webkit-scrollbar {
  display: none;
}

.strip-track {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  width: max-content;
  padding-right: var(--gutter);
}

.strip-item {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateX(60px);
  transition:
    opacity 1s var(--ease),
    transform 1.1s var(--ease);
  transition-delay: calc(var(--i, 0) * 60ms);
}

.strip.is-in .strip-item {
  opacity: 1;
  transform: none;
}

.strip-item img {
  height: clamp(240px, 30vw, 430px);
  width: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
  filter: saturate(0.85);
  transition:
    filter 0.8s var(--ease),
    transform 0.8s var(--ease);
}

.strip-item--tall img {
  height: clamp(280px, 36vw, 520px);
  aspect-ratio: 3 / 4;
}

.strip-item--wide img {
  aspect-ratio: 4 / 3;
}

.strip-item:hover img {
  filter: saturate(1.05);
  transform: translateY(-8px);
}

.strip-item span {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.4s var(--ease);
}

.strip-item:hover span {
  color: var(--ink);
}

.strip.is-dragging .strip-item img {
  transform: scale(0.98);
}

.strip-progress {
  height: 1px;
  margin-top: 28px;
  background: var(--line);
}

.strip-progress span {
  display: block;
  height: 100%;
  background: var(--ink);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0.1));
}

/* ---------- Fashion board ---------- */

.btn--sm {
  height: 38px;
  padding: 0 20px;
  font-size: 11px;
}

.board {
  columns: 4 200px;
  column-gap: 12px;
}

.board-item {
  position: relative;
  margin-bottom: 12px;
  overflow: hidden;
  break-inside: avoid;
  background: var(--stone);
  transition:
    opacity 0.5s var(--ease),
    transform 0.7s var(--ease);
  transition-delay: calc(var(--i, 0) * 30ms);
}

.board.is-shuffling .board-item {
  opacity: 0;
  transform: translateY(24px) scale(0.96);
}

.board-item img {
  width: 100%;
  filter: grayscale(0.3);
  transition:
    transform 1.1s var(--ease),
    filter 0.6s var(--ease);
}

.board-item:hover img {
  transform: scale(1.05);
  filter: grayscale(0);
}

.board-note {
  margin-top: 28px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Bookshelf ---------- */

.page-head--shelf {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
}

.page-head--shelf > div {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.shelf-stats {
  display: flex;
  gap: clamp(24px, 4vw, 56px);
  margin: 0;
}

.shelf-stats dt {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.shelf-stats dd {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(44px, 5vw, 76px);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.shelf-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 28px 0 8px;
}

.tabs {
  position: relative;
  display: flex;
  gap: 28px;
}

.tab {
  padding: 4px 0 8px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 30px);
  color: var(--muted);
  transition: color 0.4s var(--ease);
}

.tab:hover,
.tab.is-active {
  color: var(--ink);
}

.tab.is-active {
  font-style: italic;
}

.tab sup {
  margin-left: 2px;
  font-family: var(--sans);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.tab-indicator {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 0;
  background: var(--ink);
  transition:
    transform 0.55s var(--ease),
    width 0.55s var(--ease);
}

.pick-result {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.5s var(--ease),
    transform 0.5s var(--ease);
}

.pick-result.is-visible {
  opacity: 1;
  transform: none;
}

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 44px 28px;
  padding: 28px 0 80px;
}

.book {
  perspective: 900px;
  animation: book-in 0.8s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}

@keyframes book-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

.book a {
  display: block;
}

.book-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--stone);
  border-radius: 2px 4px 4px 2px;
  box-shadow:
    0 1px 2px rgba(20, 19, 18, 0.1),
    0 12px 22px -14px rgba(20, 19, 18, 0.5);
  transform-origin: 0 50%;
  transform: rotateY(0deg);
  transition:
    transform 0.7s var(--ease),
    box-shadow 0.7s var(--ease);
}

.book-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.18) 0,
    rgba(255, 255, 255, 0.2) 2.5%,
    rgba(0, 0, 0, 0.08) 5%,
    transparent 9%
  );
  pointer-events: none;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.book:hover .book-cover {
  transform: rotateY(-24deg) translateX(4px);
  box-shadow:
    0 2px 4px rgba(20, 19, 18, 0.1),
    18px 24px 30px -18px rgba(20, 19, 18, 0.55);
}

.book-title {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.15;
}

.book-author {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.stars {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink);
}

.stars .off {
  color: var(--sand);
}

.book.is-flash .book-cover {
  transform: translateY(-8px);
  box-shadow: 0 0 0 2px var(--ink);
}

.book.is-picked .book-cover {
  transform: translateY(-14px) rotate(-3deg) scale(1.06);
  box-shadow:
    0 0 0 2px var(--ink),
    0 30px 40px -20px rgba(20, 19, 18, 0.6);
}

.book.is-picked .book-cover::after {
  content: "next up!";
  position: absolute;
  z-index: 2;
  top: -12px;
  right: -14px;
  padding: 6px 10px 5px;
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1;
  transform: rotate(8deg);
  animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pop {
  from {
    transform: rotate(8deg) scale(0);
  }
}

.links-online {
  padding: 48px 0 24px;
  border-top: 1px solid var(--line);
}

.links-online .chapter-title {
  margin-bottom: 24px;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .read {
    grid-template-columns: 48px 120px 1fr 16px;
    gap: 16px;
  }
}

@media (max-width: 760px) {
  :root {
    --header-h: 96px;
  }

  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: 52px 40px;
    height: auto;
    padding-top: 4px;
  }

  body.is-scrolled .site-header {
    height: auto;
  }

  .wordmark {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    letter-spacing: 0.22em;
    padding-left: 0;
  }

  .header-meta {
    grid-column: 2;
    grid-row: 1;
  }

  .clock {
    display: none;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: start;
  }

  .chapter {
    grid-template-columns: minmax(0, 1fr);
  }

  .chapter-head {
    position: static;
  }

  .stage {
    min-height: 600px;
    gap: 16px;
  }

  .stage-word {
    font-size: 27vw;
  }

  .stage-word--left {
    top: 4%;
  }

  .stage-word--right {
    bottom: 13%;
  }

  .pola {
    width: 92px;
    padding: 5px 5px 0;
  }

  .pola--sm {
    width: 78px;
  }

  .pola figcaption {
    font-size: 12px;
    padding: 4px 0 5px;
  }

  .pola:nth-child(n + 8) {
    display: none;
  }

  /* Keep the "home" polaroid clear of the greeting on narrow screens */
  .pola:nth-child(2) {
    --x: 70% !important;
    --y: 46% !important;
  }

  .pola:nth-child(6) {
    display: none;
  }

  .portrait {
    width: 58vw;
    max-width: 260px;
  }

  .badge {
    width: 86px;
    height: 86px;
    top: -20px;
    right: -26px;
  }

  .path {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 28px;
  }

  .index-row {
    grid-template-columns: minmax(0, 1fr) 20px;
    gap: 4px 12px;
  }

  .index-role {
    grid-column: 1 / -1;
  }

  .entry {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 16px;
  }

  .entry-no {
    grid-column: 1 / -1;
  }

  .board {
    columns: 2;
    column-gap: 8px;
  }

  .board-item {
    margin-bottom: 8px;
  }

  .shelf {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 14px;
  }

  .book-title {
    font-size: 15px;
  }

  .read {
    grid-template-columns: minmax(0, 1fr) 16px;
    gap: 4px 12px;
  }

  .read-no {
    display: none;
  }

  .read-source {
    grid-column: 1 / -1;
  }

  .footer-row span:nth-child(2) {
    display: none;
  }
}

@media (max-width: 480px) {
  .card {
    min-height: 190px;
    padding: 16px;
  }

  .card-title {
    font-size: 24px;
  }

  .card-text {
    min-height: 4.8em;
  }

  .shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  [data-reveal],
  [data-split] .w > span,
  .strip-item {
    opacity: 1;
    transform: none;
  }
}
