:root {
  --bg-color:    #FAF8F5;
  --panel-bg:    #FFFFFF;
  --panel-hover: #F5F2EB;
  --border:      #E8E3DA;
  --ink:         #1C1917;
  --ink-2:       #57534E;
  --ink-3:       #A8A29E;
  
  --ff-serif: 'Playfair Display', Georgia, serif;
  --ff-sans:  'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
::selection {
  background-color: #e0dfca;
  color: #1C1917;
}
::-moz-selection {
  background-color: #e0dfca;
  color: #1C1917;
}
html { 
  font-size: 16px; 
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg-color);
  overscroll-behavior-y: none;
  min-height: 100%;
}

body {
  background-color: var(--bg-color);
  color: var(--ink);
  font-family: var(--ff-sans);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: none;
  position: relative;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
@keyframes spin-slow {
  to { transform: rotate(360deg); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.nav-brand {
  position: fixed;
  top: 28px;
  left: 36px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 60;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.nav-brand:hover {
  opacity: 0.65;
  transform: translateY(-1px);
}
.brand-name {
  font-family: 'Michroma', sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  width: 100%;
  max-width: 520px;
  margin: 24px auto 0 auto;
  position: sticky;
  top: 24px;
  z-index: 50;
}

.search-container {
  width: 100%;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 10px 8px 18px;
  width: 100%;
  box-shadow: 0 8px 28px rgba(44, 39, 34, 0.06);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, transform 0.2s ease;
}

.search-box:focus-within {
  border-color: #1C1917;
  background: #FFFFFF;
  box-shadow: 0 12px 36px rgba(44, 39, 34, 0.1);
  transform: translateY(-1px);
}

.search-icon {
  color: var(--ink-3);
  flex-shrink: 0;
  transition: color 0.2s ease;
}
.search-box:focus-within .search-icon {
  color: var(--ink);
}

#city-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: var(--ff-sans);
  font-size: 0.95rem;
  font-weight: 450;
  color: var(--ink);
  letter-spacing: -0.01em;
}
#city-input::placeholder {
  color: #A8A29E;
  font-weight: 400;
}

.locate-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F5F2EB;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--ff-sans);
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--ink-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.locate-pill-btn svg {
  color: var(--ink-3);
  transition: color 0.2s ease;
}

.locate-pill-btn:hover {
  background: #1C1917;
  color: #FAF8F5;
  border-color: #1C1917;
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.15);
}

.locate-pill-btn:hover svg {
  color: #FAF8F5;
}

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

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 380px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(44, 39, 34, 0.08);
  overflow: hidden;
  z-index: 100;
  animation: fadeInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sug-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 0.92rem;
  color: #1C1917;
  cursor: pointer;
  border-bottom: 1px solid #F5F2EB;
  transition: background 0.18s ease, color 0.18s ease;
}
.sug-item:last-child {
  border-bottom: none;
}
.sug-item strong {
  font-weight: 600;
}
.sug-item small {
  color: #78716C;
  font-size: 0.8rem;
  margin-left: 8px;
  transition: color 0.18s ease;
}

.sug-item:hover {
  background: #1C1917;
  color: #FAF8F5;
}
.sug-item:hover small {
  color: #A8A29E;
}

.unit-toggle-top {
  position: fixed;
  top: 24px;
  right: 32px;
  z-index: 60;
  display: flex;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(44, 39, 34, 0.05);
  animation: fadeInUp 0.3s ease-out;
}
.unit-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-3);
  transition: background 0.2s, color 0.2s;
}
.unit-btn.active {
  background: #1C1917;
  color: #FAF8F5;
  font-weight: 600;
}
.unit-btn:hover:not(.active) {
  background: #F5F2EB;
  color: #1C1917;
}

.state-container { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; z-index: 10; }
.state-msg { text-align: center; pointer-events: auto; padding: 40px; animation: fadeInUp 0.5s ease-out; }

#welcome-screen h1 {
  font-family: var(--ff-sans);
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -0.025em;
  margin-bottom: 10px;
  line-height: 1.2;
  color: #1C1917;
}
#welcome-screen p {
  color: #78716C;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.loader-beacon {
  position: relative;
  width: 68px;
  height: 68px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.beacon-core {
  width: 14px;
  height: 14px;
  background: #1C1917;
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(28, 25, 23, 0.2);
  animation: beacon-pulse 2s ease-in-out infinite;
}

.beacon-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(28, 25, 23, 0.15);
}

