/* Art pop-up round 3 (art-develop/a3-popup). Clicking a picture in the hallway opens its pop-up:
   the piece, its title, date, project and media, and (Metropolis, Nature Playground) the workbook.
   Three pop-up styles, one per page: .pop-full (P1), .pop-card (P2), .pop-side (P3).
   The workbook has three layouts, switched inside the pop-up: story, slides, grid.
   The pop-up uses its own --pop-* colours so the page's dimming never touches it. */

/* ---------- Pictures on the wall can be opened ---------- */
.hw-art[data-pop-open] { cursor: zoom-in; }
.hw-art[data-pop-open]:focus-visible { outline: 2px solid var(--here, #A6566B); outline-offset: 6px; }
.hw-wall.is-dragging .hw-art[data-pop-open] { cursor: grabbing; }

/* ---------- Shared ---------- */
html.pop-open { overflow: hidden; }
.pop {
  --pop-bg: #FBF8F3; --pop-ink: #262A22; --pop-text: #575C51; --pop-soft: #8F9288; --pop-line: #E8DFD1;
  --pop-accent: #A6566B; --pop-chip: #F3E6E3; --pop-btn: #FFFFFF; --pop-on: #262A22; --pop-on-ink: #FBF8F3;
  padding: 0; border: 0; color: var(--pop-text); background: var(--pop-bg);
  max-width: none; max-height: none; overflow: hidden;
}
.pop::backdrop { background: rgba(20, 18, 16, 0.72); backdrop-filter: blur(6px); }
.pop[open] { animation: pop-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.pop[open]::backdrop { animation: pop-fade 0.35s ease both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
@keyframes pop-fade { from { opacity: 0; } }

.pop-sheet { height: 100%; max-height: inherit; overflow-y: auto; overscroll-behavior: contain; }
.pop-close {
  position: absolute; top: 14px; right: 14px; z-index: 5; display: grid; place-items: center; width: 44px; height: 44px;
  padding: 0; border: 0; border-radius: 50%; cursor: pointer; color: var(--pop-ink); background: var(--pop-btn);
  box-shadow: 0 0 0 1px var(--pop-line), 0 4px 14px rgba(0, 0, 0, 0.12); transition: transform 0.2s;
}
.pop-close span { font-size: 26px; line-height: 1; }
.pop-close:hover { transform: rotate(90deg); }
.pop :focus-visible { outline: 2px solid var(--pop-accent); outline-offset: 3px; }

/* The piece and its details */
.pop-top { display: grid; gap: clamp(24px, 4vw, 56px); align-items: center; }
.pop-hero { margin: 0; display: grid; place-items: center; }
.pop-hero img { display: block; width: auto; max-width: 100%; height: auto; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18), 0 20px 50px rgba(0, 0, 0, 0.22); }
.pop-kicker { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--pop-accent); }
.pop-title { margin: 0; font-family: var(--font-head); font-size: clamp(36px, 4vw, 54px); font-weight: 400; line-height: 1.02; color: var(--pop-ink); }
.pop-facts { display: grid; gap: 14px; margin: 28px 0 0; }
.pop-facts div { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding-top: 14px; border-top: 1px solid var(--pop-line); }
.pop-facts dt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--pop-soft); }
.pop-facts dd { margin: 0; font-size: 15px; color: var(--pop-ink); }
.pop-more { margin: 28px 0 0; font-size: 13px; letter-spacing: 0.04em; color: var(--pop-soft); }

/* ---------- Workbook ---------- */
.wb { border-top: 1px solid var(--pop-line); }
.wb-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 36px; }
.wb-title { margin: 0; font-family: var(--font-head); font-size: clamp(30px, 3vw, 40px); font-weight: 400; color: var(--pop-ink); }
.wb-switch { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--pop-chip); }
.wb-switch button {
  padding: 8px 16px; border: 0; border-radius: 999px; cursor: pointer;
  font: 500 13px/1 Inter, system-ui, sans-serif; color: var(--pop-text); background: none;
}
.wb-switch button[aria-pressed="true"] { color: var(--pop-on-ink); background: var(--pop-on); }

