/*
  Support Sky — design system.
  Own compact system, no framework. Custom properties = tokens; everything
  else is built from them. Warm paper base, navy ink, editorial serif for
  display headings — ported from the approved rudik-reference-v3 reference.
  See docs/frontend-components.md.
*/

/* ----------------------------- Tokens ---------------------------------- */

:root {
    /* Surfaces */
    --color-bg: #f4f1ea;
    --color-bg-elevated: #ffffff;
    --color-bg-soft: #ece7dd;
    --color-border: #d9d4ca;
    --color-border-soft: #e3ded2;

    /* Text */
    --color-text: #182130;
    --color-text-muted: #69717d;
    --color-text-faint: #8a8f9a;

    /* Accent — deep navy, the site's one primary color */
    --color-accent: #102036;
    --color-accent-strong: #162a46;
    --color-accent-contrast: #ffffff;

    /* Secondary accent used sparingly (links, focus, highlights) */
    --color-blue: #6f879d;
    --color-soft-blue: #dce6ee;

    /* Feedback (muted, legible on paper, not neon) */
    --color-success: #3c6b4a;
    --color-success-bg: #e6efe7;
    --color-info: #3a5a78;
    --color-info-bg: #e6ecf1;
    --color-warning: #7a5f2a;
    --color-warning-bg: #f3ecdc;
    --color-danger: #8d4d4d;
    --color-danger-bg: #f3e6e6;

    --color-focus: #6f879d;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4.5rem;

    /* Radii */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-pill: 999px;

    /* Shadow — soft only, never a hard drop shadow */
    --shadow-soft: 0 18px 50px rgba(24, 33, 48, 0.08);
    --shadow-lifted: 0 28px 80px rgba(18, 28, 42, 0.10);
    --shadow-focus: 0 0 0 3px rgba(111, 135, 157, 0.45);

    /* Motion */
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 900ms;
    --ease-standard: cubic-bezier(0.2, 0.65, 0.4, 1);

    /* Typography */
    --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

    /* Layout */
    --container-max: 1320px;
    --container-narrow: 720px;
    --header-height: 4.75rem;

    color-scheme: light;
}

/* ------------------------------- Reset ---------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.65;
    background-color: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

/* Set via JS (class, not inline style) while the full-screen mobile nav is open. */
body.nav-open {
    overflow: hidden;
}

img {
    max-width: 100%;
    display: block;
}

h1, h2, h3, h4 {
    line-height: 1.15;
    font-weight: 600;
    margin: 0 0 var(--space-4);
    text-wrap: balance;
}

h1 { font-size: clamp(1.85rem, 1.4rem + 2vw, 2.75rem); }
h2 { font-size: clamp(1.375rem, 1.15rem + 1vw, 2rem); }
h3 { font-size: clamp(1.125rem, 1rem + 0.5vw, 1.5rem); }

p {
    margin: 0 0 var(--space-4);
    max-width: 68ch;
}

a {
    color: inherit;
}

button, input, textarea, select {
    font: inherit;
}

button {
    cursor: pointer;
}

ul, ol {
    padding-left: 1.25em;
}

/* Visible, consistent focus everywhere — never removed, only restyled. */
:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
}

/* -------------------------- Editorial typography -------------------------- */

.eyebrow {
    display: inline-block;
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
}

.display {
    font-family: var(--font-serif);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.02;
}

.lead {
    font-size: clamp(1.05rem, 1vw + 0.9rem, 1.2rem);
    line-height: 1.7;
    color: #394352;
    max-width: 52ch;
}

.text-link {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--color-accent);
}

.text-link::after {
    content: "\2192";
    transition: transform var(--duration-fast) var(--ease-standard);
}

.text-link:hover::after {
    transform: translateX(4px);
}

/* --------------------------- Skip link (a11y) ---------------------------- */

.skip-link {
    position: absolute;
    left: var(--space-3);
    top: -3rem;
    z-index: 100;
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    transition: top var(--duration-fast) var(--ease-standard);
}

.skip-link:focus {
    top: var(--space-3);
}

/* -------------------------------- Layout --------------------------------- */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--space-5);
}

.container--narrow {
    max-width: var(--container-narrow);
}

.section {
    padding-block: var(--space-7);
}

