/* Concept A · Studio. Dark, minimal, typographic. Motion at the end.
   Tokens mirror src/styles/tokens.css. The hero plate's dot is the one ember. */

:root {
  --canvas: #0a0a0b;
  --surface: #0f0f11;
  --surface-2: #141417;
  --text-hi: #f2f2f3;
  --text-med: #a0a0a6;
  --text-low: #7a7a82;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --ember: #ff7a1a;
  --ember-soft: #ff9a4a;
  --font-sans: "Geist Variable", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono Variable", ui-monospace, monospace;
  --pad: clamp(20px, 4.2vw, 64px);
  --max: 1320px;
  --ease-forge: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

body {
  background: var(--canvas);
  color: var(--text-hi);
  font: 400 16px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ember-soft);
  outline-offset: 3px;
}

code {
  font-family: var(--font-mono);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* In A the switch stays in the flow above the header, so it can never cover reading content. */
.proto-switch {
  position: static;
  display: flex;
  width: max-content;
  margin: 14px var(--pad) 0 auto;
}

.top,
main > section,
.foot {
  width: min(100%, var(--max));
  margin-inline: auto;
  padding-inline: var(--pad);
}

.eyebrow,
.section-head__num,
.ledger__row--head,
.hero__facts dt {
  font: 500 11px/1.2 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-low);
}

/* ---------- Top bar ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 68px;
  border-bottom: 1px solid var(--hairline);
}

.top__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.top__nav {
  display: flex;
  gap: clamp(14px, 2.4vw, 32px);
  font-size: 14px;
}

.top__nav a {
  color: var(--text-med);
  text-decoration: none;
}

.top__nav a:is(:hover, :focus-visible) {
  color: var(--text-hi);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  column-gap: clamp(32px, 5vw, 80px);
  align-items: center;
  padding-block: clamp(56px, 9vw, 128px) 0;
}

.hero__title {
  margin: 20px 0 28px;
  font-size: clamp(3.2rem, 8.4vw, 7.6rem);
  font-weight: 650;
  line-height: 0.92;
  letter-spacing: -0.052em;
  text-wrap: balance;
}

.hero__lede {
  max-width: 34rem;
  margin: 0;
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  color: var(--text-med);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 550;
  text-decoration: none;
}

.btn--primary {
  background: var(--text-hi);
  color: var(--canvas);
}

.btn--primary:is(:hover, :focus-visible) {
  background: #ffffff;
}

.btn--ghost {
  border: 1px solid var(--hairline-strong);
  color: var(--text-hi);
}

.btn--ghost:is(:hover, :focus-visible) {
  border-color: rgba(255, 255, 255, 0.34);
  background-color: rgba(255, 255, 255, 0.04);
}

/* The plate: the studio's [ · ] geometry on blueprint paper. */
.hero__plate {
  justify-self: end;
  width: min(100%, 440px);
}

.plate {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background-color: var(--surface);
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255, 122, 26, 0.12), transparent 46%),
    linear-gradient(rgba(242, 242, 243, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 242, 243, 0.04) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
  background-position: center, -1px -1px, -1px -1px;
}

.plate__corner {
  position: absolute;
  width: 24%;
  height: 24%;
  border: 0 solid var(--text-hi);
}

.plate__corner--tl { top: 18%; left: 18%; border-top-width: 6px; border-left-width: 6px; }
.plate__corner--bl { bottom: 18%; left: 18%; border-bottom-width: 6px; border-left-width: 6px; }
.plate__corner--br { bottom: 18%; right: 18%; border-bottom-width: 6px; border-right-width: 6px; }
.plate__corner--tr { top: 18%; right: 18%; border-top-width: 6px; border-right-width: 6px; }

.plate__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15%;
  height: 15%;
  border-radius: 50%;
  background: var(--ember);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 60px -6px rgba(255, 122, 26, 0.5);
}

.plate__rule {
  position: absolute;
  border: 0 dashed rgba(242, 242, 243, 0.2);
}

.plate__rule--x { left: 6%; right: 6%; top: 50%; border-top-width: 1px; }
.plate__rule--y { top: 6%; bottom: 6%; left: 50%; border-left-width: 1px; }

.plate__tag {
  position: absolute;
  padding: 4px 8px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: var(--canvas);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--text-med);
}

.plate__tag--a { top: 7%; left: 7%; }
.plate__tag--b { top: calc(50% - 11px); right: 5%; }
.plate__tag--c { bottom: 7%; left: 7%; }

.hero__facts {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: clamp(56px, 7vw, 96px) 0 0;
  border-top: 1px solid var(--hairline);
}

.hero__facts div {
  padding: 18px 20px 0 0;
}

