/* Thème Kara — point d’entrée (CSS pur)
   Pour changer de thème : remplacer 'css/themes/_kara.css' par 'css/themes/mon-theme.css'. */

@layer theme, base, layout, nav, page, home, content, components, responsive;

/* Thème Kara — "Terre & Lumière"
   Pour créer un autre thème : copier ce fichier, modifier les valeurs,
   puis changer la référence dans style.css. */

@layer theme {
  :root {
    --bg: #f3e4d2;
    --bg-deep: #e4c7aa;
    --panel-alpha: 0.8;
    --panel-padding: 2.55rem;
    --font-serif: "Georgia", serif;
    --paper: #fffaf4;
    --paper-strong: #fffaf4;

    /* Rayons par défaut ; surcharges par largeur d’écran en fin de fichier. */
    --radius-none: 0;
    --radius-standard: 1rem;
    --radius-panel: 1.6rem;
    --radius-full: 999px;

    /* Fonds des boîtes (semi-transparents, légèrement cuivrés) */
    --panel-bg: linear-gradient(180deg, rgba(255, 250, 244, var(--panel-alpha)), rgba(247, 232, 215, var(--panel-alpha))),
                linear-gradient(140deg, rgba(255, 255, 255, calc(var(--panel-alpha) * 0.36)), transparent 55%);
    --content-bg: rgba(255, 248, 240, var(--panel-alpha));
    --card-bg: linear-gradient(180deg, rgba(255, 251, 247, var(--panel-alpha)), rgba(248, 236, 225, var(--panel-alpha)));
    --ink: #2d1f18;
    --muted: #70594c;
    --footer-link: rgba(255, 251, 246, 0.5);
    --footer-link-hover: #fffdf9;
    --footer-glow-1: rgba(255, 244, 235, 0.96);
    --footer-glow-2: rgba(255, 244, 235, 0.78);
    --footer-glow-3: rgba(255, 244, 235, 0.5);
    --footer-glow-4: rgba(255, 244, 235, 0.28);
    --footer-glow-5: rgba(255, 244, 235, 0.16);
    --line: rgba(120, 81, 59, 0.18);
    --line-strong: rgba(120, 81, 59, 0.3);
    --accent: #b5562d;
    --accent-deep: #8a3b1b;
    --accent-soft: #efd4c1;
    --olive: #6f7250;
    --shadow: 0 12px 30px rgba(91, 54, 33, 0.08);
    --shadow-soft: 0 12px 30px rgba(91, 54, 33, 0.08);

    /* Texte sur fonds sombres/colorés (page-header, hero, lightbox) */
    --on-dark: #fff7f0;

    /* Hero */
    --hero-bg: #24150f;
    --hero-overlay: linear-gradient(180deg, rgba(22, 10, 6, 0.1) 0%, rgba(22, 10, 6, 0.85) 100%);

    /* Page header */
    --header-gradient: linear-gradient(135deg, #8c3f1e, #b5562d 52%, #d9874a 100%);
    --header-bg: linear-gradient(135deg, rgba(140, 63, 30, var(--panel-alpha)), rgba(186, 103, 63, var(--panel-alpha)) 52%, rgba(221, 167, 116, var(--panel-alpha)) 100%);

    /* Bouton CTA */
    --btn-gradient: linear-gradient(180deg, #c86e42 0%, #a34a26 100%);
    --btn-gradient-hover: linear-gradient(180deg, #d4794c 0%, #b0542e 100%);

    /* Overlays sombres (lightbox) et boutons sur fond sombre */
    --overlay-bg: rgba(32, 20, 13, 0.9);
    --glass-bg: rgba(255, 248, 240, 0.16);
    --glass-bg-hover: rgba(255, 248, 240, 0.28);
  }

  @media (max-width: 640px) {
    :root {
      --radius-panel: 1.2rem;
    }
  }
}
@layer base {
  * {
    box-sizing: border-box;
  }

  html {
    scroll-behavior: auto;
  }

  body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.2rem;
    line-height: 1.4;
    background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%);
    position: relative;
  }

  .page-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(28, 13, 7, 0.28), rgba(28, 13, 7, 0.42)),
        var(--page-bg-image);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
  }

  a {
    color: var(--accent-deep);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
  }

  a:hover {
    color: var(--accent);
  }

  /* Personnalisation manuelle du look dans le Markdown. */
  .content .text-align-center {
    text-align: center;
  }

  .content .font-weight-bold {
    font-weight: bold;
  }

  .content .font-style-italic {
    font-style: italic;
  }

  .content .font-variant-small-caps {
    font-variant: small-caps;
  }

  .content .text-transform-uppercase {
    text-transform: uppercase;
  }

  .content .font-size-small {
    font-size: small;
  }

  .content .caption {
    font-variant: small-caps;
    font-size: small;
    text-transform: uppercase;
  }

  img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}