.wb-steps { margin: 0; padding: 0; list-style: none; }
.wb-step { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "no text" "no fig"; column-gap: 20px; row-gap: 18px; }
.wb-no { grid-area: no; margin: 0; font-family: var(--font-head); font-size: 40px; line-height: 0.9; color: var(--pop-soft); }
.wb-text { grid-area: text; }
.wb-fig { grid-area: fig; margin: 0; }
.wb-fig img { display: block; width: 100%; height: auto; border-radius: 6px; background: #FFFFFF; box-shadow: 0 0 0 1px var(--pop-line), 0 10px 30px rgba(0, 0, 0, 0.1); }
.wb-tag { display: inline-block; margin: 0 0 10px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pop-accent); background: var(--pop-chip); }
.wb-step h4 { margin: 0; font-family: var(--font-head); font-size: 26px; font-weight: 400; line-height: 1.15; color: var(--pop-ink); }
.wb-step p.wb-desc { margin: 8px 0 0; font-size: 15px; line-height: 1.65; color: var(--pop-text); }
.wb-nav { display: none; }

/* Story: the steps in order, numbered, with a line joining them like a process timeline */
.wb[data-view="story"] .wb-steps { display: grid; gap: 64px; }
.wb[data-view="story"] .wb-step { position: relative; }
.wb[data-view="story"] .wb-step:not(:last-child)::before {
  content: ""; position: absolute; top: 52px; bottom: -52px; left: 27px; width: 1px; background: var(--pop-line);
}

/* Slideshow: one step at a time, ← → underneath */
.wb[data-view="slides"] .wb-step:not(.is-on) { display: none; }
.wb[data-view="slides"] .wb-step { grid-template-columns: minmax(0, 1fr); grid-template-areas: "fig" "text"; animation: pop-fade 0.35s ease both; }
.wb[data-view="slides"] .wb-no { display: none; }
.wb[data-view="slides"] .wb-fig img { max-height: 58vh; width: auto; max-width: 100%; margin: 0 auto; }
.wb[data-view="slides"] .wb-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 28px; }
.wb-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  font-size: 18px; color: var(--pop-ink); background: var(--pop-btn); box-shadow: 0 0 0 1px var(--pop-line);
}
.wb-btn:disabled { opacity: 0.35; cursor: default; }
.wb-count { min-width: 64px; font-size: 13px; letter-spacing: 0.08em; text-align: center; color: var(--pop-soft); }

/* Grid: every step at once as small cards; clicking one opens it in the slideshow */
.wb[data-view="grid"] .wb-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.wb[data-view="grid"] .wb-step {
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "fig" "text"; row-gap: 12px; padding: 10px 10px 16px;
  border-radius: 10px; cursor: pointer; box-shadow: 0 0 0 1px var(--pop-line); transition: transform 0.2s, box-shadow 0.2s;
}
.wb[data-view="grid"] .wb-step:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--pop-line), 0 12px 26px rgba(0, 0, 0, 0.12); }
.wb[data-view="grid"] .wb-no, .wb[data-view="grid"] .wb-desc { display: none; }
.wb[data-view="grid"] .wb-fig img { aspect-ratio: 16 / 10; object-fit: cover; box-shadow: none; }
.wb[data-view="grid"] .wb-step h4 { font-size: 20px; }
.wb[data-view="grid"] .wb-tag { margin-bottom: 6px; }

