/* Archivo Expanded is the wdth=125 axis of the Archivo variable font, not a
   separate Google Fonts family. styles.css requests family=Archivo+Expanded,
   which returns HTTP 400 alone and is silently dropped in a multi-family
   request, so --exp falls back to regular-width Archivo site-wide. These pages
   load the correct variable axis and opt display elements into it explicitly.
   The same fix belongs in styles.css + every page head. */
/* ============================================================
   downloads.css - Resources hub, document viewer, download modal
   Extends styles.css; overrides nothing in it.
   Every colour, font and easing token comes from styles.css :root.
   Radius: 8px cards/modals, 6px controls, 2px small chips.
   ============================================================ */

/* [hidden] MUST win. Any `display` on a class selector beats the UA sheet's
   `[hidden]{display:none}`, so `.dl-done{display:flex}` silently defeated the
   hidden attribute and the confirmation panel rendered underneath the live
   form. Everything that toggles via .hidden depends on this rule. */
[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------
   0. SKIP LINK
   Defined in hero.css / story.css, neither of which these pages
   load. Same rule, verbatim, so the behaviour is identical.
   ------------------------------------------------------------ */

.skip-link {
  position: absolute;
  left: -100%;
  top: 0;
  z-index: 10000;
  padding: .75rem 1.5rem;
  background: var(--teal);
  color: var(--deep);
  font-weight: 700;
  font-family: var(--mono);
  font-size: .85rem;
  letter-spacing: .05em;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

/* ------------------------------------------------------------
   0b. .btn ON A <button>
   styles.css only ever styles .btn on an <a>, so it never needed a
   font-family. These pages use real <button> elements (they open a
   modal, they do not navigate), and buttons do not inherit font or
   line-height. This makes the two render identically.
   ------------------------------------------------------------ */

button.btn {
  font: inherit;
  font-weight: 600;
  font-size: .98rem;
  line-height: 1.65;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* ------------------------------------------------------------
   1. RESOURCES HUB
   ------------------------------------------------------------ */

/* Featured (lead) resource. Not an anchor: it carries two distinct
   actions, so the title link and the buttons stay separately
   operable by keyboard. */
.res-featured {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: clamp(1.6rem, 4vw, 3.4rem);
  /* Featured status comes from the surface step, the elevation and the
     "Latest" kicker. No teal edge here: the eyebrow above and the primary
     CTA inside are already the two teal instances this screen is allowed. */
  border: 1px solid var(--rule-d);
  border-left: 3px solid var(--snow-soft);
  border-radius: 8px;
  background: var(--deep-2);
  padding: clamp(1.7rem, 3.5vw, 2.8rem) clamp(1.4rem, 3vw, 2.4rem);
  margin-top: clamp(2rem, 4vw, 3rem);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .32);
  transition: background .3s var(--e-out), border-color .3s;
}

.res-featured:hover {
  background: var(--deep-3);
}

.res-featured-side {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  padding-top: .15rem;
}

.res-kind {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--teal);
  line-height: 1;
}

.res-side-meta {
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.9;
  color: var(--snow-soft);
  font-variant-numeric: tabular-nums;
  margin-top: auto;
  display: flex;
  flex-direction: column;
}

.res-side-meta span {
  display: block;
}

.res-featured-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.res-kicker {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--snow-soft);
  display: flex;
  align-items: center;
  gap: .6em;
}

.res-kicker::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--snow-soft);
  flex: none;
}

.res-featured-title {
  font-family: var(--exp);
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(1.55rem, 1rem + 2.1vw, 2.3rem);
  letter-spacing: -.025em;
  line-height: 1.08;
  color: var(--snow);
  margin: 0;
}

.res-featured-title a {
  color: inherit;
  transition: color .2s;
}

.res-featured-title a:hover {
  color: var(--teal);
}

.res-featured-standfirst {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--snow-soft);
  margin: 0;
}

.res-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: .5rem;
}

/* The card grid future resources drop into. */
.res-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 2vw, 1.4rem);
  margin-top: clamp(1.2rem, 3vw, 2rem);
}

