/* Self-hosted so there are no third-party requests, nothing to block rendering,
   and the site keeps its typography with no connection. swap means text is
   readable immediately in the fallback while the webfont arrives. */
@font-face{font-family:"Barlow";src:url("../fonts/barlow-latin-400-normal.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"Barlow";src:url("../fonts/barlow-latin-500-normal.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"Barlow";src:url("../fonts/barlow-latin-600-normal.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:"Barlow Condensed";src:url("../fonts/barlow-condensed-latin-500-normal.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"Barlow Condensed";src:url("../fonts/barlow-condensed-latin-600-normal.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:"Barlow Condensed";src:url("../fonts/barlow-condensed-latin-700-normal.woff2") format("woff2");font-weight:700;font-style:normal;font-display:swap}
@font-face{font-family:"Azeret Mono";src:url("../fonts/azeret-mono-latin-400-normal.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"Azeret Mono";src:url("../fonts/azeret-mono-latin-500-normal.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}

/* =========================================================
   Powys Walks

   Reference points, deliberately: an OS Explorer sheet and a
   footpath fingerpost. Cool map paper rather than warm cream.
   Deep green and waymarker yellow rather than a warm accent.
   Condensed signage type rather than an editorial serif.
   Square corners throughout, because maps and signs are square.
   ========================================================= */

:root {
  --paper:      #E3E7E4;
  --paper-lift: #EFF2F0;
  --ink:        #14201B;
  --ink-soft:   #4E5A53;
  --green:      #1C3B2E;
  --green-mid:  #2F5A47;
  --yellow:     #F0C518;
  --water:      #2E5F7F;
  --contour:    #8A6A3F;

  --rule:      rgba(20, 32, 27, 0.16);
  --rule-firm: rgba(20, 32, 27, 0.42);

  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --body:    "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:    "Azeret Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 36rem;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --shell: 78rem;

  --r: 2px;
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute only gets display:none from the browser's own stylesheet,
   which any author rule beats. .more-row sets display:flex and .btn sets
   inline-block, so without this an element set to hidden stays on screen. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
}

img { max-width: 100%; display: block; }

a { color: var(--water); text-underline-offset: 0.16em; }
a:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.shell {
  width: min(100% - (var(--gutter) * 2), var(--shell));
  margin-inline: auto;
}

.vh {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- type: condensed for display, like map and sign lettering ---------- */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: 0;
  margin: 0 0 0.4em;
}

h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.05rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1.05em; max-width: var(--measure); }

.lede {
  font-size: 1.16rem;
  color: var(--ink-soft);
  max-width: 42rem;
}

/* ---------- header ---------- */

.site-head {
  background: var(--green);
  color: var(--paper-lift);
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 2px solid var(--yellow);
}

.site-head__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.7rem 0;
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--paper-lift);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.wordmark:hover { color: var(--paper-lift); }
.wordmark:hover .wordmark__mark { transform: rotate(-6deg); }
.wordmark__mark {
  width: 29px;
  height: 29px;
  flex: none;
  display: block;
  transition: transform 0.15s ease;
}
@media (prefers-reduced-motion: reduce) {
.wordmark__mark { transition: none; }
  .wordmark:hover .wordmark__mark { transform: none; }
}

.site-nav {
  display: flex;
  gap: 1.35rem;
  flex-wrap: wrap;
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 500;
}
.site-nav a {
  color: rgba(239, 242, 240, 0.72);
  text-decoration: none;
  padding-bottom: 1px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--paper-lift); }
.site-nav a[aria-current="page"] { color: var(--yellow); border-bottom-color: var(--yellow); }

.chipset { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip {
  font-family: var(--body);
  font-size: 0.93rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.55rem 0.85rem;
  background: transparent;
  border: 1px solid var(--rule-firm);
  border-radius: var(--r);
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { background: rgba(20, 32, 27, 0.06); }
.chip[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--yellow);
}

/* ---------- buttons: waymarker yellow on green ---------- */

.btn {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  background: var(--yellow);
  color: var(--ink);
  border: 1px solid var(--yellow);
  border-radius: var(--r);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #ffd52e; border-color: #ffd52e; color: var(--ink); }

.btn--quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-firm);
}
.btn--quiet:hover { background: rgba(20, 32, 27, 0.06); border-color: var(--ink); color: var(--ink); }

/* ---------- library ---------- */

.library {
  display: grid;
  grid-template-columns: 14.5rem 1fr;
  gap: clamp(1.5rem, 4vw, 2.75rem);
  padding: 2.25rem 0 4rem;
  align-items: start;
}
@media (max-width: 56rem) {
.library { grid-template-columns: 1fr; }
}

.select {
  width: 100%;
  font-family: var(--body);
  font-size: 0.95rem;
  padding: 0.5rem 0.6rem;
  background: var(--paper-lift);
  border: 1px solid var(--rule-firm);
  border-radius: var(--r);
  color: var(--ink);
  cursor: pointer;
}
.select:hover { border-color: var(--ink); }

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  padding: 0.15rem 0;
  cursor: pointer;
}
.check input { accent-color: var(--green); width: 1rem; height: 1rem; flex: none; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* flat, rule-led. no lift, no shadow. */
.walk-card {
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--green-mid);
  padding: 1rem 1.05rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.walk-card:hover { border-left-color: var(--yellow); }

.walk-card__area {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.walk-card__title {
  font-family: var(--display);
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
}
.walk-card__title a { color: var(--ink); text-decoration: none; }
.walk-card__title a:hover { color: var(--green-mid); }

.walk-card__summary { font-size: 0.93rem; color: var(--ink-soft); margin: 0; max-width: none; }

.walk-card__stats {
  font-family: var(--mono);
  font-size: 0.72rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--rule);
}

/* difficulty as stacked contour lines */
.contour-meter { display: inline-flex; flex-direction: column; gap: 2px; vertical-align: middle; }
.contour-meter span { display: block; height: 2px; background: var(--rule-firm); }
.contour-meter span:nth-child(1) { width: 6px; }
.contour-meter span:nth-child(2) { width: 10px; }
.contour-meter span:nth-child(3) { width: 14px; }
.contour-meter span:nth-child(4) { width: 18px; }
.contour-meter span.on { background: var(--contour); }

.difficulty { display: inline-flex; align-items: center; gap: 0.35rem; }

.empty {
  border: 1px dashed var(--rule-firm);
  padding: 1.75rem 1.4rem;
  color: var(--ink-soft);
}
.empty p:last-child { margin-bottom: 0; }

/* ---------- walk page ---------- */

.walk-head { padding: 2.25rem 0 1.25rem; }

.crumbs {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}
.crumbs a { color: var(--ink-soft); }

.factstrip {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule-firm);
  border-bottom: 1px solid var(--rule-firm);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 1.1rem;
}
.factstrip dt {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.factstrip dd { margin: 0; font-family: var(--mono); font-size: 0.95rem; }

.notice {
  border-left: 4px solid var(--contour);
  background: var(--paper-lift);
  padding: 0.9rem 1.1rem;
  margin: 1.75rem 0;
}
.notice p { margin: 0; max-width: none; font-size: 0.94rem; }

.walk-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16.5rem;
  gap: clamp(1.75rem, 5vw, 3.5rem);
  padding-bottom: 4rem;
  align-items: start;
}
@media (max-width: 56rem) {
.walk-body { grid-template-columns: 1fr; }
}

.walk-section { margin-bottom: 2.25rem; }
.walk-section > h2 {
  font-size: 1.45rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule-firm);
  margin-bottom: 0.9rem;
}

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1rem 2.9rem;
  max-width: var(--measure);
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0.1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--green-mid);
}
.steps li::after {
  content: "";
  position: absolute;
  left: 0.6rem; top: 1.5rem; bottom: 0.25rem;
  width: 1px;
  background: var(--rule);
}
.steps li:last-child::after { display: none; }

