* { box-sizing: border-box; }

:root {
  --site-btn-size: 42px;
  --site-btn-radius: 12px;
  --site-btn-font: "IBM Plex Mono", "Avenir Next", "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --site-btn-border: rgba(178,188,206,0.72);
  --site-btn-border-hover: rgba(228,234,246,0.92);
  --bg-paper: #f2f1ec;
  --bg-ink: #141311;
  --panel-bg: rgba(255, 255, 255, 0.72);
  --panel-border: rgba(20, 19, 17, 0.14);
  --muted-text: rgba(20, 19, 17, 0.68);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 90% at 12% 8%, rgba(202, 111, 72, 0.20), rgba(202, 111, 72, 0) 46%),
    radial-gradient(90% 74% at 88% 16%, rgba(65, 93, 139, 0.14), rgba(65, 93, 139, 0) 52%),
    linear-gradient(165deg, #f7f5ee 0%, var(--bg-paper) 48%, #ece8df 100%);
  color: var(--bg-ink);
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body.viewer-open {
  overflow: hidden;
}

.lang-switch-fixed {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 10px;
  z-index: 3000;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(16, 20, 26, 0.18);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(8px) saturate(125%);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

body.exhibition-page .lang-switch-fixed {
  position: absolute;
  top: 18px;
  right: 18px;
  left: auto;
}

body.exhibition-page .wrap {
  position: relative;
}

body.viewer-open .lang-switch-fixed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
}

.lang-switch-fixed .lang-toggle {
  position: relative;
  width: 96px;
  height: var(--site-btn-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--site-btn-radius);
  border: 1px solid var(--site-btn-border);
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,0.16), rgba(255,255,255,0) 48%),
    linear-gradient(160deg, rgba(18,22,30,1), rgba(8,11,15,1));
  color: rgba(252,252,255,0.99);
  font-family: var(--site-btn-font);
  box-shadow: 0 8px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  cursor: pointer;
  user-select: none;
}

.lang-switch-fixed .lang-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.lang-switch-fixed .lang-toggle-track {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 38px;
  height: 28px;
  border-radius: 9px;
  background: rgba(242, 245, 252, 0.94);
  box-shadow: 0 2px 6px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.75);
  transition: transform 140ms ease;
}

.lang-switch-fixed .lang-toggle input:checked + .lang-toggle-track {
  transform: translateX(46px);
}

.lang-switch-fixed .lang-toggle-labels {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.55px;
  pointer-events: none;
}

.lang-switch-fixed .lang-toggle-labels span {
  text-align: center;
  color: rgba(252,252,255,0.85);
  transition: color 140ms ease;
}

.lang-switch-fixed .lang-toggle input:not(:checked) ~ .lang-toggle-labels span:first-child,
.lang-switch-fixed .lang-toggle input:checked ~ .lang-toggle-labels span:last-child {
  color: rgba(14,17,23,0.98);
}

.lang-switch-fixed .lang-toggle:focus-within {
  outline: none;
  border-color: var(--site-btn-border-hover);
  box-shadow: 0 0 0 2px rgba(228,234,246,0.26), 0 10px 18px rgba(0,0,0,0.44), inset 0 1px 0 rgba(255,255,255,0.24);
}

.lang-switch-fixed .lang-select.sr-only {
  position: absolute;
}

.wrap {
  max-width: 820px;
  margin: 120px auto 100px;
  padding: 44px 34px;
  border-radius: 24px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  box-shadow: 0 20px 52px rgba(24, 16, 14, 0.10);
  animation: fadeIn 600ms ease both;
}

h1 {
  margin: 0 0 28px;
  font-weight: 700;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 1.3px;
  line-height: 1.18;
}

.back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted-text);
  text-decoration: none;
  font-size: 14px;
}

.back:hover {
  color: rgba(20, 19, 17, 0.9);
}

