/* LukeLang — interior page system.
   Shares the palette and motion vocabulary of the landing page; adds the
   masthead, sidebar and prose scale the documentation surfaces need. */

/* ── Page masthead ──────────────────────────────────────────────── */

.masthead {
  position: relative;
  padding: clamp(8rem, 18vh, 12rem) var(--shell) clamp(3rem, 8vh, 5rem);
  border-bottom: 1px solid var(--faint);
  overflow: hidden;
  isolation: isolate;
}
.masthead::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 62vw;
  height: 62vw;
  left: -18vw;
  top: -32vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(25, 185, 111, 0.42), transparent 66%);
  filter: blur(80px);
  animation: drift 24s ease-in-out infinite alternate;
}
.masthead::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 40vw;
  height: 40vw;
  right: -12vw;
  top: -20vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 163, 43, 0.32), transparent 66%);
  filter: blur(90px);
  animation: drift 30s 2s ease-in-out infinite alternate-reverse;
}

.masthead__kicker {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 0 1.2rem;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow);
}
.masthead__kicker::before {
  content: "";
  width: clamp(2rem, 5vw, 4rem);
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.masthead h1 {
  margin: 0;
  max-width: 18ch;
  font-size: clamp(2.4rem, 1.3rem + 4.4vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.94;
}
.masthead h1 em {
  background: linear-gradient(96deg, var(--green), var(--yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.masthead p {
  margin: 1.5rem 0 0;
  max-width: 52ch;
  font-size: var(--step-1);
  font-weight: 300;
  color: var(--mute);
  line-height: 1.4;
}

/* ── Two-column page body ───────────────────────────────────────── */

.page {
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  padding: clamp(3rem, 9vh, 6rem) var(--shell) clamp(4rem, 10vh, 7rem);
  align-items: start;
}
.page--single { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 940px) { .page { grid-template-columns: minmax(0, 1fr); } }

.sidebar { position: sticky; top: 6.5rem; min-width: 0; }
.sidebar__switch { position: absolute; opacity: 0; pointer-events: none; }
.sidebar__toggle { display: none; }

@media (max-width: 940px) {
  /* Stacked, the index is long enough to bury the page — collapse it behind a
     control that works without JavaScript. */
  .page { padding-top: clamp(1.8rem, 4vh, 2.5rem); gap: 1.8rem; }
  .masthead { padding-bottom: clamp(2rem, 5vh, 3rem); }
  .prose section + section { margin-top: clamp(2.4rem, 6vh, 3.5rem); }
  .sidebar { position: static; padding-bottom: 0; }
  .sidebar__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0;
    border-top: 1px solid var(--hair);
    border-bottom: 1px solid var(--hair);
    font-size: 0.72rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--green);
    min-height: 44px;
  }
  .sidebar__toggle::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 320ms var(--ease);
  }
  .sidebar__switch:checked ~ .sidebar__toggle::after {
    transform: rotate(225deg) translateY(-2px);
  }
  .sidebar__panel {
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 460ms var(--ease), visibility 460ms;
  }
  .sidebar__switch:checked ~ .sidebar__panel {
    max-height: 70vh;
    overflow-y: auto;
    visibility: visible;
    padding-top: 1.2rem;
  }
  .sidebar h2:first-of-type { margin-top: 0; }
  .sidebar a { padding-block: 0.55rem; }
}
.sidebar h2 {
  margin: 0 0 0.9rem;
  font-size: 0.7rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 700;
}
.sidebar ul { list-style: none; margin: 0 0 2rem; padding: 0; }
.sidebar li { margin-bottom: 0.15rem; }
.sidebar a {
  display: block;
  padding: 0.4rem 0 0.4rem 0.9rem;
  border-left: 1px solid var(--faint);
  color: var(--mute);
  font-size: var(--step--1);
  font-weight: 500;
  transition: color 300ms var(--ease), border-color 300ms var(--ease), padding-left 300ms var(--ease);
}
.sidebar a:hover {
  color: var(--white);
  border-left-color: var(--green);
  padding-left: 1.25rem;
}

/* ── Prose ──────────────────────────────────────────────────────── */

.prose { min-width: 0; max-width: 64rem; }
.prose > * + * { margin-top: 1.15rem; }

.prose section + section { margin-top: clamp(3rem, 8vh, 5.5rem); }
.prose section { scroll-margin-top: 6rem; }

.prose h2 {
  margin: 0 0 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hair);
  font-size: clamp(1.5rem, 1rem + 1.8vw, 2.4rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.prose h2 em {
  font-weight: 700;
  background: linear-gradient(92deg, var(--green), var(--yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prose h3 {
  margin: 2.4rem 0 0.8rem;
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.prose p { margin: 0; color: var(--mute); font-weight: 300; max-width: 68ch; }
.prose p strong, .prose li strong { color: var(--white); font-weight: 600; }
.prose a:not(.sidebar a):not(.btn) {
  color: var(--white);
  background-image: linear-gradient(var(--green), var(--green));
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 1px;
  transition: background-size 380ms var(--ease), color 300ms var(--ease);
}
.prose a:not(.sidebar a):not(.btn):hover {
  background-size: 0% 1px;
  background-position: 100% 100%;
  color: var(--yellow);
}

.prose ul, .prose ol { margin: 0; padding-left: 1.2rem; color: var(--mute); font-weight: 300; }
.prose li { margin-bottom: 0.5rem; max-width: 66ch; }
.prose li::marker { color: var(--green); }

.prose code:not(pre code) {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 0.86em;
  color: var(--yellow);
}

.prose pre {
  margin: 1.4rem 0;
  padding: 0 0 0 clamp(1rem, 2vw, 1.6rem);
  border-left: 1px solid var(--green);
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: clamp(0.78rem, 0.64rem + 0.34vw, 0.9rem);
  line-height: 1.95;
  max-width: 100%;
  overflow-x: auto;
}
.prose pre .ln { display: block; }
.prose pre .ln:empty { height: 0.7em; }

/* ── Definition rows (docs index, downloads, releases) ──────────── */

.rows { margin: 0; padding: 0; list-style: none; }
.rows > li {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: clamp(0.6rem, 3vw, 2.5rem);
  padding: clamp(1.1rem, 2.5vh, 1.7rem) 0;
  border-top: 1px solid var(--hair);
  position: relative;
}
.rows > li::after {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 900ms var(--ease);
}
.rows > li.is-in::after { transform: scaleX(1); }
.rows > li:last-child { border-bottom: 1px solid var(--hair); }
.rows dt, .rows .rows__key {
  margin: 0;
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--white);
}
.rows dd, .rows .rows__val {
  margin: 0;
  color: var(--mute);
  font-weight: 300;
  font-size: var(--step--1);
  max-width: 62ch;
}
.rows .rows__val code {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color: var(--yellow);
  font-size: 0.86em;
}
@media (max-width: 700px) {
  .rows > li { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
}

/* Download buttons on the binaries list */
.rows--dl > li {
  align-items: center;
}
.rows--dl .rows__val {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.1rem;
  max-width: none;
}
.btn--dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem 0.62rem;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: #04150d;
  border-radius: 0.35rem;
}
.btn--dl::before { animation-duration: 4.5s; }
.dl-meta {
  color: var(--mute);
  font-size: 0.78rem;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 300ms var(--ease), border-color 300ms var(--ease);
}
.dl-meta:hover {
  color: var(--yellow);
  border-bottom-color: var(--yellow);
}
@media (max-width: 700px) {
  .rows--dl > li { align-items: start; }
}

/* ── Syntax cheatsheet table ────────────────────────────────────── */

.sheet { width: 100%; border-collapse: collapse; margin: 1.6rem 0; font-size: var(--step--1); }
.sheet th {
  text-align: left;
  padding: 0 1.2rem 0.7rem 0;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
  border-bottom: 1px solid var(--hair);
  font-weight: 700;
}
.sheet td {
  padding: 0.75rem 1.2rem 0.75rem 0;
  border-bottom: 1px solid var(--faint);
  vertical-align: top;
  color: var(--mute);
  font-weight: 300;
}
.sheet td:first-child {
  color: var(--white);
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 0.85em;
  white-space: nowrap;
}
.sheet td b { color: var(--yellow); font-weight: 400; }

/* ── Step list (Learn) ──────────────────────────────────────────── */

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 clamp(2rem, 6vh, 3.5rem) clamp(3rem, 6vw, 4.5rem);
  border-left: 1px solid var(--hair);
  margin-left: 0.6rem;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  content: "0" counter(step);
  position: absolute;
  left: 0;
  top: 0;
  transform: translateX(-50%);
  background: var(--black);
  padding: 0.2rem 0;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--gold);
}
.steps h3 { margin-top: 0; }

/* ── Callout (no box: a ruled aside) ────────────────────────────── */

.note {
  margin: 1.6rem 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--gold);
  color: var(--mute);
  font-weight: 300;
  font-size: var(--step--1);
  max-width: 62ch;
}
.note b { color: var(--yellow); font-weight: 600; }

/* ── Hosted documents ───────────────────────────────────────────── */

.masthead--doc { padding-bottom: clamp(2rem, 5vh, 3rem); }
.masthead--doc .masthead__kicker a { color: inherit; transition: color 300ms var(--ease); }
.masthead--doc .masthead__kicker a:hover { color: var(--white); }

.prose--doc > h2:first-child { border-top: 0; padding-top: 0; }
.prose--doc h2 { margin-top: clamp(2.6rem, 7vh, 4rem); }
.prose--doc h4 {
  margin: 1.8rem 0 0.6rem;
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.prose--doc hr {
  margin: clamp(2.5rem, 6vh, 4rem) 0;
  border: 0;
  height: 1px;
  background: var(--faint);
}
.prose--doc blockquote {
  margin: 1.6rem 0;
  padding-left: 1.3rem;
  border-left: 2px solid var(--gold);
}
.prose--doc blockquote p { color: var(--white); font-weight: 300; }
.prose--doc blockquote strong { color: var(--yellow); }

.prose--doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: var(--step--1);
  display: block;
  overflow-x: auto;
}
.prose--doc thead th {
  text-align: left;
  padding: 0 1.2rem 0.7rem 0;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green);
  border-bottom: 1px solid var(--hair);
  font-weight: 700;
  white-space: nowrap;
}
.prose--doc tbody td {
  padding: 0.7rem 1.2rem 0.7rem 0;
  border-bottom: 1px solid var(--faint);
  vertical-align: top;
  color: var(--mute);
  font-weight: 300;
}
.prose--doc tbody td strong { color: var(--white); }
.prose--doc tbody tr:hover td { color: var(--white); }

.prose--doc img { margin: 1.6rem 0; }
.prose--doc ul ul, .prose--doc ol ol, .prose--doc ul ol, .prose--doc ol ul {
  margin-top: 0.5rem;
}
.prose--doc code:not(pre code) { white-space: nowrap; }

/* Sidebar carries a lot of links on doc pages — let it scroll on its own. */
@media (min-width: 941px) {
  .page .sidebar {
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--faint) transparent;
  }
}

/* ── Next / previous strip ──────────────────────────────────────── */

.next {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.2rem, 4vw, 3rem);
  margin-top: clamp(3rem, 8vh, 5rem);
  padding-top: 1.4rem;
  border-top: 1px solid var(--faint);
  font-size: var(--step--1);
  font-weight: 600;
}
.next a {
  color: var(--mute);
  background-image: linear-gradient(var(--green), var(--green));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 4px;
  transition: color 300ms var(--ease), background-size 420ms var(--ease);
}
.next a:hover { color: var(--white); background-size: 100% 1px; }
