/* ==========================================================================
   ARCHIVE — Collection Drawer
   Shared right-side drawer (desktop) / full-screen overlay (mobile) used by
   all four disciplines. Tokens come from css/hero.css (:root).
   Block: .cd   (+ .cd-lightbox)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Root, backdrop and panel
   -------------------------------------------------------------------------- */
.cd {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 440ms;
}

.cd.is-open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.cd__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 19, 18, 0.44);
  opacity: 0;
  transition: opacity 440ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cd.is-open .cd__backdrop {
  opacity: 1;
}

.cd__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(60vw, 900px);
  min-width: 460px;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  border-left: 1px solid var(--color-border-subtle);
  box-shadow: -24px 0 60px rgba(20, 19, 18, 0.18);
  transform: translateX(100%);
  transition: transform 440ms cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.cd.is-open .cd__panel {
  transform: translateX(0);
}

/* --------------------------------------------------------------------------
   2. Top bar (wordmark · collection label · close)
   -------------------------------------------------------------------------- */
.cd__topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--color-border-subtle);
  background-color: var(--color-bg);
}

.cd__topbar-left {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  min-width: 0;
}

.cd__wordmark {
  font-family: var(--font-wordmark);
  font-size: 1.0625rem;
  font-weight: 300;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--color-text-main);
  white-space: nowrap;
}

.cd__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cd__close,
.cd-lightbox__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 2px;
  color: var(--color-text-main);
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.cd__close:hover {
  background-color: var(--color-text-main);
  border-color: var(--color-text-main);
  color: var(--color-accent-text);
}

.cd__close:focus-visible,
.cd-lightbox__close:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 2px;
}

/* Pointer users get no ring on controls we focus programmatically (drawer and
   lightbox open). Keyboard users keep it — see js/input-modality.js. */
html.is-pointer .cd__close:focus-visible,
html.is-pointer .cd-lightbox__close:focus-visible {
  outline: none;
}

.cd__close svg,
.cd-lightbox__close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* --------------------------------------------------------------------------
   3. Scroll region + inner column
   -------------------------------------------------------------------------- */
.cd__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.cd__inner {
  padding: var(--space-xl) clamp(20px, 4vw, 56px) var(--space-3xl);
}

/* --------------------------------------------------------------------------
   4. Featured image
   -------------------------------------------------------------------------- */
.cd__feature {
  margin: 0 0 var(--space-2xl);
}

.cd__feature-btn {
  display: block;
  width: 100%;
  padding: 0;
  color: inherit;
  border-radius: var(--radius-image);
}

.cd__feature-btn:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 4px;
  border-radius: var(--radius-image);
}

.cd__feature-img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: top center;
  background-color: var(--color-bg-subtle);
  border-radius: var(--radius-image);
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cd__feature-btn:hover .cd__feature-img {
  transform: scale(1.02);
}

.cd__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--color-text-dim);
}

.cd__caption-tag {
  color: var(--color-highlight);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.cd__caption .cd__caption-zoom {
  margin-left: auto;
  color: var(--color-text-dim);
  font-size: 0.8125rem;
}

.cd__placeholder {
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 2px;
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-dim);
}

/* --------------------------------------------------------------------------
   5. Introduction
   -------------------------------------------------------------------------- */
.cd__intro {
  margin-bottom: var(--space-2xl);
}

.cd__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  margin-bottom: var(--space-sm);
}

.cd__headline {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.03;
  letter-spacing: -0.03em;
  color: var(--color-text-main);
  text-wrap: balance;
  margin-bottom: var(--space-md);
}

.cd__lede {
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-muted);
  max-width: 60ch;
}

/* --------------------------------------------------------------------------
   6. Editorial block (heading + body)
   -------------------------------------------------------------------------- */
.cd__block {
  padding-top: var(--space-xl);
  margin-top: var(--space-xl);
  border-top: 1px solid var(--color-border-subtle);
}

.cd__block-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--color-text-main);
  margin-bottom: var(--space-sm);
}

.cd__block-text {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text-muted);
  max-width: 62ch;
}

/* Small development note (placeholder imagery disclosure) */
.cd__note {
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--color-text-dim);
}

/* --------------------------------------------------------------------------
   7. Explore the themes
   -------------------------------------------------------------------------- */
.cd__themes {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--space-xl);
  margin-top: var(--space-md);
}

.cd__theme {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  width: 100%;
  text-align: left;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-border-subtle);
  transition: transform var(--transition-smooth);
}

.cd__theme-body {
  display: block;
  min-width: 0;
}

.cd__theme-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text-main);
  margin-bottom: 2px;
  transition: color var(--transition-fast);
}

.cd__theme-desc {
  display: block;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.cd__theme-arrow {
  flex: 0 0 auto;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text-dim);
  transition: transform var(--transition-smooth), color var(--transition-fast);
}

.cd__theme:hover .cd__theme-title,
.cd__theme.is-active .cd__theme-title {
  color: var(--color-highlight);
}

.cd__theme:hover .cd__theme-arrow,
.cd__theme.is-active .cd__theme-arrow {
  color: var(--color-highlight);
  transform: translate(2px, -2px);
}

