@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0e1922;
  --panel: #152431;
  --panel-raised: #1b2c3a;
  --line: #253848;
  --line-soft: #1c2c39;
  --text: #e7edf2;
  --text-muted: #8299ab;
  --text-faint: #536878;
  --cyan: #4fd1c5;
  --amber: #e8a33d;
  --font-display: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.5;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(79, 209, 197, 0.05), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(232, 163, 61, 0.04), transparent 35%);
}

a { color: inherit; text-decoration: none; }

/* ---------- Isobar texture (signature element) ---------- */
.isobar-field {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.isobar-field::before {
  content: "";
  position: absolute;
  inset: -40% -10%;
  background-image: repeating-radial-gradient(
    circle at 22% 35%,
    transparent 0,
    transparent 26px,
    rgba(79, 209, 197, 0.055) 27px,
    transparent 28px
  );
  pointer-events: none;
}
.isobar-field::after {
  content: "";
  position: absolute;
  inset: -40% -10%;
  background-image: repeating-radial-gradient(
    circle at 80% 70%,
    transparent 0,
    transparent 34px,
    rgba(232, 163, 61, 0.045) 35px,
    transparent 36px
  );
  pointer-events: none;
}

/* ---------- Header ---------- */
.masthead {
  position: relative;
  padding: 2rem 2rem 2.25rem;
  z-index: 1;
}
.masthead-inner {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.ministry-header {
  max-width: 1100px;
  margin: 0 auto 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--line-soft);
}
.ministry-header .l1 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.35rem;
}
.ministry-header .l2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.ministry-header .l3 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}
.masthead h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
}
.masthead .sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 640px;
}

/* ---------- Main content ---------- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.25rem 2rem 5rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}

/* ---------- Run cards ---------- */
.run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.run-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.3rem;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
  position: relative;
}
.run-card:hover {
  border-color: var(--cyan);
  background: var(--panel-raised);
  transform: translateY(-1px);
}
.run-card .cycle-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--bg);
  background: var(--cyan);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  margin-bottom: 0.7rem;
}
.run-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.run-card .meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}
.run-card .file-count {
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .big {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ---------- Run detail ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--cyan); }

.run-header {
  margin-bottom: 2.2rem;
}
.run-header h1 {
  font-size: 1.6rem;
  margin: 0.3rem 0 0.2rem;
}
.run-header .meta {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.breadcrumbs {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 1.8rem;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--cyan); }
.breadcrumbs .sep { margin: 0 0.4rem; color: var(--text-faint); }
.breadcrumbs .current { color: var(--cyan); }

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}
.folder-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.folder-card:hover { border-color: var(--cyan); background: var(--panel-raised); }
.folder-icon { font-size: 1.2rem; opacity: 0.85; }
.folder-name {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
  word-break: break-word;
}
.folder-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.product-group { margin-bottom: 2.4rem; }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.thumb-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s ease;
  cursor: pointer;
}
.thumb-card:hover { border-color: var(--cyan); }
.thumb-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.thumb-card img {
  width: 100%;
  display: block;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: #0a1319;
}
.thumb-card .cap {
  padding: 0.65rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 13, 18, 0.96);
  display: flex;
  flex-direction: column;
}
.lightbox.hidden { display: none; }

.lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.lb-filename {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-actions { display: flex; gap: 0.6rem; }
.lb-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}
.lb-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.lb-btn.primary { background: var(--cyan); color: var(--bg); border-color: var(--cyan); font-weight: 600; }
.lb-btn.primary:hover { color: var(--bg); opacity: 0.9; }

.lightbox-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1.5rem;
  overflow: hidden;
}
.lightbox-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(21, 36, 49, 0.85);
  border: 1px solid var(--line);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-nav:hover { border-color: var(--cyan); color: var(--cyan); }
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }

.lb-counter {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  padding: 0.7rem 0 1rem;
}

.file-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
  transition: background 0.15s ease;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--panel-raised); }
.file-row .fname {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.file-row .fmeta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}
.file-row .dl {
  color: var(--cyan);
  border: 1px solid var(--line);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}
.file-row .dl:hover { border-color: var(--cyan); }

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 600px) {
  .masthead { padding: 2rem 1.2rem 1.6rem; }
  main { padding: 1.6rem 1.2rem 3rem; }
  .readout-cell { padding: 0.5rem 0.8rem; }
}
