/* Magazine overview: cards for current exhibitions and places, floating on a
   background grid of photos. Spec: PLAN.md, "Magazine Overview". */
body[data-page="magazine"] { background: #070b13; color: #f6f7fb; }

/* ---- Duotone, done in CSS so one colour file serves cards and background ----
   Default: greyscale multiplied over the category colour (as in the app).
   .color: the photo in full colour; the change is an animated fade. */
.duo { position: relative; overflow: hidden; background: #10151f; isolation: isolate; }
.duo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1) brightness(var(--boost, 1)); transition: filter 1.8s ease, transform 0.6s ease; }
.duo .tint { position: absolute; inset: 0; background: var(--c, #B8BCC6); mix-blend-mode: multiply; opacity: 1; transition: opacity 1.8s ease; pointer-events: none; }
.duo.color img { filter: grayscale(0) contrast(1) brightness(1); }
.duo.color .tint { opacity: 0; }

/* ---- Background grid of photos ---- */
.mosaic { position: fixed; inset: 0; z-index: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-auto-rows: 200px; grid-auto-flow: dense; overflow: hidden; }
.mosaic .tile { position: relative; }
.mosaic .tile.big { grid-column: span 2; grid-row: span 2; }
.mosaic .tile.wide { grid-column: span 2; }
.mosaic .tile.tall { grid-row: span 2; }
.mosaic .tile img.n { opacity: 0; transition: filter 1.8s ease, opacity 2s ease; }
.mosaic .tile img.n.on { opacity: 1; }
.mosaic-veil { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 50% 40%, rgba(4, 6, 10, 0.42), rgba(4, 6, 10, 0.7)); }

/* ---- Page: a narrower column floating on top ---- */
/* The map stylesheet fixes the page height and hides overflow, so the magazine
   scrolls inside its own full-screen container. The left gutter holds the nav. */
/* The title's vertical centre sits 3px below the centre of the third nav button (the nav column starts
   at --nav-top: three 54px buttons, two 0.75rem gaps), so menu, title and controls never crowd each other. */
.mag { --nav-top: calc(0.9rem + env(safe-area-inset-top, 0px)); --title-size: clamp(2.2rem, 6vw, 3.6rem); position: fixed; inset: 0; z-index: 2; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(var(--nav-top) + 162px - var(--title-size) * 0.525) 32px 3.5rem 76px; }
@media (min-width: 970px), (min-width: 780px) and (orientation: landscape) {
  .mag { --nav-top: calc(1.2rem + env(safe-area-inset-top, 0px)); }
}

.mag-wrap { max-width: 1180px; margin: 0 auto; }
.mag-inner { box-sizing: border-box; }

.mag-head { display: grid; gap: 0.9rem; margin-bottom: 1.1rem; }
.mag-title { margin: 0 0 1rem 0.2rem; font: italic 400 var(--title-size) / 1.05 Georgia, "Iowan Old Style", "Palatino Linotype", serif; text-shadow: 0 2px 26px rgba(0, 0, 0, 0.75), 0 0 3px rgba(0, 0, 0, 0.5); }

/* ---- Compact controls ---- */
.mag-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem; }
.mag-bar .spacer { flex: 1 1 0; }

