/* Aeternaxis v5 home page: sections 4.0 to 4.6.
   Follows SPEC §6 and §11 tokens, radius, motion, and shadow rules.
   Sections use the shared system in base.css: heading left of the axis, content right of it. */

/* ---------- 4.0 Hero */
.hero { padding-block: 24px 36px; }
.hero-grid { align-items: start; grid-template-rows: auto 1fr; }
.hero-grid > .hero-sheet { grid-row: 1 / span 2; }
.hero-copy .facts > span { white-space: nowrap; }
/* the sheet's label, like a museum card: the foot of the left column, level with the foot of the sheet */
.hero-legend { grid-row: 2; align-self: end; max-width: 26em; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 13px; }
.hero-copy .eyebrow { margin-bottom: 10px; }
.hero-copy .lede { margin-top: 14px; font-size: 16.5px; line-height: 1.58; }
:lang(ko) .hero-copy .lede { font-size: 16px; line-height: 1.72; }
.hero-copy .actions { margin-top: 18px; }
.hero-docs { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font: 500 15px/1 var(--font-text); }
.hero-copy .facts { margin-top: 14px; }

/* ---------- shared by 4.1 to 4.6 */
/* Compact command blocks: home shows several per section. */
.install-tabs .cmd pre, .guard-out-box pre { padding: 10px 14px; font-size: 12.5px; line-height: 1.55; }
.install-tabs .cmd-out .cmd-head, .loop-excerpt .cmd-head, .guard-out-box .cmd-head { min-block-size: 32px; padding-inline: 14px; }

/* ---------- 4.1 Install */
.install-tabs [role="tablist"] { margin-bottom: 12px; }
.install-tabs .cmd + .cmd { margin-top: 8px; }
.install-tabs .mcp-paths { margin: 10px 0; }
.install-tabs .install-note { margin: 6px 0 10px; }
.install-tabs .mcp-boundary { margin: 12px 0 0; color: var(--ink); font-weight: 500; }
.panel-nojs { display: none; margin: 0 0 8px; font: 500 12px/1.5 var(--font-mono); }
html:not(.js) .panel-nojs { display: block; }
.install-foot { font-size: 14px; line-height: 1.55; }
.install-foot p { margin: 0; }
.install-pkg { color: var(--ink-2); }
.install-status a, .install-guide a { display: inline-block; padding-block: 11px; font-weight: 500; }

