/* ---------------------------------------------------------------------- *
 * Page design for the RetroCSS site.
 *
 * The framework's component styles live in dist/retro.css. This file is the
 * furniture the *pages* need — a shell, a hero, section cards, a footer — and
 * it is shared by index.html and documentation.html so the two cannot drift.
 * They used to carry a copy each, and had: the home page ran full-bleed to the
 * viewport while the docs were centred at 1320px, their heroes used different
 * type scales, and their section cards were built two different ways.
 *
 * Everything here is built from framework tokens, so it themes with it.
 * ---------------------------------------------------------------------- */

/* --- shell ------------------------------------------------------------ */
/* One width for the nav, the content and the footer, on every page. It is the
   framework's own container scale, so the site demonstrates its own token. */
.page-shell {
  width: 100%;
  max-width: var(--retro-container-xxl);
  margin: 0 auto;
  padding: 0 var(--retro-spacing-md);
  box-sizing: border-box;
}

/* --- hero ------------------------------------------------------------- */
/* Deliberately not a section card: the landing block used to be a card
   identical to "Vertical Navigation", so the most important thing on the page
   had exactly the same weight as the 35 demos under it. */
.hero {
  margin-bottom: var(--retro-spacing-xl);
}
.hero-body {
  display: grid;
  gap: var(--retro-spacing-lg);
  align-items: start;
}
@media (min-width: 900px) {
  .hero-body { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
}
.hero h1 {
  margin: 0 0 var(--retro-spacing-sm);
  /* 44px at the top end was a headline shouting over a page whose own section
     titles are 20px. It tops out a step above the framework's h1 now. */
  font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.25rem);
  line-height: 1.15;
}
.hero-lede {
  font-size: var(--retro-font-size-lg);
  line-height: 1.55;
  max-width: 60ch;
  margin: 0 0 var(--retro-spacing-lg);
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--retro-spacing-sm);
  margin-top: var(--retro-spacing-lg);
}

/* Key facts, as a Win9x status-bar strip rather than prose. */
.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--retro-spacing-xs);
  margin-top: var(--retro-spacing-lg);
}
.fact {
  padding: var(--retro-spacing-sm);
  background: var(--retro-bg);
  border: 1px solid var(--retro-border-dark);
  box-shadow: inset 1px 1px 0 var(--retro-border-light);
}
.fact-value {
  display: block;
  font-family: var(--retro-font-heading);
  font-size: var(--retro-font-size-lg);
  font-weight: var(--retro-font-weight-bold);
  line-height: 1.1;
}
.fact-label {
  display: block;
  margin-top: 2px;
  font-size: var(--retro-font-size-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--retro-text-muted);
}

/* A list of links with a note under each, used in the docs hero. */
.quick-links { margin: 0; padding: 0; list-style: none; }
.quick-links li {
  padding: var(--retro-spacing-xs) 0;
  border-bottom: 1px solid var(--retro-border-medium);
}
.quick-links li:last-child { border-bottom: 0; }
.quick-links .ql-note {
  display: block;
  font-size: var(--retro-font-size-sm);
  color: var(--retro-text-muted);
}

/* --- group bands ------------------------------------------------------ */
.band {
  display: flex;
  align-items: center;
  gap: var(--retro-spacing-sm);
  margin: var(--retro-spacing-xl) 0 var(--retro-spacing-md);
}
.band:first-of-type { margin-top: 0; }
.band-title {
  /* A quiet group label, not a boxed heading: the framework's own h2 style
     (accent bar, panel background, shadow) is heavier than the section headings
     it would sit above, which inverts the hierarchy. */
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  font-size: var(--retro-font-size-sm);
  font-family: var(--retro-font-heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--retro-text-muted);
  white-space: nowrap;
}
.band-rule {
  flex: 1;
  height: 2px;
  background: var(--retro-border-dark);
  box-shadow: 0 1px 0 var(--retro-border-light);
}

