/* ============================================================
   Leiti Backpacking — stylesheet
   Aesthetic: topographic editorial / field journal
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* paper & ink */
  --paper:        #ECE4D0;
  --paper-deep:   #E2D8BE;
  --paper-soft:   #F4EEE0;
  --ink:          #1F2419;
  --ink-soft:     #3A4035;
  --ink-mute:     #6E7268;

  /* accents */
  --alpenglow:    #C56B3A;   /* sunset on granite */
  --alpenglow-d:  #9E5025;
  --pine:         #2D4A3A;   /* sierra forest */
  --sepia:        #8B6F47;   /* contour-line brown */
  --lake:         #4A6B7C;   /* alpine lake on faded map */
  --granite:      #9CA39A;   /* gray-green stone */

  /* type */
  --display: "Fraunces", "Iowan Old Style", "Apple Garamond", Georgia, serif;
  --body:    "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;

  /* layout */
  --content-max: 1180px;
  --prose-max:    680px;
  --radius:       2px;       /* keep things crisp, not bubbly */
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, picture, svg, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* ---------- 3. Base ---------- */
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  /* subtle paper grain via SVG noise */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.12  0 0 0 0 0.14  0 0 0 0 0.10  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-blend-mode: multiply;
  background-size: 220px 220px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

::selection { background: var(--alpenglow); color: var(--paper-soft); }

/* ---------- 4. Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 500;
  font-variation-settings: "SOFT" 60, "WONK" 0, "opsz" 144;
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--ink);
}
h1 { font-size: clamp(2.5rem, 6vw, 4.75rem); }
h2 { font-size: clamp(1.85rem, 3.5vw, 2.6rem); letter-spacing: -0.02em; }
h3 { font-size: 1.35rem; letter-spacing: -0.01em; }
h4 { font-size: 1.05rem; }

p { max-width: var(--prose-max); }
p + p { margin-top: var(--s-4); }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--alpenglow); text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: color .2s; }
a:hover { color: var(--alpenglow-d); }

strong { font-weight: 600; }

/* small-caps editorial label */
.eyebrow {
  font-family: var(--body);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--alpenglow-d);
}

/* hairline rule */
hr {
  border: 0;
  height: 1px;
  background: var(--ink);
  opacity: 0.18;
  margin: var(--s-7) 0;
}

/* ---------- 5. Layout ---------- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--s-5);
}
.container--narrow { max-width: 820px; }

.stack > * + * { margin-top: var(--s-5); }
.stack-tight > * + * { margin-top: var(--s-3); }
.stack-loose > * + * { margin-top: var(--s-7); }

/* ---------- 6. Topographic divider ---------- */
.topo-divider {
  height: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 28' preserveAspectRatio='none'><g fill='none' stroke='%238B6F47' stroke-width='0.7' opacity='0.55'><path d='M0 6 Q 150 0 300 6 T 600 6 T 900 6 T 1200 6'/><path d='M0 14 Q 200 8 400 14 T 800 14 T 1200 14'/><path d='M0 22 Q 100 16 250 22 T 550 22 T 850 22 T 1200 22'/></g></svg>");
  background-size: 1200px 28px;
  background-repeat: repeat-x;
  margin: var(--s-7) 0;
}

/* ---------- 7. Site header ---------- */
.site-header {
  padding: var(--s-5) 0 var(--s-4);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
}
.brand {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.55ch;
}
.brand__mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--alpenglow);
  border-radius: 50%;
  margin-right: 0.3ch;
  position: relative;
  top: 1px;
}
.brand small {
  font-family: var(--body);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.nav { display: flex; gap: var(--s-5); align-items: center; }
.nav a {
  font-family: var(--body);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  padding: var(--s-2) 0;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1.5px;
  background: var(--alpenglow);
  transition: right 0.3s ease;
}
.nav a:hover::after, .nav a[aria-current="page"]::after { right: 0; }

@media (max-width: 640px) {
  .brand { font-size: 1.25rem; }
  .brand small { display: none; }
  .nav { gap: var(--s-4); }
  .nav a { font-size: 0.72rem; letter-spacing: 0.1em; }
}

/* ---------- 8. Hero ---------- */
.hero {
  padding: var(--s-8) 0 var(--s-7);
  position: relative;
}
.hero__eyebrow { margin-bottom: var(--s-4); }
.hero__title {
  font-size: clamp(2.75rem, 7.5vw, 6rem);
  letter-spacing: -0.025em;
  line-height: 0.95;
  font-variation-settings: "SOFT" 90, "WONK" 0, "opsz" 144;
}
.hero__title em {
  font-style: italic;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  color: var(--alpenglow-d);
}
.hero__lede {
  margin-top: var(--s-5);
  font-size: 1.2rem;
  max-width: 56ch;
  color: var(--ink-soft);
}
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-5);
  margin-top: var(--s-6);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.hero__meta span {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.hero__meta span::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--alpenglow);
  border-radius: 50%;
}

