/* This site runs the Valley Air Design System at its intended html{font-size:1px}
   root (set by vad.dev.css). Bootstrap 4 is loaded for its px-based grid ONLY
   (container/row/col-*, flex and display utilities). Never use Bootstrap's
   rem-based classes in views (p-*/m-*, .btn, .card, .alert, .h1-.h6, .close,
   .form-control-lg) — under the 1px root they collapse to near-zero. Use the
   VAD equivalents instead: padding-*-N / margin-*-N / no-margin, .vad-button,
   .vad-card, .vad-message, and VAD's own .form-control styling. */

html {
  position: relative;
  min-height: 100%;
}

/* Visible keyboard-focus ring (px, not rem — see note above). */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 2px white, 0 0 0 4px #258cfb;
}

/* Keep full-width form controls flush with sibling buttons regardless of
   vendored-CSS box-model quirks. */
.form-control {
  box-sizing: border-box;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* asp-validation-summary renders an (empty) container even when there are no
   errors; without this it would paint an empty .vad-message--error box. */
.validation-summary-valid {
  display: none;
}

/* Footer text at 75% of the design system's fluid base size (25% reduction
   requested). rem here is intentional — 1rem = 1px under the VAD root. */
.site-footer {
  font-size: calc(10.5rem + 0.3vw);
}

.vad-footer {
  font-size: calc(10.5rem + 0.3vw);
}

/* Tighten VAD's default 1em vertical margin around the footer logo. */
.footer-logo {
  margin: 0.25em 0;
}

/* ── Topic cards ─────────────────────────────────────────────────────────────
   Fixed card height (UI/UX Phase 1): baseline content minimum ~160px, +25%
   (200px), then +25% again per review = 250px. Pinned so cards never grow or
   shrink from it. Adjust the variable to tune all cards at once. */
:root {
  --topic-card-height: 250px;
}

.topic-card {
  height: var(--topic-card-height);
  min-height: var(--topic-card-height);
  max-height: var(--topic-card-height);
  overflow: hidden; /* hard-clip anything that escapes, preserving the card radius */
}

/* Every level of a nested flex column needs min-height:0, or content min-size
   wins and the level silently overflows instead of constraining its children —
   without this on the body, the description wrapper never scrolls. */
.topic-card .vad-card__body {
  min-height: 0;
}

/* Topic title (UI/UX Phase 3): breathing room between the name and the
   description below it (color comes from vad-text--primary on the element).
   Capped at ~3 lines (staging finding 2026-10-09: one GovDelivery topic name
   was long enough to push the description AND the checkboxes out of the
   fixed-height card). Past the cap the title scrolls inside its own box, the
   same treatment long descriptions get below. flex-shrink: 0 keeps the
   description from squeezing the title when both are long. */
.topic-card__title {
  padding-bottom: 0.4em;
  line-height: 1.3;
  max-height: calc(1.3em * 3 + 0.4em); /* three lines + the bottom padding */
  overflow-y: auto;
  overflow-wrap: break-word;
  flex-shrink: 0;
}

/* Description wrapper (UI/UX Phase 2): fills the space between the title and
   the bottom-pinned checkbox row; long descriptions wrap normally and scroll
   inside the wrapper instead of being clipped by the fixed card height. */
.topic-card__description {
  flex-grow: 1;
  min-height: 0; /* required for overflow to engage inside a flex column */
  overflow-y: auto;
  overflow-wrap: break-word;
}

/* ── Login page: available-topics preview ────────────────────────────────────
   A .vad-expandable-list of categories → topics (page-elements.md pattern).
   Topic entries are plain text (spans, not links), so vads.js's toggle
   handler — bound to every <a> in the list — leaves them alone. */
.topic-preview .vad-expandable-list > li > ul {
  padding-top: 0.25em;
  padding-bottom: 0.5em;
}

.topic-preview .vad-expandable-list > li > ul > li {
  padding: 0.35em 0;
}

.topic-preview__name {
  font-weight: 600;
}

/* ── Google Translate language picker (ported from valleyair.org) ────────────
   Markup in _LanguageToggle.cshtml, behavior in js/vad-lang.js. All sizes are
   px on purpose (1px-root rule: rem is unusable, and these values match the
   main site's control). */

/* Keep the (now hidden) Google source out of layout. */
.gt-source-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
}

