/* ==========================================================================
   arlc-resource.css
   Shared foundation for resources.adopteerightslaw.com
   --------------------------------------------------------------------------
   This file owns everything every page shares: type, color, header, footer,
   status pills, readout panel, tile-grid primitives.
   Each page adds ONLY its own bespoke CSS in a <style> block.
   If you find yourself writing the same rule on a third page, move it here.
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */
:root {
  /* Status palette — these three carry meaning, not decoration.
     Keep them consistent across every map, chart and table on the subdomain
     so a reader learns the code once. */
  --ok:        #3f7a4d;   /* unrestricted / protected / compliant       */
  --ok-bg:     #eaf2ec;
  --mid:       #b08422;   /* conditional / discriminatory / partial     */
  --mid-bg:    #f8f1dc;
  --bad:       #8f3232;   /* restricted / unprotected / blocked         */
  --bad-bg:    #f5e8e8;
  --unknown:   #7a746c;   /* unconfirmed — never guess with a color     */
  --unknown-bg:#efedea;

  /* Neutrals */
  --ink:       #1a1a1a;
  --ink-soft:  #4a453f;
  --mute:      #7a746c;
  --hair:      #ddd8d1;
  --panel:     #f7f5f2;
  --page:      #ffffff;

  --link:      #1f4e79;

  /* Type scale — Elements of Typographic Style, ~1.25 ratio off 17px */
  --t-xs:  13px;
  --t-sm:  15px;
  --t-base:17px;
  --t-md:  21px;
  --t-lg:  27px;
  --t-xl:  34px;
  --t-2xl: 44px;

  --measure: 34em;        /* ~72 characters — keep prose inside this */
  --gutter:  clamp(20px, 5vw, 48px);
}

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img { max-width: 100%; height: auto; }

/* --- Base ---------------------------------------------------------------- */
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mulish', 'Avenir Next', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--t-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Alfa Slab One', Georgia, serif; font-weight: 400; color: var(--ink); margin: 0; }
h1 { font-size: var(--t-2xl); line-height: 1.1;  letter-spacing: -0.5px; }
h2 { font-size: var(--t-lg);  line-height: 1.2;  margin: 2.5em 0 .7em; }
h3 { font-size: var(--t-md);  line-height: 1.3;  margin-top: 2em; }

p { margin: 0 0 1.1em; max-width: var(--measure); }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* Visible keyboard focus — required, not optional */
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* --- Layout -------------------------------------------------------------- */
.arlc-wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.arlc-prose { max-width: var(--measure); }

/* --- Site header --------------------------------------------------------- */
/* Keep this block byte-identical across every page. When the nav changes you
   will find-and-replace it, and identical markup is what makes that safe. */
.arlc-site-head {
  border-bottom: 1px solid var(--hair);
  padding: 22px 0;
  margin-bottom: 40px;
}
.arlc-site-head .arlc-wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.arlc-site-head img,
.arlc-site-head svg { width: 240px; height: auto; display: block; }
.arlc-site-head svg { fill: currentColor; color: var(--ink); }
.arlc-site-nav { display: flex; gap: 22px; flex-wrap: wrap; }
.arlc-site-nav a {
  font-size: var(--t-sm); color: var(--ink-soft); text-decoration: none;
}
.arlc-site-nav a:hover { color: var(--ink); text-decoration: underline; }

/* --- Page head ----------------------------------------------------------- */
.arlc-page-head { margin-bottom: 36px; }
.arlc-page-head h1 { max-width: 18em; }
.arlc-standfirst {
  font-size: var(--t-md); line-height: 1.5; color: var(--ink-soft);
  max-width: var(--measure); margin: 18px 0 0;
}
.arlc-updated { font-size: var(--t-xs); color: var(--mute); margin: 18px 0 0; }

