/* ── Typography ───────────────────────────────────────── */
/*                                                          */
/*  To brand this app with your own fonts:                  */
/*    1. Copy the font files (.otf / .ttf / .woff2) into    */
/*       the  public/fonts/  folder.                        */
/*    2. Declare the font with @font-face (see example).    */
/*    3. Replace the font name in the variables below.      */
/*                                                          */
/*  Example (add before :root):                             */
/*                                                          */
/*    @font-face {                                          */
/*      font-family: "MyBrand";                             */
/*      src: url("fonts/MyBrand-Regular.woff2");            */
/*    }                                                     */
/*                                                          */
/*  Then set:  --font-body: "MyBrand", sans-serif;          */

/* ── Custom fonts ────────────────────────────────────── */
@font-face {
  font-family: "BFHRegular";
  src:url("fonts/FF Unit Pro Light.woff");
}
@font-face {
  font-family: "BFHTitle";
  src:url("fonts/FF Unit Rounded Pro Medium.woff");
}

/* ── Design tokens ────────────────────────────────────── */
:root {
  /* Brand Colors */
 --color-bfh-primary: #4b647d;
 --color-bfh-primary-rgb: 75 100 125;

 --color-bfh-primary-light: #697d91;
 --color-bfh-primary-light-rgb: 105 125 145;

 --color-bfh-gray-light: #a2aeb9;
 --color-bfh-gray-light-rgb: 162 174 185;

 --color-bfh-gray: #c1c9d1;
 --color-bfh-gray-rgb: 193 201 209;

 --color-bfh-gray-lighter: #eff1f3;
 --color-bfh-gray-lighter-rgb: 239 241 243;

 --color-bfh-secondary-rollover: #ffbb02;
 --color-bfh-secondary-rollover-rgb: 255 187 2;

 --color-bfh-secondary: #ffcb3e;
 --color-bfh-secondary-rgb: 255 203 62;

 --color-bfh-secondary-inactive: #ffd666;
 --color-bfh-secondary-inactive-rgb: 255 214 102;

 --color-bfh-icons-menu: #f1be27;
 --color-bfh-icons-menu-rgb: 241 190 39;

 --color-bfh-white: #fff;
 --color-bfh-white-rgb: 255 255 255;

 --color-bfh-black: #000;
 --color-bfh-black-rgb: 0 0 0;

 --color-bfh-dunkelgruen: #556455;
 --color-bfh-dunkelgruen-rgb: 85 100 85;

 --color-bfh-dunkelblau: #506e96;
 --color-bfh-dunkelblau-rgb: 80 110 150;

 --color-bfh-dunkelviolett: #645078;
 --color-bfh-dunkelviolett-rgb: 100 80 120;

 --color-bfh-dunkelocker: #786450;
 --color-bfh-dunkelocker-rgb: 120 100 80;

 --color-bfh-dunkelrot: #b41428;
 --color-bfh-dunkelrot-rgb: 180 20 40;


  /* Colors */
  --color-bg:              var(--color-bfh-black);
  --color-text:            var(--color-bfh-gray-lighter);
  --color-text-muted:      var(--color-bfh-light);
  --color-text-dim:        var(--color-bfh-gray);
  --color-accent:          var(--color-bfh-icons-menu);
  --color-error:           var(--color-bfh-dunkelrot);
  --color-panel-bg:        rgb(var(--color-bfh-black-rgb) / 0.85);
  --color-panel-header-bg: #2a2a2a;
  --color-bubble-bg:       #333;
  --color-border:          #444;

  --color-overlay-bg:      rgb(var(--color-bfh-black-rgb) / 0.7);
  --color-surface-subtle:  var(--color-bfh-primary);
  /*--color-surface-subtle:  rgba(255, 255, 255, 0.1);*/
  --color-surface-active:  rgb(var(--color-bfh-white-rgb) / 0.25);

  --opacity-polygon-regular: 0.2;
  --opacity-polygon-hover: 0.5;
  --thumbnail-dim-opacity: 0.65;
  --color-polygon-fill:        rgba(255, 220, 50, var(--opacity-polygon-regular));
  --color-polygon-stroke:      rgba(255, 220, 50, 0.8);
  --color-polygon-fill-hover:  rgba(255, 220, 50, var(--opacity-polygon-hover));
  --color-polygon-fill-active: rgba(255, 220, 50, var(--opacity-polygon-hover));
  --width-polygon-stroke: 1;

  /* Transition durations */
  --duration-fast:   0.2s;
  --duration-medium: 0.25s;
  --duration-slow:   0.3s;

  /* Shared values */
  --radius-img:  8px;
  --spacing-img: 12px 0;

  /* Fonts — replace the quoted name with your local font   */
  --font-body: "BFHRegular", sans-serif;   /* UI & body text */
  --font-accent: "BFHTitle", serif;          /* decorative / serif uses */
  --font-size-small: 0.85rem;
  --font-size-medium: 1.1rem;
  --font-size-large: 1.4rem;
}