/* ---------- P1 · Full-screen viewer (the gallery's dark charcoal) ---------- */
.pop-full {
  --pop-bg: #24221F; --pop-ink: #F6F0E8; --pop-text: #D9D2C8; --pop-soft: #A39B92; --pop-line: rgba(255, 255, 255, 0.12);
  --pop-accent: #EBB1BE; --pop-chip: rgba(255, 255, 255, 0.07); --pop-btn: rgba(255, 255, 255, 0.1); --pop-on: #F6F0E8; --pop-on-ink: #24221F;
  width: 100vw; height: 100vh; height: 100dvh; margin: 0; inset: 0;
}
.pop-full .pop-top {
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 1fr); min-height: 100vh; min-height: 100dvh;
  max-width: 1320px; margin: 0 auto; padding: 72px clamp(24px, 5vw, 72px);
}
.pop-full .pop-hero img { max-height: calc(100dvh - 144px); }
.pop-full .pop-hero { position: relative; isolation: isolate; }
.pop-full .pop-hero::before {
  content: ""; position: absolute; z-index: -1; inset: -12%;
  background: radial-gradient(closest-side, rgba(255, 236, 205, 0.16), transparent);
}
.pop-full .wb { max-width: 1180px; margin: 0 auto; padding: 72px clamp(24px, 5vw, 72px) 96px; }
.pop-full .wb[data-view="story"] .wb-step { grid-template-columns: 72px minmax(0, 0.85fr) minmax(0, 1.5fr); grid-template-areas: "no text fig"; column-gap: 32px; align-items: start; }
.pop-full .wb[data-view="story"] .wb-step:not(:last-child)::before { left: 35px; }

/* ---------- P2 · Centred card (cream, like the site) ---------- */
.pop-card { width: min(1040px, calc(100vw - 48px)); max-height: min(90vh, 940px); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); }
.pop-card .pop-sheet { max-height: min(90vh, 940px); }
.pop-card .pop-top { grid-template-columns: minmax(0, 1.3fr) minmax(240px, 1fr); padding: 48px 48px 40px; }
.pop-card .pop-hero img { max-height: 62vh; }
.pop-card .wb { padding: 40px 48px 56px; }

/* ---------- P3 · Side panel (slides in from the right) ---------- */
.pop-side {
  width: min(620px, 100vw); height: 100vh; height: 100dvh; margin: 0 0 0 auto; inset: 0 0 0 auto;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.3);
}
.pop-side[open] { animation: pop-slide 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes pop-slide { from { transform: translateX(100%); } }
.pop-side::backdrop { background: rgba(20, 18, 16, 0.45); backdrop-filter: none; }
.pop-side .pop-top { grid-template-columns: minmax(0, 1fr); padding: 72px 40px 36px; }
.pop-side .pop-hero img { max-height: 58vh; }
.pop-side .pop-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pop-side .pop-facts div { grid-template-columns: 1fr; gap: 4px; }
.pop-side .wb { padding: 36px 40px 56px; }

/* ---------- Phones: every style becomes a full-screen sheet ---------- */
@media (max-width: 720px) {
  .pop-card, .pop-side { width: 100vw; height: 100vh; height: 100dvh; max-height: none; margin: 0; inset: 0; border-radius: 0; }
  .pop-card .pop-sheet { max-height: none; }
  .pop .pop-top { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 72px 20px 28px; }
  .pop .pop-hero img { max-height: 60vh; }
  .pop .wb { padding: 32px 20px 48px; }
  .pop .wb[data-view="story"] .wb-step { grid-template-columns: 40px minmax(0, 1fr); grid-template-areas: "no text" "no fig"; column-gap: 14px; }
  .pop .wb[data-view="story"] .wb-step:not(:last-child)::before { left: 19px; }
  .wb-no { font-size: 30px; }
  .pop-side .pop-facts { grid-template-columns: minmax(0, 1fr); }
  .pop-side .pop-facts div { grid-template-columns: 84px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .pop[open], .pop[open]::backdrop, .pop-side[open], .wb[data-view="slides"] .wb-step { animation: none; }
  .pop-close, .wb[data-view="grid"] .wb-step { transition: none; }
}