.section--tight {
    padding-block: var(--space-6);
}

.section__heading {
    max-width: var(--container-narrow);
    margin-bottom: var(--space-6);
}

.section__eyebrow {
    display: inline-block;
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-faint);
    margin-bottom: var(--space-2);
}

.section__lede {
    color: var(--color-text-muted);
    font-size: 1.0625rem;
}

main {
    flex: 1 0 auto;
}

/* -------------------------------- Header --------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    background-color: rgba(244, 241, 234, 0.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-border-soft);
}

.site-header__bar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 1.4rem;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.brand__mark {
    color: var(--color-blue);
    font-size: 1em;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a {
    color: #444d59;
    text-decoration: none;
    font-size: 0.9rem;
    padding: var(--space-2) 0;
    border-bottom: 2px solid transparent;
    transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.site-header__desktop {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    cursor: pointer;
}

.mobile-nav-toggle__icon {
    position: relative;
    width: 1.15rem;
    height: 1px;
    background: currentColor;
}

.mobile-nav-toggle__icon::before,
.mobile-nav-toggle__icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transition: transform var(--duration-fast) var(--ease-standard);
}

.mobile-nav-toggle__icon::before { top: -6px; }
.mobile-nav-toggle__icon::after { top: 6px; }

/* ----------------------------- Mobile nav -------------------------------- */

.mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--color-bg);
    padding: var(--space-5);
    overflow-y: auto;
}

.mobile-nav[data-open="true"] {
    display: block;
}

.mobile-nav__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.mobile-nav__close {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.mobile-nav__links {
    list-style: none;
    margin: 0 0 var(--space-6);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.mobile-nav__links a {
    display: block;
    padding: var(--space-3) var(--space-2);
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 1px solid var(--color-border-soft);
}

.mobile-nav__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* --------------------------------- Footer -------------------------------- */

.site-footer {
    margin-top: auto;
    background: #0d192a;
    color: #cdd6e0;
    padding-block: var(--space-7) var(--space-5);
    font-size: 0.9375rem;
}

.site-footer__grid {
    display: grid;
    gap: var(--space-6);
    grid-template-columns: 1fr;
    padding-bottom: var(--space-6);
}

.site-footer__about p {
    max-width: 46ch;
    color: #a9b4c1;
}

.site-footer__nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.site-footer__nav a {
    color: #cdd6e0;
    text-decoration: none;
}

.site-footer__nav a:hover {
    color: #fff;
}

.site-footer__note {
    margin-top: 0;
    padding-top: var(--space-5);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8125rem;
    color: #8393a6;
}

/* -------------------------------- Buttons -------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    min-height: 3rem;
    padding: 0 1.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--duration-fast) var(--ease-standard),
                background-color var(--duration-fast) var(--ease-standard),
                border-color var(--duration-fast) var(--ease-standard);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn--primary {
    background-color: var(--color-accent);
    color: #fff;
}

.btn--primary:hover {
    background-color: var(--color-accent-strong);
}

.btn--secondary {
    background-color: var(--color-bg-soft);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn--secondary:hover {
    border-color: var(--color-accent);
}

.btn--ghost {
    background-color: rgba(255, 255, 255, 0.18);
    color: var(--color-text);
    border-color: rgba(24, 33, 48, 0.22);
}

.btn--ghost:hover {
    border-color: var(--color-accent);
    background-color: #fff;
}

.btn--light {
    background: #f7f6f2;
    color: var(--color-accent);
}

.btn--light:hover {
    background: #fff;
}

.btn--block {
    width: 100%;
}

/* On the dark sky stage, the ghost button needs light-on-dark colors
   instead of the default dark-on-light ones — a scoped class, not an
   inline style override. */
.sky-stage__actions .btn--ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.sky-stage__actions .btn--ghost:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* --------------------------------- Cards --------------------------------- */

.card {
    background-color: var(--color-bg-elevated);
    border: 1px solid rgba(24, 33, 48, 0.08);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-soft);
}

/* --------------------------------- Hero ----------------------------------- */

.hero {
    padding-block: var(--space-7) var(--space-6);
}

.hero__inner {
    max-width: 46rem;
    background: linear-gradient(145deg, #f7f5ef 0%, #eeece6 100%);
    border-radius: var(--radius-lg);
    padding: clamp(var(--space-6), 5vw, var(--space-8));
    box-shadow: var(--shadow-lifted);
}

.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.hero__title {
    font-family: var(--font-serif);
    font-weight: 500;
    letter-spacing: -0.02em;
    font-size: clamp(2.2rem, 3.2vw + 1rem, 3.6rem);
    margin-bottom: var(--space-4);
}

.hero__lede {
    font-size: 1.125rem;
    color: #394352;
    max-width: 46ch;
    margin-bottom: var(--space-6);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* ------------------------------ Statistics -------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--color-border);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.stat-card {
    background-color: var(--color-bg);
    padding: var(--space-5) var(--space-5);
    min-height: 8.5rem;
}

.stat-card__value {
    display: block;
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem);
    color: var(--color-accent);
    margin-bottom: var(--space-2);
}

.stat-card__label {
    display: block;
    font-size: 0.94rem;
    color: var(--color-text-muted);
}

/* ---------------------------- Donation progress ---------------------------- */

.progress {
    background-color: var(--color-bg-elevated);
    border: 1px solid rgba(24, 33, 48, 0.08);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-soft);
}

