/* =============================================================================
   CHALK EATERS - style.css
   Aesthetic: utilitarian-alpine · dark slate · chalk + amber accents
============================================================================= */

/* == Tokens == */
:root {
  --bg:          #141618;
  --bg-card:     #1c1f22;
  --bg-section:  #22262b;
  --border:      #2e3238;
  --border-mid:  #3a4048;

  --chalk:       #e8e2d8;
  --chalk-dim:   #9a9490;
  --chalk-faint: #5a5652;

  --amber:       #e8a135;
  --amber-dim:   #7a5218;
  --teal:        #38b89a;
  --teal-dim:    #1a5e4e;

  --green:       #5cb85c;
  --orange:      #e0822a;
  --red:         #d94f4f;
  --red-dim:     #6b2222;
  --amber-mid:   #c07a20;

  --font-display: "Bebas Neue", sans-serif;
  --font-body:    "DM Sans", sans-serif;
  --font-mono:    "DM Mono", monospace;

  --radius:      6px;
  --radius-lg:   10px;
  --gap:         14px;
}

/* == Reset == */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }

/* == Header == */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.logo-mark {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--amber);
  line-height: 1;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.06em;
  color: var(--chalk);
  line-height: 1;
}

.logo-sub {
  font-size: 11px;
  color: var(--chalk-faint);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.last-update {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--chalk-faint);
  white-space: nowrap;
}

/* == Main grid == */
main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.crags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* == Crag card == */
.crag-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}

.crag-card:hover {
  border-color: var(--border-mid);
}

/* == Card header == */
.crag-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.crag-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crag-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--chalk);
  line-height: 1.1;
}

.crag-sector {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--chalk-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.crag-aspect-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  min-width: 44px;
}

.aspect-arrow {
  font-size: 16px;
  line-height: 1;
  color: var(--amber);
}

.aspect-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--chalk-dim);
  letter-spacing: 0.12em;
  margin-top: 2px;
}

/* == Scores row == */
.scores-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.score-block {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-block:first-child {
  border-right: 1px solid var(--border);
}

.score-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.score-title {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--chalk-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-value {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
}

.score-value small {
  font-size: 12px;
  opacity: 0.6;
  font-family: var(--font-mono);
}

.score-color-green  { color: var(--green); }
.score-color-amber  { color: var(--amber); }
.score-color-orange { color: var(--orange); }
.score-color-red    { color: var(--red); }

.score-bar-track {
  height: 4px;
  background: var(--bg-section);
  border-radius: 2px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.score-bar-fill.score-color-green  { background: var(--green); }
.score-bar-fill.score-color-amber  { background: var(--amber); }
.score-bar-fill.score-color-orange { background: var(--orange); }
.score-bar-fill.score-color-red    { background: var(--red); }

.score-label-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 500;
  align-self: flex-start;
}

.score-pill-green  { background: #1e3d1e; color: var(--green); }
.score-pill-amber  { background: var(--amber-dim); color: var(--amber); }
.score-pill-orange { background: #3d2010; color: var(--orange); }
.score-pill-red    { background: var(--red-dim); color: #f08080; }

.score-detail {
  font-size: 11px;
  color: var(--chalk-faint);
  font-family: var(--font-mono);
  line-height: 1.4;
}

/* == Generic section == */
.section-block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.section-block:last-of-type {
  border-bottom: none;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--chalk-faint);
  margin-bottom: 10px;
}

/* == History strip == */
.history-strip {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hist-day {
  display: grid;
  grid-template-columns: 100px 28px 1fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius);
  background: var(--bg-section);
}

.hist-day--wet {
  border-left: 2px solid var(--teal-dim);
}

.hist-date {
  font-size: 12px;
  color: var(--chalk-dim);
  font-family: var(--font-mono);
}

.hist-icon { font-size: 15px; text-align: center; }

.hist-precip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--teal);
}

.hist-temp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--chalk-dim);
  text-align: right;
}

/* == Forecast strip == */
.forecast-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.fc-day {
  flex: 0 0 auto;
  min-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  border-radius: var(--radius);
  background: var(--bg-section);
  border: 1px solid transparent;
}

.fc-day--today {
  border-color: var(--amber-dim);
  background: #1f1a0e;
}

.fc-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--chalk-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.fc-day--today .fc-label { color: var(--amber); }

.fc-icon  { font-size: 20px; line-height: 1.2; }
.fc-temp  { font-family: var(--font-display); font-size: 18px; color: var(--chalk); line-height: 1; }
.fc-precip{ font-family: var(--font-mono); font-size: 10px; color: var(--teal); min-height: 14px; }
.fc-sun   { font-family: var(--font-mono); font-size: 10px; color: var(--chalk-faint); }

/* == WeatherWidget wrapper == */
.section-widget {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.widget-wrap {
  overflow: hidden;
  border-radius: var(--radius);
}

.widget-wrap .weatherwidget-io {
  display: block;
  width: 100%;
}

/* == Card footer / itinerary == */
.crag-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.crag-address {
  font-size: 11px;
  color: var(--chalk-faint);
  font-family: var(--font-mono);
}

.itinerary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--amber);
  color: #1a1000;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.12s;
}

.itinerary-btn:hover {
  background: #f5b54a;
  text-decoration: none;
}

/* == Skeleton loading == */
@keyframes shimmer {
  0%   { opacity: 0.5; }
  50%  { opacity: 1; }
  100% { opacity: 0.5; }
}

.skeleton-block {
  height: 60px;
  background: var(--bg-section);
  border-radius: var(--radius);
  margin: 12px 16px;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-block--short {
  height: 32px;
  margin: 0 16px 12px;
}

/* == Error state == */
.crag-card--error .error-msg {
  padding: 20px 18px;
  color: var(--chalk-dim);
  font-size: 12px;
  line-height: 1.6;
}

/* == Footer == */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  text-align: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--chalk-faint);
}

.site-footer a { color: var(--chalk-faint); }
.site-footer a:hover { color: var(--amber); }

/* == Responsive == */
@media (max-width: 640px) {
  main { padding: 12px; }
  .crags-grid { grid-template-columns: 1fr; gap: 12px; }
  .logo-sub { display: none; }

  .scores-row { grid-template-columns: 1fr; }
  .score-block:first-child { border-right: none; border-bottom: 1px solid var(--border); }

  .hist-day {
    grid-template-columns: 90px 24px 1fr 1fr;
    gap: 6px;
  }
}

@media (max-width: 400px) {
  .crag-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}
