/* ==========================================================================
   disclosure.css
   Collapsible sections (News now; reusable for Publications and others).
   Load on any page that uses <details class="disclosure">, together with
   assets/js/disclosure.js.

   Markup
     <div class="disclosure-tools"> … Expand All / Collapse All … </div>

     <details class="disclosure" id="…" open>
       <summary class="disclosure-summary">
         <span class="disclosure-title">…</span>
         <span class="disclosure-meta">…</span>           (optional)
         <a class="disclosure-top" href="#main" aria-label="Back to top">↑</a>   (optional)
         <span class="disclosure-icon" aria-hidden="true"></span>
       </summary>
       <div class="disclosure-body">
         …
         <button class="disclosure-control disclosure-collapse" … data-collapse-section="…" hidden>…</button>
       </div>
     </details>

   Contents
     0. Section shortcuts (optional)
     0b. Year shortcuts (optional)
     1. Toolbar and buttons
     2. Section header (the clickable row)
     3. Plus / minus icon
     4. Section body
     5. Print
   ========================================================================== */


/* --------------------------------------------------------------------------
   0. Section shortcuts
   A row of boxed links to the sections, as the day links on the reference
   programme: bold name, a second line, and "↓" at the end.
     <nav class="section-jumps" aria-label="…">
       <a href="#id"><strong>…</strong><span>…</span><span aria-hidden="true">↓</span></a>
     </nav>
   -------------------------------------------------------------------------- */

.section-jumps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  max-width: var(--content-max);
  margin: 0 0 1rem;                    /* the Expand / Collapse buttons follow closely */
}

.section-jumps a {
  display: flex;
  flex-direction: column;              /* name at the top, ↓ in the bottom-right corner */
  align-items: flex-start;
  gap: .6rem;
  min-height: 4.75rem;
  padding: .85rem 1rem;
  font-size: var(--fs-label);
  line-height: 1.4;
  color: var(--ink);
  text-decoration: none;
  background: transparent;             /* light outline only, no filled box */
  border: var(--rule);
  transition: background-color .15s ease, border-color .15s ease;
}

.section-jumps a strong {
  font-family: var(--heading);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink);
}

.section-jumps a > :last-child {
  align-self: flex-end;
  margin-top: auto;
  color: var(--ink);
}