.progress__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.progress__raised {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.4rem);
    color: var(--color-accent);
}

.progress__goal {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.progress__track {
    height: 8px;
    border-radius: var(--radius-pill);
    background-color: var(--color-bg-soft);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--color-blue), var(--color-accent));
    transition: width var(--duration-slow) var(--ease-standard);
}

/* Width comes from a class, not an inline style attribute — the percent is
   rounded to the nearest 5% by the caller (see donation-progress partial). */
.progress__bar--0 { width: 0%; }
.progress__bar--5 { width: 5%; }
.progress__bar--10 { width: 10%; }
.progress__bar--15 { width: 15%; }
.progress__bar--20 { width: 20%; }
.progress__bar--25 { width: 25%; }
.progress__bar--30 { width: 30%; }
.progress__bar--35 { width: 35%; }
.progress__bar--40 { width: 40%; }
.progress__bar--45 { width: 45%; }
.progress__bar--50 { width: 50%; }
.progress__bar--55 { width: 55%; }
.progress__bar--60 { width: 60%; }
.progress__bar--65 { width: 65%; }
.progress__bar--70 { width: 70%; }
.progress__bar--75 { width: 75%; }
.progress__bar--80 { width: 80%; }
.progress__bar--85 { width: 85%; }
.progress__bar--90 { width: 90%; }
.progress__bar--95 { width: 95%; }
.progress__bar--100 { width: 100%; }

.progress__percent {
    margin-top: var(--space-3);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.progress--no-goal .progress__track {
    display: none;
}

/* -------------------------------- Star grid -------------------------------- */

.star-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: var(--space-4);
}

.star-card {
    all: unset;
    cursor: pointer;
    display: block;
    background-color: var(--color-bg-elevated);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    transition: border-color var(--duration-fast) var(--ease-standard),
                transform var(--duration-fast) var(--ease-standard);
}

.star-card:hover {
    border-color: var(--color-blue);
    transform: translateY(-2px);
}

.star-card:focus-visible {
    box-shadow: var(--shadow-focus);
}

.star-card__glyph {
    display: inline-flex;
    width: 1.75rem;
    height: 1.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: var(--space-3);
    font-size: 1rem;
    background: var(--color-soft-blue);
    color: var(--color-blue);
}

.star-card__name {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.star-card__meta {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2);
}

.star-card__message {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Star dialog (native <dialog>) */

dialog.star-dialog {
    width: min(30rem, calc(100vw - 2.5rem));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    background-color: var(--color-bg-elevated);
    color: var(--color-text);
    box-shadow: var(--shadow-lifted);
}

dialog.star-dialog::backdrop {
    background: rgba(16, 22, 33, 0.55);
}

.star-dialog__close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
}

.star-dialog__kind {
    display: inline-block;
    margin-bottom: var(--space-3);
}

.star-dialog__amount {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.star-dialog__message {
    color: var(--color-text-muted);
}

/* -------------------------------- Empty state ------------------------------ */

.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-muted);
}

.empty-state__glyph {
    font-size: 1.75rem;
    margin-bottom: var(--space-3);
    color: var(--color-blue);
}

