/* ============================================================
   NEW YORK SAFETY TRACK — Legal History Site
   style.css — mobile-first, shared across all pages
   ============================================================ */

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette */
  --black:      #0a0a0b;
  --dark:       #111214;
  --surface:    #18191d;
  --surface2:   #1f2126;
  --border:     #2a2d35;
  --muted:      #3a3e4a;
  --text-dim:   #7a8294;
  --text-mid:   #a8b0c0;
  --text:       #d8dce8;
  --white:      #f0f2f7;
  --accent:     #c0392b;
  --accent2:    #e67e22;
  --accent-dim: #7a1c12;
  --link:       #5b8fd4;

  /* Typography */
  --font-display: 'Georgia', 'Times New Roman', serif;
  --font-body:    system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'Courier New', Courier, monospace;

  /* Spacing — mobile base values */
  --sp-xs: 0.375rem;
  --sp-sm: 0.625rem;
  --sp-md: 1rem;
  --sp-lg: 1.25rem;
  --sp-xl: 2rem;
  --sp-2xl: 3.5rem;

  /* Layout */
  --max-w: 860px;
  --max-w-wide: 1100px;

  /* Nav */
  --nav-h: 52px;
}

html {
  scroll-behavior: smooth;
  /* Prevent font size inflation on iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* Prevent horizontal overflow */
  overflow-x: hidden;
}

img, video, iframe { max-width: 100%; height: auto; display: block; }

/* --- Skip link -------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 3px;
  font-size: 0.85rem;
  z-index: 1000;
  transition: top 0.2s;
}
.skip-link:focus { top: 0.75rem; }

/* ============================================================
   NAV — mobile-first with hamburger
   ============================================================ */
.site-nav {
  background: var(--dark);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 1rem;
  max-width: var(--max-w-wide);
  margin: 0 auto;
}

.site-nav__brand {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: normal;
  color: var(--white);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  flex-shrink: 0;
  /* Ensure brand never gets squeezed off */
  min-width: 0;
  margin-right: auto;
}
.site-nav__brand span {
  color: var(--accent);
  font-style: italic;
}

/* Hamburger toggle button */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  margin-left: 1rem;
  /* Larger tap target */
  position: relative;
}
.nav-toggle::before {
  content: '';
  position: absolute;
  inset: -12px;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-mid);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s, background 0.15s;
}
.nav-toggle:hover span,
.nav-toggle[aria-expanded="true"] span { background: var(--white); }

/* Animated X when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Mobile nav links: hidden drawer */
.site-nav__links {
  list-style: none;
  /* Full-width dropdown below the bar */
  position: absolute;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--dark);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0 1rem;
  /* Hidden by default */
  max-height: 0;
  overflow: hidden;
  visibility: hidden;
  transition: max-height 0.28s ease, visibility 0s 0.28s;
}
.site-nav__links.is-open {
  max-height: 500px;
  visibility: visible;
  transition: max-height 0.28s ease, visibility 0s 0s;
}

.site-nav__links li { width: 100%; }
.site-nav__links a {
  display: block;
  color: var(--text-mid);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.65rem 1.25rem;
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.site-nav__links a:hover,
.site-nav__links a.active {
  color: var(--white);
  border-left-color: var(--accent);
  background: var(--surface);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  background: var(--dark);
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 1rem 1.25rem;
}
.page-header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
  border: 1px solid var(--accent-dim);
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 6vw, 3rem);
  font-weight: normal;
  line-height: 1.18;
  color: var(--white);
  margin-bottom: 0.6rem;
  /* Allow long words to wrap */
  overflow-wrap: break-word;
  word-break: break-word;
}
.page-header h1 em {
  color: var(--text-dim);
  font-style: italic;
}

