/* Landing page — styles for templates/index.html.
   Tokens + reset live in tokens.css. */

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
}

/* Pinned to the LARGE viewport, not the dynamic one. A fixed, composited
   layer that stops short of the screen is where Safari stops painting the
   page, which left a black band behind its floating toolbar; 100lvh keeps the
   layer the full height of the screen whether that toolbar is showing or not.
   js/stage.js measures this box rather than setting its own. */
#stage {
  position: fixed;
  top: 0;
  left: 0;
  /* Width and height are both explicit: a canvas is a replaced element, so an
     auto width falls back to its own bitmap width instead of the distance
     between left and right, and js/stage.js measures this box to size that
     bitmap — the two would chase each other. */
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 1;
}

/* Single viewport-anchored scrim between the canvas and content.
   Fixed so it never seams between sections as you scroll. */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100lvh;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse 75% 65% at 50% 50%, rgba(8, 8, 10, 0.78), rgba(8, 8, 10, 0) 80%);
}

.brand {
  position: fixed;
  top: calc(24px + var(--safe-t));
  left: calc(36px + var(--safe-l));
  z-index: 30;
  display: flex;
  align-items: center;
  color: var(--fg);
  text-decoration: none;
}

.brand .mark {
  height: 54px;
  width: auto;
  display: block;
}

.menu-btn {
  position: fixed;
  top: calc(24px + var(--safe-t));
  right: calc(36px + var(--safe-r));
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--fg);
  padding: 0;
  display: grid;
  place-items: center;
  z-index: 30;
  cursor: pointer;
}

.menu-btn span {
  position: relative;
  width: 14px;
  height: 14px;
  display: block;
}

.menu-btn span::before,
.menu-btn span::after {
  content: "";
  position: absolute;
  background: var(--fg);
  transition: transform .42s cubic-bezier(.22, .61, .36, 1);
}

.menu-btn span::before {
  left: 0;
  right: 0;
  top: 50%;
  height: 1.25px;
  transform: translateY(-50%);
}

.menu-btn span::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.25px;
  transform: translateX(-50%);
}

body.menu .menu-btn span::after {
  transform: translateX(-50%) rotate(90deg);
}

main {
  position: relative;
  z-index: 5;
  /* Dark halo so light copy stays legible wherever a bright particle
     cluster drifts behind it. Invisible over the dark background;
     inherited by every descendant, so it travels with the text. */
  text-shadow: 0 0 7px rgba(8, 8, 10, 0.92), 0 0 16px rgba(8, 8, 10, 0.75);
}

.section {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.05fr 1fr;
  gap: 32px;
  padding: 120px calc(36px + var(--safe-r)) 120px calc(36px + var(--safe-l));
  min-height: 100vh;
  min-height: 100dvh;
  align-content: center;
}

.section .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.section h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(40px, 5.6vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0;
  text-wrap: pretty;
}

.section p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg);
  margin: 0;
  max-width: 44ch;
}

.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(96px + var(--safe-t)) calc(36px + var(--safe-r)) calc(40px + var(--safe-b)) calc(36px + var(--safe-l));
}

.hero-top {
  display: grid;
  grid-template-columns: 1fr 1.05fr 1fr;
  gap: 32px;
  align-items: start;
}

.hero-lead {
  grid-column: 2 / 4;
}

.hero-h {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(44px, 6.2vw, 94px);
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin: 0 0 28px;
  text-wrap: pretty;
}

.canon {
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg);
  max-width: 50ch;
  letter-spacing: -0.005em;
  margin: 0;
  padding-top: 2px;
  font-weight: 400;
}

.hero-bottom {
  margin-top: auto;
  padding-top: 64px;
}

.hero-bottom .scroll-cue {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-2);
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-bottom .scroll-cue .dot {
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
}

.section .lead {
  grid-column: 2 / 4;
}

.lead .sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(18px, 2.1vw, 26px);
  line-height: 1.36;
  color: var(--fg-2);
  margin: 20px 0 0;
  max-width: 54ch;
}

.commits {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 64px;
}

.commit {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.commit h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  color: var(--fg);
}

.product-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-top: 64px;
}

.product {
  padding: 32px 0;
  border-top: 1px solid var(--line);
  position: relative;
}

.product .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 18px;
}

.product .nm {
  font-family: var(--font-serif);
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.product .status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.product .status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-4);
  font-style: normal;
}

