:root {
  --bg: #efe5d3;
  --paper: #f9f5ec;
  --ink: #262320;
  --muted: #55504a;
  --line: #262320;
  --accent: #a12a1f;
  --link: #0f4f74;
  --link-soft: #e6f1f8;
  --link-border: #2f6788;
  --link-hover: #d6e9f6;
  --shadow: 0 16px 36px rgba(38, 35, 32, 0.17);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.4), transparent 42%),
    radial-gradient(circle at 86% 8%, #f4d7a2 0%, transparent 25%),
    var(--bg);
}

.shell {
  width: min(1260px, 95vw);
  margin: 2rem auto;
  display: grid;
  gap: 0.9rem;
}

.top {
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  background: var(--paper);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.45rem;
}

h1,
h2 {
  margin: 0;
  font-family: "Vollkorn", serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(1.8rem, 3.6vw, 2.8rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.note {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.project-list {
  display: grid;
  gap: 1rem;
}

.dossier {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 0.85rem;
  align-items: start;
}

.paper {
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 0.85rem;
  position: relative;
  height: fit-content;
}

.image-paper {
  display: grid;
  gap: 0.7rem;
}

.media-shell {
  display: grid;
  gap: 0.55rem;
}

.media-viewport {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(140deg, #f4e6d1, #efe2d0),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.34),
      rgba(255, 255, 255, 0.34) 10px,
      rgba(0, 0, 0, 0.02) 10px,
      rgba(0, 0, 0, 0.02) 20px
    );
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
  transition: aspect-ratio 250ms ease, max-width 250ms ease;
  cursor: zoom-in;
}

.media-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.media-viewport.is-square {
  aspect-ratio: 1 / 1;
  max-width: min(540px, 100%);
  margin-inline: auto;
}

.media-viewport.is-portrait {
  aspect-ratio: 10 / 16;
  max-width: min(430px, 100%);
  margin-inline: auto;
}

.media-viewport.is-ultrawide {
  aspect-ratio: 21 / 9;
}

.media-viewport.has-error::after {
  content: attr(data-error-message);
  position: absolute;
  inset: auto 14px 14px 14px;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  background: rgba(30, 13, 16, 0.78);
  color: #fff7f6;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.46rem 0.58rem;
  pointer-events: none;
}

.media-viewport img,
.media-viewport video,
.media-viewport iframe.slide-pdf {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 220ms ease;
}

.media-viewport img,
.media-viewport video {
  object-fit: contain;
}

.media-viewport iframe.slide-pdf {
  border: 0;
  background: #ffffff;
  pointer-events: none;
}

.media-viewport img.is-ready.is-active,
.media-viewport video.is-ready.is-active,
.media-viewport iframe.slide-pdf.is-ready.is-active {
  opacity: 1;
}

.media-viewport iframe.slide-pdf.is-active {
  pointer-events: auto;
}

.media-viewport.is-video {
  background: #111826;
}

.media-viewport.is-pdf {
  background: #f7f7f7;
  cursor: default;
}

.media-viewport video {
  background: #0b1320;
}

.expand-media-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(17, 24, 38, 0.68);
  color: #f6fbff;
  font: inherit;
  font-size: 0.69rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.24rem 0.58rem;
  cursor: pointer;
  z-index: 4;
  backdrop-filter: blur(2px);
}

.expand-media-btn:hover {
  background: rgba(17, 24, 38, 0.82);
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}

.lightbox.is-open {
  display: block;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(7, 11, 16, 0.82);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  margin: min(3vh, 26px) auto;
  width: min(1220px, 96vw);
  height: min(94vh, 920px);
  border: 1px solid rgba(225, 236, 247, 0.28);
  border-radius: 14px;
  background: #101722;
  color: #ecf4fb;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.lightbox-topbar,
.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.65rem 0.72rem;
  background: rgba(16, 23, 34, 0.95);
  border-bottom: 1px solid rgba(221, 235, 249, 0.2);
}

.lightbox-toolbar {
  border-top: 1px solid rgba(221, 235, 249, 0.2);
  border-bottom: 0;
  flex-wrap: wrap;
}

.lightbox-caption {
  margin: 0;
  color: #cfdeea;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-stage {
  position: relative;
  background: #070f18;
  min-height: 240px;
  overflow: hidden;
}

.lightbox-image,
.lightbox-video,
.lightbox-pdf {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.lightbox-image,
.lightbox-video {
  object-fit: contain;
}

.lightbox-pdf {
  border: 0;
  background: #ffffff;
}

.lightbox-image {
  transition: transform 180ms ease;
  transform-origin: center center;
}

.lightbox-image.is-active,
.lightbox-video.is-active,
.lightbox-pdf.is-active {
  display: block;
}

.lightbox.is-pdf .lightbox-stage {
  background: #f7fbff;
}

.lightbox-group {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
}

.lightbox-btn {
  border: 1px solid rgba(229, 239, 247, 0.36);
  border-radius: 999px;
  background: #16283a;
  color: #f1f8ff;
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  padding: 0.4rem 0.7rem;
  min-height: 2.2rem;
  cursor: pointer;
}

.lightbox-btn:hover {
  background: #1f3347;
}

.lightbox-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lightbox-zoom-group[hidden] {
  display: none;
}

.image-empty {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  background: #ede3d0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  padding: 1rem;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.counter {
  font-size: 0.73rem;
  color: var(--muted);
}

.nav-buttons {
  display: inline-flex;
  gap: 0.4rem;
}

.controls button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.thumb-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.36rem;
}

.thumb-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
}

.thumb-btn.active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.thumb-btn img {
  width: 100%;
  height: 50px;
  object-fit: cover;
  display: block;
}

.thumb-btn.is-video {
  border-style: dashed;
}

.thumb-btn.is-pdf {
  border-style: dashed;
}

.thumb-video {
  width: 100%;
  height: 50px;
  display: grid;
  place-items: center;
  background: #dfeaf3;
  color: #2f5774;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.62rem;
  font-weight: 700;
}

.thumb-pdf {
  width: 100%;
  height: 50px;
  display: grid;
  place-items: center;
  background: #e9edf5;
  color: #3a4e6b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.62rem;
  font-weight: 700;
}

.details-paper {
  display: grid;
  align-content: start;
  gap: 0.6rem;
}

.subtitle {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}

.details-paper p {
  margin: 0;
  line-height: 1.56;
  color: var(--muted);
}

.impact {
  border-left: 3px solid var(--accent);
  padding-left: 0.62rem;
}

.meta {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.55rem;
  display: grid;
  gap: 0.3rem;
}

.meta strong {
  color: var(--ink);
}

.tags,
.docs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.56rem;
  font-size: 0.76rem;
  color: var(--muted);
  background: #efe6d8;
}

