/*
 * Zarautz Webcams — style.css
 *
 * OLED dark mode: true black canvas, single DM Mono typeface throughout.
 * Temperature value style (#eceef5 / DM Mono) is the master reference
 * for all visible UI text — placeholders, labels, footer copy.
 */

/* ─────────────────────────────────────────────────────────────────────────
   Design tokens
───────────────────────────────────────────────────────────────────────── */
:root {
  --mono:       'DM Mono', 'Courier New', monospace;

  /* OLED palette — pure black base */
  --bg:         #000;          /* entire page, video cells, footer, strip */

  /* Text — same scale used in temp values, propagated everywhere */
  --c-val:      #eceef5;       /* primary readable text — temp values, headings */
  --c-hi:       #b0b3c0;       /* secondary text — tide times, body copy */
  --c-mid:      #5a5d6e;       /* tertiary — labels, icons, sub-values */
  --c-dim:      #2e3040;       /* whisper — separators, disabled states */

  /* Borders / separators — subtle on true black */
  --sep:        rgba(255,255,255,0.06);
  --sep-strong: rgba(255,255,255,0.10);

  /* Tide accent colours */
  --tide-rise:  #38bdf8;
  --tide-fall:  #3d4258;

  /* Coefficient badges */
  --coef-high-bg: rgba(239,68,68,.12);   --coef-high-fg: #f87171;
  --coef-mid-bg:  rgba(249,115,22,.12);  --coef-mid-fg:  #fb923c;
  --coef-low-bg:  rgba(34,197,94,.11);   --coef-low-fg:  #4ade80;
  --coef-neap-bg: rgba(96,165,250,.10);  --coef-neap-fg: #93c5fd;
}

/* ─────────────────────────────────────────────────────────────────────────
   Reset & base
───────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  font-family: var(--mono);
  color: var(--c-hi);
}

/* ─────────────────────────────────────────────────────────────────────────
   Video grid
───────────────────────────────────────────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.video-cell {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  overflow: hidden;
}

.video-cell video-js,
.video-cell picture,
.video-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-cell--auto {
  height: auto !important;
  padding: 0 !important;
  aspect-ratio: auto !important;
  background: transparent !important;
}
.video-cell--auto::before { content: none !important; display: none !important; }
.video-cell--auto canvas  { display: block; width: 100%; height: auto; }

/* ─────────────────────────────────────────────────────────────────────────
   Panorama
───────────────────────────────────────────────────────────────────────── */
.panorama {
  display: block;
  position: relative;
  width: 100%;
  background: var(--bg);
}
.panorama a { display: block; }
.panorama canvas,
.panorama img { display: block; width: 100%; height: auto; }

.panorama--loading { animation: panorama-pulse 2.5s ease-in-out infinite; }
@keyframes panorama-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.panorama__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  background: var(--bg);
  pointer-events: none;
  z-index: 1;
  transition: opacity .5s ease;
}
.panorama:not(.panorama--loading) .panorama__placeholder {
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease, visibility 0s linear .5s;
}

.panorama__spinner {
  width: 1.6rem; height: 1.6rem;
  border: 1.5px solid var(--c-dim);
  border-top-color: var(--c-mid);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.panorama__label {
  margin: 0;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 300;
  letter-spacing: .14em;
  color: var(--c-mid);         /* same mid-tone as temp unit/icons */
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────────────────
   Responsive — portrait mobile: single column cams
───────────────────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .video-grid { grid-template-columns: 1fr; }
}

/* ═════════════════════════════════════════════════════════════════════════
   INFO STRIP  —  top of page, always one row
═════════════════════════════════════════════════════════════════════════ */
.info-strip {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--sep);
  display: flex;
  align-items: stretch;
  height: 52px;
  overflow: hidden;
  width: 100%;
  /* Hide strip when anything is truly fullscreen */
}
/* Hide when browser native fullscreen is active */
:fullscreen .info-strip,
:-webkit-full-screen .info-strip,
:-moz-full-screen .info-strip { display: none; }

