@font-face { font-family: "Bricolage"; src: url("fonts/bricolage-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("fonts/bricolage-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("fonts/bricolage-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* Fixed colours */
:root {
  --sea: #072A33;
  --card: #0E3D47;
  --card-hi: #123F49;
  --line: #1F5A63;
  --aqua: #3FD0C9;
  --gold: #F2C14E;
  --orange: #F07A2B;
  --sand: #FBF1DE;
  --card-muted: #A9C7C6;
  --card-soft: #CFE3E2;
}

/* Theme: what changes with the background */
:root, [data-theme="sea"] {
  --bg: var(--sea);
  --ink: var(--sand);
  --muted: #A9C7C6;
  --eyebrow: var(--gold);
  --deg: var(--gold);
  --sun: var(--gold);
  --banner: var(--orange);
  --banner-ink: #2A1206;
  --today: var(--orange);
  --btn-bg: var(--card);
  --btn-ink: var(--sand);
}
[data-theme="orange"] {
  --bg: var(--orange);
  --ink: var(--sea);
  --muted: #3A1A05;
  --eyebrow: var(--sea);
  --deg: var(--sand);
  --sun: var(--gold);
  --banner: var(--aqua);
  --banner-ink: var(--sea);
  --today: var(--aqua);
  --btn-bg: var(--sea);
  --btn-ink: var(--sand);
}
[data-theme="gold"] {
  --bg: var(--gold);
  --ink: var(--sea);
  --muted: #4A3606;
  --eyebrow: var(--sea);
  --deg: #B8480C;
  --sun: var(--orange);
  --banner: var(--orange);
  --banner-ink: var(--sea);
  --today: var(--orange);
  --btn-bg: var(--sea);
  --btn-ink: var(--sand);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "Bricolage", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}
button { font: inherit; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 20px) 0 0;
}
main { flex: 1; padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

/* Header */
.top { padding: 0 24px; display: flex; justify-content: space-between; align-items: flex-start; }
.top-text { display: flex; flex-direction: column; gap: 4px; }
.eyebrow { font-size: 13px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--eyebrow); }
.place { font-size: 22px; font-weight: 600; }
.sub { font-size: 14px; color: var(--muted); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 0; padding: 0;
  background: var(--btn-bg); color: var(--btn-ink);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Now */
.now { padding: 20px 24px 0; display: flex; align-items: flex-end; justify-content: space-between; }
.temp { display: flex; align-items: flex-start; }
.temp > span:first-child { font-size: 104px; font-weight: 800; line-height: 0.9; letter-spacing: -0.04em; }
.deg { font-size: 40px; font-weight: 600; color: var(--deg); margin-top: 4px; }
.cond { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-bottom: 6px; text-align: right; }
.wx-icon { width: 56px; height: 56px; display: block; }
.cond-text { font-size: 16px; font-weight: 600; }
.cond-sub { font-size: 14px; color: var(--muted); }

/* Tiles and cards (always dark, cream text) */
.tiles { padding: 20px 24px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile, .card { background: var(--card); color: var(--sand); }
.tile { border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.tile-label { font-size: 12px; color: var(--card-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.tile-val { font-size: 22px; font-weight: 800; }
.tile-val small { font-size: 13px; font-weight: 600; }
.v-wind { color: var(--orange); }
.v-swell { color: var(--aqua); }
.v-sun { color: var(--gold); }
.tile-sub { font-size: 13px; }

.card { margin: 16px 24px 0; border-radius: 22px; padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head h2 { font-size: 18px; font-weight: 600; }
.tide-state { font-size: 14px; color: var(--aqua); font-weight: 600; }
.tide-chart svg { display: block; width: 100%; height: auto; }
.tide-chips { display: grid; gap: 6px; font-family: "Bricolage", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.chip { display: flex; flex-direction: column; gap: 2px; }
.chip-type { font-size: 11px; font-family: "Bricolage", sans-serif; font-weight: 600; color: var(--card-muted); }
.chip-type.high { color: var(--gold); }
.chip-time { font-size: 15px; font-weight: 600; }
.chip-h { font-size: 12px; color: var(--card-muted); }
.chip.past { opacity: 0.5; }
.empty { font-size: 14px; color: var(--card-muted); line-height: 1.4; }

.banner {
  margin: 14px 24px 0; border-radius: 18px; padding: 14px 16px;
  background: var(--banner); color: var(--banner-ink);
  display: flex; align-items: center; gap: 12px;
}
.banner[hidden] { display: none; }
.banner-title { font-size: 15px; font-weight: 800; }
.banner-sub { font-size: 13px; font-weight: 600; }

/* Tides view */
.view-title { padding: 16px 24px 0; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.view > .sub { padding: 4px 24px 0; }
.legend { padding: 18px 24px 0; display: flex; gap: 16px; font-size: 13px; font-weight: 600; }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 5px; display: inline-block; border: 1.5px solid var(--ink); }
.dot-high { background: var(--gold); }
.dot-low { background: var(--sand); }
.dot-today { background: var(--today); }
.week { padding: 14px 24px 0; display: flex; flex-direction: column; gap: 8px; }
.day {
  background: var(--card); color: var(--sand);
  border: 2px solid transparent; border-radius: 18px; padding: 12px;
  display: grid; grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center;
}
.day.today { background: var(--card-hi); border-color: var(--today); }
.day-name { font-size: 16px; font-weight: 800; display: block; }
.day-date { font-size: 12px; color: var(--card-muted); }
.ev-col { display: flex; flex-direction: column; gap: 3px; font-family: "Bricolage", system-ui, sans-serif; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; min-width: 0; }
.ev-h { color: var(--card-muted); font-weight: 400; }
.ev-col.lows { color: var(--card-soft); }
.ev { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ev i { width: 8px; height: 8px; border-radius: 4px; display: inline-block; flex: none; }
.ev.high i { background: var(--gold); }
.ev.low i { background: var(--sand); }

/* Settings */
.section-label { padding: 24px 24px 10px; font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.themes { padding: 0 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-opt {
  background: var(--card); color: var(--sand); border: 3px solid transparent; border-radius: 18px;
  padding: 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 44px;
}
.theme-opt[aria-checked="true"] { border-color: var(--sand); }
.swatch { width: 52px; height: 52px; border-radius: 14px; border: 2px solid var(--line); display: block; }
.theme-name { font-size: 14px; font-weight: 600; }
.about { margin-top: 0; gap: 10px; font-size: 14px; line-height: 1.45; color: var(--card-soft); }
.about a { color: var(--aqua); }

/* Tab bar */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  width: calc(100% - 32px); max-width: 448px;
  background: var(--card); border-radius: 26px; padding: 6px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.tabs a {
  height: 48px; border-radius: 20px; color: var(--sand); text-decoration: none;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600;
}
.tabs a[aria-current="page"] { background: var(--gold); color: #2A1E04; font-weight: 800; }

@media (max-width: 360px) {
  .temp > span:first-child { font-size: 84px; }
  .card, .banner { margin-left: 16px; margin-right: 16px; }
  .week { padding-left: 16px; padding-right: 16px; }
  .day { gap: 8px; padding: 10px; }
  .tiles { padding-left: 16px; padding-right: 16px; }
}
