/*
 * Spry CSS theme — "Living Sky"
 * --------------------------------
 * The age when the cosmos was order and we were placed within
 * it: the nested spheres turning round a still centre, every star in its
 * appointed place. Vellum, ultramarine, burnished gold, vermilion rubrics,
 * a hemicycle of stars over each month — rendered for a modern reader,
 * after the calendar pages of the Labours of the Month: generous space,
 * square-cut vellum leaves inside a ruled gold frame, chamfered keys like
 * cut gilt plaques, refined serif type with Cinzel small capitals for
 * labels, and two quiet signatures. Edges are sharp, as on a ruled and
 * trimmed page; roundness is kept for what is round in the cosmos — the
 * lunette of sky over the month, roundels, the sun-and-moon dial, the
 * orbit mark and the quatrefoils.
 *
 *   - the spheres: fine gold orbit rings radiating from a hidden sun on
 *     the hero's sky, framed in a Gothic arch, and a small orbit mark on the
 *     brand;
 *   - the measure: an astrolabe scale (a gold hairline with even degree
 *     ticks) under the topbar and table heads.
 *
 * and the manuscript in gold and blue, never red: illuminated initials (a
 * gold capital on an ultramarine tile) opening section headings; starry
 * ultramarine bands on card headers; the bar-and-vine ivy border dividing
 * card footers and rules; gold quatrefoils for list bullets.
 *
 * Dialogs, menus and drawers are night-sky panels; the switch is a sun-and-
 * moon dial; progress is a gilded measure. Light-only.
 *
 * Activation:
 *   - real sites:   <html data-theme="living-sky">
 *   - demo page:    hidden radio  <input id="spry-theme-living-sky">
 *   - load AFTER spry.css
 *
 * Self-contained: font stacks and inline data: URIs only.
 */