/* ---------- 9. Trip cards (home grid) ---------- */
.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--s-6) var(--s-5);
  margin-top: var(--s-6);
}
.trip-card {
  display: block;
  text-decoration: none;
  position: relative;
  transition: transform .35s ease;
}
.trip-card:hover { transform: translateY(-4px); }
.trip-card__photo {
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  background-size: cover;
  background-position: center;
  border: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
  position: relative;
  overflow: hidden;
}
.trip-card__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(31,36,25,0.4) 100%);
  pointer-events: none;
}
.trip-card__num {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--paper-soft);
  background: rgba(31,36,25,0.65);
  padding: 4px 8px;
  z-index: 1;
}
.trip-card__region {
  position: absolute;
  bottom: var(--s-3);
  left: var(--s-3);
  z-index: 1;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--paper-soft);
}
.trip-card__body { padding: var(--s-4) 0 0; }
.trip-card__title {
  font-family: var(--display);
  font-size: 1.5rem;
  letter-spacing: -0.015em;
  line-height: 1.1;
  font-weight: 500;
  font-variation-settings: "SOFT" 60, "opsz" 144;
}
.trip-card__stats {
  display: flex;
  gap: var(--s-4);
  margin-top: var(--s-3);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.trip-card__stats span strong {
  color: var(--ink);
  font-weight: 600;
  margin-right: 0.3ch;
}

/* ---------- 10. Filter bar ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-5);
  padding: var(--s-4) 0;
  border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
  align-items: center;
}
.filters__label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-right: var(--s-3);
}
.filter-pill {
  padding: var(--s-2) var(--s-3);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s;
  color: var(--ink-soft);
}
.filter-pill:hover { border-color: var(--ink); color: var(--ink); }
.filter-pill[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper-soft);
  border-color: var(--ink);
}

/* ---------- 11. Trip page hero & layout ---------- */
.trip-hero {
  position: relative;
  padding: 0;
  margin-top: var(--s-2);
}
.trip-hero__photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--paper-deep);
  background-size: cover;
  background-position: center;
  border: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
}
.trip-hero__title-block { padding: var(--s-6) 0 var(--s-5); }
.trip-hero__title { font-size: clamp(2.25rem, 5vw, 4rem); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  margin-top: var(--s-5);
  border-top: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
}
.stat {
  padding: var(--s-4) var(--s-4);
  border-right: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}
.stat:last-child { border-right: 0; }
.stat__label {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: var(--s-2);
}
.stat__value {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 500;
  font-variation-settings: "SOFT" 60, "opsz" 144;
  letter-spacing: -0.01em;
}
@media (max-width: 640px) {
  .stat { padding: var(--s-3); border-right: 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); }
  .stat:last-child { border-bottom: 0; }
}

/* ---------- 12. Section labels ---------- */
.section { padding: var(--s-7) 0; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-5);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
}
.section__head h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.section__num {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
}

/* ---------- 13. Map ---------- */
.map-wrap {
  position: relative;
  margin-top: var(--s-4);
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  background: var(--paper-deep);
}
#trip-map {
  width: 100%;
  height: 460px;
}
.map-note {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  background: var(--paper-soft);
}

/* ---------- 14. Checklist ---------- */
.checklist__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
  margin-bottom: var(--s-5);
  padding: var(--s-4);
  background: var(--paper-soft);
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}
.checklist__controls label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 500;
}
.checklist__controls input[type="number"] {
  width: 60px;
  padding: 4px 8px;
  border: 1px solid var(--ink-soft);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.9rem;
}

.gear-cat { margin-bottom: var(--s-6); }
.gear-cat__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.gear-cat__title {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 500;
}
.gear-cat__count {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
}

