/* ============================================
   PHOTO ARCHIVE — Stylesheet
   Dark editorial / monospace / archival aesthetic
   ============================================ */

:root {
  --bg: #0a0a0a;
  --bg-2: #111111;
  --bg-3: #1a1a1a;
  --border: #2a2a2a;
  --border-light: #333333;
  --text: #d8d8d8;
  --text-dim: #777777;
  --text-dimmer: #444444;
  --accent: #e8e8e8;
  --accent-2: #c0c0c0;
  --link: #aaaaaa;
  --link-hover: #ffffff;
  --tag-bg: #1e1e1e;
  --font-mono: 'Courier New', 'Lucida Console', monospace;
  --font-sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

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

html {
  font-size: 13px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   HEADER
   ============================================ */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: normal;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-decoration: none;
}
.site-title:hover { color: #ffffff; }

.header-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-decoration: none;
  padding: 3px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
  flex: 1;
  padding: 32px 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================
   ARCHIVE META
   ============================================ */

.archive-meta {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.archive-meta .meta-title {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.archive-meta .meta-stats {
  font-size: 11px;
  color: var(--text-dimmer);
  letter-spacing: 0.05em;
}

.archive-meta .meta-stats span {
  color: var(--text-dim);
}

/* ============================================
   VIEW CONTROLS
   ============================================ */

.view-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.mode-tabs, .sort-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sort-controls .label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dimmer);
  margin-right: 8px;
}

.mode-btn, .sort-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.mode-btn:hover, .sort-btn:hover {
  border-color: var(--border-light);
  color: var(--accent);
}
.mode-btn.active, .sort-btn.active {
  background: var(--bg-3);
  border-color: var(--border-light);
  color: var(--accent);
}

/* ============================================
   VIEW SECTIONS
   ============================================ */

.view-section { display: none; }
.view-section.active-view { display: block; }

/* ============================================
   GRID VIEW
   ============================================ */

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
}

.grid-item {
  background: var(--bg);
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
  filter: grayscale(15%);
}
.grid-item:hover img { opacity: 0.75; filter: grayscale(0%); }

.grid-item .grid-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 24px 12px 12px;
  opacity: 0;
  transition: opacity 0.2s;
}
.grid-item:hover .grid-item-overlay { opacity: 1; }

.grid-item .grid-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #ffffff;
  display: block;
}

.grid-item .grid-date {
  font-size: 9px;
  color: var(--accent-2);
  letter-spacing: 0.05em;
}

.grid-item-placeholder {
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.grid-item-placeholder:hover { background: var(--bg-3); }

.grid-placeholder-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.grid-placeholder-icon span {
  font-size: 18px;
  color: var(--text-dimmer);
}

.grid-item-placeholder .grid-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.grid-item-placeholder .grid-date {
  font-size: 9px;
  color: var(--text-dimmer);
  letter-spacing: 0.05em;
}

/* ============================================
   LIST VIEW
   ============================================ */

.issues-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.issues-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-dimmer);
  font-weight: normal;
  letter-spacing: 0.12em;
  font-size: 10px;
}

.issues-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.issues-table tr:hover td {
  background: var(--bg-2);
}

.issues-table .roll-link {
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.08em;
}
.issues-table .roll-link:hover { color: #fff; text-decoration: underline; }

.issues-table .frame-count {
  color: var(--text-dim);
}

.list-actions {
  display: flex;
  gap: 8px;
}

.action-link {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-dimmer);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 3px 8px;
  transition: all 0.15s;
}
.action-link:hover {
  border-color: var(--border-light);
  color: var(--accent);
}

/* ============================================
   ISSUE PAGE
   ============================================ */

.issue-main { }

.issue-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.issue-title {
  font-size: 20px;
  font-weight: normal;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
}

.issue-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.issue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 36px;
}

.issue-action-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 6px 14px;
  background: none;
  cursor: pointer;
  transition: all 0.15s;
}
.issue-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-2);
}

/* ============================================
   CONTACT SHEET
   ============================================ */

.section-label {
  font-size: 10px;
  font-weight: normal;
  letter-spacing: 0.15em;
  color: var(--text-dimmer);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.contact-sheet-section { margin-bottom: 48px; }

.contact-sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
}

.contact-frame {
  background: var(--bg-2);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.contact-frame img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  display: block;
  filter: grayscale(20%);
  transition: filter 0.2s, opacity 0.2s;
}
.contact-frame:hover img {
  filter: grayscale(0%);
  opacity: 0.85;
}

.contact-frame .frame-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.contact-frame-placeholder {
  background: var(--bg-3);
  aspect-ratio: 3/2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dimmer);
  font-size: 9px;
  letter-spacing: 0.05em;
}

/* ============================================
   IMAGE SEQUENCE
   ============================================ */

.sequence-section { margin-bottom: 48px; }

