/* field-guides components.
 *
 * Colour comes from tuxton-theme.css (vendored, load it first). This file
 * carries layout, rhythm and the two things the shared tokens genuinely do not
 * describe: the dark chrome band, and a handful of editorial greys.
 *
 * Every page loads both files and sets <html data-theme="light">. Page-specific
 * rules are scoped by a body class (page-index, page-guide, page-lids, page-portal)
 * because the surfaces reuse bare element selectors
 * (`table`, `.header`, `.footer`) with different metrics.
 */

/* ── Brand book (TUX-1618) ──
 *
 * Field guides follow the Tuxton brand book (tuxton-platform, docs/brand/).
 * Its "A field guide: Kona" example is the reference layout: an ink band with
 * the white FIELD GUIDES lockup, white cards with Poppins headings, and no
 * colour of our own. The catalog page supplies the colour. Green, gold and red
 * mean stock and status, so they never decorate a card.
 */

/* ── On-ink chrome (TUX-783) ──
 *
 * The ink header band, and the login gate that reuses it, are dark elements
 * inside a light page. That is NOT dark mode: the shared file's dark block is
 * mode-scoped (it fires when the whole page goes dark) and these run on a page
 * that is always light.
 *
 * The values match the brand book's --tux-ink / --tux-on-ink. They stay local
 * because field-guides is still the only vendored consumer with a band; when
 * the shared token file grows --tux-ink, point these at it and delete them.
 */
:root {
  --fg-chrome-bg: #231916; /* ink, the brand book's black */
  --fg-chrome-fg: #ffffff;
  --fg-chrome-fg-muted: #b3b3b3;
  --fg-chrome-surface: #1f1f1f; /* input fill inside the gate */
  --fg-chrome-line: #444444;

  /* Brand book type. The shared token file keeps the system stack for tools;
     field guides are a Tuxton site and load the brand faces. */
  --fg-font-body: "Montserrat", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --fg-font-sub: "Poppins", "Segoe UI", sans-serif; /* subheadings, buttons */
  --fg-font-caps: "psfournier-std", "Fraunces", Georgia, serif; /* ALL CAPS titles only */

  /* Editorial greys the shared neutrals do not cover. These recede almost
     entirely (version stamps, tier rules). */
  --fg-faint: #bbbbbb;
  --fg-rule: #dddddd;
}

/* ── Reset + base ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--fg-font-body);
  color: var(--tux-fg);
  background: var(--tux-bg);
}

/* ── Ink header band ──
 * Shared by every surface. Page classes below adjust only its metrics.
 * Lockup, then the page title in PS Fournier caps (the way the store titles its
 * collection pages), then the product line in small muted caps.
 */
.header {
  background: var(--fg-chrome-bg);
  color: var(--fg-chrome-fg);
  display: flex;
  align-items: center;
  gap: 18px;
}

.lockup {
  display: block;
  flex-shrink: 0;
  text-decoration: none;
}

.lockup img {
  display: block;
  width: 100%;
  height: auto;
}

.header .lockup {
  width: 72px;
}

.header .titles {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 12px;
  min-width: 0;
}

.header .title {
  font-family: var(--fg-font-caps);
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.1;
  text-transform: uppercase;
}

.header .line-name {
  font-size: 8pt;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--fg-chrome-fg-muted);
}

.header nav {
  margin-left: auto;
  flex-shrink: 0;
}

.header nav a {
  color: var(--fg-chrome-fg);
  font-size: 9pt;
  text-decoration: none;
  opacity: 0.85;
}

.header nav a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ── Footer ── */
.footer {
  font-size: 7pt;
  color: var(--fg-faint);
}

/* ── Sign-in gate ──
 * The sign-in screen for the encrypted pages. Markup is emitted at build time by
 * scripts/encrypt_site.py, so it exists only on the built site; these classes
 * match nothing in the templates or in a locally generated guide.
 *
 * .is-checking is the first state: fg-gate.js is trying a stored key or the
 * sign-in cookie, so only the logo and a status line show. It is removed when
 * the form is needed.
 */
.fg-gate {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--fg-chrome-bg);
  display: flex;
  overflow-y: auto; /* a short phone screen in landscape scrolls the form */
}

