/*
  Principle component. Native <details name="…"> accordion: mutually
  exclusive, no JS. Summary is the clickable row; ::details-content is the
  expanded panel. Modern CSS animates the open/close.
*/

.principle {
  color: inherit;
  /* Scoped opt-in to transitioning height from/to keyword values (auto).
     Without this, block-size can't animate between 0 and auto on open/close. */
  interpolate-size: allow-keywords;
}

.principle > details {
  border-block-end: 1px solid rgba(244, 236, 220, 0.12);
}
.principles > li:last-child .principle > details {
  border-block-end: 0;
}

/* --- Summary row ------------------------------------------------------ */

.principle summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: var(--space-md);
  line-height: 1.4;
  cursor: pointer;
  list-style: none;              /* hide default disclosure triangle */
}
.principle summary::-webkit-details-marker { display: none; } /* Safari */

.principle summary:hover,
.principle summary:focus-visible { color: var(--brand); }

/* Title inside the summary. Variable-font Merriweather lets font-weight
   interpolate smoothly between the closed (400) and open (700) states. */
.principle summary h2 {
  flex: 1;
  margin: 0;
  font: inherit;
  font-family: var(--font-serif);
  font-size: clamp(.95rem, .3vw + .9rem, 1.1rem);
  font-weight: 400;
  color: inherit;
  transition: margin-top .5s ease-in, font-size .25s ease, font-weight 5s 1s ease;
  text-wrap: balance;
}
.principle details[open] summary h2 {
  font-size: clamp(1.4rem, .6vw + 1.3rem, 1.95rem);
  font-weight: 700;
  margin-top:2rem;
}

/* Counter numeral: large-but-faint when closed, bigger and more present when
   open. Driven by the list counter on <li>. */
.principles > li { counter-increment: principle; }
.principles > li .principle summary::before {
  content: counter(principle);
  flex-shrink: 0;
  min-inline-size: 1.75rem;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 1;
  color: color-mix(in oklch, var(--ink-inverse) 25%, transparent);
  transition: font-size .35s ease, font-weight .35s ease, color .35s ease;
}
.principles > li .principle details[open] summary::before {
  font-size: 2.6rem;
  font-weight: 700;
  color: color-mix(in oklch, var(--ink-inverse) 55%, transparent);
}

/* Disclosure glyph: + when closed, − when open. */
.principle summary::after {
  content: "+";
  flex-shrink: 0;
  inline-size: 1.25rem;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1;
  color: color-mix(in oklch, var(--ink-inverse) 35%, transparent);
  transition: transform .35s ease;
}
.principle details[open] summary::after {
  content: "−";
}

/* --- Expanded body: animated height + fade ---------------------------- */

/* ::details-content is the implicit wrapper around everything after the
   <summary>. Available in Chrome 131+, Safari 18.2+, Firefox 141+. */
.principle ::details-content {
  block-size: 0;
  overflow: clip;
  opacity: 0;
  transition:
    block-size .35s ease,
    opacity .25s ease,
    content-visibility .35s allow-discrete;
}
.principle details[open]::details-content {
  block-size: auto;
  opacity: 1;
}

/* Body: indented under the title, past the number. */
.principle .body {
  padding-inline-start: calc(1.75rem + 1rem); /* number width + gap */
  padding-inline-end: 1.25rem;                /* mirror the disclosure glyph */
  padding-block: 0 var(--space-lg);
  font-size: 1rem;
  line-height: 1.65;
  color: color-mix(in oklch, var(--ink-inverse) 90%, transparent);
  max-inline-size: 60ch;
}
.principle .body p { margin: 0; }

/* Respect reduced-motion: snap open/close instantly. */
@media (prefers-reduced-motion: reduce) {
  .principle summary h2,
  .principle summary::before,
  .principle ::details-content {
    transition: none;
  }
}
