:root {
  color-scheme: light;

  /* Paper & Ink Palette */
  --paper: #F2F0ED;
  /* Warm, off-white architectural paper */
  --ink: #1A1918;
  /* Soft, deep charcoal, not pure black */
  --ink-muted: #66605C;
  /* Secondary text */
  --ink-faint: #B0A8A0;
  /* Tertiary / decorative lines */
  --accent-lime: #C9F16A;
  /* Light salad accent */
  --accent-lime-soft: rgba(201, 241, 106, 0.22);
  --accent: var(--ink);

  /* Dimensions */
  --page-width: 1440px;
  --text-width: 640px;
  --gutter: clamp(24px, 5vw, 64px);

  /* Typography */
  --font-serif: "Instrument Serif", serif;
  --font-sans: "Inter", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 20%, rgba(26, 25, 24, 0.06), transparent 42%),
    radial-gradient(circle at 85% 18%, rgba(26, 25, 24, 0.04), transparent 38%),
    radial-gradient(circle at 18% 82%, rgba(26, 25, 24, 0.05), transparent 40%);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.page {
  position: relative;
  z-index: 1;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* --- Typography System --- */

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  /* Regular weight for that crisp editorial look */
  margin: 0;
  line-height: 1.1;
}

p {
  font-family: var(--font-sans);
  font-size: 18px;
  /* Slightly larger for readability */
  line-height: 1.6;
  margin: 0 0 24px 0;
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  opacity: 0.6;
}

/* --- Header --- */

.site-header {
  padding: 24px 0;
  /* Reduced padding for sticky */
  border-bottom: 1px solid transparent;
  margin-bottom: 0;
  /* Handled by main padding now */
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: transparent;
  /* Initially transparent */
  transition: all 0.3s ease;
  width: 100%;
}

.site-header.scrolled {
  background-color: rgba(242, 240, 237, 0.95);
  border-bottom: 1px solid rgba(26, 25, 24, 0.08);
  backdrop-filter: blur(8px);
  padding: 16px 0 0 0;
  /* Adjusted padding */
  box-shadow: 0 4px 20px rgba(26, 25, 24, 0.02);
}

.site-header.scrolled .header-extension {
  height: 80px;
  /* Fixed height for secondary block */
  opacity: 1;
  margin-top: 16px;
}

.header-extension {
  height: 0;
  opacity: 0;
  overflow: hidden;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--paper);
  /* Ensure background covers content */
  border-top: 1px solid rgba(26, 25, 24, 0.1);
  display: flex;
  /* Centering content */
  align-items: center;
  justify-content: center;
}

#canvas-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  /* Slightly lighter than hero */
}

.header-cta {
  position: relative;
  z-index: 1;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Center for sticky mode */
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  /* Matches .page exactly */
}

.brand {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  position: relative;
  overflow: hidden;
}

.nav-links a:hover {
  color: var(--ink);
  text-shadow: 2px 0 rgba(26, 25, 24, 0.2), -2px 0 rgba(26, 25, 24, 0.2);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--ink);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-links a:hover::after {
  transform: translateX(0);
}

/* --- Hero Section --- */

.hero {
  margin-bottom: 120px;
  padding-top: 140px;
  position: relative;
  border-bottom: 1px solid var(--ink);
  /* Added horizontal line */
  overflow: hidden;
  /* Crop video */
}

.hero-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 32px;
  display: block;
}

/* --- Content Video --- */
.content-video {
  width: 100%;
  height: auto;
  margin-bottom: 32px;
  border: 1px solid var(--ink);
  /* Thin ink border */
  display: block;
  background: #000;
  /* Placeholder */
}

h1 {
  font-size: clamp(64px, 11vw, 128px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 64px;
}

.hero-line {
  display: block;
}

/* --- Button Style (Minimal Outline) --- */
.button {
  display: inline-block;
  padding: 16px 32px;
  border: 1px solid var(--ink);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: transparent;
  transition: all 0.2s ease;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.button:hover {
  /* Glitch-only hover */
  animation: glitch-skew 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

.button:hover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(201, 241, 106, 0.5);
  transform: translate(-2px, 0);
  mix-blend-mode: multiply;
  z-index: -1;
}

.button:hover::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 25, 24, 0.2);
  transform: translate(2px, 0);
  mix-blend-mode: multiply;
  z-index: -1;
}

/* --- Brand Glitch --- */
.brand {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: -0.01em;
  transition: all 0.2s;
  position: relative;
  display: inline-block;
  font-variant-ligatures: common-ligatures discretionary-ligatures;
  /* Improved Typography */
}

.brand:hover {
  /* No global glitch on hover anymore */
  text-shadow: none;
}

.brand:hover .logo-symbol {
  animation: glitch-skew 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
  color: #ff00c1;
  /* Optional highlight for logo */
  text-shadow: 2px 0 #00fff9;
}

