/*
 * Audrey's Hawaii weather page.
 * Mobile first: one column on phones, two at ~720px, three at ~1100px.
 * Colours are tokens on :root, redefined for dark mode (system preference,
 * or an explicit data-theme on <html>).
 */
:root {
  --bg: #f3f7f6;
  --surface: #ffffff;
  --fg: #14302e;
  --muted: #56706d;
  --lava: #c24a22;
  --ocean: #1a6f80;
  --line: #d6e2e0;
  --sky-top: #cfe8ec;
  --sky-bot: #fbe9d7;
  --mtn-far: #9fbfbf;
  --mtn-near: #5f8f8c;
  --sea: #1f7a8c;
  --shadow: 0 1px 2px rgb(20 48 46 / 6%), 0 4px 14px rgb(20 48 46 / 6%);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1c1d; --surface: #162829; --fg: #e4efed; --muted: #9db5b2;
    --lava: #f07a4f; --ocean: #5cb7c9; --line: #28403f;
    --sky-top: #0e2633; --sky-bot: #3a2a33; --mtn-far: #24413f; --mtn-near: #17302f; --sea: #1d5a66;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1c1d; --surface: #162829; --fg: #e4efed; --muted: #9db5b2;
  --lava: #f07a4f; --ocean: #5cb7c9; --line: #28403f;
  --sky-top: #0e2633; --sky-bot: #3a2a33; --mtn-far: #24413f; --mtn-near: #17302f; --sea: #1d5a66;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
img, iframe, svg { display: block; max-width: 100%; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 16px 16px 48px; }
@media (min-width: 720px) { .wrap { padding: 28px 28px 64px; } }

/* Postcard header: a sky gradient with a mountain-and-sea horizon at the foot. */
.postcard {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 24px 20px 92px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bot));
  overflow: hidden;
  isolation: isolate;
}
@media (min-width: 720px) { .postcard { padding: 40px 40px 120px; } }
.horizon { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 90px; z-index: -1; }
@media (min-width: 720px) { .horizon { height: 120px; } }
.mtn-far { fill: var(--mtn-far); }
.mtn-near { fill: var(--mtn-near); }
.sea { fill: var(--sea); }

.kicker { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ocean); font-weight: 600; }
h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 3.6rem);
  line-height: 1.05;
  margin: 0;
  max-width: 18ch;
  text-wrap: balance;
}
.lede { max-width: 60ch; color: var(--fg); opacity: .85; margin: 4px 0 0; }
.forecast { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .88rem;
}
.clock { margin: 4px 0 0; font-size: .95rem; color: var(--muted); }
.clock strong { color: var(--fg); font-weight: 600; }

section { margin-top: 40px; }
section h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.5rem, 4vw, 1.9rem); margin: 0 0 4px; }
section > p { color: var(--muted); margin: 0 0 16px; max-width: 64ch; }
.volcano h2 { color: var(--lava); }
.mountains h2 { color: var(--fg); }
.coast h2 { color: var(--ocean); }

/* One column on phones, two from 720px, three from 1100px. */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid.links { margin-top: 16px; }

.card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-width: 0;
}
/* Responsive 16:9 box for videos, posters and stills. */
.frame { position: relative; aspect-ratio: 16 / 9; background: #0b1414; }
.frame iframe, .frame img, .frame .poster { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.frame img { object-fit: cover; }
.frame.still img { object-fit: contain; background: #0b1414; }

.poster { padding: 0; margin: 0; cursor: pointer; background: #0b1414; color: #fff; }
.poster img { opacity: .85; }
.play {
  position: absolute; left: 50%; top: 50%;
  width: 68px; height: 68px; margin: -34px 0 0 -34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgb(0 0 0 / 55%);
  border: 2px solid rgb(255 255 255 / 85%);
}
.play svg { width: 30px; height: 30px; fill: #fff; margin-left: 4px; }
.poster:hover .play, .poster:focus-visible .play { background: var(--lava); border-color: #fff; }
.poster:focus-visible { outline: 3px solid var(--ocean); outline-offset: -3px; }

figcaption, a.tile { display: grid; gap: 4px; padding: 12px 14px 14px; }
.name { font-weight: 600; }
.where { color: var(--muted); font-size: .9rem; }
.tag {
  justify-self: start;
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  padding: 2px 8px; border-radius: 4px;
}
.live { background: color-mix(in srgb, var(--lava) 16%, transparent); color: var(--lava); }
.still { background: color-mix(in srgb, var(--ocean) 14%, transparent); color: var(--ocean); }
.page { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }

a.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  box-shadow: var(--shadow);
}
a.tile:hover, a.tile:focus-visible { border-color: var(--ocean); outline: none; }
a.tile:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ocean) 35%, transparent); }
a.tile .name::after { content: " ↗"; color: var(--ocean); }

footer { margin-top: 48px; color: var(--muted); font-size: .9rem; max-width: 64ch; }
footer p { margin: 0 0 8px; }
.aloha { font-family: var(--display); font-size: 1.25rem; color: var(--fg); }

@media (prefers-reduced-motion: no-preference) {
  a.tile, .play { transition: border-color .15s, background-color .15s; }
}
