:root {
  --bg: #06080d;
  --ink: #ede9e2;
  --muted: #8d919a;
  --line: rgba(237, 233, 226, .14);
  --line-strong: rgba(237, 233, 226, .32);
  --accent: #a9b4ff;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.is-viewing { overflow: hidden; }
button, input { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(20px, 3.2vw, 40px) clamp(20px, 5vw, 72px);
  overflow: hidden;
  isolation: isolate;
}

.hero__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(40px, 6vw, 110px);
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

/* faint blueprint grid on the right */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(169,180,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(169,180,255,.06) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 55% 70% at 78% 50%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 55% 70% at 78% 50%, #000 20%, transparent 75%);
}

/* ---------- Art: browser mockup + portrait ---------- */
.art {
  order: 2;
  position: relative;
  width: clamp(360px, 42vw, 580px);
  aspect-ratio: 580 / 500;
  container-type: inline-size;
  color: var(--accent);
}
.art::before { /* blue glow */
  content: "";
  position: absolute;
  inset: 15% 0 0 30%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(110,125,255,.18), transparent);
  filter: blur(40px);
}

.art__ruler {
  position: absolute;
  top: 0; left: 5%;
  width: 70%; height: 6cqw;
  border: 1px solid var(--line-strong);
  border-radius: 1.6cqw;
  background:
    repeating-linear-gradient(90deg, rgba(169,180,255,.55) 0 1px, transparent 1px 5.6cqw) 2.8cqw 0 / 100% 45% no-repeat,
    rgba(169,180,255,.05);
}
.art__plumb {
  position: absolute;
  top: 6cqw; left: 12%;
  height: 39cqw;
  border-left: 1.5px dotted rgba(169,180,255,.6);
}
.art__plumb::after {
  content: "";
  position: absolute;
  bottom: -1cqw; left: -1.3cqw;
  width: 2cqw; height: 2cqw;
  border: 1.5px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
}

