/* k-hole site: page layout and scroll scenes on top of Quiet Glass UI (vendor/quiet-glass).
   Components come from the library unchanged; this file only places them, with its tokens.
   Unlayered on purpose: it sits above the library's @layer qg.* rules. */

:root {
  --site-max: 1240px;
  --site-gutter: max(16px, 4vw);
  --site-bar: 64px;
}

html {
  scroll-padding-top: calc(var(--site-bar) + 16px);
}
body {
  background: var(--q-bg);
  color: var(--q-ink);
  overflow-x: clip;
}

/* Screenshots never distort: width follows the column, height follows the ratio. */
img {
  height: auto;
}

.site-skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: calc(var(--q-z-topbar) + 1);
}
.site-skip:focus {
  top: 12px;
}

/* ---- the top bar (qg-topbar is fixed glass; the site only sets its content) -------------- */
.site-bar {
  --q-bar-h: var(--site-bar);
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--q-ink);
  text-decoration: none;
  font-size: 22px;
}
.site-brand svg {
  width: 26px;
  height: 26px;
  color: var(--q-ink);
}
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--q-space-1);
}
.site-nav a:not(.qg-btn) {
  color: var(--q-ink-2);
  text-decoration: none;
  font-size: var(--q-text-md);
  font-weight: var(--q-weight-medium);
  padding: 8px 12px;
  border-radius: var(--q-radius-sm);
  transition: color var(--q-dur-fast), background var(--q-dur-fast);
}
.site-nav a:not(.qg-btn):hover {
  color: var(--q-ink);
  background: hsl(var(--q-hue) 20% 90% / 0.06);
}
.site-nav a[aria-current='page'] {
  color: var(--q-ink);
}
@media (max-width: 560px) {
  .site-nav .site-nav__extra {
    display: none;
  }
  .site-nav a:not(.qg-btn) {
    padding: 8px;
  }
}

/* ---- page frame ------------------------------------------------------------------------ */
.site-main {
  position: relative;
  z-index: 1;
  padding-top: var(--site-bar);
}
.wrap {
  width: min(100% - 2 * var(--site-gutter), var(--site-max));
  margin-inline: auto;
}
.site-section {
  padding-block: clamp(72px, 11vw, 140px) 0;
}
.site-head {
  display: grid;
  gap: var(--q-space-4);
  max-width: 68ch;
}
.site-head.is-center {
  margin-inline: auto;
  text-align: center;
  justify-items: center;
}

h1, h2, h3 {
  text-wrap: balance;
}
.site-h1 {
  font-size: clamp(2.5rem, 6.4vw, 4.75rem);
  font-weight: var(--q-weight-medium);
  line-height: 1.04;
  letter-spacing: -0.035em;
}
.site-h2 {
  font-size: clamp(1.875rem, 3.8vw, 3rem);
  font-weight: var(--q-weight-medium);
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.site-h1 b,
.site-h2 b {
  font-weight: var(--q-weight-semibold);
  color: var(--q-accent);
}
.site-lede {
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: var(--q-ink-2);
  max-width: 62ch;
  text-wrap: pretty;
}
.site-body {
  font-size: var(--q-text-lg);
  line-height: 1.6;
  color: var(--q-ink-2);
  text-wrap: pretty;
}
.site-note {
  font-size: var(--q-text-sm);
  color: var(--q-ink-muted);
}

/* keyboard chips */
kbd {
  display: inline-block;
  font: var(--q-weight-medium) 0.8125rem/1 var(--q-font-mono);
  padding: 4px 7px 5px;
  border-radius: 6px;
  border: 1px solid var(--q-line-2);
  border-bottom-width: 2px;
  background: var(--q-surface-3);
  color: var(--q-ink);
  white-space: nowrap;
  vertical-align: 0.08em;
}
.keys {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ---- screenshot frames ----------------------------------------------------------------- */
.shot {
  display: block;
  border-radius: var(--q-radius-md);
  overflow: hidden;
  border: 1px solid var(--q-glass-edge);
  box-shadow: var(--q-glass-inset), var(--q-elev-3);
  background: var(--q-surface-1);
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
}
a.shot {
  transition: border-color var(--q-dur-base) var(--q-ease);
}
/* a deliberate detail: the full 16:10 frame, moved and scaled toward what matters (--z),
   inside a box of the same ratio, so nothing is ever stretched. The link opens the whole. */
.shot.is-zoom {
  position: relative;
  aspect-ratio: 16 / 10;
}
.shot.is-zoom img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 0 0;
  transform: var(--z);
}
@media (max-width: 899px) {
  .shot.is-zoom-narrow {
    position: relative;
    aspect-ratio: 16 / 10;
  }
  .shot.is-zoom-narrow img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: 0 0;
    transform: var(--z);
  }
}
a.shot:hover {
  border-color: var(--q-accent-line);
}
figure.site-fig {
  display: grid;
  gap: var(--q-space-3);
  margin: 0;
}
figure.site-fig figcaption {
  font-size: var(--q-text-sm);
  color: var(--q-ink-muted);
}