.docs a,
.actions a,
.doc-preview-head a.inline-link {
  border: 1px solid var(--link-border);
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  font-size: 0.76rem;
  text-decoration: none;
  color: var(--link);
  background: var(--link-soft);
  font-weight: 700;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
  box-shadow: inset 0 -1px 0 rgba(15, 79, 116, 0.18);
}

.docs a::after,
.actions a:not(.primary)::after,
.doc-preview-head a.inline-link::after {
  content: " ->";
  font-weight: 700;
}

.docs a:hover,
.actions a:not(.primary):hover,
.doc-preview-head a.inline-link:hover {
  background: var(--link-hover);
  transform: translateY(-1px);
}

.docs a:focus-visible,
.actions a:focus-visible,
.doc-preview-head a.inline-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.actions a {
  border: 1px solid var(--line);
  padding: 0.36rem 0.7rem;
}

.actions .primary {
  background: #f8d9cc;
  border-color: #b86142;
  color: #532213;
  font-weight: 700;
  box-shadow: inset 0 -1px 0 rgba(83, 34, 19, 0.2);
}

.actions .primary::after {
  content: "";
}

.actions .primary:hover {
  background: #f5cfbe;
  transform: translateY(-1px);
}

.demo-access {
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #f7efe2;
  display: grid;
  gap: 0.45rem;
  padding: 0.55rem;
}

.demo-access-title {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.demo-access-status,
.demo-access-note {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--muted);
}

.demo-credentials {
  display: grid;
  gap: 0.32rem;
}

.demo-credential {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.demo-credential-key {
  font-size: 0.72rem;
  color: var(--ink);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.demo-credential-value {
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  background: #fff;
  color: #22313a;
  font-size: 0.74rem;
  padding: 0.12rem 0.38rem;
}

.project-empty {
  margin: 0;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 1rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 940px) {
  .dossier {
    grid-template-columns: 1fr;
  }

  .media-viewport,
  .image-empty {
    max-width: 100%;
  }

  .lightbox-dialog {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    border: 0;
  }

  .lightbox-topbar,
  .lightbox-toolbar {
    padding: 0.58rem;
  }

  .lightbox-caption {
    font-size: 0.69rem;
    max-width: 58vw;
  }

  .lightbox-group {
    width: 100%;
    justify-content: space-between;
  }

  .lightbox-btn {
    font-size: 0.72rem;
    padding: 0.46rem 0.7rem;
    min-height: 2.3rem;
  }

}