/* Emily Handy — portfolio
   Minimal, editorial, warm. System sans for UI, Instrument Serif for display. */

:root {
  --bg: #f7f4ee;
  --bg-elev: rgba(247, 244, 238, 0.72);
  --ink: #16150f;
  --ink-2: #4c4942;
  --ink-3: #8a857c;
  --line: rgba(22, 21, 15, 0.1);
  --line-strong: rgba(22, 21, 15, 0.22);
  --accent: #b5573a;
  --aura-1: #f6c9b3;
  --aura-2: #d9d5f2;
  --aura-3: #cfe0cf;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Inter, system-ui, Segoe UI, Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --gutter: clamp(20px, 5vw, 64px);
  --max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0d;
    --bg-elev: rgba(15, 15, 13, 0.7);
    --ink: #ece8e0;
    --ink-2: #b6b1a7;
    --ink-3: #7c7870;
    --line: rgba(236, 232, 224, 0.1);
    --line-strong: rgba(236, 232, 224, 0.26);
    --accent: #e0885f;
    --aura-1: #5a3325;
    --aura-2: #2e2a4f;
    --aura-3: #22352a;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--ink); color: var(--bg); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

/* ---------- Aura (slow drifting gradient behind hero) ---------- */
.aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.9;
}
.aura span {
  position: absolute;
  width: 56vmax;
  height: 56vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
  animation: drift 26s var(--ease-io) infinite alternate;
}
.aura .a1 { background: var(--aura-1); top: -22vmax; left: -14vmax; animation-duration: 28s; }
.aura .a2 { background: var(--aura-2); top: -8vmax; right: -20vmax; animation-duration: 34s; animation-delay: -9s; }
.aura .a3 { background: var(--aura-3); bottom: -30vmax; left: 20vw; animation-duration: 31s; animation-delay: -17s; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(9vw, 7vh, 0) scale(1.12); }
}
.aura::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 30%, var(--bg) 92%);
}

main, header, footer { position: relative; z-index: 1; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.nav.scrolled {
  background: var(--bg-elev);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 1px 0 var(--line);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
}
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: clamp(18px, 3vw, 36px);
}
.nav li a {
  font-size: 14px;
  color: var(--ink-2);
  position: relative;
  padding: 6px 0;
  transition: color 0.25s var(--ease);
}
.nav li a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav li a:hover { color: var(--ink); }
.nav li a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: calc(100svh - 64px);
  display: grid;
  align-content: center;
  padding-block: clamp(56px, 10vh, 120px) clamp(64px, 12vh, 140px);
}
.eyebrow {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 28px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 11vw, 148px);
  line-height: 0.94;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
@media (max-width: 480px) {
  .hero h1 { font-size: clamp(64px, 17vw, 70px); }
}
.hero .lede {
  margin-top: clamp(28px, 4vw, 44px);
  max-width: 34ch;
  font-size: clamp(18px, 2.1vw, 24px);
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero .cta {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  font-weight: 500;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -12px rgba(0,0,0,0.35); }
.btn svg { width: 14px; height: 14px; transition: transform 0.35s var(--ease); }
.btn:hover svg { transform: translate(2px, -2px); }
.link {
  font-size: 15px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.link:hover { color: var(--ink); border-color: var(--ink); }

/* Word-by-word entrance */
.words .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}
.words .w > span {
  display: inline-block;
  transform: translateY(110%);
  opacity: 0;
  animation: rise 1.1s var(--ease) forwards;
  animation-delay: calc(var(--i) * 90ms + 120ms);
}
@keyframes rise {
  to { transform: translateY(0); opacity: 1; }
}
.fade-up {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 1s var(--ease) forwards;
}
.hero .eyebrow.fade-up { animation-delay: 0.05s; }
.hero .lede.fade-up { animation-delay: 0.55s; }
.hero .cta.fade-up { animation-delay: 0.75s; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: 1px;
  height: 44px;
  background: var(--line-strong);
  overflow: hidden;
  opacity: 0;
  animation: fadeUp 1s var(--ease) 1.4s forwards;
}
.scroll-hint::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: translateY(-100%);
  animation: scrollLine 2.2s var(--ease-io) infinite;
}
@keyframes scrollLine {
  0% { transform: translateY(-100%); }
  55% { transform: translateY(100%); }
  100% { transform: translateY(100%); }
}

