/* MVP styling — intentionally minimal; layout refinement comes later. */
:root {
  --bg: #0f1113;
  --panel: #181b1f;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #4aa3df;
  --border: #2a2f35;
  --gap: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  padding: 20px 16px 8px;
  text-align: center;
}
.site-header h1 { margin: 0; font-size: 1.6rem; letter-spacing: 0.5px; }
.site-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.edit-status {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: #e5a44d;
}
.edit-status[hidden] { display: none; }

/* Day navigation */
.day-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  justify-content: safe center; /* centered, but scrollable from the start when overflowing */
}
.day-nav button {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  line-height: 1.25;
}
.day-nav button.active {
  border-color: var(--accent);
  color: var(--accent);
}
.day-nav button .dn-line { font-weight: 500; }
.day-nav button .dn-date { color: var(--muted); font-size: 0.72rem; }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }

.day-header { margin-bottom: 16px; }
.day-header h2 { margin: 0 0 6px; font-size: 1.3rem; }
.quip { color: var(--text); max-width: 70ch; }
.quip p { margin: 0 0 0.8em; }
.quip:empty { display: none; }

/* Sections within a day */
.day-section { margin-bottom: 28px; }
.section-header { margin: 0 0 10px; }
.section-header h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}
.section-header .quip { font-size: 0.95rem; }

/* Thumbnail grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--gap);
}
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
  border: none;
  padding: 0;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}
.thumb:hover img { transform: scale(1.05); }
.thumb.has-caption::after {
  content: "";
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.vid-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

/* Panoramas: span two columns to show their sweep, with an accent ring + badge. */
.thumb.pano {
  grid-column: span 2;
  aspect-ratio: 2 / 1; /* wide + short to show the sweep, not a square crop */
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.pano-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: #06121b;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  pointer-events: none;
}
.section-badge {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: #e5a44d;
  color: #06121b;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}
/* A section-start tile gets an accent left edge in the grid. */
.thumb.section-start { box-shadow: inset 4px 0 0 #e5a44d; }

/* Edit-mode: grid delete toggle + marked state */
.del-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.thumb:hover .del-toggle { opacity: 1; }
.thumb.marked .del-toggle { opacity: 1; background: #e5484d; }
.thumb.marked { outline: 3px solid #e5484d; outline-offset: -3px; }
.thumb.marked img { opacity: 0.4; }
.thumb.marked::before {
  content: "TO DELETE";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff6b6e;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 1px;
  z-index: 1;
  pointer-events: none;
}

.day-pager {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}
.pager-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}
.pager-btn:disabled { opacity: 0.35; cursor: default; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.lightbox[hidden] { display: none; }
.lb-figure {
  margin: 0;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lb-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 82vh;
}
.lb-media {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  background-size: cover;
  background-position: center;
}
img.lb-media.loading { filter: blur(8px); min-width: 200px; min-height: 150px; }
.lb-caption {
  color: var(--text);
  margin-top: 10px;
  text-align: center;
  max-width: 70ch;
  min-height: 1.2em;
}
.lb-fullres {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
  text-decoration: none;
}
.lb-fullres:hover { color: var(--accent); }
.lb-fullres[hidden] { display: none; }

/* Lightbox edit panel */
.lb-edit { margin-top: 10px; width: min(70ch, 92vw); }
.lb-edit[hidden] { display: none; }
.lb-note {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
  font-size: 0.9rem;
  resize: vertical;
}
.lb-edit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.lb-delete-btn,
.lb-section-btn {
  background: var(--panel);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.82rem;
}
.lb-delete-btn { color: #ff8a8c; border: 1px solid #5a2a2c; }
.lb-delete-btn.is-marked { background: #e5484d; color: #fff; border-color: #e5484d; }
.lb-section-btn { color: var(--accent); border: 1px solid #244; }
.lb-section-btn.is-marked { background: var(--accent); color: #06121b; border-color: var(--accent); }
.lb-saved { color: #4ad07a; font-size: 0.8rem; }
.lb-saved[hidden] { display: none; }
.lb-close, .lb-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 8px;
}
.lb-close {
  top: 14px;
  right: 16px;
  font-size: 1.8rem;
  line-height: 1;
  width: 44px;
  height: 44px;
}
.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.4rem;
  width: 54px;
  height: 72px;
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
