@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600;6..72,700&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #f4f1ea;
  --bg-2: #e8e2d3;
  --ink: #1a1814;
  --ink-2: #4a463d;
  --ink-3: #7a7468;
  --rule: #d6cfbe;
  --accent: #0a6e4f;
  --accent-ink: #ffffff;
  --highlight: #ffe066;

  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --font-sans: 'DM Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --pad-x: clamp(20px, 5vw, 80px);
  --pad-y: 96px;
  --maxw: 1200px;
}

[data-dark="true"] {
  --bg: #14130f;
  --bg-2: #1c1a15;
  --ink: #f0ebdc;
  --ink-2: #b8b1a0;
  --ink-3: #847e72;
  --rule: #2a2620;
  --accent: #ffb84d;
  --accent-ink: #14130f;
  --highlight: #5a4ad9;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}
a { color: inherit; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px var(--pad-x);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.topbar .who { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.topbar .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2cbf6e; box-shadow: 0 0 0 3px color-mix(in oklab, #2cbf6e 25%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px color-mix(in oklab, #2cbf6e 25%, transparent); }
  50%     { box-shadow: 0 0 0 6px color-mix(in oklab, #2cbf6e 0%, transparent); }
}
.topbar nav { display: flex; gap: 22px; align-items: center; }
.topbar nav a {
  text-decoration: none; color: var(--ink-2); transition: color .18s;
  position: relative;
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a::before { content: "~/"; color: var(--ink-3); }
.topbar .cta {
  font-family: var(--font-mono);
  background: var(--ink); color: var(--bg);
  padding: 7px 12px; border-radius: 999px;
  text-decoration: none; font-size: 11px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: transform .18s, background .18s;
}
.topbar .cta:hover { transform: translateY(-1px); }
.topbar .cta::before { content: "→"; }

/* ── Section scaffolding ─────────────────────────────────────────────── */
section { padding: var(--pad-y) var(--pad-x); position: relative; }
.wrap { max-width: var(--maxw); margin: 0 auto; }

.sect-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .04em;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.sect-tag .num { color: var(--accent); font-weight: 600; }
.sect-tag .line { flex: 1; height: 1px; background: var(--rule); }

h1, h2 { margin: 0; font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.02em; }
h3 { margin: 0; font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: clamp(36px, 5vw, 60px); line-height: 1.02; }
h3 { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.15; }
p  { margin: 0; line-height: 1.6; color: var(--ink-2); }

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero { padding-top: 80px; padding-bottom: 60px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: clamp(40px, 6vw, 100px);
  align-items: center;
}
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(40px, 6vw, 84px);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 60;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
  font-variation-settings: "opsz" 72;
}
.hero .sub {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink-2);
  margin-top: 28px;
  max-width: 560px;
  line-height: 1.7;
}
.hero .meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3);
  margin-top: 24px;
  align-items: center;
}
.hero .meta span.sep { opacity: .5; }
.hero .meta b { color: var(--ink); font-weight: 500; }
.cursor {
  display: inline-block; width: .55ch; height: 1em;
  background: var(--ink); margin-left: 2px; vertical-align: -0.12em;
  animation: blink 1.05s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.photo-frame {
  position: relative; aspect-ratio: 4/5;
  border-radius: 4px; overflow: hidden;
  transform: rotate(1.3deg);
  background: var(--bg-2);
  box-shadow:
    0 1px 0 rgba(255,255,255,.4) inset,
    0 30px 60px -20px rgba(26,24,20,.35),
    0 8px 20px -8px rgba(26,24,20,.2);
  transition: transform .4s cubic-bezier(.2,.7,.2,1.4);
}
.photo-frame:hover { transform: rotate(-0.6deg) scale(1.01); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-frame::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,.05), transparent 40%);
  pointer-events: none;
}
.photo-tag {
  position: absolute; bottom: -14px; left: -14px;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  padding: 7px 11px; border-radius: 3px;
  letter-spacing: .03em;
  transform: rotate(-2deg);
  box-shadow: 0 6px 14px -4px rgba(10,110,79,.5);
}

/* Status ribbon */
.ribbon {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--ink);
  color: var(--bg);
  overflow: hidden;
  font-family: var(--font-mono); font-size: 13px;
  padding: 14px 0;
  display: flex;
}
.ribbon .track {
  display: flex; gap: 40px; flex-shrink: 0;
  animation: scroll 38s linear infinite;
  padding-right: 40px;
}
.ribbon .track span { white-space: nowrap; display: inline-flex; align-items: center; gap: 12px; }
.ribbon .track span::before { content: "✦"; color: var(--accent); }
@keyframes scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce) {
  .ribbon .track      { animation: none; }
  .cursor             { animation: none; }
  .topbar .dot        { animation: none; }
  .photo-frame,
  .photo-frame:hover  { transition: none; transform: rotate(1.3deg); }
}

