/* ============================================================================
   favorites.css — /favorites (web redesign Stage 5c). Layout after Grant's
   Favorites Board handoff; colours are the site's tokens plus ONE accent per
   mode, the values the home page's Three Modes cards already use
   (css/home-sections.css .mode3--*), light and dark:
     surf teal · marine blue · weather amber.
   Explore's row (css/explore.css .ex-row) is the library row's base.
   ========================================================================== */
.fav-body { background: var(--surface, var(--bg)); }
.fav {
  --fav-surf: #087E6D;    --fav-surf-tint: #E6F5F0;
  --fav-marine: #22719A;  --fav-marine-tint: #E6F1F9;
  --fav-weather: #8F5D17; --fav-weather-tint: #FBF1DE;
  max-width: 1360px; margin: 0 auto; padding: calc(var(--nav-h, 68px) + 20px) 24px 48px;
  display: flex; flex-direction: column; gap: 28px; color: var(--text);
  font-family: var(--font-sans, "Inter", system-ui, sans-serif);
}
:root[data-theme='dark'] .fav {
  --fav-surf: #75D6BC;    --fav-surf-tint: rgba(117, 214, 188, 0.13);
  --fav-marine: #8CC8E9;  --fav-marine-tint: rgba(140, 200, 233, 0.13);
  --fav-weather: #ECCA86; --fav-weather-tint: rgba(236, 202, 134, 0.13);
}

/* ── heading ─────────────────────────────────────────────────────────────── */
.fav__eyebrow { margin: 0 0 10px; font-size: 11px; font-weight: 800; letter-spacing: 0.16em; color: var(--accent-text, var(--fav-surf)); }
.fav__title { margin: 0; font-size: clamp(32px, 4.2vw, 44px); line-height: 1.12; font-weight: 800; letter-spacing: -0.03em; }
.fav__title span { color: var(--accent-text, var(--fav-surf)); }
.fav__intro { margin: 12px 0 0; font-size: 15px; color: var(--text-secondary); }
.fav-loading { color: var(--text-secondary); font-size: 14px; }
#fav-root { display: flex; flex-direction: column; gap: 32px; }

.fav-h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.fav-h3 { margin: 0 0 6px; font-size: 17px; font-weight: 800; }
.fav-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }

