/* =============================================
   EMMETT ROMILIO - PORTFOLIO
   Case study layer. Loaded only by project pages.
   Depends on the tokens in styles.css.
   ============================================= */

.cs {
  --notch: 10px;
  --chamfer: polygon(
    var(--notch) 0,
    calc(100% - var(--notch)) 0,
    100% var(--notch),
    100% calc(100% - var(--notch)),
    calc(100% - var(--notch)) 100%,
    var(--notch) 100%,
    0 calc(100% - var(--notch)),
    0 var(--notch)
  );
}

/* ─── HERO ─── */
.cs-hero {
  padding: 9rem 2rem 0;
  max-width: 1200px;
  margin: 0 auto;
}

.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--ink-mid);
  margin-bottom: 2.5rem;
  transition: color 0.2s, gap 0.2s var(--ease-out);
}
.cs-back:hover { color: var(--ink); gap: 0.7rem; }

.cs-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-mid);
  display: block;
  margin-bottom: 1rem;
}

.cs-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5.5vw, 4.25rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 1.25rem;
}

.cs-tagline {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.65;
  color: var(--ink-mid);
  letter-spacing: -0.01em;
  max-width: 62ch;
  margin-bottom: 2.5rem;
}

/* ─── META GRID ─── */
.cs-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--silver);
  border: 1px solid var(--silver);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-bottom: 2rem;
}
.cs-meta-item {
  background: var(--bg);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cs-meta-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.cs-meta-value {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.cs-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.1rem;
  margin-bottom: 3.5rem;
}
.cs-note {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

/* ─── COVER ───
   Outer element carries the gutter so the cover aligns with the hero
   text and section content; inner element carries the radius and clip. */
.cs-cover {
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0 2rem;
}
.cs-cover-media {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--bg-alt);
}
.cs-cover-media img,
.cs-cover-media video {
  width: 100%;
  height: auto;
  display: block;
}
/* Faint CRT scanline. Y2K nod, kept low enough not to touch the work. */
.cs-cover-media::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(44,44,44,0.045) 0 1px,
    transparent 1px 3px
  );
}

.cs-caption {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}
.cs-section-inner .cs-caption { padding: 0; margin-bottom: 0; margin-top: 1rem; }

/* ─── SECTIONS ─── */
.cs-section { padding: 4.5rem 2rem; }
.cs-section--alt { background: var(--bg-alt); }
.cs-section--dark { background: var(--bg-dark); }
.cs-section-inner { max-width: 1200px; margin: 0 auto; }

.cs-section-head { margin-bottom: 2.25rem; }
.cs-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
}
.cs-section--dark .cs-section-title { color: var(--on-dark); }
.cs-section--dark .section-label { color: var(--on-dark-soft); }

/* ─── PROSE ─── */
.cs-prose { max-width: 68ch; }
.cs-prose > * + * { margin-top: 1.15rem; }
.cs-prose p {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink-mid);
  letter-spacing: -0.01em;
}
.cs-prose strong { color: var(--ink); font-weight: 600; }
.cs-prose a {
  color: var(--ink);
  border-bottom: 1px solid var(--silver);
  transition: border-color 0.2s;
}
.cs-prose a:hover { border-color: var(--ink); }
.cs-section--dark .cs-prose p { color: var(--on-dark-mid); }
.cs-section--dark .cs-prose strong { color: var(--on-dark); }

.cs-lead p {
  font-size: clamp(1.05rem, 1.7vw, 1.22rem);
  line-height: 1.7;
  color: var(--ink);
}
.cs-section--dark .cs-lead p { color: var(--on-dark); }

/* ─── SUB-BLOCKS ─── */
.cs-block { margin-top: 2.75rem; }
.cs-block:first-child { margin-top: 0; }
.cs-block-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 0.85rem;
}
.cs-section--dark .cs-block-title { color: var(--on-dark); }

/* ─── LISTS ─── */
.cs-list {
  list-style: none;
  max-width: 68ch;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.cs-list li {
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--ink-mid);
  letter-spacing: -0.01em;
  padding-left: 1.6rem;
  position: relative;
}
.cs-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  background: var(--ink-soft);
}
.cs-list li strong { color: var(--ink); font-weight: 600; }
.cs-section--dark .cs-list li { color: var(--on-dark-mid); }
.cs-section--dark .cs-list li strong { color: var(--on-dark); }
.cs-section--dark .cs-list li::before { background: var(--on-dark-faint); }

/* ─── PULL QUOTE ─── */
.cs-pull {
  max-width: 62ch;
  margin: 3rem 0;
  padding: 1.75rem 0 1.75rem 1.75rem;
  border-left: 2px solid var(--ink);
}
.cs-pull p {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.1vw, 1.55rem);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.cs-section--dark .cs-pull { border-left-color: var(--on-dark-faint); }
.cs-section--dark .cs-pull p { color: var(--on-dark); }

