:root {
  color-scheme: dark;

  --bg: #05060d;
  --ink: #e8eaf6;
  --ink-dim: #9aa0bf;
  --ink-faint: #5f6589;
  --panel: rgba(17, 20, 38, 0.55);
  --panel-hover: rgba(27, 31, 58, 0.72);
  --line: rgba(160, 170, 255, 0.12);
  --line-strong: rgba(170, 160, 255, 0.34);
  --accent: #9d8cff;
  --accent-2: #5ee1ff;
  --up: #4ade80;
  --down: #f87171;

  --radius: 16px;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- sky ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 55% 45% at 82% 8%, rgba(125, 90, 255, 0.20), transparent 70%),
    radial-gradient(ellipse 45% 40% at 8% 92%, rgba(40, 170, 255, 0.13), transparent 70%),
    radial-gradient(ellipse 35% 25% at 45% 55%, rgba(255, 110, 200, 0.05), transparent 70%),
    var(--bg);
}

#stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

/* ---------- layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(56px, 13vh, 150px) 24px 64px;
}

/* ---------- hero ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px 40px;
}

.hero-main { min-width: 0; }

h1 {
  margin: 0;
  font-size: clamp(2.3rem, 8.5vw, 4.4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.045em;
  color: #f4f2ff;
  overflow-wrap: anywhere;
}

/* The ".com" gets a slow aurora sweep; the gradient's first and last stops
   match so the loop is seamless. */
h1 .tld {
  padding-right: 0.04em; /* keeps the "m" from clipping under background-clip */
  font-weight: 500;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), #ff7ad9, #ffb86b, var(--accent-2));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: aurora 12s linear infinite;
}

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

.tagline {
  margin: 14px 0 0;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: #c6c9e4;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 0;
  font-size: 1.05rem;
  color: var(--ink-dim);
}

.meta time {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.sep { color: var(--ink-faint); }

/* ---------- weather ---------- */

.weather {
  flex: 0 1 320px;
  min-width: 260px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.wx-now {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wx-icon {
  flex: none;
  display: grid;
  width: 36px;
  height: 36px;
}

.wx-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wx-icon[data-kind="sun"]   { color: #ffc86b; }
.wx-icon[data-kind="moon"]  { color: #c9c2ff; }
.wx-icon[data-kind="cloud"],
.wx-icon[data-kind="fog"]   { color: #aab3d6; }
.wx-icon[data-kind="partly"]{ color: #ffd79a; }
.wx-icon[data-kind="rain"]  { color: var(--accent-2); }
.wx-icon[data-kind="snow"]  { color: #e6f0ff; }
.wx-icon[data-kind="storm"] { color: #ffb86b; }

.wx-temp {
  font-size: 2.3rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.wx-summary { min-width: 0; }

.wx-cond {
  font-weight: 500;
  line-height: 1.25;
}

.wx-hilo,
.wx-rain {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-dim);
  white-space: nowrap;
}

.wx-rain { color: var(--accent-2); }

.wx-days {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.wx-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
}

.wx-day .wx-icon { width: 20px; height: 20px; }
.wx-day .wx-icon svg { stroke-width: 2; }
.wx-day b { font-weight: 500; color: var(--ink); }

.wx-place {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- search ---------- */

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 44px 0 52px;
  padding: 0 16px;
  height: 54px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(157, 140, 255, 0.12);
}

.search svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 2;
  stroke-linecap: round;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.02rem;
}

.search input::placeholder { color: var(--ink-faint); }
.search input::-webkit-search-cancel-button { display: none; }

kbd {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
}

.search:focus-within kbd { opacity: 0; }

/* ---------- groups ---------- */

.groups {
  display: grid;
  gap: 40px;
}

.group h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.group h2 small {
  font-size: inherit;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--ink-faint);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 14px;
}

/* ---------- cards ---------- */

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: inherit;
  text-decoration: none;
  outline: none;
  transition: transform 0.25s cubic-bezier(.2, .8, .2, 1), border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.card:hover,
.card:focus-visible,
.card.is-first {
  transform: translateY(-2px);
  background: var(--panel-hover);
  border-color: var(--line-strong);
  box-shadow: 0 14px 40px -14px rgba(157, 140, 255, 0.45);
}

.card:focus-visible { box-shadow: 0 0 0 3px rgba(94, 225, 255, 0.45); }

/* Not live yet: visible but quiet, and no hover lift since it isn't clickable. */
.card.is-soon {
  opacity: 0.55;
  cursor: default;
  border-style: dashed;
}

.card.is-soon:hover {
  transform: none;
  background: var(--panel);
  border-color: var(--line);
  box-shadow: none;
}

.icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.monogram {
  font-weight: 700;
  font-size: 1.15rem;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-right: 14px;
}

.name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}

.desc {
  margin-top: 3px;
  font-size: 0.88rem;
  color: var(--ink-dim);
}

.url {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid rgba(157, 140, 255, 0.35);
  border-radius: 5px;
}

/* ---------- status ---------- */

.status {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.status[data-state="checking"] { animation: blink 1.2s ease-in-out infinite; }
.status[data-state="up"]   { background: var(--up);   box-shadow: 0 0 10px rgba(74, 222, 128, 0.7); }
.status[data-state="down"] { background: var(--down); box-shadow: 0 0 10px rgba(248, 113, 113, 0.7); }

@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- misc ---------- */

.empty {
  margin: 8px 0 0;
  color: var(--ink-dim);
  text-align: center;
}

.error {
  padding: 18px;
  color: var(--down);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius);
  background: rgba(248, 113, 113, 0.06);
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px 32px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

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

footer a:hover { color: var(--ink-dim); }

/* Wide screens: the weather sits beside the title without its box, so it reads
   as part of the header. Narrower screens keep the card (it stacks full-width). */
@media (min-width: 721px) {
  .weather {
    flex: none;
    min-width: 0;
    padding: 0;
    background: none;
    border: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .wx-days {
    gap: 18px;
    margin-top: 12px;
    padding-top: 10px;
  }
  .wx-place { margin-top: 10px; text-align: right; }
}

@media (max-width: 520px) {
  main { padding-left: 16px; padding-right: 16px; }
  .weather { flex-basis: 100%; }
  .search { margin: 32px 0 40px; }
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .card:hover, .card:focus-visible, .card.is-first { transform: none; }
}