/* ----------------------------------- Alerts -------------------------------- */

.alert {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-soft);
    margin-bottom: var(--space-5);
    font-size: 0.9375rem;
}

.alert--info {
    background-color: var(--color-info-bg);
    border-color: color-mix(in srgb, var(--color-info) 35%, var(--color-border-soft));
    color: var(--color-info);
}

.alert--success {
    background-color: var(--color-success-bg);
    border-color: color-mix(in srgb, var(--color-success) 35%, var(--color-border-soft));
    color: var(--color-success);
}

.alert--warning {
    background-color: var(--color-warning-bg);
    border-color: color-mix(in srgb, var(--color-warning) 35%, var(--color-border-soft));
    color: var(--color-warning);
}

.alert--error {
    background-color: var(--color-danger-bg);
    border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border-soft));
    color: var(--color-danger);
}

/* ----------------------------------- Badges -------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
    font-weight: 600;
    background-color: var(--color-bg-soft);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.badge--pending { color: var(--color-info); border-color: color-mix(in srgb, var(--color-info) 40%, var(--color-border)); }
.badge--matched { color: var(--color-warning); border-color: color-mix(in srgb, var(--color-warning) 40%, var(--color-border)); }
.badge--confirmed { color: var(--color-success); border-color: color-mix(in srgb, var(--color-success) 40%, var(--color-border)); }
.badge--rejected,
.badge--expired { color: var(--color-danger); border-color: color-mix(in srgb, var(--color-danger) 40%, var(--color-border)); }

/* ----------------------------------- Forms ---------------------------------- */

.form {
    max-width: 34rem;
}

.form-field {
    margin-bottom: var(--space-5);
}

.form-field label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.875rem;
    font-weight: 700;
}

.form-field__hint {
    margin: var(--space-1) 0 0;
    font-size: 0.8125rem;
    color: var(--color-text-faint);
}

/* Page-level hint text, not scoped to one field (e.g. "goal not set yet"). */
.form-hint {
    font-size: 0.875rem;
    color: var(--color-text-faint);
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 0.85rem 1rem;
    font: inherit;
    font-size: 1rem;
    color: var(--color-text);
    background-color: #fbfbfa;
    border: 1px solid #cfd4da;
    border-radius: var(--radius-sm);
    transition: border-color var(--duration-fast) var(--ease-standard);
}

.form-field input:focus-visible,
.form-field textarea:focus-visible,
.form-field select:focus-visible {
    border-color: var(--color-blue);
}

.form-field textarea {
    min-height: 8rem;
    resize: vertical;
}

.form-field--checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.form-field--checkbox label {
    margin-bottom: 0;
    font-weight: 400;
}

.form-field--invalid input,
.form-field--invalid textarea,
.form-field--invalid select {
    border-color: var(--color-danger);
}

.form-error {
    margin-top: var(--space-2);
    font-size: 0.875rem;
    color: var(--color-danger);
}

.form-actions {
    margin-top: var(--space-6);
}

/* Star preview (wish / support forms) — one fixed, neutral glyph; no
   style/color picker. */

.star-preview {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-6);
    background-color: var(--color-bg-elevated);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
}

.star-preview__glyph {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--color-soft-blue);
    color: var(--color-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.star-preview__text {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
}

.star-preview__name {
    color: var(--color-text);
    font-weight: 600;
}

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

.page-hero {
    padding-block: var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.page-hero .display {
    max-width: 16ch;
    font-size: clamp(2.1rem, 1.5rem + 2vw, 3.4rem);
    margin: var(--space-2) 0 var(--space-4);
}

/* --------------------------------- Forms (page) ----------------------------- */

.form-page {
    padding-block: var(--space-7) calc(var(--space-8) + var(--space-4));
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
    gap: var(--space-8);
    align-items: start;
}

.form-copy .display {
    font-size: clamp(2.2rem, 1.6rem + 2.4vw, 3.6rem);
    margin: var(--space-3) 0 var(--space-4);
    max-width: 10ch;
}

.form-card {
    background: var(--color-bg-elevated);
    border: 1px solid rgba(24, 33, 48, 0.08);
    border-radius: var(--radius-lg);
    padding: clamp(var(--space-5), 4vw, var(--space-7));
    box-shadow: var(--shadow-lifted);
}

.form-note {
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-soft);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: 0.88rem;
    margin-bottom: var(--space-5);
}

/* ------------------------------- Sky stage -------------------------------- */

.sky-page {
    background: #07101d;
    color: #edf3fb;
}

.sky-stage {
    position: relative;
    min-height: 62vh;
    overflow: hidden;
    background: #07101d;
    color: #edf3fb;
}

.sky-stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.sky-stage__content {
    position: relative;
    z-index: 2;
    min-height: 62vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-7) clamp(var(--space-5), 6vw, var(--space-8));
    background: linear-gradient(0deg, rgba(4, 8, 14, 0.88), rgba(4, 8, 14, 0) 65%);
}

