/* ================================================================
   ECOCOMPASS · GLOBAL STYLESHEET
   Dark-mode, glassmorphism, smooth micro-animations.
   Browser support: all modern browsers (no IE).
================================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  /* Background palette · deep navy/indigo */
  --bg-base:        #080c18;
  --bg-surface:     #0e1628;
  --bg-card:        rgba(14, 22, 48, 0.72);
  --bg-card-hover:  rgba(22, 34, 70, 0.85);

  /* Accent colours · eco green + solar gold palette */
  --accent-gold:    #ffd700;
  --accent-orange:  #ff8c42;
  --accent-rose:    #ff6b6b;
  --accent-blue:    #4fc3f7;
  --accent-noon:    #fff176;
  --accent-leaf:    #7ed957;
  --accent-forest:  #3fa34d;

  /* Text */
  --text-primary:   #f0f4ff;
  --text-secondary: #8a9bca;
  --text-muted:     #4a5580;

  /* Glass border */
  --border:         rgba(255, 255, 255, 0.08);
  --border-active:  rgba(126, 217, 87, 0.35);

  /* Gradients */
  --grad-hero:      linear-gradient(135deg, #0d1b3e 0%, #1a0a2e 50%, #0a1628 100%);
  --grad-card:      linear-gradient(145deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  --grad-sunrise:   linear-gradient(135deg, #ff6b35 0%, #ffd700 100%);
  --grad-noon:      linear-gradient(135deg, #fff176 0%, #ffb347 100%);
  --grad-sunset:    linear-gradient(135deg, #ff6b6b 0%, #c850c0 100%);
  --grad-primary:   linear-gradient(135deg, #7ed957 0%, #ffd700 100%);

  /* Spacing scale */
  --sp-xs:  0.25rem;
  --sp-sm:  0.5rem;
  --sp-md:  1rem;
  --sp-lg:  1.5rem;
  --sp-xl:  2rem;
  --sp-2xl: 3rem;

  /* Typography */
  --font-sans: 'InterVariable', 'Inter', system-ui, sans-serif;
  --font-mono: 'InterVariable', 'Inter', system-ui, sans-serif;

  /* Radii */
  --r-sm:   6px;
  --r-md:   12px;
  --r-lg:   20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-card: 0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 40px rgba(255, 215, 0, 0.12);

  /* Transitions */
  --t-fast: 150ms ease;
  --t-med:  280ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 420ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  /* Smooth scrolling for anchor links */
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  /* Subtle star-field background */
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 55%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 20%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 75% 70%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 35%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 20% 85%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 65% 45%, rgba(255,255,255,0.2) 0%, transparent 100%),
    var(--grad-hero);
  background-attachment: fixed;
}

/* ── Typography utilities ───────────────────────────────────── */
.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ── Layout containers ──────────────────────────────────────── */
.main-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--sp-md) var(--sp-md) var(--sp-2xl);
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: var(--sp-lg);
}

/* Two columns on wider screens: inputs left, scene right, results span */
@media (min-width: 920px) {
  .main-container { grid-template-columns: 1fr 1fr; }
  .input-card   { grid-column: 1; }
  .scene-card   { grid-column: 2; position: sticky; top: var(--sp-md); }
  .results-card { grid-column: 1 / -1; }
}

/* ── HEADER ─────────────────────────────────────────────────── */
.site-header {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: var(--sp-2xl) var(--sp-md) var(--sp-xl);
}

/* Subtle radial glow behind the sun icon */
.header-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 70% at 50% 30%, rgba(255,180,50,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.header-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
}

.sun-icon {
  width: 80px;
  height: 80px;
  /* Slow rotation animation */
  animation: spin-slow 30s linear infinite;
  filter: drop-shadow(0 0 18px rgba(255, 180, 50, 0.5));
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.header-text h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: var(--sp-xs);
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  /* Glassmorphism blur */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-xl);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

/* Subtle top-edge highlight (glass effect) */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

/* ── TABS ───────────────────────────────────────────────────── */
.tab-group {
  display: flex;
  gap: var(--sp-xs);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--r-md);
  padding: var(--sp-xs);
  margin-bottom: var(--sp-lg);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  padding: var(--sp-sm) var(--sp-xs);
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-med), color var(--t-med);
  white-space: nowrap;
}

.tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Active tab gets a glowing pill */
.tab.active {
  background: linear-gradient(135deg, rgba(126,217,87,0.15), rgba(63,163,77,0.12));
  color: var(--accent-leaf);
  box-shadow: 0 0 12px rgba(126,217,87,0.1);
}

.tab:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

/* ── TAB PANELS ─────────────────────────────────────────────── */
.tab-panel {
  animation: fade-in var(--t-med) forwards;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── FORM ELEMENTS ──────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-md);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}

label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Shared input styles */
.text-input,
.search-input,
input[type="date"].text-input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}

.text-input:focus,
.search-input:focus {
  border-color: var(--accent-leaf);
  box-shadow: 0 0 0 3px rgba(126,217,87,0.12);
  background: rgba(0, 0, 0, 0.45);
}

/* Remove browser default number input spinners */
.text-input[type="number"]::-webkit-inner-spin-button,
.text-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Date input colour fix (browser default is often white) */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(1) saturate(2) hue-rotate(8deg);
  cursor: pointer;
}

/* ── SEARCH WRAPPER ─────────────────────────────────────────── */
.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--t-fast);
}

.search-input {
  padding-left: 2.4rem; /* make room for icon */
}

.search-input:focus ~ .search-icon,
.search-wrapper:focus-within .search-icon {
  color: var(--accent-leaf);
}

/* ── DROPDOWN ───────────────────────────────────────────────── */
.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #0e1628;
  border: 1px solid var(--border-active);
  border-radius: var(--r-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  list-style: none;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
  animation: fade-in var(--t-fast) forwards;
}

.dropdown li {
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-sm);
  transition: background var(--t-fast), color var(--t-fast);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.dropdown li:last-child { border-bottom: none; }

.dropdown li:hover,
.dropdown li.highlighted {
  background: rgba(255, 215, 0, 0.1);
  color: var(--accent-gold);
}

.dropdown li .city-name   { font-weight: 500; }
.dropdown li .city-country { font-size: 0.75rem; color: var(--text-muted); }

/* Selected-city badge */
.selected-city {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: var(--r-sm);
  padding: var(--sp-sm) var(--sp-md);
  font-size: 0.88rem;
  color: var(--accent-gold);
  margin-top: var(--sp-xs);
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 var(--sp-xs);
  margin-left: auto;
  transition: color var(--t-fast);
}

.clear-btn:hover { color: var(--accent-rose); }

.city-missing-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin-top: var(--sp-xs);
  text-align: right;
}

.city-missing-note a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--t-fast);
}

.city-missing-note a:hover {
  color: var(--accent-gold);
}
/* ── DEVICE PANEL ───────────────────────────────────────────── */
.device-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md) 0;
}

.device-hint {
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-align: center;
}

.device-coords {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-blue);
  text-align: center;
  background: rgba(79, 195, 247, 0.08);
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-radius: var(--r-sm);
  padding: var(--sp-sm) var(--sp-md);
  width: 100%;
}

/* ── DATE FIELD ─────────────────────────────────────────────── */
.date-field {
  /* Subtle top separator to visually separate from location panels */
  margin-top: var(--sp-lg);
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--border);
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
  letter-spacing: 0.01em;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:active { transform: scale(0.97); }