.browser {
  position: absolute;
  top: 12%; left: 0;
  width: 80%;
  border: 1px solid var(--line-strong);
  border-radius: 3cqw;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  backdrop-filter: blur(6px);
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.browser__top {
  display: flex; align-items: center; gap: 1.4cqw;
  height: 8.5cqw;
  padding: 0 3cqw;
  border-bottom: 1px solid var(--line);
}
.browser__top i {
  width: 2cqw; height: 2cqw; border-radius: 50%;
  background: rgba(255,255,255,.16);
}
.browser__top i:first-child { background: var(--accent); }
.browser__url {
  margin-left: 2cqw;
  flex: 1;
  height: 4.4cqw;
  padding: 0 2.4cqw;
  border-radius: 99px;
  background: rgba(255,255,255,.05);
  font-size: 2.2cqw; line-height: 4.4cqw;
  color: var(--muted);
}
.browser__body {
  display: grid;
  grid-template-columns: 40% 1fr;
  gap: 4cqw;
  padding: 5cqw 4.5cqw;
}
.sk-img {
  height: 17cqw;
  border-radius: 2cqw;
  background: rgba(169,180,255,.1);
  color: rgba(169,180,255,.75);
  padding: 2cqw;
}
.sk-img svg { width: 100%; height: 100%; display: block; }
.sk-lines { display: flex; flex-direction: column; gap: 2.2cqw; padding-top: 1cqw; }
.sk {
  display: block;
  height: 2.2cqw;
  border-radius: 99px;
  background: rgba(255,255,255,.08);
}
.sk--strong { height: 4.2cqw; width: 92%; background: linear-gradient(90deg, #6f7cff, #a9b4ff); }
.sk--mid { width: 70%; background: rgba(169,180,255,.28); height: 3cqw; }
.sk--short { width: 52%; }
.sk-btn {
  justify-self: start;
  padding: 1.6cqw 3.6cqw;
  border-radius: 99px;
  border: 1px solid var(--accent);
  background: rgba(169,180,255,.1);
  font-size: 2.4cqw; font-weight: 600;
  color: var(--ink);
}
.sk-foot { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 1.8cqw; width: 62%; }

.cursor {
  position: absolute;
  top: 26%; right: 2%;
  width: 7cqw;
  color: var(--accent);
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.5));
  animation: drift 6s ease-in-out infinite;
}

.measure {
  position: absolute;
  top: 71%; left: 0;
  width: 58%;
  height: 3cqw;
  border-left: 1.5px solid var(--accent);
  border-right: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.measure::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 50%;
  border-top: 1.5px solid rgba(169,180,255,.6);
}
.measure span {
  position: relative;
  padding: 0 2cqw;
  background: var(--bg);
  font-size: 2.4cqw; font-weight: 600;
  color: var(--accent);
}

.spark { position: absolute; animation: twinkle 4.5s ease-in-out infinite; }
.spark--a { top: 6%; right: 9%; width: 5cqw; color: var(--accent); }
.spark--b { top: 17%; right: 1%; width: 3cqw; color: var(--ink); opacity: .7; animation-delay: -2s; }

/* portrait */
.portrait {
  position: absolute;
  right: 3%; bottom: 0;
  width: 36%;
  margin: 0;
}
.portrait__card {
  aspect-ratio: 4 / 5;
  border-radius: 4cqw;
  overflow: hidden;
  border: 1.5px solid rgba(169,180,255,.55);
  box-shadow: 0 0 0 1.2cqw rgba(6,8,13,1), 0 30px 80px rgba(0,0,0,.6);
  background: #0a0f38;
}
.portrait__card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: url(#duotone) contrast(1.06);
  transform: scale(1.06);
  animation: photoIn 2.6s var(--ease) .15s forwards;
}
.corner {
  position: absolute;
  width: 4cqw; height: 4cqw;
  border: 0 solid var(--accent);
}
.corner--tl { top: -3cqw; left: -3cqw; border-top-width: 1.5px; border-left-width: 1.5px; }
.corner--tr { top: -3cqw; right: -3cqw; border-top-width: 1.5px; border-right-width: 1.5px; }
.corner--bl { bottom: -3cqw; left: -3cqw; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.corner--br { bottom: -3cqw; right: -3cqw; border-bottom-width: 1.5px; border-right-width: 1.5px; }
.portrait__tag {
  position: absolute;
  left: 50%;
  bottom: -2.8cqw;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 1.6cqw;
  padding: 1.4cqw 2.8cqw;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(10,12,18,.9);
  backdrop-filter: blur(10px);
  font-size: max(11px, 2.2cqw);
  white-space: nowrap;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-1.2cqw, 1cqw); }
}
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0); opacity: 1; }
  50% { transform: scale(.75) rotate(20deg); opacity: .55; }
}

.nav {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 13px;
  letter-spacing: .02em;
}
.nav__name { font-weight: 600; }
.nav__role { color: var(--muted); }

.hero__content {
  align-self: center;
  max-width: 620px;
  padding: 6vh 0 4vh;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 28px;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(169,180,255,.5);
  animation: pulse 3.2s ease-in-out infinite;
}

.headline {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.4rem, 7.6vw, 7.4rem);
  line-height: .95;
  letter-spacing: -.02em;
}
.headline .line { display: block; overflow: hidden; padding-bottom: .06em; }
.headline .line > span { display: inline-block; }
.headline em { font-style: italic; color: var(--accent); }

.lede {
  margin: 28px 0 32px;
  max-width: 400px;
  color: var(--muted);
  font-size: 16px;
}