/* ---- hero ------------------------------------------------------------------------------ */
.hero {
  padding-block: clamp(56px, 9vw, 104px) 0;
  display: grid;
  gap: var(--q-space-6);
  justify-items: center;
  text-align: center;
}
.hero .site-h1 {
  max-width: 15ch;
}
.hero .site-lede {
  margin-inline: auto;
}
.hero-stage {
  position: relative;
  width: min(100%, 1120px);
  margin-top: clamp(28px, 5vw, 56px);
  perspective: 1600px;
}
.hero-screen {
  transform-origin: 50% 0;
  will-change: transform;
}
.maker {
  position: absolute;
  right: clamp(-28px, -2vw, 0px);
  bottom: clamp(-56px, -4vw, -24px);
  width: min(460px, 80%);
  text-align: left;
}
.maker__field {
  display: flex;
  align-items: center;
  min-height: 48px;
  font-size: var(--q-text-lg);
  cursor: default;
}
.maker__caret {
  display: inline-block;
  width: 1.5px;
  height: 1.15em;
  margin-left: 2px;
  background: var(--q-accent);
  vertical-align: -3px;
  animation: site-blink 1s steps(1) infinite;
}
@keyframes site-blink {
  50% { opacity: 0; }
}
.maker__verdict {
  min-height: 26px;
  transition: opacity var(--q-dur-slow) var(--q-ease);
}
@media (max-width: 720px) {
  .maker {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    margin-top: -32px;
  }
}

/* entrance: CSS only, so nothing waits on a script */
@media (prefers-reduced-motion: no-preference) {
  .hero > .enter {
    animation: site-enter 560ms var(--q-ease) both;
  }
  .hero > .enter:nth-child(2) { animation-delay: 60ms; }
  .hero > .enter:nth-child(3) { animation-delay: 120ms; }
  .hero > .enter:nth-child(4) { animation-delay: 180ms; }
  .hero > .enter:nth-child(5) { animation-delay: 260ms; animation-duration: 900ms; }
}
@keyframes site-enter {
  from { opacity: 0; transform: translateY(16px); }
}