@layer layout {
  .shell {
    width: min(76rem, calc(100% - 2rem));
    margin: 0 auto;
  }

  .app {
    display: grid;
    grid-template-columns: minmax(17rem, 21rem) minmax(0, 1fr);
    gap: 1.75rem;
    padding: 1.4rem 0 3rem;
    position: relative;
    z-index: 1;
  }

  body.is-home .shell {
    width: 100%;
  }

  body.is-home .app {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  body.is-home .mainpane {
    width: 100%;
  }

  body.is-home .sidepane {
    display: none;
  }

  .sidepane {
    display: grid;
    gap: 1rem;
    align-self: start;
    position: relative;
    z-index: 6;
  }

  .mainpane {
    min-width: 0;
  }
}
@layer nav {
  .brand,
  .sidebar {
    padding: 1.25rem;
    border-radius: var(--radius-panel);
    background: var(--panel-bg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  .sidebar {
    position: sticky;
    top: 6.9rem;
    align-self: start;
    max-height: calc(100vh - 7.9rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(138, 59, 27, 0.45) rgba(255, 255, 255, 0.22);
  }

  .brand {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
  }

  .brand-copy {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
  }

  .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: var(--radius-full);
    background: transparent;
    box-shadow: none;
  }

  .brand-mark img {
    width: 2.55rem;
    height: 2.55rem;
    margin: 0;
    box-shadow: none;
  }

  .brand-kicker {
    color: var(--olive);
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
  }

  .brand-name {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.9rem;
    line-height: 1;
  }

  .sidebar::-webkit-scrollbar {
    width: 0.7rem;
  }

  .sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-full);
  }

  .sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(181, 86, 45, 0.7), rgba(138, 59, 27, 0.55));
    border: 2px solid rgba(255, 248, 240, 0.75);
    border-radius: var(--radius-full);
  }

  .nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.12rem;
  }

  .tree li {
    display: contents;
  }

  .branch {
    border-radius: var(--radius-standard);
    overflow: hidden;
  }

  .branch-summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 0.52rem;
    border-radius: var(--radius-standard);
    cursor: default;
    transition: background-color 160ms ease, transform 160ms ease;
  }

  .branch-summary::-webkit-details-marker {
    display: none;
  }

  .branch-summary::before {
    content: "▸";
    font-size: 0.78rem;
    color: var(--muted);
    transition: transform 160ms ease, color 160ms ease;
  }

  .branch[open] .branch-summary::before {
    transform: rotate(90deg);
    color: var(--accent);
  }

  .branch-link,
  .leaf {
    text-decoration: none;
  }

  .branch-link {
    display: block;
    flex: 1;
    color: var(--ink);
    padding: 0.16rem 0;
  }

  .branch-children {
    list-style: none;
    display: grid;
    gap: 0.08rem;
    margin: 0.08rem 0 0.3rem 1.05rem;
    padding-left: 0.7rem;
    border-left: 1px solid rgba(111, 114, 80, 0.2);
  }

  .branch-children .branch-children {
    margin-left: 0.8rem;
  }

  .leaf {
    display: block;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-standard);
    color: var(--muted);
  }

  .branch-summary:hover,
  .leaf:hover {
    background: rgba(181, 86, 45, 0.08);
  }

  .branch-link.is-active,
  .leaf.is-active {
    color: var(--accent-deep);
    font-weight: 700;
  }

  .branch-summary:has(.branch-link.is-active),
  .leaf.is-active {
    background: linear-gradient(180deg, rgba(239, 212, 193, 0.95), rgba(243, 227, 214, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  }
}
@layer page {
  .site-footer:not(.home-footer) {
    grid-column: 2;
    position: relative;
    z-index: 6;
    display: flex;
    justify-content: center;
    margin-top: 0;
    padding: 0.4rem 0 0.2rem;
    font-size: 0.9rem;
    color: var(--ink);
  }

  .site-footer a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.5rem;
    min-height: 3.5rem;
    padding: 0.6rem;
    color: var(--footer-link);
    text-decoration: none;
    font-size: 3em;
    line-height: 1;
  }

  .footer-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    line-height: 1;
    font-family: "Times New Roman", serif;
    font-weight: 900;
    text-shadow:
        0 0 0.9rem var(--footer-glow-1),
        0 0 1.8rem var(--footer-glow-2),
        0 0 3.2rem var(--footer-glow-3),
        0 0 5rem var(--footer-glow-4),
        0 0 7rem var(--footer-glow-5);
  }

  .site-footer a:hover,
  .site-footer a:focus-visible {
    color: var(--footer-link-hover);
    text-decoration: none;
    outline: none;
  }

  .home-footer {
    position: absolute;
    left: 50%;
    bottom: max(1.1rem, env(safe-area-inset-bottom, 0px));
    z-index: 1;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    transform: translateX(-50%);
    color: rgba(255, 248, 240, 0.98);
  }

  .home-footer a:hover,
  .home-footer a:focus-visible {
    color: var(--on-dark);
  }

  .page {
    padding: 0.2rem 0 3rem;
  }

  body.is-home .page {
    padding: 0;
  }

  .page.home {
    position: relative;
  }

  .page-header {
    margin-bottom: 1.35rem;
    padding: calc(var(--panel-padding) * 0.6) var(--panel-padding) calc(var(--panel-padding) * 1);
    border-radius: var(--radius-panel);
    background: var(--header-bg);
    color: var(--on-dark);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
  }

  .page-header::after {
    content: "";
    position: absolute;
    inset: auto -2rem -2rem auto;
    width: 12rem;
    height: 12rem;
    border-radius: var(--radius-full);
    background: radial-gradient(circle, rgba(255, 240, 222, 0.34) 0, transparent 68%);
    pointer-events: none;
  }

  .eyebrow,
  .breadcrumb {
    margin: 0 0 0.45rem;
    text-transform: uppercase;
    font-size: 0.76rem;
    font-weight: 700;
    color: rgba(255, 244, 235, 0.82);
  }

  .breadcrumb a {
    color: inherit;
  }

  .page-header h1 {
    position: relative;
    z-index: 1;
    margin: 0;
    font-family: var(--font-serif);
    line-height: 1.02;
    font-size: clamp(2.5rem, 6vw, 4.9rem);
    overflow-wrap: anywhere;
  }

  .dek {
    position: relative;
    z-index: 1;
    margin: 0.8rem 0 0;
    max-width: 44rem;
    font-size: 1.04rem;
    color: rgba(255, 244, 235, 0.88);
  }

  .page-nav {
    position: relative;
    z-index: 1;
    margin-top: 1.15rem;
  }

  .page-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    width: 100%;
  }

  .page-nav-list li {
    display: contents;
  }

  .page-nav-link {
    appearance: none;
    user-select: none;
    display: grid;
    gap: 0.22rem;
    width: 100%;
    min-height: 5rem;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-standard);
    font: inherit;
    text-decoration: none;
    text-align: left;
    color: var(--on-dark);
    background: rgba(255, 248, 240, 0.24);
    border: 1px solid rgba(255, 244, 235, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    cursor: pointer;
    transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
  }

  .page-nav-link:hover,
  .page-nav-link:focus-visible {
    transform: translateY(-2px);
    background: rgba(255, 248, 240, 0.36);
    border-color: rgba(255, 244, 235, 0.32);
    color: var(--on-dark);
    outline: none;
  }

  .page-nav-link[hidden] {
    display: none;
  }

  .page-nav-link.is-next {
    text-align: right;
  }

  .page-nav-kicker {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: rgba(255, 244, 235, 0.78);
  }

  .page-nav-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    line-height: 1.1;
  }
}
@layer home {
  .home .content {
    padding-top: 1rem;
  }

  .home {
    display: grid;
    gap: 1.5rem;
  }

  body.is-home .home {
    gap: 0;
  }

  .home-hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    border-radius: var(--radius-none);
    overflow: hidden;
    background: var(--hero-bg);
    isolation: isolate;
  }

  .home-hero-image,
  .home-hero-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .home-hero-image {
    object-fit: cover;
  }

  .home-hero-overlay {
    background: var(--hero-overlay);
  }

  .home-hero-content {
    position: relative;
    z-index: 1;
    min-height: inherit;
    display: grid;
    align-content: end;
    gap: 1rem;
    padding: clamp(1.5rem, 4vw, 3.75rem) clamp(1.5rem, 4vw, 3.75rem) 7rem;
    color: var(--on-dark);
  }

  .home-hero-content > * {
    min-width: 0;
  }

  .home-hero-brand {
    position: absolute;
    top: clamp(1.25rem, 3vw, 2.2rem);
    left: clamp(1.25rem, 3vw, 2.2rem);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
  }

  .home-hero-brand .brand-kicker {
    color: rgba(255, 240, 230, 0.76);
  }

  .home-hero-brand .brand-name {
    color: var(--on-dark);
  }

  .home-hero-brand .brand-mark {
    background: transparent;
  }

  .home-hero-content .eyebrow {
    margin: 0;
    color: rgba(255, 239, 227, 0.86);
  }

  .home-hero-content h1 {
    margin: 0;
    max-width: 9ch;
    color: var(--on-dark);
    font-size: clamp(3.2rem, 8vw, 6.8rem);
    line-height: 0.92;
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .home-hero-text {
    display: grid;
    gap: 1rem;
  }

  .home-hero-lead,
  .home-hero-curiosity {
    margin: 0;
    max-width: 36rem;
    overflow-wrap: anywhere;
  }

  .home-hero-lead {
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-weight: 600;
    color: rgba(255, 244, 235, 0.95);
  }

  .home-hero-curiosity {
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-weight: 600;
    font-style: italic;
    color: rgba(255, 236, 224, 0.84);
  }

  p.home-hero-button {
    margin: 0;
  }

  p.home-hero-button a {
    display: inline-flex;
    user-select: none;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 12rem;
    max-width: 100%;
    min-height: 3.25rem;
    margin-top: 0.35rem;
    padding: 0.8rem 2.4rem;
    border-radius: var(--radius-full);
    text-decoration: none;
    text-align: center;
    font-weight: 800;
    white-space: normal;
    overflow-wrap: anywhere;
    color: var(--on-dark);
    background: var(--btn-gradient);
    box-shadow: 0 16px 28px rgba(37, 15, 8, 0.28);
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
  }

  p.home-hero-button a:visited {
    color: var(--on-dark);
    text-decoration: none;
  }

  p.home-hero-button a:hover,
  p.home-hero-button a:focus-visible {
    color: var(--on-dark);
    transform: translateY(-2px);
    box-shadow: 0 20px 32px rgba(37, 15, 8, 0.36);
    background: var(--btn-gradient-hover);
  }

  /* Fenêtre « prochaine manifestation », en haut à droite de l'accueil.
     Alimentée par partials/home-event.html ; rien n'est rendu si les lignes
     correspondantes de la page Manifestations sont vides. */
  .home-event {
    position: absolute;
    top: clamp(1.25rem, 3vw, 2.2rem);
    right: clamp(1.25rem, 3vw, 2.2rem);
    z-index: 2;
    display: grid;
    gap: 0.35rem;
    max-width: min(24rem, calc(100% - 2 * clamp(1.25rem, 3vw, 2.2rem)));
    padding: 1rem 1.15rem;
    border: 1px solid rgba(255, 240, 230, 0.28);
    border-radius: var(--radius-standard);
    background: var(--btn-gradient);
    box-shadow: 0 18px 32px rgba(37, 15, 8, 0.28);
    color: var(--on-dark);
    text-align: left;
  }

  .home-event-title {
    margin: 0;
    color: var(--on-dark);
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    line-height: 1.25;
    text-wrap: balance;
  }

  .home-event-detail p {
    margin: 0;
    color: rgba(255, 244, 235, 0.92);
    font-size: 0.95rem;
    line-height: 1.4;
  }

  .home-event-link {
    justify-self: start;
    margin-top: 0.2rem;
    color: var(--on-dark);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }

  .home-event-link:hover,
  .home-event-link:focus-visible {
    color: #ffd9c6;
  }
}
@layer content {
  .home .content > p:first-child {
    margin-top: 0;
  }

  .home .content img:first-child {
    width: 100%;
    max-height: 30rem;
    object-fit: cover;
    border-radius: var(--radius-standard);
    box-shadow: var(--shadow-soft);
  }

  .content img {
    margin: 1rem auto;
    border-radius: var(--radius-standard);
    box-shadow: var(--shadow-soft);
  }

  .content .media-block {
    margin: 1.25rem 0;
  }

  .content .media-block > a,
  .content .gallery-link {
    display: block;
  }

  .content .image-gallery {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.9rem;
  }

  .content .image-gallery .gallery-item {
    margin: 0;
  }

  .content figure {
    margin: 1.5rem 0;
  }

  .content figcaption {
    margin-top: 0.4rem;
    text-align: center;
  }

  .content .image-gallery img {
    margin: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }

  .content img.is-lightboxable {
    cursor: zoom-in;
    transition: transform 180ms ease, box-shadow 180ms ease;
  }

  .content img.is-lightboxable:hover,
  .content img.is-lightboxable:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(91, 54, 33, 0.14);
    outline: none;
  }

  .content {
    background: var(--content-bg);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: var(--shadow-soft);
    border-radius: var(--radius-panel);
    padding: var(--panel-padding);
  }

  .content > :first-child {
    margin-top: 0;
  }

  .content > :last-child {
    margin-bottom: 0;
  }

  .content p {
    text-align: left;
  }

  .content h2,
  .content h3,
  .content h4 {
    color: var(--accent-deep);
    font-family: var(--font-serif);
    line-height: 1.15;
  }

  .content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.1rem;
    border-left: 4px solid var(--accent);
    background: rgba(239, 212, 193, 0.32);
    border-radius: var(--radius-none) var(--radius-standard) var(--radius-standard) var(--radius-none);
  }

  .content ul,
  .content ol {
    padding-left: 1.3rem;
  }

  .content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: rgba(255, 251, 247, 0.9);
    border: 1px solid rgba(120, 81, 59, 0.18);
    border-radius: var(--radius-standard);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
  }

  .content thead {
    background: linear-gradient(180deg, rgba(239, 212, 193, 0.95), rgba(243, 227, 214, 0.9));
  }

  .content th,
  .content td {
    padding: 0.85rem 0.9rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(120, 81, 59, 0.14);
  }

  .content th {
    color: var(--accent-deep);
    font-weight: 700;
  }

  .content tbody tr:last-child td {
    border-bottom: 0;
  }

  .content tbody tr:nth-child(even) {
    background: rgba(255, 248, 240, 0.6);
  }

  /* Sphère rouge des titres portant la classe .emoji-sphere.
     La police emoji du système dessine un disque rouge cerclé de noir ;
     ce rendu CSS donne une vraie sphère, identique partout. */
  .emoji-sphere::before {
    content: "";
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-right: 0.15em;
    border-radius: var(--radius-full);
    /* centre la sphère sur la hauteur des capitales */
    vertical-align: -0.1em;
    background:
      radial-gradient(circle at 68% 30%, #ff96a2 0%, #f4616f 18%, #e43c4c 42%, #c22a3b 70%, #8b1220 100%);
    box-shadow:
      inset -0.05em -0.06em 0.12em rgba(70, 0, 10, 0.35),
      inset 0.02em 0.02em 0.05em rgba(255, 255, 255, 0.28),
      0 0.015em 0.06em rgba(60, 10, 20, 0.25);
  }

  .update-note {
    margin-top: 2.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.95rem;
  }

  .update-note p {
    margin: 0;
  }
}
@layer components {
  .document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 0;
  }

  .document-card {
    display: grid;
    align-items: start;
    justify-items: start;
    gap: 0.8rem;
    padding: 1.2rem;
    text-align: left;
    border-radius: var(--radius-standard);
    background: rgba(255, 250, 246, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.38);
    box-shadow: var(--shadow-soft);
  }

  .document-card h3,
  .document-card p {
    width: 100%;
    margin: 0;
    text-align: left;
  }

  .document-card h3 {
    color: var(--accent-deep);
    font-family: var(--font-serif);
    font-size: 1.35rem;
    line-height: 1.08;
  }

  .document-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: var(--radius-standard);
    background: rgba(255, 255, 255, 0.3);
  }

  .document-card-icon img {
    width: 2.5rem;
    margin: 0;
    box-shadow: none;
  }

  .document-card-link {
    font-weight: 700;
  }

  .listing {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16.5rem, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
  }

  body.is-home .listing {
    width: min(76rem, calc(100% - 2rem));
    margin: 2rem auto 0;
  }

  .card {
    display: grid;
    gap: 0.55rem;
    padding: 1.15rem;
    border-radius: var(--radius-panel);
    border: 1px solid rgba(255, 255, 255, 0.46);
    background: var(--card-bg);
    box-shadow: var(--shadow-soft);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  }

  .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 34px rgba(91, 54, 33, 0.12);
    border-color: rgba(181, 86, 45, 0.22);
  }

  .card h2 {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.45rem;
    line-height: 1.1;
  }

  .card p {
    margin: 0;
    color: var(--muted);
  }

  .has-lightbox {
    overflow: hidden;
  }

  .lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: var(--overlay-bg);
  }

  .lightbox[hidden] {
    display: none;
  }

  .lightbox-figure {
    margin: 0;
    display: grid;
    gap: 0.75rem;
    max-width: min(92vw, 78rem);
    max-height: calc(100vh - 3rem);
  }

  .lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 7rem);
    width: auto;
    height: auto;
    border-radius: var(--radius-standard);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.3);
  }

  .lightbox-caption {
    margin: 0;
    text-align: center;
    color: rgba(255, 244, 235, 0.92);
  }

  .lightbox-count {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    margin: 0;
    color: rgba(255, 244, 235, 0.9);
    font-size: 0.95rem;
  }

  .lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    color: #fff7f0;
    font-size: 2rem;
    line-height: 1;
    text-align: center;
    cursor: pointer;
  }

  .lightbox-close:hover,
  .lightbox-close:focus-visible {
    background: var(--glass-bg-hover);
    outline: none;
  }

  .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3.25rem;
    height: 3.25rem;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    color: #fff7f0;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
  }

  .lightbox-prev {
    left: 1rem;
  }

  .lightbox-next {
    right: 1rem;
  }

  .lightbox-nav:hover,
  .lightbox-nav:focus-visible {
    background: var(--glass-bg-hover);
    outline: none;
  }
}
@layer responsive {
  @media (min-width: 901px) {
    .brand,
    .sidebar,
    .page-header,
    .content,
    .card {
      -webkit-backdrop-filter: blur(12px);
      backdrop-filter: blur(12px);
    }
  }

  @media (max-width: 900px) {
    :root {
      --panel-alpha: 0.9;
    }

    .home-hero {
      min-height: 100vh;
      min-height: 100svh;
      min-height: 100dvh;
    }

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

    body:not(.is-home) .sidepane {
      display: contents;
    }

    .brand {
      order: 1;
    }

    .mainpane {
      order: 2;
    }

    .sidebar {
      order: 3;
      position: static;
      max-height: none;
      overflow: visible;
    }

    .site-footer:not(.home-footer) {
      grid-column: auto;
      order: 4;
    }

    .page-header h1 {
      max-width: none;
    }
  }

  @media (max-width: 720px) {
    .home-hero-content {
      padding: 1.25rem 1.25rem 8rem;
      align-content: start;
    }

    .home-hero-brand,
    .home-event {
      position: static;
    }

    .home-event {
      z-index: auto;
      max-width: none;
    }
  }

  @media (max-width: 640px) {
    :root {
      --panel-alpha: 0.96;
    }

    .shell {
      width: min(100% - 1rem, 76rem);
    }

    body.is-home .shell {
      width: 100%;
    }

    .app {
      gap: 1rem;
      padding-top: 0.7rem;
    }

    body.is-home .app {
      padding-top: 0;
    }

    .brand,
    .sidebar,
    .content,
    .card {
      padding: 1rem;
    }

    .page-header {
      padding: 1.15rem 1rem;
    }

    .page-header h1 {
      font-size: clamp(2.2rem, 12vw, 3.4rem);
      line-height: 1.04;
      text-wrap: balance;
      hyphens: auto;
      -webkit-hyphens: auto;
    }

    .lightbox {
      padding: 1rem;
    }

    .lightbox-image {
      max-height: calc(100vh - 8rem);
    }

    .content .image-gallery {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0.75rem;
    }

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

    .page-nav-link,
    .page-nav-link.is-next {
      text-align: left;
      min-height: 0;
    }

    .lightbox-nav {
      width: 2.75rem;
      height: 2.75rem;
      top: auto;
      bottom: 4.25rem;
      transform: none;
    }

    .home-hero-content h1 {
      max-width: min(100%, 11ch);
      font-size: clamp(2.35rem, 13vw, 3.9rem);
      line-height: 0.96;
      text-wrap: balance;
    }

    .home-hero-lead,
    .home-hero-curiosity {
      max-width: 100%;
      font-size: clamp(1rem, 4.8vw, 1.15rem);
      line-height: 1.5;
      text-wrap: pretty;
    }

    .home-hero-button {
      width: 100%;
      min-width: 0;
      padding-inline: 1.1rem;
    }
  }
}
