/* Ellenial Weather — styles.
   Colours from Ellen's flower (same palette as Gillefeeling): cream paper, indigo accent,
   lavender tints, Fraunces + DM Sans. Weather words get Gillefeeling's soft cover tints;
   the word always carries the meaning, the tint only helps scanning. */

@font-face { font-family: "Fraunces"; font-weight: 400; font-display: swap; src: url("fonts/fraunces-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 500; font-display: swap; src: url("fonts/fraunces-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 400; font-display: swap; src: url("fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 500; font-display: swap; src: url("fonts/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 600; font-display: swap; src: url("fonts/dm-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 700; font-display: swap; src: url("fonts/dm-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --ground: #FEF2E2;      /* cream paper */
  --card: #FFFBF5;
  --soft: #F1EAF8;        /* lavender tint */
  --head: #F8F0E6;
  --ink: #1F1A2E;
  --muted: #575166;
  --faint: #6A6476;
  --line: #EDE1D1;
  --line-strong: #D6C8B6;
  --tab-bg: #E6DDF3;
  --chip: #E6DDF3;
  --chip-ink: #1F1A2E;
  --accent: #342E86;      /* indigo */
  --accent-ink: #FFFFFF;
  --accent-hover: #2A2570;
  --lavender: #8E63B3;
  --note: #FFF7E6;
  --note-ink: #5C4310;
  --uv-mid: #F6E3A8;
  --uv-high: #F0B77E;
  /* weather word tints (Gillefeeling cover presets) */
  --w-sun: #F3E3B5;
  --w-mix: #F2D6C4;
  --w-cloudy: #DDD6EC;
  --w-rain: #D3E2EC;
  --w-wind: #D5E3D6;
  --w-snow: #EEF1F7;
  --serif: "Fraunces", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #17141F;
    --card: #221E2C;
    --soft: #2D2640;
    --head: #262130;
    --ink: #F3EEF8;
    --muted: #C2BACF;
    --faint: #A9A1B7;
    --line: #332D40;
    --line-strong: #4A4259;
    --tab-bg: #2D2640;
    --chip: #3A3052;
    --chip-ink: #F3EEF8;
    --accent: #B39AE8;
    --accent-ink: #1A1430;
    --accent-hover: #C7B4F0;
    --note: #3A3020;
    --note-ink: #F0DDB4;
    --w-sun: #4A4128;
    --w-mix: #4A362B;
    --w-cloudy: #3C3749;
    --w-rain: #2E3E48;
    --w-wind: #31423A;
    --w-snow: #3A3F4C;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.top { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.brand { font-family: var(--serif); font-size: 18px; font-weight: 500; margin: 0; }
.place {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 10px 14px; min-height: 44px;
}
.place:disabled { cursor: default; }

/* Tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--tab-bg); border-radius: 999px; padding: 4px; }
.tab {
  min-height: 44px; border: 0; border-radius: 999px; background: transparent;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; padding: 0 8px;
}
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 700; }
.tab:focus-visible, .place:focus-visible, .rain-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Cards */
.card { background: var(--card); border-radius: 24px; padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.card.tight { padding: 18px 8px 14px; gap: 10px; }
.label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin: 0; }
.title { font-family: var(--serif); font-size: 20px; font-weight: 500; margin: 0; }
.chip { align-self: flex-start; font-size: 12px; font-weight: 700; background: var(--chip); color: var(--chip-ink); border-radius: 8px; padding: 4px 10px; }
.muted { color: var(--muted); }

/* Right now */
.now { display: flex; align-items: center; gap: 16px; }
.now-temp { font-family: var(--serif); font-size: 68px; line-height: 1; }
.now-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.now-line { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.now-sub { font-size: 13px; color: var(--muted); }

.hours { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; text-align: center; }
.hour { display: flex; flex-direction: column; gap: 5px; align-items: center; padding: 9px 2px; border-radius: 12px; background: var(--soft); }
.hour-time { font-size: 12px; font-weight: 700; color: var(--muted); }
.hour-temp { font-family: var(--serif); font-size: 18px; }
.hour-small { font-size: 11px; color: var(--muted); }

.hour-word { font-size: 9px; font-weight: 700; color: var(--chip-ink); background: var(--chip); border-radius: 5px; padding: 2px 4px; }
.hour-rain.wet { color: var(--accent); font-weight: 700; }

.rain { border-top: 1px solid var(--line); padding-top: 4px; }
.rain-detail { display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 6px; }
.rain-dots { display: flex; gap: 6px; }
.rain-dot { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--accent); }
.rain-dot.on { background: var(--accent); }

/* Weather words, tinted by kind */
.chip, .hour-word, .week-word { color: var(--chip-ink); }
[data-w="SUN"], [data-w="CLEAR"] { background: var(--w-sun); }
[data-w="MIX"] { background: var(--w-mix); }
[data-w="CLOUDY"] { background: var(--w-cloudy); }
[data-w="RAIN"] { background: var(--w-rain); }
[data-w="WIND"] { background: var(--w-wind); }
[data-w="SNOW"] { background: var(--w-snow); }
.rain-text { margin: 0; font-size: 14px; }
.rain-toggle {
  width: 100%; min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: none; border: 0; padding: 6px 2px; font: inherit; font-size: 15px; color: var(--ink); text-align: left; cursor: pointer;
}

/* Week tables */
.week-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; }
.week-dates { font-size: 13px; color: var(--muted); }
.week { width: 100%; border-collapse: collapse; table-layout: fixed; border: 1px solid var(--tab-bg); border-radius: 12px; overflow: hidden; }
.week th, .week td { border-left: 1px solid var(--line); border-top: 1px solid var(--line); text-align: center; padding: 8px 0; font-size: 14px; color: var(--ink); }
.week thead th { border-top: 0; background: var(--head); padding: 0; }
.week th:first-child, .week td:first-child { border-left: 0; }
.day-btn {
  width: 100%; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 0; background: transparent; color: inherit; font: inherit; padding: 2px 0; cursor: pointer;
}
.day-btn:disabled { cursor: default; }
.day-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.week .dow { display: block; font-size: 14px; font-weight: 700; }
.week .date { display: block; font-size: 13px; font-weight: 600; }
.week th.today { background: var(--accent); color: var(--accent-ink); }
.week td.today-col { background: var(--ground); }
.week .past { opacity: 0.55; }
.week .beyond { color: var(--faint); opacity: 0.6; }
.week th.picked:not(.today), .week td.picked { background: var(--soft); }
.week td { height: 44px; }
.week-word { display: inline-block; max-width: 100%; font-size: 10.5px; font-weight: 700; color: var(--chip-ink); background: var(--chip); border-radius: 5px; padding: 3px 2px; letter-spacing: 0.1px; }
.week-hi { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.1; }
.week-lo { display: block; font-size: 13px; color: var(--muted); }
.week .wet { color: var(--accent); font-weight: 700; }
.sure { font-size: 11px; letter-spacing: 1px; }
.sure-on { color: var(--accent); }
.sure-off { color: var(--line-strong); }
.week-note { margin: 0; padding: 0 4px; font-size: 12px; color: var(--muted); }
.week-legend { margin: -4px 0 0; padding: 0 4px; font-size: 11px; color: var(--muted); }
.week-legend .sure-on { font-size: 8px; letter-spacing: 1px; vertical-align: 1px; }

.day-hours { display: flex; flex-direction: column; gap: 8px; background: var(--soft); border-radius: 16px; padding: 12px 10px; }
.day-hours-title { margin: 0; font-size: 14px; font-weight: 700; }
.day-hours-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; text-align: center; }
.day-hours .hour { background: var(--card); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.normals { background: var(--soft); border: 1px dashed var(--line-strong); border-radius: 24px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.normals p { margin: 0; font-size: 15px; line-height: 1.45; }
.link-button { font: inherit; font-size: 14px; font-weight: 700; color: var(--accent); background: none; border: 0; padding: 0; min-height: 44px; text-align: left; cursor: pointer; text-decoration: underline; }

/* What usually happens */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--soft); border-radius: 14px; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.stat-name { font-size: 12px; font-weight: 700; color: var(--muted); }
.stat-value { font-family: var(--serif); font-size: 22px; }
.section-text { margin: 0; font-size: 15px; line-height: 1.45; }
.caveat { background: var(--note); color: var(--note-ink); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.4; margin: 0; }

/* Footer */
.credits { font-size: 12px; color: var(--muted); line-height: 1.5; padding: 0 6px; margin: 0; }

.skeleton-note { font-size: 13px; color: var(--muted); text-align: center; margin: 0; }

[hidden] { display: none !important; }
