/* ============================================================================
 * TAP — landing page design tokens & layout
 * Brand palette: primary #54C8DA · surface #FDFAF8 · ink #14425B · hint #12D3A6
 * Tri-color system for databases: Data · Network · Activity
 * ========================================================================== */

:root {
  --tap-primary: #54c8da;
  --tap-primary-soft: rgba(84, 200, 218, 0.14);
  --tap-hint: #12d3a6;
  --tap-hint-soft: rgba(18, 211, 166, 0.12);

  --tap-ink: #14425b;
  --tap-ink-deep: #0d2c3d;
  --tap-ink-muted: rgba(20, 66, 91, 0.78);
  --tap-surface: #fdfaf8;
  --tap-surface-elevated: #ffffff;
  --tap-surface-dim: rgba(20, 66, 91, 0.75);
  --tap-on-dark: #fdfaf8;
  --tap-on-dark-muted: rgba(253, 250, 248, 0.72);
  --tap-on-dark-dim: rgba(253, 250, 248, 0.55);

  /* Page background — the deep-blue end of the TAP island mark
     (assets/img/tap-hub-logo.jpg), so the portal reads as one brand surface
     with the Data/Network/Activity apps' headers rather than a bright sheet. */
  --tap-bg: #0a2733;
  --tap-bg-deep: #061620;
  --tap-surface-elevated-dark: rgba(255, 255, 255, 0.05);
  --tap-border-on-dark: rgba(255, 255, 255, 0.1);

  /* Shared TAP type scale — the same ladder the Data and Network apps use
     (see apps/tap-*/src/styles.scss): a Major Third (1.25) off a 16px base,
     fluid between 640px and 1600px viewports, stated in px so all three
     properties render at identical sizes. */
  --tap-fs-eyebrow: clamp(12px, 10.7px + 0.21vw, 14px);
  --tap-fs-body: clamp(16px, 13.3px + 0.42vw, 20px);
  --tap-fs-lead: clamp(20px, 9.2px + 1.69vw, 39px);
  --tap-fs-title: clamp(39px, 27px + 1.2vw, 61px);

  /* Spacing on discrete 8pt steps */
  --tap-space-block: 24px;
  --tap-space-tight: 16px;

  --tap-header-height: 64px;

  --tap-content-max: 1600px;
  --tap-gutter: clamp(32px, 5vw, 72px);
  --tap-hero-gap: clamp(32px, 5vw, 56px);
  --tap-hero-pt: clamp(48px, 8vw, 96px);
  --tap-hero-pb: clamp(48px, 6vw, 80px);
  --tap-visual-max: 560px;

  --data-accent: #00bbff;
  --data-accent-light: #54d3ff;
  --data-accent-pale: #a6e6ff;
  --data-ink: #004c94;
  --data-white: #eaf7ff;

  --network-accent: #54c8da;
  --network-accent-light: #7ad6e4;
  --network-accent-pale: #a6e5ee;
  --network-ink: #14425b;
  --network-white: #eef9fb;

  --activity-accent: #e07a2f;
  --activity-accent-light: #f29b57;
  --activity-accent-dim: #a8541c;
  --activity-ink: #1d1108;
  --activity-surface: #fdf2e8;
}

/* ── BASE ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  width: 100%;
  overflow-x: hidden;
}

/* ── SKIP LINK & FOCUS ── */
.portal-skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tap-ink);
  background: var(--tap-surface-elevated);
  border-radius: 4px;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s;
}

.portal-skip-link:focus {
  transform: translateY(0);
}

.portal-skip-link:focus-visible,
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--tap-hint);
  outline-offset: 3px;
}

.portal-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Archivo', system-ui, -apple-system, sans-serif;
  background: var(--tap-bg);
  color: var(--tap-on-dark);
}

.portal-page {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: 3px; /* tri-color rule */
}

/* ── TRI-COLOR TOP RULE ── */
.portal-tri-rule {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 100;
  background: linear-gradient(
    90deg,
    var(--data-accent) 0%,
    var(--data-accent) 33%,
    var(--network-accent) 33%,
    var(--network-accent) 66%,
    var(--activity-accent) 66%,
    var(--activity-accent) 100%
  );
}

