:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #555;
  --line: #8a8a8a;
  --accent: #0b3d91;
  --hover: #eef2fa;
  --current: #dde6f7;
  --focus: #c05600;
  --nav-h: 4.5rem;
  --gap: clamp(1rem, 2.5vw, 2rem);
  --sidebar-w: clamp(15rem, 24vw, 22rem);
}

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

html { scroll-padding-top: calc(var(--nav-h) + 1rem); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

img { max-width: 100%; height: auto; display: block; }
audio { width: 100%; }
small { font-size: .8em; color: var(--muted); }

/* Focus always visible */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
h1:focus-visible, h2:focus-visible, h3:focus-visible { outline: 3px solid var(--focus); }

/* Skip link */
.skip-link {
  position: absolute; left: .5rem; top: -4rem; z-index: 100;
  background: var(--fg); color: #fff; padding: .6rem 1rem;
}
.skip-link:focus { top: .5rem; }

/* Header */
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem var(--gap);
}
.site-title { margin: 0; font-size: clamp(1.5rem, 4vw, 2.25rem); letter-spacing: .08em; text-transform: uppercase; }
.site-title a { color: inherit; text-decoration: none; }
.site-icon { color: var(--muted); }

/* Navigation (always visible) */
.main-nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-block: 1px solid var(--line);
}

.menu, .dropdown { list-style: none; margin: 0; padding: 0; }

.menu { display: flex; flex-wrap: wrap; }
.menu > li { position: relative; flex: 1 1 auto; border-inline-end: 1px solid var(--line); }
.menu > li:last-child { border-inline-end: 0; }

.menu a,
.dropdown-toggle {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 3.5rem; width: 100%;
  padding: .5rem .9rem;
  color: var(--fg); text-decoration: none; text-align: start;
  font: inherit; line-height: 1.3;
  background: none; border: 0; cursor: pointer;
}
.menu a:hover, .dropdown-toggle:hover { background: var(--hover); }
.menu a[aria-current="page"],
.has-dropdown.is-current > .dropdown-toggle { background: var(--current); font-weight: 600; }

/* Caret only on the real toggle button (created by script.js) */
button.dropdown-toggle { position: relative; }
button.dropdown-toggle::after { content: "▾"; position: absolute; inset-inline-end: .5rem; top: .5rem; font-size: .8em; }

/* Dropdown (only entries that have subpages).
   Fallback without JS: plain nested list, always visible. */
.dropdown { background: #f7f7f7; padding-inline-start: 1rem; }
.dropdown li + li { border-top: 1px solid #ddd; }
.dropdown[hidden] { display: none; }

.nav-toggle {
  display: none;
  width: 100%; min-height: 3rem; padding: .5rem var(--gap);
  font: inherit; font-weight: 600; text-align: start;
  background: var(--bg); color: var(--fg); border: 0; cursor: pointer;
}

/* Layout: content + static column on the right */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  gap: var(--gap);
  padding: var(--gap);
  align-items: start;
}

.content { min-height: 60vh; }
.content h2 { margin-top: 0; line-height: 1.25; }

/* Right column: every content element is one bordered block */
.sidebar { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); min-width: 0; }
.sidebar > a:empty { display: none; }
.sidebar .frame { margin: 0; padding: .75rem; border: 1px solid var(--line); min-width: 0; }
.sidebar header :is(h1, h2, h3, h4, h5, h6) { margin: 0 0 .5rem; font-size: 1rem; line-height: 1.3; }
.sidebar img { width: 100%; height: auto; }
.sidebar figure { margin: 0; }
.sidebar figcaption { font-size: .9rem; color: var(--muted); margin-top: .5rem; }
.sidebar p { margin: .5rem 0 0; font-size: .95rem; }
.sidebar a { color: var(--accent); }

/* Desktop with JS: floating dropdown */
@media (min-width: 60.01em) {
  .js .dropdown {
    position: absolute; inset-inline-start: 0; top: 100%;
    min-width: 100%; padding: 0; background: var(--bg);
    border: 1px solid var(--line); border-top: 0;
    box-shadow: 0 6px 16px rgb(0 0 0 / .15);
  }
}

/* Tablet/phone: collapsible menu, column below the content */
@media (max-width: 60em) {
  .menu { flex-direction: column; }
  .menu > li { border-inline-end: 0; border-bottom: 1px solid #ddd; }
  .js .nav-toggle { display: block; }
  .js .menu { display: none; border-top: 1px solid var(--line); max-height: calc(100vh - 3rem); overflow-y: auto; }
  .js .menu.is-open { display: flex; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .content { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
  .menu a[aria-current="page"] { outline: 2px solid; }
}

/* Paragraph formats from the RTE style menu (see Configuration/RTE/DisGiselle.yaml) */
.content p.lead { font-size: 1.2rem; }
.content p.note { padding: .5rem .75rem; border-inline-start: 4px solid var(--line); background: #f5f5f5; }
.content p.quote { padding: .5rem 0 .5rem 5rem; }
.content p.quote-source { font-size: .9rem; color: var(--muted); text-align: end; }