/* ---------- map ---------- */

.map {
  height: 26rem;
  border: 1px solid var(--rule-firm);
  background: var(--paper-lift);
  z-index: 0;
}
.map-note {
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0.5rem 0 0;
  max-width: none;
}
.leaflet-container { font-family: var(--body) !important; background: var(--paper-lift) !important; }

.sidecard {
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  padding: 1.05rem 1.1rem;
  margin-bottom: 1rem;
}
.sidecard h3 {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.7rem;
}
.sidecard dl { margin: 0; font-size: 0.93rem; }
.sidecard dt { color: var(--ink-soft); font-size: 0.8rem; }
.sidecard dd { margin: 0 0 0.75rem; }
.sidecard dd:last-child { margin-bottom: 0; }

.actions { display: flex; flex-direction: column; gap: 0.5rem; }
.actions .btn { text-align: center; }

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

.site-foot {
  border-top: 2px solid var(--yellow);
  background: var(--green);
  color: rgba(239, 242, 240, 0.78);
  padding: 2.25rem 0 2.75rem;
  font-size: 0.88rem;
}
.site-foot a { color: var(--yellow); }
.site-foot p { max-width: 48rem; }
.site-foot__legal { font-size: 0.8rem; color: rgba(239, 242, 240, 0.68); }

