/* ==========================================================================
   Aisle to Away — Components
   Shared UI pieces. Requires /css/tokens.css loaded first.
   ========================================================================== */

/* ---------- Premium typography baseline ------------------------------------ */
/* Applied sitewide via :root-level rules. Enables the OpenType features
   Instrument Serif ships with (ligatures, kerning, discretionary-ligatures,
   old-style numerals) and refines default display tracking. */

html {
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5,
.hero h1, .hero-overlay h1,
.editorial-title, .nl-title, .cinematic-text h2,
.guide-h2, .display, .gate-title,
.dest-info h2, .venue-name, .place-name, .hero-badge + h1 {
  font-feature-settings: "kern" 1, "liga" 1, "dlig" 1, "calt" 1, "onum" 1;
  font-optical-sizing: auto;
  text-wrap: balance;
}

/* Display-class headings (hero H1 in particular) deserve tighter tracking. */
.hero h1,
.hero-overlay h1,
.cinematic-text h2,
.display {
  letter-spacing: -0.032em;
  line-height: 1.02;
}

/* Emphasised italic inside serif headings reads more editorial. */
h1 em, h2 em, h3 em,
.display em, .hero h1 em, .hero-overlay h1 em {
  font-style: italic;
  font-feature-settings: "kern" 1, "liga" 1, "dlig" 1, "calt" 1, "salt" 1;
  color: var(--accent);
}

/* All-caps labels: more air on larger sizes, taut on small. */
.hero-label, .dest-label, .editorial-label, .nl-label,
.stories-label, .section-label, .guide-label, .header-label,
.kicker, .gate-label {
  font-feature-settings: "kern" 1, "ss01" 1;
}

/* ---------- Premium button system ----------------------------------------- */
/* Three variants, one base. Use .btn + a modifier. Safe to layer over legacy
   classes (e.g. class="buy-btn btn btn--ink") without breaking existing CSS. */

.btn {
  --btn-pad-y: 18px;
  --btn-pad-x: 44px;
  --btn-gap: 14px;
  --btn-fs: 0.78rem;
  --btn-ls: 0.22em;

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-family: var(--sans);
  font-size: var(--btn-fs);
  font-weight: 500;
  letter-spacing: var(--btn-ls);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: inherit;
  transition:
    background 420ms var(--ease-editorial),
    color 420ms var(--ease-editorial),
    border-color 420ms var(--ease-editorial),
    transform 420ms var(--ease-editorial),
    box-shadow 420ms var(--ease-editorial);
  will-change: transform;
}
.btn:focus-visible { outline-offset: 4px; }

/* Keyline — editorial, framed. Crisp 1px border with a gold wash on hover. */
.btn--keyline {
  border-color: var(--text1);
  color: var(--text1);
  background: transparent;
}
.btn--keyline::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 520ms var(--ease-editorial);
  z-index: -1;
}
.btn--keyline:hover {
  color: var(--cream);
  border-color: var(--accent);
}
.btn--keyline:hover::before { transform: scaleX(1); }

/* Ink — filled primary. For the single most important action on a page.
   Subtle rise on hover, gold rule sweeps in under the label. */
.btn--ink {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
  overflow: hidden;
}
.btn--ink::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 24px;
  height: 1px;
  background: var(--accent);
  transform: translateX(-50%) scaleX(0);
  transition: transform 520ms var(--ease-editorial);
}
.btn--ink:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 40px -12px rgba(31, 31, 31, 0.45);
}
.btn--ink:hover::after { transform: translateX(-50%) scaleX(1); }
.btn--ink:active { transform: translateY(0); }

/* Cream — inverse for dark sections. Same mechanics as ink. */
.btn--cream {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
  overflow: hidden;
}
.btn--cream::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 24px;
  height: 1px;
  background: var(--accent);
  transform: translateX(-50%) scaleX(0);
  transition: transform 520ms var(--ease-editorial);
}
.btn--cream:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.35);
}
.btn--cream:hover::after { transform: translateX(-50%) scaleX(1); }