/* --- sections --------------------------------------------------------- */
/* One spec for a block of the page, whether it demonstrates a component or
   documents one. Both carry .retro-card in the markup, so the panel itself is
   the framework's. */
.demo-section,
.doc-section {
  padding: var(--retro-spacing-md);
  margin-bottom: var(--retro-spacing-md);
  box-sizing: border-box;
  border-radius: var(--retro-border-radius);
  scroll-margin-top: var(--retro-spacing-xl);
}

/* The section's own heading: underlined, not the framework's h2 panel, which
   reads as a floating box detached from the prose beneath it. */
.demo-section > h3,
.doc-section > h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--retro-spacing-sm);
  margin: 0 0 var(--retro-spacing-md);
  padding: 0 0 var(--retro-spacing-sm);
  background: none;
  border: 0;
  border-bottom: 2px solid var(--retro-border-dark);
  box-shadow: 0 1px 0 var(--retro-border-light);
  font-size: var(--retro-font-size-xl);
  /* .retro-prose caps headings at the reading measure along with the running
     text, which left the docs' section rules stopping two-thirds of the way
     across their card while the home page's ran the full width. The measure is
     right for paragraphs and wrong for a rule that delimits a section. */
  max-width: none;
}

/* Sub-headings within a section. */
.demo-section > h4,
.doc-section > h3 {
  font-size: var(--retro-font-size-lg);
  margin-top: var(--retro-spacing-lg);
  margin-bottom: var(--retro-spacing-sm);
  max-width: none;
}
.demo-section > h4:first-of-type,
.doc-section > h3:first-of-type { margin-top: 0; }

/* The class you type, beside the thing you see: the demos showed a component
   without ever naming it. */
.demo-class {
  font-family: var(--retro-font-mono, monospace);
  font-size: var(--retro-font-size-sm);
  font-weight: normal;
  color: var(--retro-text-muted);
}

/* Inline code inside prose. Block code is .retro-code, which the framework
   draws with its own title bar and copy button. */
.demo-section :not(pre) > code,
.doc-section :not(pre) > code {
  padding: 0.1em 0.35em;
  background: var(--retro-light);
  color: var(--retro-text);
  font-size: var(--retro-font-size-sm);
}

/* --- sidebar ---------------------------------------------------------- */
/* Sticky: the sidebar used to scroll away, so on an 18,000px page you lost
   navigation entirely after the first screen. */
