/* Running head, contents drawer, footer (role A3 markup and style; A7 behaviour). PLAN §9. */

/* ---- running head (§9.1) ------------------------------------------------ */
.head {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  right: 0;
  height: var(--head-h);
  background: var(--paper);
  transition: box-shadow var(--d-state) var(--ease-out);
}
.head[data-state="past-hero"],
html.drawer-open .head { box-shadow: inset 0 -1px 0 var(--rule); }
.head__in {
  height: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
.head__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  min-width: 44px;
  flex: none;
  color: var(--ink-soft);
  text-decoration: none;
}
.head__wordmark { display: block; width: auto; height: 26px; }
.head__sub {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--t-label);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}
@media (hover: hover) and (pointer: fine) {
  .head__brand:hover .head__sub { color: var(--forest); }
}

.head__folio { display: none; }
@media (min-width: 1100px) {
  .head__folio {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-3);
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: var(--t-folio);
    line-height: 1.2;
    letter-spacing: 0.02em;
    color: var(--ink-soft);
  }
}
.head__folio-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.head__folio-status:empty { display: none; }
.head__folio-status .status { white-space: nowrap; }
.head__mark {
  flex: none;
  width: 72px;
  height: 20px;
  overflow: visible;
}
.head__mark path {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}

.head__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: none;
}
.head__toc,
.head__lang-btn,
.head__lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--s-2);
  background: none;
  border: 0;
  border-radius: var(--r);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--t-ui);
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--d-hover) var(--ease-out);
}
.head__toc[aria-expanded="true"] { color: var(--forest); }
.head__lang { display: inline-flex; align-items: center; }
.head__lang-btn { min-width: 36px; padding: 0 var(--s-1); color: var(--ink-faint); }
/* The separator is out of flow, so the pressed button's underline (which propagates into flex items) skips it. */
.head__lang-btn { position: relative; }
.head__lang-btn + .head__lang-btn { margin-left: var(--s-3); }
.head__lang-btn + .head__lang-btn::before {
  content: "·";
  position: absolute;
  left: calc(var(--s-3) / -2);
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.head__lang-btn[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--forest); text-underline-offset: 0.3em; }
.head__lang-toggle { display: none; }
@media (hover: hover) and (pointer: fine) {
  .head__toc:hover, .head__lang-btn:hover, .head__lang-toggle:hover { color: var(--forest); }
}
.head__cta-short { display: none; }
.head__cta {
  white-space: nowrap;
  /* the CTA sits left of the contents button and the language switch, so while it is hidden (hero) its empty
     slot is on that side and the switch always ends on the gutter (review r3) */
  order: -1;
  margin-left: 0;
  margin-right: var(--s-2);
  transition: opacity var(--d-state) var(--ease-out), visibility 0s linear 0s;
}
/* the hero shows its own CTA; the head's copy stays out of the way until that one has gone */
.head[data-cta="off"] .head__cta {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--d-state) var(--ease-out), visibility 0s linear var(--d-state);
}

@media (max-width: 860px) {
  .head__in { gap: var(--s-2); }
  .head__lang { display: none; }
  .head__lang-toggle { display: inline-flex; }
  /* the contents control is the same in both languages: icon only, its label kept for assistive tech */
  .head__toc .icon { width: 1.25rem; height: 1.25rem; }
  .head__toc-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .head__cta { margin-right: 0; }
}
@media (max-width: 480px) {
  /* the sub-label stays, set small under the wordmark */
  .head__brand { flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; }
  .head__wordmark { height: 21px; }
  .head__sub { font-size: 0.6875rem; }
}
@media (max-width: 440px) {
  /* narrow phones: the CTA takes its short label and may shrink, so the language toggle always keeps its
     place and the head__in gutter */
  .head__cta-long { display: none; }
  .head__cta-short { display: inline; }
  .head__actions { min-width: 0; }
  .head__cta { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 400px) {
  .head__cta { padding-inline: 0.625rem; font-size: 0.8125rem; }
  .head__actions { gap: 0; }
}
@media (max-width: 359px) {
  .head__cta { padding-inline: 0.5rem; font-size: 0.75rem; }
}

/* ---- contents drawer (§9.1) -------------------------------------------- */
.drawer {
  position: fixed;
  z-index: 49;
  top: var(--head-h);
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--head-h));
  max-height: calc(100svh - var(--head-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.drawer__in {
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding: var(--s-5) var(--gutter) var(--s-7);
}
.drawer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.drawer__label {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--t-folio);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
.drawer__close {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  min-width: 44px;
  padding: 0 var(--s-2);
  background: none;
  border: 0;
  border-radius: var(--r);
  font: 500 var(--t-ui)/1 var(--font-ui);
  color: var(--ink);
  cursor: pointer;
}
.drawer__list {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: var(--col-gap);
}
@media (min-width: 861px) {
  .drawer__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .drawer__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.drawer__link {
  display: block;
  padding: var(--s-3) 0 var(--s-4);
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
}
.drawer__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.375rem;
  line-height: 1.2;
  letter-spacing: -0.012em;
}
.drawer__dek {
  display: block;
  margin-top: var(--s-1);
  font-size: var(--t-note);
  line-height: 1.45;
  color: var(--ink-soft);
}
.drawer__link[aria-current="true"] .drawer__title { color: var(--forest); }
@media (hover: hover) and (pointer: fine) {
  .drawer__link:hover .drawer__title { color: var(--forest); }
  .drawer__close:hover { color: var(--forest); }
}
.drawer__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-6);
  margin-top: var(--s-6);
}
.drawer__direct {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  font-size: var(--t-note);
}
.drawer__direct a { display: inline-flex; align-items: center; min-height: 44px; }

@media (max-width: 860px) {
  .drawer {
    bottom: 0;
    max-height: none;
    border-bottom: 0;
    box-shadow: var(--e1);
  }
  html.drawer-open, html.drawer-open body { overflow: hidden; }
}

/* ---- footer (§9.3) ----------------------------------------------------- */
.foot {
  background: var(--ink-ground);
  color: var(--paper);
  padding: var(--s-9) 0 var(--s-7);
}
.foot__cols {
  display: grid;
  /* two columns from the smallest phone up (review r2: the footer ran 1.6 screens on a phone) */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-6) var(--col-gap);
}
@media (min-width: 560px) {
  .foot__cols { gap: var(--s-7) var(--col-gap); }
}
@media (min-width: 1100px) {
  .foot__cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.foot__h {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--t-label);
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--paper-on-dark-soft);
  margin-bottom: var(--s-3);
}
.foot__list { list-style: none; }
.foot__list a,
.foot__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration-color: transparent;
}
@media (min-width: 861px) {
  .foot__list a { min-height: 36px; }
}
@media (hover: hover) and (pointer: fine) {
  .foot__list a:hover, .foot__links a:hover { text-decoration-color: var(--forest-on-dark); color: var(--paper); }
}
.foot__list a:focus-visible, .foot__links a:focus-visible { text-decoration-color: var(--forest-on-dark); }
.foot__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-6);
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule-on-dark);
  font-size: var(--t-note);
}
.foot__copy { color: var(--paper-on-dark-soft); }
.foot__links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s-5);
}
.foot__test {
  margin-left: auto;
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--forest-on-dark);
  border-radius: var(--r);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--t-label);
  line-height: 1.3;
  color: var(--forest-on-dark);
}
