:root {
  --ink: #12131a;
  --paper: #f7f3ea;
  --paper-dim: #eee8da;
  --night: #161a2c;
  --night-2: #232c4a;
  --dawn: #e8b155;
  --dusk: #e2694a;
  --sky: #6fb3c7;
  --moon: #b9c2d0;
  --line: rgba(18, 19, 26, 0.12);
  --line-soft: rgba(247, 243, 234, 0.16);
  --shadow: 0 20px 60px rgba(10, 12, 25, 0.28);
  --radius: 18px;
  --grad: linear-gradient(160deg, #1b2340 0%, #2b3a63 45%, #3f5a86 100%);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--paper);
  background: var(--grad);
  min-height: 100vh;
  transition: background 1.4s ease;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}

a {
  color: inherit;
}

/* ---------- Header ---------- */
header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 2px 26px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand .mark {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: clamp(20px, 3vw, 26px);
  letter-spacing: 0.2px;
}

.brand .mark em {
  font-style: italic;
  font-weight: 300;
  opacity: 0.85;
}

.brand .sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.55;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
}

.search-box input {
  background: rgba(247, 243, 234, 0.08);
  border: 1px solid var(--line-soft);
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 16px 10px 38px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  width: 220px;
  outline: none;
  transition: all .2s ease;
}

.search-box input::placeholder {
  color: rgba(247, 243, 234, 0.45);
}

.search-box input:focus {
  background: rgba(247, 243, 234, 0.14);
  border-color: rgba(247, 243, 234, 0.4);
  width: 260px;
}

.search-box svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  opacity: 0.55;
  pointer-events: none;
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  z-index: 40;
  box-shadow: var(--shadow);
  display: none;
}

.suggestions.show {
  display: block;
}

.suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--paper);
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.suggestions button:last-child {
  border-bottom: none;
}

.suggestions button:hover,
.suggestions button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.suggestions .empty {
  padding: 10px 14px;
  font-size: 13px;
  opacity: 0.5;
  cursor: default;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(247, 243, 234, 0.08);
  border: 1px solid var(--line-soft);
  color: var(--paper);
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

.icon-btn:hover {
  background: rgba(247, 243, 234, 0.16);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.unit-toggle {
  display: flex;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.unit-toggle button {
  background: none;
  border: none;
  color: var(--paper);
  opacity: 0.55;
  padding: 9px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.unit-toggle button.active {
  opacity: 1;
  background: rgba(247, 243, 234, 0.14);
}

/* ---------- Status / loading / error ---------- */
.status-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  opacity: 0.6;
  padding: 4px 2px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dawn);
}

.dot.pulse {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}

.banner-error {
  background: rgba(226, 105, 74, 0.16);
  border: 1px solid rgba(226, 105, 74, 0.4);
  color: var(--paper);
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  margin-bottom: 18px;
  display: none;
}

.banner-error.show {
  display: block;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  padding: 8px 4px 6px;
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.hero-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.place-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.place-name {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(19px, 2.6vw, 24px);
}

.place-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  opacity: 0.55;
}

.temp-row {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-top: 2px;
}

.temp-big {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-size: clamp(72px, 13vw, 120px);
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.temp-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  opacity: 0.75;
}

.condition-label {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 17px;
  opacity: 0.95;
  margin-top: -6px;
}

.sky-story {
  font-size: 14.5px;
  line-height: 1.65;
  max-width: 46ch;
  opacity: 0.85;
  margin-top: 6px;
}

.hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-icon svg {
  width: min(220px, 60vw);
  height: auto;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.35));
}

/* ---------- Sun Arc (signature) ---------- */
.arc-panel {
  margin-top: 26px;
  background: rgba(247, 243, 234, 0.06);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 22px 14px;
  position: relative;
  overflow: hidden;
}

.arc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 6px;
}

.arc-title {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 15px;
  opacity: 0.9;
}

.arc-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.55;
  letter-spacing: 0.04em;
}

.arc-svg-wrap {
  width: 100%;
}

.arc-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  opacity: 0.7;
}

.arc-labels span b {
  opacity: 1;
  font-weight: 600;
  color: var(--dawn);
}

/* ---------- Section titles ---------- */
.section-title {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  margin: 34px 4px 12px;
  opacity: 0.9;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-title .rule {
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

/* ---------- Hourly strip ---------- */
.hourly-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px 4px 14px;
  scroll-snap-type: x proximity;
}

.hourly-scroll::-webkit-scrollbar {
  height: 5px;
}

.hourly-scroll::-webkit-scrollbar-thumb {
  background: rgba(247, 243, 234, 0.2);
  border-radius: 10px;
}

.hour-card {
  min-width: 70px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.hour-card.now {
  background: rgba(247, 243, 234, 0.09);
  border-color: var(--line-soft);
}

.hour-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.6;
}

.hour-icon svg {
  width: 26px;
  height: 26px;
}

.hour-temp {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 16px;
}

.hour-pop {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--sky);
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 3px;
}

.hour-pop svg {
  width: 9px;
  height: 9px;
}

