/* Shared styles for iaste-us.org: design tokens first, then the page frame,
   then one block per component. The style guide at /styleguide.html shows
   every token and component in use. */

/* ---- Design tokens ----
   Every colour, typeface, type size and page measure is named once here and
   used by name everywhere below. Change a value here and it changes site-wide. */
:root {
  /* Colour */
  --color-plate: #bcbec0;        /* the grey the whole page sits on; the logo artwork's plate colour */
  --color-paper: #f5f6f6;        /* the near-white sheet content is set on */
  --color-ink: #1a1a1a;          /* body text */
  --color-ink-muted: #4a4a4a;    /* secondary text: dates, affiliations, small print */
  --color-accent: #8a3324;       /* brand rust: titles, headings and links on paper */
  --color-accent-deep: #7a2c20;  /* darker rust for use on the grey plate, where the brand rust misses WCAG AA */
  --color-accent-wash: rgba(122,44,32,0.07);
  --color-white: #fff;
  --color-black: #000;
  --color-rule: rgba(0,0,0,0.12);        /* hairlines on paper */
  --color-rule-strong: rgba(0,0,0,0.22); /* hairlines on the plate */
  --color-rule-hover: rgba(0,0,0,0.35);
  --color-press: rgba(0,0,0,0.06);

  /* Typefaces */
  --font-serif: "ff-scala", Georgia, 'Times New Roman', serif;
  --font-sans: "univers-next-pro", Helvetica, Arial, sans-serif;
  --font-sans-condensed: "univers-next-pro-condensed", "univers-next-pro", Helvetica, Arial, sans-serif;

  /* Type sizes, smallest to largest. Eight steps; use the nearest one rather
     than adding a size. The two menu-driven sizes are the exceptions noted. */
  --text-claim-narrow: 0.66rem;  /* provenance line on narrow screens only: sized so it breaks into few rows */
  --text-small: 0.75rem;         /* 12px: section headings, captions, footer, note lines */
  --text-nav: 0.85rem;           /* 13.6px: menu items. Not merged into meta: at 14px the menu wraps on tablets */
  --text-meta: 0.875rem;         /* 14px: organisation line, dates, salutation */
  --text-base: 1rem;             /* 16px: lists, small print, the update heading; body text on narrow screens */
  --text-body: 1.125rem;         /* 18px: body text and the lede */
  --text-menu: 1.25rem;          /* 20px: the Menu button on narrow screens */
  --text-title: 1.40rem;         /* 22.4px: page titles */

  /* Page measures */
  --measure-masthead: 1024px;
  --measure-page: 1072px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-serif);
  /* The logo artwork's original plate colour, now carried across the whole page. */
  background: var(--color-plate);
  color: var(--color-ink);
  line-height: 1.6;
}

/* ---- Masthead ---- */
header {
  padding: 40px 24px 0;
  overflow-x: hidden;
}
.masthead {
  max-width: var(--measure-masthead);
  margin: 0 auto;
}
.logo {
  display: block;
  width: 100%;
  height: auto;
}
/* A second site's masthead (iastbe.org): the logo's drawing, with the
   association's name set as text beside it in the logo's typeface. The column
   matches the drawing's share of the full logo, so the line under it keeps
   the same inset. Sizes follow the masthead's width, like the logo artwork. */
.masthead { container-type: inline-size; }
.wordmark {
  display: grid;
  grid-template-columns: 17.17% 1fr;
  column-gap: 2.947%;
  align-items: center;
}
.wordmark-mark { display: block; width: 100%; height: auto; }
.wordmark-name {
  margin: 0;
  font-family: var(--font-sans-condensed);
  font-weight: 400;
  font-size: 5.6cqi;
  line-height: 1.02;
  text-transform: uppercase;
  color: var(--color-white);
  text-wrap: balance;
}

/* Provenance line under the wordmark. The inset is where the wordmark's
   lettering starts inside the logo artwork, measured off the file; as a
   percentage it holds that alignment at every width the logo scales to. The
   line is tracked out to fill the wordmark's measure by nav.js. */
