:root {
  --ink: #0b0f0e;
  --paper: #f4f5f2;
  --teal: #17a398;
  --teal-dark: #0e766d;
  --copper: #c97a3d;
  --muted: #93a19c;
  --line: rgba(244, 245, 242, 0.14);
  --glass: rgba(244, 245, 242, 0.07);
  --glass-strong: rgba(244, 245, 242, 0.14);
  --glass-blur: 18px;
  --radius: 0;
  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  --pad-x: clamp(20px, 3.52vw, 64px);
  --nav-top: clamp(16px, 2.05vw, 28px);
  --btn-icon: 36px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-display);
  background: var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; background: none; border: none; padding: 0; cursor: pointer; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

/* ---------- page shell ---------- */
.page {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--nav-top) var(--pad-x) clamp(28px, 4.9vw, 48px);
}

.bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--ink);
  pointer-events: none;
  overflow: hidden;
}
.bg-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.bg-trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.bg-trace path {
  fill: none;
  stroke: var(--teal);
  stroke-width: 1;
  opacity: 0.16;
  animation: trace-pulse 7s ease-in-out infinite;
}
.bg-trace--2 path { stroke: var(--copper); animation-delay: 1.6s; }
.bg-trace--3 path { animation-delay: 3.2s; }

.nav, .hero, .lede, .mobile-menu { position: relative; z-index: 1; }

/* ---------- nav ---------- */
.nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.nav__links {
  display: flex;
  gap: clamp(20px, 2.4vw, 30px);
  justify-self: start;
  padding: 20px 30px;
  background: var(--glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.nav__links a {
  position: relative;
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.15vw, 13px);
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  padding-bottom: 2px;
  opacity: 0;
  animation: link-in 0.55s var(--ease) both;
  animation-delay: var(--d, 0s);
}
.nav__links a:nth-child(1) { --d: 0.02s; }
.nav__links a:nth-child(2) { --d: 0.08s; }
.nav__links a:nth-child(3) { --d: 0.14s; }
.nav__links a:nth-child(4) { --d: 0.2s; }
.nav__links a:hover { color: var(--teal); transform: translateY(-2px); }
.nav__links a { transition: color 0.22s var(--ease), transform 0.22s var(--ease); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: var(--teal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.nav__links a:hover::after { transform: scaleX(1); }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
}
.logo__mark {
  width: clamp(28px, 3vw, 34px);
  height: clamp(28px, 3vw, 34px);
  overflow: visible;
  transition: transform 0.35s var(--ease);
}
.logo:hover .logo__mark { transform: scale(1.08); }
.logo__mark > * {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: mark-in 0.5s var(--ease) both;
}
.logo__ring { fill: none; stroke: var(--glass-strong); stroke-width: 1.4; animation-delay: 0.04s; }
.logo__north { fill: var(--teal); animation-delay: 0.09s; }
.logo__south { fill: rgba(244, 245, 242, 0.4); animation-delay: 0.14s; }
.logo__via { fill: var(--ink); stroke: var(--paper); stroke-width: 1; animation-delay: 0.19s; }
.logo__tip { fill: var(--copper); animation-delay: 0.24s; }
.logo__word {
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.2vw, 14px);
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  animation: link-in 0.55s var(--ease) both;
  animation-delay: 0.22s;
}

.nav__right { display: flex; align-items: center; gap: 14px; justify-self: end; }

.nav__burger {
  display: none;
  width: 36px;
  height: 36px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  opacity: 0;
  animation: link-in 0.5s var(--ease) both;
}
.nav__burger span { width: 18px; height: 1.5px; background: var(--paper); transition: background 0.2s, width 0.2s; }
.nav__burger:hover { transform: scale(1.08); }
.nav__burger:hover span { background: var(--teal); }
.nav__burger:hover span:first-child,
.nav__burger:hover span:last-child { width: 14px; }

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 0 0.5rem;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  padding: 16px 20px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
}

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 54px;
  border-radius: var(--radius);
  padding: 12px 10px 12px 22px;
  gap: 16px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}
