:root {
  --bg: #000000;
  --fg: rgba(255, 255, 255, 0.96);
  --soft: rgba(255, 255, 255, 0.62);
  --line: rgba(255, 255, 255, 0.18);
  --line-strong: rgba(255, 255, 255, 0.78);
  --panel: rgba(0, 0, 0, 0.34);
  --panel-border: rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  color: var(--fg);
  overflow: hidden;
  font-family: Inter, system-ui, sans-serif;
}

canvas,
.scanlines,
.vignette,
.shell {
  position: fixed;
  inset: 0;
}

#scene {
  width: 100%;
  height: 100%;
  background: #000;
}

.scanlines {
  pointer-events: none;
  opacity: 0.18;
  background-image: linear-gradient(to bottom, rgba(255,255,255,0.055) 0px, rgba(255,255,255,0.055) 1px, transparent 1px, transparent 4px);
  mix-blend-mode: screen;
}

.vignette {
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 42%, rgba(0,0,0,0.18) 70%, rgba(0,0,0,0.62) 100%);
}

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 540px) minmax(320px, 470px);
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 40px;
  pointer-events: none;
}

.card {
  width: min(540px, calc(100vw - 48px));
  padding: 22px 24px 24px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(0,0,0,0.08), var(--panel));
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025), 0 0 80px rgba(255,255,255,0.04);
  pointer-events: auto;
}

.kicker {
  margin: 0 0 14px;
  color: var(--soft);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
}

h1 {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  line-height: 0.92;
  font-weight: 400;
  letter-spacing: -0.06em;
}

.tagline {
  margin: 16px 0 0;
  max-width: 30rem;
  color: var(--soft);
  line-height: 1.7;
  font-size: 0.98rem;
}

.links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--fg);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.links a:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.42);
  transform: translateY(-1px);
}

.feature-card {
  position: relative;
  display: grid;
  min-height: 430px;
  padding: 22px 24px 20px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  color: var(--fg);
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(255,255,255,0.035) 50%, transparent 50.2%),
    linear-gradient(transparent 49.8%, rgba(255,255,255,0.035) 50%, transparent 50.2%),
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.48));
  background-size: 54px 54px, 54px 54px, auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025), 0 0 80px rgba(255,255,255,0.04);
  text-decoration: none;
  text-align: left;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  transition: border-color 220ms ease, background-color 220ms ease, transform 220ms ease;
}

.feature-card::before,
.feature-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
  transition: transform 420ms ease;
}

.feature-card::before {
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(255,255,255,0.72);
  transform: scaleX(0.18);
  transform-origin: left;
}

.feature-card::after {
  right: 22px;
  bottom: 20px;
  width: 62px;
  height: 62px;
  border-right: 1px solid rgba(255,255,255,0.12);
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.feature-card:hover,
.feature-card:focus-visible {
  border-color: rgba(255,255,255,0.44);
  outline: none;
  background-color: rgba(255,255,255,0.025);
  transform: translateY(-3px);
}

.feature-card:hover::before,
.feature-card:focus-visible::before {
  transform: scaleX(1);
}

.feature-card:hover::after,
.feature-card:focus-visible::after {
  transform: translate(-4px, -4px);
}

.feature-meta,
.feature-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--soft);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
}

.feature-meta > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(255,255,255,0.84);
  border-radius: 50%;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 0 10px rgba(255,255,255,0.62);
  animation: live-pulse 2.4s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 0.38; transform: scale(0.84); }
  50% { opacity: 1; transform: scale(1); }
}

.feature-title {
  position: relative;
  z-index: 2;
  align-self: center;
  padding: 28px 0 24px;
}

.feature-title > p:first-child {
  margin: 0 0 12px;
  color: var(--soft);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
}