.gear-list { list-style: none; padding: 0; margin: 0; }
.gear-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--s-3);
  align-items: baseline;
  padding: var(--s-3) 0;
  border-bottom: 1px dotted color-mix(in srgb, var(--ink) 25%, transparent);
}
.gear-item input[type="checkbox"] {
  appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--ink);
  background: transparent;
  cursor: pointer;
  position: relative;
  margin: 0;
  flex-shrink: 0;
}
.gear-item input[type="checkbox"]:checked { background: var(--ink); }
.gear-item input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: -3px; left: 2px;
  color: var(--paper-soft);
  font-size: 14px;
  font-weight: 700;
}
.gear-item__name { font-weight: 500; }
.gear-item__name small {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-top: 2px;
}
.gear-item__weight {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  white-space: nowrap;
}
.gear-item__tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--alpenglow-d);
  white-space: nowrap;
}
.gear-item--checked .gear-item__name {
  text-decoration: line-through;
  text-decoration-color: var(--ink-mute);
  color: var(--ink-mute);
}

.weight-totals {
  position: sticky;
  bottom: var(--s-4);
  margin-top: var(--s-6);
  padding: var(--s-4) var(--s-5);
  background: var(--ink);
  color: var(--paper-soft);
  display: flex;
  justify-content: space-between;
  gap: var(--s-5);
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  z-index: 5;
}
.weight-totals strong { color: var(--alpenglow); font-weight: 600; }

/* ---------- 15. Food grid ---------- */
.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-5);
}
.food-card {
  padding: var(--s-5);
  border: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
  background: var(--paper-soft);
  position: relative;
}
.food-card__type {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--alpenglow-d);
  font-weight: 600;
  margin-bottom: var(--s-2);
}
.food-card__name {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: var(--s-2);
}
.food-card__meta {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-mute);
  margin-bottom: var(--s-3);
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.food-card__meta span::before { content: "·"; margin-right: var(--s-3); color: var(--ink-mute); }
.food-card__meta span:first-child::before { display: none; margin-right: 0; }

/* ---------- 16. Prose ---------- */
.prose { max-width: var(--prose-max); }
.prose h2 { margin-top: var(--s-7); margin-bottom: var(--s-4); }
.prose h3 { margin-top: var(--s-5); margin-bottom: var(--s-3); }
.prose p { margin-top: var(--s-4); }
.prose ul, .prose ol { margin: var(--s-4) 0; padding-left: var(--s-5); }
.prose li { margin-bottom: var(--s-2); }
.prose blockquote {
  border-left: 2px solid var(--alpenglow);
  padding-left: var(--s-4);
  margin: var(--s-5) 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--ink-soft);
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}

/* ---------- 17. Footer ---------- */
.site-footer {
  margin-top: var(--s-9);
  padding: var(--s-7) 0 var(--s-6);
  border-top: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  background: color-mix(in srgb, var(--paper) 50%, var(--paper-deep));
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-5);
  align-items: flex-end;
}
.site-footer p {
  font-size: 0.85rem;
  color: var(--ink-mute);
  max-width: 50ch;
}
.site-footer .brand { font-size: 1.3rem; }
.site-footer__cred {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ---------- 18. Reveal animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(12px);
    animation: reveal 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  }
  .reveal-1 { animation-delay: 0.05s; }
  .reveal-2 { animation-delay: 0.15s; }
  .reveal-3 { animation-delay: 0.25s; }
  .reveal-4 { animation-delay: 0.35s; }
  @keyframes reveal {
    to { opacity: 1; transform: none; }
  }
}

/* ---------- 19. Utility ---------- */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-7);
}
@media (max-width: 760px) { .split-2 { grid-template-columns: 1fr; gap: var(--s-5); } }

.text-mute { color: var(--ink-mute); }
.text-small { font-size: 0.85rem; }

.tag {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  margin-right: var(--s-2);
  font-weight: 500;
  color: var(--ink-soft);
}
.tag--accent { border-color: var(--alpenglow); color: var(--alpenglow-d); }

.placeholder-photo {
  background: linear-gradient(135deg, var(--paper-deep) 0%, var(--granite) 50%, var(--paper-deep) 100%);
  position: relative;
}
.placeholder-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    transparent 0,
    transparent 14px,
    color-mix(in srgb, var(--sepia) 30%, transparent) 14px,
    color-mix(in srgb, var(--sepia) 30%, transparent) 15px
  );
  opacity: 0.4;
}