/* Primary CTA button · golden gradient */
.btn-primary {
  width: 100%;
  margin-top: var(--sp-lg);
  background: var(--grad-primary);
  color: #1a0a00;
  box-shadow: 0 4px 16px rgba(255, 180, 50, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(255, 180, 50, 0.45);
  transform: translateY(-1px);
}

/* Secondary button · subtle outline */
.btn-secondary {
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid rgba(79, 195, 247, 0.25);
  color: var(--accent-blue);
}

.btn-secondary:hover {
  background: rgba(79, 195, 247, 0.18);
  box-shadow: 0 0 16px rgba(79, 195, 247, 0.18);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── ERROR MESSAGE ──────────────────────────────────────────── */
.error-msg {
  margin-top: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: var(--r-sm);
  color: var(--accent-rose);
  font-size: 0.88rem;
  text-align: center;
  animation: fade-in var(--t-med) forwards;
}

/* ── RESULTS CARD ───────────────────────────────────────────── */
.results-card {
  /* Animate in when revealed */
  animation: slide-up var(--t-slow) forwards;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Summary sentence */
.result-summary {
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-lg);
  border-bottom: 1px solid var(--border);
}

.result-summary p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Highlighted parts within the summary */
.result-summary strong {
  color: var(--accent-gold);
  font-weight: 600;
}

/* ── META PILLS ─────────────────────────────────────────────── */
.meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
}

.pill {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-sm) var(--sp-md);
}

.pill-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pill-value {
  font-size: 0.88rem;
  color: var(--text-primary);
  word-break: break-all;
}

/* ── SUN-TIMES GRID ─────────────────────────────────────────── */
.sun-times-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}

.sun-time-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xs);
  padding: var(--sp-lg) var(--sp-sm);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  text-align: center;
}

.sun-time-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* Each card has its own gradient accent */
.sunrise-card {
  background: linear-gradient(160deg, rgba(255,107,53,0.12) 0%, rgba(255,215,0,0.06) 100%);
  border-color: rgba(255, 140, 66, 0.2);
}

.noon-card {
  background: linear-gradient(160deg, rgba(255,241,118,0.14) 0%, rgba(255,179,71,0.06) 100%);
  border-color: rgba(255, 241, 118, 0.25);
}

.sunset-card {
  background: linear-gradient(160deg, rgba(255,107,107,0.12) 0%, rgba(200,80,192,0.07) 100%);
  border-color: rgba(255, 107, 107, 0.2);
}

.sun-time-icon {
  font-size: 1.8rem;
  line-height: 1;
  /* Subtle bounce on load */
  animation: bounce-in var(--t-slow) both;
}

.sun-time-card:nth-child(2) .sun-time-icon { animation-delay: 0.1s; }
.sun-time-card:nth-child(3) .sun-time-icon { animation-delay: 0.2s; }

@keyframes bounce-in {
  0%   { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

.sun-time-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sun-time-value {
  font-size: clamp(0.95rem, 3vw, 1.2rem);
  font-weight: 500;
  color: var(--text-primary);
  /* Break long placeholder text like "Midnight Sun" gracefully */
  word-break: break-word;
  text-align: center;
}

/* Special polar-condition styling */
.sun-time-value.polar-midnight { color: #b0b8d4; font-size: 0.82rem; }
.sun-time-value.polar-sun      { color: var(--accent-gold); font-size: 0.82rem; }

/* ── DAY LENGTH BAR ─────────────────────────────────────────── */
.day-length {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-sm);
}

.day-length-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.day-length-value {
  font-size: 0.88rem;
  color: var(--accent-gold);
  margin-right: auto;
}

.day-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(0,0,0,0.4);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: var(--sp-xs);
}

.day-bar-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: var(--r-full);
  width: 0%; /* Set by JS */
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── LOADING OVERLAY ────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 24, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  z-index: 999;
}