/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-medium);;
  touch-action: manipulation; /* prevents 300ms tap delay on touch screens */
}


/* ── App shell ────────────────────────────────────────── */
#app {
  width: 100vw; height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ── Loading screen ───────────────────────────────────── */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  font-size: var(--font-size-large);
  color: var(--color-text-muted);
}

/* ── Content viewer: image + SVG overlay wrapper ─────── */
.content-viewer {
  position: relative;
  width: 100vw; height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.content-viewer img.exhibit-image {
  max-width: 100%; max-height: 100%;
  display: block;
  object-fit: contain;
  /* Ensures the image never stretches; SVG overlay mirrors its actual size */
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Polygon SVG overlay ──────────────────────────────── */
.polygon-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; /* the SVG itself doesn't block touches */
}

.polygon-overlay polygon {
  fill: var(--color-polygon-fill);
  stroke: var(--color-polygon-stroke);
  stroke-width: var(--width-polygon-stroke);
  cursor: pointer;
  pointer-events: all; /* only the polygons capture touches */
  transition: fill var(--duration-fast);
}

.polygon-overlay polygon:hover,
.polygon-overlay polygon:focus {
  fill: var(--color-polygon-fill-hover);
  outline: none;
}

/* Touch devices: use :active instead of :hover */
.polygon-overlay polygon:active {
  fill: var(--color-polygon-fill-active);
}

/* ── Popup panel ──────────────────────────────────────── */
.popup-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-overlay-bg);
  display: flex;
  align-items: stretch;
  justify-content: center;
  z-index: 100;
  animation: fade-in var(--duration-fast) ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.popup-panel {
  background: var(--color-panel-bg);
  border-radius: 16px 16px 0 0;
  width: 100%;
  /*max-height: 88vh;*/
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
  padding: 24px 24px 48px 40px;
  position: relative;
  overflow: hidden;
  animation: pop-up var(--duration-slow) ease-in-out;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes pop-up {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.popup-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--color-surface-subtle);
  border: none;
  color: var(--color-text);
  font-size: var(--font-size-large);
  line-height: 1;
  width: 48px; height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  z-index: 2;
}

/* When the close button is a direct child of the panel (no right panel),
   keep it anchored to the panel's top-right corner. */
.popup-panel > .popup-close-btn {
  top: 12px;
  right: 16px;
}

.popup-close-btn:active {
background: var(--color-surface-active);
}

/* Markdown content inside popup */
.popup-content h1, .popup-content h2, .popup-content h3 {
  margin: 1em 0 0.4em;
}

.popup-content h2, .popup-content h3 {
  color: var(--color-bfh-primary-light);
}

.popup-content h1 {
  color: var(--color-accent );
}

.popup-content p {
    margin: 0.6em 0;
    line-height: 1.65;
}

.popup-content ul, .popup-content ol {
   margin: 0.6em 0 0.6em 1.6em;
}

.popup-content table {
  border-collapse: collapse;
  margin: 1em 0;
  width: 100%;
}

.popup-content th, .popup-content td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  text-align: left;
}

.popup-content th {
    background: var(--color-panel-header-bg);
    color: var(--color-accent);
}

.popup-content blockquote {
  border-left: 4px solid var(--color-accent);
  margin: 1em 0;
  padding: 0.4em 1em;
  color: var(--color-text-dim);
  font-style: italic;
}

.popup-content {
  flex: 1;
  overflow-y: auto;
  min-width: 0; /* prevents flex item from overflowing */
}

.popup-content img {
  max-width: 100%;
  border-radius: var(--radius-img);
  margin: var(--spacing-img);
    padding: 0 8px;
}

