/* Ghostline — one page, dressed as a fight card: carmine field, wide wordmark,
   product fragments on charcoal so the recordings keep their own colours. */

:root {
  --ground: #9c1220;
  --ground-deep: #8a101c;
  --ground-soft: #a92330;
  --ink: #ffffff;
  --muted: #f4c6c9;
  --accent: #ffd9dc;
  --accent-ink: #9c1220;
  --char: #141111;
  --char-2: #1d1918;
  --char-ink: #f1f3f7;
  --char-muted: #a9a0a0;

  --pad: clamp(20px, 4vw, 56px);
  --step-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.375rem, 1.2rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(3rem, 1.6rem + 8.4vw, 8.5rem);

  --gap-section: clamp(96px, 12vw, 190px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Switzer", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--step-body);
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Panchang", "Switzer", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 0.98;
  margin: 0;
}

p { margin: 0; }

a { color: inherit; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- top bar ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 20px var(--pad);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ground);
}

.mark {
  font-family: "Panchang", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  text-decoration: none;
}

.nav { display: flex; gap: 22px; margin-left: 12px; }

.nav a {
  font-size: var(--step-small);
  text-decoration: none;
  color: var(--muted);
  padding: 6px 0;
}

.nav a:hover { color: var(--ink); }

.action {
  margin-left: auto;
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--step-small);
  padding: 10px 18px;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.action:hover { background: var(--ink); }
.action:active { transform: translateY(1px); }

.action.big {
  font-size: var(--step-body);
  padding: 16px 28px;
  margin-top: 32px;
}

/* ---------- sections ---------- */

main > section {
  padding: 0 var(--pad);
  margin-top: var(--gap-section);
}

.lead {
  font-size: var(--step-lead);
  line-height: 1.4;
  max-width: 34ch;
  margin-top: 22px;
  color: var(--ink);
  opacity: 0.88;
}
.lead code { color: var(--ink); }

h2 { font-size: var(--step-head); max-width: 20ch; }

/* ---------- hero ---------- */

.hero { margin-top: 8px; }

.hero h1 { font-size: var(--step-display); }

/* English words are wider than the Russian ones at the same size: cap the
   display step so "ANSWERS." fits the content width on a phone. */
html[lang="en"] .hero h1 { font-size: min(var(--step-display), 10.9vw); }

.hero .lead { max-width: 46ch; margin-top: 28px; }

.hero-media {
  margin: 56px 0 0;
  background: var(--char);
}

.hero-media video {
  display: block;
  width: 100%;
  aspect-ratio: 1180 / 540;
  object-fit: cover;
  background: var(--char);
}

.hero-media figcaption {
  padding: 14px 18px;
  color: var(--char-muted);
  font-size: var(--step-small);
  background: var(--char-2);
}

/* ---------- showcase ---------- */

.player { background: var(--char); margin-top: 44px; }

.player-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  background: var(--char-2);
}

.switch { display: flex; gap: 8px; }

.switch button {
  font: inherit;
  font-size: var(--step-small);
  color: var(--char-ink);
  background: #2a2524;
  border: 0;
  border-radius: 0;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.switch button:hover { background: #352f2d; }

.switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.clock {
  margin-left: auto;
  font-size: var(--step-small);
  color: var(--char-muted);
  font-variant-numeric: tabular-nums;
}

.player video {
  display: block;
  width: 100%;
  aspect-ratio: 1180 / 540;
  background: var(--char);
}

.chapters {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.chapters button {
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--ground-deep);
  border: 0;
  border-radius: 0;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background-color 0.15s ease;
}

.chapters button:hover { background: var(--ground-soft); }

.chapters .t {
  font-size: var(--step-small);
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.chapters .n { font-size: var(--step-body); }

/* ---------- moments ---------- */

.acts { margin-top: 44px; display: grid; gap: 6px; }

details {
  background: var(--ground-deep);
  transition: background-color 0.2s ease;
}

details[open] { background: var(--ground-soft); }

summary {
  list-style: none;
  cursor: pointer;
  padding: 22px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 22px;
}

summary::-webkit-details-marker { display: none; }

summary h3 {
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2.2rem);
  line-height: 1;
}

summary:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

summary .t {
  font-size: var(--step-small);
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.act-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 44px);
  padding: 6px 22px 26px;
  align-items: start;
}

.act-text p { max-width: 46ch; }
.act-text p + p { margin-top: 14px; }

.act-keys { font-size: var(--step-body); color: var(--ink); opacity: 0.92; }

kbd {
  font-family: "Switzer", sans-serif;
  font-size: inherit;
  font-weight: 500;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 0;
  padding: 1px 8px;
  white-space: nowrap;
}

.still { margin: 0; }

.still img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--char);
}

/* ---------- keys ---------- */

