/* Hallmark · v2.0.0 · theme: rim (dealt 1/3) · rim: night · genre: modern-minimal · shape: app screen · posture: committed · nav: two destinations · footer: processing ledger · job: find and inspect a beach · signature: live Fiji coastline overlays on satellite imagery */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R5 V4 · weakest: hierarchy, the map takes the wide column and controls stay together beside the index. */
:root {
  color-scheme: dark;
  --color-paper: #121210;
  --color-panel: #1b1b17;
  --color-input: #11110e;
  --color-hover: #2b2a24;
  --color-selection: #253036;
  --color-ink: #f2eee5;
  --color-muted: #b6b1a4;
  --color-rule: #403e35;
  --color-field: #837e6e;
  --color-band: #ffae61;
  --color-band-edge: #291b12;
  --color-active: #a6dff4;
  --color-focus: #ffd39c;
  --color-error: #ffc3ad;
  --color-ocean: #123441;
  --font-body: "Switzer", system-ui, sans-serif;
  --font-measure: "Geist Mono", ui-monospace, monospace;
  --control-height: 2.75rem;
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--color-paper); color: var(--color-ink); font: 400 1rem/1.5 var(--font-body); }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { font-weight: 500; min-width: 0; overflow-wrap: break-word; }
h1, h2 { text-wrap: balance; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { color: var(--color-band); }
button, select, input { font: inherit; color: inherit; }
button, select, input {
  min-height: var(--control-height);
  border: 1px solid var(--color-field);
  border-radius: 0;
  background: var(--color-input);
  padding: .45rem .75rem;
}
button { cursor: pointer; white-space: nowrap; }
button:hover, select:hover { background: var(--color-hover); }
button:active, select:active { background: var(--color-selection); }
button:disabled, select:disabled, input:disabled { cursor: not-allowed; opacity: .6; }
input::placeholder { color: var(--color-muted); }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
::selection { background: var(--color-active); color: var(--color-paper); }
[hidden] { display: none !important; }

.page { width: min(100% - 3rem, 96rem); margin-inline: auto; }
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  min-height: 3.75rem;
  border-bottom: 1px solid var(--color-rule);
  font-size: .9375rem;
}
.masthead nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem 1rem; }
.brand { flex-shrink: 0; font-weight: 600; text-decoration: none; }
.heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .875rem 1.5rem;
  padding-block: 1.35rem 1.25rem;
}
.heading h1 { font-size: 3.25rem; line-height: 1.08; letter-spacing: -.04em; }
.heading p { color: var(--color-muted); margin-top: .4rem; max-width: 62ch; }
.download {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-height);
  padding: .5rem .875rem;
  background: var(--color-panel);
  color: var(--color-ink);
  border: 1px solid var(--color-field);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.download:hover { background: var(--color-hover); color: var(--color-ink); }
