:root {
  --bg: #0A0D12;
  --bg-pool: rgba(126, 148, 178, 0.16);
  --text: #F2F4F8;
  --text-dim: #9BA3B0;
  --text-faint: #5D6570;
  --steel-hi: #E8ECF2;
  --steel-lo: #8E99A8;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-border: rgba(255, 255, 255, 0.09);
  --surface-edge: rgba(255, 255, 255, 0.16);
  --term-bg: rgba(10, 13, 18, 0.55);
  --term-green: #7ADEA6;
  --community-border: rgba(122, 222, 166, 0.32);
  --community-bg: rgba(122, 222, 166, 0.08);
  --shadow-deep: 0 30px 80px rgba(0, 0, 0, 0.55);

  --text-base: clamp(1rem, 0.94rem + 0.3vw, 1.125rem);
  --text-hero: clamp(2.6rem, 1.2rem + 6.5vw, 6.5rem);
  --text-count: clamp(2.6rem, 1rem + 8vw, 7rem);
  --space-section: clamp(3.5rem, 2.5rem + 4vw, 7rem);

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  --grain-opacity: 0.5;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F4F5F7;
    --bg-pool: rgba(255, 255, 255, 0.9);
    --text: #14171C;
    --text-dim: #4E555E;
    --text-faint: #8B929B;
    --steel-hi: #2A2F36;
    --steel-lo: #14171C;
    --surface: rgba(255, 255, 255, 0.6);
    --surface-border: rgba(20, 23, 28, 0.08);
    --surface-edge: rgba(255, 255, 255, 0.9);
    --term-bg: rgba(250, 250, 252, 0.72);
    --term-green: #1E9E5A;
    --community-border: rgba(30, 158, 90, 0.3);
    --community-bg: rgba(30, 158, 90, 0.08);
    --shadow-deep: 0 24px 60px rgba(20, 23, 28, 0.14);
    --grain-opacity: 0.35;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #F4F5F7;
  --bg-pool: rgba(255, 255, 255, 0.9);
  --text: #14171C;
  --text-dim: #4E555E;
  --text-faint: #8B929B;
  --steel-hi: #2A2F36;
  --steel-lo: #14171C;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-border: rgba(20, 23, 28, 0.08);
  --surface-edge: rgba(255, 255, 255, 0.9);
  --term-bg: rgba(250, 250, 252, 0.72);
  --term-green: #1E9E5A;
  --community-border: rgba(30, 158, 90, 0.3);
  --community-bg: rgba(30, 158, 90, 0.08);
  --shadow-deep: 0 24px 60px rgba(20, 23, 28, 0.14);
  --grain-opacity: 0.35;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--text-base)/1.6 system-ui, -apple-system, "SF Pro Text", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ambient layers */

.pool {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 80vh;
  background: radial-gradient(55% 55% at 50% 30%, var(--bg-pool), transparent 70%);
  pointer-events: none;
  will-change: transform;
  z-index: 0;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* header */

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: clamp(1.2rem, 3vw, 2.2rem) clamp(1.2rem, 4vw, 3rem);
}

.site-header .header-actions {
  margin-left: auto;
}

.header-slogan {
  order: 2;
  width: 100%;
  margin: 0.7rem 0 0;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: clamp(0.6rem, 0.5rem + 0.5vw, 0.78rem);
  letter-spacing: 0.05em;
  color: var(--text-dim);
  line-height: 1.6;
  min-height: 3.2em;
}

.hs-prompt {
  color: var(--term-green);
  font-weight: 700;
  margin-right: 0.6em;
}

.hs-caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--term-green);
  animation: caret-blink 1.05s steps(1) infinite;
}

@media (min-width: 1080px) {
  .header-slogan {
    order: 0;
    width: auto;
    flex: 1;
    min-width: 0;
    margin: 0 1rem 0 0;
    transform: translateY(2px);
    white-space: nowrap;
    overflow: hidden;
    min-height: 0;
  }
}

.lockup img {
  display: block;
  width: clamp(104px, 12vw, 150px);
  height: auto;
}

.header-actions {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
}

.community-btn {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.32rem 0.65rem 0.32rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--community-border);
  background: var(--community-bg);
  color: var(--term-green);
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: border-color 150ms ease, background 150ms ease, transform 100ms ease-out;
}

.community-btn svg {
  display: block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.community-btn:hover {
  border-color: var(--term-green);
  background: color-mix(in srgb, var(--community-bg), var(--term-green) 14%);
}

.community-btn:active { transform: scale(0.94); }
.community-btn:focus-visible { outline: 2px solid var(--term-green); outline-offset: 2px; }

.social-menu {
  position: relative;
}

.social-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 100ms ease-out;
}

.social-toggle:hover { color: var(--text); border-color: var(--surface-edge); }
.social-toggle:active { transform: scale(0.88); }
.social-toggle:focus-visible { outline: 2px solid var(--steel-lo); outline-offset: 2px; }