@media (min-width: 768px) {
  .sidebar-col {
    position: sticky;
    top: var(--retro-spacing-md);
    align-self: start;
    max-height: calc(100vh - var(--retro-spacing-xl));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
.sidebar-details > summary {
  cursor: pointer;
  list-style: none;
}
.sidebar-details > summary::-webkit-details-marker { display: none; }
/* A disclosure caret only where the control does something. */
.sidebar-details > summary::after {
  content: ' ▸';
  float: inline-end;
}
.sidebar-details[open] > summary::after { content: ' ▾'; }
@media (min-width: 768px) {
  /* Always expanded on desktop, where there is room for it. */
  .sidebar-details > summary { cursor: default; }
  .sidebar-details > summary::after { content: none; }
}

/* Scroll-spy state, set by the observer at the foot of each page. The
   framework marks [aria-current] itself now; this keeps the bold weight. */
.retro-sidebar .retro-nav-item[aria-current="true"] {
  font-weight: bold;
}

/* --- footer ----------------------------------------------------------- */
.site-footer {
  /* The shell width, applied here rather than by wrapping every page's footer
     in another div. */
  width: 100%;
  max-width: var(--retro-container-xxl);
  margin-inline: auto;
  padding-inline: var(--retro-spacing-md);
  box-sizing: border-box;
  margin-top: var(--retro-spacing-xl);
  padding: var(--retro-spacing-lg) 0 var(--retro-spacing-xl);
  border-top: 2px solid var(--retro-border-dark);
  box-shadow: 0 1px 0 var(--retro-border-light);
}
.footer-grid {
  display: grid;
  gap: var(--retro-spacing-lg);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.footer-grid h2 {
  /* Column labels, not page headings: the framework's h2 (accent bar, panel
     background, shadow) is far too heavy here and overflowed its column. */
  margin: 0 0 var(--retro-spacing-sm);
  padding: 0 0 var(--retro-spacing-xs);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--retro-border-medium);
  box-shadow: none;
  font-size: var(--retro-font-size-sm);
  font-family: var(--retro-font-heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--retro-text-muted);
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: var(--retro-spacing-xs); }
.footer-note {
  margin-top: var(--retro-spacing-lg);
  color: var(--retro-text-muted);
  font-size: var(--retro-font-size-sm);
}

/* --- back to top ------------------------------------------------------ */
.to-top {
  position: fixed;
  inset-inline-end: var(--retro-spacing-lg);
  bottom: var(--retro-spacing-lg);
  z-index: 900;
  display: none;
}
.to-top.is-visible { display: inline-block; }

/* ====================================================================== *
 * Example pages
 *
 * The eight pages under examples/ each carried their own <style> block, and
 * between them they duplicated the footer seven times and the whole sign-in
 * layout twice, byte for byte. Everything they need lives here now, so the
 * site has exactly one stylesheet and no page can drift from another.
 * ====================================================================== */

/* --- example footer --------------------------------------------------- */
/* Same rule and the same rhythm as .site-footer — it is the same chrome, with
   one line of credits instead of four columns. It used to be a 1px hairline
   with different padding, which made the examples look like a different site
   from the one that links to them. */
.example-footer {
  margin-top: var(--retro-spacing-xl);
  padding: var(--retro-spacing-lg) 0 var(--retro-spacing-xl);
  border-top: 2px solid var(--retro-border-dark);
  box-shadow: 0 1px 0 var(--retro-border-light);
  color: var(--retro-text-muted);
  font-size: var(--retro-font-size-sm);
  text-align: center;
}

/* --- blog listing ----------------------------------------------------- */
.post-grid {
  display: grid;
  gap: var(--retro-spacing-md);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
/* Equal heights: a ragged bottom row is the first thing that makes a card grid
   look unfinished, and post excerpts are never the same length. */
.post-grid > article { display: flex; flex-direction: column; margin-bottom: 0; }
.post-grid .retro-card-content { display: flex; flex-direction: column; flex: 1; }
/* The card body is a flex column, so its children stretch across the cross axis
   by default, which turned every category badge and Read more button into a
   full-width bar. */
.post-grid .retro-card-content > .retro-badge,
.post-grid .retro-card-content > .retro-btn { align-self: flex-start; }

.post-cover {
  display: block;
  width: 100%;
  height: auto;
  /* The covers are 3:2. Reserving the ratio stops the grid reflowing as they
     decode, which is what makes a card list jump about on load. */
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.post-title { margin: 0 0 var(--retro-spacing-xs); font-size: var(--retro-font-size-lg); }
.post-title a { text-decoration: none; }
.post-title a:hover { text-decoration: underline; }
.post-excerpt { flex: 1; margin: 0 0 var(--retro-spacing-md); }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--retro-spacing-xs) var(--retro-spacing-sm);
  margin-bottom: var(--retro-spacing-sm);
  font-size: var(--retro-font-size-sm);
  color: var(--retro-text-muted);
}

.featured-body { display: grid; gap: var(--retro-spacing-lg); }
@media (min-width: 760px) {
  .featured-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
}
.featured-body h2 {
  margin: 0 0 var(--retro-spacing-sm);
  font-size: clamp(1.3rem, 1rem + 1.6vw, 1.9rem);
  line-height: 1.2;
}

.sidebar-widget { margin-bottom: var(--retro-spacing-lg); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--retro-spacing-xs); }

/* --- long-form article ------------------------------------------------ */
/* A measure, so prose does not run the full width of a desktop card. Around 70
   characters is where a line stops being tiring to track. */
.article-body { max-width: 68ch; }
.article-body > * + * { margin-top: var(--retro-spacing-md); }
.article-body h2 {
  margin-top: var(--retro-spacing-xl);
  padding-bottom: var(--retro-spacing-xs);
  background: none;
  border: 0;
  border-bottom: 2px solid var(--retro-border-dark);
  box-shadow: 0 1px 0 var(--retro-border-light);
  font-size: var(--retro-font-size-2xl);
}
.article-body h3 {
  margin-top: var(--retro-spacing-lg);
  font-size: var(--retro-font-size-lg);
}
.article-lede {
  font-size: var(--retro-font-size-lg);
  line-height: 1.6;
}
.article-hero {
  display: block;
  width: 100%;
  /* Letterboxed, not 3:2. At full ratio across a desktop column the hero was
     625px tall and pushed the headline off the first screen entirely. */
  aspect-ratio: 3 / 1;
  max-height: 320px;
  object-fit: cover;
}
@media (max-width: 600px) {
  .article-hero { aspect-ratio: 2 / 1; }
}
figure.article-figure { margin: var(--retro-spacing-lg) 0; }
figure.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 2px solid var(--retro-border-dark);
}
figure.article-figure figcaption {
  margin-top: var(--retro-spacing-xs);
  font-size: var(--retro-font-size-sm);
  color: var(--retro-text-muted);
}
.author-card { display: flex; gap: var(--retro-spacing-md); align-items: flex-start; }
.comment { display: flex; gap: var(--retro-spacing-md); align-items: flex-start; }
.comment + .comment {
  margin-top: var(--retro-spacing-md);
  padding-top: var(--retro-spacing-md);
  border-top: 1px solid var(--retro-border-medium);
}
.comment-body { flex: 1; min-width: 0; }
.comment-body p { margin: var(--retro-spacing-xs) 0 0; }
.related-grid {
  display: grid;
  gap: var(--retro-spacing-md);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.related-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.related-grid h3 { margin: var(--retro-spacing-sm) 0 0; font-size: var(--retro-font-size); }
@media (min-width: 768px) {
  .toc-col { position: sticky; top: var(--retro-spacing-md); align-self: start; }
}

/* --- sign in / sign up ------------------------------------------------ */
.auth-shell {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: var(--retro-spacing-lg) var(--retro-spacing-md) var(--retro-spacing-xl);
  box-sizing: border-box;
}
.auth-grid { display: grid; }
@media (min-width: 820px) {
  /* The brand panel is a fixed column so the form keeps a comfortable measure
     instead of stretching across the whole card on a wide screen. */
  .auth-grid { grid-template-columns: 300px minmax(0, 1fr); }
}
.auth-brand {
  position: relative;
  display: none;
  padding: var(--retro-spacing-lg);
  color: #ffffff;
  /* The dark end of the artwork's own ramp, so the copy stays legible even if
     the image never arrives, and so the contrast gate can see what the text is
     actually sitting on. */
  background: #14143f;
  border-inline-end: 2px solid var(--retro-border-dark);
  overflow: hidden;
}
/* Below the breakpoint the panel would push the form off the first screen, and
   it carries no information the form needs. */
@media (min-width: 820px) { .auth-brand { display: block; } }
.auth-brand-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Anchored low so the padlock sits below the copy rather than behind it. */
  object-position: center bottom;
}
/* A scrim over the top of the panel. Without it the text sits directly on the
   artwork, and the third bullet landed across the padlock. */
