* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #071019;
  --panel: #0d1b2a;
  --ink: #e8f1f8;
  --dim: #7fa0b8;
  --accent: #3aa9e0;
  --high: #4fc3f7;
  --low: #f3a13a;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

#header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.2vh 3vw;
  background: var(--panel);
  border-bottom: 2px solid var(--accent);
}

#place {
  font-size: 3vh;
  font-weight: 600;
  letter-spacing: 0.05em;
}

#clock {
  text-align: right;
}

#time {
  font-size: 4vh;
  font-weight: 700;
  display: block;
  font-variant-numeric: tabular-nums;
}

#date {
  font-size: 2vh;
  color: var(--dim);
  display: block;
}

#slides {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.slide {
  position: absolute;
  inset: 0;
  padding: 2vh 3vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  display: flex;
  flex-direction: column;
}

.slide.active {
  opacity: 1;
  pointer-events: auto;
}

.slide h1 {
  font-size: 3vh;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 1.5vh;
}

.slide h1.subhead {
  font-size: 2.2vh;
  margin-top: 1vh;
  margin-bottom: 1vh;
}

/* --- Radar --- */
.radar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#radar-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* --- Tides --- */
#tide-chart-wrap {
  flex: 1;
  min-height: 0;
}

#tide-chart {
  width: 100%;
  height: 100%;
}

#tide-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5vw;
  padding-top: 1.5vh;
}

.tide-item {
  background: var(--panel);
  border-radius: 8px;
  padding: 1.2vh 1.5vw;
  font-size: 2.2vh;
  min-width: 15vw;
}

.tide-item .kind {
  font-weight: 700;
}

.tide-item.high .kind { color: var(--high); }
.tide-item.low .kind { color: var(--low); }

.tide-item .when {
  color: var(--dim);
  font-size: 1.8vh;
}

/* --- Forecast --- */
.card-row {
  flex: 1;
  display: flex;
  gap: 1.5vw;
  min-height: 0;
}

.fc-card {
  flex: 1;
  background: var(--panel);
  border-radius: 10px;
  padding: 2vh 1vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1vh;
  min-width: 0;
}

.fc-card .name {
  font-size: 2.2vh;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fc-card .temp {
  font-size: 5vh;
  font-weight: 700;
}

.fc-card .short {
  font-size: 2vh;
}

.fc-card .wind {
  font-size: 1.8vh;
  color: var(--dim);
}

/* Marine cards hold a full sentence rather than a single stat, so give
   them a smaller, left-aligned body instead of the big centered temp. */
.fc-card.marine {
  justify-content: flex-start;
}

.fc-card.marine .summary {
  font-size: 1.7vh;
  line-height: 1.4;
}

#dots {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1vw;
  height: 3vh;
}

.dot {
  box-sizing: content-box;
  width: 1.4vh;
  height: 1.4vh;
  border-radius: 50%;
  background: var(--dim);
  opacity: 0.5;
  cursor: pointer;
  padding: 1vh;
  background-clip: content-box;
}

.dot.active {
  background: var(--accent);
  opacity: 1;
  box-shadow: 0 0 1vh var(--accent);
}

.stale-warning {
  color: var(--low);
  font-size: 1.8vh;
  margin-top: 1vh;
}

/* Radar: on a narrow portrait phone OR a wide-but-short landscape one,
   zoom past 100% of width and crop the (centered) overflow, rather than
   just fitting to width -- the raw NWS image includes a lot of distant
   coverage area, so a plain 100% fit still renders the area right
   around Beaufort fairly small. Doesn't apply to the kiosk's wide
   desktop display, where the un-zoomed fit is correct -- zooming there
   would crop off real radar coverage that display has the room to show
   in full. */
@media (max-width: 700px), (max-height: 500px) {
  #slide-radar h1 {
    display: none;
  }

  .radar-wrap {
    overflow: hidden;
  }

  #radar-img {
    --radar-zoom: 1.4;
    width: calc(100% * var(--radar-zoom));
    height: auto;
    max-width: none;
    max-height: none;
  }
}

/* --- Mobile / narrow screens --- */
@media (max-width: 700px) {
  /* Four cards in a row is illegible on a phone-width screen -- show
     two full-width ones instead of squeezing all of them down. */
  .card-row {
    flex-wrap: wrap;
  }

  .card-row .fc-card {
    flex: 1 1 100%;
  }

  .card-row .fc-card:nth-child(n + 3) {
    display: none;
  }

  .fc-card .temp {
    font-size: 4vh;
  }

  .tide-item {
    min-width: 40vw;
  }
}