.page-header__sub {
  font-size: 0.975rem;
  color: var(--text-mid);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.page-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.page-header__meta span::before {
  content: '▸ ';
  color: var(--accent);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.site-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* ============================================================
   TABLE OF CONTENTS
   ============================================================ */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}
.toc h2 {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  font-weight: normal;
}
.toc ol {
  list-style: none;
  counter-reset: toc-counter;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.toc ol li {
  counter-increment: toc-counter;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.toc ol li::before {
  content: counter(toc-counter, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  flex-shrink: 0;
}
.toc a {
  color: var(--text-mid);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
  /* Readable tap target */
  padding: 0.15rem 0;
  display: inline-block;
}
.toc a:active,
.toc a:hover { color: var(--white); }

/* ============================================================
   SECTION BLOCKS
   ============================================================ */
.section {
  margin-bottom: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.section:first-of-type { border-top: none; padding-top: 0; }

.section-marker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.section-marker__num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  border: 1px solid var(--accent-dim);
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
}
.section-marker__date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 5vw, 1.9rem);
  font-weight: normal;
  color: var(--white);
  margin-bottom: 0.85rem;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.section p {
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 0.975rem;
  line-height: 1.72;
}
.section p:last-child { margin-bottom: 0; }

/* Sub-headings */
.section h3 {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent2);
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   CALLOUT BOXES
   ============================================================ */
.callout {
  border-radius: 4px;
  padding: 0.875rem 1rem;
  margin: 1.25rem 0;
  font-size: 0.92rem;
  line-height: 1.6;
  /* Prevent text from overflowing callout on narrow screens */
  overflow-wrap: break-word;
  word-break: break-word;
}
.callout--warning {
  background: rgba(192,57,43,0.1);
  border: 1px solid rgba(192,57,43,0.35);
  border-left: 3px solid var(--accent);
}
.callout--ruling {
  background: rgba(91,143,212,0.08);
  border: 1px solid rgba(91,143,212,0.25);
  border-left: 3px solid var(--link);
}
.callout--finding {
  background: rgba(230,126,34,0.08);
  border: 1px solid rgba(230,126,34,0.25);
  border-left: 3px solid var(--accent2);
}
.callout--status {
  background: rgba(39,174,96,0.07);
  border: 1px solid rgba(39,174,96,0.2);
  border-left: 3px solid #27ae60;
}
.callout__label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  display: block;
}

/* ============================================================
   BLOCKQUOTES
   ============================================================ */
blockquote {
  border-left: 3px solid var(--muted);
  margin: 1.25rem 0;
  padding: 0.5rem 0 0.5rem 1rem;
}
blockquote p {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-mid);
  font-size: 0.975rem;
  line-height: 1.6;
  margin-bottom: 0.35rem !important;
  overflow-wrap: break-word;
  word-break: break-word;
}
blockquote cite {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  font-style: normal;
}

.quote-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}
.quote-block__label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.quote-block blockquote {
  border: none;
  padding: 0;
  margin: 0;
}

/* ============================================================
   LISTS
   ============================================================ */
.section ul, .section ol {
  padding-left: 1.25rem;
  margin: 0.875rem 0;
}
.section ul {
  list-style: none;
  padding-left: 0;
}
.section ul li {
  padding-left: 1.25rem;
  position: relative;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: var(--text);
  line-height: 1.55;
}
.section ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* Fact list */
.fact-list {
  list-style: none;
  padding: 0;
  margin: 0.875rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.fact-list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.5;
}
.fact-list li::before {
  content: '◆';
  color: var(--accent);
  font-size: 0.45rem;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

/* ============================================================
   TABLES — stack on mobile
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  /* smooth momentum scrolling on iOS */
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  /* Prevent table from collapsing too narrow */
  min-width: 380px;
}
thead { border-bottom: 2px solid var(--border); }
thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.5rem 0.75rem 0.5rem 0;
  font-weight: normal;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody td {
  padding: 0.6rem 0.75rem 0.6rem 0;
  vertical-align: top;
  color: var(--text);
  line-height: 1.5;
}
tbody tr:hover td { background: var(--surface); }

/* ============================================================
   HIGHLIGHT BLOCKS
   ============================================================ */
.key-finding {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent2);
  border-radius: 4px;
  padding: 0.875rem 1rem;
  margin: 1.25rem 0;
  overflow-wrap: break-word;
}
.key-finding__label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.key-finding__label::before { content: '⚠'; }
.key-finding p { font-size: 0.92rem; color: var(--text); margin-bottom: 0; }

.ruling {
  background: var(--surface);
  border: 1px solid rgba(91,143,212,0.25);
  border-left: 3px solid var(--link);
  border-radius: 4px;
  padding: 0.875rem 1rem;
  margin: 1.25rem 0;
  overflow-wrap: break-word;
}
.ruling__label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--link);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ruling__label::before { content: '⚖'; }
.ruling p { font-size: 0.92rem; color: var(--text); margin-bottom: 0; }

.status-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #27ae60;
  border-radius: 4px;
  padding: 0.875rem 1rem;
  margin: 1.25rem 0;
  overflow-wrap: break-word;
}
.status-block__label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #27ae60;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.status-block__label::before { content: '✓'; }
.status-block p { font-size: 0.92rem; color: var(--text); margin-bottom: 0; }