.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.62) 38%,
    rgba(0, 0, 0, 0) 62%
  );
}
.auth-brand-inner { position: relative; z-index: 1; }
.auth-brand h2 {
  margin: 0 0 var(--retro-spacing-sm);
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: #ffffff;
  font-size: var(--retro-font-size-2xl);
  /* The art behind this is a dithered gradient, not a flat fill, so the type
     needs its own shadow to stay legible over the light end of the ramp. */
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.65);
}
.auth-brand p,
.auth-brand li { text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.75); }
.auth-brand ul {
  margin: var(--retro-spacing-lg) 0 0;
  padding: 0;
  list-style: none;
}
.auth-brand li {
  margin-bottom: var(--retro-spacing-sm);
  padding-inline-start: var(--retro-spacing-md);
  position: relative;
  font-size: var(--retro-font-size-sm);
  line-height: 1.5;
}
.auth-brand li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.45em;
  width: 7px;
  height: 7px;
  background: currentColor;
}
.auth-form { padding: var(--retro-spacing-lg); }
/* The framework's heading style is a panel in its own right (accent bar,
   background, shadow), which reads as a second card floating inside this one.
   A page title here is just a title. */
.auth-form h1 {
  margin: 0 0 var(--retro-spacing-xs);
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
.auth-intro { margin: 0 0 var(--retro-spacing-lg); color: var(--retro-text-muted); }
.field-hint {
  display: block;
  margin-top: var(--retro-spacing-xs);
  font-size: var(--retro-font-size-sm);
  color: var(--retro-text-muted);
}
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--retro-spacing-sm);
}
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--retro-spacing-sm);
  margin: var(--retro-spacing-lg) 0;
  color: var(--retro-text-muted);
  font-size: var(--retro-font-size-sm);
}
.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--retro-border-medium);
  box-shadow: 0 1px 0 var(--retro-border-light);
}
.provider-row { display: grid; gap: var(--retro-spacing-sm); grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 420px) { .provider-row { grid-template-columns: 1fr; } }
.provider-row .retro-btn { width: 100%; }
.req-list { margin: var(--retro-spacing-sm) 0 0; padding: 0; list-style: none; }
.req-list li {
  padding: 2px 0;
  font-size: var(--retro-font-size-sm);
  color: var(--retro-text-muted);
}
.req-list li::before { content: "\2022\00a0\00a0"; }
.req-list li.met { color: var(--retro-success-text); }
.req-list li.met::before { content: "\2713\00a0\00a0"; }

