/* cr.seamus.win: a monitor wall of the Côte d'Azur. Dark like a control room, sea blue and sunset accents,
   a light variant follows the system setting. */

:root {
  color-scheme: dark;
  --bg: #060a12;
  --glow-sun: rgba(255, 122, 89, 0.11);
  --glow-sea: rgba(46, 170, 220, 0.1);
  --panel: #0c1320;
  --panel-2: #101a2a;
  --border: #1b2638;
  --hover: #172338;
  --text: #e8eef7;
  --muted: #8693a8;
  --sea: #3cc4e6;
  --sunset: #ff8a5c;
  --live: #ff3b4f;
  --sun: #ffc35a;
  --moon: #c9d4ff;
  --map-bg: #0a0f18;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --scrim: rgba(3, 6, 12, 0.8);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f1ea;
    --glow-sun: rgba(255, 138, 92, 0.18);
    --glow-sea: rgba(60, 196, 230, 0.14);
    --panel: #ffffff;
    --panel-2: #fbf8f3;
    --border: #e6dfd3;
    --hover: #f2ede4;
    --text: #13202f;
    --muted: #677385;
    --sea: #0b86ad;
    --sunset: #e3623b;
    --live: #e5283c;
    --sun: #e39b12;
    --moon: #5d6bb5;
    --map-bg: #e9e4da;
    --shadow: 0 8px 24px rgba(60, 40, 10, 0.08);
    --scrim: rgba(25, 20, 12, 0.55);
  }
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 clamp(12px, 2.4vw, 32px);
  color: var(--text);
  font: 15px/1.45 var(--font);
  background:
    radial-gradient(1100px 520px at 88% -8%, var(--glow-sun), transparent 70%),
    radial-gradient(900px 600px at -10% 110%, var(--glow-sea), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body.has-focus { overflow: hidden; }

a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; letter-spacing: normal; text-transform: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- header */

.top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
  flex-wrap: wrap;
  padding: 18px 0 16px;
}

.top::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sea) 25%, var(--sunset) 75%, transparent);
  opacity: 0.55;
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 11px; box-shadow: var(--shadow); }
.brand-text { display: flex; flex-direction: column; }
.brand strong {
  font-size: 23px;
  font-weight: 760;
  letter-spacing: -0.015em;
  line-height: 1.1;
  background: linear-gradient(90deg, var(--sea), var(--sunset));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand small { color: var(--muted); font-size: 13px; }

.now { display: flex; gap: 26px; }
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat .k { color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.stat .v { display: inline-flex; align-items: center; gap: 7px; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: pre; }
.sun .v { font-size: 15px; }

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 var(--live);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 8px transparent; }
}

/* ---- place filter */

