/* ── Night case study (/projekti/svjetlarna-lovran/) ──────────────────────
   A projection-mapping project is seen at night, so its page is dark from
   top to bottom. Loaded only by cases with night: True in
   scripts/projects/cases/*.py. The article swaps the site's colour tokens,
   so every shared component (eyebrow, lede, buttons, rows, facts) turns
   light-on-dark without its own override. Nav and footer sit outside the
   article and keep their own colours. */
.case-night {
  --ink: #f5f2ea;
  --paper: #06080e;
  --muted: rgba(245, 242, 234, .64);
  --hairline: rgba(245, 242, 234, .16);
  --wash: #0c1019;
  --gold: #f2b84b;
  background: var(--paper);
  color: var(--ink);
}

.case-night .band--ink {
  background: #000;
  color: var(--ink);
}

.case-night .band--wash {
  background: var(--wash);
}

.case-night .eyebrow {
  color: var(--gold);
}

.case-night .band--ink .lede,
.case-night .band--ink .eyebrow {
  color: inherit;
}

.case-night .band--ink .eyebrow {
  color: var(--gold);
}

.case-night .band--ink .lede {
  color: var(--muted);
}

.case-night .band--ink .btn {
  border-color: var(--ink);
  color: var(--ink);
}

.case-night .band--ink .btn--solid {
  background: var(--ink);
  color: #000;
}

.case-night a:not(.btn) {
  color: inherit;
}

.case-night :focus-visible {
  outline-color: var(--gold);
}

/* ── Cover: the picture fills the first screen, the title sits on it ───── */
.case-cover {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: min(100svh, 980px);
  padding: calc(var(--nav-h) + 2rem) 0 clamp(2rem, 4vw, 3rem);
  overflow: hidden;
  background: #000;
}

.case-cover__media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.case-cover__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 40%;
  animation: case-cover-in 2.4s var(--ease) both;
}

/* the cover settles (scale only): a fade from opacity 0 kept the photo
   out of LCP until the fade's first visible frame, ~0.3–0.5 s after it had
   loaded on a throttled phone (LCP 1.7–1.8 s, now ~1.45 s) */
@keyframes case-cover-in {
  from {
    transform: scale(1.06);
  }
}

/* Dark at the bottom and left, where the text is; clear where the
   buildings are. */
.case-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgba(6, 8, 14, 1) 0%, rgba(6, 8, 14, .86) 26%, rgba(6, 8, 14, .2) 58%, rgba(6, 8, 14, .45) 100%),
    linear-gradient(to right, rgba(6, 8, 14, .88) 0%, rgba(6, 8, 14, .55) 38%, rgba(6, 8, 14, 0) 68%);
}

.case-cover__body {
  width: 100%;
}

.case-cover .crumbs {
  position: absolute;
  top: calc(var(--nav-h) + 1.25rem);
}

.case-cover .crumbs li+li::before {
  color: var(--muted);
}

.case-cover h1 {
  margin: .9rem 0 0;
  font-size: clamp(3rem, 11vw, 8.5rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: .92;
}

.case-cover__tag {
  margin-top: 1rem;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  letter-spacing: -0.01em;
  color: var(--gold);
}

.case-cover .lede {
  max-width: 33.5em; /* 52ch of Google Sans; em, so the fallback font keeps the same box */
  margin-top: 1.1rem;
  color: rgba(245, 242, 234, .82);
}

.case-cover .btn-row {
  margin-top: 1.8rem;
}

.case-cover .case-facts {
  max-width: 980px;
}

.case-cover__credit {
  margin-top: 1.4rem;
  font-size: .78rem;
  color: var(--muted);
}

@media (max-width: 759px) {
  .case-cover {
    display: block;
    min-height: 0;
    padding: 0 0 2.5rem;
  }

  .case-cover__media {
    position: relative;
    inset: auto;
    display: block;
    height: min(78svh, 620px);
  }

  .case-cover__media img {
    object-position: 50% 35%;
  }

  .case-cover::after {
    bottom: auto;
    height: min(78svh, 620px);
    background: linear-gradient(to top, rgba(6, 8, 14, 1) 0%, rgba(6, 8, 14, .35) 30%, rgba(6, 8, 14, 0) 55%, rgba(6, 8, 14, .55) 100%);
  }

  .case-cover__body {
    margin-top: -5.5rem;
  }
}

/* ── Big statement in the overview ─────────────────────────────────────── */
.case-night #pregled h2 {
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.case-night #pregled .prose p:first-child {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.5;
  color: var(--ink);
}

/* ── Numbers ───────────────────────────────────────────────────────────── */
.case-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: clamp(2.5rem, 5vw, 4rem) 0 0;
  border-top: 1px solid var(--hairline);
}

.case-stats div {
  padding: clamp(1.4rem, 3vw, 2.4rem) clamp(.75rem, 2vw, 1.5rem) clamp(1.4rem, 3vw, 2.4rem) 0;
  border-bottom: 1px solid var(--hairline);
}