/* ── PAGE ATMOSPHERE ──
   Three slowly drifting, heavily blurred brand glows over the warm surface —
   the same ambient layer the Data and Network apps use, so all three
   properties share one background behaviour.

   Each span is invisible itself; what you see is its blurred box-shadow. The
   shadow has to stay a full 100vmin clear of the span, because an outer
   box-shadow is never painted underneath its own border box — any overlap
   would punch a hard-edged circle out of the glow. Drift comes from rotating
   the span about a transform-origin placed next to the *shadow*, so the orbit
   radius is the small gap between the two rather than the whole 100vmin throw.
   Animating only `transform` lets the browser rasterise the blur once. */
.portal-hero__bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(84, 200, 218, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse at 82% 65%, rgba(18, 211, 166, 0.1) 0%, transparent 50%),
    linear-gradient(160deg, var(--tap-bg) 0%, var(--tap-bg-deep) 100%);
  contain: layout paint;
}

@keyframes portal-ambient-drift {
  to {
    transform: translate3d(0, 0, 1px) rotate(360deg);
  }
}

.portal-hero__bg span {
  position: absolute;
  width: 50vmin;
  height: 50vmin;
  border-radius: 50%;
  backface-visibility: hidden;
  will-change: transform;
  animation-name: portal-ambient-drift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

/* `left`/`top` are offset by the origin so the percentages read as the orbit
   centre of the visible glow. Tinted with the portal's own tri-colour accents
   rather than a single hue, since the portal is the parent of all three. */
.portal-hero__bg span:nth-child(1) {
  color: rgba(84, 200, 218, 0.22);
  left: calc(16% - 111vmin);
  top: calc(24% - 25vmin);
  transform-origin: 111vmin 25vmin;
  box-shadow: 100vmin 0 30vmin currentColor;
  animation-duration: 132s;
  animation-delay: -18s;
}

.portal-hero__bg span:nth-child(2) {
  color: rgba(18, 211, 166, 0.14);
  left: calc(86% - 107vmin);
  top: calc(16% - 25vmin);
  transform-origin: 107vmin 25vmin;
  box-shadow: 100vmin 0 32vmin currentColor;
  animation-duration: 196s;
  animation-delay: -80s;
}

.portal-hero__bg span:nth-child(3) {
  color: rgba(84, 200, 218, 0.12);
  left: calc(68% + 63vmin);
  top: calc(86% - 25vmin);
  transform-origin: -63vmin 25vmin;
  box-shadow: -100vmin 0 28vmin currentColor;
  animation-duration: 158s;
  animation-delay: -60s;
}

/* The drift is slow enough to be ambient, but it is still motion. */
@media (prefers-reduced-motion: reduce) {
  .portal-hero__bg span {
    animation: none;
  }
}

.portal-hero__grad-left {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    rgba(6, 22, 32, 0.9) 0%,
    rgba(6, 22, 32, 0.5) 48%,
    transparent 78%
  );
}

.portal-hero__grad-bottom {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(6, 22, 32, 0.94) 0%,
    transparent 42%
  );
}

/* ── CONTAINER ── */
.portal-container {
  width: 100%;
  max-width: var(--tap-content-max);
  margin-inline: auto;
  padding-left: max(var(--tap-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--tap-gutter), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

/* Never use padding shorthand on elements that also carry .portal-container —
   it resets padding-inline to 0 (see .portal-hero__main). */

/* ── HEADER / NAV ──
   Sticky and translucent, matching the app-tap-header in the Data and Network
   apps, so the ambient layer drifts behind it instead of being cut off. */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 22, 32, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--tap-border-on-dark);
}

.portal-header__inner {
  display: flex;
  height: var(--tap-header-height);
  min-height: var(--tap-header-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.portal-header__brand-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 4px;
  text-decoration: none;
}

.portal-header__brand {
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--tap-on-dark);
}

