/* =========================================================
   nomoreh1bs.com styles
   Colors and fonts for each mode live in the two blocks
   right below. Change them there and they apply sitewide.
   ========================================================= */

:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);

  /* Light mode */
  --bg: #F4F6F8;
  --ink: #172131;
  --muted: #4B5668;
  --accent: #1D4F91;
  --rule: #D3DAE3;
  --ph: #E7EDF4;
  --body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --head: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --measure: 68ch;
}

:root[data-theme="dark"] {
  /* Dark mode */
  --bg: #0C1412;
  --ink: #D8D1BC;
  --muted: #999380;
  --accent: #86A57C;
  --rule: #25352F;
  --ph: #13201C;
  --body: "EB Garamond", Garamond, "Times New Roman", serif;
  --head: "IM Fell English", "EB Garamond", Garamond, serif;
  --measure: 64ch;
}

html { scroll-padding-top: env(safe-area-inset-top, 0px); }
*, *::before, *::after { box-sizing: inherit; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.6;
}
[data-theme="dark"] body { font-size: 1.1875rem; line-height: 1.7; }
img { max-width: 100%; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout: sections down the left side ---------- */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
.side {
  position: sticky; top: env(safe-area-inset-top, 0px); align-self: start;
  height: calc(100vh - env(safe-area-inset-top, 0px)); overflow-y: auto;
  border-right: 1px solid var(--rule);
  padding: 1.5rem 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.mark {
  align-self: flex-start; display: inline-flex; align-items: baseline; white-space: nowrap;
  font-family: "Fredoka", "Public Sans", sans-serif; font-weight: 500; line-height: 1;
  color: var(--ink); text-decoration: none;
}
.mark-n { font-size: 1.65rem; }
.mark-o { width: 1.2rem; height: 1.4rem; margin: 0 .06rem; align-self: baseline; transform: translateY(.1rem); }
.mark-rest { font-size: 1.45rem; }
.side > .mark { margin-bottom: .3rem; }
.side > .toggle { margin-bottom: .9rem; }
.mark-o ellipse, .mark-o line { stroke: #C8102E; }
[data-theme="dark"] .mark-o ellipse, [data-theme="dark"] .mark-o line { stroke: var(--accent); }
.mark:hover .mark-rest, .mark:hover .mark-n { color: var(--accent); }

nav ul { list-style: none; margin: 0; padding: 0; }
nav a { display: block; padding: .3rem 0; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
[data-theme="dark"] nav a { font-size: 1.1rem; }
[data-theme="dark"] nav a[aria-current="page"] { font-weight: 500; font-style: italic; }

.x-link {
  align-self: flex-start; margin: auto 0 0 -.8rem; padding: .45rem .8rem;
  font-size: .85rem; font-weight: 600; color: #fff; text-decoration: none;
  background: #173A6B; border: 0; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(23, 33, 49, .25);
  transition: box-shadow .2s ease, background .2s ease;
}
.x-link:hover { color: #fff; background: #122E55; box-shadow: 0 4px 14px rgba(23, 33, 49, .32); }
[data-theme="dark"] .x-link { font-weight: 400; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }

/* Light/dark switch */
.toggle {
  align-self: flex-start; display: inline-flex; align-items: center; gap: .55rem;
  font: inherit; font-size: .85rem; font-weight: 600; color: var(--ink);
  background: transparent; border: 0; padding: .2rem 0; cursor: pointer;
}
.switch {
  position: relative; width: 2.6rem; height: 1.4rem; border-radius: 999px;
  border: 2px solid var(--ink); background: transparent; transition: background .2s ease;
}
.switch i {
  position: absolute; top: 2px; left: 2px; width: calc(1.4rem - 8px); height: calc(1.4rem - 8px);
  border-radius: 50%; background: var(--ink); transition: transform .2s ease;
}
.toggle[aria-checked="true"] .switch i { transform: translateX(1.2rem); }

/* ---------- Page content ---------- */
main { padding: clamp(2rem, 6vw, 4rem) clamp(1rem, 4vw, 2.5rem) 6rem; }
.page { max-width: var(--measure); }
.page.wide { max-width: 72rem; }
.page.wide > p, .page.wide > blockquote, .page.wide > ul, .page.wide > ol { max-width: var(--measure); }

h1 {
  font-family: var(--head); font-weight: 800; font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.05; letter-spacing: -.025em; margin: 0 0 1rem;
}
[data-theme="dark"] h1 { font-weight: 400; letter-spacing: 0; line-height: 1.1; }
h2 { font-family: var(--head); font-size: 1.35rem; line-height: 1.25; margin: 2.75rem 0 .75rem; }
[data-theme="dark"] h2 { font-weight: 400; font-size: 1.6rem; }
h3 { font-family: var(--head); font-size: 1.1rem; margin: 2rem 0 .5rem; }
[data-theme="dark"] h3 { font-weight: 400; font-size: 1.4rem; }
h2, h3 { scroll-margin-top: 1.5rem; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 4rem 0 0; }

/* The first paragraph under a page title reads as an intro */
h1 + p { font-size: 1.2rem; color: var(--muted); margin: 0 0 2rem; }

/* Regular quotes */
blockquote { margin: 1.5rem 0; padding-left: 1.1rem; border-left: 3px solid var(--rule); color: var(--muted); font-style: italic; }
blockquote p { margin: .4rem 0; }

/* Placeholder boxes: a quote starting with "To write" or "Tentative" */
blockquote.ph {
  background: var(--ph); border: 1px dashed var(--rule); border-radius: 6px;
  padding: 1rem 1.1rem; font-style: normal;
}
blockquote.ph strong { color: var(--ink); }

/* Buttons: <a class="btn" href="...">Label</a> in a page file */
.btn {
  display: inline-block; margin: .5rem 0; padding: .65rem 1.1rem; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
}
[data-theme="dark"] .btn { color: var(--bg); }

/* Tables scroll sideways on small screens instead of breaking the page */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; background: var(--ph); }
tr:last-child td { border-bottom: 0; }

.loading, .error { color: var(--muted); }

/* ---------- Bestiary (Necronomicon) ---------- */
.bestiary { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0 2.5rem; margin-top: 1rem; }
.creature { padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.creature h3 { font-size: 1.7rem; margin: 0; line-height: 1.15; }
.creature .src { font-style: italic; color: var(--muted); margin: .15rem 0 .6rem; }
.creature blockquote.ph { padding: .6rem .8rem; font-size: 1rem; margin: 0; }

/* ---------- Home page layout ----------
   The menu stays in the left column; the main story, tracker and
   everything after them stack in the right column. */
@media (min-width: 701px) {
  [data-page="home"] .shell {
    grid-template-columns: 16rem minmax(0, 1fr); column-gap: clamp(1.5rem, 4vw, 3.5rem);
    max-width: 86rem; padding: clamp(1.5rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2.5rem) 6rem;
  }
  [data-page="home"] main, [data-page="home"] .page { display: contents; }
  [data-page="home"] .side { position: static; height: auto; border-right: 0; padding: 0; overflow: visible; }
  [data-page="home"] .page > * { grid-column: 2; }
  [data-page="home"] .page > [data-widget="main-story"] { grid-column: 2; grid-row: 1; }
  [data-page="home"] .x-link { margin-top: 5rem; }
  [data-page="home"] .home-aside > hr { margin-top: 2rem; }
  [data-page="home"] .story { max-width: none; }
}

/* Wide desktop screens: the home-aside section (see content/light/home.md) moves into a right-hand column */
@media (min-width: 1700px) {
  [data-page="home"] .shell { grid-template-columns: 16rem minmax(0, 1fr) 22rem; max-width: 124rem; }
  [data-page="home"] .page > .home-aside { grid-column: 3; grid-row: 1 / span 2; align-self: start; }
  [data-page="home"] .home-aside > hr { display: none; }
  [data-page="home"] .home-aside > h2:first-of-type { margin-top: 0; }
  [data-page="home"] .home-aside .info-cards { grid-template-columns: 1fr; }
}

/* ---------- Immigration info article blocks (home page) ---------- */
.info-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
.info-card {
  display: flex; flex-direction: column; overflow: hidden;
  color: inherit; text-decoration: none; background: #fff;
  border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(23, 33, 49, .05); transition: box-shadow .2s ease;
}
.info-card:hover { box-shadow: 0 6px 20px rgba(23, 33, 49, .12); }
.info-photo { position: relative; aspect-ratio: 16 / 9; background: var(--ph); border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; }
.info-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.info-photo span { border: 2px dashed var(--rule); border-radius: 6px; padding: .5rem 1.1rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.info-body { display: flex; flex-direction: column; gap: .35rem; flex: 1; padding: .8rem 1rem 1rem; }
.info-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.25; }
.info-card p { margin: 0; font-size: .92rem; line-height: 1.45; color: var(--muted); }
.info-card .soon { font-style: italic; }
.info-more, .info-all { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; font-weight: 700; color: var(--accent); }
.info-more { margin-top: auto; padding-top: .3rem; }
.info-more svg, .info-all svg { width: 1em; height: 1em; }
.info-card:hover .info-more, .info-all:hover { text-decoration: underline; text-underline-offset: 3px; }
.info-all { margin-top: .9rem; text-decoration: none; }

/* ---------- Main story (edit it in main-story.json) ---------- */
.kicker { margin: 0 0 .3rem; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.story {
  display: block; max-width: 46rem; color: inherit; text-decoration: none;
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: #fff;
  box-shadow: 0 1px 2px rgba(23, 33, 49, .05);
  transition: box-shadow .2s ease;
}
.story:hover { box-shadow: 0 6px 20px rgba(23, 33, 49, .12); }
.story-media { position: relative; aspect-ratio: 16 / 9; max-height: 34rem; width: 100%; overflow: hidden; background: var(--ph); }
.story-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.story-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.story-fallback span {
  border: 2px dashed var(--rule); border-radius: 6px; padding: .8rem 1.6rem;
  font-size: .9rem; font-weight: 600; color: var(--muted);
}
.story-media.has-img .story-fallback { display: none; }
.story-text { padding: 1rem 1.4rem 1.2rem; border-top: 1px solid var(--rule); }
.story-title { font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: 1.05; letter-spacing: -.025em; margin: 0 0 .5rem; }
.story-summary { font-size: 1.05rem; color: var(--muted); margin: 0 0 .5rem; }
.story-cta { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--accent); }
.story-cta svg { width: 1.1em; height: 1.1em; transition: transform .2s ease; }
.story:hover .story-cta { text-decoration: underline; text-underline-offset: 3px; }
.story:hover .story-cta svg { transform: translateX(4px); }
.story:focus-visible { outline-offset: 4px; }

/* ---------- H-1B Tracker (home page) ---------- */
#tracker { scroll-margin-top: 1rem; margin-top: clamp(1.75rem, 3vw, 2.5rem); }
.t-title, .home-aside > h2 { margin: 0 0 1rem; font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 800; letter-spacing: -.02em; }
.home-aside > h2 { margin-top: 2.5rem; }
.t-grid {
  display: grid; grid-template-columns: 15.5rem minmax(0, 1fr) 15rem;
  gap: 1.25rem; align-items: start;
}

/* Left: search box and stat cards */
.t-controls {
  display: flex; flex-direction: column; gap: .7rem;
  border: 1px solid var(--rule); border-radius: 8px; background: #fff; padding: .85rem;
}
.t-controls label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--ink); }
.t-controls select, .t-controls input {
  font: inherit; font-size: .95rem; color: var(--ink); background: #fff; width: 100%;
  border: 1px solid var(--rule); border-radius: 6px; padding: .5rem .6rem;
}
.t-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; margin: .7rem 0 0; }
.t-stats div {
  display: flex; flex-direction: column; gap: .35rem; min-width: 0; container-type: inline-size;
  border: 1px solid var(--rule); border-radius: 8px; background: #fff; padding: .55rem .4rem .6rem;
}
.t-stats dt { font-size: .72rem; font-weight: 600; color: var(--muted); }
.t-stats dd {
  margin: 0; font-size: min(1rem, 22cqi); font-weight: 800; line-height: 1.1; white-space: nowrap;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}

/* Middle: source line and map */
.t-source { margin: 0 0 .4rem; font-size: .78rem; color: var(--muted); line-height: 1.4; }
.tracker-map { height: 24rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--ph); z-index: 0; }

/* Right: Top Employers */
.t-top-title { margin: 0 0 .5rem; font-size: 1.1rem; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.t-list { list-style: none; margin: 0; padding: 0; }
.t-list li + li { border-top: 1px solid var(--rule); }
.t-row {
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .4rem; align-items: baseline;
  width: 100%; font: inherit; text-align: left; color: var(--ink); background: none; border: 0;
  padding: .55rem .25rem; cursor: pointer; border-radius: 4px;
}
.t-row:hover { background: var(--ph); }
.t-rank { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.t-name { font-size: .9rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.t-name small { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); }
.t-val { font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.t-empty { color: var(--muted); margin: .5rem 0; }
.t-more-row { display: flex; justify-content: space-between; align-items: center; margin: .4rem 0 0; }
.t-more, .t-less {
  display: block; margin: 0 0 0 auto; font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--accent); background: none; border: 0; padding: .3rem .25rem; cursor: pointer;
}
.t-less { margin: 0 auto 0 0; }
.t-more:hover, .t-less:hover { text-decoration: underline; }
.t-more[hidden], .t-less[hidden] { display: none; }
.tracker-note { font-size: .75rem; line-height: 1.45; color: var(--muted); margin: .8rem 0 0; }

/* Map pins and clusters */
.pin { background: none; border: 0; }
.pin svg { width: 20px; height: 27px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.pin path { fill: var(--accent); }
.pin circle { fill: #fff; }
.leaflet-marker-icon.pin-cluster {
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--accent); color: #fff; font: 700 .8rem var(--body);
  box-shadow: 0 0 0 5px rgba(29, 79, 145, .25);
}
.pin-pop strong { display: block; font-size: 1rem; }
.pin-pop .pp-sub { display: block; color: var(--muted); font-size: .8rem; }
.pin-pop ol { margin: .5rem 0; padding: 0; list-style: none; }
.pin-pop li { display: flex; justify-content: space-between; gap: 1rem; padding: .15rem 0; border-top: 1px solid var(--rule); }
.pin-pop li b { font-variant-numeric: tabular-nums; }
.leaflet-container { font-family: var(--body); }
/* Gray map so the pins stand out */
.tracker-map .leaflet-tile-pane { filter: grayscale(1) brightness(1.04) contrast(.9); }

/* ---------- "Outsourced" banner (light mode only) ---------- */
.banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: .8rem clamp(2.25rem, 3vw, 2.5rem) .8rem clamp(1rem, 4vw, 2.5rem);
  padding-bottom: calc(.8rem + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg);
  display: flex; align-items: center; gap: 1rem;
}
.banner p { margin: 0; flex: 1; }
.banner a { color: inherit; font-weight: 600; }
.banner-link { flex: none; white-space: nowrap; }
.banner button {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: clamp(2.25rem, 3vw, 2.5rem); background: transparent; border: 0; color: inherit; cursor: pointer;
  font-size: 1.5rem; line-height: 1; padding: .25rem 0;
}
.banner[hidden] { display: none; }

/* ---------- Mode switch transition ---------- */
.veil { position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0; background: #0C1412; transition: opacity .35s ease; }
.veil.on { opacity: 1; }
.veil.to-light { background: #F4F6F8; }
@media (prefers-reduced-motion: reduce) { .veil { transition: none; } }

/* ---------- Narrower screens: Top Employers moves under the search and map ---------- */
@media (max-width: 1320px) {
  .t-grid { grid-template-columns: 15.5rem minmax(0, 1fr); }
  .t-right { grid-column: 1 / -1; }
  .t-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); column-gap: 1.5rem; }
  .t-list li + li { border-top: 0; }
  .t-list li { border-bottom: 1px solid var(--rule); }
}
@media (max-width: 1000px) {
  .t-grid { grid-template-columns: 1fr; }
}

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule);
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 1rem;
  }
  nav { flex-basis: 100%; }
  nav ul { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
  nav li, nav li:first-child { border: 0; }
  .x-link { margin: 0; }
  .side > .mark, .side > .toggle { margin-bottom: 0; }
  .banner { flex-wrap: wrap; row-gap: .35rem; }
  .banner p { flex-basis: 100%; }
  .banner-link { order: 3; flex-basis: 100%; }
  .t-grid { grid-template-columns: 1fr; }
  .story-text { padding: .9rem 1rem 1rem; }
  .tracker-map { height: 20rem; }
}