.social-toggle[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--surface-edge);
}

.social-toggle-icon {
  width: 15px;
  height: 15px;
  transition: transform 320ms var(--ease-out-expo);
}

.social-toggle[aria-expanded="true"] .social-toggle-icon {
  transform: rotate(90deg);
}

.social {
  display: flex;
  gap: 0.15rem;
}

.social a {
  display: block;
  padding: 5px;
  border-radius: 10px;
  color: var(--text-faint);
  transition: color 150ms ease, transform 100ms ease-out;
}

.social a:hover { color: var(--text); }
.social a:active { transform: scale(0.9); }
.social a:focus-visible { outline: 2px solid var(--steel-lo); outline-offset: 2px; }

.social-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 40px);
  grid-auto-rows: 40px;
  gap: 0.2rem;
  padding: 0.5rem;
  border-radius: 16px;
  border: 1px solid var(--surface-border);
  background: var(--term-bg);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  box-shadow: var(--shadow-deep), inset 0 1px 0 var(--surface-edge);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 220ms var(--ease-out-expo), transform 280ms var(--ease-out-expo);
}

.social-panel a {
  display: grid;
  place-items: center;
  padding: 0;
}

.social-menu.open .social-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

@media (min-width: 1080px) {
  .social-toggle { display: none; }

  .social-panel {
    position: static;
    display: flex;
    gap: 0.15rem;
    padding: 0;
    border: none;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .social-panel a {
    display: block;
    padding: 5px;
  }
}

.social svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.social .icon-at {
  fill: none;
  stroke: currentColor;
}

.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, transform 100ms ease-out;
}

.theme-toggle:hover { color: var(--text); border-color: var(--surface-edge); }
.theme-toggle:active { transform: scale(0.88); }
.theme-toggle:focus-visible { outline: 2px solid var(--steel-lo); outline-offset: 2px; }

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 17px;
  height: 17px;
  transition: opacity 250ms ease, transform 450ms var(--ease-out-expo);
}

/* layout */

main {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(1.2rem, 4vw, 3rem);
}

/* hero */

.hero {
  padding-top: clamp(1rem, 4vh, 3rem);
  text-align: center;
}

.hello {
  width: min(430px, 72vw);
  height: auto;
  margin: 0 auto;
  display: block;
  overflow: visible;
}

.hello-stroke {
  stroke: var(--steel-hi);
  stroke-width: 9;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: hello-draw 2.1s var(--ease-out-expo) 0.3s forwards;
}

.hello-dot {
  fill: var(--steel-hi);
  opacity: 0;
  transform-origin: 382px 172px;
  animation: hello-dot 0.5s var(--ease-out-expo) 2.3s forwards;
}

@keyframes hello-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes hello-dot {
  0% { opacity: 0; transform: scale(0.2); }
  100% { opacity: 1; transform: scale(1); }
}

.headline {
  margin: clamp(1.2rem, 3vh, 2.4rem) 0 0;
  font-size: var(--text-hero);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, var(--steel-hi), var(--steel-lo));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  opacity: 0;
  animation: rise-in 0.9s var(--ease-out-expo) 0.9s forwards;
}

.subline {
  max-width: 34rem;
  margin: 1.4rem auto 0;
  color: var(--text-dim);
  opacity: 0;
  animation: rise-in 0.9s var(--ease-out-expo) 1.15s forwards;
}

.subline strong { color: var(--text); font-weight: 600; }