.portal-header__brand-link:hover .portal-header__brand {
  color: var(--tap-hint);
}

.portal-nav {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
  height: 40px;
}

.portal-nav-label--short {
  display: none;
}

.portal-nav-item {
  padding: 0 12px;
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--tap-on-dark-muted);
  text-decoration: none;
  border-radius: 4px;
  border-left: 3px solid transparent;
  text-align: center;
  line-height: 1.2;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.portal-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--tap-on-dark);
}

.portal-nav-item--data:hover {
  border-left-color: var(--data-accent);
  color: var(--data-accent-light);
}

.portal-nav-item--network:hover {
  border-left-color: var(--network-accent);
  color: var(--network-accent-light);
}

.portal-nav-item--activity:hover {
  border-left-color: var(--activity-accent);
  color: var(--activity-accent-light);
}

.portal-nav-item[aria-disabled="true"] {
  cursor: default;
  pointer-events: none;
  opacity: 0.45;
}

.portal-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tap-on-dark-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

@media (min-width: 1024px) {
  .portal-hamburger {
    display: none;
  }
}

.portal-hamburger:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--tap-on-dark);
}

.portal-mobile-menu {
  display: none;
  border-top: 1px solid var(--tap-border-on-dark);
  background: var(--tap-bg);
  padding-left: max(var(--tap-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--tap-gutter), env(safe-area-inset-right, 0px));
}

.portal-mobile-menu.open {
  display: block;
}

.portal-mobile-nav-item {
  display: block;
  padding: 16px;
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--tap-on-dark-muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.portal-mobile-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--tap-on-dark);
}

.portal-mobile-nav-item--data:hover {
  border-left-color: var(--data-accent);
  color: var(--data-accent-light);
}

.portal-mobile-nav-item--network:hover {
  border-left-color: var(--network-accent);
  color: var(--network-accent-light);
}

.portal-mobile-nav-item--activity:hover {
  border-left-color: var(--activity-accent);
  color: var(--activity-accent-light);
}

.portal-mobile-nav-item[aria-disabled="true"] {
  cursor: default;
  pointer-events: none;
  opacity: 0.45;
}

/* ── HERO CONTENT ── */
.portal-hero {
  position: relative;
  z-index: 5;
  min-height: calc(100vh - var(--tap-header-height) - 3px);
  min-height: calc(100dvh - var(--tap-header-height) - 3px);
  display: flex;
  flex-direction: column;
}

/* The container, not __main, is the hero's flex child — it has to stretch
   before __main can centre anything inside it. */
.portal-hero > .portal-container {
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* Vertically centred like the Data and Network heroes, so a tall viewport
   grows the margins instead of leaving a void under the copy. */
.portal-hero__main {
  display: flex;
  flex: 1;
  align-items: center;
  padding-block: var(--tap-hero-pt) var(--tap-hero-pb);
}

.portal-hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--tap-hero-gap);
  align-items: start;
  width: 100%;
}

.portal-hero__text {
  min-width: 0;
  width: 100%;
}

.portal-hero__visual {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

@media (min-width: 1024px) {
  /* Two rows so the quote sits under the copy while the visual column — brand
     mark plus the database navigation — spans the full height beside them.
     Below 1024px the same three children simply stack in DOM order: copy,
     navigation, quote, which keeps the forwarding links ahead of the pull
     quote on a phone. */
  .portal-hero__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--tap-visual-max));
    grid-template-areas:
      'text visual'
      'quote visual';
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: var(--tap-hero-gap);
  }

  .portal-hero__text {
    grid-area: text;
  }

  .portal-hero__visual {
    grid-area: visual;
  }

  .portal-quote {
    grid-area: quote;
  }

  /* No brand-mark image in this column anymore (it opens the hero as a
     full-width banner instead), so the nav starts at the top, level with
     the copy, rather than bottom-anchored. */
  .portal-hero__visual {
    justify-content: flex-start;
  }
}

/* Breadcrumb */
.portal-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  margin: 0 0 24px;
  min-height: 16px;
}