.fg-gate-form {
  width: 340px;
  max-width: 100%;
  margin: auto; /* centred when it fits, top-aligned and scrollable when not */
  color: var(--fg-chrome-fg);
  padding: 24px 16px;
}

.fg-gate-form .lockup {
  width: 96px;
  margin: 0 auto;
}

.fg-gate-rule {
  width: 36px;
  height: 2px;
  background: var(--fg-chrome-fg);
  opacity: 0.5;
  margin: 14px auto 12px;
}

.fg-gate-hint {
  color: var(--fg-chrome-fg-muted);
  font-family: var(--fg-font-sub);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 18px;
}

.fg-gate-status {
  color: var(--fg-chrome-fg-muted);
  font-size: 13px;
  text-align: center;
}

.fg-gate .fg-gate-fields { display: block; }
.fg-gate .fg-gate-status { display: none; }
.fg-gate.is-checking .fg-gate-fields { display: none; }
.fg-gate.is-checking .fg-gate-status { display: block; }

.fg-gate-field {
  margin-bottom: 12px;
}

.fg-gate-field label {
  display: block;
  color: var(--fg-chrome-fg-muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.fg-gate-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--fg-chrome-line);
  border-radius: var(--tux-radius);
  background: var(--fg-chrome-surface);
  color: var(--fg-chrome-fg);
  font-family: var(--fg-font-body);
  font-size: 16px; /* below 16px, iPhone Safari zooms the page on focus */
  outline: none;
}

.fg-gate-field input:focus {
  border-color: var(--fg-chrome-fg-muted);
}

/* No red here: on the ink ground the message carries the meaning, and the
   brand book keeps red for status. The field gets a white outline instead. */
.fg-gate-field input[aria-invalid="true"] {
  border-color: var(--fg-chrome-fg);
}

.fg-gate-code {
  position: relative;
}

.fg-gate-code input {
  padding-right: 64px;
}

.fg-gate-show {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 60px;
  border: 0;
  background: none;
  color: var(--fg-chrome-fg-muted);
  font-family: var(--fg-font-sub);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

.fg-gate-show:hover {
  color: var(--fg-chrome-fg);
}

.fg-gate-prompt {
  color: var(--fg-chrome-fg);
  font-size: 14px;
  line-height: 1.45;
  margin: 2px 0 12px;
}

.fg-gate-help {
  color: var(--fg-chrome-fg-muted);
  font-size: 12px;
  margin-top: 6px;
}

.fg-gate-help a {
  color: var(--fg-chrome-fg);
}

.fg-gate-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 4px 0 2px;
  cursor: pointer;
}

.fg-gate-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--fg-chrome-fg);
}

.fg-gate-err {
  color: var(--fg-chrome-fg);
  font-size: 13px;
  min-height: 16px;
  margin: 10px 0;
}

.fg-gate-btn {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: var(--tux-radius);
  background: var(--fg-chrome-fg);
  color: var(--fg-chrome-bg);
  font-family: var(--fg-font-sub);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  cursor: pointer;
}

.fg-gate-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ─────────────────────────────────────────────────────────────────────────
   page-index — the landing page
   ───────────────────────────────────────────────────────────────────────── */

.page-index {
  background: var(--tux-bg);
}

.page-index .header {
  padding: 20px 32px;
  gap: 24px;
}

.page-index .header .lockup {
  width: 96px;
}

.page-index .header .text p {
  color: var(--fg-chrome-fg-muted);
  font-size: 0.875rem;
}

.page-index .header .text a {
  color: var(--fg-chrome-fg);
  font-size: 0.8rem;
  margin-top: 4px;
  display: inline-block;
}

.page-index main {
  max-width: 960px;
  margin: 40px auto;
  padding: 0 24px 60px;
}

/* On a phone the "Rep portal" link drops to its own line instead of running
   off the edge. */
@media screen and (max-width: 640px) {
  .page-index .header {
    flex-wrap: wrap;
    padding: 16px;
    gap: 12px 20px;
  }
  .page-index .header nav {
    margin-left: 0;
    width: 100%;
  }
}

.tier {
  margin-bottom: 40px;
}