.hero__facts div + div {
  padding-left: 20px;
  border-left: 1px solid var(--hairline);
}

.hero__facts dd {
  margin: 8px 0 0;
  font-size: 15px;
}

/* ---------- Section heads ---------- */

main > section:not(.hero) {
  padding-block: clamp(80px, 10vw, 136px) 0;
}

.section-head {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: baseline;
  margin-bottom: 40px;
}

.section-head__num,
.section-head__title,
.section-head__note {
  margin: 0;
}

.section-head__title {
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.section-head__note {
  color: var(--text-med);
  max-width: 30rem;
}

/* ---------- Ledger ---------- */

.section-head,
.ledger__row,
.flow__step,
.principles__list li {
  --in: 0.5;
}

.section-head,
.ledger__row,
.principles__list li {
  position: relative;
}

.ledger .section-head::after,
.ledger__row:not(.ledger__row--head)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--text-low);
  transform: scaleX(0.35);
  transform-origin: left;
  pointer-events: none;
}

.section-head::after {
  top: -20px;
  width: 96px;
}

/* Drawing rails belong only to the first content section. */
.ledger__row:not(.ledger__row--head)::before {
  height: 3px;
  background: var(--text-med);
}

.ledger__row:not(.ledger__row--head)::after {
  content: "";
  position: absolute;
  top: -3px;
  left: calc(35% - 9px);
  width: 9px;
  height: 9px;
  background: var(--text-hi);
  pointer-events: none;
}

.ledger__row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1.1fr) minmax(0, 1.35fr) minmax(0, 1.2fr) minmax(0, 1.4fr);
  gap: 28px;
  align-items: start;
  padding: 32px 0;
  border-top: 1px solid var(--hairline);
}

.ledger__row--head {
  padding: 0 0 14px;
  border-top: 0;
}

.ledger__row:last-child {
  border-bottom: 1px solid var(--hairline);
}

.ledger__num {
  font: 500 14px/1.6 var(--font-mono);
  color: var(--text-low);
  font-variant-numeric: tabular-nums;
}

.ledger__tool {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.ledger__tool img {
  flex: none;
  border-radius: 9px;
  outline: 1px solid var(--hairline-strong);
}

.ledger__tool h3 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.ledger__kind {
  margin: 6px 0 0;
  font: 400 12px/1.4 var(--font-mono);
  color: var(--text-low);
}

.ledger__job {
  margin: 0;
  color: var(--text-med);
}

.ledger__hosts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  font: 400 14px/1.5 var(--font-mono);
}

.ledger__hosts li {
  display: grid;
  grid-template-columns: 6ch minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
}

.ledger__hosts b {
  min-width: 0;
  font-weight: 500;
  color: var(--text-low);
}

.ledger__hosts span {
  min-width: 0;
  overflow-wrap: break-word;
}

.ledger__install {
  min-width: 0;
}

.ledger__cmd {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  background: var(--surface-2);
}

.ledger__install code {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 7px 10px;
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-med);
  cursor: pointer;
}

.copy[hidden] {
  display: none;
}

.copy:is(:hover, :focus-visible) {
  color: var(--text-hi);
}

.copy svg {
  flex: none;
}

.copy__check,
.copy[data-state="ok"] .copy__squares {
  display: none;
}

.copy[data-state="ok"] .copy__check {
  display: block;
}

.copy[data-state="ok"] {
  color: #cfe8d4;
}

.copy[data-state="error"] {
  color: var(--ember-soft);
}

.copy[aria-busy="true"] {
  color: var(--text-low);
}

.ledger__hint,
.ledger__soon {
  margin: 8px 0 0;
  font: 400 12px/1.45 var(--font-mono);
  color: var(--text-med);
}

.ledger__soon {
  color: var(--text-low);
}

.ledger__install a {
  display: inline-block;
  margin-top: 10px;
  font: 400 13px/1.4 var(--font-mono);
  color: var(--text-med);
  text-underline-offset: 3px;
}

.ledger__install a:is(:hover, :focus-visible),
.foot__links a:is(:hover, :focus-visible) {
  color: var(--text-hi);
}

.ledger__row:is(:hover, :focus-within) {
  border-top-color: var(--hairline-strong);
}

.ledger__row:is(:hover, :focus-within) .ledger__num {
  color: var(--text-hi);
}

.ledger__limits {
  margin: 24px 0 0;
  padding: 16px 20px;
  border: 1px dashed var(--hairline-strong);
  border-radius: 14px;
  font-size: 14px;
  color: var(--text-med);
}

.ledger__limits span {
  margin-right: 10px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-low);
}

.ledger__limits a {
  color: var(--text-hi);
  text-underline-offset: 3px;
  white-space: nowrap;
}