.portal-breadcrumb__link {
  color: var(--tap-on-dark-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.portal-breadcrumb__link:hover {
  color: var(--tap-hint);
}

/* Decorative and aria-hidden, so exempt from the contrast floor. */
.portal-breadcrumb__sep {
  color: rgba(255, 255, 255, 0.35);
}

.portal-breadcrumb__current {
  color: var(--tap-on-dark);
}

/* Eyebrow */
.portal-eyebrow {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: var(--tap-fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--network-accent-light);
  margin: 0 0 var(--tap-space-tight);
  min-height: 16px;
}

.portal-eyebrow::before {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--data-accent),
    var(--network-accent),
    var(--activity-accent)
  );
  flex-shrink: 0;
}

/* Title */
.portal-title {
  font-family: 'Archivo', system-ui, sans-serif;
  /* Same ceiling and slope as --tap-fs-title, but one ladder step lower at the
     floor (39 / 1.25 = 31): this headline is a full question rather than the
     apps' two-word landing titles, and at 39px it ran to seven lines on a
     390px screen. */
  font-size: clamp(31px, 27px + 1.2vw, 61px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--tap-on-dark);
  margin: 0 0 var(--tap-space-block);
  text-wrap: pretty;
}

/* Body text */
.portal-body {
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: var(--tap-fs-body);
  line-height: 1.6;
  color: var(--tap-on-dark-muted);
  margin: 0 0 var(--tap-space-tight);
  max-width: 58ch;
  text-wrap: pretty;
}

.portal-body a {
  color: var(--network-accent-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.portal-body a:hover {
  color: var(--tap-on-dark);
}

.portal-fn-ref {
  font-size: 12px;
  vertical-align: super;
  color: rgba(253, 250, 248, 0.65);
}

.portal-fn-ref a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  color: inherit;
  text-decoration: none;
}

.portal-fn-ref a:hover {
  text-decoration: underline;
  color: var(--tap-hint);
}

/* Quote */
.portal-quote {
  margin: 24px 0 0;
  padding-left: 24px;
  border-left: 2px solid;
  border-image: linear-gradient(
    to bottom,
    var(--data-accent),
    var(--network-accent),
    var(--activity-accent)
  ) 1;
}

.portal-quote blockquote {
  margin: 0;
}

.portal-quote blockquote p {
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: clamp(18px, 1.5vw, 22px);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--tap-on-dark);
  margin: 0;
}

.portal-quote figcaption {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.portal-quote__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--tap-primary-soft);
}

.portal-quote__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-quote__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--tap-on-dark);
}

.portal-quote__role {
  font-size: 14px;
  color: var(--tap-on-dark-dim);
}

/* ── HERO BANNER (full container width, opens the hero) ── */
.portal-hero__banner {
  margin: 0 0 var(--tap-hero-gap);
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--tap-primary), var(--tap-ink));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.5);
}

.portal-hero__banner img {
  display: block;
  width: 100%;
  height: auto;
  /* Source is 4:1 (1920x480) with the TAP mark in the bottom-left corner. */
  aspect-ratio: 1920 / 480;
  object-fit: cover;
  object-position: left bottom;
}

/* ── DATABASE NAVIGATION (hero right column) ──
   The portal exists to hand visitors on to Data, Network and Activity, so these
   sit in the hero rather than in a section below it. In a 560px column three
   16:10 picture cards would stack ~1050px tall, hence compact rows: thumbnail,
   name, scope, and a left edge in each database's own accent. */
.portal-db-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: var(--tap-visual-max);
  margin-top: 24px;
}

.portal-db-nav__title {
  margin: 0 0 8px;
  font-size: var(--tap-fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tap-on-dark);
}

.portal-db-link {
  --db-accent: var(--tap-primary);

  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--tap-border-on-dark);
  border-left: 3px solid var(--db-accent);
  border-radius: 8px;
  background: var(--tap-surface-elevated-dark);
  backdrop-filter: blur(8px);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.portal-db-link:hover {
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.22);
  border-left-color: var(--db-accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.portal-db-link--data {
  --db-accent: var(--data-accent);
}

.portal-db-link--network {
  --db-accent: var(--network-accent);
}

.portal-db-link--activity {
  --db-accent: var(--activity-accent);
}

.portal-db-link__thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.portal-db-link__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.portal-db-link__name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--tap-on-dark);
}