.keylist {
  list-style: none;
  margin: 44px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.keylist li {
  display: grid;
  grid-template-columns: 13ch 22ch 1fr;
  gap: 18px;
  align-items: baseline;
  padding: 18px;
}

.keylist li:nth-child(odd) { background: var(--ground-deep); }

.keylist kbd {
  justify-self: start;
  font-size: var(--step-body);
  padding: 6px 12px;
}

.keylist b {
  font-family: "Panchang", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  font-size: var(--step-body);
  line-height: 1.1;
}

.keylist span { color: var(--ink); opacity: 0.82; }

/* Auxiliary chords: settings, manual entry, move, scale, permissions, Esc.
   Three across, two down on a desktop; they wrap rather than shrink below. */
.keygrid {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.keygrid li {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  background: var(--ground-deep);
}

.keygrid kbd {
  justify-self: start;
  font-size: var(--step-small);
  padding: 5px 10px;
}

.keygrid b {
  font-family: "Panchang", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  font-size: var(--step-small);
  line-height: 1.15;
}

.keygrid span {
  color: var(--ink);
  opacity: 0.82;
  font-size: var(--step-small);
  line-height: 1.45;
}

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

@media (max-width: 640px) {
  .keygrid { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; row-gap: 8px; }
  .top .action { margin-left: auto; white-space: nowrap; font-size: 13px; padding: 9px 12px; }
}

/* ---------- questions ---------- */

.qa { margin-top: 44px; display: grid; gap: 6px; }

.qa article {
  padding: 28px 24px;
  background: var(--ground-deep);
  display: grid;
  grid-template-columns: minmax(220px, 30ch) 1fr;
  gap: 24px;
  align-items: start;
}

.qa article:nth-child(even) { background: var(--ground-soft); }

.qa h3 {
  font-size: var(--step-lead);
  line-height: 1.02;
}

.qa p { opacity: 0.92; max-width: 62ch; }
.qa code { color: var(--ink); background: rgba(0, 0, 0, 0.18); padding: 1px 6px; overflow-wrap: anywhere; }

/* ---------- build ---------- */

.build {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}

.build-text .lead { max-width: 30ch; }

.downloads {
  background: var(--char);
  padding: 26px 24px;
  display: grid;
  gap: 14px;
  justify-items: stretch;
  align-content: start;
}

.downloads .action.big {
  margin: 0;
  text-align: center;
}

.action.busy {
  background: transparent;
  color: var(--char-muted);
  box-shadow: inset 0 0 0 1px currentColor;
  cursor: not-allowed;
}

.action.busy:hover { background: transparent; }

.commands {
  margin: 0;
  background: var(--char);
  color: var(--char-ink);
  padding: 26px 24px;
  overflow-x: auto;
  font-size: var(--step-body);
  line-height: 1.7;
}

.build-code .fine {
  max-width: 70ch;
  overflow-wrap: anywhere;
  margin-top: 16px;
  font-size: var(--step-small);
  opacity: 1;
}
.build-code .fine code { color: var(--ink); background: rgba(0, 0, 0, 0.18); padding: 1px 6px; }

/* ---------- footer ---------- */

.foot {
  margin-top: var(--gap-section);
  padding: 0 var(--pad) 40px;
}

.foot-mark {
  font-family: "Panchang", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  /* Fit the wordmark to the content width: 9.4em is the measured word length,
     so it spans the page without bleeding past the right edge at any width. */
  font-size: min(10.2vw, calc((100vw - 2 * var(--pad)) / 9.4), 9.5rem);
  line-height: 0.8;
  white-space: nowrap;
}

.foot-note {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 24px;
  font-size: var(--step-small);
  opacity: 0.85;
}

/* ---------- motion ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-reveal].in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .action, .switch button, .chapters button, details { transition: none; }
}

/* ---------- phone ---------- */

@media (max-width: 820px) {
  .nav { display: none; }

  .top { gap: 12px; }

  .lead { max-width: 32ch; }

  .act-body { grid-template-columns: 1fr; }

  .keylist li {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .keylist kbd { font-size: var(--step-body); }

  .qa article {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .build { grid-template-columns: 1fr; }

  .chapters { grid-template-columns: 1fr; gap: 2px; }

  .chapters button {
    background: transparent;
    padding: 12px 2px;
  }

  .chapters button:hover { background: transparent; }

  .foot-note { flex-direction: column; gap: 6px; }
}

/* ---------- hero: the session drawn as text ---------- */

.hero-ascii { margin: 56px 0 0; }

.hero-ascii pre {
  margin: 0;
  padding: clamp(14px, 2vw, 26px);
  background: #000;
  color: #e8e8e8;
  font: 400 clamp(9px, 1.15vw, 17px)/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

.hero-ascii figcaption {
  margin-top: 12px;
  font-size: var(--step-small);
  opacity: 0.75;
  max-width: 46ch;
}

/* ---------- language switch ---------- */

.lang {
  display: flex;
  gap: 2px;
  margin-left: 14px;
  font-size: var(--step-small);
}

.lang a {
  padding: 4px 5px;
  text-decoration: none;
  opacity: 0.55;
}

.lang a:hover { opacity: 1; }

.lang a[aria-current="true"] {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