/* ─── TWO-COLUMN SPLIT ─── */
.cs-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
.cs-split .cs-prose,
.cs-split .cs-list { max-width: none; }

/* ─── FIGURES (interleaved with prose) ─── */
.cs-figure {
  margin: 3rem 0;
  max-width: 1200px;
}
/* --cap holds a figure at a sane display width. Phone captures and low-res
   art both look wrong stretched across the full 1200px prose column. */
.cs-figure img,
.cs-figure video {
  width: 100%;
  height: auto;
  display: block;
  max-width: var(--cap, none);
  margin-inline: auto;
  border-radius: var(--r-md);
  background: var(--bg-alt);
}
.cs-figure figcaption {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-top: 0.7rem;
}
.cs-section--dark .cs-figure figcaption { color: var(--on-dark-soft); }

/* ─── TABLE ─── */
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  border: 1px solid var(--silver);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.cs-table th,
.cs-table td {
  text-align: left;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--silver);
  vertical-align: top;
}
.cs-table thead th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  background: var(--bg);
  white-space: nowrap;
}
.cs-section--alt .cs-table thead th { background: var(--bg-alt); }
.cs-table tbody th {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.cs-table td {
  font-size: 0.89rem;
  line-height: 1.65;
  color: var(--ink-mid);
  letter-spacing: -0.01em;
}
.cs-table tbody tr:last-child th,
.cs-table tbody tr:last-child td { border-bottom: none; }
.cs-table-scroll { overflow-x: auto; }

/* ─── COLOUR SWATCHES ─── */
.cs-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.cs-swatch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem 0.5rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--silver);
  border-radius: var(--r-pill);
}
.cs-section--alt .cs-swatch { background: var(--bg-alt); }
.cs-swatch-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sw, var(--silver));
  box-shadow: inset 0 0 0 1px var(--ink-faint);
  flex-shrink: 0;
}
.cs-swatch-hex {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-mid);
}

/* =============================================
   GALLERIES - three variants, one shell
   ============================================= */

/* Variant 1: filmstrip for phone screens */
.cs-gallery--strip {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding: 1.75rem;
  background: var(--bg);
  border: 1px solid var(--silver);
  border-radius: var(--r-lg);
  scroll-snap-type: x proximity;
}
.cs-section--alt .cs-gallery--strip { background: var(--bg-alt); }
.cs-gallery--strip .cs-shot {
  flex: 0 0 auto;
  height: 460px;
  scroll-snap-align: center;
  border: none;
  background: none;
  padding: 0;
  cursor: zoom-in;
  transition: transform 0.3s var(--ease-out);
}
.cs-gallery--strip .cs-shot:hover { transform: translateY(-4px); }
.cs-gallery--strip .cs-shot img {
  height: 100%;
  width: auto;
  display: block;
  border-radius: var(--r-sm);
}
.cs-gallery--strip::-webkit-scrollbar { height: 6px; }
.cs-gallery--strip::-webkit-scrollbar-track { background: var(--ink-hairline); }
.cs-gallery--strip::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 3px; }

/* Variant 2: stacked browser frames for web work */
.cs-gallery--frames {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Variant 3: responsive grid for wide and print work */
.cs-gallery--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
/* Wide captures need fewer, larger columns to stay legible */
.cs-gallery--grid.cs-gallery--wide {
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
}
.cs-gallery--grid .cs-shot {
  border: none;
  padding: 0;
  background: var(--bg-alt);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}
.cs-section--alt .cs-gallery--grid .cs-shot { background: var(--bg); }
.cs-gallery--grid .cs-shot:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 42px rgba(0,0,0,0.12);
}
.cs-gallery--grid .cs-shot img { width: 100%; height: auto; display: block; }

/* ─── BROWSER FRAME ─── */
.cs-frame {
  clip-path: var(--chamfer);
  background: var(--silver);
  padding: 1px;
}
.cs-frame-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-alt);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-mid);
}
.cs-section--alt .cs-frame-bar { background: var(--bg); }
.cs-frame-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-frame-expand {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--silver);
  border-radius: 3px;
  color: var(--ink-mid);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.cs-frame-expand:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.cs-frame-body {
  height: min(72vh, 660px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--bg-alt);
}
.cs-frame-body img { width: 100%; height: auto; display: block; }
.cs-frame-body::-webkit-scrollbar { width: 8px; }
.cs-frame-body::-webkit-scrollbar-track { background: var(--ink-hairline); }
.cs-frame-body::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 4px; }