.claim-line {
  margin: 20px 0 0 20.117%;
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 400;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--color-white);
}
/* Standing tracking for when the fitter cannot run; it sets exact per-line
   values and breaks the line itself. */
.claim-line span {
  letter-spacing: 0.16em;
}

/* Breaks out of the centered column so the rule bleeds to the page edge on the left
   while still stopping at the wordmark's right edge. */
.masthead-rule {
  height: 4px;
  background: var(--color-black);
  margin-top: 14px;
  margin-left: calc(50% - 50vw);
  width: calc(50vw + 50%);
}

/* ---- Navigation ---- */
.site-nav {
  max-width: var(--measure-masthead);
  margin: 0 auto;
  padding: 16px 0 0;
  font-family: var(--font-sans);
  font-size: var(--text-nav);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
/* Padded well beyond the text so the target is comfortably clickable rather
   than a hairline of type. */
.site-nav a {
  color: var(--color-ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding: 5px 0 7px;
  margin-right: 30px;
  display: inline-block;
  margin-bottom: 8px;
}
.site-nav a:hover { border-bottom-color: var(--color-rule-hover); }
.site-nav a:focus-visible {
  outline: 2px solid var(--color-accent-deep);
  outline-offset: 3px;
}
/* The nav is the only place the accent sits on the grey plate rather than on the
   near-white paper of a statement box. The brand var(--color-accent) only reaches 4.37:1 on
   this grey, so the nav uses a darker step of the same red for WCAG AA. */
.site-nav a[aria-current="page"] {
  color: var(--color-accent-deep);
  border-bottom-color: var(--color-accent-deep);
}

/* Toggle row for the mobile drawer. Hidden on desktop, where .site-nav
   itself is already the single-line bar. */
.nav-bar { display: none; }
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  padding: 20px 0 16px;
  margin: 0;
  font-family: var(--font-sans-condensed);
  font-size: var(--text-menu);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  color: var(--color-ink);
  cursor: pointer;
}
.nav-toggle:focus-visible {
  outline: 2px solid var(--color-accent-deep);
  outline-offset: 3px;
}
.nav-toggle-icon { flex: 0 0 auto; width: 20px; height: 20px; }
.nav-toggle-icon .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

main {
  max-width: var(--measure-page);
  margin: 0 auto;
  padding: 48px 24px 80px;
  font-family: var(--font-serif);
}

/* ---- The white paper block every page is set on ---- */
.sheet {
  border: 1px solid var(--color-rule);
  background: var(--color-paper);
  padding: 52px 66px 56px;
  border-radius: 6px;
  margin-bottom: 32px;
}
.sheet:last-child { margin-bottom: 0; }

/* ---- Letterhead ---- */
.org-line {
  font-family: var(--font-sans);
  font-size: var(--text-meta);
  line-height: 1.45;
  margin: 0 0 18px;
  color: var(--color-ink-muted);
}
.title {
  font-family: var(--font-sans);
  font-size: var(--text-title);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 24px;
}
.dateline {
  font-family: var(--font-sans);
  font-size: var(--text-meta);
  margin: 0 0 26px;
  color: var(--color-ink-muted);
}
.salutation {
  font-family: var(--font-sans);
  font-size: var(--text-meta);
  letter-spacing: 0.03em;
  margin: 0 0 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-rule);
  color: var(--color-ink-muted);
}

/* When a page has no visible title, the organisation line carries the rule
   that separates the letterhead from what follows. */
.org-line--ruled {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-rule);
}

/* ---- Prose ---- */
.prose p {
  text-align: justify;
  margin: 0 0 1.15em;
  font-size: var(--text-body);
  line-height: 1.68;
}
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 700; }
.prose a {
  color: var(--color-accent);
  /* break-all, not overflow-wrap: the overflow-wrap values only break a URL
     that can't fit a line of its own, so the URL still dropped whole and left
     a hole in the justified line above. break-all breaks it unconditionally. */
  word-break: break-all;
}