.places {
  display: flex;
  gap: 8px;
  padding: 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.places::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 7px 12px 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { background: var(--hover); }
.chip .n {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.chip .t { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.chip .t:empty { display: none; }
.chip[aria-pressed='true'] {
  border-color: color-mix(in srgb, var(--sea) 55%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--sea) 20%, var(--panel)), color-mix(in srgb, var(--sunset) 16%, var(--panel)));
}
.chip[aria-pressed='true'] .n { background: var(--sea); color: var(--bg); }

/* ---- layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 14px;
  align-content: start;
}

/* One or two cameras get the room, but never taller than the window. */
.wall.few { grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }
.wall.few .tile { max-width: calc((100svh - 240px) * 16 / 9); margin-inline: auto; }

/* ---- camera tiles */

.slot { position: relative; min-width: 0; }
.slot[hidden] { display: none; }

.tile {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.screen { position: relative; aspect-ratio: 16 / 9; background: #000; }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

.offline {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
  text-align: center;
  color: #c7d0dc;
  background: radial-gradient(circle at 50% 40%, #1a2436, #070b12);
}
.offline strong { font-size: 16px; color: #fff; }
.offline a { color: #7fd8ee; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 8px 9px 12px;
}

.label { display: flex; align-items: center; gap: 10px; min-width: 0; }

.badge {
  flex: none;
  padding: 3px 7px 2px;
  border-radius: 6px;
  background: var(--live);
  color: #fff;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.badge.off { background: var(--muted); }

.where { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.place { color: var(--sea); font-size: 10.5px; font-weight: 650; letter-spacing: 0.13em; text-transform: uppercase; }
.name { overflow: hidden; font-size: 15px; font-weight: 640; text-overflow: ellipsis; white-space: nowrap; }

.tools { display: flex; align-items: center; gap: 2px; flex: none; }
.wx {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ib {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.ib:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.ib:focus-visible, .chip:focus-visible, .linkish:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }

.more { display: none; padding: 0 14px 14px; font-size: 14px; }
.more p { margin: 0; }
.more p + p { margin-top: 2px; font-size: 13px; }

.slot.flash .tile { animation: flash 1.4s ease-out; }
@keyframes flash {
  0%, 40% { box-shadow: 0 0 0 3px var(--sea), var(--shadow); }
  100% { box-shadow: 0 0 0 0 transparent, var(--shadow); }
}

/* ---- enlarged view */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--scrim);
  backdrop-filter: blur(6px);
}

.slot.focused .tile {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: calc(50% - 26px);
  width: min(96vw, calc((100svh - 170px) * 16 / 9));
  transform: translate(-50%, -50%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: pop 0.18s ease-out;
}
.slot.focused .more { display: block; }
.slot.focused .name { font-size: 17px; }

@keyframes pop {
  from { opacity: 0.4; transform: translate(-50%, -48%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.stepper {
  position: fixed;
  z-index: 61;
  left: 50%;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}
.stepper[hidden] { display: none; }
.stepper .ib { border-radius: 999px; }
#stepper-pos { padding: 0 8px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- full screen: the tile with its caption */

.tile:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: #000;
}
.tile:fullscreen .screen { flex: 1; aspect-ratio: auto; }
.tile:fullscreen .bar { background: #0c1320; color: #e8eef7; }
.tile:fullscreen .more { display: none; }
.tile::backdrop { background: #000; }

/* ---- side panels */

.side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }

.panel {
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.panel p { margin: 8px 0 0; }
.panel.small { font-size: 13.5px; }

.map {
  height: 300px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--map-bg);
}
.map-empty { display: grid; height: 100%; margin: 0; place-items: center; }
@media (prefers-color-scheme: dark) {
  .map .osm { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(88%) saturate(55%); }
}
.map .leaflet-control-attribution { background: color-mix(in srgb, var(--panel) 85%, transparent); color: var(--muted); font-size: 10px; }
.map .leaflet-control-attribution a { color: var(--sea); }
.map .leaflet-bar a { background: var(--panel); color: var(--text); border-bottom-color: var(--border); }
.map .leaflet-bar a:hover { background: var(--hover); }
.map .leaflet-tooltip { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: 600 12.5px/1.3 var(--font); box-shadow: var(--shadow); }
.map .leaflet-tooltip-top::before { border-top-color: var(--panel); }

.wx-list { margin: 0; padding: 0; list-style: none; }
.wx-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  column-gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.wx-row:first-child { border-top: 0; padding-top: 2px; }
.wx-icon { display: grid; place-items: center; }
.wx-place { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.wx-place small { color: var(--muted); font-size: 12.5px; }
.wx-temp { font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; }
.wx-extra {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.arrow { display: inline-block; color: var(--sea); }

.linkish {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 620;
  text-align: left;
  cursor: pointer;
}
.linkish:hover { color: var(--sea); }

.wi-sun, .wi-partly { color: var(--sun); }
.wi-moon, .wi-partly-night { color: var(--moon); }
.wi-rain, .wi-drizzle, .wi-thunder { color: var(--sea); }
.wi-cloud, .wi-fog { color: var(--muted); }
.wi-snow { color: var(--text); }

/* ---- footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  margin-top: 26px;
  padding: 18px 0 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

/* ---- smaller screens */

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
}

@media (max-width: 640px) {
  body { padding: 0 12px; font-size: 14.5px; }
  .top { padding: 14px 0 12px; }
  .brand strong { font-size: 20px; }
  .now { gap: 18px; }
  .stat .v { font-size: 16px; }
  .sun .v { font-size: 14px; }
  .wall { gap: 12px; }
  .wx { margin-right: 2px; }
  .slot.focused .tile { top: 50%; width: 100vw; border-radius: 0; border-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse, .slot.flash .tile, .slot.focused .tile { animation: none; }
}