/* ---------- Workflow ---------- */

.flow {
  margin: 0;
}

.flow__steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow__step {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 28px 28px 0;
  border-top: 1px solid var(--hairline-strong);
}

.flow__step + .flow__step {
  padding-left: 28px;
  border-left: 1px solid var(--hairline);
}

/* Node on the rail, and an arrowhead into the next step. */
.flow__step::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -1px;
  width: 9px;
  height: 9px;
  background: var(--text-hi);
}

.flow__step:not(.flow__step--end)::after {
  content: "";
  position: absolute;
  top: -5px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--text-med);
  border-right: 1px solid var(--text-med);
  transform: rotate(45deg);
}

.flow__idx {
  font: 500 12px/1 var(--font-mono);
  color: var(--text-low);
}

.flow__step h3 {
  margin: 14px 0 8px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.flow__step p {
  margin: 0 0 16px;
  color: var(--text-med);
  font-size: 15px;
}

.flow__step code {
  display: inline-block;
  align-self: flex-start;
  max-width: 100%;
  margin-top: auto;
  padding: 5px 9px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.flow__back {
  position: relative;
  width: 50%;
  margin: 0;
  padding-top: 18px;
  border-top: 1px dashed var(--hairline-strong);
  font: 400 12px/1.4 var(--font-mono);
  color: var(--text-med);
}

.flow__back::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  width: 8px;
  height: 8px;
  border-bottom: 1px solid var(--text-med);
  border-left: 1px solid var(--text-med);
  transform: rotate(45deg);
}

.flow figcaption {
  margin-top: 28px;
  font: 400 12px/1.5 var(--font-mono);
  color: var(--text-low);
}

/* ---------- Principles ---------- */

.principles__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: principle;
}

.principles__list li {
  padding-top: 20px;
  border-top: 1px solid var(--hairline-strong);
  counter-increment: principle;
}

.principles__list li::before {
  display: inline-block;
  content: "0" counter(principle);
  font: 500 12px/1 var(--font-mono);
  color: var(--text-low);
}

.principles__list h3 {
  margin: 18px 0 12px;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.principles__list p {
  margin: 0;
  color: var(--text-med);
}

/* ---------- Footer ---------- */

.foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px 40px;
  margin-top: clamp(96px, 12vw, 160px);
  padding-block: 40px 96px;
  border-top: 1px solid var(--hairline);
}

.foot__brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.foot__brand p {
  margin: 0;
  font-weight: 600;
}

.foot__brand span {
  font: 400 12px/2 var(--font-mono);
  color: var(--text-low);
}

.foot__links {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px 32px;
  font-size: 14px;
}

.foot__links a {
  color: var(--text-med);
  text-underline-offset: 3px;
}

.foot__note {
  grid-column: 1 / -1;
  margin: 0;
  font: 400 12px/1.4 var(--font-mono);
  color: var(--text-low);
}

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
  .ledger__row {
    grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px 28px;
  }

  .ledger__row--head {
    display: none;
  }

  .ledger__num {
    grid-row: span 3;
  }

  .ledger__tool,
  .ledger__job {
    grid-column: 2 / -1;
  }

}