/* Inside running text: a subheading and lists. */
.prose h3 {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.4;
  margin: 1.6em 0 0.5em;
}
.prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol {
  margin: 0 0 1.15em;
  padding-left: 1.4em;
  font-size: var(--text-body);
  line-height: 1.68;
}
.prose li { margin-bottom: 0.35em; }
.prose > :last-child { margin-bottom: 0; }

/* ---- Text overrides ----
   Exceptions to the standard styles, applied one block at a time. Only a
   super admin is offered these in the editor. */
.t-left { text-align: left !important; }
.t-center { text-align: center !important; }
.t-right { text-align: right !important; }
.t-justify { text-align: justify !important; }
.t-small { font-size: var(--text-meta) !important; }
.t-large { font-size: var(--text-menu) !important; }
.t-muted { color: var(--color-ink-muted) !important; }
.t-accent { color: var(--color-accent) !important; }

/* ---- Signatories ---- */
.signatories {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--color-rule);
}
.signatories h2 {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin: 0 0 18px;
}
.signatories ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.signatories li {
  margin-bottom: 9px;
  font-size: var(--text-base);
  line-height: 1.5;
}
.signatories li span {
  font-style: italic;
  color: var(--color-ink-muted);
}
.note-line {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 700;
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--color-rule);
  color: var(--color-ink-muted);
}

/* ---- Dated update appended below the statement ---- */
.sheet--update { border-top: 4px solid var(--color-accent); }
.update-heading {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin: 0 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-rule);
}
/* Set exactly like .dateline on the statement above, so both dates match. */
.update-heading .update-date {
  display: block;
  margin-top: 10px;
  font-size: var(--text-meta);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-ink-muted);
}

/* ---- People lists (board, TDSR) ---- */
/* Small caps for the source documents' "u.s.a." / "u.k." country abbreviations. */
.sc { font-variant: small-caps; text-transform: lowercase; }

.people-section { margin-bottom: 44px; }
.people-section:last-child { margin-bottom: 0; }
/* Section heading: shared by people lists and the standalone Heading block. */
.people-section > h2,
.section-heading {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-accent);
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-rule);
}
/* A people list that follows text or a photo needs the same air as a heading would. */
.prose + .people-section, .figure + .people-section, .media + .people-section { margin-top: 40px; }

/* A heading placed part-way down a sheet needs air above it. */
.sheet > .section-heading:not(:first-child) { margin-top: 40px; }

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px 40px;
}
/* One entry per row, name and affiliation on the same line. */
.people.people--inline {
  grid-template-columns: 1fr;
  gap: 10px;
}
.people li {
  font-size: var(--text-base);
  line-height: 1.45;
  break-inside: avoid;
}
.people .name {
  display: block;
  font-weight: 700;
}
.people.people--inline .name { display: inline; }
.people .affil {
  color: var(--color-ink-muted);
}
.people .role {
  display: block;
  margin-top: 4px;
  font-style: italic;
  color: var(--color-ink-muted);
}

/* ---- Lede: a standfirst set above the lists that follow it ---- */
.lede {
  text-align: justify;
  font-size: var(--text-body);
  line-height: 1.65;
  margin: 0 0 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--color-rule);
}

/* ---- Colophon: the small print that closes a page ---- */
.colophon {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--color-rule);
}
.colophon p {
  text-align: justify;
  font-size: var(--text-base);
  line-height: 1.6;
  margin: 0 0 1.1em;
  color: var(--color-ink-muted);
}
.colophon p:last-child { margin-bottom: 0; }
.colophon .issn {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  text-align: left;
}

/* ---- Photo: a single image with an optional caption ---- */
.figure { margin: 36px 0; }
.figure:first-child { margin-top: 0; }
.figure:last-child { margin-bottom: 0; }
.figure img {
  display: block;
  width: 100%;
  height: auto;
}
.figure figcaption {
  margin-top: 10px;
  font-family: var(--font-sans);
  font-size: var(--text-small);
  line-height: 1.5;
  color: var(--color-ink-muted);
}