/* --- examples gallery ------------------------------------------------- */
.gallery {
  display: grid;
  gap: var(--retro-spacing-md);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
/* Equal-height cards: the demo pages' own grids left ragged rows, which is the
   first thing that makes a set of examples look unfinished. */
.gallery > .retro-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}
.gallery .retro-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.ex-desc { flex: 1; margin: 0 0 var(--retro-spacing-md); }
.ex-shows {
  margin: 0 0 var(--retro-spacing-md);
  padding: 0;
  list-style: none;
  font-size: var(--retro-font-size-sm);
  color: var(--retro-text-muted);
}
.ex-shows li { padding: 2px 0; }
.ex-shows code { font-size: var(--retro-font-size-xs); }

/* --- right-to-left example -------------------------------------------- */
.rtl-page { max-width: 900px; margin: 0 auto; padding: var(--retro-spacing-lg); }
.rtl-note { margin-bottom: var(--retro-spacing-lg); }

/* --- theme matrix ----------------------------------------------------- */
.tm-wrap { max-width: 1100px; margin: 0 auto; padding: var(--retro-spacing-md); }
.tm-panels { display: grid; gap: var(--retro-spacing-md); grid-template-columns: 1fr; }
@media (min-width: 900px) { .tm-panels { grid-template-columns: 1fr 1fr; } }
/* Two panels so every swatch is judged against both surfaces: the page ground
   (--retro-body-bg) and a raised surface (--retro-bg). */
.tm-panel { padding: var(--retro-spacing-md); border: 2px solid var(--retro-border-dark); }
.tm-on-body { background: var(--retro-body-bg); }
.tm-on-bg { background: var(--retro-bg); }
.tm-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--retro-spacing-sm); }
.tm-section { margin-bottom: var(--retro-spacing-lg); }
.tm-label {
  font-family: var(--retro-font-mono);
  font-size: var(--retro-font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--retro-text-muted);
  margin-bottom: 4px;
}
.tm-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--retro-spacing-md);
  padding: var(--retro-spacing-sm) var(--retro-spacing-md);
  background: var(--retro-light);
  border-bottom: 2px solid var(--retro-border-dark);
}
