:root {
  color-scheme: dark;
  --bg: #08090b;
  --surface: #11151b;
  --surface-soft: #171d25;
  --panel-bg: rgba(17, 21, 27, 0.78);
  --frame-bg: rgba(17, 21, 27, 0.86);
  --button-bg: rgba(255, 255, 255, 0.04);
  --button-hover: rgba(110, 231, 216, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f6f1e8;
  --muted: #aeb6c2;
  --dim: #6f7a87;
  --accent: #6ee7d8;
  --accent-2: #f0c35a;
  --danger: #ff8b78;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --glow-1: rgba(110, 231, 216, 0.14);
  --glow-2: rgba(240, 195, 90, 0.1);
  --demo-bg: #07080a;
  --focus: rgba(110, 231, 216, 0.32);
  --max: 1180px;
  --radius: 8px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f6f2ea;
    --surface: #ffffff;
    --surface-soft: #eee7dc;
    --panel-bg: rgba(255, 255, 255, 0.78);
    --frame-bg: rgba(255, 255, 255, 0.9);
    --button-bg: rgba(10, 16, 22, 0.04);
    --button-hover: rgba(11, 126, 115, 0.1);
    --line: rgba(13, 24, 34, 0.14);
    --line-strong: rgba(13, 24, 34, 0.24);
    --text: #111820;
    --muted: #586472;
    --dim: #76808c;
    --accent: #0b7e73;
    --accent-2: #b27b07;
    --danger: #b83a27;
    --shadow: 0 24px 70px rgba(47, 40, 30, 0.14);
    --glow-1: rgba(11, 126, 115, 0.14);
    --glow-2: rgba(178, 123, 7, 0.12);
    --demo-bg: #ebe4da;
    --focus: rgba(11, 126, 115, 0.26);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f2ea;
  --surface: #ffffff;
  --surface-soft: #eee7dc;
  --panel-bg: rgba(255, 255, 255, 0.78);
  --frame-bg: rgba(255, 255, 255, 0.9);
  --button-bg: rgba(10, 16, 22, 0.04);
  --button-hover: rgba(11, 126, 115, 0.1);
  --line: rgba(13, 24, 34, 0.14);
  --line-strong: rgba(13, 24, 34, 0.24);
  --text: #111820;
  --muted: #586472;
  --dim: #76808c;
  --accent: #0b7e73;
  --accent-2: #b27b07;
  --danger: #b83a27;
  --shadow: 0 24px 70px rgba(47, 40, 30, 0.14);
  --glow-1: rgba(11, 126, 115, 0.14);
  --glow-2: rgba(178, 123, 7, 0.12);
  --demo-bg: #ebe4da;
  --focus: rgba(11, 126, 115, 0.26);
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, var(--glow-1), transparent 26rem),
    linear-gradient(220deg, var(--glow-2), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.hero,
.showcase-grid,
.footer {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  min-height: 82svh;
  display: grid;
  align-content: center;
  gap: 42px;
  padding: 26px 0 72px;
}

.topbar {
  position: absolute;
  top: 26px;
  left: 50%;
  width: min(var(--max), calc(100% - 40px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transform: translateX(-50%);
}

.brand,
.nav-links,
.theme-dock,
.theme-option {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  font-weight: 850;
  text-decoration: none;
}

.brand-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 28px rgba(110, 231, 216, 0.7);
}

.nav-links {
  gap: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.theme-dock {
  position: fixed;
  left: 18px;
  top: 74px;
  z-index: 20;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.theme-option {
  min-height: 38px;
  gap: 7px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.theme-option span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}

.theme-option:hover,
.theme-option:focus-visible {
  color: var(--text);
}

.theme-option[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

.theme-option[aria-pressed="true"] span {
  opacity: 1;
}

.nav-links a,
.footer a {
  text-decoration: none;
}

.nav-links a:hover,
.footer a:hover {
  color: var(--text);
}

.hero-copy {
  max-width: 860px;
  padding-top: 86px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: 0;
}

h1 {
  font-size: 7.4rem;
}

h2 {
  font-size: 3.9rem;
}

h3 {
  font-size: 1.15rem;
}

.hero-line {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.28rem;
}

.text-toggle {
  position: relative;
  margin-top: 34px;
  padding: 0 0 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 850;
  cursor: pointer;
}

.text-toggle span {
  position: relative;
  display: inline-block;
}

.text-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.text-toggle:hover span::after,
.text-toggle:focus-visible span::after,
.text-toggle[aria-expanded="true"] span::after {
  transform: scaleX(1);
}

.text-toggle:focus-visible,
.button:focus-visible,
.theme-option:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 5px;
}

.story-panel {
  max-width: 760px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.story-panel[hidden] {
  display: none;
}

.story-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.showcase-grid {
  display: grid;
  gap: 72px;
  padding-bottom: 86px;
}

.project {
  display: grid;
  gap: 22px;
}

.project-head {
  max-width: 760px;
}

.project-head p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.demo-frame,
.tech-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--frame-bg);
  box-shadow: var(--shadow);
}

.demo-toolbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.demo-title,
.demo-url {
  display: block;
}

.demo-title {
  font-weight: 850;
}

.demo-url {
  margin-top: 3px;
  color: var(--dim);
  font-size: 0.9rem;
}

.demo-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--button-bg);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover {
  border-color: rgba(110, 231, 216, 0.72);
  background: var(--button-hover);
  transform: translateY(-1px);
}

.button-primary {
  border-color: rgba(110, 231, 216, 0.86);
  background: var(--accent);
  color: #04100f;
}

.button-primary:hover {
  background: #91f2e7;
}

.demo-viewport {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 280px;
  background:
    linear-gradient(135deg, var(--glow-1), transparent 42%),
    linear-gradient(225deg, var(--glow-2), transparent 44%),
    var(--demo-bg);
}

.demo-viewport:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}

.demo-viewport:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}

.demo-viewport iframe {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  opacity: 0;
  transition: opacity 180ms ease;
}

.demo-viewport.is-loaded iframe {
  opacity: 1;
}

.demo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 26px;
  text-align: center;
}