.sequence-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sequence-item {
  display: flex;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.sequence-num {
  min-width: 48px;
  padding: 16px 0;
  font-size: 10px;
  color: var(--text-dimmer);
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.sequence-img-wrap {
  flex: 0 0 auto;
  width: 280px;
  cursor: pointer;
  overflow: hidden;
  margin: 12px 0;
}

.sequence-img-wrap img {
  width: 100%;
  display: block;
  filter: grayscale(15%);
  transition: filter 0.2s, opacity 0.2s;
}
.sequence-img-wrap:hover img {
  filter: grayscale(0%);
  opacity: 0.88;
}

.sequence-img-placeholder {
  width: 280px;
  height: 188px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
  font-size: 9px;
  color: var(--text-dimmer);
  letter-spacing: 0.05em;
}

.sequence-meta {
  padding: 16px 20px;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.sequence-filename {
  color: var(--text-dimmer);
  margin-top: 4px;
  font-size: 9px;
  word-break: break-all;
}

/* ============================================
   ARCHIVE RECORD TABLE
   ============================================ */

.archive-record-section { margin-bottom: 48px; }

.record-table {
  border-collapse: collapse;
  font-size: 11px;
  min-width: 360px;
}

.record-table td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.record-table td:first-child {
  color: var(--text-dimmer);
  letter-spacing: 0.1em;
  font-size: 10px;
  min-width: 140px;
}

.record-table td:last-child {
  color: var(--text);
}

/* ============================================
   FRAME INDEX
   ============================================ */

.frame-index-section { margin-bottom: 48px; }

.frame-index-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.frame-index-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-dimmer);
  font-weight: normal;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.frame-index-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: top;
}

.frame-index-table td:first-child {
  color: var(--text-dimmer);
  width: 50px;
}

.frame-index-table a {
  color: var(--text-dim);
  text-decoration: none;
  word-break: break-all;
}
.frame-index-table a:hover { color: var(--accent); text-decoration: underline; }

/* ============================================
   ISSUE NAV
   ============================================ */

.issue-nav {
  display: flex;
  justify-content: space-between;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.issue-nav a {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.issue-nav a:hover {
  color: var(--accent);
  border-color: var(--border-light);
}

.issue-nav .nav-disabled {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dimmer);
  padding: 6px 14px;
  border: 1px solid transparent;
}

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-close {
  align-self: flex-end;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.lightbox-close:hover { color: var(--accent); border-color: var(--border-light); }

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}

.lightbox-caption {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-align: center;
}

.lightbox-controls {
  display: flex;
  gap: 12px;
}

.lb-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.lb-btn:hover { color: var(--accent); border-color: var(--border-light); }

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dimmer);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================
   UTILITIES
   ============================================ */

.text-dim { color: var(--text-dim); }
.text-dimmer { color: var(--text-dimmer); }

/* Loading state */
.loading-placeholder {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dimmer);
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  html { font-size: 12px; }

  .main-content { padding: 20px 16px; }

  .site-header { padding: 12px 16px; }

  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .contact-sheet-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .sequence-img-wrap,
  .sequence-img-placeholder {
    width: 160px;
  }
  .sequence-img-placeholder { height: 108px; }

  .issues-table th:nth-child(4),
  .issues-table td:nth-child(4) { display: none; }

  .view-controls { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
  }
  .contact-sheet-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .sequence-img-wrap,
  .sequence-img-placeholder { width: 120px; }
  .sequence-img-placeholder { height: 80px; }
}

/* ============================================
   LIGHTBOX — SIDEBAR LAYOUT (updated)
   ============================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: stretch;
  justify-content: center;
}
.lightbox.open { display: flex; }

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.95);
  cursor: pointer;
}

.lightbox-inner {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  height: 100%;
  max-height: 100vh;
}

/* Image panel — takes up remaining space */
.lightbox-img-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
  display: block;
}

/* Sidebar */
.lightbox-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #0d0d0d;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 20px 24px;
  overflow-y: auto;
  gap: 20px;
}

.lightbox-close {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.lightbox-close:hover { color: var(--accent); border-color: var(--border-light); }

.lb-counter {
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.06em;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.lb-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
}

.lb-meta-group {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.lb-meta-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-dimmer);
  margin-bottom: 4px;
}

.lb-meta-value {
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.lb-filename {
  font-size: 10px;
  color: var(--text-dim);
  word-break: break-all;
}

.lb-nav-btns {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
}

.lb-btn {
  flex: 1;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.lb-btn:hover { color: var(--accent); border-color: var(--border-light); }

/* Mobile lightbox — stack vertically */
@media (max-width: 768px) {
  .lightbox-inner { flex-direction: column; }
  .lightbox-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 220px;
  }
  .lightbox-img-panel { padding: 16px; flex: 1; min-height: 0; }
  .lb-meta { flex-direction: row; flex-wrap: wrap; gap: 0; }
  .lb-meta-group { min-width: 120px; padding: 6px 12px 6px 0; border-bottom: none; }
  .lb-counter { width: 100%; padding-bottom: 8px; font-size: 14px; }
  .lb-nav-btns { width: 100%; }
  .lightbox-close { width: 100%; text-align: center; }
}