.portal-db-link__meta {
  font-size: 13px;
  line-height: 1.4;
  color: var(--tap-on-dark-muted);
}

.portal-db-link__arrow {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--tap-on-dark-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.portal-db-link:hover .portal-db-link__arrow {
  transform: translate(2px, -2px);
  color: var(--tap-on-dark);
}

.portal-db-link[aria-disabled="true"] {
  cursor: default;
  pointer-events: none;
  opacity: 0.45;
}

.portal-db-link[aria-disabled="true"]:hover {
  transform: none;
  box-shadow: none;
}

/* ── STAGGERED IMAGE GALLERY (hero right column) ── */
.portal-gallery {
  --gallery-col-w: clamp(108px, 11vw, 176px);
  display: flex;
  justify-content: center;
  gap: clamp(16px, 2vw, 32px);
  width: 100%;
  max-width: calc(var(--gallery-col-w) * 3 + 2 * 32px);
  margin-inline: auto;
  padding-inline: 12px;
}

.portal-gallery__col {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: var(--gallery-col-w);
}

/* Vertical offsets — staggered columns (mobile / stacked default) */
.portal-gallery__col--a {
  padding-top: 40px;
}

.portal-gallery__col--b {
  padding-top: 64px;
}

.portal-gallery__col--c {
  padding-top: 0;
}

.portal-gallery__frame {
  position: relative;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.portal-gallery__frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.portal-gallery__frame img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: center top;
  filter: sepia(8%) contrast(1.04) brightness(0.94);
  transition: filter 0.35s ease;
}

.portal-gallery__frame:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  z-index: 2;
}

.portal-gallery__frame:hover img {
  filter: sepia(0%) contrast(1.05) brightness(1);
}

.portal-gallery__frame--data::after {
  box-shadow: inset 0 0 0 1px rgba(14, 159, 143, 0.35);
}

.portal-gallery__frame--network::after {
  box-shadow: inset 0 0 0 1px rgba(79, 110, 247, 0.35);
}

.portal-gallery__frame--activity::after {
  box-shadow: inset 0 0 0 1px rgba(224, 122, 47, 0.35);
}

.portal-gallery__frame--activity img {
  object-position: center top;
}

.portal-gallery__frame--preview img {
  object-position: center top;
}

/* ── GALLERY HOVER CAPTIONS ── */
.portal-gallery__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 36px 12px 12px;
  background: linear-gradient(transparent, rgba(7, 10, 14, 0.92));
  font-family: 'Archivo', system-ui, sans-serif;
  font-style: italic;
  font-size: 12px;
  line-height: 1.35;
  color: var(--tap-surface);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.portal-gallery__caption span {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 10px;
  opacity: 0.7;
}

.portal-gallery__caption-source {
  font-size: 9px !important;
  opacity: 0.45 !important;
  margin-top: 4px !important;
  letter-spacing: 0.03em;
}

.portal-gallery__frame--activity .portal-gallery__caption { color: var(--activity-accent-light); }
.portal-gallery__frame--network  .portal-gallery__caption { color: var(--network-accent-pale); }
.portal-gallery__frame--data     .portal-gallery__caption { color: var(--data-accent-pale); }

.portal-gallery__frame:hover .portal-gallery__caption {
  opacity: 1;
}

/* ── EDITORIAL SECTION ── */
/* Footnotes only, now that the database navigation lives in the hero. */
.portal-editorial {
  position: relative;
  z-index: 5;
  border-top: 1px solid var(--tap-border-on-dark);
  padding: 32px 0;
}

.portal-editorial__footnotes {
  list-style: decimal;
  list-style-position: inside;
  padding: 0;
  margin: 0;
  max-width: 780px;
}

.portal-editorial__footnotes li {
  font-size: 12px;
  color: var(--tap-on-dark-dim);
  margin-top: 8px;
  line-height: 1.6;
}

