/* PLITO — framework-as-system design language
   Palette: paper/ink + five variable registers used as a wayfinding system */

:root {
  --paper: #FBFBF9;
  --ink: #16181A;
  --ink-soft: #4A4F54;
  --hairline: #DCDDD8;

  --p: #3E5C76;  /* People — slate blue */
  --l: #2A7F6F;  /* Labour — deep teal */
  --i: #B07D2B;  /* Ideas — ochre */
  --t: #5B5586;  /* Techne — violet graphite */
  --o: #A14A2E;  /* Objects — rust */

  --display: 'Archivo', sans-serif;
  --body: 'Source Serif 4', Georgia, serif;
  --mono: 'IBM Plex Mono', monospace;

  --max: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.06rem;
  line-height: 1.75;
}

/* ---------- Signature: the five-register rule ---------- */
.register-rule {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 4px;
}
.register-rule span:nth-child(1) { background: var(--p); }
.register-rule span:nth-child(2) { background: var(--l); }
.register-rule span:nth-child(3) { background: var(--i); }
.register-rule span:nth-child(4) { background: var(--t); }
.register-rule span:nth-child(5) { background: var(--o); }

/* Variable chips */
.chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.1rem 0.45rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.chip.p { color: var(--p); }
.chip.l { color: var(--l); }
.chip.i { color: var(--i); }
.chip.t { color: var(--t); }
.chip.o { color: var(--o); }

/* ---------- Nav ---------- */
nav {
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 1100;
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark b:nth-child(1) { color: var(--p); }
.wordmark b:nth-child(2) { color: var(--l); }
.wordmark b:nth-child(3) { color: var(--i); }
.wordmark b:nth-child(4) { color: var(--t); }
.wordmark b:nth-child(5) { color: var(--o); }
.nav-links { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--display);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--ink); }
.nav-links a.active { color: var(--ink); border-bottom-color: var(--ink); }
a:focus-visible { outline: 2px solid var(--p); outline-offset: 3px; }

/* ---------- Page scaffolding ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }
main { padding-bottom: 5rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
h2 {
  font-family: var(--display);
  font-weight: 650;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}
h3 { font-family: var(--display); font-weight: 600; font-size: 1.1rem; margin-bottom: 0.5rem; }

.lede {
  font-size: 1.22rem;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 58ch;
}

section { padding: 3.5rem 0; }
section + section { border-top: 1px solid var(--hairline); }

p + p { margin-top: 1rem; }
.prose { max-width: 66ch; }
.prose a { color: var(--p); }

/* ---------- Hero variables ---------- */
.hero { padding: 5rem 0 3.5rem; }
.var-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  margin-top: 3rem;
}
.var-cell {
  background: var(--paper);
  padding: 1.4rem 1.1rem 1.2rem;
  position: relative;
  transition: background 0.25s ease;
}
.var-cell::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--vc, var(--ink));
}
.var-cell:hover { background: #F3F3EF; }
.var-cell .var-letter {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--vc);
  display: block;
}
.var-cell .var-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin: 0.3rem 0 0.5rem;
}
.var-cell .var-q { font-size: 0.88rem; line-height: 1.55; color: var(--ink-soft); }
.var-cell.vp { --vc: var(--p); }
.var-cell.vl { --vc: var(--l); }
.var-cell.vi { --vc: var(--i); }
.var-cell.vt { --vc: var(--t); }
.var-cell.vo { --vc: var(--o); }

/* ---------- Application tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-top: 2rem; }
.tile {
  border: 1px solid var(--hairline);
  padding: 1.6rem 1.4rem;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #fff;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.tile:hover { border-color: var(--ink); transform: translateY(-2px); }
.tile .tile-kind {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.tile p { font-size: 0.92rem; color: var(--ink-soft); line-height: 1.6; }
.tile .tile-go { font-family: var(--display); font-size: 0.84rem; font-weight: 600; margin-top: auto; }

/* ---------- Lens blocks (framework page) ---------- */
.lens {
  border-left: 4px solid var(--vc, var(--ink));
  padding: 0.4rem 0 0.4rem 1.5rem;
  margin: 2.2rem 0;
  max-width: 70ch;
}
.lens h3 { display: flex; align-items: baseline; gap: 0.7rem; font-size: 1.25rem; }
.lens h3 .chip { font-size: 0.8rem; }
.lens .lens-q { font-style: italic; color: var(--ink-soft); margin: 0.3rem 0 0.7rem; }
.lens.vp { --vc: var(--p); }
.lens.vl { --vc: var(--l); }
.lens.vi { --vc: var(--i); }
.lens.vt { --vc: var(--t); }
.lens.vo { --vc: var(--o); }

/* ---------- Narrative walkthrough ---------- */
.story-block {
  background: #fff;
  border: 1px solid var(--hairline);
  padding: 2rem;
  max-width: 70ch;
  font-size: 1.12rem;
}
.lens-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 2.5rem 0 0; }
.lens-tab {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid var(--hairline);
  background: #fff;
  color: var(--ink-soft);
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}
.lens-tab[aria-selected="true"] {
  border-color: var(--vc);
  color: var(--vc);
  border-bottom-width: 3px;
}
.lens-tab.vp { --vc: var(--p); } .lens-tab.vl { --vc: var(--l); }
.lens-tab.vi { --vc: var(--i); } .lens-tab.vt { --vc: var(--t); }
.lens-tab.vo { --vc: var(--o); }
.lens-panel {
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--vc, var(--ink));
  background: #fff;
  padding: 1.8rem;
  max-width: 70ch;
  margin-top: -1px;
}
.lens-panel[hidden] { display: none; }
.lens-panel.vp { --vc: var(--p); } .lens-panel.vl { --vc: var(--l); }
.lens-panel.vi { --vc: var(--i); } .lens-panel.vt { --vc: var(--t); }
.lens-panel.vo { --vc: var(--o); }
.lens-panel h3 { color: var(--vc); }
.lens-panel ul { padding-left: 1.2rem; margin-top: 0.6rem; }
.lens-panel li { margin-bottom: 0.5rem; }

/* ---------- Map ---------- */
#map { height: 540px; border: 1px solid var(--hairline); }
.map-note {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 0.8rem;
}
.leaflet-popup-content { font-family: var(--body); font-size: 0.92rem; }
.popup-title { font-family: var(--display); font-weight: 650; font-size: 1rem; margin-bottom: 0.2rem; }
.popup-meta { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.5rem; }
.popup-slots { display: flex; gap: 0.3rem; margin-top: 0.6rem; }
.popup-withheld { font-style: italic; color: var(--ink-soft); font-size: 0.85rem; margin-top: 0.5rem; }

/* ---------- Events cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; margin-top: 2rem; }
.card {
  border: 1px solid var(--hairline);
  background: #fff;
  padding: 1.6rem 1.4rem;
}
.card.placeholder { border-style: dashed; background: transparent; color: var(--ink-soft); }
.card .card-date { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.1em; color: var(--ink-soft); }
.card h3 { margin-top: 0.4rem; }
.card p { font-size: 0.94rem; color: var(--ink-soft); }

/* ---------- Limits ---------- */
.limit { max-width: 70ch; margin-bottom: 2.4rem; }
.limit h3 { font-size: 1.15rem; }
.limit-index {
  font-family: var(--mono);
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-right: 0.5rem;
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--hairline); }
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 2.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .var-row { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  #map { height: 420px; }
}