.tier h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--tux-fg-muted);
  border-bottom: 1px solid var(--fg-rule);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.guides {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.guide-link {
  display: block;
  background: var(--tux-surface);
  border: 1px solid var(--tux-line);
  border-radius: var(--tux-radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--tux-fg);
  font-family: var(--tux-font-display);
  font-size: 1.05rem;
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.guide-link:hover {
  border-color: var(--tux-brown);
  box-shadow: 0 0 0 3px rgba(107, 72, 54, 0.12);
}

/* ─────────────────────────────────────────────────────────────────────────
   page-guide — one collection per page
   ───────────────────────────────────────────────────────────────────────── */

@page {
  size: letter landscape;
  margin: 0;
}

.page-guide {
  font-size: 9pt;
  background: var(--tux-bg); /* the grey page under white cards; print resets to white */
}

.page-guide .header {
  padding: 10px 22px;
}

.page-guide .header .title {
  font-size: 22pt;
}

/* Body grid — image right, content left; both span full height. */
.page-guide .body {
  display: grid;
  grid-template-columns: 1fr clamp(3in, 26vw, 4.6in);
  grid-template-areas: "content preview";
  gap: 16px;
  padding: 13px 15px 8px;
}

.page-guide .body > .col {
  grid-area: content;
}

.page-guide .body > .preview {
  grid-area: preview;
}

.page-guide .col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Cards (collapsible) ── */
.card {
  background: var(--tux-surface);
  border-radius: var(--tux-radius);
  box-shadow: var(--tux-shadow);
  overflow: hidden;
}

/* The lead card carries the page's one brown rule. */
.card.lead {
  border-top: 3px solid var(--tux-brown);
}

/* summary element = clickable collapse header */
.card-header {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 7px;
  font-family: var(--fg-font-sub);
  font-weight: 700;
  font-size: 10pt;
  color: var(--tux-fg);
}

details.card[open] > .card-header {
  border-bottom: 1px solid var(--tux-line);
}

.card-header::-webkit-details-marker {
  display: none;
}

.card-header::after {
  content: "\25B8"; /* ▸ rotates to ▾ when open */
  font-size: 13pt;
  line-height: 1;
  color: var(--tux-fg-muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

details.card[open] > .card-header::after {
  transform: rotate(90deg);
}

.card-body {
  padding: 9px 12px 11px;
}

.catalog-link {
  margin-top: 8px;
  margin-bottom: 0;
}

.catalog-link a {
  color: var(--tux-link);
  font-weight: 700;
  font-size: 8pt;
  text-decoration: none;
}

.catalog-link a:hover {
  text-decoration: underline;
}

.card p {
  margin-bottom: 5px;
  line-height: 1.45;
}
.card ul {
  padding-left: 14px;
}
.card ul li {
  margin-bottom: 4px;
  line-height: 1.4;
}
.card ul li strong {
  font-weight: 600;
}

/* ── Catalog preview (right sidebar) ── */
.preview {
  position: sticky;
  top: 12px;
}

.preview a {
  text-decoration: none;
}

.preview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--tux-radius);
  border: 1px solid var(--tux-line);
  box-shadow: var(--tux-shadow);
}

.preview .catalog-link {
  text-align: center;
  margin-top: 7px;
}

.page-guide .footer {
  text-align: right;
  padding: 3px 16px 5px;
}

/* ── SKU table ── */
.page-guide table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.5pt;
}

.page-guide th {
  font-weight: 600;
  font-size: 6.5pt;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: left;
  padding: 3px 5px;
  color: var(--tux-fg-muted);
  border-bottom: 1px solid var(--tux-line-strong);
}

.page-guide td {
  padding: 2px 5px;
  border-bottom: 1px solid var(--tux-line);
}

.page-guide tbody tr:nth-child(even) {
  /* A stripe steps toward the page: its grey, on a white card. */
  background: var(--tux-bg);
}

/* ── Responsive: tablet — same areas, image scales proportionally ── */
@media screen and (max-width: 1150px) {
  .page-guide {
    width: auto;
  }
  .page-guide .body {
    padding: 12px;
    gap: 12px;
  }
}

/* ── Responsive: mobile ── */
@media screen and (max-width: 640px) {
  .page-guide {
    font-size: 11pt;
  }
  .page-guide .header {
    height: auto;
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-guide .header .title {
    font-size: 18pt;
  }
  .page-guide .header nav {
    display: none;
  }
  .page-guide .body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "preview"
      "content";
    padding: 10px;
    gap: 12px;
  }
  .page-guide .preview {
    position: static;
    max-width: 300px;
    margin: 0 auto;
  }
}

/* ── Print ── */
@media print {
  .page-guide {
    background: var(--tux-surface);
    font-size: 9pt;
  }
  .page-guide .header nav {
    display: none;
  }
  .page-guide .body {
    grid-template-columns: 1fr 2.7in;
    grid-template-areas: "content preview";
    gap: 12px;
    padding: 13px 15px 8px;
  }
  .page-guide .preview {
    position: static;
  }
  /* No clipping in print: a card that breaks across pages would otherwise cut
     the line pushed onto the next one. The radius it existed for is moot. */
  .card {
    box-shadow: none;
    overflow: visible;
  }
  /* Always show every section when printing, regardless of collapse state.
     Browsers hide a closed <details> body through its ::details-content slot,
     which no rule on .card-body can reach, so they need the pseudo-element;
     WeasyPrint has no slot and needs the display rule. Keep both. */
  details.card::details-content {
    content-visibility: visible;
    display: contents;
  }
  details.card:not([open]) > .card-body {
    display: block;
  }
  details.card > .card-header {
    border-bottom: 1px solid var(--tux-line);
    break-after: avoid;
  }
  /* Guides run to several pages; never split a bullet or a table row, and
     never leave a heading alone at the foot of a page. */
  .card li,
  .card p,
  .card tr {
    break-inside: avoid;
  }
  .card-header::after {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   page-lids — the lid-program reference table
   ───────────────────────────────────────────────────────────────────────── */

.page-lids {
  background: var(--tux-bg);
}

.page-lids .header {
  padding: 10px 22px;
}

.page-lids .header .title {
  font-size: 22pt;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px 44px;
}

.intro {
  margin: 10px 2px 18px;
  color: var(--tux-fg);
  font-size: 11pt;
  line-height: 1.5;
}

.intro strong {
  font-family: var(--fg-font-sub);
}

.table-scroll {
  overflow-x: auto;
  border-radius: 8px;
  background: var(--tux-surface);
  box-shadow: var(--tux-shadow);
}

.page-lids table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5pt;
}

.page-lids thead th {
  position: sticky;
  top: 0;
  background: var(--tux-surface);
  color: var(--tux-fg-muted);
  text-align: left;
  padding: 9px 12px;
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--tux-line-strong);
  z-index: 1;
}

.page-lids tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--tux-line);
  vertical-align: top;
}

