/* ── Fonts ─────────────────────────────────────────────────────────
   Transducer (Wortmeister) – place woff2 files in /fonts/ (repo root)
   Barlow used as fallback.
──────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Transducer';
  src: url('../fonts/Transducer-Light.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Transducer';
  src: url('../fonts/Transducer-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ── Reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font:      'Transducer', 'Barlow', sans-serif;
  --fw-light:  300;
  --fw-bold:   700;
  --black:     #000;
  --white:     #fff;
  --sidebar-w: 33.333vw;
  --mobile-bar-h: 56px;
}

html { height: 100%; }

body {
  font-family: var(--font);
  font-weight: var(--fw-light);
  background: var(--white);
  color: var(--black);
  font-size: 13px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; padding: 0; }
[hidden] { display: none !important; }

/* ── Mobile top bar (desktop: hidden) ────────────────────────────── */
.mobile-bar { display: none; }

/* ── Password gate (soft) ────────────────────────────────────────── */
.gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate[hidden] { display: none !important; }
.gate-box {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.gate-logo { width: 100%; max-width: 360px; height: auto; display: block; }
.gate-form { display: flex; gap: 8px; width: 100%; max-width: 320px; }
.gate-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--black);
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  background: transparent;
}
.gate-btn {
  border: 1px solid var(--black);
  background: var(--black);
  color: var(--white);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
}
.gate-btn:hover { opacity: 0.8; }
.gate-error { font-size: 12px; color: #c0392b; }

/* ── Sidebar overlay (mobile only) ───────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ── Layout ───────────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 28px 20px;
  overflow-y: auto;
  border-right: 1px solid var(--black);
  background: var(--white);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.logo-link { display: block; }
.logo {
  width: 100%;
  max-width: 330px;
  height: auto;
  margin-left: -4px;
}
/* Pull the logo up to the top edge (cancel the sidebar's top padding) while
   keeping its original size. */
.desktop-logo-link { margin-top: -28px; }
.logo-fallback { display: none; }

/* Menu */
.menu { display: flex; flex-direction: column; gap: 0; }

.menu-item {
  font-family: 'Ubuntu', 'Barlow', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 2;
  opacity: 0.35;
  transition: opacity 0.15s;
  display: block;
}
.menu-item:hover { opacity: 0.75; }
.menu-item.active {
  opacity: 1;
  font-weight: 700;
  font-size: 19px;
  line-height: 1.6;
}

/* ── Category filter ──────────────────────────────────────────────── */
.cat-section {
  border-top: 1px solid var(--black);
  padding-top: 14px;
}
.cat-list { display: flex; flex-direction: column; }
.cat-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--black);
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  transition: opacity 0.15s;
  text-transform: capitalize;
}
.cat-item:hover { opacity: 0.6; }
.cat-item.selected { font-weight: var(--fw-bold); }

/* ── Tab intro description ────────────────────────────────────────── */
.tab-desc {
  border-top: 1px solid var(--black);
  padding-top: 14px;
}
.tab-desc-text {
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-line;   /* respects the blank lines between paragraphs */
  opacity: 0.8;
}