/* ── buttons (sentence case) ─────────────────────────────────────────────── */
.fav-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  padding: 0 15px; border-radius: 10px; border: 1px solid var(--line-strong, var(--line));
  background: var(--surface-raised, var(--bg)); color: var(--text); font: 600 13px var(--font-sans, "Inter", sans-serif);
  cursor: pointer; white-space: nowrap;
}
.fav-btn:hover:not(:disabled) { border-color: var(--accent); }
.fav-btn:focus-visible, .fav-seg__btn:focus-visible, .fav-row__rm:focus-visible, .fav-card__link:focus-visible,
.fav-toast__undo:focus-visible, .fav-dialog__x:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.fav-btn:disabled { opacity: 0.55; cursor: default; }
.fav-btn--primary { background: var(--brand-teal, #0E7A66); border-color: var(--brand-teal, #0E7A66); color: #fff; }
.fav-btn--primary:hover:not(:disabled) { border-color: var(--brand-teal, #0E7A66); filter: brightness(1.06); }
.fav-btn--sm { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }

/* ── rev A §5: the Example board's sign-up prompt and labels ──────────── */
.fav-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--fav-surf-tint); }
.fav-banner p { margin: 0; font-size: 14px; font-weight: 600; }
.fav-tag { display: inline-block; margin-left: 10px; padding: 3px 9px; border-radius: 999px; vertical-align: middle;
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-text); background: var(--fav-surf-tint); border: 1px solid var(--line); }
.fav-board__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fav-note { margin: 8px 0 0; font-size: 13px; color: var(--text-secondary); max-width: 70ch; }
.fav-lib__cta { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.fav-lib__cta .fav-sub { margin: 0 0 4px; max-width: 60ch; font-size: 14px; line-height: 1.5; }

/* ── the board: a restrained teal wash ───────────────────────────────────── */
.fav-board {
  padding: 26px; border: 1px solid var(--line); border-radius: 20px;
  background: radial-gradient(ellipse at top left, var(--fav-surf-tint), transparent 62%), var(--bg);
}
.fav-board__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.fav-board__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-top: 20px; }
.fav-board__foot .fav-sub { margin: 0; font-size: 12px; }
.fav-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.fav-check input { width: 17px; height: 17px; accent-color: var(--brand-teal, #0E7A66); }
.fav-board__empty { grid-column: 1 / -1; padding: 30px 20px; text-align: center; color: var(--text-secondary);
  border: 1px dashed var(--line-strong, var(--line)); border-radius: 14px; }
.fav-board__empty p { margin: 0 auto; max-width: 52ch; font-size: 14px; line-height: 1.5; }
.fav-board__empty .fav-h3 { color: var(--text); }

/* 12 columns: Wide spans 6, Standard / Compact span 3; fewer at narrower widths */
.fav-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.fav-card { grid-column: span 3; min-width: 0; display: flex; flex-direction: column; position: relative;
  border: 1px solid var(--line); border-radius: 15px; background: var(--surface-raised, var(--bg)); overflow: hidden;
  --acc: var(--fav-surf); transition: border-color 0.18s, box-shadow 0.18s; }
.fav-card--wide { grid-column: span 6; }
.fav-card--compact { align-self: start; }
.fav-card--marine { --acc: var(--fav-marine); }
.fav-card--weather { --acc: var(--fav-weather); }
.fav-card:hover { border-color: var(--acc); box-shadow: var(--shadow-sm, 0 6px 18px rgba(9, 37, 44, 0.05)); }
@media (max-width: 1100px) {
  .fav-card, .fav-card--compact { grid-column: span 6; }
  .fav-card--wide { grid-column: span 12; }
}
@media (max-width: 640px) {
  .fav { padding-inline: 16px; }
  .fav-board { padding: 16px; }
  .fav-card, .fav-card--compact, .fav-card--wide { grid-column: span 12; }
}
@media (prefers-reduced-motion: reduce) { .fav-card { transition: none; } }

.fav-card__link { display: flex; flex: 1; color: inherit; text-decoration: none; border-radius: 15px; }
.fav-card__body { display: flex; flex-direction: column; flex: 1; min-width: 0; padding: 20px; }
.fav-card__type { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--acc);
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em; }
.fav-ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; flex: 0 0 auto; }
.fav-card__name { margin: 12px 0 4px; font-size: 18px; font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.fav-card__region { margin: 0 0 18px; font-size: 12px; color: var(--text-secondary); }
.fav-card__value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; min-height: 46px; }
.fav-card__num { font-size: 40px; font-weight: 700; line-height: 1.1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.fav-card__unit { font-size: 17px; color: var(--text-secondary); font-weight: 600; }
.fav-card__label { flex-basis: 100%; font-size: 12px; color: var(--text-secondary); }
.fav-card__wx { width: 30px; height: 30px; align-self: center; }
.fav-card--wide .fav-card__label { flex-basis: auto; margin-left: auto; }
.fav-card--compact .fav-card__num { font-size: 32px; }
.fav-card--compact .fav-card__region { margin-bottom: 12px; }
.fav-card__support { min-height: 0; }
.fav-card__detail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 12px 0 0; font-size: 12px; color: var(--text-secondary); }
.fav-card__note { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); }
/* a wind + tide station's tide line (2026-10-05) */
.fav-card__tide { margin: 8px 0 0; font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.fav-card__trend { margin-top: 14px; color: var(--acc); }
.fav-card__bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: auto; padding-top: 16px;
  font-size: 11px; color: var(--text-muted); }
/* rev B §2: the reading's time is READ, not skimmed — 13px, body ink. The
   warning-type notes (.fav-card__note, .fav-flag) keep their own styling. */