.product.live .status {
  color: var(--accent-soft);
}

.product.live .status i {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.product p {
  max-width: 46ch;
}

.product .link {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--fg-4);
  padding-bottom: 2px;
}

.product .link:hover {
  border-color: var(--fg);
}

.product .link.disabled {
  color: var(--fg-3);
  border-color: transparent;
}

.problem .body {
  grid-column: 2 / 4;
  margin-top: 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.problem .body p {
  max-width: 38ch;
}

/* Staggered cascade: the middle block sits lower than its neighbors
   so the eye follows a single 1 → 2 → 3 diagonal instead of guessing
   between reading across rows or down columns. */
.problem .body {
  align-items: start;
}

.problem .body p:nth-child(2) {
  margin-top: 160px;
}

.contact-list {
  grid-column: 1 / -1;
  margin-top: 64px;
}

.contact-row {
  display: grid;
  grid-template-columns: 1fr 1.05fr 1fr;
  gap: 32px;
  align-items: baseline;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.contact-row:last-of-type {
  border-bottom: 1px solid var(--line);
}

.contact-row .who {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-2);
}

.contact-row .addr {
  font-family: var(--font-serif);
  font-size: 28px;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.contact-row .addr:hover {
  color: var(--accent-soft);
}

.contact-row .note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  text-align: right;
  letter-spacing: 0.02em;
}

footer {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding: 36px calc(36px + var(--safe-r)) calc(28px + var(--safe-b)) calc(36px + var(--safe-l));
  border-top: 1px solid var(--line);
}

footer .f-mark {
  display: flex;
  align-items: center;
  gap: 14px;
}

footer .f-mark h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fg);
}

footer .f-mark .stamp {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-3);
}

footer .f-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

footer .f-links a {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-2);
  text-decoration: none;
  letter-spacing: 0.04em;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color .25s, border-color .25s;
}

footer .f-links a:hover {
  color: var(--fg);
  border-bottom-color: var(--fg-3);
}

.nav {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(8, 8, 10, 0.92);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s cubic-bezier(.22, .61, .36, 1);
  overflow: hidden;
}

body.menu {
  overflow: hidden;
}

body.menu .nav {
  opacity: 1;
  pointer-events: auto;
}

.nav-inner {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 32px;
  padding: calc(90px + var(--safe-t)) calc(36px + var(--safe-r)) calc(36px + var(--safe-b)) calc(36px + var(--safe-l));
  align-content: start;
}

.nav-mid ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-mid li {
  font-family: var(--font-serif);
  font-size: 64px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--fg);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s cubic-bezier(.22, .61, .36, 1), transform .55s cubic-bezier(.22, .61, .36, 1), color .25s;
}

body.menu .nav-mid li {
  opacity: 1;
  transform: translateY(0);
}

/* One step per nav item — four covers the hidden Product item too. */
.nav-mid li:nth-child(1) {
  transition-delay: .06s;
}

.nav-mid li:nth-child(2) {
  transition-delay: .11s;
}

.nav-mid li:nth-child(3) {
  transition-delay: .16s;
}

.nav-mid li:nth-child(4) {
  transition-delay: .21s;
}

.nav-mid li a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.nav-mid li a:hover {
  color: var(--accent-soft);
  font-style: italic;
}

.nav-mid li .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  font-style: normal;
  letter-spacing: 0.06em;
  width: 32px;
}