.res-card {
  background: var(--deep-2);
  border: 1px solid var(--rule-d);
  border-radius: 8px;
  padding: clamp(1.5rem, 3vw, 2.1rem);
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-width: 0;
  transition: background .3s var(--e-out), border-color .3s;
}

.res-card:hover {
  background: var(--deep-3);
  border-color: rgba(0, 184, 148, .3);
}

.res-card-title {
  font-family: var(--exp);
  font-stretch: 125%;
  font-weight: 700;
  font-size: clamp(1.05rem, 1rem + .6vw, 1.3rem);
  letter-spacing: -.015em;
  line-height: 1.15;
  color: var(--snow);
  margin: 0;
}

.res-card-standfirst {
  font-size: .95rem;
  line-height: 1.6;
  color: var(--snow-soft);
  margin: 0;
}

.res-card-meta {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--snow-soft);
  font-variant-numeric: tabular-nums;
  margin-top: auto;
  padding-top: .85rem;
  border-top: 1px solid var(--rule-d);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem 1rem;
}

.res-card-meta .sep {
  opacity: .4;
}

/* Restrained "more in preparation" panel. Deliberately not a card:
   it must never read as a resource that exists. */
/* Spans the grid so it reads as a note about the section, never as an
   empty card slot. It stays a note when real cards appear beside it. */
.res-soon {
  grid-column: 1 / -1;
  border: 1px dashed var(--rule-d);
  border-radius: 8px;
  padding: clamp(1.2rem, 2.6vw, 1.7rem) clamp(1.4rem, 3vw, 2.1rem);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 1.6rem;
}

.res-soon-k {
  flex: none;
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--snow-soft);
}

.res-soon p {
  flex: 1 1 22rem;
  font-size: .95rem;
  line-height: 1.6;
  color: var(--snow-soft);
  margin: 0;
}

/* ------------------------------------------------------------
   2. DOCUMENT VIEWER
   ------------------------------------------------------------ */

.doc-back {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  margin-bottom: 1.5rem;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--snow-soft);
  transition: color .2s;
}

.doc-back:hover {
  color: var(--teal);
}

.doc-back .arw {
  transition: transform .2s var(--e-out);
}

.doc-back:hover .arw {
  transform: translateX(-3px);
}

.doc-head-sub {
  font-size: clamp(1.05rem, 1rem + .45vw, 1.24rem);
  line-height: 1.6;
  color: var(--snow-soft);
  margin: 0 0 1.6rem;
}

.doc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.8rem;
}

.doc-chip {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--snow-soft);
  border: 1px solid var(--rule-d);
  border-radius: 2px;
  padding: .45em .75em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.doc-chip b {
  color: var(--snow);
  font-weight: 600;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .8rem;
}

/* --- the embedded document --- */
.doc-frame-sec {
  padding: clamp(2rem, 4vw, 3.2rem) 0 clamp(3rem, 6vw, 5rem);
}

.doc-frame-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding-bottom: .9rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule-d);
}

.doc-frame-lbl {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--snow-soft);
}

.doc-expand {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--snow-soft);
  border: 1px solid var(--rule-d);
  border-radius: 6px;
  padding: .55em .9em;
  line-height: 1;
  transition: color .2s, border-color .25s, background .25s;
}

.doc-expand:hover {
  color: var(--snow);
  border-color: rgba(0, 184, 148, .38);
  background: rgba(0, 184, 148, .06);
}

.doc-frame-wrap {
  position: relative;
  border: 1px solid var(--rule-d);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .32);
  min-height: 60vh;
}

.doc-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 60vh;
  border: 0;
  background: var(--paper);
}

/* Fallback when the document height cannot be measured (a
   cross-origin or blocked frame): give the frame its own scroll
   so the document is still fully readable. */
.doc-frame-wrap.is-scroll .doc-frame {
  height: 78vh;
  min-height: 460px;
}

/* --- sticky download bar --- */
.doc-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(10, 18, 26, .88);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--rule-d);
  transform: translateY(110%);
  opacity: 0;
  visibility: hidden;
  transition: transform .4s var(--e-out), opacity .3s var(--e-out), visibility .3s;
}

.doc-sticky.is-on {
  transform: none;
  opacity: 1;
  visibility: visible;
}

.doc-sticky-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 0;
}