.portal-editorial__footnotes a {
  color: var(--network-accent-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.portal-editorial__footnotes a:hover {
  color: var(--tap-on-dark);
}

/* ── FOOTER ── */
.portal-footer {
  position: relative;
  z-index: 5;
  background: var(--tap-bg-deep);
  border-top: 1px solid rgba(253, 250, 248, 0.1);
}

/* Light band — readable logos, harmonized with the surface palette */
.portal-footer__logos-band {
  background: var(--tap-surface);
  border-bottom: 1px solid rgba(20, 66, 91, 0.08);
  padding: clamp(20px, 3vw, 32px) 0;
}

.portal-footer__logos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: clamp(16px, 3vw, 32px);
}

.portal-footer__logos a {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  max-width: min(258px, 32%);
  line-height: 0;
  opacity: 0.92;
  transition: opacity 0.2s;
}

.portal-footer__logos a:hover {
  opacity: 1;
}

.portal-footer__logos img {
  display: block;
  height: clamp(32px, 5vw, 48px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.portal-footer__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 0 24px;
  font-size: 14px;
  color: var(--tap-on-dark-muted);
}

.portal-footer__links a {
  color: var(--tap-on-dark-muted);
  text-decoration: none;
  margin-left: 24px;
  transition: color 0.2s;
}

.portal-footer__links a:hover {
  color: var(--tap-hint);
}

/* ── ANIMATIONS ── */
@keyframes portal-fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portal-fade-up {
  animation: portal-fade-up 0.8s ease forwards;
}

.portal-delay-1 { animation-delay: 0.1s; opacity: 0; }
.portal-delay-2 { animation-delay: 0.25s; opacity: 0; }
.portal-delay-3 { animation-delay: 0.4s; opacity: 0; }
.portal-delay-4 { animation-delay: 0.55s; opacity: 0; }
.portal-delay-5 { animation-delay: 0.7s; opacity: 0; }

/* ── LEGAL PAGES HEADER (shared) ── */
.portal-header--legal {
  position: sticky;
  top: 0;
}

body.portal-legal-page {
  background: var(--tap-bg);
  color: var(--tap-on-dark);
}

/* ── LEGAL PAGE HEADER ──
   Horizontal eyebrow / title / rule block, the same one the Data and Network
   subpages use, so a legal page reads as a sibling of the landing. */
.portal-page-header {
  position: relative;
  z-index: 5;
  padding-block: 48px 40px;
  border-bottom: 1px solid var(--tap-border-on-dark);
}

.portal-page-header__eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 var(--tap-space-tight);
  font-size: var(--tap-fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.portal-page-header__eyebrow a {
  color: var(--network-accent-light);
  text-decoration: none;
  text-underline-offset: 4px;
}

.portal-page-header__eyebrow a:hover {
  color: var(--tap-hint);
  text-decoration: underline;
}

.portal-page-header__eyebrow span[aria-hidden] {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
}

.portal-page-header__current {
  font-weight: 500;
  color: var(--tap-on-dark-dim);
}

.portal-page-header__title {
  margin: 0 0 var(--tap-space-tight);
  font-size: var(--tap-fs-title);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--tap-on-dark);
}

.portal-page-header__rule {
  height: 4px;
  width: 64px;
  border-radius: 9999px;
  background: linear-gradient(
    90deg,
    var(--data-accent),
    var(--network-accent),
    var(--activity-accent)
  );
}

/* Transparent so the ambient layer drifts behind the legal copy too; the card
   below keeps its own elevated surface for reading contrast. */
.portal-legal-content {
  position: relative;
  z-index: 5;
  background: transparent;
  color: var(--tap-ink);
  padding: 48px 0 96px;
}

/* Same container geometry as .portal-container so the card's left edge lines up
   with the page header above it; the reading width lives on the inner card. */
.portal-legal-card {
  width: 100%;
  max-width: var(--tap-content-max);
  margin-inline: auto;
  padding-left: max(var(--tap-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--tap-gutter), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

/* Paper-on-glow: the reading card stays on the light surface for long-form
   contrast, but its top edge carries the same tri-colour accent as the
   Data/Network/Activity icons, so it still reads as part of the dark page
   rather than a foreign light box dropped onto it. */
.portal-legal-card__inner {
  max-width: 48rem;
  background: var(--tap-surface-elevated);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(20, 66, 91, 0.06);
  border-top: 3px solid;
  border-image: linear-gradient(
    90deg,
    var(--data-accent),
    var(--network-accent),
    var(--activity-accent)
  ) 1;
  padding: 32px;
}

.portal-legal-card h1 {
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 1.875rem;
  font-weight: 500;
  color: var(--tap-ink);
  margin: 0 0 32px;
  letter-spacing: -0.01em;
}

.portal-legal-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--tap-ink);
  margin: 24px 0 8px;
}

.portal-legal-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--tap-ink);
  margin: 16px 0 8px;
}

