@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --line: rgba(255, 255, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.1);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-2: rgba(255, 255, 255, 0.1);
  --dim: rgba(255, 255, 255, 0.58);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'Source Serif 4', Georgia, 'Songti SC', serif;
  --display: 'Playfair Display', Georgia, 'Songti SC', serif;
  --u: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

h1, h2, h3 {
  text-wrap: balance;
}

:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.masthead-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

.brandrow {
  display: flex;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 0;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(20px, 2.2vw, 25px);
  letter-spacing: 0.01em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--paper);
  flex: none;
}

.menurow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 16px;
  cursor: pointer;
}

.mainnav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  flex: 1 1 auto;
}

.navlink,
.groupbtn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
}

.navlink:hover,
.groupbtn:hover {
  background: var(--glass-2);
}

.navgroup {
  position: relative;
}

.groupbtn::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 9px;
  border-right: 1px solid var(--paper);
  border-bottom: 1px solid var(--paper);
  transform: rotate(45deg) translateY(-2px);
}

.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  flex-direction: column;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.navgroup:hover .dropdown,
.navgroup:focus-within .dropdown {
  display: flex;
}

.dropdown a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 16px;
  text-decoration: none;
}

.dropdown a:hover {
  background: var(--glass-2);
}

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

.search-field {
  width: 150px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 16px;
}

.search-field::placeholder {
  color: var(--dim);
}

.search-btn {
  height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  cursor: pointer;
}

.search-btn:hover {
  background: rgba(255, 255, 255, 0.8);
}

.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 40px) clamp(16px, 3vw, 32px);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 70vh;
}

.hero-copy {
  grid-column: 1 / 8;
  text-align: center;
}

.hero-copy h1 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(34px, 5.6vw, 74px);
  line-height: 1.03;
  letter-spacing: -0.025em;
}

.hero-lead {
  margin: 0 auto;
  max-width: 40ch;
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.7;
  color: var(--dim);
  font-style: italic;
}

.hero-figure {
  grid-column: 8 / 13;
  position: relative;
  margin: 0;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--glass-2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 5;
}

.badge {
  position: absolute;
  left: 14px;
  bottom: 14px;
  margin: 0;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.content-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px) clamp(40px, 6vw, 80px);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(16px, 2.4vw, 32px);
  align-items: start;
}

.rail {
  grid-column: 1 / 4;
  position: sticky;
  top: 132px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rail h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.03em;
  color: var(--dim);
}

.rail-list {
  display: flex;
  flex-direction: column;
}

.rail-list a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 2px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 15px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.86);
  transition: padding-left 0.2s ease, color 0.2s ease;
}

.rail-list a:hover {
  color: var(--paper);
  padding-left: 8px;
}

.prose {
  grid-column: 4 / 13;
  min-width: 0;
  counter-reset: sec;
}

.prose > article {
  counter-increment: sec;
  position: relative;
  margin: 0 0 clamp(16px, 2vw, 26px);
  padding: clamp(20px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  scroll-margin-top: 130px;
  transition: border-color 0.25s ease, box-shadow 0.3s ease, background 0.25s ease;
}

.prose > article:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.07);
}

.prose > article:last-child {
  margin-bottom: 0;
}

.prose > article::before {
  content: counter(sec, decimal-leading-zero);
  position: absolute;
  top: clamp(20px, 3vw, 36px);
  right: clamp(20px, 3vw, 36px);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.42);
}

.prose > article.hit {
  box-shadow: inset 0 0 0 2px var(--paper);
}

.prose h2 {
  margin: 0 0 12px;
  padding-right: 44px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(23px, 2.4vw, 32px);
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.prose h3 {
  margin: 26px 0 8px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.35;
}

.prose p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.84);
}

.prose ul,
.prose ol {
  margin: 0 0 14px;
  padding-left: 20px;
}

.prose li {
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.84);
}

.prose a {
  color: var(--paper);
  text-underline-offset: 3px;
}

.prose blockquote {
  margin: 18px 0;
  padding: 10px 18px;
  border-left: 2px solid var(--paper);
  font-style: italic;
  color: rgba(255, 255, 255, 0.92);
}

.prose figure {
  margin: 16px 0;
}

.prose img {
  margin: 14px 0;
  border-radius: 14px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 16px;
}

.prose th,
.prose td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

.prose code {
  font-family: var(--mono);
  font-size: 15px;
}

.foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 40px) 36px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px 32px;
  align-items: start;
}

.foot-logo {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(30px, 7.6vw, 68px);
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.foot-nav dl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 18px;
  margin: 0;
}

.foot-nav dt {
  flex: 0 0 100%;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.foot-nav dd {
  margin: 0;
}

.foot-nav dd a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  font-family: var(--mono);
  font-size: 15px;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.foot-nav dd a:hover {
  border-bottom-color: var(--paper);
}

.foot-bottom {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 20px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.copy {
  margin: 0;
}

.foot-links {
  display: flex;
  gap: 18px;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
  color: var(--paper);
  border-bottom: 1px solid var(--line);
}

.foot-links a:hover {
  border-bottom-color: var(--paper);
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (max-width: 899px) {
  .menurow {
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 10px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .mainnav {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 6px;
    border-top: 1px solid var(--line-soft);
  }

  .masthead.nav-open .mainnav {
    display: flex;
  }

  .navlink,
  .groupbtn {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 4px;
  }

  .groupbtn {
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.7);
  }

  .dropdown {
    position: static;
    display: flex;
    min-width: 0;
    margin: 0 0 8px 10px;
    padding: 0 0 0 10px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .dropdown a {
    padding: 11px 4px;
  }

  .search {
    display: none;
    order: 4;
    width: 100%;
    margin-left: 0;
  }

  .masthead.nav-open .search {
    display: flex;
  }

  .search-field {
    flex: 1 1 auto;
    width: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 20px;
    padding-top: 26px;
  }

  .hero-copy,
  .hero-figure {
    grid-column: 1 / -1;
  }

  .hero-copy {
    order: 1;
  }

  .hero-figure {
    order: 2;
    min-height: 190px;
  }

  .hero-img {
    aspect-ratio: 16 / 10;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .rail,
  .prose {
    grid-column: 1 / -1;
  }

  .rail {
    position: static;
    padding: 18px;
  }

  .rail-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 6px;
  }

  .rail-list a {
    border-top: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 8px 2px;
    min-height: 40px;
  }

  .prose > article {
    scroll-margin-top: 120px;
  }

  .foot {
    grid-template-columns: 1fr;
  }

  .foot-logo {
    font-size: clamp(28px, 11vw, 46px);
  }

  .prose > article::before {
    top: 18px;
    right: 18px;
  }

  .prose h2 {
    padding-right: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .rail-list a,
  .prose > article {
    transition: none;
  }
}

button[aria-expanded]{min-width:44px;min-height:44px}
