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

:root {
  --bg:       #ebe7dc;
  --ink:      #0d0b08;
  --dim:      #7a7570;
  --faint:    #b8b3ab;
  --rule:     rgba(13, 11, 8, 0.1);
  --rule-md:  rgba(13, 11, 8, 0.16);
  --mono:     'DM Mono', ui-monospace, monospace;
  --serif:    'Cormorant Garamond', Georgia, serif;
  --ease:     cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html { font-size: 16px; }

body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--bg); }

a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; color: inherit; font-family: inherit; }
ul { list-style: none; }


/* ══════════════════════════════════
   HEADER
   ══════════════════════════════════ */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0.9rem 1.75rem;
  border-bottom: 1px solid var(--rule-md);
}

/* Logo */
.logo {
  display: inline-flex;
  gap: 0;
  cursor: crosshair;
  user-select: none;
}

.logo-l {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: inline-block;
  transition: font-weight 0.1s ease, font-style 0.1s ease;
  line-height: 1;
}

/* Center meta */
.header-center {
  text-align: center;
}

.header-tag {
  font-family: var(--mono);
  font-size: 0.42rem;
  letter-spacing: 0.18em;
  color: var(--faint);
  text-transform: uppercase;
}

/* Contact link */
.contact-link {
  color: var(--faint);
  text-decoration: none;
  transition: color 0.15s;
  margin-left: auto;
}

.contact-link:hover { color: var(--ink); }

/* Filters */
.filter-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.filter {
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.filter:hover { color: var(--dim); }

.filter.active {
  color: var(--ink);
}

.fsep {
  font-size: 0.5rem;
  color: var(--faint);
  opacity: 0.5;
}


/* ══════════════════════════════════
   FULL-WIDTH TITLE LIST
   ══════════════════════════════════ */

.title-list {
  width: 100%;
}

/* Each row */
.title-row {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr 100px;
  align-items: center;
  padding: 0 1.75rem;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  overflow: hidden;
  transition: background 0.25s ease;
}

.title-row.filtered-out {
  opacity: 0.1;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.title-row.filtered-in {
  opacity: 1;
  transition: opacity 0.35s ease;
}

/* Background image on hover */
.title-row-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.title-row-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-row:hover .title-row-bg {
  opacity: 0.1;
}

/* Left meta: year */
.tr-year {
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: var(--faint);
  z-index: 1;
  transition: color 0.2s ease;
}

.title-row:hover .tr-year {
  color: var(--dim);
}

/* The actual title — scaled by JS to fill center column */
.tr-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  line-height: 1;
  padding: 0.55rem 0;
  z-index: 1;
  transition: opacity 0.2s ease;
  will-change: font-size;
}

/* Right meta: category */
.tr-cat {
  font-family: var(--mono);
  font-size: 0.45rem;
  letter-spacing: 0.12em;
  color: var(--faint);
  text-align: right;
  text-transform: uppercase;
  z-index: 1;
  transition: color 0.2s ease;
}

.title-row:hover .tr-cat {
  color: var(--dim);
}

/* ── Type styles per project — historical printing press & newspaper typefaces ── */

/* Garamond, 1530 — the text face of Renaissance book printing */
.tf-garamond {
  font-family: 'EB Garamond', serif;
  font-weight: 400;
  font-style: italic;
}

/* EB Garamond heavy — display headline cut */
.tf-garamond-bold {
  font-family: 'EB Garamond', serif;
  font-weight: 800;
  font-style: normal;
}

/* Baskerville, 1757 — transitional serif, set the standard for fine printing */
.tf-baskerville {
  font-family: 'Libre Baskerville', serif;
  font-weight: 400;
  font-style: italic;
}

/* Baskerville bold — subhead cut */
.tf-baskerville-bold {
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  font-style: normal;
}

/* Bodoni, 1798 — 19th century newspaper headline serif */
.tf-bodoni {
  font-family: 'Bodoni Moda', serif;
  font-weight: 400;
  font-style: italic;
}

/* Bodoni heavy — front-page display */
.tf-bodoni-heavy {
  font-family: 'Bodoni Moda', serif;
  font-weight: 900;
  font-style: normal;
}

/* Playfair Display — Victorian editorial headline */
.tf-playfair {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-style: italic;
}

/* Franklin Gothic, 1902 — the American newspaper headline grotesque */
.tf-franklin {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 900;
  letter-spacing: -0.02em;
}

/* Franklin Gothic light — ultra-thin grotesque cut */
.tf-franklin-light {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 100;
  letter-spacing: 0.01em;
}

/* News Cycle — designed specifically as a newspaper typeface */
.tf-news-cycle {
  font-family: 'News Cycle', sans-serif;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Oswald — condensed grotesque, newspaper column headline */
.tf-oswald {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Courier Prime — the press typewriter, IBM Courier 1955 */
.tf-courier {
  font-family: 'Courier Prime', monospace;
  font-weight: 400;
}

/* ══════════════════════════════════
   FLOATING IMAGE PREVIEW
   ══════════════════════════════════ */

.img-float {
  position: fixed;
  width: auto;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease;
  border: 1px solid var(--rule-md);
}

.img-float.on { opacity: 1; }

.img-float img {
  width: 100%;
  height: auto;
  display: block;
}

/* ══════════════════════════════════
   COLOPHON
   ══════════════════════════════════ */

.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  padding: 1.1rem 1.75rem;
  border-top: 1px solid var(--rule);
}

.col-text {
  font-family: var(--mono);
  font-size: 0.42rem;
  letter-spacing: 0.18em;
  color: var(--faint);
  text-transform: uppercase;
}

.col-orn {
  font-size: 0.3rem;
  color: var(--faint);
  opacity: 0.45;
}

/* ══════════════════════════════════
   PROJECT OVERLAY
   ══════════════════════════════════ */

.project-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(13, 11, 8, 0);
  pointer-events: none;
  transition: background 0.4s var(--ease);
}

.project-overlay.open {
  background: rgba(13, 11, 8, 0.5);
  pointer-events: all;
}

.ov-panel {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  clip-path: inset(50% 0 50% 0);
  /* transition set by JS to sync with row origin */
}

.project-overlay.open .ov-panel {
  clip-path: inset(0% 0% 0% 0%);
}

/* Keep real content above the ghost */
.ov-header,
.ov-body,
.ov-caption { position: relative; z-index: 1; }

/* Overlay header */
.ov-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 1.75rem;
  border-bottom: 1px solid var(--rule-md);
  flex-shrink: 0;
}

