/* Design tokens. Navy bands with white content, orange as the accent, a serif for display. */
:root {
  --navy: #223041;
  --orange: #F39A24;
  --orange-deep: #D9881C;
  --slate: #566272;
  --grey: #7C858F;
  --rule: #E3E1E1;
  --panel: #F4F5F6;
  --on-navy: #FFFFFF;
  --on-navy-muted: #C9D1DC;
  --bg: #FFFFFF;
  --wrap: 1120px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, "Segoe UI", Arial, sans-serif;
}

/* Base ---------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--sans); color: var(--slate); background: var(--bg); font-size: 17px; line-height: 1.65; }
h1, h2 { font-family: var(--serif); font-weight: 600; color: var(--navy); line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(36px, 4.5vw, 48px); }
h2 { font-size: clamp(26px, 3vw, 32px); }
h3 { font-family: var(--sans); font-weight: 600; font-size: 20px; color: var(--navy); line-height: 1.3; margin: 0 0 0.5em; }
h3.sub { font-size: 13px; font-weight: 400; color: var(--grey); text-transform: uppercase; letter-spacing: 0.1em; margin: 36px 0 8px; }
p { margin: 0 0 1.2em; }
a { color: var(--navy); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: #B8C0CB; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--orange); }
strong { font-weight: 600; }
img { max-width: 100%; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.kicker { display: block; font-size: 12px; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange); margin-bottom: 14px; }
.lede { font-family: var(--serif); font-size: 21px; line-height: 1.5; max-width: 62ch; }
section.block { padding: 80px 0; }

/* Section headings in content carry a short orange rule */
.longform .content h2::after, .bio .kicker::after { content: ""; display: block; width: 40px; height: 2px; background: var(--orange); margin-top: 12px; }
.longform .content h2 { margin-bottom: 20px; }

/* Navy bands ------------------------------------------------------------------------ */
.band { background: var(--navy); color: var(--on-navy); }
.band h1, .band h2 { color: var(--on-navy); }
.band .lede { color: var(--on-navy-muted); }
.band a { color: var(--on-navy); }
.page-header { padding: 72px 0 64px; }
.page-header .lede { margin: 12px 0 0; }

/* Header and navigation ------------------------------------------------------------ */
.site-header { position: sticky; top: 0; background: var(--navy); border-bottom: 1px solid rgba(255, 255, 255, 0.1); z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 22px; color: var(--on-navy); text-decoration: none; letter-spacing: -0.01em; }
.site-nav { display: flex; gap: 32px; }
.site-nav a { text-decoration: none; color: var(--on-navy-muted); font-weight: 400; font-size: 15px; padding: 25px 0 23px; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--on-navy); }
.site-nav a.is-active { color: var(--on-navy); border-bottom-color: var(--orange); }
.nav-toggle { display: none; font: inherit; font-size: 15px; color: var(--on-navy); background: none; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 4px; padding: 6px 12px; }

/* Home hero ------------------------------------------------------------------------- */
.hero { padding: 72px 0 0; }
.hero .wrap { display: grid; grid-template-columns: 7fr 5fr; gap: 64px; align-items: end; }
.hero-text { padding-bottom: 80px; }
.hero h1 { font-size: clamp(44px, 6vw, 72px); margin-bottom: 24px; }
.hero .headline { font-family: var(--serif); font-size: clamp(22px, 2.4vw, 28px); line-height: 1.35; color: var(--on-navy); max-width: 34ch; margin: 0 0 16px; }
.hero .subline { font-size: 19px; line-height: 1.55; color: var(--on-navy-muted); max-width: 44ch; margin: 0 0 36px; }
.hero-portrait { margin: 0; }
.hero-portrait img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; }