.page-lids tbody tr.alt td {
  /* A stripe steps toward the page: its grey, on a white card. */
  background: var(--tux-bg);
}

.page-lids tbody tr:hover td {
  background: var(--tux-surface-2);
}

.empty {
  color: #c4c4c4;
}

.page-lids .footer {
  text-align: center;
  color: #999;
  font-size: 8pt;
  margin-top: 18px;
}

@media print {
  .page-lids {
    background: var(--tux-surface);
  }
  .table-scroll {
    box-shadow: none;
  }
  .page-lids thead th {
    position: static;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   page-portal: the rep portal home (templates/portal-home.html)
   ───────────────────────────────────────────────────────────────────────── */

.page-portal {
  background: var(--tux-bg);
}

.page-portal .header {
  padding: 16px 32px;
  gap: 16px;
}

.page-portal .header .lockup {
  width: 64px;
}

.page-portal .header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.page-portal main {
  max-width: 1040px;
  margin: 36px auto;
  padding: 0 24px 24px;
}

.portal-section {
  margin-bottom: 40px;
  scroll-margin-top: 16px;
}

/* Same quiet section heading as the field guides index's tiers. */
.portal-section h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--tux-fg-muted);
  border-bottom: 1px solid var(--fg-rule);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.portal-section h3 {
  font-family: var(--fg-font-sub);
  font-size: 0.95rem;
  font-weight: 600;
}

.portal-note a,
.portal-person a,
.portal-more a,
.portal-footer a {
  color: var(--tux-link);
}

/* White cards on the grey page, as the brand book draws them. */
.portal-note,
.portal-links,
.portal-group,
.portal-person,
.portal-post,
.portal-map {
  background: var(--tux-surface);
  border-radius: 8px;
  box-shadow: var(--tux-shadow);
}

/* Announcements carry the page's one brown rule. */
.portal-note {
  border-left: 3px solid var(--tux-brown);
  padding: 16px 20px;
  margin-bottom: 12px;
}

.portal-note p {
  margin-top: 6px;
  font-size: 0.95rem;
  line-height: 1.55;
}

.portal-banner {
  display: block;
  background: var(--tux-brown);
  color: var(--tux-on-accent);
  border-radius: 8px;
  padding: 16px 20px;
  font-family: var(--fg-font-sub);
  font-weight: 600;
  text-decoration: none;
}

.portal-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 28px;
}