.ov-header-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.ov-year,
.ov-sep,
.ov-cat {
  font-family: var(--mono);
  font-size: 0.45rem;
  letter-spacing: 0.12em;
  color: var(--faint);
  text-transform: uppercase;
}

.ov-title {
  font-size: clamp(1rem, 2.5vw, 2rem);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ov-close {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--dim);
  line-height: 1;
  padding: 0.2rem 0.4rem;
  transition: color 0.15s;
  flex-shrink: 0;
}

.ov-close:hover { color: var(--ink); }

/* Overlay caption (mobile only — desktop shows meta in header) */
.ov-caption {
  display: none;
  flex-shrink: 0;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--rule-md);
  gap: 0.4rem;
  align-items: center;
}

.ov-cap-year,
.ov-cap-sep,
.ov-cap-cat {
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-transform: uppercase;
}

/* Ink bleed-through ghost — mirror of main list at low opacity */
.ov-ghost {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.055;
  transform: scaleX(-1);
  z-index: 0;
}

/* The cloned ul sits at the top, same as the real page */
.ov-ghost .title-list {
  margin: 0;
  padding: 0;
}

.ov-ghost .title-row-bg { display: none; }

/* Overlay body */
.ov-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.75rem;
}

/* Video embed (iframes only — mux uses .ov-mux-wrap) */
.ov-video {
  width: 100%;
  max-width: 960px;
  max-height: calc(100% - 4rem);
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
}

.ov-video iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Mux player — no built-in controls, custom ones below */
mux-player {
  --controls: none;
  --media-object-fit: contain;
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
}

mux-player::part(gesture-layer) { display: none; }

/* Custom controls */
.ov-mux-wrap {
  width: 100%;
  max-width: 960px;
  flex-shrink: 0;
}

.ov-controls {
  padding: 0.6rem 0 0;
  border-top: 1px solid var(--rule-md);
}

.ov-progress {
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 0.4rem;
}

.ov-progress-track {
  width: 100%;
  height: 2px;
  background: rgba(26, 23, 20, 0.1);
  position: relative;
}

.ov-progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(26, 23, 20, 0.4);
  transition: width 0.1s linear;
}

.ov-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ov-control-left {
  display: flex;
  gap: 1rem;
}

.ov-control-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ov-ctrl-btn {
  font-family: var(--mono);
  font-size: 0.45rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  transition: color 0.15s;
}

.ov-ctrl-btn:hover { color: var(--ink); }

.ov-ctrl-time {
  font-family: var(--mono);
  font-size: 0.45rem;
  letter-spacing: 0.1em;
  color: var(--faint);
  tabular-nums: all;
}

/* Photo gallery — allow scrolling from top */
.ov-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 0.75rem;
  width: 100%;
  max-width: 960px;
  align-self: flex-start;
}

.ov-gallery img {
  width: calc(50% - 0.375rem);
  max-width: 480px;
  height: auto;
  display: block;
  object-fit: cover;
}

/* Single fallback image — centered, constrained to viewport */
.ov-single {
  max-width: 800px;
  max-height: calc(100% - 4rem);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ov-single img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 10rem);
  object-fit: contain;
  display: block;
}

/* Empty state */
.ov-empty {
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-transform: uppercase;
}

/* ══════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════ */

@media (max-width: 700px) {
  .header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
  }

  .header-center { display: none; }

  .intro-strip { padding: 2rem 1.25rem; }

  .title-row {
    grid-template-columns: auto 1fr;
    padding: 0 1.25rem;
  }

  .tr-cat { display: none; }
  .tr-year { min-width: 0; }

  .img-float { display: none; }

  .colophon { flex-direction: column; flex-wrap: nowrap; padding: 1rem 1.25rem; align-items: center; gap: 0.5rem; }
  .col-fontlist { display: none; }
  .contact-link { margin-left: 0; }

  .ov-panel { inset: 0; }
  .ov-header { grid-template-columns: 1fr auto; gap: 0.75rem; padding: 0.75rem 1.25rem; }
  .ov-header-meta { display: none; }
  .ov-body { padding: 1.25rem; align-items: flex-start; }
  .ov-caption { display: flex; }
  .ov-gallery { columns: 1; }
}