.download:active { background: var(--color-selection); color: var(--color-ink); }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17.5rem, 21.5rem);
  height: min(49rem, max(31rem, calc(100dvh - 17.5rem)));
  border: 1px solid var(--color-rule);
}
.map-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.map-view { display: flex; flex: 1; position: relative; min-height: 0; }
.map-toolbar, .map-legend {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .42rem .75rem;
  background: var(--color-panel);
}
.map-toolbar button { margin-right: auto; }
.map-toolbar button, .map-toolbar select, .map-legend { font-size: .875rem; }
.basemap-label { color: var(--color-muted); font-size: .875rem; }
#beach-map {
  flex: 1;
  min-width: 0;
  min-height: 0;
  isolation: isolate;
  background: var(--color-ocean);
  font-family: var(--font-body);
}
#beach-map noscript p { padding: 1rem; }
.map-legend { min-height: 2.4rem; flex-wrap: wrap; justify-content: space-between; color: var(--color-muted); }
.legend-line { display: inline-block; vertical-align: middle; width: 1.2rem; height: .2rem; margin-right: .4rem; background: var(--color-band); }
.satellite-tile { overflow: hidden; }
.satellite-tile img { position: absolute; max-width: none; user-select: none; }
#trend-legend { position: relative; }
#trend-legend summary { cursor: pointer; color: var(--color-ink); }
#trend-legend small { color: var(--color-muted); }
#trend-colors { display: inline-flex; height: .6rem; width: clamp(4.5rem, 19vw, 10rem); margin-inline: .35rem; }
#trend-colors span { flex: 1; }
#trend-classes {
  position: absolute;
  z-index: 1100;
  bottom: calc(100% + .55rem);
  inset-inline-start: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .3rem .6rem;
  width: min(19rem, 84vw);
  margin: 0;
  padding: .65rem;
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  list-style: none;
}
.trend-key { display: inline-block; width: .9rem; height: .22rem; margin-inline-end: .38rem; vertical-align: middle; }
#beach-map .leaflet-bar { border: 1px solid var(--color-field); border-radius: 0; }
#beach-map .leaflet-bar a { border-radius: 0; border-color: var(--color-rule); }
#beach-map .leaflet-bar a, #beach-map .leaflet-control-attribution, #beach-map .leaflet-control-scale-line {
  background: var(--color-paper);
  color: var(--color-ink);
}
#beach-map .leaflet-control-attribution a { color: var(--color-active); }
#beach-map .leaflet-control-scale-line { border-color: var(--color-ink); font-size: .75rem; text-shadow: none; }
#beach-map .leaflet-bar a:hover { background: var(--color-hover); }
#beach-map:focus-visible, #beach-map a:focus-visible {
  outline: 2px solid var(--color-focus) !important;
  outline-offset: -3px;
}
#beach-map .map-place {
  background: var(--color-ocean);
  color: var(--color-ink);
  font: 500 .875rem/1.2 var(--font-body);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: .32rem .4rem;
}
#beach-map .map-place::before { display: none; }
#beach-map .leaflet-popup-content-wrapper, #beach-map .leaflet-popup-tip {
  border-radius: 0;
  background: var(--color-paper);
  color: var(--color-ink);
}
#beach-map .leaflet-popup-content { font-size: .875rem; }
#beach-map .leaflet-popup-close-button { color: var(--color-muted); }
#transect-series {
  position: absolute;
  z-index: 900;
  inset: auto .65rem 1.65rem;
  padding: .7rem .85rem;
  max-height: 80%;
  overflow: auto;
  color: #172f36;
  background: #edf2ee;
  border: 1px solid #aebfba;
  box-shadow: 0 4px 18px #0006;
}
#transect-series header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: .6rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid #bdcbc6;
}
#transect-series h3 { font-size: 1rem; overflow-wrap: anywhere; }
#transect-series p { color: #3e575e; font-size: .8rem; }
#transect-series button {
  padding: .28rem .55rem;
  min-height: 1.9rem;
  font-size: .8rem;
  background: #edf2ee;
  color: #172f36;
  border-color: #839d97;
}
#transect-series button:hover { background: #dbe7e2; }
#transect-series button:focus-visible { outline-color: #176358; }
#transect-series-status:empty { display: none; }
.series-plot { position: relative; height: clamp(11rem, 34vh, 22rem); margin-top: .4rem; }
#series-gap-note { margin: .25rem 0 0 .2rem; }

