:root {
  --ink: #171713;
  --paper: #f2efe6;
  --paper-deep: #e6e0d3;
  --orange: #ed5a24;
  --orange-dark: #c83e12;
  --yellow: #f3bd37;
  --muted: #6d6a60;
  --line: #cfc8b9;
  --white: #fffdf7;
  --shadow: 0 18px 45px rgba(37, 31, 20, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 300px;
  background:
    linear-gradient(rgba(23, 23, 19, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 23, 19, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

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

.crag-toolbar {
  min-height: 58px;
  padding: 8px clamp(18px, 4vw, 60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--ink);
  color: var(--white);
  border-bottom: 1px solid #3d3d37;
}

.crag-toolbar > strong {
  font-weight: 900;
  letter-spacing: 0.1em;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.crag-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.planner-link {
  padding: 9px 12px;
  border: 1px solid #6b6860;
  color: var(--white);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-decoration: none;
  text-transform: uppercase;
}

.planner-link:hover,
.planner-link:focus-visible {
  border-color: var(--orange);
  color: var(--yellow);
  outline: none;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d7d4ca;
  font-size: 0.76rem;
  font-weight: 700;
}

.offline-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #83c76c;
  box-shadow: 0 0 0 3px rgba(131, 199, 108, 0.15);
}

.offline-badge.is-offline::before {
  background: var(--yellow);
}

.install-button,
.primary-button {
  border: 0;
  border-radius: 3px;
  background: var(--orange);
  color: white;
  padding: 10px 16px;
  font-weight: 800;
}

.install-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.install-description {
  max-width: 260px;
  color: #d7d4ca;
  font-size: 0.72rem;
  line-height: 1.35;
}

.install-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

main {
  min-height: 80vh;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 390px;
  padding: clamp(70px, 10vw, 130px) clamp(20px, 7vw, 100px) 70px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(23, 23, 19, 0.96) 0%, rgba(23, 23, 19, 0.75) 56%, rgba(23, 23, 19, 0.25) 100%),
    radial-gradient(circle at 80% 30%, #9e4d2e 0 8%, transparent 9%),
    linear-gradient(135deg, #424238 0 43%, #706252 44% 56%, #24241e 57% 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -5% -120px 35%;
  height: 310px;
  background: var(--orange);
  clip-path: polygon(34% 0, 100% 70%, 100% 100%, 0 100%);
  opacity: 0.85;
}

.hero-copy,
.hero-stat {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 770px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--orange);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(3.5rem, 9vw, 7.6rem);
  line-height: 0.84;
  letter-spacing: -0.07em;
  text-transform: uppercase;
}

.hero-text {
  max-width: 600px;
  margin: 28px 0 0;
  color: #d9d4c8;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.hero-stat {
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(23, 23, 19, 0.62);
  backdrop-filter: blur(8px);
}

.hero-stat strong {
  color: var(--yellow);
  font-size: 3rem;
  line-height: 1;
}

.hero-stat span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.controls,
.results,
.field-note {
  width: min(1180px, calc(100% - 36px));
  margin-inline: auto;
}

.controls {
  position: relative;
  z-index: 2;
  margin-top: -28px;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 2px solid var(--ink);
}

.search-icon {
  width: 15px;
  height: 15px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  transform: rotate(45deg);
  background: var(--ink);
}

.search input {
  width: 100%;
  padding: 15px 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.filter-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
}

.filter-group {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.filter,
.select-wrap select,
.text-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 9px 14px;
  font-size: 0.78rem;
  font-weight: 800;
}

.filter.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

.organisation-filter {
  margin-left: auto;
  border-color: var(--orange);
  color: var(--orange-dark);
}

.organisation-filter[aria-pressed="true"] {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--white);
}

.select-wrap select {
  min-width: 180px;
  background: var(--paper);
}

.results {
  padding: 70px 0 45px;
}

.results-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.results h2,
.field-note h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3.1rem);
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.text-button[aria-pressed="true"] {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}

.crag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.crag-card {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.crag-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-top {
  min-height: 118px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background:
    linear-gradient(145deg, rgba(23, 23, 19, 0.17), transparent 60%),
    var(--card-color, var(--yellow));
  clip-path: polygon(0 0, 100% 0, 100% 76%, 74% 100%, 0 84%);
}

.province {
  padding: 6px 8px;
  background: var(--ink);
  color: var(--white);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-top-actions {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.organisation-mark {
  width: 54px;
  min-height: 54px;
  padding: 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--white);
  border: 1px solid rgba(23, 23, 19, 0.45);
  border-radius: 3px;
  box-shadow: 0 5px 15px rgba(23, 23, 19, 0.14);
}

.organisation-mark[hidden] {
  display: none;
}

.organisation-mark img {
  display: block;
  width: 44px;
  height: 34px;
  object-fit: contain;
}

.organisation-mark span {
  color: var(--ink);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.save-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(23, 23, 19, 0.5);
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.35);
  font-size: 1.5rem;
  line-height: 1;
}

.save-button.is-saved {
  background: var(--ink);
  color: var(--white);
  transform: rotate(45deg);
}

.card-body {
  padding: 10px 22px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.location {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crag-card h3 {
  margin: 0 0 14px;
  font-size: 1.8rem;
  letter-spacing: -0.045em;
  line-height: 1;
  text-transform: uppercase;
}

.tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tag {
  padding: 5px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.quick-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0;
}

.quick-facts div {
  border-left: 2px solid var(--orange);
  padding-left: 9px;
}

.quick-facts dt {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.quick-facts dd {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-weight: 800;
}

.open-detail {
  margin-top: auto;
  padding: 13px 0 0;
  display: flex;
  justify-content: space-between;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.empty-state {
  padding: 80px 20px;
  text-align: center;
  border: 1px dashed var(--line);
}

.empty-state span {
  color: var(--orange);
  font-weight: 900;
  letter-spacing: 0.18em;
}

.empty-state h3 {
  margin-bottom: 6px;
  font-size: 2rem;
  text-transform: uppercase;
}

.field-note {
  margin-bottom: 70px;
  padding: clamp(28px, 5vw, 55px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  background: var(--yellow);
  border: 1px solid #c79620;
}

.field-note .eyebrow {
  color: var(--ink);
}

.field-note > p {
  margin: 0;
  line-height: 1.7;
}

footer {
  padding: 26px 20px;
  background: var(--ink);
  color: #aaa79e;
  text-align: center;
  font-size: 0.76rem;
}

footer a {
  color: var(--yellow);
}

.detail-dialog {
  width: min(680px, calc(100% - 24px));
  max-height: 90vh;
  padding: 0;
  border: 0;
  background: var(--white);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.detail-dialog::backdrop {
  background: rgba(23, 23, 19, 0.78);
  backdrop-filter: blur(3px);
}

.dialog-head {
  padding: 24px;
  color: var(--white);
  background: var(--ink);
}

.dialog-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-close {
  width: 40px;
  height: 40px;
  border: 1px solid #66645e;
  border-radius: 50%;
  background: transparent;
  color: white;
  font-size: 1.4rem;
}

.dialog-head h2 {
  margin: 34px 0 8px;
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.dialog-head p {
  margin: 0;
  color: #c7c3b9;
}

.dialog-body {
  padding: 28px;
}

.dialog-body > p {
  line-height: 1.7;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 26px 0;
}

.detail-facts div {
  padding: 13px;
  background: var(--paper);
}

.detail-facts span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.extended-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 24px 0;
}

.extended-facts div {
  padding: 13px;
  border-left: 3px solid var(--orange);
  background: var(--paper);
}

.extended-facts span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.extended-facts strong {
  font-size: 0.82rem;
}

.status-callout,
.booking-note,
.access-warning,
.copyright-note {
  padding: 14px 16px;
  border-left: 4px solid var(--orange);
  background: var(--paper);
}

.status-callout {
  border-left-color: #4e8a55;
}

.access-warning {
  border-left-color: var(--yellow);
}

.copyright-note {
  border-left-color: var(--ink);
  font-size: 0.88rem;
}

.guide-section {
  margin-top: 26px;
}

.weather-panel {
  margin: 26px 0;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.weather-loading {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.weather-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--line);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: weather-spin 800ms linear infinite;
}

@keyframes weather-spin {
  to { transform: rotate(360deg); }
}

.weather-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.weather-label {
  margin: 0 0 4px;
  color: var(--orange-dark);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.weather-heading h3 {
  margin: 0;
  font-size: 1.15rem;
}

.weather-heading a {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.weather-days {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.weather-day {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 12px 9px;
  border-top: 3px solid var(--orange);
  background: var(--white);
  text-align: center;
}

.weather-day strong {
  font-size: 0.7rem;
  text-transform: uppercase;
}

.weather-day > span:not(.weather-icon) {
  min-height: 2.4em;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.weather-icon {
  font-size: 1.55rem;
}

.weather-day b {
  font-size: 0.84rem;
}

.weather-day small {
  color: var(--muted);
  font-size: 0.67rem;
}

.weather-note,
.weather-error {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.guide-section h3 {
  margin: 0 0 10px;
  color: var(--orange-dark);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-section ul {
  margin: 0;
  padding-left: 20px;
}

.guide-section li {
  margin: 8px 0;
  line-height: 1.55;
}

.sector-groups {
  display: grid;
  gap: 8px;
}

.sector-groups article {
  padding: 15px;
  background: var(--paper);
  border-left: 3px solid var(--orange);
}

.sector-groups h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.sector-groups p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

.detail-actions button,
.source-link {
  padding: 11px 14px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-actions button.active {
  background: var(--ink);
  color: white;
}

.notes-label {
  display: block;
  margin-top: 24px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.notes-label textarea {
  width: 100%;
  min-height: 100px;
  margin-top: 8px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

@media (max-width: 850px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-stat {
    align-self: flex-end;
  }

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

  .field-note {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .crag-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .crag-toolbar-actions {
    width: 100%;
    align-items: stretch;
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .planner-link {
    flex: 1 1 130px;
    text-align: center;
  }

  .install-option {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    padding-top: 4px;
  }

  .install-description {
    max-width: none;
  }

  .install-button {
    width: 100%;
    white-space: normal;
  }

  .offline-badge {
    display: none;
  }

  .weather-days {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-heading {
    flex-direction: column;
    gap: 8px;
  }

  .hero {
    min-height: 440px;
    padding-top: 80px;
  }

  .hero-stat {
    align-self: flex-start;
  }

  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .select-wrap select {
    width: 100%;
  }

  .results-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .crag-grid {
    grid-template-columns: 1fr;
  }

  .detail-facts {
    grid-template-columns: 1fr;
  }

  .extended-facts {
    grid-template-columns: 1fr;
  }
}