.case-stats dt {
  font-size: clamp(2rem, 5.4vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.case-stats dt small {
  font-size: .42em;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: .15em;
}

.case-stats dd {
  margin: .7rem 0 0;
  font-size: .95rem;
  color: var(--muted);
  max-width: 26ch;
}

@media (min-width: 960px) {
  .case-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .case-stats div:not(:nth-child(3n+1)) {
    padding-left: clamp(1rem, 2.5vw, 2rem);
    border-left: 1px solid var(--hairline);
  }
}

@media (max-width: 959px) {
  .case-stats div:nth-child(2n) {
    padding-left: clamp(.9rem, 3vw, 1.5rem);
    border-left: 1px solid var(--hairline);
  }
}

/* ── Illustrated process ───────────────────────────────────────────────── */
.case-flow {
  list-style: none;
  margin: clamp(3rem, 6vw, 5rem) 0 0;
  padding: 0;
  display: grid;
  gap: clamp(3.5rem, 8vw, 7rem);
}

.case-flow__step {
  display: grid;
  gap: 1.5rem;
  align-items: center;
  margin: 0;
}

.case-flow__n {
  font-size: .8rem;
  letter-spacing: .16em;
  color: var(--gold);
  font-weight: 600;
}

.case-flow__text h3 {
  margin-top: .7rem;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.case-flow__text p:last-child {
  margin-top: 1rem;
  color: var(--muted);
  max-width: 46ch;
  font-size: 1.02rem;
  line-height: 1.65;
}

.case-flow__media .case-fig img {
  border-radius: 0;
}

/* A tall render (the bell tower) shouldn't fill a whole screen */
/* a definite height, so the box is reserved before the image loads (width
   auto with only a max-height gave it no size: CLS 0.34 on fast scrolls) */
.case-flow__media .case-fig img[height="2000"] {
  width: auto;
  height: min(78vh, 720px);
  aspect-ratio: 1600 / 2000;
  max-width: 100%;
  object-fit: contain;
  margin-inline: auto;
}

@media (min-width: 960px) {
  .case-flow__step {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2.5rem, 5vw, 5rem);
  }

  .case-flow__step:nth-child(even) .case-flow__text {
    order: 2;
  }
}

/* Diagrams drawn in SVG: the canvas strip and the projector plan */
.case-diagram {
  margin: 0;
  padding: clamp(1rem, 2.5vw, 1.75rem);
  border: 1px solid var(--hairline);
  border-radius: 0;
  background: radial-gradient(120% 90% at 50% 0%, #121828 0%, #06080e 70%);
}

.case-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.case-diagram figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .9rem;
  font-size: .8rem;
  color: var(--muted);
}

.case-diagram text {
  font-family: var(--font);
}

.case-plan {
  position: relative;
}

.case-plan img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}

.case-plan svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Premiere ──────────────────────────────────────────────────────────── */
.case-premiere {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(2rem, 4vw, 3rem);
  align-items: end;
}

.case-premiere__date {
  font-size: clamp(3.4rem, 13vw, 11rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: .85;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(100deg, #fff6df 0%, var(--gold) 45%, #e0763a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.case-premiere__day {
  margin-top: 1.2rem;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
}

.case-premiere__times {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.case-premiere__times li {
  margin: 0;
  padding: .7rem 1.2rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.case-premiere__note {
  margin-top: 1.2rem;
  color: var(--muted);
  max-width: 40ch;
}

.case-premiere .btn-row {
  margin-top: 1.6rem;
}

@media (min-width: 960px) {
  .case-premiere {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }
}

/* ── Festival years: a strip of photos per year, scrolled sideways ─────── */
.case-years {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.case-year__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--hairline);
}

.case-year__head h3 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.04em;
  font-weight: 500;
}

.case-year__head p {
  font-size: .82rem;
  color: var(--muted);
  text-align: right;
}

.case-year__strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 80%;
  gap: .9rem;
  margin-top: 1.1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline) transparent;
  padding-bottom: .6rem;
}

.case-year__strip:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.case-year__strip figure {
  margin: 0;
  scroll-snap-align: start;
}

.case-year__strip img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 0;
  background: #111;
}

@media (min-width: 760px) {
  .case-year__strip {
    grid-auto-columns: 44%;
  }
}

/* Wide screens: a bento of five, the first photo large on the left. */
@media (min-width: 1100px) {
  .case-year__strip {
    grid-auto-flow: row;
    grid-template-columns: 2fr 1fr 1fr;
    grid-auto-columns: auto;
    overflow: visible;
    padding-bottom: 0;
  }

  .case-year__strip figure:first-child {
    grid-row: span 2;
  }

  .case-year__strip figure:first-child img {
    aspect-ratio: auto;
    height: 100%;
  }
}

/* The closing band's mock is drawn for a light page; give it a lit edge. */
.case-night .svc-band .mock {
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .6));
}

@media (prefers-reduced-motion: reduce) {
  .case-cover__media img {
    animation: none;
  }
}