@media (max-width: 1024px) {
  .brand {
    top: calc(20px + var(--safe-t));
    left: calc(24px + var(--safe-l));
  }

  .brand .mark {
    height: 46px;
  }

  .menu-btn {
    top: calc(20px + var(--safe-t));
    right: calc(24px + var(--safe-r));
  }

  .hero {
    padding: calc(104px + var(--safe-t)) calc(28px + var(--safe-r)) calc(32px + var(--safe-b)) calc(28px + var(--safe-l));
  }

  .section {
    padding: 96px calc(28px + var(--safe-r)) 96px calc(28px + var(--safe-l));
  }

  .hero-top {
    grid-template-columns: 1fr 1.5fr;
  }

  .hero-top>div:first-child {
    display: none;
  }

  .hero-lead {
    grid-column: 1 / -1;
  }

  .hero-h {
    font-size: clamp(42px, 7vw, 72px);
  }

  .commits {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .commits .commit:last-child {
    grid-column: 1 / -1;
  }

  .nav-inner {
    padding: calc(96px + var(--safe-t)) calc(28px + var(--safe-r)) calc(28px + var(--safe-b)) calc(28px + var(--safe-l));
  }

  footer {
    padding: 32px calc(28px + var(--safe-r)) calc(24px + var(--safe-b)) calc(28px + var(--safe-l));
  }
}

@media (max-width: 700px) {
  .brand {
    top: calc(16px + var(--safe-t));
    left: calc(20px + var(--safe-l));
  }

  .brand .mark {
    height: 40px;
  }

  .menu-btn {
    top: calc(16px + var(--safe-t));
    right: calc(20px + var(--safe-r));
  }

  .hero {
    padding: calc(88px + var(--safe-t)) calc(20px + var(--safe-r)) calc(24px + var(--safe-b)) calc(20px + var(--safe-l));
  }

  .hero-top,
  .section,
  .nav-inner {
    grid-template-columns: 1fr;
  }

  .hero-top>div {
    display: none;
  }

  .hero-top>.hero-lead {
    display: block;
  }

  .hero-h {
    font-size: clamp(36px, 9vw, 52px);
    margin-bottom: 22px;
  }

  .canon {
    max-width: none;
  }

  .hero-bottom {
    padding-top: 36px;
  }

  .section {
    padding: 72px calc(20px + var(--safe-r)) 72px calc(20px + var(--safe-l));
    min-height: auto;
  }

  .section h2 {
    font-size: clamp(34px, 9vw, 56px);
  }

  .commits,
  .product-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 36px;
  }

  .commit {
    padding: 20px 0;
  }

  .commit h3 {
    font-size: 24px;
  }

  .product {
    padding: 24px 0;
  }

  .product .nm {
    font-size: 38px;
  }

  .problem .body {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 32px;
  }

  .problem .body p:nth-child(2) {
    margin-top: 0;
  }

  .section .lead {
    grid-column: 1;
  }

  .contact-list {
    margin-top: 36px;
  }

  .contact-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 18px 0;
  }

  .contact-row .note {
    text-align: left;
  }

  .contact-row .addr {
    font-size: 22px;
  }

  .nav-mid li {
    font-size: 38px;
    line-height: 1.1;
  }

  .nav-mid li .num {
    width: 28px;
    font-size: 10px;
  }

  footer {
    padding: 28px calc(20px + var(--safe-r)) calc(22px + var(--safe-b)) calc(20px + var(--safe-l));
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  footer .f-links {
    gap: 18px;
  }
}

/* Load-in animation: pen-tip signature trace, then fade to page */
#load-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: opacity .55s ease;
}

#load-screen.done {
  opacity: 0;
  pointer-events: none;
}

#load-logo {
  width: min(42vmin, 360px);
  height: auto;
  display: block;
}

#load-screen .ls-stroke {
  fill: none;
  stroke: var(--fg);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#load-screen .ls-fill {
  fill: var(--fg);
  opacity: 0;
}

#load-screen .ls-dot,
#load-screen .ls-rect {
  fill: var(--fg);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

#load-screen .ls-dot {
  transform: scale(.1);
}

#load-screen .ls-rect {
  transform: scale(.1) rotate(-30deg);
}

#load-screen.go .ls-stroke {
  animation: lsDraw 2.4s cubic-bezier(.5, 0, .3, 1) forwards,
    lsOut .35s ease-out 2.3s forwards;
}

@keyframes lsDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes lsOut {
  to {
    opacity: 0;
  }
}

#load-screen.go .ls-fill {
  animation: lsFill .35s ease-out 2.3s forwards;
}

@keyframes lsFill {
  to {
    opacity: 1;
  }
}

#load-screen.go .ls-tip {
  animation: lsTipFade .35s ease-out 2.35s forwards;
}

@keyframes lsTipFade {
  to {
    opacity: 0;
  }
}

#load-screen.go .ls-dot {
  animation: lsPop .3s cubic-bezier(.3, 1.5, .5, 1) 2.6s forwards;
}

@keyframes lsPop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

#load-screen.go .ls-rect {
  animation: lsPopR .35s cubic-bezier(.3, 1.5, .5, 1) 2.8s forwards;
}

@keyframes lsPopR {
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

html.loading,
html.loading body {
  overflow: hidden;
}

html.loading .brand,
html.loading .menu-btn {
  opacity: 0;
}
