/* ==========================================================================
   GALLERY – "Explore canvas"
   Site palette & type only. Spacing uses the Fibonacci scale
   (5 · 8 · 13 · 21 · 34 · 55 · 89 px); the detail view splits 1.618 : 1.
   ========================================================================== */
.ex,
.ex-detail {
  --g1: 5px;
  --g2: 8px;
  --g3: 13px;
  --g4: 21px;
  --g5: 34px;
  --g6: 55px;
  --g7: 89px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.ex {
  position: relative;
  height: 400vh;                         /* real height set by attractions.js: one full turn of scrolling */
  background-color: var(--color-cream);
}

.ex-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Canvas: dotted, map-like surface that pans with the cards
   -------------------------------------------------------------------------- */
.ex-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background-image: radial-gradient(rgba(6, 95, 70, 0.2) 1.1px, transparent 1.5px);
  background-size: var(--g4) var(--g4);
  background-position: var(--bgx, 0px) var(--bgy, 0px);
  cursor: grab;
  outline: none;
}

.ex-canvas.is-dragging { cursor: grabbing; }
.ex-canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--color-green); }


.ex-canvas::after {                      /* soft fade into the page at the sides and bottom */
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(237, 238, 223, 0.95), rgba(237, 238, 223, 0) 14%, rgba(237, 238, 223, 0) 86%, rgba(237, 238, 223, 0.95)),
    linear-gradient(180deg, rgba(237, 238, 223, 0) 82%, rgba(237, 238, 223, 0.85));   /* bottom only: no haze under the menu bar */
}

.ex-plane {
  position: absolute;
  inset: 0;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.ex-card,
.ex-ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw, 280px);
  display: block;
  padding: 0;
  text-align: left;
  opacity: 0;
  /* Flat position, plus the sphere bend while panning sideways (set by attractions.js) */
  transform: translate3d(var(--x, 0px), var(--y, 0px), 0) perspective(900px) rotateY(var(--ry, 0deg)) scale(var(--s, 1));
  transform-origin: 50% 50%;
  will-change: transform;
  transition: opacity 0.6s ease, filter 0.5s ease;
}

/* Soft shadow boxes that fill the empty cells */
.ex-ghost {
  aspect-ratio: var(--ar, 4 / 3);
  border-radius: var(--g3);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.55), rgba(237, 238, 223, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 var(--g4) var(--g5) calc(var(--g4) * -1) rgba(6, 95, 70, 0.32);
  pointer-events: none;
}

.ex.is-ready .ex-ghost { opacity: 1; }

.ex.is-ready .ex-card { opacity: 1; }
.ex-card.is-muted { opacity: 0.1 !important; filter: grayscale(1); pointer-events: none; }

.ex-card__media {
  position: relative;
  display: block;
  aspect-ratio: var(--ar, 4 / 3);
  overflow: hidden;
  border-radius: var(--g3);
  background: var(--color-green-dark);
  box-shadow: 0 var(--g4) var(--g5) calc(var(--g4) * -1) rgba(6, 95, 70, 0.55);
  transition: box-shadow 0.4s ease, transform 0.5s var(--ease);
}

.ex-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.8s var(--ease), filter 0.5s ease;
  pointer-events: none;
}

.ex-card:hover .ex-card__media,
.ex-card:focus-visible .ex-card__media {
  transform: translateY(calc(var(--g2) * -1));
  box-shadow: 0 var(--g5) var(--g6) calc(var(--g4) * -1) rgba(6, 95, 70, 0.7);
}

.ex-card:hover .ex-card__media img,
.ex-card:focus-visible .ex-card__media img { transform: scale(1.1); }

.ex-card:focus-visible { outline: none; }
.ex-card:focus-visible .ex-card__media { box-shadow: 0 0 0 3px var(--color-lime), 0 var(--g5) var(--g6) calc(var(--g4) * -1) rgba(6, 95, 70, 0.7); }

.ex-card__cap {
  display: flex;
  align-items: baseline;
  gap: var(--g2);
  padding: var(--g3) var(--g1) 0;
}

.ex-card__num {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-green);
}

.ex-card__title {
  flex: 1;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.15;
  color: var(--color-green-dark);
}

.ex-card__tag {
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted-light);
}

/* --------------------------------------------------------------------------
   Filter strip (top centre)
   -------------------------------------------------------------------------- */
.ex-dock {
  position: absolute;
  left: 50%;
  top: var(--g3);                       /* just under the menu bar */
  z-index: 5;
  display: flex;
  align-items: center;
  gap: var(--g2);
  padding: var(--g1);
  border-radius: 9999px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(var(--g4)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--g4)) saturate(1.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 var(--g4) var(--g5) calc(var(--g4) * -1) rgba(6, 95, 70, 0.45);
}

.ex-filters {
  position: relative;
  display: flex;
}

.ex-filters button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  padding: var(--g2) var(--g4);
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
  transition: color 0.3s ease;
}