.logo-symbol {
  display: inline-block;
  margin-right: 8px;
  font-size: 0.9em;
}

/* Individual letter glitch state */
.brand span:not(.logo-symbol) {
  display: inline-block;
  transition: color 0.1s;
}

.glitch-char {
  font-family: "VT323", monospace !important;
  color: #000;
  text-shadow: 2px 0 #ff00c1, -2px 0 #00fff9;
  transform: translateY(-1px);
}

@keyframes glitch-skew {
  0% {
    transform: skew(0deg);
  }

  20% {
    transform: skew(-10deg);
  }

  40% {
    transform: skew(10deg);
  }

  60% {
    transform: skew(-5deg);
  }

  80% {
    transform: skew(5deg);
  }

  100% {
    transform: skew(0deg);
  }
}

/* --- Manifesto & Content Sections --- */

html.js-enabled main>section {
  margin-bottom: 120px;
  opacity: 0;
  /* Hidden initially for JS reveal */
  transform: translateY(20px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Ensure visibility logic matches previous correct state */
html.js-enabled main>section.visible {
  opacity: 1;
  transform: translateY(0);
}

main>section {
  margin-bottom: 120px;
  /* Fallback margin if JS disabled */
}

section h2 {
  font-size: clamp(32px, 4vw, 48px);
  margin-bottom: 64px;
  max-width: var(--text-width);
}

.accent-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "VT323", monospace;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink);
  margin-bottom: 18px;
}

.accent-mark::before {
  content: "◆";
  font-size: 12px;
  opacity: 0.7;
}

.copy {
  max-width: var(--text-width);
  margin-left: 0;
}

/* --- Utilities & Décor --- */

/* --- Text Glitch Dividers (Watchdogs Style) --- */

.text-divider {
  font-family: "VT323", "Courier New", monospace;
  text-align: left;
  margin: 36px 0 24px;
  color: #000000;
  font-size: 16px;
  letter-spacing: 0.1em;
  font-weight: 400;
  opacity: 1;
  user-select: none;
  position: relative;
  width: 100%;
  max-width: var(--page-width);
  overflow: visible;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 2px;
  line-height: 1;
}

.divider-content {
  display: inline-block;
  position: relative;
  padding: 0;
}

.divider-content::before,
.divider-content::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--paper);
}

.divider-content::before {
  left: 2px;
  text-shadow: -2px 0 rgba(201, 241, 106, 0.6);
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim 2s infinite linear alternate-reverse;
}

.divider-content::after {
  left: -2px;
  text-shadow: -2px 0 rgba(26, 25, 24, 0.25);
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim2 3s infinite linear alternate-reverse;
}

.glitch-deco {
  display: inline-block;
  font-size: 14px;
  color: #000;
  margin-top: 6px;
  opacity: 0.7;
  animation: blink 0.1s infinite alternate;
}

@keyframes blink {
  0% {
    opacity: 0.7;
  }

  100% {
    opacity: 0.3;
  }
}

@keyframes glitch-anim {
  0% {
    clip: rect(38px, 9999px, 81px, 0);
    transform: skew(0.85deg);
  }

  5% {
    clip: rect(49px, 9999px, 8px, 0);
    transform: skew(0.06deg);
  }

  10% {
    clip: rect(69px, 9999px, 92px, 0);
    transform: skew(0.36deg);
  }

  15% {
    clip: rect(10px, 9999px, 4px, 0);
    transform: skew(0.46deg);
  }

  20% {
    clip: rect(46px, 9999px, 78px, 0);
    transform: skew(0.96deg);
  }

  25% {
    clip: rect(47px, 9999px, 14px, 0);
    transform: skew(0.81deg);
  }

  30% {
    clip: rect(12px, 9999px, 42px, 0);
    transform: skew(0.49deg);
  }

  35% {
    clip: rect(51px, 9999px, 91px, 0);
    transform: skew(0.51deg);
  }

  40% {
    clip: rect(46px, 9999px, 32px, 0);
    transform: skew(0.84deg);
  }

  45% {
    clip: rect(83px, 9999px, 44px, 0);
    transform: skew(0.09deg);
  }

  50% {
    clip: rect(31px, 9999px, 44px, 0);
    transform: skew(0.53deg);
  }

  55% {
    clip: rect(72px, 9999px, 46px, 0);
    transform: skew(0.5deg);
  }

  60% {
    clip: rect(11px, 9999px, 63px, 0);
    transform: skew(0.18deg);
  }

  65% {
    clip: rect(96px, 9999px, 3px, 0);
    transform: skew(0.5deg);
  }

  70% {
    clip: rect(68px, 9999px, 98px, 0);
    transform: skew(0.92deg);
  }

  75% {
    clip: rect(1px, 9999px, 44px, 0);
    transform: skew(0.58deg);
  }

  80% {
    clip: rect(52px, 9999px, 81px, 0);
    transform: skew(0.87deg);
  }

  85% {
    clip: rect(2px, 9999px, 93px, 0);
    transform: skew(0.56deg);
  }

  90% {
    clip: rect(78px, 9999px, 7px, 0);
    transform: skew(0.95deg);
  }

  95% {
    clip: rect(21px, 9999px, 45px, 0);
    transform: skew(0.24deg);
  }

  100% {
    clip: rect(93px, 9999px, 74px, 0);
    transform: skew(0.02deg);
  }
}