.demo-placeholder span {
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.demo-placeholder strong {
  font-size: 3.5rem;
  line-height: 1;
}

.demo-placeholder p {
  margin: 0;
  color: var(--muted);
}

.demo-status {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 4;
  margin: 0;
  color: var(--accent);
  text-align: center;
  pointer-events: none;
}

.demo-status.is-error {
  color: var(--danger);
}

.fullscreen-hint {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100% - 28px));
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
  pointer-events: auto;
}

.fullscreen-hint[hidden] {
  display: none;
}

.fullscreen-hint button {
  display: none;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

.fullscreen-hint button:hover,
.fullscreen-hint button:focus-visible {
  background: rgba(255, 255, 255, 0.2);
}

.fullscreen-hint.is-mobile {
  right: 14px;
  max-width: none;
  justify-content: space-between;
}

.fullscreen-hint.is-mobile button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tech-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.tech-panel article {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  padding: 22px;
  background: var(--surface);
}

.tech-panel span {
  color: var(--accent-2);
  font-weight: 900;
}

.footer,
.footer nav {
  display: flex;
  align-items: center;
}

.footer {
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer nav {
  gap: 16px;
  flex-wrap: wrap;
}

.legal-page {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 80px;
}

.legal-back {
  margin-bottom: 42px;
}

.legal-card {
  display: grid;
  gap: 26px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--frame-bg);
  box-shadow: var(--shadow);
}

.legal-card h1 {
  font-size: 4.2rem;
}

.legal-card h2 {
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.legal-card p {
  margin: 0;
  color: var(--muted);
}

.legal-note {
  max-width: 680px;
}

@media (max-width: 820px) {
  .hero {
    align-content: start;
  }

  .topbar {
    position: static;
    width: 100%;
    transform: none;
  }

  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 5.2rem;
  }

  h2 {
    font-size: 3rem;
  }

  .tech-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .hero,
  .showcase-grid,
  .footer,
  .topbar {
    width: min(100% - 28px, var(--max));
  }

  .hero {
    min-height: auto;
    padding-top: 22px;
  }

  .hero-copy {
    padding-top: 0;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
  }

  .theme-dock {
    left: 14px;
    top: 76px;
  }

  .theme-option {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 0.84rem;
  }

  h1 {
    font-size: 3.7rem;
  }

  h2 {
    font-size: 2.35rem;
  }

  .hero-line,
  .project-head p:last-child,
  .story-panel p {
    font-size: 1rem;
  }

  .demo-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-actions,
  .button {
    width: 100%;
  }

  .demo-placeholder strong {
    font-size: 2.1rem;
  }

  .demo-viewport {
    min-height: 220px;
  }

  .tech-panel {
    grid-template-columns: 1fr;
  }

  .legal-card {
    padding: 22px;
  }

  .legal-card h1 {
    font-size: 2.75rem;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