.ex-filters button:hover { color: var(--color-green); }
.ex-filters button.is-active { color: var(--color-white); }

.ex-filters__pill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pill-x, 0px);
  width: var(--pill-w, 0px);
  border-radius: 9999px;
  background: var(--color-green);
  transition: left 0.5s var(--ease), width 0.5s var(--ease);
}




.ex-filters button:focus-visible { outline: 2px solid var(--color-green); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Detail view: photo 1.618 : text 1
   -------------------------------------------------------------------------- */
.ex-detail {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);
  gap: var(--g5);
  padding: var(--g4);
  background: rgba(237, 238, 223, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: background-color 0.5s ease, backdrop-filter 0.5s ease, -webkit-backdrop-filter 0.5s ease;
}

.ex-detail[hidden] { display: none; }   /* `display: grid` above would otherwise override the hidden attribute */

.ex-detail.is-open {
  background: rgba(237, 238, 223, 0.94);
  backdrop-filter: blur(var(--g4));
  -webkit-backdrop-filter: blur(var(--g4));
}

.ex-detail__media {
  position: relative;
  overflow: hidden;
  border-radius: var(--g4);
  opacity: 0;
}

.ex-detail.is-settled .ex-detail__media { opacity: 1; }

.ex-detail__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.35s ease;
}

.ex-detail__info {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: var(--g6) var(--g4) 0 0;
  opacity: 0;
  transform: translateX(var(--g5));
  transition: opacity 0.5s ease 0.15s, transform 0.7s var(--ease) 0.15s;
}

.ex-detail.is-open .ex-detail__info { opacity: 1; transform: none; }

.ex-detail__close {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: var(--g5);
  height: var(--g5);
  border-radius: 50%;
  background: var(--color-white);
  color: var(--color-green-dark);
  box-shadow: 0 var(--g1) var(--g3) rgba(0, 0, 0, 0.1);
  transition: transform 0.35s var(--ease), background-color 0.3s ease, color 0.3s ease;
}

.ex-detail__close:hover { transform: rotate(90deg); background: var(--color-green); color: var(--color-white); }

.ex-detail__meta { display: flex; align-items: center; gap: var(--g2); }

.ex-tag {
  display: inline-flex;
  padding: var(--g1) var(--g3);
  border-radius: 9999px;
  background: var(--color-lime);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-dark);
}

.ex-detail__num {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted);
}

.ex-detail__title {
  margin: var(--g3) 0 var(--g4);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2rem, 3.4vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--color-green-dark);
}

.ex-detail__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: var(--g2);
  scrollbar-width: thin;
  scrollbar-color: rgba(6, 95, 70, 0.25) transparent;
}

.ex-teaser {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--color-dark);
}

.ex-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--g2);
  margin: var(--g3) 0 var(--g4);
  list-style: none;
}

.ex-chips li {
  padding: var(--g1) var(--g3);
  border-radius: 9999px;
  background: rgba(6, 95, 70, 0.08);
  border: 1px solid rgba(6, 95, 70, 0.12);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-green-dark);
}

.ex-facts { list-style: none; counter-reset: fact; }

.ex-facts li {
  position: relative;
  padding: var(--g3) 0 var(--g3) var(--g5);
  border-top: 1px solid rgba(6, 95, 70, 0.12);
  font-family: var(--font-body);
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--color-muted);
  counter-increment: fact;
}

.ex-facts li::before {
  content: counter(fact, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: var(--g3);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.6rem;
  color: var(--color-green);
}

.ex-detail__nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--g2);
  padding: var(--g4) 0;
}

.ex-detail__nav button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--g3) var(--g4);
  border-radius: var(--g3);
  text-align: left;
  background: var(--color-white);
  border: 1px solid rgba(6, 95, 70, 0.1);
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.35s var(--ease);
}

.ex-detail__nav button:last-child { text-align: right; }

.ex-detail__nav span {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.ex-detail__nav strong {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-green-dark);
}

.ex-detail__nav button:hover { background: var(--color-green); transform: translateY(-2px); }
.ex-detail__nav button:hover span,
.ex-detail__nav button:hover strong { color: var(--color-white); }

.ex-fly {                                /* the photo flying between card and detail */
  position: fixed;
  z-index: 1200;
  object-fit: cover;
  pointer-events: none;
}


/* --------------------------------------------------------------------------
   Linear listing (one category picked): photo 1 : text 1.618, alternating
   -------------------------------------------------------------------------- */
.ex.is-linear { height: auto !important; }

.ex.is-linear .ex-stage {                /* only the filter strip remains, pinned at the top */
  z-index: 5;
  height: auto;
  min-height: 0;
  padding: var(--g3) var(--g3) 0;
  overflow: visible;
  pointer-events: none;
}

.ex.is-linear .ex-canvas { display: none; }

/* Slide down with the header when it comes back, so the strip is never under it */
body:has(.site-header:not(.is-hidden)) .ex.is-linear .ex-stage { top: var(--hdr, 0px); }
.ex.is-linear .ex-stage { transition: top 0.45s cubic-bezier(0.16, 1, 0.3, 1); }