/* ---- facts ----------------------------------------------------------------------------- */
.facts {
  margin-top: clamp(96px, 12vw, 150px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  border-block: 1px solid var(--q-line);
}
.fact {
  padding: var(--q-space-6) var(--q-space-5);
  display: grid;
  gap: var(--q-space-1);
  align-content: start;
}
.fact + .fact {
  border-left: 1px solid var(--q-line);
}
.fact b {
  font: var(--q-weight-medium) 1.5rem/1.2 var(--q-font-mono);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.fact span {
  font-size: var(--q-text-sm);
  color: var(--q-ink-muted);
}
@media (max-width: 900px) {
  .fact + .fact { border-left: 0; }
  .fact { border-top: 1px solid var(--q-line); }
  .fact:first-child { border-top: 0; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(2) { border-top: 0; }
  .fact:nth-child(even) { border-left: 1px solid var(--q-line); }
}
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; }
  .fact:nth-child(2) { border-top: 1px solid var(--q-line); }
  .fact:nth-child(even) { border-left: 0; }
}

/* ---- the pinned scene ------------------------------------------------------------------
   Base (no JS, reduced motion, narrow): chapters stack, each with its own screenshot.
   .scene.is-live (JS, motion allowed, wide): one sticky 16:10 screen, chapters scroll by. */
.scene {
  position: relative;
  margin-top: clamp(40px, 6vw, 72px);
}
.chapters {
  display: grid;
  gap: clamp(64px, 9vw, 112px);
}
.chapter {
  display: grid;
  gap: var(--q-space-5);
  align-content: center;
}
.chapter__text {
  display: grid;
  gap: var(--q-space-3);
  max-width: 52ch;
}
.chapter__num {
  font: var(--q-weight-medium) var(--q-text-sm) / 1 var(--q-font-mono);
  color: var(--q-accent);
}
.chapter__title {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: var(--q-weight-medium);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.chapter__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--q-space-2);
  margin-top: var(--q-space-1);
}
.stage {
  display: none;
}

@media (min-width: 900px) {
  .scene.is-live {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: clamp(32px, 4vw, 64px);
    align-items: start;
  }
  .scene.is-live .chapters {
    gap: 0;
    padding-block: 12vh 30vh;
  }
  .scene.is-live .chapter {
    min-height: 78vh;
  }
  .scene.is-live .chapter__fig {
    display: none;
  }
  .scene.is-live .chapter__text {
    opacity: 0.32;
    transform: translateY(8px);
    transition: opacity var(--q-dur-slow) var(--q-ease), transform var(--q-dur-slow) var(--q-ease);
  }
  .scene.is-live .chapter.is-on .chapter__text {
    opacity: 1;
    transform: none;
  }
  .scene.is-live .stage {
    display: grid;
    gap: var(--q-space-3);
    position: sticky;
    top: calc(var(--site-bar) + 6vh);
    width: min(100%, (100vh - var(--site-bar) - 6vh - 72px) * 1.6);
    justify-self: end;
    grid-column: 2;
    grid-row: 1;
  }
  .scene.is-live .chapters {
    grid-column: 1;
    grid-row: 1;
  }
}
.stage__frame {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--q-radius-lg);
  border: 1px solid var(--q-glass-edge);
  box-shadow: var(--q-glass-inset), var(--q-elev-3);
  background: var(--q-surface-1);
  isolation: isolate;
}
.stage__layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 420ms var(--q-ease);
}
.stage__layer.is-on {
  opacity: 1;
}
.stage__layer img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 0 0;
  will-change: transform;
  backface-visibility: hidden;
}
.stage__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--q-space-3);
  min-height: 28px;
}
.stage__rail {
  display: flex;
  gap: 6px;
  align-items: center;
}
.stage__rail i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--q-line-strong);
  transition: background var(--q-dur-base), transform var(--q-dur-base) var(--q-ease);
}
.stage__rail i.is-on {
  background: var(--q-accent);
  transform: scale(1.5);
}

/* ---- reveal: only once a script has marked what's already on screen -------------------- */
@media (prefers-reduced-motion: no-preference) {
  .has-motion .rise {
    transition: opacity 520ms var(--q-ease), transform 520ms var(--q-ease);
  }
  .has-motion .rise:not(.is-in) {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* ---- tiers and install ----------------------------------------------------------------- */
.tiers {
  margin-top: var(--q-space-7);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: var(--q-space-4);
  align-items: stretch;
}
.tier {
  padding: var(--q-space-6);
  gap: var(--q-space-4);
}
.tier.is-lead {
  border-color: var(--q-accent-line);
  box-shadow: inset 0 0 0 1px var(--q-accent-line);
}
.tier__name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--q-space-3);
}
.tier__name h3 {
  font-size: var(--q-text-2xl);
  font-weight: var(--q-weight-medium);
}
.tier ul {
  margin: 0;
  padding-left: 1.1em;
  display: grid;
  gap: 6px;
  color: var(--q-ink-2);
  font-size: var(--q-text-md);
}
.pkgs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ways {
  margin-top: var(--q-space-7);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--q-space-4);
}
.way {
  padding: var(--q-space-6);
  gap: var(--q-space-4);
}
.way h3 {
  font-size: var(--q-text-xl);
  font-weight: var(--q-weight-medium);
}
.term {
  position: relative;
}
.term .qg-code {
  padding-right: 88px;
}
.term .qg-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}
.qg-code .p {
  color: var(--q-ink-muted);
  user-select: none;
}
.qg-code .c {
  color: var(--q-ink-muted);
}