/* ---------- print ---------- */

@media print {
  :root { --paper: #fff; --paper-lift: #fff; }
  body { font-size: 10.5pt; background: #fff; }
  .site-head, .site-foot, .actions, .site-nav,
  .crumbs, .more-row, .offline-panel, .welcome, .no-print { display: none !important; }
  .walk-body { grid-template-columns: 1fr; gap: 0; }
  .sidecard { border: 1px solid #999; break-inside: avoid; }
  .walk-section { margin-bottom: 1.1rem; break-inside: avoid; }
  .map { height: 12rem; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  h1 { font-size: 24pt; }
  .notice { border: 1px solid #999; }
}

/* ---------- the index: query first, no hero ----------
   The h1 is generated from the filters and counts the result, so the page
   states what you asked for rather than selling you anything. */

.index-head { padding: 2.25rem 0 0; }

.index-head h1 {
  font-size: clamp(1.75rem, 4.2vw, 2.8rem);
  font-weight: 600;
  margin: 0 0 1.4rem;
  min-height: 1.1em;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem 1.9rem;
  padding: 1.1rem 0 1.2rem;
  border-top: 1px solid var(--rule-firm);
  border-bottom: 1px solid var(--rule);
}

.control { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.control--wide { flex: 1 1 100%; }
.control .select { min-width: 12rem; }

.control__label {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.checkrow { display: flex; flex-wrap: wrap; gap: 0.35rem 1.15rem; }
.checkrow .check { font-size: 0.9rem; }

#grid { margin-top: 1.75rem; }

.index-foot {
  margin: 2.75rem 0 4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 46rem;
}

.prose { padding: 2.25rem 0 4rem; }
.prose h1 { margin-bottom: 1.2rem; }
.prose h2 { font-size: 1.35rem; margin-top: 2.25rem; }
.prose p { font-size: 1.02rem; }

/* ---------- language toggle ---------- */

.lang {
  font-family: var(--body);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.4rem 0.7rem;
  background: transparent;
  color: var(--yellow);
  border: 1px solid rgba(240, 197, 24, 0.5);
  border-radius: var(--r);
  cursor: pointer;
}
.lang:hover { background: var(--yellow); color: var(--green); border-color: var(--yellow); }

/* ---------- tips ---------- */

.tips { margin: 0; padding: 0; list-style: none; max-width: var(--measure); }
.tips li {
  position: relative;
  padding: 0 0 0.7rem 1.5rem;
}
.tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  background: var(--yellow);
  border: 1px solid var(--green);
}

/* ---------- offline panel ---------- */

.offline-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 3rem 0 0;
  padding: 1.25rem 1.4rem;
  background: var(--green);
  color: var(--paper-lift);
  border-radius: var(--r);
}
.offline-panel h2 {
  font-size: 1.25rem;
  margin: 0 0 0.35rem;
  color: var(--yellow);
}
.offline-panel p { margin: 0; font-size: 0.92rem; max-width: 44rem; }
.offline-status { font-family: var(--mono); font-size: 0.78rem; color: var(--yellow); min-height: 1.2em; }
.offline-panel .btn { flex: none; }
.offline-panel .btn:disabled { opacity: 0.5; cursor: default; }

#map-links a { color: var(--water); }
.leaflet-control-layers { font-size: 0.85rem; }

/* ---------- welcome block ---------- */

.welcome {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-firm);
}
.welcome > h2 { font-size: 1.45rem; margin-bottom: 1.1rem; }
.welcome__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem 2rem;
}
.welcome__cols h3 {
  font-size: 1.05rem;
  font-family: var(--body);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.welcome__cols p { font-size: 0.93rem; color: var(--ink-soft); margin-bottom: 0.5rem; }
.welcome__cols p:last-child { margin-bottom: 0; }

.offline-more { margin-top: 0.5rem !important; font-size: 0.86rem !important; }
.offline-more a { color: var(--yellow); }

/* ---------- show more ---------- */

.more-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.more-all {
  font-family: var(--body);
  font-size: 0.9rem;
  background: none;
  border: 0;
  padding: 0;
  color: var(--water);
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
}
.more-all:hover { color: var(--ink); }
.more-count {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 0 0 0 auto;
}
@media (max-width: 34rem) {
.more-count { margin-left: 0; }
}