/* ── Work info ────────────────────────────────────────────────────── */
.work-info {
  border-top: 1px solid var(--black);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.info-row         { font-size: 12px; line-height: 1.6; }
.info-title       { font-weight: var(--fw-bold); font-size: 13px; }
.info-subtitle    { opacity: 0.7; font-size: 11.5px; line-height: 1.5; margin-top: 2px; }
.info-category    { opacity: 0.6; text-transform: capitalize; }
.work-open {
  margin-top: 8px;
  font-size: 12px;
  color: #1a56cc;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.work-open:hover { color: #0d3a99; }
.info-pos { opacity: 0.5; font-size: 11px; margin-top: 6px; }

/* Sidebar footer */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 20px;
}
.copyright {
  font-size: 10px;
  opacity: 0.45;
  letter-spacing: 0.03em;
}

/* ── Content area ─────────────────────────────────────────────────── */
.content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ── Grid wrap (scrollable column) ───────────────────────────────── */
.grid-wrap {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
.tab-panel.detail-active .grid-wrap {
  flex: 0 0 50%;
  width: 50%;
}

/* ── Masonry grid (CSS columns) ──────────────────────────────────── */
.masonry-grid {
  column-count: 3;
  column-gap: 0;
  width: 100%;
}
.tab-panel.detail-active .masonry-grid { column-count: 2; }

.gallery-item {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  display: block;
  width: 100%;
  cursor: pointer;
  overflow: hidden;
  background: #ebebeb;
  position: relative;
}
.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  transition: opacity 0.18s;
}
.gallery-item:hover img    { opacity: 0.82; }
.gallery-item.selected img { opacity: 0.35; }

/* small caption strip on hover */
.gallery-item .item-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.gallery-item:hover .item-cap { opacity: 1; }

/* Badge marking tiles that open in a new tab (PDF works) */
.pdf-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 6px;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.gallery-item:hover .pdf-badge { opacity: 1; }

/* ── Detail panel ─────────────────────────────────────────────────── */
.detail-panel {
  flex: 0 0 50%;
  width: 50%;
  height: 100%;
  overflow: hidden;
  border-left: 1px solid var(--black);
  position: relative;
  display: flex;
  flex-direction: column;
  background: #000;
}
.detail-panel .close-btn { color: #fff; }

.detail-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* image works: scrollable, centered */
.detail-body.is-image {
  overflow-y: auto;
  align-items: center;
  padding: 44px 20px;
}
.detail-body.is-image .detail-img {
  width: 100%;
  height: auto;
  display: block;
}

/* pdf works: iframe fills the panel (native viewer scrolls internally) */
.detail-body.is-pdf { padding: 0; }
.detail-pdf {
  flex: 1;
  width: 100%;
  border: none;
  background: #333;
}

/* Detail navigation — always at the bottom of the panel (like HaGL events) */
.detail-nav {
  flex-shrink: 0;
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 14px 0;
  background: #000;
  width: 100%;
}
.nav-btn {
  font-size: 20px;
  color: #fff;
  opacity: 0.5;
  padding: 4px 16px;
  border: 1px solid transparent;
  transition: opacity 0.15s, border-color 0.15s;
}
.nav-btn:not(:disabled):hover { opacity: 1; border-color: #fff; }
.nav-btn:disabled { cursor: default; opacity: 0.18; }

/* Close button */
.close-btn {
  position: absolute;
  top: 8px;
  right: 14px;
  font-size: 26px;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.15s;
  z-index: 3;
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
}
.close-btn:hover { opacity: 1; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ RESPONSIVE ━━━━━━━━━━━━━━━━━ */

/* ── Tablet (< 1100px) ────────────────────────────────────────────── */
@media (max-width: 1099px) {
  :root { --sidebar-w: 260px; }
  .masonry-grid { column-count: 2; }
  .tab-panel.detail-active .masonry-grid { column-count: 1; }
  .sidebar { padding: 22px 20px 16px; }
  .logo { max-width: 180px; }
  .desktop-logo-link { margin-top: -22px; }
}

/* ── Mobile (< 700px) ─────────────────────────────────────────────── */
@media (max-width: 699px) {
  body { overflow: hidden; }

  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--mobile-bar-h);
    padding: 0 16px;
    border-bottom: 1px solid var(--black);
    background: var(--white);
    z-index: 100;
  }
  .mobile-logo { max-width: 140px; }
  .mobile-logo-link .logo-fallback {
    display: inline;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 700;
    font-size: 15px;
  }
  /* if the real logo image loads, hide the text fallback */
  .mobile-logo-link .mobile-logo:not([style*="display: none"]) + .logo-fallback { display: none; }

  .hamburger { display: flex; flex-direction: column; gap: 5px; padding: 6px; }
  .hamburger span {
    display: block; width: 22px; height: 1.5px; background: var(--black);
    transition: transform 0.2s, opacity 0.2s;
  }
  .hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .layout { flex-direction: column; padding-top: var(--mobile-bar-h); height: 100dvh; }

  .sidebar {
    position: fixed;
    top: var(--mobile-bar-h);
    left: 0; bottom: 0;
    width: min(80vw, 300px);
    height: auto;
    flex: none;
    border-right: 1px solid var(--black);
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .desktop-logo-link { display: none; }

  .content { flex: 1; height: auto; overflow: hidden; }

  .tab-panel.detail-active .grid-wrap { display: none; }
  .tab-panel.detail-active .detail-panel {
    flex: 1; width: 100%; border-left: none;
  }

  .masonry-grid { column-count: 2; }
  .tab-panel.detail-active .masonry-grid { column-count: 2; }
  .gallery-item .item-cap { opacity: 1; } /* always show caption on touch */
}

/* ── Very small phones (< 400px) ──────────────────────────────────── */
@media (max-width: 399px) {
  .masonry-grid { column-count: 1; }
}