/* Rule — text-only link with a growing gold hairline. Editorial, minimal. */
.btn--rule {
  padding: 14px 0;
  color: var(--text1);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
}
.btn--rule .btn-line {
  display: inline-block;
  width: 40px;
  height: 1px;
  background: var(--accent);
  transition: width 520ms var(--ease-editorial);
}
.btn--rule:hover .btn-line { width: 72px; }

/* Size modifier for the single most prominent purchase CTA. */
.btn--xl {
  --btn-pad-y: 22px;
  --btn-pad-x: 64px;
  --btn-fs: 0.82rem;
  --btn-ls: 0.24em;
}

/* Serif accent glyph that sits before the label — small editorial flourish. */
.btn-accent {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05em;
  letter-spacing: 0;
  color: var(--accent);
  text-transform: none;
}

/* ---------- Climate strip -------------------------------------------------- */
/* 12-cell monthly strip: ideal / shoulder / avoid states with hover detail. */

.climate-strip {
  margin: 48px 0 32px;
}
.climate-strip-label {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}
.climate-months {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  border: 1px solid var(--border-visible);
  background: var(--border-visible);
}
.climate-cell {
  position: relative;
  background: var(--cream-warm);
  border: none;
  padding: 14px 4px 12px;
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  cursor: pointer;
  transition: background 300ms var(--ease-editorial),
              color 300ms var(--ease-editorial);
}
.climate-cell::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin: 0 auto 8px;
  background: currentColor;
  opacity: 0.35;
  transition: opacity 300ms, transform 300ms var(--ease-editorial);
}
.climate-cell[data-state="ideal"] { color: var(--accent); }
.climate-cell[data-state="ideal"]::before { background: var(--accent); opacity: 1; }
.climate-cell[data-state="shoulder"] { color: var(--accent-soft); }
.climate-cell[data-state="shoulder"]::before { background: var(--accent-soft); opacity: 0.7; }
.climate-cell[data-state="avoid"] { color: var(--text3); }
.climate-cell[data-state="avoid"]::before { background: var(--text3); opacity: 0.25; }

.climate-cell:hover,
.climate-cell:focus-visible,
.climate-cell.is-active {
  background: var(--cream);
  color: var(--text1);
}
.climate-cell:hover::before,
.climate-cell:focus-visible::before,
.climate-cell.is-active::before { transform: scale(1.3); opacity: 1; }

.climate-detail {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--accent-subtle);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: baseline;
  min-height: 58px;
  transition: opacity 300ms var(--ease-editorial);
}
.climate-detail-month {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--text1);
  letter-spacing: -0.005em;
}
.climate-detail-note {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text2);
}
.climate-detail-state {
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.climate-detail-state[data-state="shoulder"] { color: var(--accent-soft); }
.climate-detail-state[data-state="avoid"] { color: var(--text3); }

.climate-legend {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-visible);
  display: flex;
  gap: 20px 24px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
}
.climate-legend-label {
  color: var(--text3);
  opacity: 0.7;
  margin-right: 4px;
}
.climate-legend-label::after { content: ':'; margin-left: 2px; }
.climate-legend-item { display: inline-flex; align-items: center; gap: 8px; }
.climate-legend-item::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.climate-legend .lg-ideal { color: var(--accent); }
.climate-legend .lg-shoulder { color: var(--accent-soft); }
.climate-legend .lg-avoid { color: var(--text3); }
/* Back-compat: existing templates use plain <span class="lg-*"> */
.climate-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.climate-legend > span.lg-ideal::before,
.climate-legend > span.lg-shoulder::before,
.climate-legend > span.lg-avoid::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

@media (max-width: 640px) {
  .climate-cell { font-size: 0.55rem; padding: 10px 2px 8px; letter-spacing: 0.04em; }
  .climate-cell::before { width: 5px; height: 5px; margin-bottom: 6px; }
  .climate-detail {
    grid-template-columns: 1fr;
    gap: 6px;
    min-height: 0;
  }
  .climate-detail-state { justify-self: start; }
}

/* ---------- View Transitions (progressive enhancement) -------------------- */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 320ms;
  animation-timing-function: var(--ease-editorial, ease);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}