/* Link back to the main-site page this expands on. Every page gets one. */
.arlc-parent-link {
  display: block; margin: 0 0 28px;
  font-size: var(--t-sm); color: var(--ink-soft);
  border-left: 3px solid var(--hair); padding: 4px 0 4px 14px;
  max-width: var(--measure);
}

/* --- Status pills -------------------------------------------------------- */
.arlc-pill {
  display: inline-block; border-radius: 999px;
  padding: 4px 13px; font-size: var(--t-xs); line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.arlc-pill.ok      { background: var(--ok-bg);      color: var(--ok);      border-color: var(--ok); }
.arlc-pill.mid     { background: var(--mid-bg);     color: var(--mid);     border-color: var(--mid); }
.arlc-pill.bad     { background: var(--bad-bg);     color: var(--bad);     border-color: var(--bad); }
.arlc-pill.unknown { background: var(--unknown-bg); color: var(--unknown); border-color: var(--unknown); }

/* Legend of filter buttons. Buttons, not divs — they are clickable. */
.arlc-legend { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 26px; padding: 0; }
.arlc-legend button {
  font: inherit; font-size: var(--t-xs); cursor: pointer;
  border-radius: 999px; padding: 6px 15px;
  background: transparent; border: 1px solid var(--hair); color: var(--ink-soft);
}
.arlc-legend button[aria-pressed="true"] { border-width: 2px; padding: 5px 14px; font-weight: 700; }
.arlc-legend button.ok[aria-pressed="true"]  { border-color: var(--ok);  color: var(--ok);  background: var(--ok-bg); }
.arlc-legend button.mid[aria-pressed="true"] { border-color: var(--mid); color: var(--mid); background: var(--mid-bg); }
.arlc-legend button.bad[aria-pressed="true"] { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }

/* --- Figure: any map, chart or interactive ------------------------------- */
.arlc-figure { margin: 34px 0; }
.arlc-figure-grid { display: grid; grid-template-columns: 1fr 300px; gap: 30px; align-items: start; }
.arlc-readout {
  background: var(--panel); border: 1px solid var(--hair);
  padding: 22px; position: sticky; top: 20px;
}
.arlc-readout .ro-name  { font-family: 'Alfa Slab One', Georgia, serif; font-size: var(--t-md); line-height: 1.2; margin: 0 0 10px; }
.arlc-readout .ro-body  { font-size: var(--t-sm); line-height: 1.6; color: var(--ink-soft); margin: 12px 0 0; }
.arlc-readout .ro-empty { font-size: var(--t-sm); color: var(--mute); margin: 0; }

.arlc-fig-caption {
  font-size: var(--t-xs); color: var(--mute); line-height: 1.6;
  margin: 14px 0 0; max-width: var(--measure);
}

/* --- Tile grid (cartogram) ----------------------------------------------- */
.arlc-tilegrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; }
.arlc-tile {
  aspect-ratio: 1; border: 1px solid transparent; border-radius: 2px;
  font: inherit; font-size: var(--t-xs); font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s ease;
}
.arlc-tile.ok      { background: var(--ok-bg);      color: var(--ok);      border-color: var(--ok); }
.arlc-tile.mid     { background: var(--mid-bg);     color: var(--mid);     border-color: var(--mid); }
.arlc-tile.bad     { background: var(--bad-bg);     color: var(--bad);     border-color: var(--bad); }
.arlc-tile.unknown { background: var(--unknown-bg); color: var(--unknown); border-color: var(--unknown); }
.arlc-tile.sel   { transform: scale(1.12); box-shadow: 0 0 0 2px var(--ink); z-index: 2; }
.arlc-tile.dim   { opacity: .25; }

/* --- Data table ---------------------------------------------------------- */
table { border-collapse: collapse; width: 100%; margin: 26px 0; font-size: var(--t-sm); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--hair); vertical-align: top; }
th { font-weight: 700; border-bottom-width: 2px; border-bottom-color: var(--ink); }
tbody tr:hover { background: var(--panel); }