.feature-title h2 {
  margin: 0;
  color: transparent;
  font-size: clamp(2rem, 3.7vw, 3.6rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.91;
  -webkit-text-stroke: 1px rgba(255,255,255,0.9);
}

.feature-title h2 em {
  color: rgba(255,255,255,0.94);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  -webkit-text-stroke: 0;
}

.feature-copy {
  max-width: 25rem;
  margin: 18px 0 0;
  color: var(--soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.87rem;
  line-height: 1.55;
}

.feature-path {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: stretch;
  margin-bottom: 22px;
}

.feature-path > span {
  display: grid;
  flex: 1;
  place-items: center;
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.48);
}

.feature-path small {
  color: rgba(255,255,255,0.42);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.44rem;
  letter-spacing: 0.1em;
}

.feature-path strong {
  margin-top: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-weight: 400;
}

.feature-path > b {
  display: grid;
  place-items: center;
  width: 20px;
  color: rgba(255,255,255,0.38);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  font-weight: 400;
}

.feature-footer {
  align-self: end;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.5rem;
}

.feature-footer strong {
  color: rgba(255,255,255,0.88);
  font-weight: 400;
  white-space: nowrap;
}

.formulation-portal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  grid-template-rows: 54px 1fr;
  visibility: hidden;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.992);
  transition: opacity 260ms ease, transform 360ms ease, visibility 360ms;
}

body.formulation-open {
  overflow: hidden;
}

body.formulation-open .formulation-portal {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.formulation-header {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 180px 1fr 180px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.94);
  font-family: "IBM Plex Mono", monospace;
}

.formulation-header > button,
.formulation-header > a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  padding: 0 14px;
  border: 0;
  color: rgba(255,255,255,0.64);
  background: transparent;
  font: inherit;
  font-size: 0.58rem;
  letter-spacing: 0.11em;
  text-decoration: none;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.formulation-header > button {
  border-right: 1px solid rgba(255,255,255,0.12);
}

.formulation-header > a {
  border-left: 1px solid rgba(255,255,255,0.12);
}

.formulation-header > button:hover,
.formulation-header > a:hover {
  color: #fff;
  background: rgba(255,255,255,0.055);
}

.formulation-header > div {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.formulation-header small {
  color: rgba(255,255,255,0.34);
  font-size: 0.48rem;
  letter-spacing: 0.16em;
}

.formulation-header strong {
  color: rgba(255,255,255,0.84);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.86rem;
  font-weight: 400;
}

.formulation-frame-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

.formulation-frame-shell iframe {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  opacity: 0;
  transition: opacity 320ms ease;
}

.formulation-frame-shell.is-loaded iframe {
  opacity: 1;
}

.formulation-loading {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: rgba(255,255,255,0.72);
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    #000;
  background-size: 72px 72px;
  transition: opacity 260ms ease;
}

.formulation-loading span {
  color: transparent;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 8vw, 7rem);
  -webkit-text-stroke: 1px rgba(255,255,255,0.82);
}

.formulation-loading small {
  color: rgba(255,255,255,0.36);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.52rem;
  letter-spacing: 0.2em;
}

.formulation-frame-shell.is-loaded .formulation-loading {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .shell {
    position: relative;
    grid-template-columns: 1fr;
    align-content: end;
    min-height: 100svh;
    padding-top: 84px;
    overflow-y: auto;
  }

  .card,
  .feature-card {
    width: min(620px, 100%);
  }

  .feature-card {
    justify-self: end;
    min-height: 390px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 18px;
    padding-top: 72px;
    align-items: flex-end;
  }

  .card {
    padding: 18px;
  }

  .tagline {
    font-size: 0.92rem;
  }

  .feature-card {
    min-height: 410px;
    padding: 18px;
  }

  .feature-title h2 {
    font-size: clamp(2rem, 11vw, 3.15rem);
  }

  .feature-path {
    overflow-x: auto;
  }

  .feature-path > span {
    flex: 0 0 82px;
  }

  .feature-footer > span:first-child {
    display: none;
  }

  .feature-footer {
    justify-content: flex-end;
  }

  .formulation-portal {
    grid-template-rows: 48px 1fr;
  }

  .formulation-header {
    grid-template-columns: 54px 1fr 54px;
  }

  .formulation-header > button,
  .formulation-header > a {
    padding: 0;
    font-size: 0;
  }

  .formulation-header > button span {
    font-size: 1rem;
  }

  .formulation-header > a::after {
    content: "↗";
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
  }

  .formulation-header small {
    display: none;
  }

  .formulation-header strong {
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