/* The welcome band: a white band under the header, text and lookup on the
   left, a photo on the right. Its padding centres it on main's 1040px. */
.portal-welcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  align-items: center;
  gap: 32px;
  padding: 32px max(24px, calc((100% - 1040px) / 2 + 24px));
  background: var(--tux-surface);
  box-shadow: var(--tux-shadow);
}

.portal-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--tux-brown);
}

.portal-welcome h1 {
  margin: 6px 0 20px;
  font-family: var(--tux-font-display);
  font-size: 2rem;
  line-height: 1.15;
}

.portal-welcome-photo {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  border-radius: 8px;
}

/* The item lookup and its suggestions (static/portal.js). */
.portal-lookup {
  position: relative;
}

.portal-lookup label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--tux-fg-muted);
}

.portal-lookup-row {
  display: flex;
  gap: 8px;
}

.portal-lookup input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--tux-line-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  color: var(--tux-fg);
  background: var(--tux-surface);
}

.portal-lookup input[type="search"]:focus {
  outline: none;
  border-color: var(--tux-brown);
  box-shadow: 0 0 0 3px rgba(107, 72, 54, 0.18);
}

.portal-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10;
  margin-top: 4px;
  list-style: none;
  background: var(--tux-surface);
  border-radius: 8px;
  box-shadow: var(--tux-shadow);
  overflow: hidden;
}

.portal-suggest li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.92rem;
}

.portal-suggest li[aria-selected="true"] {
  background: var(--tux-surface-2);
}

.portal-suggest-label {
  font-weight: 600;
}

.portal-suggest-note {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--tux-fg-muted);
}

.portal-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* Brown is the button, as the brand book has it. */
.portal-btn {
  display: inline-block;
  padding: 11px 18px;
  border: 1px solid var(--tux-brown);
  border-radius: 6px;
  background: var(--tux-brown);
  color: var(--tux-on-accent);
  font-family: var(--fg-font-sub);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.portal-btn-quiet {
  background: transparent;
  color: var(--tux-brown);
}

/* The way into the field guides: catalog photos over their own lockup. */
.portal-guides-tile {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--tux-shadow);
  text-decoration: none;
  transition: box-shadow 0.15s;
}

.portal-mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--fg-chrome-bg);
}

.portal-mosaic img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.portal-guides-band {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--fg-chrome-bg);
  color: var(--fg-chrome-fg-muted);
  font-size: 0.85rem;
}

.portal-guides-band img {
  width: 72px;
  flex-shrink: 0;
}

.portal-guides-tile:hover,
.portal-photo-tile:hover {
  box-shadow: 0 0 0 3px rgba(107, 72, 54, 0.25), var(--tux-shadow);
}

/* A photo beside a title, for one of the portal's own pages. */
.portal-photo-tile {
  display: flex;
  overflow: hidden;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--tux-surface);
  box-shadow: var(--tux-shadow);
  color: var(--tux-fg);
  text-decoration: none;
  transition: box-shadow 0.15s;
}

.portal-photo-tile img {
  width: 42%;
  flex-shrink: 0;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.portal-photo-tile-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--tux-fg-muted);
}

.portal-photo-tile-text strong {
  font-family: var(--fg-font-sub);
  font-size: 0.95rem;
  color: var(--tux-fg);
}

.portal-links {
  list-style: none;
  overflow: hidden;
}

.portal-links li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--tux-line);
  font-size: 0.92rem;
}

.portal-links li:last-child {
  border-bottom: 0;
}

.portal-links a {
  color: var(--tux-fg);
  font-weight: 500;
  text-decoration: none;
}

.portal-links a:hover {
  color: var(--tux-link);
  text-decoration: underline;
}

.portal-kind {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tux-fg-muted);
}

.portal-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  align-items: start;
}