.loading-overlay p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* CSS-only spinner */
.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255,215,0,0.15);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── FOOTER · Stormberry Branding ─────────────────────────────── */
.site-footer {
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  padding: 4rem 1.5rem 2rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-brand {
  max-width: 320px;
}

.footer-logo {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.footer-dot {
  background: linear-gradient(135deg, #E21E26, #FF4D54);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.footer-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.footer-powered p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-align: right;
  max-width: 250px;
  line-height: 1.6;
}

.footer-powered a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--t-fast);
}

.footer-powered a:hover {
  color: var(--accent-gold);
}

.footer-bottom {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-social {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}

.footer-social a {
  color: var(--text-secondary);
  transition: all var(--t-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-social a:hover {
  color: #E21E26;
  transform: translateY(-2px);
}

.footer-bottom p {
  margin: 0;
}

.footer-privacy {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.8;
  margin-top: 0.25rem !important;
}

.footer-ai {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin-top: 0.15rem !important;
}

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  
  .footer-powered p {
    text-align: center;
    max-width: 100%;
  }

  .footer-bottom {
    gap: 0.8rem;
  }
}


/* ── UTILITIES ──────────────────────────────────────────────── */
[hidden] { display: none !important; }

/* ── RESPONSIVE BREAKPOINTS ─────────────────────────────────── */

/* Small mobile · stack GPS inputs and sun-time cards */
@media (max-width: 480px) {
  .card { padding: var(--sp-lg); }

  .tab { font-size: 0.72rem; padding: var(--sp-sm) var(--sp-xs); }
  .tab svg { display: none; } /* hide icons on tiny screens to save space */

  .field-row { grid-template-columns: 1fr; }

  .sun-times-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-sm);
  }

  .sun-time-card {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    padding: var(--sp-md);
  }

  .sun-time-icon { font-size: 1.4rem; }

  .meta-pills { flex-direction: column; }
  .pill { min-width: unset; }
}

/* App Switcher Carousel */
.app-switcher-container {
  padding: 3rem 0;
  text-align: center;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color, var(--border, rgba(255,255,255,0.08)));
}

.switcher-title {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: -0.5px;
}

.app-switcher-marquee {
  display: flex;
  overflow: hidden;
  padding-bottom: 1rem;
  width: 100%;
}

.app-switcher-track {
  display: flex;
  width: max-content;
  animation: marquee 30s linear infinite;
}

.app-switcher-marquee:hover .app-switcher-track {
  animation-play-state: paused;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-10%); }
}

.switcher-card {
  background: var(--bg-secondary, var(--bg-card, rgba(255,255,255,0.05)));
  border: 1px solid var(--border-color, var(--border, rgba(255,255,255,0.08)));
  border-radius: 12px;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 1rem;
}

.switcher-card:hover {
  transform: translateY(-3px);
  background: var(--bg-tertiary, var(--bg-card-hover, rgba(255,255,255,0.15)));
  box-shadow: 0 4px 12px var(--shadow-color, var(--shadow-card, 0 8px 32px rgba(0,0,0,0.45)));
}

.switcher-card i {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .app-switcher-marquee {
    padding: 0.5rem 1rem 1.5rem 1rem;
  }
}

/* Visible keyboard focus (WCAG 2.4.7) */
:focus-visible{outline:2px solid currentColor;outline-offset:2px;border-radius:4px}

/* ================================================================
   ECOCOMPASS ADDITIONS · header icon, sliders, 3D scene, charts,
   stat variants, print report.
================================================================ */

/* ── HEADER COMPASS ICON ────────────────────────────────────── */
.compass-icon {
  width: 80px;
  height: 80px;
  /* Slow, gentle pulse */
  animation: compass-pulse 8s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(126, 217, 87, 0.45));
}

@keyframes compass-pulse {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 14px rgba(126, 217, 87, 0.35)); }
  50%      { transform: scale(1.06); filter: drop-shadow(0 0 24px rgba(126, 217, 87, 0.55)); }
}

/* ── SECTION HEADINGS ───────────────────────────────────────── */
.section-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--sp-md);
}

/* ── SLIDERS ────────────────────────────────────────────────── */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-md);
}

.slider-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.slider-readout {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-leaf);
  white-space: nowrap;
}

.slider-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, rgba(126,217,87,0.55) 0%, rgba(255,215,0,0.45) 100%);
  border: 1px solid var(--border);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, rgba(126,217,87,0.55) 0%, rgba(255,215,0,0.45) 100%);
  border: 1px solid var(--border);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: rgba(240, 244, 255, 0.9);
  border: 2px solid var(--accent-leaf);
  box-shadow: 0 0 10px rgba(126, 217, 87, 0.5), inset 0 0 4px rgba(255, 255, 255, 0.6);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(240, 244, 255, 0.9);
  border: 2px solid var(--accent-leaf);
  box-shadow: 0 0 10px rgba(126, 217, 87, 0.5), inset 0 0 4px rgba(255, 255, 255, 0.6);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb:hover     { transform: scale(1.12); }

