:root {
  --bg: #f7f7f5;
  --ink: #111111;
  --muted: #5d5d5d;
  --hairline: #d9d9d9;
  --panel: #ffffff;
  --shadow: rgba(0, 0, 0, 0.08);
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", serif;
  --sans: "Space Grotesk", "Avenir Next", "Futura", sans-serif;
  --content-width: 72ch;
  --accent: #ff2d1b;
  --page-pad: 6vw;
}

body.theme-dark {
  --bg: #0b0b0c;
  --ink: #f2f2f2;
  --muted: #9b9b9b;
  --hairline: #2a2a2a;
  --panel: #141416;
  --shadow: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background: radial-gradient(1200px 600px at 5% -10%, rgba(0, 0, 0, 0.05), transparent 60%), var(--bg);
  line-height: 1.65;
}

body.theme-dark {
  background: radial-gradient(1200px 600px at 5% -10%, rgba(255, 255, 255, 0.04), transparent 60%), var(--bg);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px var(--page-pad) 16px;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  font-size: 14px;
}

.brand-title:hover {
  background-size: 100% 2px;
  color: inherit;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.site-nav {
  display: flex;
  gap: 20px;
  font-family: var(--sans);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-left: auto;
  flex-wrap: wrap;
}

.search {
  position: relative;
}

.search-input {
  width: min(200px, 40vw);
  border: none;
  border-bottom: 1px solid var(--hairline);
  padding: 2px 2px 6px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink);
}

.search-input::placeholder {
  color: var(--muted);
}

.search-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, 90vw);
  background: var(--panel);
  border: 1px solid var(--hairline);
  box-shadow: 0 20px 40px var(--shadow);
  border-radius: 12px;
  padding: 8px 0;
  z-index: 10;
}

.search-item {
  display: block;
  padding: 12px 18px;
  border-bottom: 1px solid #efefef;
  background-image: none;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: color-mix(in srgb, var(--panel) 80%, var(--accent) 20%);
  border-bottom-color: #e6e6e6;
  color: var(--ink);
}

.search-title {
  font-family: var(--sans);
  font-weight: 600;
}

.search-meta {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.search-summary {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 6px;
}

.search-empty {
  padding: 14px 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.nav-link {
  position: relative;
  padding-bottom: 6px;
  background-image: none;
  color: var(--muted);
  border-bottom: none;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

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

.nav-link:hover::after,
.nav-link.is-active::after {
  transform: scaleX(1);
}

.main {
  flex: 1;
  padding: 0 var(--page-pad) 80px;
}

.hero {
  display: grid;
  gap: 28px;
  max-width: var(--content-width);
  padding: 40px 0 60px;
}

.hero-title {
  display: grid;
  gap: 10px;
}

.hero-kicker {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2,
h3 {
  font-family: var(--sans);
  margin: 0 0 16px;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4.8rem);
}

h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
}

.prose {
  font-size: 1.08rem;
  color: var(--ink);
}

.prose p {
  margin: 0 0 1.3rem;
}

.prose p:first-of-type::first-letter {
  float: left;
  font-family: var(--sans);
  font-size: 3.5rem;
  line-height: 0.9;
  padding-right: 8px;
  color: var(--accent);
}

.cta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.cta-link {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  background-image: none;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.theme-toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.cta-link:hover {
  color: #111111;
  background: transparent;
}

.cta-link.ghost {
  background: transparent;
  color: var(--accent);
  background-image: none;
  border-bottom: 1px solid var(--accent);
}

.cta-link.ghost:hover {
  color: #111111;
  background: var(--accent);
}

.section {
  margin-top: 40px;
  max-width: var(--content-width);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
}

.section-head.stack {
  flex-direction: column;
  align-items: flex-start;
}

.section-intro {
  max-width: 60ch;
}

.section-link {
  font-family: var(--sans);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
  background-image: none;
}

.section-link:hover {
  color: var(--accent);
}

.work-list {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 22px;
}

.work-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 24px;
  padding: 20px 0 20px 16px;
  border-left: 2px solid var(--hairline);
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.6s ease forwards;
}

.work-item:nth-child(1) { animation-delay: 0.05s; }
.work-item:nth-child(2) { animation-delay: 0.1s; }
.work-item:nth-child(3) { animation-delay: 0.15s; }
.work-item:nth-child(4) { animation-delay: 0.2s; }
.work-item:nth-child(5) { animation-delay: 0.25s; }
.work-item:nth-child(6) { animation-delay: 0.3s; }

.work-item:hover {
  border-left-color: var(--accent);
}

.work-year {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.work-title {
  font-family: var(--sans);
  font-size: 1.3rem;
  font-weight: 600;
  background-image: none;
  border-bottom: none;
}

.work-title:hover {
  color: var(--accent);
}

.work-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.work-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag-link {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background-image: none;
  border-bottom: none;
}

.tag-link:hover {
  color: var(--accent);
}

.tag-row .tag-link {
  font-size: 0.7rem;
}

.single {
  max-width: var(--content-width);
  padding: 40px 0 20px;
}

.single-header h1 {
  margin-top: 8px;
}

.single-meta {
  display: flex;
  gap: 10px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.single-summary {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 60ch;
}

.content img {
  display: block;
  margin: 18px 0;
  max-width: 100%;
  width: 100%;
  border-radius: 4px;
  filter: grayscale(100%);
}

.content iframe {
  width: 100%;
  max-width: 600px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  margin: 16px 0;
}

.gallery {
  position: relative;
  width: calc(100% + (var(--page-pad) * 2));
  margin-left: calc(var(--page-pad) * -1);
  margin-right: calc(var(--page-pad) * -1);
  margin-top: 24px;
  margin-bottom: 24px;
  background: #141414;
  border-top: 1px solid #1f1f1f;
  border-bottom: 1px solid #1f1f1f;
}

body.theme-dark .gallery {
  background: #090909;
  border-top-color: #1a1a1a;
  border-bottom-color: #1a1a1a;
}

.gallery-track {
  padding: 18px var(--page-pad);
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.gallery-track p {
  margin: 0;
  display: contents;
}

.gallery-track img {
  height: 220px;
  width: auto;
  flex: 0 0 auto;
  border-radius: 4px;
  filter: grayscale(100%);
  scroll-snap-align: start;
}

.gallery-track::-webkit-scrollbar {
  height: 8px;
}

.gallery-track::-webkit-scrollbar-thumb {
  background: #2b2b2b;
  border-radius: 20px;
}

.single-footer {
  margin-top: 36px;
}

.site-footer {
  padding: 16px var(--page-pad) 32px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
}

.footer-accent {
  color: var(--accent);
}

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

@media (max-width: 720px) {
  :root {
    --page-pad: 5vw;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .site-nav {
    flex-wrap: wrap;
  }

  .search {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  .theme-toggle {
    order: 3;
  }

  .work-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .content img {
    max-width: 100%;
  }

  .gallery {
    margin-top: 20px;
    margin-bottom: 20px;
  }

  .gallery-track {
    padding: 14px var(--page-pad);
  }

  .gallery-track img {
    height: 170px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