/* ── About ───────────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(40px, 6vw, 90px);
}
@media (max-width: 880px) { .about-grid { grid-template-columns: 1fr; gap: 36px; } }
.about-grid h2 { max-width: 14ch; }
.about-body p { font-size: 19px; line-height: 1.6; color: var(--ink); }
.about-body p + p { margin-top: 18px; }
.about-body .lede { font-family: var(--font-serif); font-size: 26px; line-height: 1.4; color: var(--ink); margin-bottom: 22px; }
.about-body .lede em { color: var(--accent); font-style: italic; }

.kpis {
  margin-top: 48px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.kpi { padding: 22px 0; border-right: 1px solid var(--rule); }
.kpi:last-child { border-right: 0; }
.kpi .num {
  font-family: var(--font-serif);
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}
.kpi .num em { font-style: italic; color: var(--accent); }
.kpi .lbl {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3); margin-top: 8px;
  text-transform: uppercase; letter-spacing: .06em;
}

/* ── Work / timeline ─────────────────────────────────────────────────── */
.work .head {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  margin-bottom: 48px;
}
.work .head h2 { max-width: 16ch; }
.work .head .note {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-3);
  max-width: 320px; text-align: right;
}
.timeline { display: flex; flex-direction: column; }
.tl-row {
  display: grid; grid-template-columns: 110px 1fr auto;
  gap: 32px; align-items: start;
  padding: 26px 0;
  border-top: 1px solid var(--rule);
  cursor: pointer;
  transition: padding-left .25s ease, background .25s ease;
}
.tl-row:last-child { border-bottom: 1px solid var(--rule); }
.tl-row:hover { padding-left: 16px; background: var(--bg-2); }
.tl-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tl-row .yr { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); padding-top: 6px; }
.tl-row .role {
  font-family: var(--font-serif); font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 500; line-height: 1.15; letter-spacing: -0.015em;
  margin-bottom: 8px;
}
.tl-row .role em { color: var(--accent); font-style: italic; }
.tl-row .where { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.tl-row .blurb {
  font-size: 15px; line-height: 1.6; color: var(--ink-2);
  margin-top: 12px; max-width: 60ch;
  display: none;
}
.tl-row[aria-expanded="true"] .blurb { display: block; }
.tl-row .arrow {
  font-family: var(--font-mono); font-size: 18px; color: var(--ink-3);
  align-self: center;
  transition: transform .25s, color .25s;
}
.tl-row:hover .arrow { transform: translateX(6px); color: var(--accent); }
@media (max-width: 720px) {
  .tl-row { grid-template-columns: 1fr; gap: 8px; }
  .tl-row .arrow { display: none; }
}

/* ── Projects ────────────────────────────────────────────────────────── */
.projects {
  background: var(--bg-2);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.proj-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 48px; gap: 24px; }
.proj-head h2 { max-width: 14ch; }
.proj-head .aside { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); max-width: 280px; text-align: right; }

.proj-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 980px) { .proj-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 680px) { .proj-grid { grid-template-columns: 1fr; } }

.proj {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  text-decoration: none; color: inherit;
  position: relative; overflow: hidden;
  min-height: 280px;
}
.proj:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -16px rgba(26,24,20,.22);
  border-color: var(--ink);
}
.proj:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.proj-art {
  height: 200px; border-radius: 4px;
  background: var(--bg-2); overflow: hidden;
  border: 1px solid var(--rule);
}
.proj-art img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  display: block;
}
.proj-meta {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em;
  display: flex; gap: 10px; align-items: center;
}
.proj-meta .pill {
  background: var(--bg-2); padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--rule);
}
.proj h3 {
  font-family: var(--font-serif); font-size: 24px; font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.15;
}
.proj p { font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.proj .open {
  margin-top: auto; font-family: var(--font-mono); font-size: 11px;
  color: var(--ink); display: inline-flex; gap: 6px; align-items: center;
}
.proj .open::after { content: "→"; transition: transform .2s; }
.proj:hover .open::after { transform: translateX(4px); }

/* ── Writing ─────────────────────────────────────────────────────────── */
.writing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
}
@media (max-width: 880px) { .writing-grid { grid-template-columns: 1fr; gap: 36px; } }
.writing h2 { max-width: 14ch; }
.writing .blurb { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); line-height: 1.7; margin-top: 24px; max-width: 42ch; }
.writing .sub-cta {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px;
  margin-top: 20px;
  border: 1px solid var(--ink); padding: 10px 14px; border-radius: 999px;
  text-decoration: none; color: var(--ink);
  transition: background .2s, color .2s;
}
.writing .sub-cta:hover { background: var(--ink); color: var(--bg); }