/* ---- footer ---------------------------------------------------------------------------- */
.site-foot {
  position: relative;
  z-index: 1;
  margin-top: clamp(96px, 12vw, 160px);
  border-top: 1px solid var(--q-line);
  padding-block: var(--q-space-7) calc(var(--q-space-7) + var(--q-safe-bottom));
  color: var(--q-ink-muted);
  font-size: var(--q-text-sm);
}
.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--q-space-4);
  justify-content: space-between;
  align-items: center;
}
.site-foot nav {
  display: flex;
  gap: var(--q-space-4);
}
.site-foot a {
  color: var(--q-ink-2);
}

/* ---- features page --------------------------------------------------------------------- */
.feat-intro {
  padding-block: clamp(48px, 8vw, 96px) 0;
  display: grid;
  gap: var(--q-space-5);
}
.feat-layout {
  margin-top: clamp(40px, 6vw, 72px);
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
.feat-index {
  position: sticky;
  top: calc(var(--site-bar) + 20px);
  max-height: calc(100vh - var(--site-bar) - 40px);
  overflow: auto;
  padding-bottom: var(--q-space-4);
}
.feat-index .qg-navlist a {
  min-height: 34px;
}
.feat-index .qg-navlist .n {
  margin-left: auto;
  font: var(--q-text-xs) var(--q-font-mono);
  color: var(--q-ink-muted);
}
.feat-group {
  display: grid;
  gap: var(--q-space-6);
  padding-block: 0 clamp(56px, 8vw, 96px);
  scroll-margin-top: calc(var(--site-bar) + 16px);
}
.feat-group + .feat-group {
  border-top: 1px solid var(--q-line);
  padding-top: clamp(48px, 7vw, 80px);
}
.feat-group__head {
  display: grid;
  gap: var(--q-space-3);
  max-width: 70ch;
}
.feat-group__head .site-h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
}
.feat-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: var(--q-space-3);
}
.feat-item h3 {
  font-size: var(--q-text-lg);
  font-weight: var(--q-weight-semibold);
  line-height: 1.3;
}
.feat-item p {
  font-size: var(--q-text-md);
  line-height: 1.55;
  color: var(--q-ink-2);
  text-wrap: pretty;
}
.feat-item .keys {
  margin-top: auto;
}
.feat-figs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--q-space-4);
  align-items: start;
}
.feat-figs.is-one {
  grid-template-columns: minmax(0, 1fr);
}
.keytable {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 0 var(--q-space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.keytable li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--q-space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--q-line);
  color: var(--q-ink-2);
  font-size: var(--q-text-md);
}
@media (max-width: 900px) {
  .feat-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .feat-index {
    position: sticky;
    top: var(--site-bar);
    z-index: 5;
    max-height: none;
    margin-inline: calc(-1 * var(--site-gutter));
    padding: 8px var(--site-gutter);
    background: color-mix(in srgb, var(--q-bg) 92%, transparent);
    -webkit-backdrop-filter: var(--q-glass-filter);
    backdrop-filter: var(--q-glass-filter);
    border-bottom: 1px solid var(--q-line);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .feat-index .qg-navlist {
    flex-direction: row;
    gap: 4px;
    width: max-content;
  }
  .feat-index .qg-navlist a {
    white-space: nowrap;
    min-height: 36px;
  }
  .feat-index .qg-navlist .n,
  .feat-index .qg-navlist svg,
  .feat-index .qg-eyebrow {
    display: none;
  }
  .feat-group {
    scroll-margin-top: calc(var(--site-bar) + 72px);
  }
}