/* ---------- 4.2 The loop: four steps left of the axis, the sheet and its annotation right of it */
.loop-steps { list-style: none; margin: 20px 0 0; padding-left: 0; }
.loop-step { border-top: 1px solid var(--rule); padding-bottom: 8px; transition: border-color var(--t2) var(--ease); }
.js .loop-step.is-active { border-top-color: var(--ink); }
.loop-heading { margin: 0; font: inherit; }
.loop-step-head, .loop-step-btn {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: baseline; column-gap: 0;
  width: 100%; min-height: 44px; padding: 9px 0 2px; background: none; border: 0; color: inherit; font: inherit; text-align: left;
}
.loop-step-btn { cursor: pointer; }
.loop-num, .loop-file { font-size: 12px; font-weight: 400; color: var(--ink-2); }
.js .loop-step.is-active .loop-num { color: var(--ink); }
.loop-title { font: 500 17px/1.4 var(--font-text); }
.loop-file { padding-left: 12px; }
.loop-desc { margin: 0 0 0 28px; max-width: 34em; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
:lang(ko) .loop-desc { line-height: 1.7; }

.loop-stage {
  position: sticky; top: calc(var(--nav-h) + 20px);
  display: grid; grid-template-columns: minmax(0, 336px) minmax(0, 1fr); gap: 20px 24px; align-items: start;
}
/* --bar: the row of tabs above the paper. --fade: the paper runs out into the page at the foot
   (a blurred inset shadow in the page colour; the sheet is longer than its frame). */
.loop-deck {
  --bar: 32px; --fade: inset 0 -64px 32px -32px var(--paper);
  position: relative; max-width: 336px; perspective: 1100px;
}

/* The original lies under the copy and is the same paper. It shows at step 4, when the copy slides
   off it; its tab and note sit in the tab row, above its own corner. */
.loop-sheet-orig {
  position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: flex-start; gap: 8px;
  opacity: 0;
  transition: transform var(--t4) var(--ease), opacity var(--t4) var(--ease);
}
.loop-sheet-orig::before, .loop-sheet-orig::after, .loop-sheet-frame::before, .loop-sheet-frame::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
}
.loop-sheet-orig::before, .loop-sheet-orig::after { top: var(--bar); }
/* the paper's edge: a hairline on three sides, none at the foot */
.loop-sheet-orig::before, .loop-sheet-frame::before { border: solid rgb(23 24 27 / .12); border-width: 1px 1px 0; }
.loop-sheet-orig::before { background: color-mix(in srgb, var(--sheet) 95%, #17181b); }
.loop-sheet-orig::after, .loop-sheet-frame::after { box-shadow: var(--fade); }
.loop-stage[data-step="4"] .loop-sheet-orig { transform: translate(-14px, 6px); opacity: 1; }
.loop-orig-note {
  position: relative; margin: 0; min-width: 0; font-size: 12px; line-height: 23px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 100px);
}

.loop-sheet-card { position: relative; z-index: 1; transition: transform var(--t4) var(--ease); }
.loop-stage[data-step="4"] .loop-sheet-card { animation: loop-turn var(--t4) var(--ease) forwards; }
@keyframes loop-turn {
  0% { transform: rotateY(0deg) translate(0, 0); }
  45% { transform: rotateY(-78deg) scale(.97); }
  100% { transform: rotateY(0deg) translate(8px, 0); }
}

/* The tabs stand on the page, so they take the page's inks in both themes. */
.loop-sheet-bar { display: flex; align-items: flex-start; justify-content: space-between; height: var(--bar); }
.loop-tab {
  position: relative; display: inline-block; flex: none; padding: 2px 8px; font: 500 12px/1.4 var(--font-mono);
  border-radius: 2px; border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap;
}
.loop-tab[hidden] { display: none; }
.loop-tab-orig { border-color: var(--ink); color: var(--ink); }
.loop-tab-prop { border-color: var(--pencil); color: var(--pencil); }
/* The copy is a file, not a decision: ink. The seal stays with the sheet. */
.loop-tab-copy { margin-left: auto; border-color: var(--ink); color: var(--ink); }

.loop-sheet-frame { position: relative; aspect-ratio: 210 / 236; overflow: hidden; }
.loop-sheet-frame::before { z-index: 4; }
.loop-sheet-frame::after { z-index: 5; }

/* The annotation and the excerpt swap with the step (240ms crossfade); without JS all four show. */
.loop-annot, .loop-excerpts { display: grid; min-width: 0; }
.loop-annot { padding-top: 8px; border-top: 1px solid var(--ink); }
.loop-excerpts { grid-column: 1 / -1; }
.loop-annot-item, .loop-excerpt { grid-area: 1 / 1; min-width: 0; }
.js .loop-annot-item, .js .loop-excerpt {
  opacity: 0; visibility: hidden;
  transition: opacity var(--t2) var(--ease), visibility 0s linear var(--t2);
}
.js .loop-stage[data-step="1"] [data-step="1"],
.js .loop-stage[data-step="2"] [data-step="2"],
.js .loop-stage[data-step="3"] [data-step="3"],
.js .loop-stage[data-step="4"] [data-step="4"] { opacity: 1; visibility: visible; transition-delay: 0s; }
html:not(.js) .loop-annot-item, html:not(.js) .loop-excerpt { grid-area: auto; }
html:not(.js) .loop-annot-item + .loop-annot-item, html:not(.js) .loop-excerpt + .loop-excerpt { margin-top: 12px; }
.loop-annot p { margin: 0; }
.loop-annot-k { font-size: 12px; color: var(--ink-2); }
.loop-annot-t { margin-top: 2px; font-weight: 500; font-size: 17px; line-height: 1.4; }
.loop-annot-b { margin-top: 4px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
/* 12px keeps each line of the vendored JSON whole in seven columns (a sha256 line is 86 characters). */
.loop-excerpt .cmd pre { padding: 10px 14px; font-size: 12px; line-height: 1.55; }

/* ---------- 4.3 Two checks: the live guard right of the axis, the style check under the heading */
.check-col { min-width: 0; }
.check-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 27px; }
.check-name { margin: 0; font: 500 14px/27px var(--font-mono); }
.check-desc { margin: 4px 0 0; max-width: 40em; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
:lang(ko) .check-desc { line-height: 1.7; }

.guard-reset {
  min-height: 44px; padding: 0 12px; font: 500 13px/1 var(--font-text);
  color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 4px; cursor: pointer;
}
.guard-reset[hidden] { display: none; }
.guard-reset:hover { border-color: var(--ink); }
.guard-lbl { display: block; margin: 0 0 4px; font: 400 12px/1.5 var(--font-mono), var(--font-text); color: var(--ink-2); }
.guard-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin-top: 14px; }
.guard-before { margin: 0; padding: 8px 0; font-size: 15px; line-height: 1.7; }
.guard-edit textarea {
  display: block; width: 100%; min-height: 96px; padding: 7px 10px; resize: vertical; field-sizing: content;
  font: 400 15px/1.7 var(--font-text); color: var(--ink); background: var(--paper);
  border: 1px solid var(--ink); border-radius: 2px;
}
.guard-edit textarea[readonly] { border-color: var(--rule); }
.guard-out-box { margin-top: 14px; }
/* A check's finding is a flag. The seal is a person's decision. */
.guard-live-badge { font-size: 12px; color: var(--flag); }
.guard-live-badge.is-clean { color: var(--ink-2); }

.style-sample { margin: 14px 0 0; }
.style-sample blockquote { margin: 0; font-size: 15px; line-height: 1.7; }
.st-hit {
  background: color-mix(in srgb, var(--flag) 14%, transparent);
  color: inherit; border-bottom: 2px solid var(--flag); padding: 0 2px; border-radius: 2px;
}
.style-notes-lbl { margin: 14px 0 0; }
.style-notes { list-style: none; margin: 4px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.style-note { padding: 7px 0; border-bottom: 1px solid var(--rule); }
.style-note-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 12.5px; }
.style-rule-id { font-size: inherit; font-weight: 500; padding: 0; background: none; }
.style-sev, .style-try { font-size: inherit; color: var(--ink-2); }
.style-sev { color: var(--flag); }
.style-note p { margin: 2px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }

/* ---------- 4.4 Workspace: one capture, Review and Fill behind tabs */

/* ---------- 4.6 Company */
.company-prose { font-size: 17px; line-height: 1.6; }
:lang(ko) .company-prose { line-height: 1.75; }
.company-prose p { margin-bottom: .7em; }
.company-rows { margin: 20px 0 0; border-top: 1px solid var(--rule); }
.company-row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px 16px;
  padding: 8px 0; border-bottom: 1px solid var(--rule); align-items: baseline;
}
.company-row dt { margin: 0; font-size: 12px; color: var(--ink-2); }
.company-row dd { margin: 0; font-size: 15px; line-height: 1.55; }
.company-sign { margin-bottom: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.company-sign a { display: inline-block; padding-block: 11px; }

/* ---------- Responsive */
@media (max-width: 1100px) {
  .guard-pair { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .loop-stage { grid-template-columns: minmax(0, 1fr); }
  .loop-annot { grid-row: 2; }
}

@media (max-width: 767px) {
  .hero { padding-block: 24px 36px; }
  .hero-copy .lede { margin-top: 14px; font-size: 16px; }
  :lang(ko) .hero-copy .lede { font-size: 15.5px; line-height: 1.72; }
  .hero-copy .actions { margin-top: 18px; }
  .hero-copy .facts { margin-top: 14px; }
  .hero .sx-hero { margin-top: 20px; }
  .hero-grid { grid-template-rows: none; }
  .hero-grid > .hero-sheet, .hero-legend { grid-row: auto; }
  .hero-legend { align-self: auto; margin-top: 24px; padding-top: 16px; }

  /* The steps fold to their titles; the open one shows its text, the sheet follows right below. */
  .loop-steps { margin: 0 0 20px; }
  .js .loop-step { padding-bottom: 0; }
  .js .loop-step:not(.is-active) .loop-desc { display: none; }
  .js .loop-step.is-active { padding-bottom: 10px; }
  .loop-step:last-child { border-bottom: 1px solid var(--rule); }
  .loop-stage { position: static; row-gap: 16px; }
  .loop-annot { grid-row: auto; }
  .loop-annot-k { display: none; }
  .loop-deck { --fade: inset 0 -48px 24px -24px var(--paper); max-width: 264px; }
  /* No reserved height on a phone: only the open step's annotation and excerpt take room. */
  .js .loop-annot-item, .js .loop-excerpt { display: none; transition: none; }
  .js .loop-stage[data-step="1"] [data-step="1"],
  .js .loop-stage[data-step="2"] [data-step="2"],
  .js .loop-stage[data-step="3"] [data-step="3"],
  .js .loop-stage[data-step="4"] [data-step="4"] { display: block; }
  .loop-stage[data-step="4"] .loop-sheet-orig { transform: translate(-6px, 6px); }
  .loop-stage[data-step="4"] .loop-sheet-card { animation: none; transform: translate(6px, 0); }

  .check-style { margin-top: 32px; }

  .shots .shot picture { display: block; max-width: 240px; }
  .company-prose { font-size: 16px; }

  .company-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* ---------- the opening: the AX solid on the page axis (stage.js)
   The pin holds still for --scene of scrolling while the solid folds into the A; the A then rides the axis
   down to the seal on the plan slip. Without the fold (no JavaScript, no WebGL, reduced motion) the stage
   is one screen that scrolls away like any section. */
.stage { --scene: 90svh; --pin-h: max(520px, calc(100svh - var(--nav-h))); position: relative; height: calc(var(--pin-h) + var(--scene)); }
html:not(.stage-fold) .stage { --scene: 0px; }
.stage-pin { position: sticky; top: var(--nav-h); height: var(--pin-h); overflow: hidden; background: var(--paper); }
.stage-fold .stage-pin { background: none; }
.stage-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
:root[data-theme="dark"] .stage-poster { filter: brightness(.55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stage-poster { filter: brightness(.55); } }
.gl-on .stage-poster { visibility: hidden; }
.stage-gl { display: none; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.gl .stage-gl { display: block; }
.grabbing .stage-gl { cursor: grabbing; }
.folded .stage-gl { visibility: hidden; }

.stage-caps { position: absolute; inset: 0; pointer-events: none; }
html:not(.gl) .stage-caps { display: none; }
.stage-cap { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; }
.stage-cap > span { display: block; transform: translateX(-50%); white-space: nowrap; font: 400 12px/1 var(--font-mono); letter-spacing: .02em; color: var(--ink-2); }
.stage-cap b { margin-left: 4px; font: 400 26px/1 var(--font-display); color: var(--ink); vertical-align: -3px; }

.stage-ui { position: absolute; left: 0; right: 0; bottom: 0; padding-bottom: clamp(28px, 7vh, 72px); align-items: end; pointer-events: none; }
.stage-say > *, .stage-ctl > * { will-change: transform, opacity; }
.stage-say .eyebrow { margin-bottom: 14px; }
.stage-lead { margin: 0; font: 400 clamp(30px, 2.7vw, 40px)/1.1 var(--font-display); letter-spacing: -.016em; text-wrap: balance; }
:lang(ko) .stage-lead { font-family: var(--font-display-ko); font-size: clamp(26px, 2.3vw, 34px); line-height: 1.36; letter-spacing: -.035em; word-break: keep-all; }
.stage-solid { margin: 16px 0 0; max-width: 30em; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
:lang(ko) .stage-solid { line-height: 1.7; }
.stage-ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.stage-mats { display: inline-flex; align-items: center; gap: 0; pointer-events: auto; }
.stage-mats[hidden], .stage-drag[hidden], .stage-scroll[hidden] { display: none; }
.stage-mats button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 2px; background: none; cursor: pointer; }
.stage-mats .sw { display: block; width: 16px; height: 16px; border: 1px solid rgb(23 24 27 / .28); border-radius: 1px; transition: transform var(--t2) var(--ease); }
.stage-mats button[aria-pressed="true"] .sw { outline: 1px solid var(--ink); outline-offset: 3px; }
.stage-mats button:hover .sw { transform: translateY(-2px); }
.sw0 { background: #cfe3e5; }
.sw1 { background: #8f959d; }
.sw2 { background: #ebe7de; }
.sw3 { background: #17181b; }
.sw4 { background: #b3251c; }
.mat-name { min-width: 5.5em; margin-right: 6px; font: 400 12px/1 var(--font-mono); color: var(--ink-2); text-align: right; }
.mat-name.swap { animation: mat-in var(--t3) var(--ease); }
@keyframes mat-in { from { opacity: 0; transform: translateY(4px); } }
.stage-drag, .stage-scroll { margin: 0; font: 400 13px/1.45 var(--font-text); color: var(--ink-2); }
.stage-scroll { color: var(--ink); }

/* the A in flight, over the page */
.ax-fly { position: fixed; left: 0; top: 0; z-index: 20; width: 44px; height: 44px; overflow: visible; pointer-events: none; visibility: hidden; transform-origin: 50% 50%; will-change: transform; }

@media (max-width: 767px) {
  .stage { --scene: 70svh; --pin-h: max(480px, calc(100svh - var(--nav-h))); }
  .stage-ui { padding-bottom: 28px; }
  .stage-caps { display: none; }
  .stage-solid { margin-top: 10px; font-size: 13px; }
  .stage-ctl { align-items: flex-start; text-align: left; margin-top: 18px; }
  .stage-mats { margin-left: -12px; }
  .mat-name { order: 9; min-width: 0; margin: 0 0 0 6px; text-align: left; }
  .stage-drag { display: none; }
  .stage-cap b { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .mat-name.swap { animation: none; }
}