.ex.is-linear .ex-dock {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  transform: none;
  pointer-events: auto;
}

/* Second level: smaller frosted chips for the groups inside the picked category */
.ex-subdock {
  display: flex;
  justify-content: center;
  gap: var(--g2);
  width: max-content;
  max-width: 100%;
  margin: var(--g2) auto 0;
  pointer-events: auto;
  animation: ex-sub-in 0.45s var(--ease) both;
}
.ex-subdock[hidden] { display: none; }

@keyframes ex-sub-in {
  from { opacity: 0; transform: translateY(calc(var(--g2) * -1)); }
}

.ex-subdock button {
  display: inline-flex;
  align-items: center;
  gap: var(--g1);
  padding: var(--g1) var(--g3);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(var(--g3)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--g3)) saturate(1.2);
  box-shadow: 0 var(--g3) var(--g4) calc(var(--g3) * -1) rgba(6, 95, 70, 0.4);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-green-dark);
  white-space: nowrap;
  transition: background-color 0.3s ease, transform 0.3s var(--ease);
}
.ex-subdock button:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.85); }
.ex-subdock button.is-active { background: var(--color-lime); border-color: var(--color-lime); color: var(--color-dark); }
.ex-subdock button:focus-visible { outline: 2px solid var(--color-green); outline-offset: 2px; }

.ex-subdock__n {
  min-width: 1.4em;
  padding: 0 var(--g1);
  border-radius: 9999px;
  background: rgba(6, 95, 70, 0.1);
  font-size: 0.7rem;
  text-align: center;
  color: var(--color-muted);
}
.ex-subdock button.is-active .ex-subdock__n { background: rgba(6, 95, 70, 0.16); color: var(--color-dark); }

.ex-list { padding: var(--g6) 0 var(--g7); }

.ex-list__kicker {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-green);
}

.ex-list__title {
  margin: var(--g2) 0 var(--g5);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
  color: var(--color-green-dark);
}

.ex-list__count {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
  vertical-align: middle;
}

.ex-list__rows { list-style: none; }

.ex-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.618fr);
  gap: var(--g6);
  align-items: center;
  padding: var(--g6) 0;
  border-top: 1px solid rgba(6, 95, 70, 0.12);
  opacity: 0;
  transform: translateY(var(--g5));
  transition: opacity 0.7s ease calc(var(--k, 0) * 90ms), transform 0.9s var(--ease) calc(var(--k, 0) * 90ms);
}

.ex-row.is-in { opacity: 1; transform: none; }

.ex-row--flip { grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr); }
.ex-row--flip .ex-row__media { order: 2; }

.ex-row__media {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--g4);
  background: var(--color-green-dark);
  box-shadow: 0 var(--g4) var(--g6) calc(var(--g4) * -1) rgba(6, 95, 70, 0.45);
}

.ex-row__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}

.ex-row:hover .ex-row__media img { transform: scale(1.05); }

.ex-row__meta { display: flex; align-items: center; gap: var(--g2); }

.ex-row__num {
  display: grid;
  place-items: center;
  width: var(--g5);
  height: var(--g5);
  border-radius: 50%;
  background: var(--color-lime);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-dark);
}

.ex-row__tag {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.ex-row__title {
  margin: var(--g3) 0 var(--g2);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.6rem, 2.6vw, 2.3rem);
  line-height: 1.1;
  color: var(--color-green-dark);
}

/* --------------------------------------------------------------------------
   Phones
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .ex-dock {
    left: var(--g3);
    right: var(--g3);
    top: var(--g2);
    transform: none;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .ex-dock::-webkit-scrollbar { display: none; }
  .ex-filters button { padding: var(--g2) var(--g3); }
  .ex-card__title { font-size: 0.95rem; }
  .ex-card__tag { display: none; }
  .ex-detail {
    grid-template-columns: 1fr;
    grid-template-rows: 38svh minmax(0, 1fr);
    gap: var(--g4);
    padding: var(--g3);
  }
  .ex-detail__info { padding-top: var(--g2); }
  .ex-detail__close { top: auto; bottom: calc(100% + var(--g4) + var(--g3)); right: var(--g3); }
  .ex.is-linear .ex-dock { left: auto; right: auto; overflow-x: auto; }
  .ex-subdock { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding-bottom: var(--g2); }
  .ex-subdock::-webkit-scrollbar { display: none; }
  .ex-row,
  .ex-row--flip { grid-template-columns: 1fr; gap: var(--g4); padding: var(--g5) 0; }
  .ex-row--flip .ex-row__media { order: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ex-card,
  .ex-card__media,
  .ex-card__media img,
  .ex-detail,
  .ex-detail__info { transition-duration: 0.01s; }
  .ex-row { opacity: 1; transform: none; transition: none; }
  .ex-subdock { animation: none; }
}