/* Banner stays hidden. Newer Google banners ship as an iframe carrying only
   .skiptranslate (no .goog-te-banner-frame), which slipped past the old
   compound selector and overlaid the nav, so match the iframe directly. */
.goog-te-banner-frame,
iframe.skiptranslate { display: none !important; }
/* Google shifts the body down to make room for the banner; cancel that. */
body { top: 0 !important; }
#goog-gt-tt, .goog-te-balloon-frame { display: none !important; }

/* Portal-specific: the hero's flex-end container doesn't size the control the
   way the website's grid columns did, so give it a width of its own. */
.gt-iconwrap {
  position: relative;
  width: 250px;
  max-width: 100%;
}

.vad-lang {
  position: relative;
  width: 100%;
}

.vad-lang__button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: #fff;
  border: 2px solid var(--set-color-primary, #0b3f8a);
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
  color: var(--set-color-primary, #0b3f8a);
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
}

.vad-lang__button[disabled] {
  opacity: 0.7;
  cursor: default;
}

.vad-lang__button:focus-visible {
  outline: 2px solid var(--set-color-primary, #0b3f8a);
  outline-offset: 1px;
}

.vad-lang__globe { font-size: 16px; flex: 0 0 auto; }
.vad-lang__current {
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.vad-lang__chevron { font-size: 12px; flex: 0 0 auto; }
.vad-lang__button[aria-expanded="true"] .vad-lang__chevron { transform: rotate(180deg); }

.vad-lang__list {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 4px);
  right: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  max-height: 360px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.vad-lang__list:focus-visible { outline: none; }

.vad-lang__option {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 16px;
  cursor: pointer;
}

.vad-lang__option:hover,
.vad-lang__option.is-active {
  background: #eef2f8;
}

.vad-lang__option[aria-selected="true"] {
  background: var(--set-color-primary, #0b3f8a);
}
.vad-lang__option[aria-selected="true"] .vad-lang__primary,
.vad-lang__option[aria-selected="true"] .vad-lang__secondary {
  color: #fff;
}

.vad-lang__primary {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.2;
}

.vad-lang__secondary {
  font-size: 12px;
  color: #64748b;
  line-height: 1.2;
}

/* ── Dashboard action bar (Log Out / Unsubscribe / Update) ─────────────────
   Three buttons that used to sit in a single non-wrapping flex row and
   collided on 320–375px phones. flex-wrap lets the row break; the gap keeps
   wrapped buttons apart. Order is the same on every screen size. */
.topic-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5em;
}

/* ── Flex-gap fallback for older iOS Safari (< 14.5, 2021) ──────────────────
   Those browsers ignore `gap` on flex containers, so the A–Z buttons, the
   Email/Text checkbox pair, the modal buttons and the action bar would butt
   together. @supports not (gap) applies margins ONLY where gap is missing, so
   modern browsers never get doubled spacing. */
@supports not (gap: 1em) {
  .topic-alpha-filter__btn { margin: 0.125em; }
  .topic-card .form-check { margin: 0 0.75em; }
  .topic-actions > * { margin: 0.25em; }
  .vad-modal .vad-button { margin: 0.375em; }
}

/* ── Keyboard focus in Windows contrast themes (security review PSGN-041) ──
   Windows "contrast themes" switch the browser into forced-colors mode, which
   computes every box-shadow to none. vad.dev.css draws keyboard focus with
   box-shadow and removes the outline with !important, so in that mode NO
   focus indicator remained anywhere — a keyboard user tabbing through the
   Unsubscribe dialog could not see whether Enter would press Cancel or
   "Yes". Restore an outline in a system colour: `Highlight` is a CSS system
   colour keyword, so the browser keeps it in the user's chosen palette
   (non-system colours are replaced in forced-colors mode). Same selector
   and !important as the design-system rule; site.css loads after
   vad.dev.css, so this later declaration wins. Applies ONLY while forced
   colours are on — the normal focus ring is unchanged.
   (Reported upstream to the design-system maintainers.) */
@media (forced-colors: active) {
  :focus-visible {
    outline: 2px solid Highlight !important;
    outline-offset: 2px;
  }
}
