/* SPDX-License-Identifier: AGPL-3.0-or-later WITH LicenseRef-Casca-output-exception */
/* SPDX-FileCopyrightText: 2026 💀 <skell@which.is> */
/* Casca portal, landing-page gallery styles.
 *
 * These styles serve only the casca.style landing page (site/pages/
 * index.html as a Soupault fragment wrapped by site/layouts/landing.html).
 * They are NOT part of the casca library's public API and intentionally
 * live outside dist/ so the library bundles stay focused on primitives.
 *
 * Every value flows through the --casca-* token graph so the picker's
 * mood selection repaints the whole landing in one shot.
 */

/* Constrain the gallery column. The layout's <main> is full-width so
   the sticky header and the gallery can have different widths. */
main {
  max-width: 980px;
  margin-inline: auto;
  padding: var(--casca-size-4) var(--casca-size-3) var(--casca-size-6);
}

/* Section spacing + scroll offset so anchor jumps clear the sticky bar. */
section {
  margin-block-start: var(--casca-size-6);
  scroll-margin-block-start: 4rem;
}

/* Section header row: title plus an optional Core/Extended segment
   toggle on the right. The h2 drops its own border here; the row
   carries it. */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--casca-size-2);
  flex-wrap: wrap;
  margin-block-end: var(--casca-size-2);
  padding-block-end: var(--casca-size-1);
  border-block-end: 1px solid var(--casca-rule);
}
.section-head h2 {
  margin: 0;
  padding: 0;
  border: 0;
}
h2 {
  margin: 0 0 var(--casca-size-2);
  font-size: var(--casca-font-size-3);
  scroll-margin-block-start: 4rem;
}
.note {
  font-size: var(--casca-font-size-0);
  color: var(--casca-muted);
  margin: 0 0 var(--casca-size-3);
}

/* Cards are uniform thumbnail tiles: a centered preview, a plain title,
   a tiny description, and the whole tile navigates to the demo page.
   Previews made only of non-interactive shapes (charts, data, pager,
   layout) ARE the link element (<a class="casca-card">); previews that
   hold real form controls use the stretched-link <article> pattern
   (a.casca-card-title::after) so the live controls stay interactive. */
.casca-card { position: relative; isolation: isolate; }
.casca-card[href] { text-decoration: none; color: inherit; }
a.casca-card-title { text-decoration: none; }
a.casca-card-title::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: var(--casca-z-local-1);
}

.casca-card[href]:hover,
.casca-card:has(> a.casca-card-title):hover {
  border-color: var(--casca-color-1);
}
.casca-card:has(> a.casca-card-title:focus-visible) {
  outline: 2px solid var(--casca-color-1);
  outline-offset: 2px;
}

.card-desc {
  font-size: 0.78rem;
  /* --casca-ink with reduced opacity gives strong secondary contrast
     in both light and dark modes without picking a token that fights
     the surface (the previous gray-8 default collapsed into the dark
     surface in dark mode). */
  color: var(--casca-ink);
  opacity: 0.7;
}

/* The Toggle thumbnail is a .casca-segment nested inside the controls
   section's outer .casca-segment. The component drives its knob/labels
   through subsequent-sibling descendants (input:checked ~ * .track), a
   reach that can't be confined to a sub-scope in no-JS CSS (see
   COMPATIBILITY.md, nested instances), so the section's
   always-checked input leaks onto this knob. When the thumbnail is
   OFF, reassert its own state over that leak.
   Note: targets a library selector with a layout-affecting property
   (transform); flagged for Phase 104 lint and casca-segment scope
   refactor. */
.casca-thumb > .casca-segment > .casca-segment-input:not(:checked) ~ * .casca-segment-track::before {
  transform: none;
}
.casca-thumb > .casca-segment > .casca-segment-input:not(:checked) ~ * .casca-segment-label:last-of-type {
  color: inherit;
}

/* Demo-local helpers (inside live demo cards). */
.stat { font-size: 1.5rem; font-weight: var(--casca-font-weight-7); color: var(--casca-ink); }
.stat-label { color: var(--casca-muted); font-size: var(--casca-font-size-0); }
ul.list {
  list-style: none;
  padding: 0;
  margin: var(--casca-size-1) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--casca-size-1);
}
ul.list li {
  border: 1px solid var(--casca-rule);
  border-radius: var(--casca-radius-1);
  padding: var(--casca-size-1) var(--casca-size-2);
  font-size: var(--casca-font-size-0);
  color: var(--casca-ink);
}
