@layer base, components, pages;
@layer pages {
  /* Contourkeep hike pages (landing, Christmas and birthday gift, park and index).
     Builds on relief.css (.ck) and the alpenglow tokens; light and dark from tokens. */
  .hk .page { max-width: 76rem; }
  .hk-crumbs { font-size: var(--text-sm); color: var(--muted); margin: 0 0 var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-2); }
  .hk-crumbs a { color: var(--muted); text-underline-offset: 3px; }
  .hk-crumbs [aria-current] { color: var(--fg); font-weight: 600; }
  .hk .hk-kicker { font: 600 var(--text-xs)/1.4 var(--font-mono); font-stretch: 100%; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 var(--space-3); }

  /* Hero: the illustration as a wide banner, copy below on phones, beside on wide screens. */
  .hk-hero { display: grid; gap: var(--space-6); margin: 0 0 var(--space-12); }
  .hk-hero-art { margin: 0; position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--terrain);
                 box-shadow: 0 24px 60px -30px rgb(20 24 27 / .55); }
  .hk-hero-art img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
  .hk-hero-art img.is-tile, .hk-card img.is-tile, .hk-park-thumb img.is-tile { object-position: center; filter: saturate(.9); }
  .hk-art-note { position: absolute; left: var(--space-3); bottom: var(--space-3); max-width: calc(100% - var(--space-6));
                 padding: 2px var(--space-2); border-radius: var(--radius-sm); font: 500 var(--text-xs)/1.5 var(--font-mono);
                 background: rgb(21 24 27 / .72); color: #ECE8E1; backdrop-filter: blur(4px); }
  .hk-hero-copy > * + * { margin-top: var(--space-4); }
  /* Phones: the words and the button first, the picture right after (ads land here). */
  @media (max-width: 63.99rem) { .hk-hero-copy { order: -1; } }
  .hk-hero-copy h1 { font-size: clamp(2.1rem, 5.4vw, 4rem); line-height: 1.02; text-wrap: balance; margin: 0; }
  .hk-hero-copy .lede { color: var(--fg); max-width: 58ch; }
  @media (min-width: 64rem) {
    .hk-hero { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: center; gap: var(--space-10, 2.5rem); }
  }
  .hk-christmas .hk-hero-copy .eyebrow::before { content: "✦ "; color: var(--route); }
  .hk-birthday .hk-hero-copy .eyebrow::before { content: "◆ "; color: var(--route); }

  /* The hike's facts, each with its source. */
  .hk-facts { margin: 0 0 var(--space-12); }
  .hk-why { font-family: var(--font-display); font-size: clamp(var(--text-lg), 2.4vw, var(--text-2xl)); font-weight: 600; line-height: 1.3;
            max-width: 40ch; text-wrap: pretty; margin: 0 0 var(--space-6); }
  .hk-fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1px; margin: 0;
                  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
  .hk-fact-grid > div { background: var(--surface); padding: var(--space-4); min-width: 0; }
  .hk-fact-grid dt { font: 600 var(--text-xs)/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  .hk-fact-grid dd { margin: var(--space-1) 0 0; font-weight: 600; overflow-wrap: anywhere; }
  .hk-source { font-size: var(--text-sm); color: var(--muted); margin-top: var(--space-3); }

  /* The terrain tile render. */
  .hk-tile { display: grid; gap: var(--space-6) var(--space-10, 2.5rem); align-items: center; margin: 0 0 var(--space-12); }
  @media (min-width: 52rem) { .hk-tile { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
  .hk-tile-figure { margin: 0; aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line);
                    background: radial-gradient(circle at 50% 40%, var(--surface), var(--terrain)); transform: perspective(900px) rotateX(8deg);
                    box-shadow: 0 30px 50px -30px rgb(20 24 27 / .6); }
  .hk-tile-figure img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .hk-tile-missing { display: grid; place-items: center; height: 100%; color: var(--muted); }
  .hk-tile-facts { list-style: none; padding: 0; margin: var(--space-4) 0; display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--text-sm); }
  .hk-tile-facts li { padding: var(--space-1) var(--space-3); border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); }
  .hk-tile-facts b { color: var(--fg); font-weight: 600; }
  @media (prefers-reduced-motion: reduce) { .hk-tile-figure { transform: none; } }

  .hk-steps { margin-bottom: var(--space-12); }

  /* Gift panel (Christmas and birthday pages). */
  .hk-gift { display: grid; gap: var(--space-6); margin: 0 0 var(--space-12); padding: var(--space-6); border-left: 4px solid var(--route); }
  @media (min-width: 52rem) { .hk-gift { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; } }
  .hk-gift-cta { display: grid; gap: var(--space-2); }
  .hk-gift-cta .quote-total, .hk-order-total .quote-total { font-family: var(--font-display); font-weight: 800; font-size: var(--text-3xl); margin: 0; }

  /* Compact preorder form. */
  .hk-order { padding-top: var(--space-8); border-top: 1px solid var(--line); }
  .hk-order-form { display: grid; gap: var(--space-6); align-items: end; }
  @media (min-width: 56rem) { .hk-order-form { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
  .hk-order-total { display: grid; gap: var(--space-2); }

  /* Cards: other hikes, park lists. */
  .hk-cards { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
  .hk-card { display: grid; border-radius: var(--radius-md); overflow: hidden; background: var(--surface); border: 1px solid var(--line);
             color: var(--fg); text-decoration: none; transition: border-color .15s, transform .15s; }
  .hk-card:hover { border-color: var(--route); transform: translateY(-2px); }
  .hk-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--terrain); }
  .hk-card-text { display: grid; gap: 2px; padding: var(--space-3); }
  .hk-card-text .mono { font-size: var(--text-xs); color: var(--muted); }
  .hk-card-gifts { font-size: var(--text-sm); margin: var(--space-2) 0 0; color: var(--muted); }
  .hk-variants { font-size: var(--text-sm); margin-top: var(--space-4); }
  .hk-more { margin: 0 0 var(--space-12); }

  /* Index */
  .hk-index-hero { display: grid; gap: var(--space-6); margin: 0 0 var(--space-8); }
  .hk-index-hero h1 { font-size: clamp(2.1rem, 5.4vw, 4rem); line-height: 1.02; text-wrap: balance; }
  @media (min-width: 64rem) { .hk-index-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; } .hk-mosaic-note { grid-column: 2; } }
  .hk-mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
  .hk-mosaic img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); }
  .hk-mosaic img:nth-child(1) { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; height: 100%; }
  .hk-mosaic-note { margin: calc(-1 * var(--space-4)) 0 0; }
  .hk-park-jump { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-10, 2.5rem); }
  .hk-park-jump a { padding: var(--space-1) var(--space-3); border: 1px solid var(--line); border-radius: 999px; font-size: var(--text-sm);
                    color: var(--fg); text-decoration: none; background: var(--surface); }
  .hk-park-jump a:hover { border-color: var(--route); }
  .hk-park-block { margin: 0 0 var(--space-12); scroll-margin-top: var(--space-6); }
  .hk-park-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); border-bottom: 1px solid var(--line); padding-bottom: var(--space-2); }
  .hk-park-head h2 { margin: 0; font-size: clamp(var(--text-xl), 3vw, var(--text-2xl)); }
  .hk-park-head h2 a { color: var(--fg); text-decoration: none; }
  .hk-park-head p { margin: 0; }

  /* Park page rows */
  .hk-park-list { list-style: none; padding: 0; margin: 0 0 var(--space-12); display: grid; gap: var(--space-8); }
  .hk-park-row { display: grid; gap: var(--space-4); align-items: start; padding-top: var(--space-6); border-top: 1px solid var(--line); }
  @media (min-width: 48rem) { .hk-park-row { grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); } }
  .hk-park-row h2 { margin: 0 0 var(--space-1); font-size: var(--text-xl); }
  .hk-park-row h2 a { color: var(--fg); text-decoration-color: var(--route); text-underline-offset: 4px; }
  .hk-park-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-md); background: var(--terrain); }
}