@media (max-width: 1080px) {
  .flow__steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow__step:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 760px) {
  /* Visually hidden, not removed: it names the brand link. */
  .top__brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__plate {
    justify-self: start;
    width: min(100%, 300px);
    margin-top: 48px;
  }

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

  .hero__facts div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .hero__facts div:nth-child(n + 3) {
    margin-top: 18px;
    border-top: 1px solid var(--hairline);
  }

  .section-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .ledger__row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .ledger__num {
    grid-row: span 4;
  }

  .ledger__tool,
  .ledger__job,
  .ledger__hosts,
  .ledger__install {
    grid-column: 2;
  }

  .flow__steps {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 12px;
  }

  .flow__step,
  .flow__step + .flow__step,
  .flow__step:nth-child(3) {
    padding: 0 0 28px 24px;
    border-top: 0;
    border-left: 1px solid var(--hairline-strong);
  }

  .flow__step code {
    margin-top: 0;
  }

  .flow__step::before {
    top: 2px;
    left: -5px;
  }

  .flow__step:not(.flow__step--end)::after {
    top: auto;
    right: auto;
    bottom: 6px;
    left: -5px;
    transform: rotate(135deg);
  }

  .flow__back {
    width: 100%;
  }

  .principles__list {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .foot {
    grid-template-columns: minmax(0, 1fr);
  }

  .foot__links {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Motion ----------
   Reduced motion drops all of it. motion.js sets the plate's [data-motion] and
   --mx, --my, --sy (-1 to 1); layers shift by depth. */

@media (prefers-reduced-motion: no-preference) {
  .top__nav a,
  .ledger__install a,
  .ledger__num,
  .foot__links a {
    transition: color 180ms var(--ease-forge);
  }

  .btn {
    transition: background-color 180ms var(--ease-forge), border-color 180ms var(--ease-forge), transform 140ms var(--ease-forge);
  }

  .btn:active {
    transform: translateY(1px);
  }

  .ledger__row {
    transition: border-color 240ms var(--ease-forge);
  }

  .ledger__row:not([data-motion]) .ledger__tool img {
    transition: transform 240ms var(--ease-forge);
  }

  .ledger__row:is(:hover, :focus-within) .ledger__tool img {
    transform: translateY(-2px);
  }

  .hero__plate[data-motion] {
    --pitch: 1;
    --mx: 0;
    --my: 0;
    --sy: 0;
    --travel: 24px;
    --ly: clamp(-1, calc(var(--my) + var(--sy)), 1);
    perspective: 1100px;
  }

  .hero__plate[data-motion] .plate {
    transform: translateY(calc(var(--sy) * var(--travel)))
      rotateX(clamp(-5deg, calc(var(--sy) * var(--pitch) * 3deg - var(--my) * 4deg), 5deg))
      rotateY(calc(var(--mx) * 4deg));
  }

  .hero__plate[data-motion] :is(.plate__rule, .plate__corner, .plate__tag, .plate__dot) {
    translate: calc(var(--mx) * var(--depth)) calc(var(--ly) * var(--depth));
  }

  .plate__rule { --depth: 8px; }
  .plate__corner { --depth: 16px; }
  .plate__tag { --depth: 0px; }
  .plate__dot { --depth: 24px; }

  .hero__plate[data-motion] .plate__rule--x {
    transform: scaleX(calc(0.65 + var(--sy) * 0.35));
    transform-origin: left;
  }

  .hero__plate[data-motion] .plate__rule--y {
    transform: scaleY(calc(0.65 - var(--sy) * 0.35));
    transform-origin: top;
  }

  .copy {
    transition: color 180ms var(--ease-forge), border-color 180ms var(--ease-forge);
  }

  /* Direct scroll progress, with no transition lag or hidden reading content. */
  .ledger .section-head[data-motion]::after,
  .ledger__row[data-motion]::before {
    transform: scaleX(calc(0.15 + 0.85 * var(--in)));
  }

  .ledger__row[data-motion]::after {
    left: calc((0.15 + 0.85 * var(--in)) * 100% - 9px);
  }

  /* Finite arrivals: workflow assembles upward, principles swipe across,
     headings and the footer simply fade. No scroll progress on reading text. */
  [data-scene="in"] {
    animation: scene-fade 600ms ease-out 120ms both;
  }

  .flow__step[data-scene="in"] {
    animation: scene-rise 650ms ease-out 120ms both;
  }

  .flow__step:nth-child(2)[data-scene="in"] {
    animation: scene-rise 650ms ease-out 190ms both;
  }

  .flow__step:nth-child(3)[data-scene="in"] {
    animation: scene-rise 650ms ease-out 260ms both;
  }

  .flow__step:nth-child(4)[data-scene="in"] {
    animation: scene-rise 650ms ease-out 330ms both;
  }

  .principles__list li[data-scene="in"] {
    animation: scene-swipe 650ms ease-out 180ms both;
  }

  .principles__list li:nth-child(2)[data-scene="in"] {
    animation: scene-swipe 650ms ease-out 250ms both;
  }

  .principles__list li:nth-child(3)[data-scene="in"] {
    animation: scene-swipe 650ms ease-out 320ms both;
  }

  [data-scene="out"] {
    animation: scene-depart 180ms ease-out both;
  }

  .workflow [data-scene]:focus-within,
  .principles [data-scene]:focus-within,
  .principles li[data-scene]:focus-within,
  .foot[data-scene]:focus-within {
    animation-name: none;
    opacity: 1;
    transform: none;
  }

  @keyframes scene-fade {
    from { opacity: 0.5; }
    to { opacity: 1; }
  }

  @keyframes scene-rise {
    from { opacity: 0.5; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
  }

  @keyframes scene-swipe {
    from { opacity: 0.5; transform: translateX(-28px); }
    to { opacity: 1; transform: none; }
  }

  @keyframes scene-depart {
    from { opacity: 1; }
    to { opacity: 0.5; }
  }

  /* Coarse pointers disable tilt only. Scroll travel and drawn rules stay live. */
  @media (hover: none), (pointer: coarse) {
    .hero__plate[data-motion] {
      --pitch: 0;
    }
  }
}
