/* ───────────────────────────── Tokens ───────────────────────────── */
:root {
  --paper:      #f7f4ee;
  --paper-deep: #efe9df;
  --ink:        #1b1a17;
  --ink-soft:   #4a4843;
  --muted:      #8a857b;
  --line:       #d9d2c5;
  --accent:     #9a4f2e;   /* burnt sienna */
  --accent-dim: rgba(154, 79, 46, 0.12);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;

  --maxw: 660px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100vh;
}

/* faint paper grain */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: radial-gradient(rgba(0,0,0,0.18) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}

::selection { background: var(--accent-dim); }

/* ───────────────────────────── Layout ───────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(4rem, 12vh, 9rem) 1.6rem 4rem;
}

/* ───────────────────────────── Intro ───────────────────────────── */
.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.6rem;
}

.name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.3rem, 6.5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.rule {
  height: 1px;
  background: var(--line);
  margin: 2.4rem 0;
  transform-origin: left;
}

.bio {
  font-size: 1.12rem;
  color: var(--ink-soft);
  max-width: 56ch;
}
.bio em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  color: var(--ink);
}

/* ───────────────────────────── Catalog ───────────────────────────── */
.catalog {
  margin-top: 3.4rem;
  border-top: 1px solid var(--line);
}

.entry {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  padding: 1.5rem 0.4rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: background 0.4s var(--ease), padding-left 0.4s var(--ease);
}
.entry:hover,
.entry:focus-visible {
  background: var(--paper-deep);
  padding-left: 1.1rem;
  outline: none;
}

.entry-num {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  min-width: 1.6rem;
}

.entry-body { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }

.entry-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.2;
}
.entry-desc { font-size: 0.92rem; color: var(--muted); }

.entry-arrow {
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.4s var(--ease), color 0.4s var(--ease);
}
.entry:hover .entry-arrow,
.entry:focus-visible .entry-arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}

/* ───────────────────────────── Footer ───────────────────────────── */
.footer {
  margin-top: 3.6rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.9rem;
}
.contact {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.contact:hover { color: var(--accent); border-color: var(--accent); }
.footer-meta { color: var(--muted); }

/* ───────────────────────────── Dialogs ───────────────────────────── */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 620px;
  width: calc(100% - 2rem);
  color: var(--ink);
}
.modal::backdrop {
  background: rgba(27, 26, 23, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-inner {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3rem 2.6rem 2.6rem;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.4);
  max-height: 86vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}
.modal-close:hover { color: var(--accent); transform: rotate(90deg); }

.modal-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.modal-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  margin-bottom: 1.8rem;
  letter-spacing: -0.01em;
}

/* CV */
.cv-block { margin-bottom: 2rem; }
.cv-block h3 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
.cv-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr auto;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.98rem;
}
.cv-where { font-weight: 500; }
.cv-what { color: var(--ink-soft); }
.cv-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.cv-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cv-tags span {
  font-size: 0.85rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--ink-soft);
}
.modal-foot { margin-top: 1.4rem; }
.modal-foot a, .piece a, .project-link {
  color: var(--accent);
  text-decoration: none;
}
.modal-foot a:hover { text-decoration: underline; }

/* Writing */
.piece-list, .project-list { list-style: none; }
.piece { border-top: 1px solid var(--line); }
.piece a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1.1rem 0;
  color: var(--ink);
  transition: padding-left 0.35s var(--ease);
}
.piece a:hover { padding-left: 0.6rem; }
.piece-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.piece-meta { font-size: 0.82rem; color: var(--muted); }
.piece-blurb { font-size: 0.95rem; color: var(--ink-soft); margin-top: 0.15rem; }

/* Projects */
.project { padding: 1.4rem 0; border-top: 1px solid var(--line); }
.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.project-title { font-family: var(--font-display); font-size: 1.35rem; }
.project-status {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  background: var(--accent-dim);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  white-space: nowrap;
}
.project-blurb { color: var(--ink-soft); font-size: 0.98rem; margin-bottom: 0.6rem; }
.project-link:hover { text-decoration: underline; }

/* ───────────────────────────── Motion ───────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.9s var(--ease) forwards;
}
.catalog.reveal { animation-delay: 0.12s; }
.footer.reveal { animation-delay: 0.22s; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.modal[open] .modal-inner {
  animation: pop 0.4s var(--ease);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .modal[open] .modal-inner { animation: none; opacity: 1; transform: none; }
  .entry, .entry-arrow, .piece a, .modal-close { transition: none; }
}

/* ───────────────────────────── Small screens ───────────────────────────── */
@media (max-width: 520px) {
  .cv-row { grid-template-columns: 1fr; gap: 0.1rem; }
  .cv-when { order: -1; }
  .modal-inner { padding: 2.4rem 1.5rem 2rem; }
}