.posts { display: flex; flex-direction: column; }
.post {
  display: grid; grid-template-columns: 60px 1fr auto;
  gap: 18px; align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none; color: inherit;
  transition: padding-left .25s, background .25s;
  cursor: pointer;
}
.post:first-child { border-top: 1px solid var(--rule); }
.post:hover { padding-left: 12px; }
.post:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.post .ttl { font-family: var(--font-serif); font-size: 20px; font-weight: 500; line-height: 1.3; letter-spacing: -0.01em; }
.post .ttl em { font-style: italic; color: var(--ink-2); }
.post .date { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.post:hover .ttl { color: var(--accent); }

/* ── Contact ─────────────────────────────────────────────────────────── */
.contact {
  background: var(--ink);
  color: var(--bg);
  border-top: 1px solid var(--ink);
}
.contact .sect-tag { color: color-mix(in oklab, var(--bg) 50%, transparent); }
.contact .sect-tag .num { color: var(--accent); }
.contact .sect-tag .line { background: color-mix(in oklab, var(--bg) 20%, transparent); }
.contact h2 {
  font-size: clamp(48px, 7vw, 96px);
  letter-spacing: -0.035em;
  line-height: .98;
  max-width: 18ch;
}
.contact h2 em { color: var(--accent); font-style: italic; font-weight: 500; }

.contact .layout {
  display: grid; grid-template-columns: 1.3fr 1fr;
  gap: clamp(40px, 6vw, 90px); margin-top: 64px;
  align-items: start;
}
@media (max-width: 880px) { .contact .layout { grid-template-columns: 1fr; gap: 48px; } }

.open-list { display: flex; flex-direction: column; gap: 0; }
.open-item {
  display: grid; grid-template-columns: 28px 1fr auto;
  gap: 16px; align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid color-mix(in oklab, var(--bg) 18%, transparent);
  font-family: var(--font-mono); font-size: 13px;
}
.open-item:first-child { border-top: 1px solid color-mix(in oklab, var(--bg) 18%, transparent); }
.open-item .ck { color: var(--accent); font-weight: 600; }
.open-item .lbl { color: var(--bg); }
.open-item .desc { color: color-mix(in oklab, var(--bg) 55%, transparent); font-size: 11.5px; }

.contact-card {
  background: color-mix(in oklab, var(--bg) 7%, var(--ink));
  border: 1px solid color-mix(in oklab, var(--bg) 16%, transparent);
  border-radius: 8px;
  padding: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.contact-card .h {
  font-size: 11px; color: color-mix(in oklab, var(--bg) 55%, transparent);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 16px;
  display: flex; gap: 8px; align-items: center;
}
.contact-card .h::before {
  content: ""; width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
  display: inline-block;
}
.contact-card .links { display: flex; flex-direction: column; gap: 0; }
.contact-card a {
  display: flex; align-items: center; justify-content: space-between;
  text-decoration: none; color: var(--bg);
  padding: 12px 0;
  border-bottom: 1px dashed color-mix(in oklab, var(--bg) 18%, transparent);
  transition: color .2s, padding-left .2s;
}
.contact-card a:last-child { border-bottom: 0; }
.contact-card a:hover { color: var(--accent); padding-left: 6px; }
.contact-card a .ar {
  color: color-mix(in oklab, var(--bg) 35%, transparent);
  transition: transform .2s, color .2s;
}
.contact-card a:hover .ar { color: var(--accent); transform: translateX(4px); }

/* Footer */
.foot {
  padding: 32px var(--pad-x) 40px;
  background: var(--ink);
  color: color-mix(in oklab, var(--bg) 55%, transparent);
  font-family: var(--font-mono); font-size: 11px;
  display: flex; justify-content: space-between; gap: 18px;
  border-top: 1px solid color-mix(in oklab, var(--bg) 14%, transparent);
}
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--accent); }
@media (max-width: 600px) { .foot { flex-direction: column; gap: 8px; } }

.topbar nav a:focus-visible,
.topbar .cta:focus-visible,
.writing .sub-cta:focus-visible,
.contact-card a:focus-visible,
.foot a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.open-label {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: .6;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
}

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