/* ---- Photo and text: an image beside a passage of prose ---- */
.media {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 36px;
  align-items: start;
  margin: 36px 0;
}
.media:first-child { margin-top: 0; }
.media:last-child { margin-bottom: 0; }
.media .figure { margin: 0; }
.media--flip { grid-template-columns: 3fr 2fr; }
.media--flip .figure { order: 2; }

/* ---- Feature: a prominent announcement with a wide photo and buttons ----
   As the first block of a sheet, the photo runs to the sheet's edges and the
   sheet takes an accent rule on top, so it stands out from the sheets below. */
.feature { margin: 36px 0; }
.feature:first-child { margin-top: 0; }
.feature:last-child { margin-bottom: 0; }
.sheet:has(> .feature:first-child) { overflow: hidden; border-top: 4px solid var(--color-accent); }
.sheet > .feature:first-child { margin: -52px -66px 40px; }
.sheet > .feature:first-child:last-child { margin-bottom: -56px; }
.feature .figure { margin: 0; }
.feature .figure img { aspect-ratio: 3 / 1; object-fit: cover; }
.feature .figure figcaption { margin: 0; padding: 10px 66px 0; }
.feature-body {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 40px;
  align-items: end;
  padding: 26px 66px 44px;
}
.feature-label {
  grid-column: 1 / -1;
  margin: 0 0 10px;
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.feature-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-title);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-ink);
}
.feature-when { margin: 10px 0 0; font-family: var(--font-sans); font-size: var(--text-base); color: var(--color-ink); }
.feature-date { font-weight: 700; color: var(--color-accent); }
.feature-place::before { content: "\00b7"; margin: 0 0.5em; color: var(--color-ink-muted); }
.feature-text {
  margin: 14px 0 0;
  max-width: 36em;
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--color-ink-muted);
}
.feature-actions {
  grid-column: 2;
  grid-row: 2 / span 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.button {
  display: inline-block;
  padding: 12px 22px;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  background: var(--color-accent);
  color: var(--color-white);
  font-family: var(--font-sans);
  font-size: var(--text-meta);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover { background: var(--color-accent-deep); border-color: var(--color-accent-deep); }
.button--quiet { background: transparent; color: var(--color-accent); }
.button--quiet:hover { background: var(--color-accent-wash); color: var(--color-accent-deep); }
.button:focus-visible { outline: 2px solid var(--color-accent-deep); outline-offset: 2px; }

/* ---- Kicker: the section a page belongs to, above its title ----
   The short name links to the section's first page; the full name follows. */
.kicker {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.kicker a { color: var(--color-accent); text-decoration: none; }
.kicker a:hover { text-decoration: underline; text-underline-offset: 3px; }
.kicker a:focus-visible { outline: 2px solid var(--color-accent-deep); outline-offset: 2px; }
.kicker span { color: var(--color-ink-muted); font-weight: 400; letter-spacing: 0.08em; }
.kicker span::before { content: "\00b7\00a0"; }

/* ---- Sub-menu: the pages of one section, such as TDSR, as a row of tabs ----
   Sits under the title, with the section named in a kicker above the title.
   On narrow screens the row scrolls sideways. */
.subnav {
  margin: 0 0 32px;
  border-bottom: 1px solid var(--color-rule);
  font-family: var(--font-sans);
}
.subnav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.subnav li a {
  display: block;
  padding: 10px 0 12px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: var(--text-meta);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  color: var(--color-ink-muted);
}
.subnav li a:hover { color: var(--color-ink); border-bottom-color: var(--color-rule-hover); }
.subnav li a.is-current { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.subnav li a:focus-visible { outline: 2px solid var(--color-accent-deep); outline-offset: 2px; }

/* ---- Issues: a list of journal issues, each with its cover beside its contents ---- */
.issues { margin: 36px 0; }
.issues:first-child { margin-top: 0; }
.issues:last-child { margin-bottom: 0; }
.issue {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 28px;
  align-items: start;
  padding: 28px 0;
  border-top: 1px solid var(--color-rule);
}
.issue:first-child { border-top: 0; padding-top: 0; }
/* Link text here is article titles, not URLs: break between words only. */
.issue-body a { word-break: normal; overflow-wrap: break-word; }
.issue-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 320 / 414;
  object-fit: cover;
  border: 1px solid var(--color-rule);
}

/* ---- Divider: a hairline between two parts of a sheet ---- */
.divider {
  border: 0;
  border-top: 1px solid var(--color-rule);
  margin: 36px 0;
}

/* Present to assistive tech and search engines, absent from the visual layout. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Title with a rule beneath, for pages that open straight into content ---- */
.title--ruled {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-rule);
}
.title--ruled em { font-style: italic; }

footer {
  font-family: var(--font-sans);
  text-align: center;
  padding: 32px 24px;
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: 0.54em;
  color: var(--color-white);
}

/* ---- Narrow screens ---- */
@media (max-width: 620px) {
  main { padding: 32px 16px 56px; }
  .sheet { padding: 26px 22px 30px; border-radius: 4px; }
  .prose p, .prose ul, .prose ol, .lede { font-size: var(--text-base); }
  .people { grid-template-columns: 1fr; gap: 18px; }
  .media { grid-template-columns: 1fr; gap: 20px; }
  .media--flip .figure { order: 0; }
  .sheet > .feature:first-child { margin: -26px -22px 30px; }
  .sheet > .feature:first-child:last-child { margin-bottom: -30px; }
  .feature .figure img { aspect-ratio: 3 / 2; }
  .feature .figure figcaption { padding: 8px 22px 0; }
  .feature-body { grid-template-columns: 1fr; padding: 20px 22px 28px; }
  .issue { grid-template-columns: 76px 1fr; gap: 16px; padding: 22px 0; }
  .subnav ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 0 20px; }
  .subnav ul::-webkit-scrollbar { display: none; }
  /* A fade at the right edge shows the row continues. */
  .subnav ul { -webkit-mask-image: linear-gradient(to right, black 85%, transparent); mask-image: linear-gradient(to right, black 85%, transparent); padding-right: 32px; }
  .feature-actions { grid-column: 1; grid-row: auto; margin-top: 20px; }
  footer { letter-spacing: 0.3em; }
}

/* The nav needs more room than the rest of the layout: the four items stop
   fitting on one line just under 745px, so the drawer takes over earlier than
   the narrow-screen rules above. Its rows are full-width targets, which is the
   friendlier answer at this width anyway. */
@media (max-width: 760px) {
  /* Smaller here so the line breaks into fewer rows against a much shorter
     measure. It keeps the wordmark's inset: dropped back to the logo's left
     edge it reads as a separate banner rather than part of the masthead. */
  .claim-line {
    margin: 14px 0 0 20.117%;
    font-size: var(--text-claim-narrow);
  }
  .claim-line span { letter-spacing: 0.08em; }

  .nav-bar {
    display: block;
    border-bottom: 1px solid var(--color-rule-strong);
  }
  .site-nav {
    display: none;
    flex-direction: column;
    padding-top: 0;
    letter-spacing: 0.09em;
    line-height: 1.35;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a {
    margin: 0;
    padding: 16px 12px 16px 13px;
    min-height: 56px;
    display: flex;
    align-items: center;
    font-size: var(--text-nav);
    border-bottom: 1px solid var(--color-rule-strong);
    border-top: none;
    border-left: 3px solid transparent;
  }
  .site-nav a:hover,
  .site-nav a:active { background: var(--color-press); }
  .site-nav a[aria-current="page"] {
    border-left-color: var(--color-accent-deep);
    background: var(--color-accent-wash);
  }
}

/* ---- Print / save as PDF ---- */
@media print {
  body { background: var(--color-white); }
  header { padding: 0 0 20px; }
  .masthead-rule { margin-left: 0; width: 100%; }
  .site-nav, .nav-bar { display: none; }
  main { padding: 0; max-width: 100%; }
  .sheet {
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 0;
  }
  .prose a { color: var(--color-ink); text-decoration: underline; }
  footer { display: none; }
}