/* ============================================================
   PAGE NAV (prev / next)
   ============================================================ */
.page-nav {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.page-nav a {
  color: var(--text-mid);
  text-decoration: none;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  /* Comfortable tap size */
  padding: 0.4rem 0;
  min-height: 44px;
  align-items: center;
}
.page-nav a:hover,
.page-nav a:active { color: var(--white); }
.page-nav a.prev::before { content: '← '; }
.page-nav a.next::after  { content: ' →'; }
.page-nav__center {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  flex-grow: 1;
  text-align: center;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--dark);
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  line-height: 1.8;
}
.site-footer a { color: var(--link); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ============================================================
   DISCLAIMER
   ============================================================ */
.disclaimer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-top: 3rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.65;
}
.disclaimer h2 {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  font-weight: normal;
}

/* ============================================================
   HISTORY / INDEX PAGE CARDS
   ============================================================ */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  display: block;
  /* Use active state instead of hover for touch */
  -webkit-tap-highlight-color: transparent;
}
.card:hover,
.card:active {
  border-color: var(--accent);
  background: var(--surface2);
}
.card__num {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.card__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 0.25rem;
  font-weight: normal;
}
.card__date {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 0.5rem;
}
.card__desc {
  font-size: 0.875rem;
  color: var(--text-mid);
  line-height: 1.5;
}

/* ============================================================
   INTRO TEXT
   ============================================================ */
.intro {
  font-size: 1rem;
  color: var(--text-mid);
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin-bottom: 2rem;
  line-height: 1.7;
}

/* ============================================================
   LINKS
   ============================================================ */
a { color: var(--link); }
a:hover { color: var(--white); }

/* ============================================================
   TABLET — 600px+
   ============================================================ */
@media (min-width: 600px) {
  :root {
    --sp-md: 1.15rem;
    --sp-lg: 1.75rem;
    --sp-xl: 3rem;
    --sp-2xl: 5rem;
  }

  .site-main { padding: 2rem 1.5rem 4rem; }
  .page-header { padding: 2.5rem 1.5rem 1.75rem; }

  .toc ol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 1.5rem;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .section { margin-bottom: 4rem; }
}

/* ============================================================
   DESKTOP — 900px+ — show full horizontal nav, hide hamburger
   ============================================================ */
@media (min-width: 900px) {
  :root {
    --sp-lg: 2rem;
    --sp-xl: 3.5rem;
    --sp-2xl: 6rem;
  }

  .site-main { padding: 3.5rem 2rem 6rem; }
  .page-header { padding: 3.5rem 2rem 2rem; }

  /* Hide hamburger */
  .nav-toggle { display: none; }

  /* Restore horizontal nav */
  .site-nav__links {
    position: static;
    max-height: none;
    overflow: visible;
    visibility: visible;
    flex-direction: row;
    padding: 0;
    gap: 1.25rem;
    border: none;
    background: none;
    /* Override transition */
    transition: none;
  }
  .site-nav__links li { width: auto; }
  .site-nav__links a {
    display: inline-block;
    padding: 0.2rem 0;
    border-left: none;
    border-bottom: 2px solid transparent;
    font-size: 0.82rem;
  }
  .site-nav__links a:hover,
  .site-nav__links a.active {
    background: none;
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .toc ol { grid-template-columns: 1fr 1fr; }

  .cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

  .page-header__sub { font-size: 1.05rem; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================
   CITATIONS
   ============================================================ */

/* Inline superscript markers */
sup.cite {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--link);
  vertical-align: super;
  line-height: 0;
  margin-left: 0.05em;
  white-space: nowrap;
}
sup.cite a {
  color: var(--link);
  text-decoration: none;
  padding: 0 0.1em;
}
sup.cite a:hover { text-decoration: underline; color: var(--white); }

/* Citations section */
.citations {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding-top: 1.5rem;
}
.citations h2 {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
  font-weight: normal;
}
.citations ol {
  list-style: none;
  counter-reset: cite-counter;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.citations ol li {
  counter-increment: cite-counter;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.55;
}
.citations ol li::before {
  content: counter(cite-counter);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 1.2rem;
  text-align: right;
}
.citations ol li a {
  color: var(--link);
  word-break: break-all;
}
.citations ol li em {
  font-style: italic;
  color: var(--text-mid);
}