.portal-legal-card p {
  font-size: 1rem;
  line-height: 1.625;
  color: var(--tap-ink-muted);
  margin: 8px 0;
}

.portal-legal-card a {
  color: var(--tap-primary);
  text-decoration: none;
}

.portal-legal-card a:hover {
  color: var(--tap-hint);
  text-decoration: underline;
}

.portal-legal-card ul,
.portal-legal-card ol {
  margin: 8px 0;
  padding-left: 1.5rem;
}

.portal-legal-card li {
  font-size: 1rem;
  line-height: 1.625;
  color: var(--tap-ink-muted);
  margin: 4px 0;
}

.portal-legal-card ol.upper-roman {
  list-style-type: upper-roman;
  padding-left: 1.75rem;
}

.portal-legal-card ol.upper-roman > li {
  margin-bottom: 40px;
}

.portal-legal-card__section {
  margin-top: 40px;
}

.portal-legal-footer {
  position: relative;
  z-index: 5;
  border-top: 1px solid rgba(253, 250, 248, 0.1);
  padding: 24px 0;
  font-size: 14px;
  color: var(--tap-on-dark-muted);
  background: var(--tap-bg-deep);
}

.portal-legal-footer__inner {
  max-width: 48rem;
  margin-inline: auto;
  padding-inline: var(--tap-gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (min-width: 640px) {
  .portal-legal-footer__inner {
    flex-direction: row;
  }
}

.portal-legal-footer a {
  color: var(--tap-on-dark-muted);
  text-decoration: none;
  margin: 0 12px;
  transition: color 0.2s;
}

.portal-legal-footer a:hover {
  color: var(--tap-hint);
}

/* ── RESPONSIVE ── */
@media (min-width: 1024px) and (max-width: 1279px) {
  .portal-nav-label--long {
    display: none;
  }

  .portal-nav-label--short {
    display: inline;
  }
}

@media (min-width: 1024px) {
  .portal-nav {
    display: flex;
  }
}

@media (min-width: 1024px) {
  .portal-gallery__col--c {
    order: 1;
    padding-top: 0;
  }

  .portal-gallery__col--b {
    order: 2;
    padding-top: 96px;
  }

  .portal-gallery__col--a {
    order: 3;
    padding-top: 144px;
  }
}

@media (max-width: 1024px) {
  .portal-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .portal-gallery {
    --gallery-col-w: clamp(96px, 28vw, 140px);
    gap: 12px;
  }

  .portal-gallery__col {
    gap: 16px;
  }

  .portal-gallery__col--a {
    padding-top: 40px;
  }

  .portal-gallery__col--b {
    padding-top: 64px;
  }

  .portal-gallery__col--c {
    padding-top: 0;
  }

  .portal-footer__meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-footer__links a {
    margin-left: 0;
    margin-right: 16px;
  }

  .portal-footer__logos a {
    max-width: 30%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .portal-fade-up {
    animation: none;
    opacity: 1;
  }

  .portal-gallery__frame,
  .portal-card {
    transition: none;
  }
}

body.portal-menu-open {
  overflow: hidden;
}