/* Right column: thumb area + zoom canvas + node image */
.popup-image-wrapper {
  flex-shrink: 0;
  width: 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  overflow-y: auto;
}

.popup-image-wrapper img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-img);
}

/* Container that holds the thumbnail canvas and the close button overlay. */
.popup-thumb-area {
  position: relative;
  /*width: 180px;*/
  flex-shrink: 0;
}

/* Thumbnail canvas: spotlight preview of the tapped polygon region.
   Clicking it closes the popup. */
.popup-thumbnail {
  display: block;
  width: 100%;
  border-radius: var(--radius-img);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  animation: fade-in var(--duration-medium) ease;
}

.popup-thumbnail:hover {
  opacity: 0.85;
  transition: opacity var(--duration-fast);
}

/* Bounding-box zoom canvas: cropped detail of the tapped polygon area.
   Shown when the child node has no image of its own. Fills the right half. */
.popup-zoom-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 50vh;
  border-radius: var(--radius-img);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  animation: fade-in var(--duration-medium) ease;
}

/* ── Depth-limit message ──────────────────────────────── */
.depth-limit-message {
  position: fixed;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  pointer-events: none;
}

.depth-limit-bubble {
  background: var(--color-bubble-bg);
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
  border-radius: 12px;
  padding: 20px 36px;
  font-size: var(--font-size-medium);
  max-width: 480px;
  text-align: center;
  pointer-events: none;
  animation: fade-in var(--duration-fast) ease, fade-out var(--duration-slow) ease 2.5s forwards;
}

@keyframes fade-out {
  to { opacity: 0; }
}

/* ── Top bar (full-screen overlay, children positioned independently) ── */
.top-bar {
  position: fixed;
  inset: 0;
  pointer-events: none; /* pass touches through to the exhibit */
  z-index: 200;
}

/* Home button: top-left */
.home-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  pointer-events: auto;
}

/* ── Language switcher: bottom center ────────────────── */
.lang-switcher {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.lang-btn {
  background: var(--color-surface-subtle);
  border: 1px solid transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--font-size-small);
  font-weight: 700;
  letter-spacing: 0.06em;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}

.lang-btn.active {
  background: var(--color-accent);
  color: #111;
  border-color: var(--color-accent);
}

.lang-btn:not(.active):hover,
.lang-btn:not(.active):focus {
  background: var(--color-surface-active);
  color: var(--color-text);
  outline: none;
}

.lang-btn:not(.active):active {
  background: var(--color-surface-active);
}

/* ── Home button ──────────────────────────────────────── */
.home-btn {
  background: var(--color-surface-subtle);
  border: none;
  color: var(--color-text);
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background var(--duration-fast), color var(--duration-fast);
}

.home-btn svg {
  width: 22px; height: 22px;
  pointer-events: none;
}

.home-btn:hover,
.home-btn:focus {
  background: var(--color-accent);
  color: #111;
  outline: none;
}

.home-btn:active {
  background: var(--color-surface-active);
}

.home-btn[hidden] { display: none; }

/* ── Info button: bottom-right ────────────────────────── */
.info-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  pointer-events: auto;
  background: var(--color-surface-subtle);
  border: 1px solid transparent;
  color: var(--color-text-muted);
  font-family: var(--font-accent);
  font-size: var(--font-size-small);
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.02em;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}

.info-btn:hover,
.info-btn:focus {
  background: var(--color-accent);
  color: #111;
  border-color: var(--color-accent);
  outline: none;
}

.info-btn:active {
  background: var(--color-surface-active);
}

/* ── Welcome modal (centered on open / idle reset) ───── */
.welcome-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: fade-in var(--duration-fast) ease;
}