.cd__theme.is-active {
  border-top-color: var(--color-highlight);
}

.cd__theme:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Active-filter bar */
.cd__filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding: var(--space-xs) 0;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-dim);
}

.cd__filter[hidden] {
  display: none;
}

.cd__filter-clear {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--color-text-main);
  border-bottom: 1px solid var(--color-border-strong);
  padding-bottom: 2px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.cd__filter-clear:hover {
  color: var(--color-highlight);
  border-color: var(--color-highlight);
}

.cd__filter-clear:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   8. The Archive in Frames — gallery
   -------------------------------------------------------------------------- */
.cd__gallery {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  column-gap: var(--space-lg);
  row-gap: var(--space-xl);
  margin-top: var(--space-lg);
}

.cd__gallery > li[hidden] {
  display: none;
}

.cd__gallery > li:nth-child(even) {
  margin-top: 56px;
}

.cd__frame {
  display: block;
  width: 100%;
  text-align: left;
}

.cd__frame-img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top center;
  background-color: var(--color-bg-subtle);
  border-radius: var(--radius-image);
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cd__frame:hover .cd__frame-img {
  transform: scale(1.03);
}

.cd__frame:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 4px;
  border-radius: var(--radius-image);
}

.cd__frame-caption {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--color-text-main);
}

.cd__frame-caption .cd__frame-zoom {
  margin-left: auto;
  color: var(--color-text-dim);
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   9. Closing statement
   -------------------------------------------------------------------------- */
.cd__closing {
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border-strong);
}

.cd__closing-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
  text-wrap: balance;
  margin-bottom: var(--space-sm);
}

.cd__closing-text {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  max-width: 46ch;
  margin-bottom: var(--space-lg);
}

.cd__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-main);
  padding-bottom: 3px;
  border-bottom: 1px solid var(--color-border-strong);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.cd__cta .cd__cta-arrow {
  transition: transform var(--transition-smooth);
}

.cd__cta:hover {
  color: var(--color-highlight);
  border-color: var(--color-highlight);
}

.cd__cta:hover .cd__cta-arrow {
  transform: translate(2px, -2px);
}

.cd__cta:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   10. Screen-reader only live region
   -------------------------------------------------------------------------- */
.cd__sr {
  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;
}

/* --------------------------------------------------------------------------
   11. Lightbox
   -------------------------------------------------------------------------- */
.cd-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vw, 64px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 320ms;
}

.cd-lightbox.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

.cd-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 12, 11, 0.88);
}

.cd-lightbox__stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1100px;
  max-height: 100%;
}

.cd-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  background-color: #1a1917;
  border-radius: var(--radius-image);
}

.cd-lightbox__caption {
  margin-top: var(--space-sm);
  max-width: 62ch;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.82);
}

.cd-lightbox__close {
  position: absolute;
  top: clamp(16px, 4vw, 32px);
  right: clamp(16px, 4vw, 32px);
  z-index: 2;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

.cd-lightbox__close:hover {
  background-color: #ffffff;
  border-color: #ffffff;
  color: #141312;
}

.cd-lightbox__close:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   12. Scroll lock (compensated so the page does not shift)
   -------------------------------------------------------------------------- */
html.drawer-open {
  overflow: hidden;
  padding-right: var(--drawer-scrollbar-comp, 0);
}

/* --------------------------------------------------------------------------
   13. Responsive — full-screen drawer on small screens
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .cd__panel {
    width: 100%;
    min-width: 0;
    border-left: none;
    box-shadow: none;
  }

  .cd__topbar {
    padding: calc(var(--space-md) + env(safe-area-inset-top, 0px)) var(--space-lg) var(--space-md);
  }

  .cd__inner {
    padding: var(--space-lg) var(--space-lg)
             calc(var(--space-3xl) + env(safe-area-inset-bottom, 0px));
  }

  .cd__feature-img {
    aspect-ratio: 4 / 3;
  }

  .cd__themes {
    grid-template-columns: 1fr;
    column-gap: 0;
  }

  .cd__gallery {
    grid-template-columns: 1fr;
    row-gap: var(--space-lg);
  }

  .cd__gallery > li:nth-child(even) {
    margin-top: 0;
  }

  .cd__headline {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .cd__inner {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .cd__topbar {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .cd__headline {
    font-size: 1.75rem;
  }

  .cd__wordmark {
    font-size: 0.95rem;
  }

  .cd-lightbox__img {
    max-height: 70vh;
  }
}

/* --------------------------------------------------------------------------
   14. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cd,
  .cd__backdrop,
  .cd__panel,
  .cd-lightbox {
    transition: none;
  }

  .cd__panel {
    transform: none;
  }

  .cd__frame-img,
  .cd__feature-img,
  .cd__cta-arrow,
  .cd__theme-arrow,
  .cd__theme {
    transition: none;
  }

  .cd__frame:hover .cd__frame-img,
  .cd__feature-btn:hover .cd__feature-img {
    transform: none;
  }
}