.fav-card__source { min-width: 0; font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.35; }
.fav-card__open { font-size: 12px; font-weight: 700; color: var(--acc); white-space: nowrap; }
.fav-card--compact .fav-card__bottom { padding-top: 12px; }
.fav-card--compact .fav-card__open { display: none; }
.fav-flag { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface-sunken, var(--surface)); color: var(--text-secondary); border: 1px solid var(--line); }
.fav-card.is-unavailable .fav-card__name { color: var(--text-secondary); }
.fav-card__ctl { display: flex; gap: 8px; padding: 0 20px 16px; }

/* skeletons hold the card's shape while its reading loads */
.fav-skel { display: inline-block; border-radius: 6px; background: var(--surface-sunken, var(--line)); color: transparent; }
.fav-skel--value { width: 60%; height: 40px; }
.fav-skel--chart { display: block; width: 100%; height: 150px; }
@media (prefers-reduced-motion: no-preference) {
  .fav-skel { animation: fav-pulse 1.4s ease-in-out infinite; }
  @keyframes fav-pulse { 50% { opacity: 0.55; } }
}

/* rev A §1: the Wide surf card's live Surf chart (fc-chart.js, the forecast
   page's own) — one bar colour, --ch-surf, exactly as the forecast page
   (css/surf-page.css .fcx-surf); the rating is the readout's pill. The
   readout is the surf page's (sf-big / sf-ratepill). */
.fav-card--live .fav-card__value { min-height: 0; }
.fav-live__readout { display: block; }
.fav-live__readout .fcx-readout { width: 100%; }
.fav-live__big { font-size: 30px; }
/* rev B §3: swell lines under the range (Standard + Wide surf) — the forecast
   page's .sf-swline, three reserved lanes */
.fav-swells { margin-top: 6px; }
.fav-swells .fcx-lane { font-size: 13px; color: var(--text); }
.fav-card__support .fav-swells { margin: 10px 0 0; }
.fav-card__openlink { font-size: 12px; font-weight: 700; letter-spacing: 0; color: var(--acc); text-decoration: none; white-space: nowrap; }
.fav-card__openlink:hover, .fav-card__namelink:hover { text-decoration: underline; }
.fav-card__namelink { color: inherit; text-decoration: none; }
.fav-card__openlink:focus-visible, .fav-card__namelink:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; border-radius: 4px; }
.fav-card--live:not([draggable='true']) { cursor: pointer; }
.fav-chart { margin-top: 10px; cursor: default; }
.fav-chart__ctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.fav-chart__day { min-width: 0; font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-chart__btns { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.fav-chart__ctl .fcc-stepper--card { margin-left: 0; }
.fav-live__now { min-height: 28px; padding: 0 10px; font-size: 12px; }
.fav-chart__plot { touch-action: pan-y; }

/* editing */
.fav-grid.is-editing .fav-card { cursor: grab; border-style: dashed; border-color: var(--line-strong, var(--line)); }
.fav-card.is-dragging { opacity: 0.45; }
.fav-card.is-drop { border-color: var(--acc); border-style: solid; box-shadow: 0 0 0 2px var(--acc); }
.fav-card__edit { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--fav-surf-tint); border-bottom: 1px solid var(--line); }
.fav-card__move { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); margin-top: auto; }
.fav-seg { display: inline-flex; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.fav-seg__btn { border: 0; background: none; padding: 4px 8px; border-radius: 6px; font: 600 11px var(--font-sans, "Inter", sans-serif);
  color: var(--text-secondary); cursor: pointer; }
.fav-seg__btn[aria-pressed='true'] { background: var(--surface-raised, var(--bg)); color: var(--accent-text); box-shadow: 0 0 0 1px var(--line-strong, var(--line)); }

/* ── the library ─────────────────────────────────────────────────────────── */
.fav-lib { padding: 24px 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); }
.fav-lib__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.fav-lib__filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fav-modes__n { margin-left: 6px; font-weight: 500; opacity: 0.7; }
.fav-search { flex: 1 1 220px; }
.fav-select { height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong, var(--line));
  background: var(--surface-raised, var(--bg)); color: var(--text); font: 500 13px var(--font-sans, "Inter", sans-serif); max-width: 240px; }