/* Buttons --------------------------------------------------------------------------- */
.btn { display: inline-block; font-family: var(--sans); font-weight: 500; font-size: 15px; line-height: 1.2; padding: 14px 24px; border-radius: 4px; text-decoration: none; background: var(--orange); color: var(--navy); border: 1px solid var(--orange); }
.btn:hover { background: var(--orange-deep); border-color: var(--orange-deep); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn.secondary:hover { background: var(--panel); }
.band .btn.secondary { color: var(--on-navy); border-color: rgba(255, 255, 255, 0.6); }
.band .btn.secondary:hover { border-color: var(--on-navy); background: rgba(255, 255, 255, 0.06); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* Prose ----------------------------------------------------------------------------- */
.prose { max-width: 70ch; }
.prose p, .prose li { font-size: 18px; }
.prose h2 { margin-top: 2em; scroll-margin-top: 96px; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose img { height: auto; border-radius: 2px; }
.prose blockquote { margin: 0 0 1.2em; padding: 4px 0 4px 20px; border-left: 2px solid var(--orange); color: var(--navy); }
.bio { padding: 80px 0 72px; }
.bio .kicker { margin-bottom: 28px; }
.bio .prose { max-width: none; columns: 2; column-gap: 56px; }
.bio .prose p { font-size: 18px; }

/* Cards (pet projects on About) ---------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card { background: var(--bg); border: 1px solid var(--rule); border-radius: 4px; padding: 32px; text-decoration: none; display: block; color: inherit; }
.card:hover { border-color: var(--orange); text-decoration: none; }
.card h3 { font-family: var(--serif); font-size: 22px; margin-bottom: 10px; }
.card p { margin: 0; font-size: 16px; }
.card .arrow { color: var(--navy); margin-top: 18px; display: block; font-size: 15px; }
.cards.projects { grid-template-columns: repeat(2, 1fr); margin: 24px 0 40px; }
.cards.projects img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 2px; margin-bottom: 16px; }

/* Long-form pages with sidebar -------------------------------------------------------- */
.longform .wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; padding-top: 56px; padding-bottom: 96px; }
.sidebar { position: sticky; top: 96px; align-self: start; }
.toc a { display: block; color: var(--grey); text-decoration: none; padding: 6px 0 6px 14px; border-left: 1px solid var(--rule); font-size: 14px; font-weight: 400; }
.toc a:hover, .toc a.is-active { color: var(--navy); border-left: 2px solid var(--orange); padding-left: 13px; }
.view-switch { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--rule); border-radius: 4px; padding: 6px; margin-bottom: 24px; }
.view-switch button { font: inherit; font-size: 14px; text-align: left; background: none; border: 0; border-radius: 3px; padding: 8px 10px; color: var(--slate); cursor: pointer; }
.view-switch button:hover { background: var(--panel); }
.view-switch button.is-active { background: var(--orange); color: var(--navy); }
.cv[data-view="featured"] [data-show="detail"], .cv[data-view="featured"] [data-show="normal"], .cv[data-view="featured"] .entry ul { display: none; }
.cv-section.is-empty, .cv-group.is-empty { display: none; }
.cv-section { padding-top: 8px; margin-bottom: 56px; border-top: 1px solid var(--rule); scroll-margin-top: 96px; }
.cv-section h2 { margin: 28px 0 16px; }

/* CV entries ------------------------------------------------------------------------ */
.entry { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.entry:last-child { border-bottom: 0; }
.entry .when { color: var(--grey); font-size: 14px; padding-top: 5px; }
.entry h3 { font-size: 18px; margin-bottom: 4px; }
.entry .where { color: var(--slate); font-size: 16px; margin: 0 0 6px; }
.entry .meta { color: var(--grey); font-size: 14px; margin: 0; }
.entry ul { margin: 10px 0 0; padding-left: 1.1em; font-size: 16px; }
.entry li { margin-bottom: 4px; }
.compact { list-style: none; padding: 0; margin: 0; }
.compact li { padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 16px; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; }
.compact .when { color: var(--grey); font-size: 14px; }
.compact .detail { display: block; color: var(--grey); font-size: 14px; margin-top: 2px; }
.pill { display: inline-block; font-size: 11px; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grey); border: 1px solid var(--rule); border-radius: 999px; padding: 2px 9px; margin-left: 8px; vertical-align: middle; }
.counts { display: flex; gap: 40px; flex-wrap: wrap; margin: 0 0 32px; }
.counts .value { display: block; font-family: var(--serif); font-size: 36px; font-weight: 600; color: var(--navy); line-height: 1; }
.counts .label { font-size: 14px; color: var(--grey); }

/* Gallery: a reading-order grid, newest first ---------------------------------------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px 20px; }
.gallery figure { margin: 0; cursor: zoom-in; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: 2px; }
.gallery figcaption { font-size: 14px; color: var(--grey); padding: 8px 2px 0; }
.lightbox { position: fixed; inset: 0; background: rgba(34, 48, 65, 0.96); display: none; align-items: center; justify-content: center; flex-direction: column; z-index: 50; padding: 24px; cursor: zoom-out; }
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 100%; max-height: 85vh; }
.lightbox p { color: var(--on-navy); margin: 16px 0 0; font-size: 15px; }

/* Notes ----------------------------------------------------------------------------- */
.note-list { list-style: none; padding: 0; margin: 0; }
.note-list li { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; padding: 28px 0; border-bottom: 1px solid var(--rule); }
.note-list .thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; }
.note-list h3 { font-family: var(--serif); font-size: 22px; margin-bottom: 6px; }
.note-list h3 a { text-decoration: none; }
.note-list h3 a:hover { text-decoration: underline; text-decoration-color: var(--orange); }
.note-list p { margin: 0 0 6px; }
.note-meta { color: var(--grey); font-size: 14px; }
.note-body img { display: block; margin: 16px auto; }
.comments { margin-top: 64px; border-top: 1px solid var(--rule); padding-top: 24px; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 16px; }
.comment p { margin: 4px 0 0; }
.comment .who { font-weight: 500; color: var(--navy); }
.comment .when { color: var(--grey); font-size: 13px; margin-left: 8px; }
.comment.reply { margin-left: 32px; }

