/*
 * layout.css — Eclipse 2026 Covarrubias
 * ─────────────────────────────────────────────────────────────
 * Structural layout only. No colors, no typography decoration.
 * All sizing/spacing uses tokens from theme.css.
 * ─────────────────────────────────────────────────────────────
 */

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: var(--transition-theme);
}

img, video, iframe { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

/* ── THEME TOGGLE — sticky top-right ── */
.theme-toggle {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  transition: var(--transition-theme), transform var(--dur-base) var(--ease-out);
}
.theme-toggle:hover { transform: scale(1.1); }
.theme-toggle:active { transform: scale(0.95); }

/* ── MAIN CONTAINER ── */
.page-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Full-bleed override for map */
.section--fullbleed { margin: 0 calc(-1 * var(--space-4)); }

/* ── SECTION BASE ── */
.section {
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.section:last-of-type { border-bottom: none; }

.section__label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: var(--leading-snug);
  margin-bottom: var(--space-2);
}

/* ── HERO / COUNTDOWN SECTION ── */
.section--hero {
  padding-top: var(--space-12);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.hero__location {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 5vw, var(--text-2xl));
  font-weight: 600;
  line-height: var(--leading-tight);
  margin-bottom: var(--space-1);
}

.hero__subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-md);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

/* ── COUNTDOWN GRID ── */
.countdown {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.countdown__digit {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1;
  min-width: 2.2ch;
  text-align: center;
  letter-spacing: -0.02em;
}

.countdown__sep {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 400;
  line-height: 1;
  color: var(--text-tertiary);
  padding-top: 0.05em;
  user-select: none;
}

.countdown__label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ── ECLIPSE PHASE BAR ── */
.phase-bar {
  width: 100%;
  margin-top: var(--space-6);
}

.phase-bar__track {
  display: flex;
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--border-subtle);
  margin-bottom: var(--space-2);
}

.phase-bar__segment {
  height: 100%;
  transition: width var(--dur-slow) var(--ease-out);
}

.phase-bar__labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ── CONTACT TIMES GRID ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.contact-card {
  padding: var(--space-4) var(--space-5);
}

.contact-card--duration {
  padding: var(--space-4) var(--space-5);
}

/* ── WEATHER GRID ── */
.weather-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.weather-metric {
  padding: var(--space-4) var(--space-3);
  text-align: center;
}

.weather-history {
  margin-top: var(--space-2);
}

.history-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 48px;
  padding-bottom: var(--space-1);
}

.history-bar {
  flex: 1;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 4px;
  transition: opacity var(--dur-base);
}

.history-axis {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-1);
}

/* ── MAP ── */
.map-container {
  width: 100%;
  height: 320px;
  position: relative;
}

@media (min-width: 480px) {
  .map-container { height: 400px; }
}

.map-overlay-controls {
  position: absolute;
  bottom: var(--space-3);
  right: var(--space-3);
  z-index: var(--z-overlay);
  display: flex;
  gap: var(--space-2);
}

/* ── SKY VIEW ── */
.skyview-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
}

.skyview-frame iframe { width: 100%; height: 100%; border: 0; }

.skyview__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
}

.skyview__live-badge {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ── ACCORDION ── */
.accordion { display: flex; flex-direction: column; }

.accordion__item {
  border-bottom: 1px solid var(--border-subtle);
}
.accordion__item:last-child { border-bottom: none; }

.accordion__trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  gap: var(--space-4);
}

.accordion__icon {
  flex-shrink: 0;
  transition: transform var(--dur-base) var(--ease-out);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.accordion__item[open] .accordion__icon { transform: rotate(180deg); }

.accordion__body {
  padding-bottom: var(--space-5);
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--text-secondary);
}

/* ── SAFETY BANNER ── */
.safety-banner {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

/* ── FOOTER ── */
.footer {
  padding: var(--space-8) 0 var(--space-6);
  text-align: center;
}

.footer__grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: var(--z-toast);
  max-width: calc(100vw - var(--space-8));
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: transform var(--dur-slow) var(--ease-out);
  pointer-events: none;
}
.toast--visible {
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ── RESPONSIVE ── */
@media (min-width: 480px) {
  .countdown__digit { font-size: var(--text-4xl); }
  .contact-grid { gap: var(--space-4); }
}

@media (min-width: 640px) {
  .page-wrapper { padding: 0 var(--space-6); }
  .section--hero { padding-top: var(--space-16); }
}