.mag-ctl { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 38px; padding: 0 0.9rem; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px; background: rgba(4, 6, 10, 0.55); color: #fff; font: 500 0.8rem / 1 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mag-ctl .k { color: rgba(255, 255, 255, 0.55); }
.mag-ctl .v { font-weight: 700; }
.mag-ctl:hover { border-color: rgba(255, 255, 255, 0.5); }
.mag-ctl:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mag-ctl .caret { width: 6px; height: 6px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-2px) rotate(45deg); transition: transform 0.2s ease; }
.mag-ctl[aria-expanded="true"] { border-color: #fff; }
.mag-ctl[aria-expanded="true"] .caret { transform: translateY(1px) rotate(225deg); }

.mag-filter { display: inline-flex; align-items: center; gap: 0.55rem; min-height: 38px; padding: 0 0.9rem; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px; background: rgba(4, 6, 10, 0.55); color: #fff; font: 600 0.8rem / 1 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mag-filter:hover { border-color: rgba(255, 255, 255, 0.5); }
.mag-filter:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mag-filter .dots { display: inline-flex; gap: 2px; }
.mag-filter .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.mag-filter .dots i.off { background: #3a3f4a; }
.mag-filter .count { color: rgba(255, 255, 255, 0.7); font-weight: 500; }
.mag-filter .caret { width: 6px; height: 6px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-2px) rotate(45deg); transition: transform 0.2s ease; }
.mag-filter[aria-expanded="true"] .caret { transform: translateY(1px) rotate(225deg); }

.mag-panel { display: grid; gap: 0.7rem; padding: 0.9rem 1rem 1rem; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 14px; background: rgba(4, 6, 10, 0.72); backdrop-filter: blur(10px); }
.mag-panel[hidden], .mag-panel [hidden] { display: none !important; }
.mag-panel .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.mag-panel .mag-desc { margin: 0; color: rgba(255, 255, 255, 0.6); font-size: 0.78rem; }
.mag-panel .lbl { min-width: 4rem; color: rgba(255, 255, 255, 0.55); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

.mag-pill { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 36px; padding: 0 0.95rem; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px; background: transparent; color: #fff; font: 600 0.8rem / 1 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mag-pill:hover { border-color: rgba(255, 255, 255, 0.5); }
.mag-pill[aria-pressed="true"] { background: #fff; border-color: #fff; color: #05070b; }
.mag-pill:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mag-pill .mc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #fff); }
.mag-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mag-tags .mag-pill { min-height: 30px; padding: 0 0.8rem; font-size: 0.76rem; font-weight: 500; }
.mag-clear { justify-self: start; border: 0; background: none; color: rgba(255, 255, 255, 0.7); font: 500 0.78rem system-ui, sans-serif; text-decoration: underline; cursor: pointer; padding: 0.3rem 0; }

.mag-note { margin: 0.2rem 0 0; min-height: 1.1em; color: rgba(255, 255, 255, 0.65); font-size: 0.78rem; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); }

/* ---- The grid ---- */
.mag-grid { --unit: 110px; display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: var(--unit); grid-auto-flow: dense; gap: 10px; }

.mcard { position: relative; display: grid; grid-template-rows: 1fr auto; grid-template-columns: minmax(0, 1fr); overflow: hidden; border-radius: 2px; background: #fff; color: #11151d; text-decoration: none; isolation: isolate; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
.mcard:focus-within { outline: 2px solid #fff; outline-offset: 2px; }
.mcard .stretch { position: absolute; inset: 0; z-index: 3; }
.mcard .stretch:focus-visible { outline: none; }
.mcard:hover .duo img, .mcard:focus-within .duo img { transform: scale(1.04); }
/* Full-colour cards (.hot, photo in colour by default) turn to the tint on hover; the tinted ones turn to colour. */
.mcard.hot:hover .duo img, .mcard.hot:focus-within .duo img { filter: grayscale(1) contrast(1.1) brightness(var(--boost, 1)); }
.mcard.hot:hover .duo .tint, .mcard.hot:focus-within .duo .tint { opacity: 1; }
.mcard:not(.hot):hover .duo img, .mcard:not(.hot):focus-within .duo img { filter: grayscale(0) contrast(1) brightness(1); }
.mcard:not(.hot):hover .duo .tint, .mcard:not(.hot):focus-within .duo .tint { opacity: 0; }

/* the picture part: duotone photo, label, big title on top */
.mcard .pic { min-height: 0; }
.mcard .pic::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(4, 6, 10, 0.8) 0%, rgba(4, 6, 10, 0.25) 50%, rgba(4, 6, 10, 0) 75%); }
.mcard .label { position: absolute; z-index: 2; top: 0.6rem; left: 0.6rem; max-width: calc(100% - 1.2rem); padding: 0.28rem 0.6rem; border-radius: 999px; background: #fff; color: #05070b; font: 700 0.66rem / 1.1 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0.06em; text-transform: uppercase; }
.mcard .label.closing { background: #EB1E81; }
.mcard .title { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0.8rem; margin: 0; padding: 0.8rem 2.7rem 0 0.9rem; color: #fff; font: italic 400 1.28rem / 1.15 Georgia, "Iowan Old Style", "Palatino Linotype", serif; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.mcard .credit { z-index: 4; position: relative; justify-self: end; margin-top: 0.2rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 0.6rem / 1.2 system-ui, sans-serif; color: #8a91a0; text-decoration: none; }
.mcard a.credit:hover { color: #11151d; text-decoration: underline; }
.mcard .intro.venue { color: #6a7282; }

/* the white part: where, when, what */
.mcard .info { min-width: 0; display: grid; gap: 0.18rem; align-content: start; padding: 0.65rem 0.85rem 0.75rem; background: #fff; color: #11151d; }
.mcard .mc-meta { display: flex; align-items: flex-start; gap: 0.4rem; color: #5a6272; font: 500 0.72rem / 1.25 system-ui, -apple-system, "Segoe UI", sans-serif; }
.mcard .mc-meta .mc-dots { flex: none; display: inline-flex; gap: 3px; margin-top: 0.3em; }
.mcard .mc-meta .mc-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c, #888); }
.mcard .mc-meta .mc-where { min-width: 0; overflow-wrap: anywhere; }
.mcard .dates { font: 700 0.76rem / 1.25 system-ui, -apple-system, "Segoe UI", sans-serif; color: #11151d; }
.mcard .intro { margin: 0.1rem 0 0; color: #333a47; font: 400 0.78rem / 1.38 system-ui, -apple-system, "Segoe UI", sans-serif; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }

/* sizes (columns x rows of the grid) */
.s-hero { grid-column: span 4; grid-row: span 4; }
.s-m { grid-column: span 2; grid-row: span 2; }
.s-w { grid-column: span 3; grid-row: span 2; }
.s-x { grid-column: span 4; grid-row: span 2; }
.s-t { grid-column: span 2; grid-row: span 4; }

.s-hero .title { bottom: 1.2rem; padding: 1.2rem 4.2rem 0 1.4rem; font-size: clamp(1.7rem, 3.1vw, 2.6rem); line-height: 1.12; }
.s-hero .label { top: 0.9rem; left: 0.9rem; font-size: 0.72rem; }
.s-hero .info { padding: 0.9rem 1.4rem 1.1rem; gap: 0.3rem; }
.s-hero .mc-meta, .s-hero .dates { font-size: 0.88rem; }
.s-hero .intro { font-size: 0.92rem; -webkit-line-clamp: 3; }
.s-t .title { font-size: 1.4rem; }
.s-t .intro { -webkit-line-clamp: 5; }

/* wide cells: picture left, white part on the right */
.s-w, .s-x { grid-template-rows: 1fr; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.s-x { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.s-w .title, .s-x .title { font-size: 1.38rem; }
.s-w .info, .s-x .info { align-content: center; padding: 0.8rem 1rem; }
.s-w .intro { -webkit-line-clamp: 4; }
.s-x .intro { -webkit-line-clamp: 5; }

.mag-empty { padding: 3rem 0; color: rgba(255, 255, 255, 0.7); }

/* panel behind the column: tablet and up */
@media (min-width: 700px) {
  .mag-title { margin-left: 1.6rem; } /* in line with the content, not the panel edge */
  .mag-inner { padding: 1.4rem 1.4rem 1.6rem; border-radius: 20px; background: rgba(7, 11, 19, 0.78); backdrop-filter: blur(14px); box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45); }
}

@media (max-width: 999px) {
  .mag-grid { --unit: 100px; grid-template-columns: repeat(4, 1fr); }
  .s-hero { grid-column: span 4; grid-row: span 4; }
  .s-w, .s-x { grid-column: span 4; }
  .s-t { grid-row: span 2; }
  .s-t .intro { -webkit-line-clamp: 2; }
}

/* phones: exhibitions get the full width (stacked, or picture left / text right for the wide sizes),
   places sit two by two */
@media (max-width: 599px) {
  .mag { --title-size: 2.7rem; padding-bottom: 3rem; }
  .mag-title { margin-bottom: 0.9rem; }
  .mag-bar { flex-wrap: nowrap; gap: 6px; }
  .mag-ctl .k { display: none; }
  .mag-ctl, .mag-filter { min-height: 34px; padding: 0 0.6rem; gap: 0.4rem; font-size: 0.72rem; }
  .mag-ctl select { font-size: 0.72rem; }
  .mag-filter .dots i { width: 8px; height: 8px; }
  /* fine rows (16px + 8px gap) so card heights can be tuned in small steps: 8 = place, 11 = medium, 16 = large, 18 = main */
  .mag-grid { --unit: 16px; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .mcard.k-show { grid-column: span 2; grid-row: span 16; }
  .mcard.k-show.s-hero { grid-row: span 18; }
  .mcard.k-show .intro { -webkit-line-clamp: 3; }
  .mcard.k-place { grid-column: span 1; grid-row: span 8; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; }
  .mcard.k-show:not(.s-w):not(.s-x) { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; }
  /* medium: full width, picture over the left half plus the gap, text aligned with the right half-width cards */
  .mcard.k-show.s-w, .mcard.k-show.s-x { grid-row: span 11; grid-template-rows: 1fr; grid-template-columns: calc(50% + 4px) minmax(0, 1fr); }
  .mcard.k-show.s-w .title, .mcard.k-show.s-x .title { font-size: 1.05rem; padding-right: 1.8rem; -webkit-line-clamp: 5; }
  .mcard.k-show.s-w .intro, .mcard.k-show.s-x .intro { -webkit-line-clamp: 7; }
  .mcard .title { font-size: 1.1rem; bottom: 0.65rem; padding: 0.65rem 2.25rem 0 0.75rem; }
  .mcard.k-place .title { -webkit-line-clamp: 4; }
  .s-hero .title { font-size: 1.55rem; padding-right: 3.5rem; }
  .mcard .info { padding: 0.55rem 0.7rem 0.65rem; }
  .mcard.k-place .intro, .mcard.k-place .dates { display: none; }
  .mcard .label { top: 0.45rem; left: 0.45rem; font-size: 0.6rem; }
}

/* ---- Behind an open sheet: the whole page goes dark, tinted with the category colour.
   The scrim lives inside .mag (below the title, above the grid and the background mosaic); the page does not scroll meanwhile. ---- */
.mag { scrollbar-gutter: stable; }
.mag.detail-open { overflow-y: hidden; }
.mag-title { position: relative; z-index: 2; }
.detail-scrim { position: fixed; inset: 0; z-index: 1; background: color-mix(in srgb, var(--cat, #EB1E81) 28%, #04060a); opacity: 0; pointer-events: none; transition: opacity 420ms ease; }
.detail-scrim.on { opacity: 0.86; pointer-events: auto; }

/* ---- Detail sheet: the map's sheet, in light ---- */
.detail-sheet { --panel-solid: #fff; --ink: #11151d; --muted: #3a4150; --dim: #6a7282; --soft-line: rgba(17, 21, 29, 0.12); --accent-ink: #b3125f; color: var(--ink); }
.detail-sheet .close { color: #fff; }
.detail-sheet .detail-current-note, .detail-sheet .detail-current-note p, .detail-sheet .detail-body .detail-current-note p, .detail-sheet .detail-more-toggle, .detail-sheet .museumkaart-flag { color: var(--accent-ink); }
.detail-sheet .museumkaart-flag { border-color: var(--accent-ink); }
.detail-sheet .access-note strong { color: var(--ink); }
.detail-sheet .artist-list .pill { background: rgba(17, 21, 29, 0.07); color: var(--muted); }
.detail-sheet .artist-list .pill.category-pill { background: var(--pill-color); color: var(--pill-ink); }
.detail-sheet .info-tile, .detail-sheet .sources-list { background: #eef0f4; border-color: transparent; }
.detail-sheet .detail-actions .secondary-action { background: #11151d; color: #fff; }
.detail-sheet .photo-strip button { background: #eef0f4; }
/* phone: the strip bleeds to the sheet edges; the arrow marks more photos to the right */
/* the strip is a flex row of wide pictures: the single column must not grow to fit it */
.detail-body { grid-template-columns: minmax(0, 1fr); }
.photo-strip-wrap { position: relative; min-width: 0; margin: -0.1rem -1rem 0; }
.detail-sheet .photo-strip { margin: 0; }
.strip-more { position: absolute; top: 0; right: 0; width: 64px; height: 100px; display: flex; align-items: center; justify-content: flex-end; padding: 0 0.5rem 0 0; border: 0; background: linear-gradient(to left, rgba(4, 6, 10, 0.55), transparent); color: #fff; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 220ms ease; }
.strip-more span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(4, 6, 10, 0.72); font-size: 1.5rem; line-height: 1; padding-bottom: 3px; }
.photo-strip-wrap.has-more .strip-more { opacity: 1; pointer-events: auto; }
.detail-sheet .sources-list a { color: var(--ruhrtriennale); }
.detail-desc-full { display: none; }

/* tablet and up: covers the frosted column, "What's on" stays visible above it; no "more" toggle, all text shown */
@media (min-width: 700px) {
  .detail-sheet { top: var(--sheet-top, 13rem); bottom: 1.2rem; left: var(--sheet-left, 76px); right: auto; width: var(--sheet-w, calc(100vw - 108px)); max-height: none; border-radius: 20px; transform: translateY(calc(100% + 3rem)); box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45); }
  .detail-sheet.open { transform: none; }
  .detail-sheet .detail-hero { min-height: 300px; padding: 6.5rem 4.5rem 1.8rem 1.4rem; }
  .detail-sheet .detail-hero h2 { font-size: 2.2rem; max-width: 900px; }
  .detail-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr; align-items: start; column-gap: 1.6rem; padding: 1.4rem 1.4rem 2rem; }
  .detail-body > * { grid-column: 2; }
  .detail-body > .detail-description-group { grid-column: 1; grid-row: 1 / -1; gap: 0.75rem; }
  .detail-sheet .detail-body p { font-size: 1rem; line-height: 1.65; }
  .detail-sheet .detail-description-clamp { display: none; }
  .detail-sheet .detail-desc-full { display: grid; gap: 0.85rem; }
  .detail-sheet .detail-rest, .detail-sheet .detail-more-toggle { display: none; }
  .detail-sheet .detail-more-content, .detail-sheet .detail-more-content[hidden] { display: grid; gap: 0.85rem; }
  .detail-sheet .info-grid { grid-template-columns: minmax(0, 1fr); }
  /* photos lead the right column; a thin scrollbar stays visible so mouse users can see the strip scrolls */
  .photo-strip-wrap { margin: 0; border-radius: 8px; overflow: hidden; }
  .strip-more { height: 130px; }
  .detail-sheet .photo-strip { margin: 0; padding: 0; scrollbar-width: thin; scrollbar-color: rgba(17, 21, 29, 0.35) transparent; }
  .detail-sheet .photo-strip::-webkit-scrollbar { display: block; height: 6px; }
  .detail-sheet .photo-strip::-webkit-scrollbar-thumb { border-radius: 3px; background: rgba(17, 21, 29, 0.35); }
  .detail-sheet .photo-strip button, .detail-sheet .photo-strip img { height: 130px; }
}
@media (min-width: 850px) {
  .detail-body { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
  .detail-sheet .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .duo img, .duo .tint, .mosaic .tile img.n { transition: none; }
  .mcard:hover .duo img, .mcard:focus-within .duo img { transform: none; }
}
