/* from-social-v2-nav try 2: nav fit + card actions + back-link contrast
   Linked last in <head> so it wins over inlined shell CSS. */

/* ---- 1) Menu button up to 1199px (site already does this at 959) ---- */
@media (max-width: 1199px) {
  .header-inner { flex-wrap: wrap; align-items: center; }
  .js .menu-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
    background: 0 0;
    color: var(--chrome-fg);
    border: 1px solid var(--chrome-accent, rgba(255,255,255,.25));
    border-radius: 999px;
    padding: .4rem .9rem;
    font: 600 .9rem var(--font-sans, system-ui, sans-serif);
    cursor: pointer;
    min-height: 44px;
    order: 3;
  }
  .js .theme-btn { order: 2; margin-left: 8px; }
  .header-inner .brand { flex: 1 1 0; min-width: 0; }
  .header-inner nav.main { order: 4; flex-basis: 100%; margin: 0; width: 100%; }
  /* menu-v1: panel absolute under header bar so hero is not covered by an expanded sticky header */
  .site-header .header-inner { position: relative; }
  .js nav.main {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    width: 100%;
    margin: 0;
    z-index: 50;
    overflow: visible;
    box-sizing: border-box;
    padding: .35rem 0 .6rem;
    background: var(--chrome-bg, var(--surface, #fff));
    border-top: 1px solid var(--line, rgba(255,255,255,.12));
    box-shadow: 0 12px 28px rgba(0,0,0,.16);
  }
  html[data-theme="dark"] .js nav.main {
    background: var(--chrome-bg, var(--surface, #0b1220));
    box-shadow: 0 12px 28px rgba(0,0,0,.45);
  }
  .js nav.main.open {
    display: block;
    max-height: calc(100vh - 5.5rem);
    max-height: calc(100dvh - 5.5rem);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .js nav.main.open ul {
    flex-direction: column;
    flex-wrap: wrap;
    white-space: normal;
    padding: .5rem 0;
  }
  .js nav.main.open a {
    font-size: 1rem;
    padding: .6rem .75rem;
    border-radius: var(--radius, 8px);
  }
  .js nav.main.open a[class^="e-"] {
    border-bottom: 0;
    box-shadow: inset 5px 0 0 var(--edge);
    padding: 12px 1rem;
    border-radius: 0;
  }
  /* hamburger -> X when open */
  .menu-btn[aria-expanded="true"] .mb-icon { background: transparent; }
  .menu-btn[aria-expanded="true"] .mb-icon::before { top: 0; transform: rotate(45deg); }
  .menu-btn[aria-expanded="true"] .mb-icon::after { top: 0; transform: rotate(-45deg); }
}

/* ---- 1b) At 1200+ keep full row; shrink so About isn't clipped ---- */
@media (min-width: 1200px) {
  .js .menu-btn { display: none; }
  .js nav.main { display: block; }
  .header-inner nav.main {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
  }
  nav.main {
    overflow-x: visible;
  }
  nav.main ul {
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
  }
  nav.main ul li a,
  nav.main ul li a[class^="e-"] {
    font-size: 14px;
    font-weight: 700;
    padding: 10px 7px 14px;
    min-height: 44px;
    box-sizing: border-box;
  }
}

/* Extra-tight band just above the menu breakpoint if still tight */
@media (min-width: 1200px) and (max-width: 1279px) {
  nav.main ul li a,
  nav.main ul li a[class^="e-"] {
    font-size: 13px;
    padding: 10px 5px 14px;
  }
}

/* ---- 2) Index card actions: consistent Read / Share / Deep dive ---- */
a.btn-read {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.2;
  text-decoration: none;
  color: #ffffff;
  background: #0B6E99;
  border: 2px solid #0B6E99;
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 44px;
  box-sizing: border-box;
}
a.btn-read:hover { background: #0a5a7d; border-color: #0a5a7d; }
a.btn-read:focus-visible {
  outline: 3px solid #F59E0B;
  outline-offset: 2px;
}

/* Dark mode: keep Read legible (light text on deep blue) */
:root[data-theme="dark"] a.btn-read {
  color: #e0f2fe;
  background: #0c4a6e;
  border-color: #38bdf8;
}
:root[data-theme="dark"] a.btn-read:hover {
  background: #075985;
}
/* Also when html has class/theme via prefers without data-theme=light set but dark pressed */
html[data-theme="dark"] a.btn-read {
  color: #e0f2fe;
  background: #0c4a6e;
  border-color: #38bdf8;
}

@media (max-width: 479px) {
  .fs-card-actions.card-toolbar {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  /* Undo display:contents so each control is a full-width row */
  .fs-card-actions .card-share,
  .fs-card-actions .card-deepdive {
    display: block;
    width: 100%;
  }
  .fs-card-actions a.btn-read,
  .fs-card-actions .btn-share,
  .fs-card-actions a.btn-deepdive {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    box-sizing: border-box;
  }
  .fs-card-actions .share-panel {
    width: 100%;
  }
}

/* ---- 3) Back link on teal page-head: white, underlined, both modes ---- */
.page-head .fs-back-top {
  margin: 0 0 .75rem;
  font-weight: 700;
}
.page-head .fs-back-top a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  font-weight: 700;
}
.page-head .fs-back-top a:hover,
.page-head .fs-back-top a:focus-visible {
  color: #ffffff;
  opacity: 0.92;
}

/* v4-9: header tools + search on site chrome */
.site-header .header-tools.site-header-tools{
  display:flex;flex-wrap:wrap;align-items:center;gap:.35rem;margin-left:auto
}
.site-header .header-tools .search-wrap{flex:1 1 140px;min-width:110px;max-width:240px}
.site-header .header-share .share-panel{
  position:absolute;right:0;top:calc(100% + 4px);z-index:50;background:var(--surface,var(--bg,#fff));
  border:1px solid var(--line,#c9d0d4);border-radius:10px;padding:.5rem;min-width:160px
}
.site-header .header-share{position:relative}
@media (max-width:720px){
  .site-header .header-tools.site-header-tools{width:100%;order:3;margin-left:0}
  .site-header .header-tools .search-wrap{max-width:none;flex:1 1 100%}
}

/* v4-14: mobile header stack — brand full width on row 1, tools on row 2.
   Root cause: .header-inner .brand { flex: 1 1 0; min-width: 0 } (above)
   lets the brand shrink beside .header-tools; tagline wraps and sits under
   the controls. width:100% wrap at 720px is unreliable on WebKit/iOS Safari.
   Desktop (768px+) unchanged. */
@media (max-width: 767px) {
  .header-inner {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: .45rem;
  }
  .header-inner .brand {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-right: 0;
  }
  .site-header .header-tools,
  .site-header .header-tools.site-header-tools,
  .header-tools {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    flex: 0 0 auto;
    min-width: 0;
    order: 3;
    box-sizing: border-box;
  }
  .site-header .header-tools .search-wrap,
  .header-tools .search-wrap,
  .search-wrap {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    order: 0; /* undo search-ui.css order:-1 at 420px so controls stay one row */
  }
  /* Tagline stays on ONE line (override inlined .sl2{display:block} at 759) */
  .brand-line {
    white-space: nowrap;
    flex-wrap: nowrap;
  }
  .brand-strap {
    font-size: 12px;
    letter-spacing: 0;
    align-items: center;
    line-height: 1.2;
    white-space: nowrap;
  }
  .brand-strap .sl,
  .brand-strap .sl1,
  .brand-strap .sl2 {
    display: inline;
    white-space: nowrap;
  }
  .brand-strap .sl2 {
    display: inline !important;
  }
  .wm {
    max-width: min(278px, calc(100vw - 5rem));
    height: auto;
  }
}

@media (max-width: 399px) {
  .brand-strap {
    font-size: 11px;
  }
}
/* Last resort: hide tagline below 360px rather than wrap */
@media (max-width: 359px) {
  .brand-strap {
    display: none;
  }
}


/* menu-v4-15f: outside-tap backdrop (under raised header while open) */
.mrh-menu-backdrop{
  display:none;
  position:fixed;
  inset:0;
  z-index:45;
  background:transparent;
  -webkit-tap-highlight-color:transparent;
}
html.mrh-menu-open .mrh-menu-backdrop{display:block;}
html.mrh-menu-open .site-header{z-index:60;}