.cs-frame--tablet,
.cs-frame--mobile { margin-left: auto; margin-right: auto; }
.cs-frame--tablet { max-width: 768px; }
.cs-frame--mobile { max-width: 390px; }
.cs-frame--tablet .cs-frame-body,
.cs-frame--mobile .cs-frame-body { height: min(76vh, 720px); }

/* ─── BREAKPOINT CAROUSEL ───
   Grid rather than flex so the dots can live inside .cs-carousel,
   which is the scope site.js binds them in. */
.cs-carousel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}
.cs-carousel-track { min-width: 0; }
.cs-carousel-slide { display: none; }
.cs-carousel-slide.is-active { display: block; }
.cs-carousel-arrow {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  background: var(--bg);
  border: 1px solid var(--silver);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s, transform 0.2s var(--ease-out);
}
.cs-carousel-arrow:hover {
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-2px);
}
.cs-carousel-dots {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.cs-carousel-dot {
  background: none;
  border: 1px solid var(--ink-soft);
  border-radius: 2px;
  width: 26px;
  height: 6px;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.cs-carousel-dot.is-active { background: var(--ink); border-color: var(--ink); }

/* ─── PREV / NEXT PROJECT NAV ─── */
.cs-nav {
  border-top: 1px solid var(--silver);
  padding: 3.5rem 2rem;
  background: var(--bg);
}
.cs-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--silver);
  border: 1px solid var(--silver);
  border-radius: var(--r-md);
  overflow: hidden;
}
.cs-nav-link {
  background: var(--bg);
  padding: 1.75rem 1.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: background 0.25s;
}
.cs-nav-link:hover { background: var(--bg-alt); }
.cs-nav-link--next { text-align: right; align-items: flex-end; }
.cs-nav-dir {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.cs-nav-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* =============================================
   POSTER GALLERY - posters.html
   ============================================= */
.poster-list {
  display: flex;
  flex-direction: column;
  gap: 5rem;
}
.poster-entry {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}
.poster-entry:nth-child(even) .poster-entry-img { order: 2; }

/* --cap holds an entry at its source resolution so low-res art never upscales */
.poster-entry-img {
  border: none;
  padding: 0;
  background: var(--bg-alt);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: zoom-in;
  display: block;
  width: 100%;
  max-width: var(--cap, none);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s;
}
.poster-entry-img img { width: 100%; height: auto; display: block; }
.poster-entry-img:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 52px rgba(0,0,0,0.14);
}

.poster-entry-body { display: flex; flex-direction: column; gap: 0.7rem; }
.poster-entry-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}
.poster-entry-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.poster-entry-desc {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--ink-mid);
  letter-spacing: -0.01em;
  max-width: 48ch;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1000px) {
  .cs-split { grid-template-columns: 1fr; gap: 2rem; }
  .poster-entry { grid-template-columns: 1fr; gap: 1.5rem; }
  .poster-entry:nth-child(even) .poster-entry-img { order: 0; }
  .poster-list { gap: 3.5rem; }
}
@media (max-width: 900px) {
  .cs-hero { padding: 7.5rem 1.5rem 0; }
  .cs-section { padding: 3.5rem 1.5rem; }
  .cs-nav { padding: 2.5rem 1.5rem; }
  .cs-cover, .cs-caption { padding-left: 1.5rem; padding-right: 1.5rem; }
  .cs-gallery--strip .cs-shot { height: 380px; }
}
@media (max-width: 640px) {
  .cs-hero { padding: 7rem 1.25rem 0; }
  .cs-section { padding: 3rem 1.25rem; }
  .cs-nav { padding: 2rem 1.25rem; }
  .cs-cover, .cs-caption { padding-left: 1.25rem; padding-right: 1.25rem; }
  .cs-caption { margin-bottom: 2.5rem; }
  .cs-cover-media { border-radius: var(--r-md); }
  .cs-gallery--strip { padding: 1rem; gap: 0.85rem; }
  .cs-gallery--strip .cs-shot { height: 320px; }
  .cs-gallery--grid { grid-template-columns: 1fr; }
  .cs-frame-body { height: min(62vh, 460px); }
  .cs-nav-inner { grid-template-columns: 1fr; }
  .cs-nav-link--next { text-align: left; align-items: flex-start; }
  .cs-pull { margin: 2rem 0; padding: 1.25rem 0 1.25rem 1.25rem; }
  .cs-figure { margin: 2rem 0; }
  .cs-carousel { gap: 0.5rem; }
  .cs-carousel-arrow { width: 34px; height: 34px; font-size: 0.85rem; }
  .cs-meta { grid-template-columns: 1fr 1fr; }
}