@keyframes rise-in {
  0% { opacity: 0; transform: translateY(18px); filter: blur(6px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* countdown */

.countdown {
  margin-top: var(--space-section);
  opacity: 0;
  animation: rise-in 0.9s var(--ease-out-expo) 1.4s forwards;
}

.count-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(0.4rem, 1.6vw, 1.4rem);
}

.count-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.digits {
  display: flex;
  gap: clamp(0.15rem, 0.6vw, 0.4rem);
  min-height: var(--text-count);
}

.digit {
  height: 1em;
  overflow: hidden;
  font-size: var(--text-count);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--steel-hi);
}

.reel {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.reel span {
  display: block;
  height: 1em;
  line-height: 1;
  background: linear-gradient(180deg, var(--steel-hi), var(--steel-lo));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.colon {
  font-size: var(--text-count);
  font-weight: 300;
  line-height: 1;
  color: var(--text-faint);
  transform: translateY(-0.04em);
  animation: colon-pulse 2s ease-in-out infinite;
}

@keyframes colon-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 0.3; }
}

.unit {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.noscript-note {
  text-align: center;
  color: var(--text-dim);
  margin-top: 1rem;
}

/* terminal */

.terminal {
  margin: var(--space-section) auto 0;
  max-width: 720px;
  border-radius: 14px;
  border: 1px solid var(--surface-border);
  background: var(--term-bg);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--shadow-deep), inset 0 1px 0 var(--surface-edge);
  overflow: hidden;
  opacity: 0;
  animation: materialize 0.9s var(--ease-out-expo) 1.7s forwards;
}

@keyframes materialize {
  0% { opacity: 0; transform: scale(0.965) translateY(14px); filter: blur(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

.term-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-border);
}

.term-dot { width: 12px; height: 12px; border-radius: 50%; }
.term-dot-r { background: #FF5F57; }
.term-dot-y { background: #FEBC2E; }
.term-dot-g { background: #28C840; }

.term-title {
  margin-left: auto;
  margin-right: auto;
  transform: translateX(-26px);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.term-body {
  margin: 0;
  padding: 18px 20px 22px;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: clamp(0.72rem, 0.62rem + 0.5vw, 0.92rem);
  line-height: 1.75;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 13.5em;
}

.term-body .t-prompt { color: var(--term-green); }
.term-body .t-key { color: var(--text-faint); }
.term-body .t-val { color: var(--text); }
.term-body .t-bar { color: var(--term-green); letter-spacing: 0.06em; }

.term-caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--term-green);
  animation: caret-blink 1.05s steps(1) infinite;
}

@keyframes caret-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* products */

.products {
  margin-top: var(--space-section);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.8rem, 2vw, 1.4rem);
  opacity: 0;
  animation: rise-in 0.9s var(--ease-out-expo) 2s forwards;
}

.product-chip {
  display: block;
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  border-radius: 16px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 var(--surface-edge);
  color: inherit;
  text-decoration: none;
  transition: transform 300ms var(--ease-out-expo), border-color 300ms ease;
}

.product-chip:hover {
  transform: translateY(-4px);
  border-color: var(--surface-edge);
}

.product-chip:active {
  transform: translateY(-1px) scale(0.99);
}

.product-chip:focus-visible {
  outline: 2px solid var(--steel-lo);
  outline-offset: 3px;
}

.chip-icon {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin-bottom: 0.9rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.chip-icon-next {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--surface-border);
  box-shadow: none;
  color: var(--text-faint);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
}

.product-chip h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.product-chip p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.product-chip-next h2 {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  color: var(--text-faint);
  font-weight: 500;
}

/* footer */

.site-footer {
  position: relative;
  z-index: 2;
  margin-top: var(--space-section);
  padding: 2.4rem 1.2rem 2.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.site-footer p { margin: 0; }

.footer-mark {
  display: block;
  width: 34px;
  height: 34px;
  cursor: pointer;
  will-change: transform;
}

.footer-mark img {
  display: block;
  width: 34px;
  height: 34px;
}

.footer-domain {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
}

/* utilities */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* responsive */

@media (max-width: 560px) {
  .products { grid-template-columns: 1fr; }
  .colon { display: none; }
  .count-row { gap: clamp(0.8rem, 4vw, 1.4rem); }
  .lockup img { width: 96px; }
  .community-btn { padding: 0.3rem 0.6rem 0.3rem 0.48rem; font-size: 0.7rem; }
  .theme-toggle { width: 30px; height: 30px; }
  .theme-toggle svg { width: 15px; height: 15px; }
  .social-toggle { width: 30px; height: 30px; }
  .social-toggle-icon { width: 14px; height: 14px; }
}

@media (max-width: 480px) {
  .community-btn { padding: 0.34rem; }
  .community-btn span { display: none; }
}

@media (max-width: 400px) {
  .lockup img { width: 88px; }
  .header-actions { gap: 0.25rem; }
  .theme-toggle { width: 28px; height: 28px; }
  .social-toggle { width: 28px; height: 28px; }
  .social-panel { grid-template-columns: repeat(4, 36px); grid-auto-rows: 36px; right: -6px; }
}

/* accessibility: reduced motion / transparency / contrast */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hello-stroke { animation: none; stroke-dashoffset: 0; }
  .hello-dot { animation: none; opacity: 1; }
  .headline, .subline, .countdown, .terminal, .products {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
  }
  .colon { animation: none; }
  .term-caret { animation: none; }
  .product-chip { transition: none; }
  .hs-caret { animation: none; }
  .social-panel { transition: none; }
  .social-toggle-icon { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .terminal, .product-chip {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .terminal { background: var(--bg); }
  .product-chip { background: var(--bg); }
}

@media (prefers-contrast: more) {
  :root {
    --text-dim: #C7CDD6;
    --text-faint: #A9B0BA;
    --surface-border: rgba(255, 255, 255, 0.4);
  }
  .terminal, .product-chip { border-width: 2px; }
}

/* theme switching: system preference by default, data-theme wins when set */

html .only-light { display: none; }
html .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .only-dark { display: none; }
  html:not([data-theme="dark"]) .only-light { display: block; }
  html:not([data-theme="dark"]) .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.6); }
  html:not([data-theme="dark"]) .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
}

html[data-theme="light"] .only-dark { display: none; }
html[data-theme="light"] .only-light { display: block; }
html[data-theme="light"] .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.6); }
html[data-theme="light"] .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