/* --- Notes and caveats --------------------------------------------------- */
.arlc-note {
  background: var(--panel); border-left: 3px solid var(--ink);
  padding: 20px 24px; margin: 30px 0; max-width: var(--measure);
}
.arlc-note p:last-child { margin-bottom: 0; }
.arlc-note .arlc-note-head { font-weight: 700; }

/* A section heading that introduces a card grid lines up with the card text
   rather than the grid edge, so its first letter doesn't appear to hang left.
   The indent matches .arlc-card's horizontal padding. */
h2:has(+ .arlc-cardgrid) { padding-left: 26px; }

/* --- Card grid: index and section landing pages -------------------------- */
/* Navigation, not reading. Cards give each destination a target and a line of
   description. Content pages use the prose + figure layout above instead. */
.arlc-cardgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px; margin: 0 0 42px;
}
.arlc-card {
  display: flex; flex-direction: column; min-height: 198px;
  background: var(--page); border: 1px solid var(--hair); border-radius: 14px;
  padding: 24px 26px 20px; text-decoration: none; color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
.arlc-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.arlc-card .card-tag {
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--mute); margin: 0 0 9px;
}
/* Override the shared h3/p rules — inside a card these are not document flow. */
.arlc-card h3 { margin: 0 0 8px; font-size: var(--t-md); line-height: 1.25; }
.arlc-card p  { margin: 0 0 18px; max-width: none; font-size: var(--t-sm);
                line-height: 1.55; color: var(--ink-soft); }
.arlc-card .card-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--hair);
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; font-size: var(--t-xs);
}
.arlc-card .card-open { font-weight: 700; color: var(--link); }
.arlc-card .card-open::after { content: " \2192"; }
.arlc-card .card-date { color: var(--mute); }

/* Status classes match the pills and tiles — same code, same meaning. */
.arlc-card.ok  .card-tag { color: var(--ok); }
.arlc-card.mid .card-tag { color: var(--mid); }
.arlc-card.bad .card-tag { color: var(--bad); }
.arlc-card.ok:hover  { border-color: var(--ok); }
.arlc-card.mid:hover { border-color: var(--mid); }
.arlc-card.bad:hover { border-color: var(--bad); }

/* Not published yet. Use a div, not an <a> — there is nowhere to go. */
.arlc-card.soon { background: var(--panel); border-style: dashed; }
.arlc-card.soon:hover { transform: none; border-color: var(--hair); }
.arlc-card.soon h3, .arlc-card.soon p, .arlc-card.soon .card-open { color: var(--mute); }
.arlc-card.soon .card-open::after { content: ""; }

/* --- Footer -------------------------------------------------------------- */
.arlc-site-foot {
  border-top: 1px solid var(--hair); margin-top: 70px; padding: 30px 0 60px;
  font-size: var(--t-xs); color: var(--mute);
}
.arlc-site-foot p { max-width: var(--measure); margin: 0 0 .6em; }
.arlc-site-foot a { color: var(--mute); }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 820px) {
  .arlc-figure-grid { grid-template-columns: 1fr; }
  .arlc-readout { position: static; }
  h1 { font-size: var(--t-xl); }
}
@media (max-width: 560px) {
  .arlc-site-head img { width: 200px; }
  .arlc-tilegrid { gap: 3px; }
  .arlc-tile { font-size: 10px; }
  .arlc-cardgrid { grid-template-columns: 1fr; gap: 14px; }
  .arlc-card { min-height: 0; padding: 20px 22px 18px; }
  h2:has(+ .arlc-cardgrid) { padding-left: 22px; }   /* match the card padding above */
}

/* --- Motion and print ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media print {
  .arlc-site-nav, .arlc-legend { display: none; }
  .arlc-card { break-inside: avoid; }
  body { font-size: 11pt; }
  .arlc-figure-grid { grid-template-columns: 1fr; }
}