/* Footer ---------------------------------------------------------------------------- */
.site-footer { background: var(--navy); color: var(--on-navy-muted); padding: 32px 0; font-size: 14px; border-top: 2px solid var(--orange); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; }

/* Responsive ------------------------------------------------------------------------ */
@media (max-width: 1000px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .bio .prose { columns: 1; }
}
@media (max-width: 860px) {
  .hero { padding: 48px 0 56px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 36px; align-items: start; }
  .hero-text { padding-bottom: 0; }
  .hero-portrait { order: -1; max-width: 320px; }
  .cards, .cards.projects { grid-template-columns: 1fr; }
  .longform .wrap { grid-template-columns: 1fr; gap: 32px; }
  .sidebar { position: static; }
  .toc { display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .toc a { border-left: 0; padding: 4px 0; }
  .toc a.is-active { border-left: 0; padding-left: 0; text-decoration: underline; text-decoration-color: var(--orange); }
  .view-switch { flex-direction: row; }
  .view-switch button { flex: 1; text-align: center; }
}
@media (max-width: 768px) {
  section.block { padding: 56px 0; }
  .page-header { padding: 48px 0 40px; }
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 72px; background: var(--navy); flex-direction: column; gap: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding: 8px 24px 16px; }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
  .site-nav a.is-active { border-bottom: 1px solid rgba(255, 255, 255, 0.1); border-left: 2px solid var(--orange); padding-left: 12px; }
}
@media (max-width: 600px) {
  .entry, .compact li { grid-template-columns: 1fr; gap: 4px; }
  .entry .when { padding-top: 0; }
  .counts { gap: 24px; }
  .counts .value { font-size: 30px; }
  .gallery { grid-template-columns: 1fr; }
  .note-list li { grid-template-columns: 1fr; gap: 12px; }
}
