/**
 * CiviPin - static place pages (CP-2 lot 4).
 *
 * Written by hand, consumed by scripts/generate-place-pages.js output.
 * Extends the Civic Blueprint tokens in design-system.css - it declares no
 * colours, fonts, radii or spacing of its own, so a theme change reaches
 * these pages for free and they never drift into a second design language.
 *
 * The aesthetic these pages commit to is "public dossier": hairline blueprint
 * grid behind the header, monospace uppercase labels, and every record filed
 * as an entry with a coloured rail and a stamped source line at its foot. The
 * source line is the design's centre of gravity, not an afterthought - the
 * CC-BY obligation and the product's credibility are the same line of text.
 */

.place-page {
  background: var(--c-void);
  color: var(--c-text);
}

.place-page main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-24);
}

/* ------------------------------------------------------------------ hero */

.place-hero {
  position: relative;
  isolation: isolate;
  padding: var(--space-16) var(--space-6) var(--space-10);
  margin: 0 calc(var(--space-6) * -1) var(--space-10);
  border-bottom: 1px solid var(--c-border);
  overflow: hidden;
}

/* The blueprint grid. Fades out downward so the text never fights it. */
.place-hero-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--c-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--c-grid) 1px, transparent 1px);
  background-size: 3rem 3rem;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 85%);
}

.place-crumbs {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-bottom: var(--space-5);
}

.place-crumbs a {
  color: var(--c-text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.place-crumbs a:hover {
  color: var(--c-accent);
  border-bottom-color: currentColor;
}

.place-crumbs span[aria-hidden] {
  opacity: 0.45;
  padding: 0 var(--space-1);
}

.place-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 6vw, var(--text-5xl));
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  /* Optical hang: the counts rail below reads as a caption of the title. */
  max-width: 22ch;
}

.place-counts {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--c-accent);
  margin: var(--space-4) 0 0;
}

/*
 * The non-exhaustivity notice. Deliberately given real weight rather than
 * being demoted to fine print: it is the sentence that keeps the page honest
 * (CP-2 rule 6), and a reader who misses it has been misled.
 */
.place-honesty {
  margin: var(--space-6) 0 0;
  padding-left: var(--space-4);
  border-left: 2px solid var(--c-border-bright);
  max-width: 62ch;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--c-text-muted);
}

/* --------------------------------------------------------------- sections */

.place-section {
  margin-top: var(--space-12);
}

.place-section > h2,
.place-siblings > h2 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--c-border);
}

.place-section-note {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  margin: 0 0 var(--space-5);
}

/* ---------------------------------------------------------------- records */

.rec-list {
  display: grid;
  gap: var(--space-4);
}

.rec {
  display: flex;
  gap: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.rec:hover {
  border-color: var(--c-border-bright);
  box-shadow: var(--shadow-sm);
}

/* The rail is the record's classification, readable before any word is. */
.rec-rail {
  flex: 0 0 3px;
  background: var(--c-border-bright);
}

.rec-situation .rec-rail { background: var(--c-converge); }
.rec-idea .rec-rail { background: var(--c-idea); }

.rec-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-5) var(--space-6);
}

.rec-kind {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 var(--space-2);
  color: var(--c-text-muted);
}

.rec-situation .rec-kind { color: var(--c-converge); }
.rec-idea .rec-kind { color: var(--c-idea); }

.rec-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0;
  overflow-wrap: anywhere;
}

.rec-title a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.rec-title a:hover {
  color: var(--c-accent);
  border-bottom-color: currentColor;
}

.rec-segment {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

.rec-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
}

.rec-chips li {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  padding: 2px var(--space-2);
  border: 1px solid color-mix(in srgb, var(--c-converge) 30%, transparent);
  border-radius: var(--radius-sm);
  background: var(--c-converge-soft);
  color: var(--c-converge);
  white-space: nowrap;
}

.rec-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--c-text-soft);
}

.rec-facts:empty { display: none; }

.rec-window {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

/*
 * The question. This is the most-read line of the product after the title
 * (CP-2 3.4), so it gets a hanging quote mark and real breathing room rather
 * than being tucked in with the metadata.
 */
.rec-question {
  position: relative;
  margin: var(--space-4) 0 0;
  padding: var(--space-3) 0 var(--space-3) var(--space-6);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--c-text);
  max-width: 58ch;
}

