:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #1e2a30;
  --muted: #5f7278;
  --line: #dde5e8;
  --accent: #14697a;
  --danger: #d84b3a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

/* ---- main layout ----
   No menu bar: the home page is the navigation. Pages fill a single
   centered column, with a small floating corner nav on subpages. */

#main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 36px;
  position: relative;
}

.top-nav {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.nav-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
}
.nav-icon:hover { color: var(--accent); border-color: var(--accent); }
.nav-icon svg { width: 18px; height: 18px; }

/* ---- home ---- */

.home-header { text-align: center; margin: 4px 0 20px; }
.brand-title {
  margin: 0;
  color: #333;
  font-family: "Cabin", sans-serif;
  font-optical-sizing: auto;
  font-size: 40px;
  font-weight: 700;
  font-style: italic;
  font-variation-settings: "wdth" 75;
}

.home-actions { display: flex; justify-content: center; margin: 20px 0; }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 36px 0 16px;
}
.site-footer a { color: var(--accent); }

/* Right padding keeps a long title from running under the floating
   corner nav. */
.page-title, .loc-title { margin: 0 0 8px; padding-right: 96px; }

.loading { color: var(--muted); padding: 24px 0; }

.empty-state { text-align: center; padding: 80px 20px; }
.empty-state p { color: var(--muted); margin-bottom: 24px; }

.warning {
  background: #fdf3e4;
  border: 1px solid #eed9b0;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
}

.hint { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }

/* ---- buttons ---- */

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: none; }

.btn-icon { display: inline-flex; align-items: center; gap: 8px; }
.btn-icon svg { width: 16px; height: 16px; }

/* ---- day view ---- */

.day-header { margin-bottom: 16px; }
.day-date { margin: 0; font-weight: 500; color: var(--muted); }
.sun-times { color: var(--muted); font-size: 13px; }

/* Day chips share the hour table's width, one equal slice per day. The
   container query compacts "Friday 7/10" to "FRI" when slices get
   narrow. */
.day-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  container-type: inline-size;
}

/* Chips never squeeze below a readable width; when seven don't fit,
   the row wraps instead. */
.day-chip {
  flex: 1 1 0;
  min-width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.day-chip.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day-chip-short { display: none; }

@container (max-width: 720px) {
  .day-chip-long { display: none; }
  .day-chip-short { display: block; }
}

.day-bar {
  display: block;
  width: 100%;
  height: 12px;
  border-radius: 6px;
}

/* Hour table: hours down, one column per metric, in the same panel
   dress as the home week table. Cells stay unfilled: the color lives
   in a small full-strength category dot (metric emoji inside) per
   cell and the ramp-colored edge on the time cell. Wind and wave
   directions are arrows rotated inline by the JS. */
.day-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  table-layout: fixed;
}

.day-table thead th { font-size: 12px; padding: 0 0 4px; text-align: left; }
.day-table thead .dt-metric { padding-left: 31px; }
.dt-corner { width: 58px; }

.dt-time {
  font-weight: 600;
  font-size: 13px;
  padding: 4px 4px 4px 10px;
  border-left: 4px solid var(--overall, var(--line));
}

.dt-cell {
  font-size: 13px;
  padding: 4px 6px 4px 0;
  overflow: hidden;
}

.dt-cell-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.dt-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.dt-value { overflow: hidden; text-overflow: ellipsis; }

.dt-arrow { display: inline-block; color: var(--muted); }

/* Sunrise/sunset marker rows sit centered between the hour they fall
   in and the next. The event stays in the header's quiet voice; the
   color prediction is a pill tinted by the JS along the glow ramp. */
.dt-sun {
  font-size: 12px;
  color: var(--muted);
  padding: 3px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dt-sun-chip {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .day-table { padding: 8px; border-spacing: 2px; }
  .dt-corner { width: 42px; }
  .day-table thead th { font-size: 10px; }
  .day-table thead .dt-metric { padding-left: 22px; }
  .dt-time { font-size: 11px; padding: 4px 2px 4px 6px; }
  .dt-cell { font-size: 11px; padding: 4px 2px 4px 0; }
  .dt-cell-wrap { gap: 4px; white-space: normal; }
  .dt-dot { width: 18px; height: 18px; font-size: 9px; }
  .dt-sun { font-size: 10px; padding: 2px; }
  .dt-sun-chip { margin-left: 5px; padding: 1px 7px; font-size: 9px; }
}

/* ---- week table (home) ----
   Days across, locations down, each cell a clickable hour-stripe
   timeline. Scanning a column answers "where can I paddle that day". */

.week-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  table-layout: fixed;
}

.week-table th { font-size: 12px; padding: 0; }
.wt-corner { width: 110px; }
.wt-day-name { display: block; font-weight: 600; }
.wt-day-date { display: block; color: var(--muted); font-weight: 400; }

.wt-loc {
  text-align: left;
  font-size: 14px;
  padding-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wt-loc a { color: var(--ink); text-decoration: none; }
.wt-loc a:hover { color: var(--accent); }

.week-table td { padding: 0; }

.wt-cell {
  display: block;
  padding: 6px 3px;
  border: 1px solid transparent;
  border-radius: 8px;
}
.wt-cell:hover { border-color: var(--accent); }
.wt-cell .day-bar { height: 14px; }

.wt-error { color: var(--muted); font-size: 13px; }

@media (max-width: 720px) {
  .week-table { padding: 8px; border-spacing: 2px 8px; }
  .wt-corner { width: 72px; }
  .wt-loc { font-size: 13px; }
  .wt-day-date { display: none; }
}

/* ---- settings ---- */

.settings-form { max-width: 640px; }

.settings-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 14px;
}
.settings-section h3 { margin: 0 0 4px; }

.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field-label { font-size: 13px; color: var(--muted); }
.field input[type="text"], .field input[type="number"], .field select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 120px; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }

.cond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.settings-actions { display: flex; gap: 10px; margin: 18px 0 40px; }

.swatches { display: inline-flex; gap: 3px; margin-left: 8px; }
.swatch { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }

/* ---- direction wheel ---- */

.dir-wheel { width: 220px; height: 220px; display: block; margin: 10px 0; }
.dir-slice { fill: #e7edef; stroke: #fff; stroke-width: 1.5; cursor: pointer; }
.dir-slice:hover { fill: #cfdce0; }
.dir-slice.selected { fill: var(--accent); }
.dir-label { font-size: 9px; text-anchor: middle; dominant-baseline: middle; fill: var(--ink); pointer-events: none; }
.dir-hint { font-size: 10px; text-anchor: middle; dominant-baseline: middle; fill: var(--muted); }

/* ---- add location ---- */

.map { height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }

.add-form { display: flex; gap: 12px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.add-form input[type="text"] {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  min-width: 240px;
}
.coords { color: var(--muted); font-size: 13px; }

/* ---- responsive ---- */

@media (max-width: 720px) {
  #main { padding: 14px; }
  .top-nav { top: 10px; right: 10px; }
}