.strip-div {
  width: 1px;
  background: var(--sep);
  margin: 12px 0;
  flex-shrink: 0;
}

/* ── Temperatures ── */
.temps-cluster { display: flex; align-items: center; flex-shrink: 0; }

.temp-item {
  display: flex; align-items: center; gap: 7px;
  padding: 0 16px; position: relative;
}
.temp-item + .temp-item::before {
  content: ''; position: absolute; left: 0; top: 28%; height: 44%;
  width: 1px; background: var(--sep);
}
.temp-icon { display: flex; align-items: center; color: var(--c-mid); flex-shrink: 0; }
.temp-body { display: flex; flex-direction: column; gap: 2px; }

.temp-label {
  font-family: var(--mono);
  font-size: .53rem;
  font-weight: 500;
  letter-spacing: .18em;
  color: var(--c-mid);
  text-transform: uppercase;
  line-height: 1;
}
.temp-value {
  font-family: var(--mono);
  font-size: .98rem;
  color: var(--c-val);        /* ← master reference colour */
  line-height: 1;
  letter-spacing: -.01em;
}
.temp-unit { font-size: .6em; color: var(--c-mid); vertical-align: super; letter-spacing: 0; }

/* ── Tides ── */
.tides-cluster { display: flex; align-items: center; flex: 1; overflow: hidden; min-width: 0; }

.tides-label {
  font-family: var(--mono);
  font-size: .53rem;
  letter-spacing: .18em;
  color: var(--c-mid);
  text-transform: uppercase;
  padding: 0 14px;
  flex-shrink: 0;
  white-space: nowrap;
}

.tide-events {
  display: flex; align-items: center;
  overflow-x: auto; scrollbar-width: none; flex: 1;
}
.tide-events::-webkit-scrollbar { display: none; }

.tide-event {
  display: flex; align-items: center; gap: 7px; padding: 7px 10px;
  border-radius: 4px; flex-shrink: 0; cursor: default;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.tide-event:not(.tide-event--next):hover { background: rgba(255,255,255,.03); }
/* Next tide: lock appearance (no hover/active color changes on touch devices) */
.tide-event--next { transition: none; }
.tide-event--next:hover,
.tide-event--next:active,
.tide-event--next:focus,
.tide-event--next:focus-visible {
  background: rgba(255,255,255,.08);
  outline: 1px solid rgba(255,255,255,.18);
}

.tide-sep { width: 1px; height: 18px; background: var(--sep); flex-shrink: 0; }

.tide-arrow {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 20px; height: 20px;
}
.tide-arrow svg { display: block; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }

.tide-data { display: flex; flex-direction: column; gap: 3px; }

.tide-time {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--c-val);        /* ← same as temp values */
  line-height: 1;
  letter-spacing: .02em;
}
.tide-sub  { display: flex; align-items: center; gap: 5px; line-height: 1; }
.tide-height {
  font-family: var(--mono);
  font-size: .61rem;
  color: var(--c-mid);
}

.tide-coef {
  font-family: var(--mono); font-size: .57rem; font-weight: 500;
  padding: 1px 4px; border-radius: 3px; letter-spacing: .04em; line-height: 1.5;
}
.coef-high { background: var(--coef-high-bg); color: var(--coef-high-fg); }
.coef-mid  { background: var(--coef-mid-bg);  color: var(--coef-mid-fg); }
.coef-low  { background: var(--coef-low-bg);  color: var(--coef-low-fg); }
.coef-neap { background: var(--coef-neap-bg); color: var(--coef-neap-fg); }

/* ── Shimmer ── */
.temp-shimmer {
  display: inline-block; border-radius: 3px;
  background: rgba(255,255,255,.05); color: transparent;
  position: relative; overflow: hidden; vertical-align: middle;
}
.temp-shimmer::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent);
  animation: shimmer 1.8s ease-in-out infinite;
}
@keyframes shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(200%)} }

.tide-unavailable {
  font-family: var(--mono); font-size: .62rem;
  color: var(--c-mid); padding: 0 12px; letter-spacing: .1em;
}