.index-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--color-panel);
  color: var(--color-ink);
  border-left: 1px solid var(--color-rule);
}
.index-head { padding: .8rem 1rem .9rem; }
.index-head h2, .coastsat h2 { font-size: 1.25rem; letter-spacing: -.02em; }
.views { display: flex; gap: .35rem; margin-top: .55rem; }
.views button { flex: 1; padding-inline: .4rem; font-size: .875rem; }
.views [aria-pressed="true"] {
  border-color: var(--color-active);
  background: var(--color-selection);
  color: var(--color-active);
}
#filters { display: grid; margin-top: .5rem; gap: .2rem; }
#filters label { font-size: .875rem; color: var(--color-muted); }
#filters label:not(:first-child) { margin-top: .38rem; }
#filters input, #filters select { width: 100%; }
.site-details { padding: .55rem 1rem .7rem; border-block: 1px solid var(--color-rule); background: var(--color-selection); }
.detail-heading { display: flex; gap: .5rem; align-items: start; justify-content: space-between; }
.detail-heading h3 { padding-top: .4rem; font-size: 1.075rem; }
.detail-heading button { font-size: .875rem; border-color: transparent; background: none; }
.detail-heading button:hover, .detail-heading button:active { border-color: var(--color-field); }
.site-details dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .15rem .6rem; font-size: .875rem; }
.site-details dt { color: var(--color-muted); }
.site-details dd { overflow-wrap: anywhere; }
.site-details a { display: inline-block; margin-top: .45rem; font-size: .875rem; }
.result-links { display: flex; flex-wrap: wrap; gap: 0 1rem; }
#transect-picker-label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .4rem; align-items: center; margin-top: .5rem; font-size: .875rem; }
#transect-picker { min-height: 2rem; padding: .25rem .4rem; font: inherit; }
.site-photos { margin-top: .55rem; font-size: .875rem; }
.site-photos p { margin: 0; color: var(--color-muted); }
.fiji-site-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin-top: .35rem; }
.fiji-site-previews figure { margin: 0; min-width: 0; font-size: .75rem; }
.fiji-site-previews img { display: block; width: 100%; height: auto; aspect-ratio: 10 / 7; object-fit: contain; background: var(--color-selection); }
.fiji-site-previews a { margin-top: .15rem; font-size: inherit; }
#site-id, #site-area { font-family: var(--font-measure); font-variant-numeric: tabular-nums; }
.list-head { padding: .55rem 1rem; border-block-start: 1px solid var(--color-rule); font-size: .875rem; color: var(--color-muted); }
.list-head button { margin-top: .5rem; }
.results {
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1;
  background: var(--color-input);
  color: var(--color-ink);
  scrollbar-color: var(--color-field) var(--color-input);
}
#site-list { margin: 0; padding: 0; list-style: none; }
.site-row {
  display: grid;
  width: 100%;
  gap: .1rem;
  padding: .29rem 1rem;
  line-height: 1.25;
  text-align: start;
  white-space: normal;
  border: 0;
  border-top: 1px solid var(--color-rule);
  background: var(--color-input);
}
.site-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-row span:last-child { font-family: var(--font-measure); color: var(--color-muted); font-size: .75rem; }
.site-row[aria-current="true"] { background: var(--color-selection); color: var(--color-active); }
.site-row:focus-visible { outline-offset: -3px; }
#more { margin: .75rem 1rem; }
.coastsat {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: .75rem 2rem;
  flex-wrap: wrap;
  width: calc(100% - 21.5rem);
  padding-block: .85rem 1.25rem;
  font-size: .875rem;
}
.coastsat p, .coastsat dt { color: var(--color-muted); }
.coastsat dl { display: flex; gap: .8rem 1.5rem; flex-wrap: wrap; }
.coastsat dd { font: 400 1.125rem/1.4 var(--font-measure); font-variant-numeric: tabular-nums; margin-top: .15rem; }
.research {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1.5rem 3rem;
  border-top: 1px solid var(--color-rule);
  padding-block: 1.5rem 2.25rem;
}
.research h2 { font-size: 1.25rem; letter-spacing: -.02em; }
.research p { color: var(--color-muted); max-width: 67ch; margin-top: .65rem; }
.sources { margin: .65rem 0 0; padding: 0; list-style: none; }
.sources li + li { margin-top: .65rem; }
.sources span { display: block; color: var(--color-muted); font-size: .875rem; }
.has-error { color: var(--color-error); }

@media (max-width: 740px) {
  .page { width: calc(100% - 1.5rem); }
  .heading { padding-block: 1rem; }
  .heading h1 { font-size: 2.25rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); height: auto; }
  .map-panel { height: max(23rem, 54svh); }
  .index-panel { border-left: 0; border-top: 1px solid var(--color-rule); }
  .results { max-height: 18rem; }
  .coastsat { width: 100%; }
  .research { grid-template-columns: minmax(0, 1fr); }
  .basemap-label { display: none; }
  #transect-series { inset-inline: .35rem; max-height: 78%; padding: .5rem; }
  .series-plot { height: clamp(8.25rem, 16svh, 10rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