.section-jumps a:hover {
  color: var(--ink);
  background: var(--accent-tint);
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .section-jumps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (forced-colors: active) {
  .section-jumps a {
    border-color: LinkText;
  }
}


/* --------------------------------------------------------------------------
   0b. Year shortcuts (compact variant of the section shortcuts: one box per
   year, wrapping into rows). Used on Events and Learning.
     <nav class="section-jumps year-jumps" aria-label="Years">
       <a href="#y2026"><strong>2026</strong><span aria-hidden="true">↓</span></a> …
   -------------------------------------------------------------------------- */

.year-jumps {
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: .5rem;
}

.year-jumps a {
  flex-direction: row;                 /* year and ↓ side by side */
  align-items: center;
  justify-content: space-between;
  gap: .3rem;
  min-height: var(--tap);
  padding: .6rem .75rem;
}

.year-jumps a > :last-child {
  align-self: center;
  margin-top: 0;
}

.year-jumps a strong {
  flex-basis: auto;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.ev-year > .disclosure-body {
  padding-bottom: 1.5rem;
}

.ev-year .event:first-child {
  padding-top: .25rem;
}

.ev-year .event:last-of-type {
  border-bottom: 0;
}


/* --------------------------------------------------------------------------
   1. Toolbar and buttons
   -------------------------------------------------------------------------- */

.disclosure-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin: 0 0 3rem;                    /* then the first section */
}

/* The same buttons repeated at the end of a page (e.g. Committees) */
.disclosure-tools-bottom {
  margin: 1.5rem 0 0;
}

.disclosure-control {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: var(--tap);
  padding: 0 1rem;
  font-family: var(--heading);
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.disclosure-control:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.disclosure-control:disabled {
  opacity: .4;
  cursor: default;
}

.disclosure-control[hidden] {
  display: none;
}

@media (forced-colors: active) {
  .disclosure-control {
    border-color: ButtonText;
  }

  .disclosure-control:disabled {
    color: GrayText;
    border-color: GrayText;
  }
}


/* --------------------------------------------------------------------------
   2. Section header (the clickable row)
   -------------------------------------------------------------------------- */

/* One column for header and content, as on the reference programme, so the
   +/− always sits at the end of its own content (not out at the page edge). */
.disclosure-tools,
.disclosure {
  max-width: var(--content-max);
}

.disclosure {
  border-top: var(--rule);
  scroll-margin-top: 1rem;             /* breathing room when jumped to */
}

.disclosure:last-of-type {
  border-bottom: var(--rule);
}

.disclosure-summary {
  display: grid;
  grid-template-columns: auto 1fr auto 24px;  /* title | meta | top arrow | icon */
  align-items: baseline;
  column-gap: 1rem;
  min-height: var(--tap);
  padding: 2.25rem 0 1.1rem;           /* clear room below the dividing line */
  list-style: none;                    /* hide the browser's own triangle */
  cursor: pointer;
}

.disclosure-summary::-webkit-details-marker {
  display: none;                       /* Safari's triangle */
}

/* Title sits on a coloured label (like "Day 0" on the reference programme) */
.disclosure-title {
  margin: 0;                           /* may be a heading (h2), e.g. on Research */
  padding: .1rem .55rem;
  font-family: var(--heading);
  font-size: var(--label-size);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--highlight);
  border-radius: 2px;
  transition: background-color .15s ease;
}

.disclosure-meta {
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

.disclosure-summary:hover .disclosure-title {
  background: var(--highlight-strong);
}

/* High-contrast mode drops backgrounds; keep the label visible with a border */
@media (forced-colors: active) {
  .disclosure-title {
    border: 1px solid CanvasText;
  }
}

/* Print: no background, a thin outline instead */
@media print {
  .disclosure-title {
    background: none;
    border: 1px solid #000;
  }
}


/* --------------------------------------------------------------------------
   3. Plus / minus icon
   As on the reference programme: a 16px "+" in full ink at the end of the
   row; the vertical bar is removed when the section is open, leaving "−".
   -------------------------------------------------------------------------- */

/* Optional "back to top" arrow, just before the +/− (a link: doesn't toggle the section) */
.disclosure-top {
  grid-column: 3;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  margin: -0.5rem 0;                   /* full touch target without making the row taller */
  font-family: var(--heading);
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 50%;
  transition: background-color .15s ease, color .15s ease;
}

.disclosure-top:hover {
  color: var(--accent);
  background: var(--accent-tint);
}

.disclosure-icon {
  grid-column: 4;                      /* always at the end of the row, with or without a meta */
  position: relative;
  align-self: center;
  justify-self: center;
  width: 16px;
  height: 16px;
  color: var(--ink);
}

.disclosure-icon::before,
.disclosure-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.disclosure-icon::before {             /* horizontal bar */
  top: 7px;
  left: 0;
  width: 16px;
  height: 2px;
}

.disclosure-icon::after {              /* vertical bar */
  top: 0;
  left: 7px;
  width: 2px;
  height: 16px;
}

.disclosure[open] > summary .disclosure-icon::after {
  display: none;
}

.disclosure-summary:hover .disclosure-icon {
  color: var(--accent);
}

@media (forced-colors: active) {
  .disclosure-icon::before,
  .disclosure-icon::after {
    background: CanvasText;
  }
}


/* --------------------------------------------------------------------------
   4. Section body
   -------------------------------------------------------------------------- */

.disclosure-body {
  padding: 0 0 1.5rem;
}

.disclosure-collapse {
  margin-top: 1rem;
}


/* --------------------------------------------------------------------------
   5. Print: all sections are opened by disclosure.js; hide the controls
   -------------------------------------------------------------------------- */

@media print {
  .disclosure-top,
  .section-jumps,
  .disclosure-tools,
  .disclosure-collapse,
  .disclosure-icon {
    display: none !important;
  }

  .disclosure {
    break-inside: auto;
  }
}