.btn span:not(.btn__icon) { position: relative; z-index: 1; }
.btn__icon {
  position: relative;
  z-index: 1;
  width: var(--btn-icon);
  height: var(--btn-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn__icon svg { width: 14px; height: 14px; }
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
  pointer-events: none;
  z-index: 0;
}
.btn:hover::before { transform: scaleX(1); }

.btn--nav { background: var(--teal); color: var(--ink); }
.btn--nav .btn__icon { background: var(--teal-dark); color: var(--paper); }
.btn--nav::before { background: var(--teal-dark); }
.btn--nav:hover .btn__icon { background: var(--paper); color: var(--teal-dark); }

.btn--light { background: var(--paper); color: var(--ink); }
.btn--light .btn__icon { background: var(--ink); color: var(--paper); }
.btn--light::before { background: #dbe7e5; }
.btn--light:hover .btn__icon { background: var(--teal); color: var(--paper); }

.btn--ghost {
  padding: 12px 26px;
  color: var(--paper);
  background: rgba(244, 245, 242, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
}
.btn--ghost::before { background: rgba(244, 245, 242, 0.14); z-index: 0; }

.wipe { clip-path: inset(0 100% 0 0); animation: wipe-in 0.7s var(--ease) both; animation-delay: var(--d, 0s); }

/* ---------- hero ---------- */
.hero { margin-top: clamp(52px, 10.15vh, 92px); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: clamp(34px, 3.6vw, 42px);
  padding: 0 18px 0 14px;
  background: var(--glass);
  border: 1px solid rgba(23, 163, 152, 0.3);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.25vw, 13px);
  letter-spacing: 0.02em;
  color: var(--paper);
}
.badge__dot { width: 14px; height: 14px; border: 2px solid var(--teal); flex: none; }

.headline {
  margin-top: clamp(22px, 2.8vw, 36px);
  font-size: calc(clamp(2.9rem, 5.9vw, 5rem) + 3px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.headline__mask { display: block; overflow: hidden; }
.headline__rise {
  display: inline-block;
  transform: translate3d(0, 118%, 0);
  animation: type-rise 0.85s var(--ease) both;
  animation-delay: var(--d, 0s);
}
.headline__line { display: flex; gap: 0.32em; flex-wrap: wrap; }
.headline__muted { color: var(--muted); font-weight: 600; }

.headline__accent {
  position: relative;
  color: var(--muted);
}
.headline__accent::before,
.headline__accent::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 60px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 60px), transparent 100%);
  -webkit-mask-size: 0% 100%;
  mask-size: 0% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.headline__accent::before { color: var(--teal); animation: accent-fill 1.05s cubic-bezier(0.4, 0, 0.2, 1) 0.7s forwards; }
.headline__accent::after { color: var(--copper); animation: accent-fill 1.05s cubic-bezier(0.4, 0, 0.2, 1) 1.08s forwards; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(28px, 3.4vw, 42px); }

/* ---------- lede ---------- */
.lede {
  margin-top: auto;
  max-width: 640px;
  overflow: hidden;
  color: var(--paper);
  font-size: clamp(17px, 1.8vw, 20px);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.lede__rise {
  display: inline-block;
  transform: translate3d(0, 40%, 0);
  opacity: 0;
  animation: lede-rise 0.9s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}

/* ---------- keyframes ---------- */
@keyframes mark-in { from { opacity: 0; transform: translate3d(-12px, 8px, 0); } to { opacity: 1; transform: none; } }
@keyframes link-in { from { opacity: 0; transform: translate3d(-16px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes wipe-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes type-rise { from { transform: translate3d(0, 118%, 0); } to { transform: translate3d(0, 0, 0); } }
@keyframes lede-rise { from { opacity: 0; transform: translate3d(0, 40%, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }
@keyframes accent-fill { from { -webkit-mask-size: 0% 100%; mask-size: 0% 100%; } to { -webkit-mask-size: calc(100% + 60px) 100%; mask-size: calc(100% + 60px) 100%; } }
@keyframes trace-pulse { 0%, 100% { opacity: 0.08; } 50% { opacity: 0.22; } }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  html, body { overflow: auto; }
  .page { height: auto; min-height: 100vh; min-height: 100dvh; }
  .nav__links, .btn--nav { display: none; }
  .nav { grid-template-columns: auto 1fr auto; }
  .logo { justify-self: start; }
  .nav__burger { display: flex; }
  .mobile-menu:not([hidden]) { display: flex; }
  .hero { margin-top: 48px; }
  .headline { font-size: calc(clamp(2.75rem, 10vw, 3.85rem) + 3px); }
  .lede { width: 100%; max-width: 700px; margin-top: 64px; }
}

@media (max-height: 700px) and (min-width: 821px) {
  .hero { margin-top: 36px; }
  .headline { font-size: calc(clamp(2.75rem, 7.2vh, 4.15rem) + 3px); }
}

@media (prefers-reduced-motion: reduce) {
  .wipe, .headline__rise, .lede__rise, .logo__mark > *, .nav__links a, .logo__word, .nav__burger,
  .bg-trace path {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
  .headline__accent { color: var(--teal); }
  .headline__accent::before, .headline__accent::after { content: none; }
}