/* ---- Embedded fonts (generated by tools/fonts/apply_fonts.py) ---- */
@font-face { font-family: "Spry EB Garamond"; src: url("spry-font-eb-garamond.woff2") format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Spry EB Garamond"; src: url("spry-font-eb-garamond-italic.woff2") format("woff2"); font-weight: 400 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Spry Cinzel"; src: url("spry-font-cinzel.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
/* ---- end embedded fonts ---- */

[data-theme="living-sky"],
html:has(#spry-theme-living-sky:checked) {
  color-scheme: light;

  /* ---- Pigments ---- */
  --spry-bg: #f5efe2;            /* vellum */
  --spry-bg-alt: #efe6d1;        /* a deeper leaf: bands, wells */
  --spry-bg-inset: #ebe1c9;
  --spry-surface: #fcf9f1;       /* the written page: cards, inputs */
  --spry-surface-hover: #f7f0df;
  --spry-fg: #1b2140;            /* night ink: blue-black */
  --spry-fg-muted: #565c76;      /* ≥5.5:1 on every vellum tone */
  --spry-border: #e2d5b2;        /* gold-tan hairlines */
  --spry-border-strong: #c9b380;
  --spry-accent: #233d9b;        /* ultramarine: focus, primaries */
  --spry-accent-hover: #1a2f7d;
  --spry-accent-fg: #fcf9f1;
  --spry-accent-soft: rgb(35 61 155 / 0.1);
  --spry-danger: #a3301b;        /* vermilion */
  --spry-success: #3d6b45;       /* malachite */
  --spry-warning: #6e5410;
  --spry-info: #233d9b;
  --spry-link: #233d9b;
  --spry-link-hover: #8a6a16;
  --spry-heading-color: #1b2a64; /* headings in deep ultramarine ink */
  --spry-backdrop: rgb(10 16 40 / 0.55);
  --spry-focus-ring: 0 0 0 3px rgb(197 158 64 / 0.45);

  /* Theme-internal: gold, the night sky and their inks */
  --spry-gold: #b48a2c;          /* gold leaf: decoration */
  --spry-gold-ink: #7a5d12;      /* gold text on vellum — 5.2:1 */
  --spry-gold-soft: #ddc78f;
  --ls-gold-bright: #f0d48a;     /* gold on the night sky */
  --ls-gold-leaf: linear-gradient(135deg, #8a6714 0%, #d8b14e 25%, #f8e3a0 45%, #c99a32 65%, #ecd08a 85%, #9a7518 100%);
  --ls-vermilion: #a3301b;
  --spry-night: #17286b;         /* ultramarine sky panels */
  --ls-night-deep: #0e1846;
  --spry-night-fg: #f3eedf;
  --spry-night-muted: #c3cbe6;
  --spry-ink-line: #b9a674;      /* control rules: warm, not black */

  /* ---- Type ---- */
  --spry-font: "Spry EB Garamond", "EB Garamond", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --spry-font-heading: "Spry EB Garamond", "EB Garamond", "Cormorant Garamond", Georgia, serif;
  --ls-caps: "Spry Cinzel", "Cinzel", "Trajan Pro", "EB Garamond", Georgia, serif;   /* inscriptional capitals for labels */
  --spry-font-mono: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --spry-font-size: 1.15rem;
  --spry-line-height: 1.65;
  --spry-heading-weight: 600;

  /* ---- Shape, depth, motion: trimmed leaves, ruled frames, quiet depth ---- */
  --spry-radius: 2px;
  --spry-radius-sm: 1px;
  --spry-radius-lg: 3px;
  --spry-radius-pill: 2px;
  --ls-chamfer: 0.45rem;          /* the cut corner of a gilt plaque */
  --spry-border-width: 1px;
  --spry-shadow: 0 1px 0 rgb(180 138 44 / 0.12), 0 14px 32px -20px rgb(27 33 64 / 0.4);
  --spry-shadow-lg: 0 30px 60px -24px rgb(14 24 70 / 0.55);
  --spry-glass: none;
  --spry-transition: 180ms ease;
  --spry-dialog-duration: 320ms;
  --spry-dialog-ease: cubic-bezier(0.22, 1, 0.36, 1);   /* a slow, settled arrival */
  --spry-dialog-in: translateY(0.75rem) scale(0.985);

  /* ---- Controls ---- */
  --spry-control-bg: var(--spry-surface);
  --spry-control-fg: var(--spry-fg);
  --spry-control-border: var(--spry-ink-line);
  --spry-control-radius: var(--spry-radius-sm);
  --spry-control-padding-x: 0.8rem;
  --spry-control-padding-y: 0.55rem;

  --spry-btn-bg: var(--spry-surface);
  --spry-btn-fg: var(--spry-fg);
  --spry-btn-border: var(--spry-border-strong);
  --spry-btn-bg-hover: #f8efd9;
  --spry-btn-bg-active: var(--spry-bg-inset);

  /* ---- Cards, tables, progress, popovers ---- */
  --spry-card-bg: var(--spry-surface);
  --spry-card-border: var(--spry-border);
  --spry-card-padding: 1.6rem;
  --spry-main-padding-block: 2.5rem;
  --spry-card-shadow: var(--spry-shadow);
  --spry-table-header-bg: transparent;
  --spry-table-hover: #f6edd6;
  --spry-progress-bg: #ece2c8;
  --spry-progress-fg: var(--spry-gold);
  --spry-popover-bg: var(--spry-night);
  --spry-popover-border: var(--spry-gold);
  --spry-popover-shadow: var(--spry-shadow-lg);

  /* ---- Motifs (inline SVG / gradients) ---- */
  /* faint gold stars over the vellum */
  --spry-stars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='%23b48a2c' opacity='.07'%3E%3Cpath d='M24 22l1.2 3.2 3.2 1.2-3.2 1.2-1.2 3.2-1.2-3.2-3.2-1.2 3.2-1.2z'/%3E%3Cpath d='M128 54l1 2.6 2.6 1-2.6 1-1 2.6-1-2.6-2.6-1 2.6-1z'/%3E%3Cpath d='M76 132l1.1 2.8 2.8 1.1-2.8 1.1-1.1 2.8-1.1-2.8-2.8-1.1 2.8-1.1z'/%3E%3Ccircle cx='160' cy='150' r='1'/%3E%3Ccircle cx='40' cy='160' r='.9'/%3E%3C/g%3E%3C/svg%3E");
  /* vellum grain */
  --spry-parchment-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  /* gold stars for the night panels (dim enough to sit behind words) */
  --spry-stars-night: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cg fill='%23f0d48a' opacity='.32'%3E%3Cpath d='M28 24l1.1 3 3 1.1-3 1.1-1.1 3-1.1-3-3-1.1 3-1.1z'/%3E%3Cpath d='M104 62l.9 2.5 2.5.9-2.5.9-.9 2.5-.9-2.5-2.5-.9 2.5-.9z'/%3E%3Cpath d='M56 112l1 2.7 2.7 1-2.7 1-1 2.7-1-2.7-2.7-1 2.7-1z'/%3E%3Ccircle cx='126' cy='104' r='1'/%3E%3Ccircle cx='76' cy='14' r='.9'/%3E%3Ccircle cx='12' cy='86' r='.8'/%3E%3Ccircle cx='140' cy='20' r='.7'/%3E%3C/g%3E%3C/svg%3E");
  /* the orbit mark: a still centre, a sphere, a planet on it */
  --ls-orbit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%23b48a2c' stroke-width='1.1'/%3E%3Ccircle cx='12' cy='12' r='4.5' fill='none' stroke='%23b48a2c' stroke-width='.8' opacity='.7'/%3E%3Ccircle cx='12' cy='12' r='1.8' fill='%23b48a2c'/%3E%3Ccircle cx='19.4' cy='6.9' r='1.9' fill='%23233d9b'/%3E%3C/svg%3E");
  /* bar-and-vine: a gold vine with three-lobed ivy leaves on short stems
     (gold and ultramarine, as in 14th-century border work) and small gold
     and blue bezants; a seamless 120px tile */
  --ls-vine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='24'%3E%3Cpath d='M0 12C10 5 20 5 30 12S50 19 60 12S80 5 90 12S110 19 120 12' fill='none' stroke='%23b48a2c' stroke-width='1.2'/%3E%3Cpath d='M15.0 8.3L15.0 6.3' stroke='%23b48a2c' stroke-width='.8'/%3E%3Cpath d='M15.0 6.3C11.8 6.1 10.4 3.7 12.0 2.3C12.8 1.7 13.8 1.9 14.1 2.3C14.2 0.9 15.8 0.9 15.9 2.3C16.2 1.9 17.2 1.7 18.0 2.3C19.6 3.7 18.2 6.1 15.0 6.3Z' fill='%23b48a2c'/%3E%3Cpath d='M45.0 15.7L45.0 17.7' stroke='%23233d9b' stroke-width='.8'/%3E%3Cpath d='M45.0 17.7C41.8 17.9 40.4 20.3 42.0 21.7C42.8 22.3 43.8 22.1 44.1 21.7C44.2 23.1 45.8 23.1 45.9 21.7C46.2 22.1 47.2 22.3 48.0 21.7C49.6 20.3 48.2 17.9 45.0 17.7Z' fill='%23233d9b'/%3E%3Cpath d='M75.0 8.3L75.0 6.3' stroke='%23233d9b' stroke-width='.8'/%3E%3Cpath d='M75.0 6.3C71.8 6.1 70.4 3.7 72.0 2.3C72.8 1.7 73.8 1.9 74.1 2.3C74.2 0.9 75.8 0.9 75.9 2.3C76.2 1.9 77.2 1.7 78.0 2.3C79.6 3.7 78.2 6.1 75.0 6.3Z' fill='%23233d9b'/%3E%3Cpath d='M105.0 15.7L105.0 17.7' stroke='%23b48a2c' stroke-width='.8'/%3E%3Cpath d='M105.0 17.7C101.8 17.9 100.4 20.3 102.0 21.7C102.8 22.3 103.8 22.1 104.1 21.7C104.2 23.1 105.8 23.1 105.9 21.7C106.2 22.1 107.2 22.3 108.0 21.7C109.6 20.3 108.2 17.9 105.0 17.7Z' fill='%23b48a2c'/%3E%3Ccircle cx='30' cy='12' r='1.5' fill='%23d8b14e'/%3E%3Ccircle cx='90' cy='12' r='1.5' fill='%23d8b14e'/%3E%3Ccircle cx='60' cy='12' r='1.1' fill='%23233d9b'/%3E%3Ccircle cx='0' cy='12' r='1.1' fill='%23233d9b'/%3E%3Ccircle cx='120' cy='12' r='1.1' fill='%23233d9b'/%3E%3C/svg%3E");
  /* the vine's centrepiece: a gilt roundel holding a quatrefoil, set in a
     small clearing of the leaf's own vellum so the vine stops short of it */
  --ls-roundel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='19.5' fill='%23fcf9f1'/%3E%3Ccircle cx='20' cy='20' r='12.4' fill='none' stroke='%23b48a2c' stroke-width='1.1'/%3E%3Ccircle cx='20' cy='20' r='9.8' fill='none' stroke='%23b48a2c' stroke-width='.5' opacity='.65'/%3E%3Cg fill='%23b48a2c'%3E%3Ccircle cx='20' cy='16.4' r='2.8'/%3E%3Ccircle cx='23.6' cy='20' r='2.8'/%3E%3Ccircle cx='20' cy='23.6' r='2.8'/%3E%3Ccircle cx='16.4' cy='20' r='2.8'/%3E%3C/g%3E%3Ccircle cx='20' cy='20' r='1.8' fill='%23233d9b'/%3E%3Cg fill='%23d8b14e'%3E%3Ccircle cx='20' cy='7.6' r='.9'/%3E%3Ccircle cx='32.4' cy='20' r='.9'/%3E%3Ccircle cx='20' cy='32.4' r='.9'/%3E%3Ccircle cx='7.6' cy='20' r='.9'/%3E%3C/g%3E%3C/svg%3E");
  /* the whole border ornament: roundel over a centred vine that fades out
     before it reaches the frame, so no leaf is ever cut in half */
  --ls-vine-border: var(--ls-roundel) center / 40px 40px no-repeat, var(--ls-vine) center / 100px 20px repeat-x;
  --ls-vine-fade: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
  /* a gold quatrefoil, for list bullets */
  --ls-quatrefoil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 11 11'%3E%3Cg fill='%23b48a2c'%3E%3Ccircle cx='5.5' cy='2.9' r='2.3'/%3E%3Ccircle cx='8.1' cy='5.5' r='2.3'/%3E%3Ccircle cx='5.5' cy='8.1' r='2.3'/%3E%3Ccircle cx='2.9' cy='5.5' r='2.3'/%3E%3C/g%3E%3Ccircle cx='5.5' cy='5.5' r='1.3' fill='%23233d9b'/%3E%3C/svg%3E");
  /* the astrolabe measure: a gold hairline with even degree ticks */
  --ls-measure:
    linear-gradient(var(--spry-gold-soft), var(--spry-gold-soft)) 0 100% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, rgb(180 138 44 / 0.75) 0 1px, transparent 1px 9px) 0 100% / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, rgb(180 138 44 / 0.9) 0 1px, transparent 1px 45px) 0 100% / 100% 9px no-repeat;
  /* the spheres: fine gold rings radiating from a sun just above the frame */
  --ls-spheres: repeating-radial-gradient(circle at 50% -5rem, transparent 0 calc(4.5rem - 1px), rgb(240 212 138 / 0.28) calc(4.5rem - 1px) 4.5rem);

  /* ---- The page ---- */
  & body { background-image: var(--spry-stars), var(--spry-parchment-noise); }
  & ::selection { background: rgb(180 138 44 / 0.28); }
  & ::placeholder { color: var(--spry-fg-muted); opacity: 0.8; }

  /* Headings: deep ultramarine ink; the section heading carries the orbit */
  & :where(h1, h2, h3, h4) { letter-spacing: -0.005em; }
  & :where(h5, h6) { font-family: var(--ls-caps); letter-spacing: 0.14em; }
  /* An illuminated initial opens each section heading: a gold capital on a
     small ultramarine tile in a gold frame */
  & .card > h2:first-child::first-letter {
    font-family: var(--ls-caps);
    color: var(--ls-gold-bright);
    background: radial-gradient(circle at 30% 25%, #3152b8, var(--spry-night) 75%);
    border: 1px solid var(--spry-gold);
    border-radius: 0;
    padding: 0 0.22em 0.04em;
    margin-right: 0.12em;
  }

  /* Gold quatrefoils for the bullets of running lists */
  & :where(.prose, .card) :where(ul):not([class]) { list-style-image: var(--ls-quatrefoil); }
  & .card-title { font-family: var(--ls-caps); font-weight: 600; letter-spacing: 0.04em; font-size: 1.05rem; }
  & .card-subtitle { font-style: italic; }

  /* An illuminated initial for lead paragraphs: ultramarine, gilded edge */
  & p.lead::first-letter,
  & article > p:first-of-type::first-letter {
    float: left;
    font-family: var(--ls-caps);
    font-size: 3.2em; line-height: 0.85;
    padding: 0.1em 0.14em 0.08em; margin: 0.06em 0.16em 0 0;
    color: var(--spry-accent);
    border: 1px solid var(--spry-gold-soft);
    border-radius: 0;
    background: linear-gradient(135deg, rgb(240 212 138 / 0.35), transparent 70%);
  }

  & hr {
    border: 0; height: 40px; margin-block: 2rem;
    background: var(--ls-vine-border);
    -webkit-mask: var(--ls-vine-fade); mask: var(--ls-vine-fade);
  }

  & blockquote {
    border-inline-start: 2px solid var(--spry-gold);
    background: linear-gradient(90deg, rgb(180 138 44 / 0.07), transparent 70%);
    padding: 0.4rem 1.2rem;
    font-style: italic;
    color: #2b3358;
  }
  & blockquote :is(footer, cite) { font-style: normal; font-family: var(--ls-caps); letter-spacing: 0.08em; font-size: 0.8em; color: var(--spry-gold-ink); }

  & :not(pre) > code { background: #f2e9d3; border-color: #e3d4ac; color: #3a2c12; }
  & mark { background: rgb(240 212 138 / 0.55); color: inherit; }

  /* ---- Topbar: a calm vellum band over the measure ---- */
  & .topbar {
    background: rgb(245 239 226 / 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 0;
    padding-bottom: calc(0.65rem + 9px);
    box-shadow: 0 10px 24px -22px rgb(27 33 64 / 0.6);
  }
  & .topbar::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 9px;
    pointer-events: none;
    background: var(--ls-measure);
  }
  & .topbar-brand {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-family: var(--ls-caps); letter-spacing: 0.1em; font-weight: 600;
    color: var(--spry-heading-color);
  }
  & .topbar-brand::before {
    content: ""; width: 1.4em; height: 1.4em;
    background: var(--ls-orbit) center / contain no-repeat;
  }
  & .topbar-brand:hover { color: var(--spry-accent); }

  /* Nav: inscriptional small capitals; a gold line grows under on hover; the
     current page is an ultramarine plaque with cut corners */
  & .nav a {
    font-family: var(--ls-caps); font-size: 0.86rem; letter-spacing: 0.1em; font-weight: 500;
    color: var(--spry-fg);
    border-radius: var(--spry-radius-sm);
    background-image: linear-gradient(var(--spry-gold), var(--spry-gold));
    background-repeat: no-repeat;
    background-position: 50% calc(100% - 0.2rem);
    background-size: 0% 1px;
    transition: background-size var(--spry-transition), color var(--spry-transition);
  }
  & .nav a:hover { background-color: transparent; background-size: 60% 1px; color: var(--spry-gold-ink); }
  & .nav a.active { background: var(--spry-accent); color: var(--spry-accent-fg); box-shadow: inset 0 0 0 1px rgb(240 212 138 / 0.55); }
  & .breadcrumb a { font-family: var(--ls-caps); font-size: 0.85em; letter-spacing: 0.08em; }
  & .breadcrumb li + li::before { color: var(--spry-gold); }
  & .breadcrumb [aria-current] { color: var(--spry-fg); }

  /* ---- Buttons ---- */
  & :where(button, input[type="submit"], input[type="reset"], input[type="button"], .btn) {
    font-family: var(--ls-caps);
    font-size: 0.86em;
    letter-spacing: 0.08em;
    font-weight: 600;
  }
  & .btn-primary {
    background: linear-gradient(180deg, #2b48a9 0%, #1d3283 100%);
    border-color: #142561;
    color: var(--spry-accent-fg);
    box-shadow: inset 0 0 0 1px rgb(240 212 138 / 0.4), 0 6px 16px -10px rgb(20 37 97 / 0.9);
  }
  & .btn-primary:hover {
    background: linear-gradient(180deg, #3152b8 0%, #213a92 100%);
    border-color: #142561;
    box-shadow: inset 0 0 0 1px rgb(240 212 138 / 0.7), 0 8px 20px -10px rgb(20 37 97 / 0.95);
  }
  & .btn-danger { background: var(--ls-vermilion); border-color: #7e2414; color: #fcf9f1; }
  & .btn-danger:hover { background: #8a2716; border-color: #6b1e10; color: #fcf9f1; }
  & .btn-outline { background: transparent; border-color: var(--spry-accent); color: var(--spry-accent); }
  & .btn-outline:hover { background: var(--spry-accent-soft); border-color: var(--spry-accent-hover); color: var(--spry-accent-hover); }
  & .btn-ghost:hover { background: rgb(180 138 44 / 0.1); }
  & .btn-link { font-family: var(--spry-font); font-size: inherit; letter-spacing: 0; font-weight: 500; }

  /* ---- Forms ---- */
  & :where(input[type="checkbox"], input[type="radio"]) { accent-color: var(--spry-accent); }
  & .label, & legend { font-family: var(--ls-caps); font-size: 0.8rem; letter-spacing: 0.1em; font-weight: 600; color: var(--spry-heading-color); }
  & fieldset { border-color: var(--spry-border); border-radius: var(--spry-radius); }
  & .otp input { font-family: var(--ls-caps); color: var(--spry-accent); background: var(--spry-surface); }

  /* Switch: a sun-and-moon dial — a vellum trough with a pewter moon when
     off; the night sky with a gilded sun when on */
  & .switch .track { border-radius: 999px; background: #ece2c8; box-shadow: inset 0 0 0 1px var(--spry-ink-line), inset 0 1px 2px rgb(27 33 64 / 0.15); }
  & .switch .track::after { background: radial-gradient(circle at 32% 32%, #ffffff, #b9c0cf 72%); box-shadow: 0 0 0 1px #8e96ad, 0 1px 2px rgb(27 33 64 / 0.3); }
  & .switch input:checked + .track { background-color: var(--spry-night); background-image: var(--spry-stars-night); box-shadow: inset 0 0 0 1px rgb(240 212 138 / 0.6); }
  & .switch input:checked + .track::after { background: radial-gradient(circle at 32% 32%, #fbe9a6, #c99a32 72%); box-shadow: 0 0 0 2px rgb(252 249 241 / 0.25), 0 0 0.5rem rgb(240 212 138 / 0.7); }

  /* ---- Cards: soft vellum leaves; structured parts divided by the measure ---- */
  /* A structured card's header is a band of starry ultramarine sky */
  & .card-header {
    background: var(--spry-stars-night), linear-gradient(180deg, #2a46a4 0%, var(--spry-night) 100%);
    border-bottom: 1px solid var(--spry-gold);
    color: var(--spry-night-fg);
  }
  & .card-header .card-title { color: var(--ls-gold-bright); }
  & .card-header .card-subtitle { color: var(--spry-night-muted); }
  /* ...and its footer sits under the bar-and-vine border: the vine grows
     out from a gilt roundel and fades before the frame; the footer's vellum
     deepens gently below it instead of starting on a hard edge */
  & .card-footer {
    position: relative;
    border-top: 0;
    padding-top: calc(var(--spry-card-padding) * 0.45 + 34px);
    background: linear-gradient(180deg, rgb(239 230 209 / 0) 0 38px, rgb(239 230 209 / 0.45) 70%, rgb(235 225 201 / 0.7) 100%);
    font-style: italic;

    &::before {
      content: ""; position: absolute; inset: -0.1rem 1.25rem auto; height: 40px;
      pointer-events: none;
      background: var(--ls-vine-border);
      -webkit-mask: var(--ls-vine-fade); mask: var(--ls-vine-fade);
    }
  }
  /* every leaf sits inside a ruled gold frame, as on a calendar page */
  & .card { position: relative; }
  & .card::after {
    content: ""; position: absolute; inset: 4px;
    border: 1px solid rgb(180 138 44 / 0.4);
    pointer-events: none;
  }
  & .card .card { --spry-card-shadow: 0 1px 0 rgb(180 138 44 / 0.12), 0 8px 18px -14px rgb(27 33 64 / 0.35); }
  & .card-flat { box-shadow: none; background: transparent; border-style: dashed; }
  & .card-flat::after { content: none; }

  /* ---- Tables: astronomical tables — capitals over the measure ---- */
  & thead th {
    position: relative;
    background: transparent;
    color: var(--spry-heading-color);
    font-family: var(--ls-caps); font-size: 0.78em; letter-spacing: 0.12em; font-weight: 600;
    text-transform: none;
    border-bottom: 0;
    padding-bottom: calc(0.6rem + 9px);
    background-image: var(--ls-measure);
  }
  & :where(td, th) { border-color: var(--spry-border); }
  & .table-striped tbody tr:nth-child(even) { background: rgb(180 138 44 / 0.06); }
  & .num { font-family: var(--spry-font-mono); font-size: 0.86em; }

  /* ---- Tabs: small capitals, a gold underline on the current ---- */
  & .tab-list { --spry-accent: var(--spry-gold-ink); border-bottom-color: var(--spry-border); }
  & .tab-list label { font-family: var(--ls-caps); font-size: 0.84rem; letter-spacing: 0.1em; }

  /* ---- Expanders ---- */
  & details { border-color: var(--spry-border); background: var(--spry-surface); }
  & summary::before { border-color: var(--spry-gold); }
  & summary:hover { background: #f8efd9; }

  /* ---- Night panels: dialogs, drawers, popovers. The whole ink system flips
     with the sky, so every child inherits readable pairs; the vellum
     .dialog-body inset flips it back. ---- */
  & dialog,
  & [popover],
  & :is(.drawer-left, .drawer-right) {
    background-color: var(--spry-night);
    background-image: var(--spry-stars-night), radial-gradient(ellipse 120% 80% at 50% 0, #213a8e, var(--spry-night) 60%, var(--ls-night-deep));
    border-color: rgb(240 212 138 / 0.55);
    color: var(--spry-night-fg);
    --spry-fg: var(--spry-night-fg);
    --spry-heading-color: var(--spry-night-fg);
    --spry-fg-muted: var(--spry-night-muted);
    --spry-bg-alt: rgb(243 238 223 / 0.08);
    --spry-bg-inset: rgb(8 14 40 / 0.6);
    --spry-btn-bg: rgb(243 238 223 / 0.1); --spry-btn-fg: var(--spry-night-fg);
    --spry-btn-border: rgb(240 212 138 / 0.55);
    --spry-btn-bg-hover: rgb(243 238 223 / 0.18); --spry-btn-bg-active: rgb(243 238 223 / 0.24);
    --spry-control-bg: #0f1c52; --spry-control-fg: var(--spry-night-fg);
    --spry-control-border: rgb(240 212 138 / 0.5);
    --spry-accent: #e3c06a; --spry-accent-hover: #f0d48a;
    --spry-accent-fg: #1b1608; --spry-accent-soft: rgb(240 212 138 / 0.16);
    --spry-link: var(--ls-gold-bright); --spry-link-hover: #fbe9a6;
    --spry-danger: #f0a898; --spry-danger-soft: rgb(240 168 152 / 0.16);
    --spry-success: #b6d6a8; --spry-success-soft: rgb(182 214 168 / 0.16);
    --spry-warning: #ecd394; --spry-warning-soft: rgb(236 211 148 / 0.18);
    --spry-info: #b9c8f2; --spry-info-soft: rgb(185 200 242 / 0.16);

    & :focus-visible { outline-color: var(--ls-gold-bright); }

    & .dialog-titlebar {
      background: none;
      border-bottom: 1px solid rgb(240 212 138 / 0.3);
      & .dialog-title { color: var(--ls-gold-bright); font-family: var(--ls-caps); letter-spacing: 0.08em; font-size: 0.95rem; }
      & .dialog-close { color: var(--ls-gold-bright); border-radius: 50%; }
      & .dialog-close:hover { background: rgb(240 212 138 / 0.16); color: #fff6d6; }
    }

    /* the vellum leaf inset in the sky: flip the ink system back */
    & .dialog-body {
      margin: 0.7rem;
      background: var(--spry-surface);
      border: 1px solid rgb(240 212 138 / 0.45);
      border-radius: var(--spry-radius);
      color: #1b2140;
      --spry-fg: #1b2140; --spry-fg-muted: #565c76; --spry-heading-color: #1b2a64;
      --spry-bg-alt: #efe6d1; --spry-bg-inset: #ebe1c9;
      --spry-btn-bg: var(--spry-surface); --spry-btn-fg: #1b2140;
      --spry-btn-border: #c9b380;
      --spry-btn-bg-hover: #f8efd9; --spry-btn-bg-active: #ebe1c9;
      --spry-control-bg: var(--spry-surface); --spry-control-fg: #1b2140;
      --spry-control-border: #b9a674;
      --spry-accent: #233d9b; --spry-accent-hover: #1a2f7d;
      --spry-accent-fg: #fcf9f1; --spry-accent-soft: rgb(35 61 155 / 0.1);
      --spry-link: #233d9b; --spry-link-hover: #8a6a16;
      --spry-danger: #a3301b; --spry-danger-soft: rgb(163 48 27 / 0.1);
      --spry-success: #3d6b45; --spry-success-soft: rgb(61 107 69 / 0.1);
      --spry-warning: #6e5410; --spry-warning-soft: rgb(110 84 16 / 0.12);
      --spry-info: #233d9b; --spry-info-soft: rgb(35 61 155 / 0.1);
      & :focus-visible { outline-color: var(--spry-accent); }
    }

    & .dialog-footer { background: none; border-top-color: rgb(240 212 138 / 0.25); }

    /* danger keeps a deep vermilion fill under light lettering */
    & .btn-danger { background: #9a2d1a; border-color: #f0a898; color: #fff; }
    & .btn-danger:hover { background: #82240f; border-color: #f6c2b5; color: #fff; }
    & .btn-primary { background: var(--ls-gold-leaf); border-color: #7a5a12; color: #1b1608; box-shadow: none; }
    & .btn-primary:hover { filter: brightness(1.06); border-color: #7a5a12; color: #1b1608; }

    & .alert:not(.dialog-body *) { background: rgb(243 238 223 / 0.07); border-color: rgb(240 212 138 / 0.3); }
  }
  & dialog, & [popover]:has(> .dialog-titlebar, > .dialog-body, > .dialog-footer) { border-radius: var(--spry-radius-lg); }

  /* Dropdowns are night panels too; static submenus inside .menu stay on vellum */
  & .submenu { background-color: var(--spry-night); background-image: var(--spry-stars-night); border-color: rgb(240 212 138 / 0.55); }
  & .submenu a { color: var(--spry-night-fg); }
  & .submenu a:hover,
  & .submenu a.active { background: rgb(240 212 138 / 0.16); color: #fff6d6; }
  & .nav .submenu a { background-image: none; font-family: var(--spry-font); font-size: 1rem; letter-spacing: 0; color: var(--spry-night-fg); white-space: nowrap; border-radius: var(--spry-radius-sm); }
  & .nav .submenu a:hover,
  & .nav .submenu a.active { background: rgb(240 212 138 / 0.16); color: #fff6d6; }
  & .menu .has-submenu .submenu { background: none; border: 0; }
  & .menu .has-submenu .submenu a { color: var(--spry-fg); }
  & .menu a { border-radius: var(--spry-radius-sm); }
  & .menu a:hover,
  & .menu .has-submenu .submenu a:hover { background: #f4ead2; color: var(--spry-heading-color); }
  & .menu a.active,
  & .menu .has-submenu .submenu a.active { background: var(--spry-accent-soft); color: var(--spry-accent); }

  /* ---- Hero: the living sky — the spheres turning round a hidden sun ---- */
  & .hero {
    background:
      var(--spry-stars-night),
      radial-gradient(circle at 50% -5rem, rgb(255 230 160 / 0.6), rgb(255 220 140 / 0.12) 9rem, transparent 14rem),
      radial-gradient(ellipse 70% 120% at 50% 0, transparent 35%, var(--ls-night-deep) 92%),
      var(--ls-spheres),
      linear-gradient(180deg, #2846a6 0%, var(--spry-night) 55%, var(--ls-night-deep) 100%);
    border: 1px solid rgb(240 212 138 / 0.6);
    /* the lunette over the month: the sky's arch springs from a squared,
       sharp-cornered base, as the hemicycle sits over each calendar scene */
    border-radius: 50% 50% 0 0 / 4.5rem 4.5rem 0 0;
    color: var(--spry-night-fg);
    padding-top: 6rem;
    /* a second gold rule follows the arch inside the first */
    box-shadow: inset 0 0 0 5px var(--ls-night-deep), inset 0 0 0 6px rgb(240 212 138 / 0.4), var(--spry-shadow-lg);
  }
  & .hero-eyebrow {
    display: inline-flex; align-items: center; gap: 0.9rem;
    font-family: var(--ls-caps); letter-spacing: 0.3em;
    color: var(--ls-gold-bright);
  }
  & .hero-eyebrow::before,
  & .hero-eyebrow::after { content: ""; width: 2.5rem; height: 1px; background: rgb(240 212 138 / 0.6); }
  & .hero-title { color: #fbf6e6; font-weight: 500; letter-spacing: -0.01em; text-shadow: 0 2px 24px rgb(14 24 70 / 0.8); }
  & .hero-sub { color: var(--spry-night-muted); }
  & .hero .btn-primary { background: var(--ls-gold-leaf); border-color: #8a6714; color: #1b1608; box-shadow: 0 6px 18px -8px rgb(240 212 138 / 0.6); }
  & .hero .btn-primary:hover { filter: brightness(1.06); border-color: #8a6714; color: #1b1608; }
  & .hero .btn:not(.btn-primary) { background: transparent; border-color: rgb(240 212 138 / 0.55); color: var(--spry-night-fg); }
  & .hero .btn:not(.btn-primary):hover { background: rgb(240 212 138 / 0.12); color: #fff; }

  /* ---- Avatars: roundels of sky in a gold ring ---- */
  & .avatar {
    background: radial-gradient(circle at 35% 30%, #2f4fb5, var(--spry-night) 70%);
    color: var(--ls-gold-bright);
    font-family: var(--ls-caps);
    box-shadow: inset 0 0 0 1px rgb(240 212 138 / 0.65);
  }
  & .avatar-group .avatar { box-shadow: inset 0 0 0 1px rgb(240 212 138 / 0.65), 0 0 0 2px var(--spry-surface); }

  /* ---- Pagination ---- */
  & .pagination :is(a, span) { font-family: var(--ls-caps); border-radius: var(--spry-radius-sm); }
  & .pagination [aria-current="page"],
  & .pagination a[aria-current="page"]:hover { background: var(--spry-accent); border-color: var(--spry-accent); color: var(--spry-accent-fg); box-shadow: inset 0 0 0 1px rgb(240 212 138 / 0.5); }

  /* ---- Progress: a gilded measure; indeterminate is a shaft of light ---- */
  & progress {
    --ls-degrees: repeating-linear-gradient(90deg, rgb(122 93 18 / 0.4) 0 1px, transparent 1px 10%);
    border: 1px solid var(--spry-border-strong);
    border-radius: 1px;
    background: var(--ls-degrees) 0 100% / 100% 45% no-repeat, #ece2c8;
  }
  & progress::-webkit-progress-bar { background: var(--ls-degrees) 0 100% / 100% 45% no-repeat, #ece2c8; border-radius: 0; }
  & progress::-webkit-progress-value { border-radius: 0; }
  & progress::-moz-progress-bar { border-radius: 0; }
  & progress::-webkit-progress-value { background: linear-gradient(180deg, #ecd08a 0%, #d3ac52 45%, #a8801f 100%); box-shadow: inset 0 1px 0 rgb(255 244 214 / 0.55); }
  & progress::-moz-progress-bar { background: linear-gradient(180deg, #ecd08a 0%, #d3ac52 45%, #a8801f 100%); box-shadow: inset 0 1px 0 rgb(255 244 214 / 0.55); }
  & progress:indeterminate {
    background:
      linear-gradient(90deg, rgb(211 172 82 / 0) 0%, rgb(211 172 82 / 0.4) 18%, #ecc46a 38% 62%, rgb(211 172 82 / 0.4) 82%, rgb(211 172 82 / 0) 100%) 0 50% / 38% 100% no-repeat,
      var(--ls-degrees) 0 100% / 100% 45% no-repeat,
      #ece2c8;
    animation: sky-glide 2.4s ease-in-out infinite;
  }

  /* Spinner: a planet on its sphere */
  & .spinner { border-color: var(--spry-gold-soft); border-top-color: var(--spry-accent); }
}

/* Chamfered plaques: keys, the current nav item, page numbers and badges
   get cut corners like trimmed gilt plaques. Engines without corner-shape
   keep the near-square radius above. */
@supports (corner-shape: bevel) {
  [data-theme="living-sky"],
  html:has(#spry-theme-living-sky:checked) {
    & :where(.btn, button, input[type="submit"], input[type="reset"], input[type="button"]):not(.dialog-close, .btn-link),
    & .nav a.active,
    & .pagination :is(a, span),
    & .badge {
      border-radius: var(--ls-chamfer);
      corner-shape: bevel;
    }
    & .badge { --ls-chamfer: 0.3rem; }
  }
}

/* The shaft of light: a 38%-wide glow crossing the trough once per loop —
   p% maps to p x 62% of the track, so -161% .. 161% enters and leaves fully */
@keyframes sky-glide {
  from { background-position: -161% 50%, 0 100%, 0 0; }
  to { background-position: 161% 50%, 0 100%, 0 0; }
}