.portal-group h3 {
  padding: 14px 16px 4px;
}

.portal-group-wide {
  grid-column: 1 / -1;
}

.portal-group-wide .portal-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Inside a group card the list is part of the card, not a second one. */
.portal-group .portal-links {
  box-shadow: none;
  background: none;
}

.portal-news {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.portal-post {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--tux-fg);
  text-decoration: none;
  transition: box-shadow 0.15s;
}

.portal-post:hover {
  box-shadow: 0 0 0 3px rgba(107, 72, 54, 0.18), var(--tux-shadow);
}

.portal-post img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--tux-surface-2);
}

.portal-post-date {
  padding: 12px 16px 0;
  font-size: 0.72rem;
  color: var(--tux-fg-muted);
}

.portal-post-title {
  padding: 2px 16px 14px;
  font-family: var(--fg-font-sub);
  font-weight: 600;
  line-height: 1.3;
}

.portal-more {
  margin-top: 10px;
  font-size: 0.85rem;
}

.portal-people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.portal-directors {
  margin-bottom: 16px;
}

.portal-person {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  font-size: 0.88rem;
}

.portal-person a {
  overflow-wrap: anywhere;
}

.portal-role {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tux-fg-muted);
}

.portal-name {
  font-weight: 600;
}

.portal-map {
  padding: 12px;
}

.portal-map img {
  display: block;
  width: 100%;
  height: auto;
}

/* The portal's own pages (training/...). */
.portal-article {
  max-width: 1040px;
  margin: 28px auto;
  padding: 0 24px 24px;
}

.portal-crumb {
  font-size: 0.8rem;
}

.portal-crumb a,
.portal-toc a,
.portal-prose a {
  color: var(--tux-link);
}

.portal-article h1 {
  margin: 6px 0 8px;
  font-family: var(--tux-font-display);
  font-size: 2rem;
  line-height: 1.15;
}

.portal-lede {
  max-width: 60ch;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--tux-fg-muted);
}

.portal-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 16px 0 32px;
  font-size: 0.9rem;
}

.portal-settings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.portal-setting {
  overflow: hidden;
  background: var(--tux-surface);
  border-radius: 8px;
  box-shadow: var(--tux-shadow);
}

.portal-setting img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.portal-setting > div {
  padding: 14px 16px 16px;
}

.portal-setting dl {
  margin-top: 8px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.portal-setting dt {
  margin-top: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tux-fg-muted);
}

.portal-tips {
  padding: 16px 20px 16px 38px;
  background: var(--tux-surface);
  border-radius: 8px;
  box-shadow: var(--tux-shadow);
  font-size: 0.95rem;
  line-height: 1.5;
}

.portal-tips li + li {
  margin-top: 8px;
}

.portal-prose p {
  max-width: 70ch;
  margin-bottom: 10px;
  font-size: 0.95rem;
  line-height: 1.55;
}

.portal-prose .portal-example {
  display: inline-block;
  margin: 4px 0 16px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--tux-surface-2);
  font-family: var(--fg-font-sub);
  font-weight: 600;
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.portal-table th,
.portal-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--tux-line);
  text-align: right;
  white-space: nowrap;
}

.portal-table th:first-child {
  text-align: left;
}

.portal-table thead th {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tux-fg-muted);
  border-bottom-color: var(--tux-line-strong);
}

.portal-table tbody th {
  font-weight: 500;
}

.portal-table tbody tr:last-child > * {
  border-bottom: 0;
}

.portal-footer {
  text-align: center;
  padding: 0 16px 40px;
  font-size: 0.85rem;
}

@media screen and (max-width: 720px) {
  .portal-pair {
    grid-template-columns: 1fr;
  }
  /* On a phone the photo leads, as a short banner over the lookup. */
  .portal-welcome {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 20px 16px 24px;
  }
  .portal-welcome-photo {
    order: -1;
    aspect-ratio: 16 / 7;
  }
  .portal-welcome h1 {
    font-size: 1.6rem;
  }
}

@media screen and (max-width: 640px) {
  .page-portal .header {
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  .page-portal .header nav {
    margin-left: 0;
    width: 100%;
  }
  .page-portal main,
  .portal-article {
    margin: 24px auto;
    padding: 0 16px 16px;
  }
  .portal-map {
    padding: 6px;
  }
}