/* Price row inherits .field-row grid; keep the select compact */
.price-row select.text-input {
  cursor: pointer;
}

/* ── 3D SCENE ───────────────────────────────────────────────── */
.scene-card { overflow: visible; }

.scene-viewport {
  position: relative;
  height: 340px;
  perspective: 900px;
  touch-action: none;
  cursor: grab;
  overflow: hidden;
  border-radius: var(--r-md);
}

.scene-viewport:active { cursor: grabbing; }

.scene-world {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  transform-style: preserve-3d;
  transform: rotateX(55deg) rotateZ(var(--orbit, 0deg));
}

/* Ground disc with compass rose */
.ground-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(126,217,87,0.10) 0%, rgba(14,22,40,0.55) 62%, rgba(8,12,24,0.2) 100%);
  border: 1px solid rgba(126, 217, 87, 0.22);
  box-shadow: 0 0 40px rgba(126, 217, 87, 0.08) inset;
  transform-style: preserve-3d;
}

.compass-ring {
  position: absolute;
  inset: 16px;
  border: 1.5px dashed rgba(126, 217, 87, 0.35);
  border-radius: 50%;
}

.compass-tick {
  position: absolute;
  background: rgba(126, 217, 87, 0.6);
}

.tick-n { left: 50%; top: 4px;    width: 2px; height: 12px; margin-left: -1px; }
.tick-s { left: 50%; bottom: 4px; width: 2px; height: 12px; margin-left: -1px; }
.tick-e { right: 4px; top: 50%;   width: 12px; height: 2px; margin-top: -1px; }
.tick-w { left: 4px;  top: 50%;   width: 12px; height: 2px; margin-top: -1px; }

.compass-label {
  position: absolute;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(126, 217, 87, 0.85);
}

.compass-n { left: 50%; top: 18px;    transform: translateX(-50%); color: var(--accent-gold); }
.compass-s { left: 50%; bottom: 18px; transform: translateX(-50%); }
.compass-e { right: 20px; top: 50%;   transform: translateY(-50%); }
.compass-w { left: 20px;  top: 50%;   transform: translateY(-50%); }

/* Glass house · plan 150 x 120, wall height 55 */
.house {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 120px;
  margin: -60px 0 0 -75px;
  transform-style: preserve-3d;
  transform: rotateZ(var(--az-deg, 180deg));
  transition: transform 120ms linear;
}