.doc-sticky-t {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.doc-sticky-t .k {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--snow-soft);
}

.doc-sticky-t .t {
  font-family: var(--exp);
  font-stretch: 125%;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.015em;
  color: var(--snow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-sticky .btn {
  flex: none;
  padding: .68em 1.15em;
  font-size: .9rem;
}

/* ------------------------------------------------------------
   3. DOWNLOAD MODAL
   Reuses .modal / .scrim / .card / .top / .mbody / .close from
   styles.css. Card is the light document context, so inline teal
   drops to --teal-deep for AA.
   ------------------------------------------------------------ */

/* Card is a flex column: the header stays put and only the body
   scrolls, so the close button never scrolls out of reach. */
.modal-dl .card {
  width: min(560px, 100%);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  --ac: var(--teal);
}

.modal-dl .top {
  flex: none;
  padding-right: 4rem;
}

.modal-dl .mbody {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-dl .dl-title {
  font-family: var(--exp);
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(1.28rem, 1rem + 1vw, 1.6rem);
  letter-spacing: -.02em;
  line-height: 1.12;
  color: var(--ink);
  margin-top: .3rem;
}

.modal-dl .dl-sub {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .06em;
  color: var(--ink-soft);
  margin-top: .55rem;
  font-variant-numeric: tabular-nums;
}

.dl-fs {
  border: 0;
  margin: 0 0 1.5rem;
  padding: 0;
}

.dl-legend {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: .75rem;
  display: block;
}

.dl-formats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
}

.dl-fmt {
  position: relative;
  display: flex;
  cursor: pointer;
}

.dl-fmt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.dl-fmt-in {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  border: 1px solid var(--rule-l);
  border-radius: 6px;
  background: var(--paper);
  padding: .85rem .9rem;
  transition: border-color .22s, background .22s, box-shadow .22s;
  height: 100%;
}

.dl-fmt-k {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .45em;
}

/* tick box drawn in CSS, no icon font, no emoji */
.dl-fmt-k::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: none;
  border: 1px solid var(--ink-soft);
  border-radius: 2px;
  background: transparent;
  transition: background .18s, border-color .18s;
}

.dl-fmt-d {
  font-size: .76rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.dl-fmt input:checked + .dl-fmt-in {
  border-color: var(--teal-deep);
  background: rgba(0, 184, 148, .07);
}

.dl-fmt input:checked + .dl-fmt-in .dl-fmt-k::before {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  box-shadow: inset 0 0 0 2px var(--paper);
}

.dl-fmt input:focus-visible + .dl-fmt-in {
  outline: 2px solid var(--teal-deep);
  outline-offset: 2px;
}

.dl-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
  margin-bottom: 1.3rem;
}

.dl-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  min-width: 0;
}

.dl-field.dl-full {
  grid-column: 1 / -1;
}

.dl-field > span {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: .6em;
}

.dl-opt {
  letter-spacing: .06em;
  text-transform: none;
  opacity: .7;
  font-size: .68rem;
}

.dl-field input[type="text"],
.dl-field input[type="email"] {
  font-family: var(--sans);
  font-size: .96rem;
  color: var(--ink);
  background: var(--cloud);
  border: 1px solid var(--rule-l);
  border-radius: 6px;
  padding: .7em .8em;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
}

.dl-field input:focus {
  outline: none;
  border-color: var(--teal-deep);
  box-shadow: 0 0 0 3px rgba(0, 184, 148, .14);
}

.dl-field input[aria-invalid="true"] {
  border-color: var(--crit);
}

.dl-err {
  display: block;
  font-family: var(--mono);
  font-size: .7rem;
  line-height: 1.5;
  letter-spacing: .04em;
  color: var(--crit);
  margin-top: .35rem;
}

.dl-err[hidden] {
  display: none;
}

/* --- mailer opt-in. Unticked by default, always. --- */
.dl-optin {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  cursor: pointer;
  padding: .9rem 1rem;
  border: 1px solid var(--rule-l);
  border-radius: 6px;
  background: var(--paper);
  transition: border-color .22s, background .22s;
}

.dl-optin:hover {
  border-color: rgba(0, 134, 106, .35);
}