.ring-1 {
  width: 38px;
  height: 38px;
  border-top-color: #1C1917;
  border-right-color: transparent;
  animation: beacon-spin 2.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.ring-2 {
  width: 62px;
  height: 62px;
  border-bottom-color: #1C1917;
  border-left-color: transparent;
  animation: beacon-spin-rev 3s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

@keyframes beacon-pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}

@keyframes beacon-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes beacon-spin-rev {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

.loader-text {
  font-family: var(--ff-sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: #78716C;
}

.retry-btn { margin-top: 16px; background: #1C1917; color: #FAF8F5; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; transition: transform 0.2s, background 0.2s; }
.retry-btn:hover { transform: scale(1.05); background: #44403C; }

.dashboard {
  flex: 1;
  display: grid;
  grid-template-columns: 350px 1fr;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 40px 32px;
  gap: 48px;
  position: relative;
  z-index: 10;
}

.col-left { 
  display: flex; flex-direction: column; justify-content: center; 
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
}

.location-header h1 { 
  font-family: var(--ff-sans); 
  font-size: 2.75rem; 
  font-weight: 700; 
  letter-spacing: -0.03em; 
  line-height: 1.1; 
  color: #1C1917;
}
.location-header p { 
  color: #78716C; 
  font-size: 0.95rem; 
  font-weight: 400; 
  margin-top: 6px; 
  letter-spacing: -0.01em;
}

.hero-temp-wrapper { display: flex; align-items: flex-start; margin-top: 32px; }
.hero-temp { font-family: var(--ff-sans); font-size: 7.5rem; font-weight: 300; line-height: 0.9; letter-spacing: -0.04em; color: #1C1917; }
.hero-deg { font-size: 1.8rem; font-weight: 400; color: #A8A29E; margin-top: 10px; }

.hero-condition { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.hero-icon { font-size: 2rem; }
.hero-icon.spinning { animation: spin-slow 8s linear infinite; }
.hero-desc { font-family: var(--ff-sans); font-size: 1.4rem; font-weight: 500; color: #44403C; }

.hero-hilo { margin-top: 12px; color: #78716C; font-size: 0.95rem; }

.sun-times { display: flex; gap: 24px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.sun-box { 
  display: flex; 
  flex-direction: column; 
  gap: 4px; 
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; 
}
.sun-box:hover { 
  background: #F5F2EB;
  border-color: var(--border);
  transform: scale(1.02); 
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.06);
}
.sun-lbl { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; color: #78716C; text-transform: uppercase; }
.sun-val { font-size: 1.25rem; font-weight: 600; color: #1C1917; }
.sun-divider { width: 1px; background: var(--border); }

.col-right { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.panel {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(44, 39, 34, 0.03);
}
.chart-panel {
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.25s;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.panel-header h2 { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.15em; color: #78716C; }
.time-label { font-size: 0.85rem; color: #57534E; font-weight: 500; }

.canvas-wrap { width: 100%; height: 180px; position: relative; }
#hourly-chart { width: 100%; height: 100%; display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.4s;
}
.stat-box {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(44, 39, 34, 0.02);
  cursor: default;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.stat-box:hover { 
  background: #F5F2EB; 
  transform: scale(1.02);
  border-color: #D6CFBE;
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.08);
}
.stat-lbl { 
  font-size: 0.7rem; 
  font-weight: 600; 
  letter-spacing: 0.08em; 
  color: #78716C; 
  margin-bottom: 8px; 
  text-transform: uppercase;
  transition: color 0.2s ease; 
}
.stat-box:hover .stat-lbl { 
  color: #44403C; 
}
.stat-val { 
  font-family: var(--ff-sans); 
  font-weight: 700; 
  font-size: 1.55rem; 
  color: #1C1917; 
  letter-spacing: -0.02em;
}

.forecast-panel {
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.55s;
}

.forecast-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.fc-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(44, 39, 34, 0.02);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.fc-card:hover { 
  background: #1C1917; 
  border-color: #1C1917;
  transform: scale(1.04); 
  box-shadow: 0 4px 16px rgba(28, 25, 23, 0.18); 
}
.fc-day { font-size: 0.75rem; font-weight: 600; color: #78716C; transition: color 0.2s ease; text-transform: uppercase; }
.fc-card:hover .fc-day { color: #A8A29E; }
.fc-icon { font-size: 1.6rem; transition: transform 0.2s ease; }
.fc-card:hover .fc-icon { transform: scale(1.1); }
.fc-hi { font-size: 1.15rem; font-weight: 600; color: #1C1917; margin-top: 4px; transition: color 0.2s ease; }
.fc-card:hover .fc-hi { color: #FAF8F5; }
.fc-lo { font-size: 0.85rem; color: #78716C; font-weight: 500; transition: color 0.2s ease; }
.fc-card:hover .fc-lo { color: #D6CFBE; }

.site-footer { 
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  text-align: center; 
  padding: 24px 20px; 
  font-size: 0.75rem; 
  font-weight: 450;
  color: #78716C; 
  margin-top: auto; 
  letter-spacing: 0.02em; 
  position: relative;
  z-index: 10;
  animation: fadeInUp 1s ease-out; 
}
.footer-divider {
  color: #D6CFBE;
}
.bug-link {
  color: #57534E;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #D6CFBE;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.bug-link:hover {
  color: #1C1917;
  text-decoration-color: #1C1917;
}
.hidden { display: none !important; }

@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; gap: 32px; padding: 24px; }
  .col-left { align-items: center; text-align: center; border-bottom: 1px solid var(--border); padding-bottom: 32px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .forecast-row { overflow-x: auto; padding-bottom: 10px; }
  .fc-card { min-width: 80px; }
}