.house-floor {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(126,217,87,0.10), rgba(255,255,255,0.03));
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.house-wall {
  position: absolute;
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(126,217,87,0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Each wall hangs outward from its shared edge, then folds upright */
.wall-n { left: 0; top: -55px;  width: 150px; height: 55px;  transform-origin: 50% 100%; transform: rotateX(-90deg); }
.wall-s { left: 0; top: 120px;  width: 150px; height: 55px;  transform-origin: 50% 0;    transform: rotateX(90deg); }
.wall-e { left: 150px; top: 0;  width: 55px;  height: 120px; transform-origin: 0 50%;    transform: rotateY(-90deg); }
.wall-w { left: -55px; top: 0;  width: 55px;  height: 120px; transform-origin: 100% 50%; transform: rotateY(90deg); }

/* Gable roof · two planes hinged on the elevated ridge line.
   --ridge-z is set by JS as 55px + 66px * sin(tilt) so the eaves
   stay level with the wall tops at any tilt. */
.roof-plane {
  position: absolute;
  left: -5px;
  width: 160px;
  height: 66px;
  background: linear-gradient(180deg, rgba(255,255,255,0.14) 0%, rgba(126,217,87,0.08) 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  transform-style: preserve-3d;
  transition: transform 120ms linear;
}

.roof-front {
  top: -6px; /* bottom edge sits on the ridge */
  transform-origin: 50% 100%;
  transform: translateZ(var(--ridge-z, 92.9px)) rotateX(var(--tilt-deg, 35deg));
}

.roof-back {
  top: 60px; /* top edge sits on the ridge */
  transform-origin: 50% 0;
  transform: translateZ(var(--ridge-z, 92.9px)) rotateX(calc(var(--tilt-deg, 35deg) * -1));
}

/* Solar panels · dark blue-green cell grid on the front plane */
.panel-grid {
  position: absolute;
  inset: 9% 6%;
  transform: scale(var(--panel-scale, 1));
  transform-origin: 50% 50%;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0 1px, transparent 1px calc(100% / 6)),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.18) 0 1px, transparent 1px calc(100% / 3)),
    linear-gradient(135deg, #0c2f3f 0%, #123c46 45%, #0e4a41 100%);
  border: 2px solid rgba(220, 235, 255, 0.35);
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(79, 195, 247, 0.18);
  transition: transform 120ms linear;
}

.scene-readout {
  margin-top: var(--sp-md);
  text-align: center;
  font-size: 0.88rem;
  color: var(--accent-leaf);
}

.scene-hint {
  margin-top: var(--sp-xs);
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── RESULT STAT VARIANTS (reuse sun-time-card look) ────────── */
.stat-day-card {
  background: linear-gradient(160deg, rgba(255,215,0,0.13) 0%, rgba(255,140,66,0.06) 100%);
  border-color: rgba(255, 215, 0, 0.22);
}

.stat-annual-card {
  background: linear-gradient(160deg, rgba(126,217,87,0.13) 0%, rgba(63,163,77,0.06) 100%);
  border-color: rgba(126, 217, 87, 0.25);
}

.stat-saving-card {
  background: linear-gradient(160deg, rgba(79,195,247,0.13) 0%, rgba(79,195,247,0.05) 100%);
  border-color: rgba(79, 195, 247, 0.22);
}

/* ── CHARTS ─────────────────────────────────────────────────── */
.chart-block {
  margin-bottom: var(--sp-lg);
}

.chart-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-sm);
}

.chart-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-sm);
}

.chart-container svg { display: block; }

.chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-line {
  stroke: var(--accent-leaf);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-bar:hover { opacity: 0.85; }

.chart-axis-label {
  fill: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
}

.results-footnote {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: var(--sp-md);
}

.report-hint {
  margin-top: var(--sp-xs);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── PRINT REPORT ───────────────────────────────────────────── */
/* Hidden on screen; @media print swaps the app chrome for it */
.print-report { display: none; }

@media print {
  body {
    background: #ffffff !important;
    background-image: none !important;
    color: #111111;
  }

  .site-header,
  .main-container,
  .app-switcher-container,
  .site-footer { display: none !important; }

  .print-report {
    display: block;
    color: #111111;
    font-family: var(--font-sans);
    padding: 1cm;
  }

  .report-header {
    border-bottom: 2px solid #3fa34d;
    padding-bottom: 0.4cm;
    margin-bottom: 0.6cm;
  }

  .report-header h1 {
    font-size: 1.6rem;
    color: #1c5c2e;
  }

  .report-generated {
    font-size: 0.85rem;
    color: #555555;
  }

  .print-report h2 {
    font-size: 1.05rem;
    margin: 0.6cm 0 0.25cm;
    color: #1c5c2e;
  }

  .report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
  }

  .report-table th,
  .report-table td {
    border: 1px solid #cccccc;
    padding: 0.15cm 0.25cm;
    text-align: left;
  }

  .report-table th {
    background: #eef7ee;
    font-weight: 600;
  }

  .report-monthly th,
  .report-monthly td { text-align: right; }

  .report-footnote {
    margin-top: 0.6cm;
    font-size: 0.75rem;
    color: #555555;
    line-height: 1.5;
  }

  .report-brand {
    margin-top: 0.4cm;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1c5c2e;
  }
}
