/* Stocked — site styles on top of /ui/ui.css (Tailwind + Basecoat). Colors are the shadcn variables from site.ts `theme`.
   Signature element: the aging pin (.st-pin). Bright on the day of stocking, fading over 14 days, its size set by the
   number of fish; a dashed ring is a scheduled (not confirmed) stocking. public/map.js draws the same pin on the map.
   Bump ?v= in APP_HEAD (src/ui.tsx) whenever this file changes. */

:root {
  --st-fresh: oklch(0.68 0.2 42);
  --st-old: oklch(0.8 0.025 195);
  --st-rim: #fff;
  --st-water: oklch(0.94 0.02 200);
}
.dark {
  --st-fresh: oklch(0.76 0.17 50);
  --st-old: oklch(0.5 0.03 195);
  --st-rim: oklch(0.2 0.01 70);
}

/* ---- The aging pin ---- */
.st-pin {
  --age: 0;
  --d: 16px;
  display: inline-block;
  flex: none;
  box-sizing: border-box;
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: color-mix(in oklab, var(--st-fresh) calc((1 - var(--age)) * 100%), var(--st-old));
  border: 2px solid var(--st-rim);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--foreground) 30%, transparent);
  opacity: calc(1 - var(--age) * 0.45);
  vertical-align: middle;
}
.st-pin.is-planned {
  background: color-mix(in oklab, var(--st-fresh) 14%, var(--st-rim));
  border: 2px dashed color-mix(in oklab, var(--st-fresh) 85%, var(--foreground));
  box-shadow: none;
}
.st-pin.is-fresh { animation: st-ping 2.2s ease-out infinite; }
@keyframes st-ping {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--st-fresh) 55%, transparent), 0 0 0 1px color-mix(in oklab, var(--foreground) 30%, transparent); }
  70%, 100% { box-shadow: 0 0 0 12px color-mix(in oklab, var(--st-fresh) 0%, transparent), 0 0 0 1px color-mix(in oklab, var(--foreground) 30%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .st-pin.is-fresh { animation: none; box-shadow: 0 0 0 4px color-mix(in oklab, var(--st-fresh) 35%, transparent), 0 0 0 1px color-mix(in oklab, var(--foreground) 30%, transparent); }
}
.leaflet-marker-icon.st-icon { background: none; border: 0; }
.st-icon .st-pin { cursor: pointer; opacity: calc(1 - var(--age) * 0.35); }

/* ---- Lists ---- */
.st-when { display: inline-flex; align-items: center; gap: .65rem; min-width: 0; }
.st-when .block { display: block; }
.st-table td, .st-table th { vertical-align: middle; }
.show-sm { display: none; }
@media (max-width: 40rem) { .hide-sm { display: none; } .show-sm { display: inline; } }
.st-source { margin: 0; }
.st-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.st-state-row { display: grid; gap: .15rem; }
.st-lock { display: inline-flex; align-items: center; gap: .35rem; }

/* ---- Map ---- */
.map-wrap { position: relative; isolation: isolate; z-index: 0; }
#map { height: calc(100dvh - 3.5rem); min-height: 360px; width: 100%; background: var(--st-water); }
.leaflet-container { font-family: var(--font-body); }
.dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
.map-controls { position: absolute; right: 12px; top: 12px; z-index: 600; display: flex; flex-direction: column; gap: 8px; }
.map-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); color: var(--foreground); cursor: pointer; text-decoration: none; }
.map-btn svg { width: 20px; height: 20px; }
.map-title { position: absolute; left: 12px; top: 12px; z-index: 600; max-width: calc(100% - 84px); display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); color: var(--card-foreground); text-decoration: none; }
.map-title b { font: 600 1rem/1.2 var(--font-heading, inherit); }
.map-title span { font-size: .8rem; color: var(--muted-foreground); }
.map-hint { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); z-index: 650; padding: .5rem .9rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--foreground); color: var(--background); font: 500 .875rem/1.2 var(--font-body); cursor: pointer; }
.map-hint[hidden] { display: none; }
.st-legend { position: absolute; left: 12px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 600; display: grid; gap: 4px; padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card); color: var(--card-foreground); font-size: .75rem; line-height: 1.4; }
.st-scale { display: flex; align-items: center; gap: 6px; }
.st-ramp { flex: 1; min-width: 56px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--st-fresh), var(--st-old)); }
.st-scale-labels { display: flex; justify-content: space-between; color: var(--muted-foreground); }
.st-legend-row { display: flex; align-items: center; gap: 6px; color: var(--muted-foreground); }

/* ---- Sheets over the map ---- */
html.sheet-open { overflow: hidden; }
.sheet { position: fixed; z-index: 2000; background: var(--background); color: var(--foreground); overflow-y: auto; overscroll-behavior: contain;
  inset: auto 0 0 0; max-height: 88dvh; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px rgb(0 0 0 / .25); }
.sheet[hidden] { display: none; }
@media (min-width: 640px) {
  .sheet { inset: auto; left: 12px; bottom: 12px; top: auto; width: 26rem; max-height: calc(100dvh - 5rem); border: 1px solid var(--border); border-radius: 12px; }
  .sheet-modal { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); }
}
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; background: var(--background); border-bottom: 1px solid var(--border); }
.sheet-head h2 { flex: 1; min-width: 0; margin: 0; font-family: var(--font-heading, inherit); font-size: 1.25rem; line-height: 1.25; }
.sheet-x { display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: -6px -8px -6px 0; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--foreground); cursor: pointer; }
.sheet-body { padding: 14px 16px 24px; display: grid; gap: 12px; }
.sheet-body > * { margin: 0; }
.sheet-note { font-size: .875rem; color: var(--muted-foreground); }
.sheet-label { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.sheet-last { display: flex; align-items: center; gap: .75rem; font-size: 1.05rem; }
.sheet-events { list-style: none; padding: 0; margin: 0; display: grid; border-top: 1px solid var(--border); }
.sheet-events li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.sheet-events .when { font-weight: 600; min-width: 6.5rem; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