/* ── Mobile — single compact row, "Mareas" hidden ── */
@media (max-width: 680px) {
  .info-strip { height: 46px; }

  .temp-item  { padding: 0 10px; gap: 5px; }
  /* Show temp icons on mobile too (compact) */
  .temp-icon  { display: flex; }
  .temp-icon svg { height: 14px; width: auto; }
  .temp-label { font-size: .5rem; letter-spacing: .12em; }
  .temp-value { font-size: .9rem; }

  .tides-label { display: none; }
  .tide-event  { padding: 5px 7px; gap: 5px; }
  .tide-arrow  { width: 16px; height: 16px; }
  .tide-time   { font-size: .7rem; }
  .tide-height { font-size: .57rem; }
  .tide-coef   { font-size: .52rem; padding: 1px 3px; }
  .tide-sep    { height: 14px; }
  .strip-div   { margin: 10px 0; }
}


/* ── Sun cluster (desktop only) ── */
.sun-cluster {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.sun-item {
  display: flex; align-items: center; gap: 7px;
  padding: 0 16px; position: relative;
}
.sun-item + .sun-item::before {
  content: ''; position: absolute; left: 0; top: 28%; height: 44%;
  width: 1px; background: var(--sep);
}
.sun-icon { display: flex; align-items: center; color: var(--c-mid); flex-shrink: 0; }

/* ── Tide states: past / next (upcoming) / future ── */

/* Past tide — clearly readable but obviously historical */
.tide-event--past {
  opacity: .52;
}
.tide-event--past .tide-time,
.tide-event--past .tide-height,
.tide-event--past .tide-coef {
  color: var(--c-mid);
}
.tide-event--past .tide-arrow svg polygon { opacity: .4; }

/* Next upcoming tide — unmistakable */
.tide-event--next {
  position: relative;
  background: rgba(255,255,255,.08);
  border-radius: 6px;
  outline: 1px solid rgba(255,255,255,.18);
  outline-offset: -1px;
  padding: 5px 13px 5px 8px;
}
.tide-event--next .tide-time {
  color: var(--c-val);
  font-weight: 500;
  letter-spacing: .04em;
}
.tide-event--next .tide-height {
  color: var(--c-hi);
}

/* Future tides — normal */
.tide-event--future { /* inherits base */ }

/* Tide progress bar — vertical accent between arrow and info */
.tide-progress {
  --tide-progress-height: 28px;
  width: 4px;
  height: var(--tide-progress-height);
  border-radius: 99px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  margin: -7px 4px;
  background: rgba(255,255,255,.08);
}
.tide-progress__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  overflow: hidden;
  will-change: height;
}
.tide-progress__gradient {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tide-progress-height);
  border-radius: inherit;
  background: linear-gradient(to top, #f87171, #38bdf8);
}

/* Hide sun cluster on mobile */
@media (max-width: 680px) {
  .sun-cluster { display: none; }
  .strip-div--sun { display: none; }
}

/* ═════════════════════════════════════════════════════════════════════════
   FOOTER
═════════════════════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--sep);
  padding: 40px 0 24px;
  font-family: var(--mono);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 48px;
}

.footer-about  { flex: 3; }
.footer-sources { flex: 1; }

.site-footer h6 {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c-val);         /* ← primary colour for headings */
  margin-bottom: 14px;
}

.site-footer p {
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.9;
  color: var(--c-hi);
  font-weight: 300;
}

.footer-sources ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.site-footer a {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--c-hi);
  text-decoration: none;
  letter-spacing: .02em;
  transition: color .15s;
}
.site-footer a:hover { color: var(--c-val); }

.site-footer hr {
  border: none;
  border-top: 1px solid var(--sep);
  margin: 28px 0 20px;
}

.copyright {
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--c-mid);
  letter-spacing: .1em;
  margin: 0;
}

@media (max-width: 680px) {
  .footer-inner   { flex-direction: column; gap: 32px; padding: 0 20px; }
  .site-footer    { padding: 32px 0 20px; text-align: center; }
  .footer-sources ul { align-items: center; }
}