@keyframes glitch-anim2 {
  0% {
    clip: rect(27px, 9999px, 16px, 0);
  }

  20% {
    clip: rect(6px, 9999px, 81px, 0);
  }

  40% {
    clip: rect(48px, 9999px, 33px, 0);
  }

  60% {
    clip: rect(22px, 9999px, 88px, 0);
  }

  80% {
    clip: rect(33px, 9999px, 7px, 0);
  }

  100% {
    clip: rect(9px, 9999px, 91px, 0);
  }
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--ink);
  color: var(--paper);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- Partners Grid --- */

.partners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid rgba(26, 25, 24, 0.1);
  border-left: 1px solid rgba(26, 25, 24, 0.1);
}

.partners-grid li {
  padding: 40px;
  border-right: 1px solid rgba(26, 25, 24, 0.1);
  border-bottom: 1px solid rgba(26, 25, 24, 0.1);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 200px;
}

.partner-logo {
  max-width: 120px;
  height: auto;
  margin-bottom: 24px;
  filter: grayscale(100%);
  opacity: 0.8;
  transition: opacity 0.3s;
}

.partners-grid li:hover .partner-logo {
  opacity: 1;
}

.partners-grid span {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}

.partners-grid a {
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(26, 25, 24, 0.2);
}

/* --- Footer --- */

.site-footer {
  border-top: 1px solid rgba(26, 25, 24, 0.1);
  padding: 64px 0 120px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 14px;
  color: var(--ink-muted);
}

.footer-links {
  display: flex;
  gap: 32px;
}

/* Mobile Tweaks */
@media (max-width: 768px) {
  .nav {
    flex-direction: column;
    gap: 24px;
  }

  .nav-links {
    flex-direction: column;
    gap: 16px;
  }

  .hero {
    margin-bottom: 100px;
  }

  .site-footer {
    flex-direction: column;
    gap: 32px;
  }
}

/* --- LEAVE THIS AT THE END --- */

/* --- Network States Directory --- */

.network-states-directory {
  margin-bottom: 120px;
  position: relative;
  overflow: hidden;
}

.network-states-directory::before,
.network-states-directory::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, var(--accent-lime), transparent 60%);
  opacity: 0.35;
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}

.network-states-directory::before {
  top: -40px;
  right: -60px;
}

.network-states-directory::after {
  bottom: -80px;
  left: -40px;
}

.ns-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.ns-card {
  background-color: #F7F5F2;
  /* Slightly lighter/different paper tone */
  border: 1px solid rgba(26, 25, 24, 0.2);
  padding: 18px;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.ns-card::before {
  /* Decorative "Stamp" or corner mark */
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 1px dashed rgba(26, 25, 24, 0.15);
  border-radius: 50%;
  pointer-events: none;
}

.ns-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--accent-lime), transparent 80%);
  opacity: 0.7;
  pointer-events: none;
}

.ns-card:hover {
  transform: translateY(-3px);
  box-shadow: 6px 10px 18px rgba(0, 0, 0, 0.08);
  border-color: rgba(26, 25, 24, 0.55);
}

.ns-card.is-clickable {
  cursor: pointer;
}

.ns-card.is-clickable:focus-visible {
  outline: 2px solid var(--accent-lime);
  outline-offset: 3px;
}

.ns-card-header {
  border-bottom: 1px double rgba(26, 25, 24, 0.1);
  padding-bottom: 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.ns-name {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 0;
  line-height: 1.2;
}

.ns-category {
  font-family: "VT323", monospace;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px solid rgba(26, 25, 24, 0.2);
  background-color: var(--accent-lime-soft);
  padding: 2px 6px;
  border-radius: 2px;
}

.ns-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ns-location {
  font-family: "VT323", monospace;
  font-size: 14px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ns-description {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ns-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed rgba(26, 25, 24, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ns-visa-link {
  font-family: "VT323", monospace;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.ns-visa-link:hover {
  border-bottom-color: var(--accent-lime);
}

.ns-card.is-clickable:hover .ns-visa-link {
  color: var(--accent);
}

.ns-id {
  font-family: "VT323", monospace;
  font-size: 12px;
  color: rgba(26, 25, 24, 0.4);
}