.fav-select--full { width: 100%; max-width: none; }
.fav-count { margin: 14px 2px 0; }
.fav-rows { display: flex; flex-direction: column; }
.fav-group { display: flex; flex-direction: column; gap: 6px; padding-top: 18px; }
.fav-group__title { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 4px; font-size: 14px; font-weight: 800; }
.fav-group__title small { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.fav-lib__empty, .fav-lib__none { padding: 36px 16px; text-align: center; color: var(--text-secondary); font-size: 14px; }
.fav-lib__empty p { max-width: 54ch; margin: 0 auto 16px; line-height: 1.5; }
.fav-lib__empty .fav-h3 { color: var(--text); }

.ex-row.fav-row { grid-template-columns: minmax(0, 1fr) auto auto; padding: 0 10px 0 0; }
.fav-row__link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 4px 10px 12px; color: inherit; text-decoration: none; min-width: 0; border-radius: 10px; }
.fav-row__link:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: -2px; }
.fav-rowic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--fav-surf); background: var(--fav-surf-tint); }
.fav-rowic--marine { color: var(--fav-marine); background: var(--fav-marine-tint); }
.fav-rowic--weather { color: var(--fav-weather); background: var(--fav-weather-tint); }
.fav-rowic .fav-ic { width: 20px; height: 20px; }
.fav-pin { color: var(--accent-text); }
.fav-pin.is-pinned { background: var(--fav-surf-tint); border-color: transparent; }
.fav-row__rm { width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text-secondary);
  font-size: 18px; line-height: 1; cursor: pointer; }
.fav-row__rm:hover { border-color: var(--line-strong, var(--line)); color: var(--text); }
.fav-row.is-unavailable .ex-row__name { color: var(--text-secondary); }
@media (max-width: 640px) {
  .fav-lib { padding: 18px 14px; }
  .fav-lib__head, .fav-board__head { flex-direction: column; align-items: stretch; }
  .ex-row.fav-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fav-row .fav-pin { grid-column: 1; justify-self: start; margin: 0 0 10px 60px; }
  .fav-row .fav-row__rm { grid-row: 1; grid-column: 2; }
  .fav-select { max-width: none; flex: 1 1 100%; }
}

/* ── toast (Undo) ───────────────────────────────────────────────────────── */
.fav-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1500; display: flex; align-items: center; gap: 24px;
  padding: 12px 16px 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  font: 600 14px var(--font-sans, "Inter", sans-serif); max-width: calc(100vw - 32px); }
.fav-toast[hidden] { display: none; }
.fav-toast__undo { border: 0; background: none; color: inherit; font: 800 14px var(--font-sans, "Inter", sans-serif); text-decoration: underline; cursor: pointer; padding: 4px; }

/* ── Add favorite dialog ─────────────────────────────────────────────────── */
.fav-dialog { width: 560px; max-width: calc(100vw - 32px); max-height: 82vh; padding: 24px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--bg); color: var(--text); font-family: var(--font-sans, "Inter", sans-serif); }
.fav-dialog::backdrop { background: var(--scrim, rgba(4, 21, 28, 0.5)); }
.fav-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
.fav-dialog__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.fav-dialog__x { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: none; color: var(--text); font-size: 22px; cursor: pointer; }
.fav-dialog__field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.fav-dialog__hint { margin: 0; }
.fav-dialog__search { flex: 0 0 auto; width: 100%; box-sizing: border-box; }
.fav-dialog__search[hidden] { display: none; }
.fav-dialog__results { overflow: auto; min-height: 60px; max-height: 44vh; }
.fav-dialog__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.fav-dialog__row b { display: block; font-size: 14px; }
.fav-dialog__row small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-secondary); }
