/* SPDX-FileCopyrightText: 2026 Kartoza
 * SPDX-License-Identifier: MIT
 *
 * The frame: header pinned to the top, footer pinned to the bottom, and a main
 * area that fills whatever is left and scrolls on overflow.
 */

#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
}

.app__header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: var(--header-height);
  padding: 0 clamp(var(--s4), 4vw, var(--s7));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.app__brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s2);
  text-decoration: none;
  font-weight: 680;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.app__brand-mark {
  font-family: var(--font-mark);
  color: var(--ink-muted);
}
.app__brand-text { font-size: var(--step-0); }

.app__nav {
  display: flex;
  gap: clamp(var(--s2), 2vw, var(--s5));
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.app__nav::-webkit-scrollbar { display: none; }

.app__navlink {
  position: relative;
  padding: var(--s2) 0;
  text-decoration: none;
  font-size: var(--step--1);
  font-family: var(--font-mark);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}
.app__navlink:hover { color: var(--ink); }
.app__navlink.is-current { color: var(--ink); }
.app__navlink.is-current::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--ink);
}

.app__main {
  padding: clamp(var(--s5), 4vw, var(--s7)) clamp(var(--s4), 4vw, var(--s7));
  width: 100%;
  max-width: 78rem;
  margin-inline: auto;
}
.app__main:focus { outline: none; }

.app__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--footer-height);
  padding: var(--s2) var(--s4);
  border-top: 1px solid var(--rule);
  background: var(--paper-sunken);
  font-size: var(--step--1);
  color: var(--ink-muted);
}

.page { display: grid; gap: var(--s6); }
.page__title { font-size: var(--step-4); }
.page__intro { max-width: var(--measure); color: var(--ink-muted); }

/* A lesson is text and drawing side by side; on a narrow screen the drawing
   comes first, because the drawing is the thing being taught. */
.lesson__body {
  display: grid;
  gap: clamp(var(--s5), 3vw, var(--s6));
  align-items: start;
}
.lesson__figure { order: -1; }

@media (min-width: 62rem) {
  .lesson__body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  }
  .lesson__figure {
    order: 0;
    position: sticky;
    top: calc(var(--header-height) + var(--s4));
  }
  .lesson__body--text-only { grid-template-columns: minmax(0, 1fr); }
}

/* On a narrow screen the mark alone carries the brand, leaving the navigation
   enough room to sit on one line. */
@media (max-width: 34rem) {
  .app__brand-text { display: none; }
  .app__navlink { font-size: 0.7rem; letter-spacing: 0.04em; }
  .app__header { padding-inline: var(--s3); gap: var(--s2); }
}