.rec-question::before {
  content: "";
  position: absolute;
  left: 0;
  top: var(--space-3);
  bottom: var(--space-3);
  width: 2px;
  border-radius: var(--radius-full);
  background: linear-gradient(to bottom, var(--c-accent), transparent);
}

.rec-excerpt {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--c-text-soft);
  max-width: 62ch;
}

.rec-metrics,
.rec-seeded {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  margin: var(--space-3) 0 0;
}

/*
 * The stamped source line. Mandatory on every rendered record: CC-BY 4.0
 * attribution rides on the record (CP-1 trap 1), and the pull date is what
 * makes a stale record forgivable instead of dishonest (CP-1 4.2.3 rule 5).
 * Never a buried credits page - founder directive.
 */
.rec-source {
  margin: var(--space-5) 0 0;
  padding-top: var(--space-3);
  border-top: 1px dashed var(--c-border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--c-text-muted);
}

.rec-source a {
  color: var(--c-accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--c-accent) 40%, transparent);
}

.rec-source a:hover {
  border-bottom-color: currentColor;
}

/* Short enough to keep whole: "CC-BY 4.0" broken across two lines reads as
   two different facts. The attribution link before them still wraps freely. */
.rec-licence,
.rec-fetched {
  color: var(--c-text-dim);
  white-space: nowrap;
}

.rec-licence::before,
.rec-fetched::before {
  content: "· ";
  opacity: 0.6;
}

/* -------------------------------------------------------------------- cta */

.place-cta {
  margin-top: var(--space-16);
  padding: var(--space-10) var(--space-8);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 0% 0%, var(--c-accent-soft), transparent 60%),
    var(--c-surface);
}

.place-cta h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-3);
}

.place-cta p {
  margin: 0;
  max-width: 54ch;
  color: var(--c-text-soft);
  line-height: 1.6;
}

.place-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6) !important;
}

/* --------------------------------------------------------------- siblings */

.place-siblings {
  margin-top: var(--space-16);
}

.place-siblings ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
}

.place-siblings a {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  background: var(--c-surface);
  color: var(--c-text-soft);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.place-siblings a:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
  background: var(--c-accent-soft);
}

/* ------------------------------------------------------------ index page */

.place-index {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.place-index-item {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-surface);
}

.place-index-link {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--c-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.place-index-link:hover {
  color: var(--c-accent);
  border-bottom-color: currentColor;
}

.place-index-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  margin-left: var(--space-2);
}

.place-index-sub {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-3) 0 0;
  padding: 0;
}

.place-index-sub-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}

.place-index-sub a {
  font-size: var(--text-sm);
  color: var(--c-text-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.place-index-sub a:hover {
  color: var(--c-accent);
  border-bottom-color: currentColor;
}

/* ----------------------------------------------------------------- footer */

.place-footer {
  max-width: 68rem;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-16);
  border-top: 1px solid var(--c-border);
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

.place-footer p {
  margin: 0 0 var(--space-2);
  max-width: 70ch;
}

.place-footer a {
  color: var(--c-accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--c-accent) 40%, transparent);
}

.place-footer a:hover { border-bottom-color: currentColor; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 640px) {
  .place-page main { padding: 0 var(--space-4) var(--space-16); }

  .place-hero {
    padding: var(--space-10) var(--space-4) var(--space-8);
    margin: 0 calc(var(--space-4) * -1) var(--space-8);
  }

  .rec-body { padding: var(--space-4) var(--space-4); }
  .place-cta { padding: var(--space-8) var(--space-5); }
  .place-cta-actions .btn { flex: 1 1 100%; justify-content: center; }
}

/* Reduced motion: nothing here animates on load, only hover transitions. */
@media (prefers-reduced-motion: reduce) {
  .rec,
  .place-siblings a { transition: none; }
}

/* High-contrast mode already raises token contrast; only the decorative grid
   and the dashed source rule need to stop being decorative. */
[data-contrast="high"] .place-hero-grid { display: none; }
[data-contrast="high"] .rec-source { border-top-style: solid; }
