@font-face {
  font-family: 'NType82';
  src: url('/fonts/NType82-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --black: #000000;
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f0f0f0;
  --gray-200: #e0e0e0;
  --gray-300: #c0c0c0;
  --gray-400: #909090;
  --gray-500: #707070;
  --gray-600: #505050;
  --gray-700: #303030;
  --gray-800: #1a1a1a;
  --gray-900: #0d0d0d;
  --font-display: 'NType82', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --font-body: 'DM Sans', sans-serif;
}

::selection {
  background: var(--white);
  color: var(--black);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  overflow-x: hidden;
  line-height: 1.7;
}

/* ─── Noise overlay ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--gray-600); border-radius: 2px; }

/* ─── Layout ─── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}

/* ─── Nav ─── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--white);
}

.nav-logo svg {
  width: 34px;
  height: 34px;
}

.nav-logo span {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  text-decoration: none;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--white);
  transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--white); }
.nav-links a:hover::after { width: 100%; }
.nav-links a:focus-visible { outline: 1px solid var(--white); outline-offset: 4px; }

.nav-cta {
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  padding: 8px 20px !important;
  background: var(--white) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  border-radius: 0 !important;
  color: var(--black) !important;
  text-decoration: none !important;
  transition: background 0.3s ease, border-color 0.3s ease !important;
}

.nav-cta:hover {
  background: rgba(255,255,255,0.85) !important;
  border-color: var(--white) !important;
}

.nav-cta:focus-visible {
  outline: 1px solid var(--white);
  outline-offset: 4px;
}

.nav-cta::after { display: none !important; }

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 16px 40px;
  background: var(--white);
  color: var(--black);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255,255,255,0.15);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible { outline: 2px solid var(--white); outline-offset: 4px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 32px;
  background: transparent;
  color: var(--white);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.btn-secondary:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.04);
}

.btn-secondary:focus-visible { outline: 1px solid var(--white); outline-offset: 4px; }

/* ─── Footer ─── */
footer {
  padding: 48px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-left svg {
  width: 20px;
  height: 20px;
  opacity: 0.4;
}

.footer-left span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-500);
  letter-spacing: 0.05em;
}

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-links a:hover { color: var(--white); }
.footer-links a:focus-visible { outline: 1px solid var(--white); outline-offset: 4px; }

/* ─── Animations ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Article Layout ─── */
.article-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}

/* ─── Banner ─── */
.article-banner {
  position: relative;
  height: 280px;
  overflow: hidden;
  margin-top: 72px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.article-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.75;
}

.article-banner::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 260px;
  background: linear-gradient(to top, var(--black) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
  z-index: 1;
}

.article-header {
  position: relative;
  z-index: 2;
  margin-top: -120px;
  padding: 0 0 48px;
}

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.breadcrumb a {
  color: var(--gray-400);
  text-decoration: none;
  transition: color 0.3s ease;
}

.breadcrumb a:hover { color: var(--white); }
.breadcrumb a:focus-visible { outline: 1px solid var(--white); outline-offset: 4px; }

.breadcrumb .sep {
  margin: 0 8px;
  color: var(--gray-600);
}

.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-500);
  opacity: 0;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

/* ─── Table of Contents ─── */
.toc {
  background: var(--gray-900);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 20px 24px;
  margin-top: 32px;
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 16px;
}

.toc-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  counter-reset: toc;
}

.toc-list li {
  counter-increment: toc;
}

.toc-list a {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--gray-400);
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.2s ease;
}

.toc-list a::before {
  content: counter(toc) ". ";
  color: var(--gray-600);
  font-family: var(--font-mono);
  font-size: 11px;
}

.toc-list a:hover {
  color: var(--white);
}

.toc-list a:focus-visible {
  outline: 1px solid var(--white);
  outline-offset: 2px;
}

/* ─── Article Body ─── */
.article-body {
  padding-bottom: 72px;
}

.article-body p {
  font-size: 16px;
  color: var(--gray-300);
  line-height: 1.7;
  margin-bottom: 24px;
}

.article-body a {
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255,255,255,0.3);
  transition: text-decoration-color 0.3s ease;
}

.article-body a:hover {
  text-decoration-color: var(--white);
}

.article-body a:focus-visible {
  outline: 1px solid var(--white);
  outline-offset: 2px;
}

.article-body h2 {
  scroll-margin-top: 100px;
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 56px;
  margin-bottom: 16px;
  padding-top: 40px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.article-body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.article-body strong {
  color: var(--white);
  font-weight: 500;
}

/* ─── Callout ─── */
.callout {
  background: var(--gray-900);
  border-left: 2px solid var(--white);
  padding: 24px 28px;
  margin: 40px 0;
}

.callout-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 12px;
}

.callout p {
  font-size: 14px;
  color: var(--gray-400);
  margin-bottom: 0;
}

/* ─── Next Links ─── */
.article-body a.next-link {
  text-decoration: none;
}

.next-links {
  display: grid;
  gap: 4px;
  margin-top: 24px;
}

.next-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--gray-900);
  border: 1px solid rgba(255,255,255,0.04);
  text-decoration: none;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.next-link:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02);
}

.next-link:focus-visible {
  outline: 1px solid var(--white);
  outline-offset: -1px;
}

.next-link .arrow {
  color: var(--gray-600);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
}

.next-link:hover .arrow {
  transform: translateX(4px);
  color: var(--white);
}

.next-link.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.next-link-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-500);
  display: block;
  margin-top: 4px;
}

/* ─── Lightbox ─── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: zoom-out;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
}

.lightbox.open img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--gray-400);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 8px 16px;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.lightbox-close:hover {
  color: var(--white);
  border-color: rgba(255,255,255,0.4);
}

.lightbox-close:focus-visible {
  outline: 1px solid var(--white);
  outline-offset: 4px;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .nav-links li:not(:last-child) { display: none; }
  .nav-links { gap: 0; }
}

@media (max-width: 600px) {
  .container { padding: 0 20px; }
  .article-container { padding: 0 20px; }

  .site-nav { padding: 14px 0; }
  .nav-logo svg { width: 36px; height: 36px; }
  .nav-logo span { display: none; }

  .article-banner { height: 200px; margin-top: 60px; }
  .article-banner::after { height: 180px; background: linear-gradient(to top, var(--black) 0%, rgba(0,0,0,0.85) 60%, transparent 100%); }
  .article-header { margin-top: -130px; padding: 0 0 32px; }
  .article-header h1 { font-size: clamp(28px, 8vw, 36px); }

  .toc { padding: 16px 20px; }
  .toc-list { grid-template-columns: 1fr; }
  .toc-list a { font-size: 13px; padding: 5px 0; }

  .article-body h2 {
    margin-top: 40px;
    padding-top: 28px;
  }

  .article-body p { font-size: 15px; }

  .callout { padding: 20px; }

  .next-link { padding: 16px 20px; font-size: 11px; }

  footer { padding: 32px 0; }
  footer .container {
    flex-direction: column;
    gap: 20px;
    text-align: center;
    align-items: center;
  }
  .footer-left { justify-content: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; gap: 16px; }
}

@media (max-width: 380px) {
  .container { padding: 0 16px; }
  .article-container { padding: 0 16px; }
}