.meta {
  margin: 0 0 28px;
  color: var(--muted-text);
  font-size: 14px;
  letter-spacing: 0.2px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.grid picture {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(20, 19, 17, 0.04);
}

.grid img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid rgba(20, 19, 17, 0.12);
  box-shadow: 0 8px 22px rgba(24, 16, 14, 0.10);
  cursor: pointer;
  object-fit: cover;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.grid img:hover {
  transform: translateY(-2px);
  border-color: rgba(20, 19, 17, 0.24);
  box-shadow: 0 14px 30px rgba(24, 16, 14, 0.14);
}


.exhibition-text {
  margin-top: 18px;
}

.exhibition-text p {
  margin: 0;
}

.site-footer {
  position: relative;
  margin-top: 44px;
  padding: 16px 16px 14px;
  border: 1px solid rgba(20, 19, 17, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(120% 120% at 8% 8%, rgba(98, 106, 124, 0.08), rgba(98, 106, 124, 0) 50%),
    radial-gradient(90% 90% at 92% 16%, rgba(130, 145, 170, 0.06), rgba(130, 145, 170, 0) 56%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.78), rgba(242, 241, 237, 0.72));
  box-shadow: 0 8px 22px rgba(24, 16, 14, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(6px) saturate(104%);
  color: rgba(20, 19, 17, 0.74);
  font-size: 11px;
  line-height: 1.55;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  overflow: hidden;
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.025), rgba(0, 0, 0, 0) 42%),
    radial-gradient(circle at 88% 88%, rgba(255, 255, 255, 0.11) 0 1px, transparent 1px 100%);
  background-size: auto, 4px 4px;
  pointer-events: none;
  opacity: 0.24;
}

.site-footer-copy,
.site-footer-contact,
.site-footer-note {
  position: relative;
  margin: 5px 0;
}

.site-footer-contact a,
.site-footer-legal a {
  color: rgba(20, 19, 17, 0.9);
  text-decoration: none;
  border-bottom: 1px solid rgba(20, 19, 17, 0.2);
  transition: border-color 140ms ease, color 140ms ease;
}

.site-footer-contact a:hover,
.site-footer-legal a:hover {
  color: rgba(20, 19, 17, 1);
  border-bottom-color: rgba(20, 19, 17, 0.62);
}

.site-footer-legal {
  position: relative;
  display: flex;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin: 10px 0 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(20, 19, 17, 0.2);
}

.site-footer-note {
  color: rgba(20, 19, 17, 0.6);
  max-width: 70ch;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .wrap {
    margin: 96px auto 70px;
    padding: 28px 20px;
    border-radius: 20px;
  }

  .meta {
    margin-bottom: 22px;
  }

  .grid {
    gap: 12px;
  }
}

@media (max-width: 700px) {
  .wrap {
    margin: 78px auto 44px;
    padding: 20px 14px 18px;
    border-radius: 18px;
  }

  h1 {
    margin-bottom: 18px;
    font-size: clamp(22px, 8vw, 30px);
  }

  .back,
  .meta {
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .grid picture {
    aspect-ratio: 5 / 4;
    border-radius: 14px;
  }

  .grid img {
    border-radius: 14px;
    object-position: center 38%;
    box-shadow: 0 6px 16px rgba(24, 16, 14, 0.08);
  }

  .exhibition-text {
    margin-top: 14px;
  }

  .exhibition-text p {
    max-width: 34ch;
    font-size: 11px;
    line-height: 1.7;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(20, 19, 17, 0.62);
  }

  .site-footer {
    margin-top: 28px;
    padding: 14px 12px 12px;
    font-size: 10px;
    line-height: 1.5;
    border-radius: 12px;
  }

  .site-footer-legal {
    gap: 8px 10px;
   }
}

@media (max-width: 420px) {
  .wrap {
    padding-left: 12px;
    padding-right: 12px;
  }

  .grid picture,
  .grid img {
    aspect-ratio: 1 / 1;
  }

  .grid img {
    object-position: center 34%;
  }
}

/* Viewer styles are loaded on demand by js/viewer/bootstrap.js */
#viewer {
  display: none;
}

@media (pointer: fine) {
  html.cursor-fx-on,
  html.cursor-fx-on * {
    cursor: none !important;
  }

  html.cursor-fx-on input,
  html.cursor-fx-on textarea,
  html.cursor-fx-on [contenteditable="true"] {
    cursor: text !important;
  }
}

#site-cursor-fx {
  position: fixed;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2147483647;
  opacity: 0;
  transform: translate(-9999px, -9999px) scale(0.92);
  transition: opacity 120ms ease;
  background:
    radial-gradient(68% 68% at 34% 30%, rgba(255,255,255,0.20), rgba(255,255,255,0) 64%),
    url('../exhibitions/chaotic-structure/memory-cursor-90.png') center / contain no-repeat;
  filter:
    drop-shadow(0 6px 10px rgba(0,0,0,0.30))
    drop-shadow(0 1px 0 rgba(255,255,255,0.20));
  will-change: transform;
}

#site-cursor-fx.is-on {
  opacity: 1;
}

#site-cursor-fx.is-down {
  filter:
    drop-shadow(0 3px 6px rgba(0,0,0,0.26))
    drop-shadow(0 1px 0 rgba(255,255,255,0.14));
}