/* ---------- Detail grid ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width:760px) {
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.detail-card {
  background: rgba(247, 243, 234, 0.06);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}

.detail-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.55;
}

.detail-value {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 500;
}

.detail-value small {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.6;
  margin-left: 4px;
}

.detail-note {
  font-size: 12px;
  opacity: 0.65;
  line-height: 1.4;
  margin-top: auto;
}

.compass-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.compass-wrap svg {
  width: 76px;
  height: 76px;
}

/* ---------- 7-day almanac table ---------- */
.almanac {
  border-top: 1px solid var(--line-soft);
}

.almanac-row {
  display: grid;
  grid-template-columns: 100px 34px 1fr 90px 40px;
  align-items: center;
  gap: 12px;
  padding: 13px 6px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}

@media (max-width:600px) {
  .almanac-row {
    grid-template-columns: 70px 28px 1fr 76px;
  }

  .almanac-row .pop-col {
    display: none;
  }
}

.almanac-row .day-col {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  opacity: 0.75;
}

.almanac-row .day-col b {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: 14.5px;
  font-style: normal;
  opacity: 1;
  font-weight: 500;
  margin-bottom: 1px;
}

.almanac-row .icon-col svg {
  width: 22px;
  height: 22px;
  display: block;
}

.range-track {
  position: relative;
  height: 5px;
  border-radius: 4px;
  background: rgba(247, 243, 234, 0.12);
}

.range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--sky), var(--dawn));
}

.range-nums {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.6;
}

.pop-col {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--sky);
  text-align: right;
  opacity: 0.9;
}

/* ---------- Footer ---------- */
footer {
  margin-top: 40px;
  padding: 20px 4px 0;
  border-top: 1px solid var(--line-soft);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.45;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.skeleton {
  background: linear-gradient(90deg, rgba(247, 243, 234, 0.05), rgba(247, 243, 234, 0.14), rgba(247, 243, 234, 0.05));
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.fade-in {
  animation: fadeIn .5s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

:focus-visible {
  outline: 2px solid var(--dawn);
  outline-offset: 2px;
}

/* ---------- Globe Modal Overlay ---------- */
.globe-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 18, 0.85);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.globe-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.globe-modal-dialog {
  position: relative;
  width: min(92vw, 760px);
  height: min(88vh, 780px);
  background: var(--night);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.globe-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  z-index: 2;
  background: rgba(22, 26, 44, 0.85);
  backdrop-filter: blur(4px);
}

.globe-modal-title {
  font-family: 'Fraunces', serif;
  font-size: 18px;
}

#closeGlobeBtn {
  font-size: 22px;
  line-height: 1;
}

#globeViz {
  width: 100%;
  flex: 1;
  min-height: 0;
  cursor: grab;
  position: relative;
}

#globeViz:active {
  cursor: grabbing;
}

/* Globe Pin Marker (CSS2D) */
.globe-pin-marker {
  position: relative;
  pointer-events: none;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

.globe-pin-marker .pin-icon {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
  animation: dropPinAnim 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes dropPinAnim {
  0% {
    transform: translateY(-24px) scale(0.4);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.globe-pin-marker .pin-pulse {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(226, 105, 74, 0.4);
  border: 1.5px solid var(--dusk);
  animation: pulsePinAnim 1.6s infinite ease-out;
}

@keyframes pulsePinAnim {
  0% {
    transform: translate(-50%, 50%) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, 50%) scale(2.6);
    opacity: 0;
  }
}

/* Globe Weather Popover Card */
.globe-weather-card {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: rgba(18, 20, 32, 0.95);
  border: 1px solid var(--line-soft);
  padding: 16px 20px;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

.globe-weather-card.hidden {
  transform: translateY(24px) scale(0.96);
  opacity: 0;
  pointer-events: none;
}

.globe-loading-card {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  opacity: 0.85;
  padding: 6px 0;
}

.globe-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.globe-card-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.globe-card-name {
  font-family: 'Fraunces', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--paper);
  display: flex;
  align-items: center;
  gap: 7px;
}

.globe-card-sub {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.65;
  padding-left: 23px;
}

.globe-card-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: rgba(247, 243, 234, 0.08);
  border: 1px solid var(--line-soft);
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0.8;
  white-space: nowrap;
}

.globe-card-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(247, 243, 234, 0.08);
}

.globe-card-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
}

.globe-card-temp {
  font-family: 'Fraunces', serif;
  font-size: 34px;
  font-weight: 300;
  line-height: 1;
}

.globe-card-weather {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.globe-card-label {
  font-weight: 600;
  font-size: 14px;
}

.globe-card-subtext {
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.7;
}

.globe-open-btn {
  background: rgba(247, 243, 234, 0.1);
  border: 1px solid var(--line-soft);
  color: var(--paper);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.globe-open-btn:hover {
  background: rgba(247, 243, 234, 0.2);
  border-color: rgba(247, 243, 234, 0.4);
  transform: translateY(-1px);
}

.globe-open-btn:active {
  transform: scale(0.96);
}