/* ---------- Sections ---------- */
section { padding-block: clamp(72px, 12vh, 150px); }
.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: end;
  margin-bottom: clamp(36px, 5vw, 60px);
}
@media (min-width: 760px) {
  .section-head { grid-template-columns: 1fr auto; }
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.section-head .count {
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 13px;
  color: var(--ink-2);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip:active { transform: scale(0.97); }

/* ---------- Article list ---------- */
.articles {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.article {
  border-bottom: 1px solid var(--line);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), max-height 0.45s var(--ease);
}
.article.hide {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  display: none;
}
.article a {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px 32px;
  padding: 22px 0;
  position: relative;
  transition: padding-left 0.5s var(--ease);
}
@media (min-width: 760px) {
  .article a {
    grid-template-columns: 170px 1fr auto;
    align-items: baseline;
    padding: 26px 0;
  }
  .article a:hover { padding-left: 10px; }
}
.article .pub {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.article .title {
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}
.article .dek {
  grid-column: 1 / -1;
  color: var(--ink-2);
  font-size: 15px;
  max-width: 62ch;
}
@media (min-width: 760px) { .article .dek { grid-column: 2 / 3; margin-top: 2px; } }
@media (max-width: 759px) { .article .meta { order: 4; margin-top: 4px; } }
.article .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
}
.article .meta svg {
  width: 12px; height: 12px;
  transition: transform 0.4s var(--ease);
}
.article a:hover .meta svg { transform: translate(3px, -3px); }
.article a:hover .title { color: var(--accent); }
.article .title { transition: color 0.3s var(--ease); }

.more {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

/* ---------- Featured cards ---------- */
.featured { padding-bottom: clamp(24px, 4vh, 48px); }
.index { padding-top: clamp(48px, 8vh, 96px); }
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; gap: 18px; } }
.card > a, .card > div {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--bg-elev);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.55s var(--ease), border-color 0.4s var(--ease), box-shadow 0.55s var(--ease);
  will-change: transform;
}
.card > a:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 30px 60px -40px rgba(0, 0, 0, 0.35);
}
.card .pub { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.card .title {
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: pretty;
  transition: color 0.3s var(--ease);
}
.card > a:hover .title { color: var(--accent); }
.card .dek { color: var(--ink-2); font-size: 15px; flex: 1; }
.card .meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.card .meta svg { width: 12px; height: 12px; transition: transform 0.4s var(--ease); }
.card > a:hover .meta svg { transform: translate(3px, -3px); }

.tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-3);
}
.article .row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px 32px;
  padding: 22px 0;
  cursor: default;
}
@media (min-width: 760px) {
  .article .row { grid-template-columns: 170px 1fr auto; align-items: baseline; padding: 26px 0; }
}

/* ---------- Publications strip ---------- */
.pubs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: clamp(40px, 6vw, 72px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 22px);
  color: var(--ink-3);
}
.pubs span { transition: color 0.3s var(--ease); }
.pubs span:hover { color: var(--ink); }

/* ---------- About ---------- */
.about .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px 64px;
}
@media (min-width: 860px) {
  .about .grid { grid-template-columns: 5fr 7fr; }
}
.about h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.about p {
  font-size: clamp(18px, 1.6vw, 21px);
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}
.about p + p { margin-top: 22px; }
.about .facts {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 22px 28px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.about .facts dt, .about .facts .k {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.about .facts .v { font-size: 16px; color: var(--ink); }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 8vw, 96px);
  line-height: 1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.contact h2 em { font-style: italic; color: var(--accent); }
.contact p {
  margin: 24px auto 0;
  max-width: 44ch;
  color: var(--ink-2);
  font-size: clamp(17px, 1.6vw, 20px);
}
.contact .email {
  display: inline-block;
  margin-top: 40px;
  font-family: var(--serif);
  font-size: clamp(24px, 4vw, 44px);
  letter-spacing: -0.01em;
  position: relative;
}
.contact .email::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0.35);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.contact .email:hover::after { transform: scaleX(1); }
.socials {
  margin-top: 36px;
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 14px;
  color: var(--ink-2);
}
.socials a { border-bottom: 1px solid transparent; transition: border-color 0.3s var(--ease), color 0.3s var(--ease); }
.socials a:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Footer ---------- */
footer {
  padding: 32px 0 44px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-3);
}
footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
}

/* ---------- Utilities ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* ---------- 404 ---------- */
.nf { min-height: 100svh; display: grid; place-content: center; text-align: center; gap: 18px; }
.nf h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(56px, 12vw, 140px); line-height: 1; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .aura span { animation: none; }
  .words .w > span, .fade-up, .scroll-hint { animation: none; opacity: 1; transform: none; }
  .scroll-hint::after { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .article a, .chip { transition: none; }
}