.welcome-panel {
  background: var(--color-panel-bg);
  border-radius: 16px;
  width: min(960px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 64px 40px 40px;
  position: relative;
  overflow: hidden;
  animation: scale-in var(--duration-medium) ease;
}

.welcome-panel .popup-content {
  overflow-y: auto;
  flex: 1;
}

@keyframes scale-in {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* ── Error state ──────────────────────────────────────── */
.error-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; text-align: center; padding: 40px;
  color: var(--color-error);
}

.error-screen h2 {
    font-size: var(--font-size-large);
    margin-bottom: 12px; }
.error-screen p  {
    font-size: var(--font-size-medium);
    color: var(--color-text-muted);
    }

/* --- Image siting ---*/
img[alt=pngegg] { width: 200px; float:left;}
img[alt=img1997] { float:right; width: 50%; height: 50%;}
img[alt=solar_panels] { float:left; width: 25%; height: 25%;}

/* ── Zone toggle button columns ───────────────────────── */
/*
 * Two vertical columns pinned to the left and right edges of the viewer.
 * Buttons are ordered top-to-bottom by the `order` frontmatter variable.
 * Column assignment is controlled by the `column` frontmatter variable
 * (value: "left" | "right") in each sub-node's DESCRIPTION file.
 */
.zone-buttons {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  z-index: 10;
}

.zone-buttons--left {
  left: 20px;
  align-items: flex-start;
}

.zone-buttons--right {
  right: 20px;
  align-items: flex-end;
}

.zone-btn {
  background: var(--color-surface-subtle);
  border: 1px solid transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-small);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast), opacity var(--duration-fast);
  opacity: 0.6;
  white-space: nowrap;
}

.zone-buttons--right .zone-btn {
  text-align: right;
}

.zone-btn.active {
  background: var(--color-accent);
  color: #111;
  border-color: var(--color-accent);
  opacity: 1;
}

.zone-btn:not(.active):hover,
.zone-btn:not(.active):focus {
  background: var(--color-surface-active);
  outline: none;
  opacity: 0.85;
}

/* Hidden polygon zone — toggled by zone buttons */
.polygon-overlay polygon.zone-hidden {
  display: none;
}

/* ── Splide slideshow ─────────────────────────────────── */

/* Container — wraps main carousel + thumbnail strip */
.splide-container {
  width: 100%;
  margin: 1.5rem 0;
}

/* Layout options set from [[SLIDES: ... align=X width=Y]] */
.splide-container.align-left   { margin-right: auto; }
.splide-container.align-center { margin-left: auto; margin-right: auto; }
.splide-container.align-right  { margin-left: auto; }

.splide-container.width-small  { max-width: 420px; }
.splide-container.width-medium { max-width: 720px; }
.splide-container.width-full   { max-width: 100%; }

/* ── Slide content ──────────────────────────────────── */
.splide-container .splide__slide {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  overflow: hidden;
}

.splide-container .splide__slide h2 {
    font-family: var(--font-accent), sans-serif;
  font-size: var(--font-size-medium);
  color: var(--color-accent);
  margin: 0;
}

.splide-container .splide__slide p {
  font-size: var(--font-size-small);
  color: var(--color-text);
  margin: 0;
  line-height: 1.5;
}

.splide-container .splide__slide img {
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
  border-radius: var(--radius-img);
}

.splide-container .splide__slide video {
  width: 100%;
  max-height: 55vh;
  border-radius: var(--radius-img);
  background: #000;
}

/* Placeholder for slides with no media */
.splide-no-media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  border-radius: var(--radius-img);
  background: var(--color-panel-header-bg);
  color: var(--color-text-dim);
  font-size: var(--font-size-small);
}

/* ── Thumbnail strip ────────────────────────────────── */
.splide-container .splide--thumbnails {
  margin-top: 8px;
}

.splide-container .splide--thumbnails .splide__slide {
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--duration-fast);
}

.splide-container .splide--thumbnails .splide__slide.is-active {
  border-color: var(--color-accent);
}

.splide-container .splide--thumbnails .splide__slide img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 2px;
}

/* Video / empty thumbnail icon */
.splide-thumb-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-panel-header-bg);
  color: var(--color-text-dim);
  font-size: 1.1rem;
  border-radius: 2px;
}

/* ── Splide chrome overrides (colors only) ────────────── */
.splide-container .splide__arrow {
  background: rgb(var(--color-bfh-black-rgb) / 0.6);
  opacity: 1;
}

.splide-container .splide__arrow:hover {
  background: rgb(var(--color-bfh-black-rgb) / 0.85);
}

.splide-container .splide__arrow svg {
  fill: var(--color-accent);
}

.splide-container .splide__pagination__page {
  background: var(--color-border);
}

.splide-container .splide__pagination__page.is-active {
  background: var(--color-accent);
  transform: scale(1.25);
}