.dl-optin input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.dl-optin-box {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: .15rem;
  border: 1px solid var(--ink-soft);
  border-radius: 2px;
  transition: background .18s, border-color .18s;
}

.dl-optin input:checked ~ .dl-optin-box {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  box-shadow: inset 0 0 0 2px var(--paper);
}

.dl-optin input:focus-visible ~ .dl-optin-box {
  outline: 2px solid var(--teal-deep);
  outline-offset: 2px;
}

.dl-optin-t {
  font-size: .94rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.dl-fine {
  font-size: .82rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: .6rem 0 1.4rem;
}

/* honeypot: off-screen, unreachable by keyboard, invisible to AT */
.dl-hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.dl-submit {
  width: 100%;
  justify-content: center;
}

.dl-submit[disabled] {
  opacity: .6;
  cursor: progress;
  transform: none;
  box-shadow: none;
}

.dl-foot {
  font-size: .8rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-top: 1rem;
}

/* --- confirmation state --- */
.dl-done {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.dl-done-h {
  font-family: var(--exp);
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.55rem);
  letter-spacing: -.02em;
  line-height: 1.12;
  color: var(--ink);
  margin: 0;
}

.dl-done-h:focus {
  outline: none;
}

.dl-done-p {
  font-size: .98rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}

.dl-files {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rule-l);
  border: 1px solid var(--rule-l);
  border-radius: 6px;
  overflow: hidden;
}

.dl-file {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--paper);
  padding: .9rem 1rem;
  transition: background .2s;
}

.dl-file:hover {
  background: var(--cloud);
}

.dl-file-k {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal-deep);
  flex: none;
  width: 4.2rem;
}

.dl-file-t {
  font-size: .92rem;
  color: var(--ink);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dl-file-a {
  margin-left: auto;
  flex: none;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.dl-file:hover .dl-file-a {
  color: var(--teal-deep);
}

.dl-book {
  border-top: 1px solid var(--rule-l);
  padding-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-items: flex-start;
}

.dl-book-t {
  font-size: .98rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

/* quiet notice when the capture endpoint is unreachable */
.dl-notice {
  font-family: var(--mono);
  font-size: .74rem;
  line-height: 1.6;
  letter-spacing: .02em;
  color: var(--ink-soft);
  border-left: 2px solid var(--warn);
  padding: .1rem 0 .1rem .8rem;
  margin: 0;
}

.dl-notice a {
  color: var(--teal-deep);
  font-weight: 600;
}

/* ------------------------------------------------------------
   4. RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 900px) {
  .res-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .res-featured {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  .res-featured-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem 1.2rem;
  }

  .res-side-meta {
    margin-top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .2rem 1rem;
  }

  .res-featured-title {
    font-size: 1.45rem;
  }

  .doc-frame-wrap {
    min-height: 50vh;
  }

  .doc-frame {
    min-height: 50vh;
  }

  .doc-frame-wrap.is-scroll .doc-frame {
    height: 70vh;
  }
}

@media (max-width: 620px) {
  .dl-formats {
    grid-template-columns: 1fr;
  }

  .dl-fmt-in {
    flex-direction: row;
    align-items: baseline;
    gap: .8rem;
  }

  .dl-rows {
    grid-template-columns: 1fr;
  }

  .doc-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .doc-actions .btn {
    justify-content: center;
  }

  .doc-sticky-t .k {
    display: none;
  }

  .doc-sticky-in {
    padding: .65rem 0;
  }

  .doc-sticky .btn {
    font-size: .84rem;
    padding: .62em .95em;
  }

  .dl-file {
    flex-wrap: wrap;
    gap: .35rem .8rem;
  }

  .dl-file-k {
    width: auto;
  }

  .dl-file-a {
    width: 100%;
    margin-left: 0;
  }
}

/* ------------------------------------------------------------
   5. REDUCED MOTION
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .res-featured,
  .res-card,
  .doc-expand,
  .doc-back .arw,
  .dl-fmt-in,
  .dl-optin,
  .dl-field input,
  .dl-file {
    transition: none;
  }

  .doc-sticky {
    transition: opacity .01s linear, visibility .01s linear;
    transform: none;
  }

  .doc-sticky:not(.is-on) {
    transform: translateY(110%);
  }
}