.sky-stage__content .eyebrow {
    color: #9fb0c2;
}

.sky-stage__content h1 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: clamp(2.4rem, 1.6rem + 3.2vw, 4.6rem);
    line-height: 1;
    margin: var(--space-2) 0 var(--space-4);
    color: #fff;
}

.sky-stage__content p {
    max-width: 48ch;
    color: #bac7d6;
}

.sky-stage__actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-4);
}

/* Cursor feedback is a class toggled from JS (canvas.classList.toggle),
   never an inline style — see public/assets/js/sky.js. */
.sky-stage canvas.is-hovering-star {
    cursor: pointer;
}

/* The accessible star list below the stage: same data, same <dialog>s the
   canvas opens on click — styled as a plain divided list, not a card
   grid, so it doesn't read as a catalog. */
.sky-list__note {
    margin-bottom: var(--space-5);
}

.sky-list .star-grid {
    display: block;
}

.sky-list .star-card {
    all: unset;
    cursor: pointer;
    display: block;
    width: 100%;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border-soft);
}

.sky-list .star-card:hover,
.sky-list .star-card:focus-visible {
    border-color: var(--color-blue);
}

.sky-list .star-card__glyph {
    display: none;
}

/* --------------------------------- Utilities -------------------------------- */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.breadcrumbs {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0;
    margin: 0 0 var(--space-5);
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.breadcrumbs a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--color-text);
}

.breadcrumbs li:not(:last-child)::after {
    content: "/";
    margin-left: var(--space-2);
    color: var(--color-text-faint);
}

.definition-list {
    display: grid;
    grid-template-columns: minmax(9rem, 14rem) 1fr;
    gap: var(--space-3) var(--space-5);
    margin: 0;
}

.definition-list dt {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.definition-list dd {
    margin: 0;
}

/* Gentle reveal-on-scroll — purely decorative, off by default until JS
   marks elements ready, and disabled entirely under reduced motion. */
[data-reveal] {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: no-preference) {
    [data-reveal] {
        opacity: 0;
        transform: translateY(12px);
        transition: opacity var(--duration-slow) var(--ease-standard),
                    transform var(--duration-slow) var(--ease-standard);
    }

    [data-reveal="visible"] {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------------------------------- Errors ---------------------------------- */

.page-error {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

/* ------------------------------ Language switcher ---------------------------- */

.language-switcher {
    display: flex;
    gap: var(--space-2);
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.language-switcher__link,
.language-switcher__current {
    color: inherit;
    text-decoration: none;
}

.language-switcher__current {
    color: var(--color-text);
    font-weight: 700;
}

.language-switcher__link:hover {
    color: var(--color-text);
    text-decoration: underline;
}

/* --------------------------------- Responsive -------------------------------- */

@media (max-width: 63.9375em) {
    .site-header__desktop {
        display: none;
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .form-layout {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 64em) {
    .mobile-nav-toggle {
        display: none;
    }

    .mobile-nav {
        display: none !important;
    }
}

@media (min-width: 48em) {
    .site-footer__grid {
        grid-template-columns: 1.2fr 1fr 1fr;
    }
}

@media (max-width: 30em) {
    .container {
        padding-inline: var(--space-4);
    }

    .hero {
        padding-block: var(--space-6) var(--space-6);
    }

    .hero__inner {
        padding: var(--space-5);
    }

    .definition-list {
        grid-template-columns: 1fr;
    }

    .definition-list dt {
        padding-top: var(--space-2);
    }

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