/* code input */
.code {
  display: flex;
  align-items: center;
  max-width: 440px;
  height: 60px;
  padding: 6px 6px 6px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(8px);
  transition: border-color .4s var(--ease), background-color .4s var(--ease), box-shadow .6s var(--ease);
}
.code:focus-within {
  border-color: rgba(169,180,255,.7);
  background: rgba(255,255,255,.05);
  box-shadow: 0 0 0 6px rgba(169,180,255,.07), 0 0 40px rgba(169,180,255,.08);
}
.code input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  letter-spacing: .01em;
}
.code input::placeholder { color: rgba(237,233,226,.32); }
.code button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform .25s var(--ease), background-color .3s;
}
.code button svg { transition: transform .35s var(--ease); }
@media (hover: hover) {
  .code button:hover { background: #fff; }
  .code button:hover svg { transform: translateX(3px); }
}
.code button:active { transform: scale(.97); }
.code.is-busy button { opacity: .7; pointer-events: none; }
.code.is-wrong { animation: shake .5s var(--ease); border-color: rgba(230,120,110,.6); }

.msg {
  min-height: 1.5em;
  margin: 14px 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}
.msg.is-error { color: #e9a097; }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.foot__links { display: flex; gap: 20px; }
.foot a { color: inherit; text-decoration: none; transition: color .3s; }
.foot a:hover { color: var(--ink); }

/* entrance */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: rise 1.4s var(--ease) var(--d, 0s) forwards;
}
.headline .reveal { transform: translateY(105%); animation-duration: 1.5s; }

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes photoIn { to { transform: scale(1); } }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(169,180,255,.45); }
  50% { box-shadow: 0 0 0 6px rgba(169,180,255,0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* ---------- Viewer ---------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: 64px 1fr;
  background: var(--bg);
  opacity: 0;
  transition: opacity .6s var(--ease);
}
.viewer.is-open { opacity: 1; }
.viewer[hidden] { display: none; }

.bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 clamp(12px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
}
.bar__back {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px 0 10px;
  border: 1px solid transparent; border-radius: 999px;
  background: none; cursor: pointer;
  font-size: 13px; color: var(--muted);
  transition: color .3s, border-color .3s;
}
.bar__back:hover { color: var(--ink); border-color: var(--line); }
.bar__title { display: flex; flex-direction: column; align-items: center; line-height: 1.2; text-align: center; }
.bar__kicker { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.bar__name { font-family: var(--serif); font-size: 20px; }
.bar__right { justify-self: end; display: flex; align-items: center; gap: 10px; }

.device {
  display: flex; padding: 3px;
  border: 1px solid var(--line); border-radius: 999px;
}
.device button {
  display: grid; place-items: center;
  width: 34px; height: 30px;
  border: 0; border-radius: 999px;
  background: none; color: var(--muted); cursor: pointer;
  transition: background-color .3s, color .3s;
}
.device button[aria-pressed="true"] { background: rgba(255,255,255,.1); color: var(--ink); }

.bar__cta {
  display: inline-flex; align-items: center;
  height: 38px; padding: 0 18px;
  border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background-color .3s;
}
.bar__cta:hover { background: #fff; }
.bar__cta[hidden] { display: none; }

.stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(169,180,255,.05), transparent 60%), var(--bg);
}
.frame {
  width: 100%; height: 100%;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .9s var(--ease), transform .9s var(--ease), width .7s var(--ease), height .7s var(--ease), border-radius .7s var(--ease);
  overflow: hidden;
}
.frame.is-ready { opacity: 1; transform: none; }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

.stage.is-mobile .frame {
  width: 390px;
  height: min(844px, calc(100% - 48px));
  border-radius: 36px;
  box-shadow: 0 0 0 10px #15171d, 0 0 0 11px var(--line), 0 40px 120px rgba(0,0,0,.6);
}

.loader {
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px; overflow: hidden;
  opacity: 0; transition: opacity .4s;
}
.loader.is-on { opacity: 1; }
.loader span {
  display: block; width: 30%; height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: load 1.4s ease-in-out infinite;
}
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(400%); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-rows: auto 1fr auto; }
  .hero__main { grid-template-columns: 1fr; gap: 44px; padding: 28px 0 8px; }
  .art { order: 0; width: min(100%, 400px); justify-self: center; }
  .hero::before {
    -webkit-mask-image: radial-gradient(ellipse 80% 40% at 50% 28%, #000 20%, transparent 75%);
            mask-image: radial-gradient(ellipse 80% 40% at 50% 28%, #000 20%, transparent 75%);
  }
  .nav { flex-direction: column; gap: 2px; }
  .hero__content { padding: 0 0 28px; }
  .eyebrow { margin-bottom: 18px; }
  .headline { font-size: clamp(3rem, 13.5vw, 4.6rem); }
  .lede { margin: 20px 0 24px; font-size: 15px; }
  .code { height: 56px; }
  .foot { padding-bottom: env(safe-area-inset-bottom); }

  .viewer { grid-template-rows: 56px 1fr; }
  .bar { grid-template-columns: auto 1fr auto; }
  .bar__back span, .bar__kicker, .device { display: none; }
  .bar__title { align-items: flex-start; text-align: left; }
  .bar__name { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
  .bar__cta { height: 34px; padding: 0 14px; }
}

@media (max-width: 860px) and (max-height: 700px) {
  .art { width: min(100%, 320px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
