:root {
  --paper:      #e7eeed;   /* fog over the Sound */
  --paper-2:    #d5e0df;   /* deeper mist */
  --card:       #f6faf9;   /* pale glacial white */
  --ink:        #1b2b2c;   /* deep spruce-slate */
  --ink-soft:   #5b6e6d;   /* weathered driftwood grey */
  --line:       #c7d4d2;   /* shoreline grey */
  --accent:     #2f5d63;   /* deep Sound water (teal-blue) */
  --accent-2:   #6a9a95;   /* glacial seafoam */
  --matte:      #15211f;   /* deep water / wet slate */

  --ok:    #4f7d5e;   /* spruce green */
  --low:   #b0883a;   /* lichen ochre */
  --crit:  #a8513f;   /* weathered rust */

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,40,42,.07), 0 8px 24px rgba(20,40,42,.08);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

/* No image ever overflows its container */
img { max-width: 100%; height: auto; }

/* Visually hidden but available to screen readers and search engines */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: radial-gradient(120% 80% at 50% -10%, var(--paper-2) 0%, var(--paper) 55%) fixed;
  min-height: 100vh;
  padding: clamp(1rem, 3vw, 2.5rem);
}

/* ---- Layout ---- */
main { max-width: 1180px; margin: 0 auto; }

.camera-grid {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

.status {
  text-align: center;
  color: var(--ink-soft);
  padding: 2rem 0;
  font-size: .9rem;
}
.status.error { color: var(--crit); }

/* ---- Camera card ---- */
.camera {
  width: 100%;
  min-width: 0;               /* let the card shrink below the image's natural width */
  max-width: 1128px;          /* 1080px image + card padding */
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 2vw, 1.4rem);
}
.camera-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 .9rem;
}

/* ---- Main image ---- */
.viewer { margin: 0; }
.main-img {
  display: block;
  width: 100%;
  max-width: 1080px;
  height: auto;
  margin-inline: auto;
  background: var(--matte);
  border: 2px solid var(--accent);
  border-radius: 8px;
}
.main-caption {
  margin: .5rem 0 0;
  font-size: .78rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---- Filmstrip ---- */
.filmstrip {
  display: flex;
  gap: .4rem;
  margin-top: .8rem;
}
.thumbs {
  list-style: none;
  margin: 0;
  padding: 2px;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.thumbs::-webkit-scrollbar { height: 6px; }
.thumbs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.thumb-btn {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 84px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--matte);
  cursor: pointer;
  overflow: hidden;
  opacity: .6;
  transition: border-color .15s ease, transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-btn:hover { transform: translateY(-1px); opacity: .9; }
.thumb-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; opacity: 1; }
.thumb-btn[aria-current="true"] {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(47, 93, 99, .35);
}

.arrow {
  flex: 0 0 auto;
  width: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: .7rem;
  cursor: pointer;
  transition: background .15s ease;
}
.arrow:hover { background: var(--paper-2); }
.arrow:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---- Meta (last sync + battery) ---- */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 2rem;
  margin: .9rem 0 0;
  padding-top: .75rem;
  border-top: 1px dashed var(--line);
}
.meta div { display: flex; flex-direction: column; gap: .1rem; }
.meta dt {
  font-size: .65rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.meta dd {
  margin: 0;
  font-size: .82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.meta-batt { margin-left: auto; align-items: flex-end; }
.meta-batt dd { display: flex; align-items: center; }

/* ---- Battery gauge ---- */
.battery {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .85rem;
  font-weight: 500;
}
.battery-cell {
  position: relative;
  width: 30px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  padding: 1.5px;
}
.battery-cell::after {            /* the little nub */
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5px;
  height: 6px;
  background: currentColor;
  border-radius: 0 2px 2px 0;
}
.battery-fill {
  display: block;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transition: width .3s ease;
}
.battery.is-ok   { color: var(--ok); }
.battery.is-low  { color: var(--low); }
.battery.is-crit { color: var(--crit); }

/* ---- Footer ---- */
.site-footer {
  max-width: 1180px;
  margin: clamp(1.5rem, 4vw, 3rem) auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.site-desc {
  max-width: 64ch;
  margin: 0 auto .9rem;
  font-size: .95rem;
  line-height: 1.6;
  color: var(--ink);
}
.support-note {
  max-width: 56ch;
  margin: 0 auto;
  font-size: .92rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
/* "Updated" line — intentionally small, quiet fine-print */
#page-updated {
  margin-top: 1rem;
  font-size: .68rem;
  letter-spacing: .02em;
  opacity: .6;
}
.bmc-button {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .9rem;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease, filter .15s ease;
}
.bmc-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.bmc-button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---- Touch behavior ---- */
.arrow, .thumb-btn, .bmc-button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---- Phones (and small windows) ---- */
@media (max-width: 600px) {
  body {
    padding: .65rem;
    overflow-x: hidden;        /* guard against accidental sideways scroll */
  }

  .camera {
    padding: .85rem;
    border-radius: 8px;
  }
  .camera-name {
    font-size: 1.2rem;
    margin-bottom: .6rem;
  }

  .filmstrip { gap: .3rem; }
  .arrow { width: 44px; }                 /* comfortable tap target */
  .thumb-btn { width: 76px; height: 50px; }

  .main-caption { font-size: .74rem; }

  .meta { gap: .3rem 1rem; padding-top: .6rem; }
  .meta dt { font-size: .68rem; }
  .meta dd { font-size: .82rem; }

  .site-footer { margin-top: 2rem; }
  .site-desc { font-size: .9rem; }
  .support-note { font-size: .88rem; }
}
