/* Layout: a full-screen survey map of the mountain with a trail sign, peak tags and a slide-in project panel.
   Single look built from clean black and white with neutral greys, set once so they work on any host theme. */
:root {
  /* The palette */
  --cafe: #111111;      /* black */
  --kombu: #111111;     /* black, accent */
  --moss: #6e6e6e;      /* subtle grey */
  --tan: #8a8a8a;       /* border grey */
  --bone: #ebebea;      /* light grey */
  /* Roles */
  --night: #f5f5f4;     /* off-white: page edges */
  --deep: #ffffff;      /* page centre */
  --glass: rgba(255, 255, 255, 0.9);   /* panels, route list and tags */
  --line: #e4e4e2;                     /* light border grey */
  --ink: var(--cafe);                  /* text */
  --muted: #545454;     /* muted grey: secondary text */
  --sign: var(--kombu); /* accent: trail signs, buttons, altitudes */
  --sign-ink: var(--bone);
  --blaze: var(--kombu);

  --display: "Young Serif", Georgia, serif;
  --body: "Work Sans", system-ui, -apple-system, sans-serif;
  --label: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Dark-theme equivalents, kept for a future dark mode */
  --dark-bg: #0e0e0e; --dark-surface: #161616; --dark-raised: #1f1f1f; --dark-ink: #f2f2f2;
  --dark-muted: #a8a8a8; --dark-subtle: #8c8c8c; --dark-border: #6e6e6e; --dark-line: #262626;

  --panel-w: 440px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 45%, var(--deep), var(--night) 70%);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--sign); }
:focus-visible { outline: 2px solid var(--sign); outline-offset: 3px; }

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#world.dragging { cursor: grabbing; }

/* ---------- Header ---------- */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 28px 36px;
  background: linear-gradient(var(--deep) 30%, rgba(255, 255, 255, 0));
  pointer-events: none;
}
.top > * { pointer-events: auto; }

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.05;
  text-shadow: 0 2px 18px rgba(255, 255, 255, 0.8);
}
.tagline {
  margin: 6px 0 0;
  font-family: var(--label);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.85;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.8);
}

/* About me: a round avatar button in the top-right corner */
.about-btn {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--kombu);
  border-radius: 50%;
  background: #fff;
  color: var(--kombu);
  font-family: var(--display);
  font-size: 1.05rem;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(17, 17, 17, 0.12);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.about-btn img { width: 100%; height: 100%; object-fit: cover; }
.about-btn:hover, .about-btn[aria-current="true"] { background: var(--kombu); color: var(--bone); }
.about-btn:hover { transform: scale(1.04); }

/* ---------- Route list (projects) ---------- */
.trail {
  position: fixed;
  left: 28px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  z-index: 5;
  width: 280px;
  padding: 14px 16px 8px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(17, 17, 17, 0.08);
}
.trail-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 6px;
  font-family: var(--label);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--muted);
}
.blaze { display: none; }
.trail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column-reverse; /* highest summit on top, read upward like a route */
}
.trail-list li + li { border-bottom: 1px solid var(--line); }
/* Each stop sits in its own box: number and name only */
/* No surrounding box or title: just the project boxes, with an arrow at their side to slide them away */
.trail { background: none; border: 0; box-shadow: none; backdrop-filter: none; padding: 0; width: 248px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.trail-head { position: absolute; left: 100%; bottom: 0; margin: 0 0 0 8px; }
.trail-fold { display: grid; place-items: center; width: 28px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.55); backdrop-filter: blur(8px); color: var(--muted); cursor: pointer; transition: transform 0.35s ease; }
.trail-fold:hover, .trail-fold:focus-visible { color: var(--kombu); border-color: var(--kombu); }
.trail-fold svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s ease; }
.trail-list { transition: transform 0.35s ease, opacity 0.3s ease; }
.trail.is-closed .trail-list { transform: translateX(calc(-100% - 40px)); opacity: 0; pointer-events: none; }
.trail.is-closed .trail-fold { transform: translateX(calc(-248px - 36px)); }
.trail.is-closed .trail-fold svg { transform: rotate(180deg); }
.trail-list { gap: 6px; }
.trail-list li + li { border-bottom: 0; }
.trail .sign { grid-template-columns: 26px 1fr; align-items: center; padding: 0 12px; height: 38px; overflow: hidden; isolation: isolate;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.55); transition: color 0.2s ease, height 0.25s ease, border-color 0.2s ease; }
.trail .sign::before { display: none; }
.trail .sign:hover, .trail .sign[aria-current="true"] { border-color: var(--kombu); }
/* A project with a banner shows it when you pass over its box */
.sign.has-banner::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity 0.25s ease;
  background: linear-gradient(90deg, rgba(17, 17, 17, 0.55), rgba(17, 17, 17, 0.05)), var(--banner) center / cover; }
.sign.has-banner:hover, .sign.has-banner:focus-visible { height: 64px; color: #fff; }
.sign.has-banner:hover::after, .sign.has-banner:focus-visible::after { opacity: 1; }
.sign.has-banner:hover .sign-num, .sign.has-banner:focus-visible .sign-num { color: rgba(255, 255, 255, 0.85); }
.sign {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  border: 0;
  padding: 9px 0;
  background: none;
  color: var(--ink);
  text-align: left;
  transition: color 0.2s ease, padding 0.2s ease;
}
.sign::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--kombu);
  transform: scaleY(0);
  transition: transform 0.2s ease;
}
.sign:hover { color: var(--kombu); }
.sign[aria-current="true"] { color: var(--kombu); }
.sign[aria-current="true"]::before, .sign:hover::before { transform: scaleY(1); }
.sign-num, .sign-alt {
  font-family: var(--label);
  font-weight: 500;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.sign-name {
  font-weight: 500;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sign.summit .sign-name { font-weight: 600; }
.sign.summit .sign-num { color: var(--cafe); }

/* ---------- Hint ---------- */
.hint {
  font-family: var(--label);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.hint.gone { opacity: 0; }

/* ---------- Model credit (CC BY) ---------- */
.credit {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 4;
  margin: 0;
  max-width: calc(100% - 32px);
  font-size: 0.72rem;
  color: var(--ink);
  opacity: 0.75;
  text-align: right;
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.9);
}
.credit a { color: inherit; }

/* ---------- Peak tags floating in 3D ---------- */
.labels {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.peak-tag {
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  pointer-events: none;
  transition: opacity 0.3s ease;
  will-change: transform;
}
.peak-tag.active { z-index: 1; }
.peak-tag.hidden { opacity: 0; }
.peak-tag.hidden * { pointer-events: none !important; }

/* Marker: always visible, one per project */
.tag-marker {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--kombu);
  border-radius: 3px;
  background: #fff;
  color: var(--kombu);
  pointer-events: auto;
  transition: background 0.15s ease, color 0.15s ease;
}
.tag-num { font-family: var(--label); font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.peak-tag.active .tag-marker { background: var(--kombu); color: var(--bone); }

/* Side label: only for the active project */
.tag-label {
  position: absolute;
  left: 34px;
  top: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 24px; /* same height as the marker */
  white-space: nowrap;
  text-decoration: none;
  text-shadow: 0 0 6px #fff, 0 0 3px #fff;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.peak-tag.active .tag-label { opacity: 1; pointer-events: auto; }
.tag-label .tag-alt { font-family: var(--label); font-size: 8px; line-height: 9px; letter-spacing: 0.1em; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag-label .tag-name { font-family: var(--body); font-size: 12px; line-height: 13px; font-weight: 600; color: var(--ink); }
.tag-label:hover .tag-name { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Project panel ---------- */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  width: min(var(--panel-w), 100%);
  background: var(--glass);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(0);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.panel.closing { transform: translateX(105%); }
.panel[hidden] { display: none; }

.panel-close {
  position: fixed; /* fixed to the panel, which is the containing block because it is transformed */
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--night);
  z-index: 1;
}

.panel-body {
  padding: calc(env(safe-area-inset-top, 0px) + 30px) 32px calc(env(safe-area-inset-bottom, 0px) + 32px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.panel-alt {
  margin: 0;
  padding-right: 44px;
  font-family: var(--label);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--sign);
  font-variant-numeric: tabular-nums;
}
.panel h2 {
  margin: -8px 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.2rem;
  line-height: 1.1;
  text-wrap: balance;
}
.panel p { margin: 0; color: var(--ink); max-width: 62ch; }
.panel .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); }
.chip {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink);
}

.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gallery > :first-child { grid-column: 1 / -1; }
.gallery img, .frame {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
}
.frame {
  display: grid;
  place-items: center;
  font-family: var(--label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink);
}

.panel-link {
  align-self: flex-start;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--sign);
  color: var(--sign-ink);
  font-weight: 600;
  text-decoration: none;
}
.panel-link:hover { filter: brightness(1.06); }

.panel-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.panel-nav button {
  border: 0;
  background: none;
  padding: 4px 0;
  font-family: var(--label);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-nav button:hover { color: var(--ink); }

.about-photo {
  width: 270px;
  height: 270px;
  max-width: 100%;
  border-radius: 50%;
  border: 1px solid var(--kombu);
  padding: 5px;
  box-shadow: 0 14px 34px rgba(17, 17, 17, 0.16);
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--sign);
  color: var(--sign-ink);
  font-family: var(--display);
  font-size: 2.6rem;
}
img.about-photo { background: #fff; }
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.email {
  font-weight: 600;
  user-select: all;
  overflow-wrap: anywhere;
}
.copy-btn {
  border: 1px solid var(--line);
  background: none;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
}
.socials { display: flex; flex-wrap: wrap; gap: 16px; padding: 0; margin: 0; list-style: none; }

/* ---------- Case study (projects with levels) ---------- */
.panel.panel--wide { width: min(740px, 100%); overflow-x: hidden; }
.case-title { margin: -4px 0 0 !important; padding-right: 48px; }
.case-sub { margin-top: -10px !important; font-size: 1.05rem; color: var(--muted) !important; }
.case-goal { font-size: 1.05rem; line-height: 1.6; max-width: 60ch; }
.case-lead { font-weight: 600; color: var(--kombu) !important; }
.case-h {
  font-family: var(--label);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel--wide .case-meta { padding-right: 48px; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--muted); font-size: 0.88rem; }

/* Device mockups. Screens are 16:9 media inside a dark bezel. */
.device { margin: 0; filter: drop-shadow(0 24px 28px rgba(17, 17, 17, 0.16)) drop-shadow(0 4px 6px rgba(17, 17, 17, 0.12)); }
.device-body { position: relative; background: #121110; }
.device-screen { position: relative; overflow: hidden; background: #050505; aspect-ratio: 16 / 9; }
.device-screen img, .device-screen video { display: block; width: 100%; height: 100%; object-fit: cover; }
.device-body::before { /* camera */
  content: "";
  position: absolute;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #2b2a28;
  box-shadow: inset 0 0 0 1px #3a3936;
}

/* Laptop: thin bezel, camera on top, aluminium base with a thumb notch */
.device--laptop { padding: 0 7%; }
.device--laptop .device-body { padding: 2.4% 2.4% 3%; border-radius: 16px 16px 4px 4px; box-shadow: inset 0 0 0 1px #2c2a27; }
.device--laptop .device-body::before { top: 1%; }
.device--laptop .device-screen { border-radius: 3px; }
.device--laptop::after {
  content: "";
  display: block;
  height: 14px;
  margin: 0 -7.5%;
  border-radius: 2px 2px 14px 14px / 2px 2px 10px 10px;
  background:
    linear-gradient(90deg, transparent 43%, rgba(17, 17, 17, 0.16) 43%, rgba(17, 17, 17, 0.16) 57%, transparent 57%) top / 100% 5px no-repeat,
    linear-gradient(#f5f5f4, #ebebea 70%, #8a8a8a);
}

/* Monitor: bezel, slim neck and foot */
.device--monitor .device-body { padding: 1.6%; border-radius: 12px; box-shadow: inset 0 0 0 1px #2c2a27; }
.device--monitor .device-body::before { display: none; }
.device--monitor .device-screen { border-radius: 4px; }
.device--monitor::after {
  content: "";
  display: block;
  width: 28%;
  height: 34px;
  margin: 0 auto;
  background:
    linear-gradient(#8a8a8a, #ebebea) center bottom / 100% 6px no-repeat,
    linear-gradient(90deg, #8a8a8a, #ebebea, #8a8a8a) center top / 26% 28px no-repeat;
  border-radius: 0 0 4px 4px;
}

/* Tablet: even bezel, rounded corners, landscape */
.device--tablet .device-body { padding: 3.2%; border-radius: 28px; box-shadow: inset 0 0 0 1px #2c2a27, inset 0 0 0 4px #1b1a18; }
.device--tablet .device-body::before { top: 50%; left: 1.6%; margin-top: -2.5px; }
.device--tablet .device-screen { border-radius: 8px; }

/* Hero: one large laptop on a soft light gradient, edge to edge in the panel (like slide 3 of the deck) */
.mock-hero {
  margin: 6px -32px 0;
  padding: 22px 18px 26px;
}
.mock-hero { display: grid; gap: 22px; align-items: end; }
.mock-hero .device--laptop { padding: 0 7.5%; }

/* Phone: portrait, rounded, with a small speaker notch */
.device--phone .device-body { padding: 5%; border-radius: 30px; box-shadow: inset 0 0 0 1px #2c2a27, inset 0 0 0 4px #1b1a18; }
.device--phone .device-body::before { top: 2.4%; width: 26%; height: 4px; margin-left: -13%; border-radius: 2px; }
.device--phone .device-screen { aspect-ratio: 9 / 19; border-radius: 20px; }

/* A screen still waiting for its image */
.device-screen--empty {
  display: grid;
  place-items: center;
  padding: 10px;
  background: repeating-linear-gradient(135deg, #1c1b19 0 10px, #232220 10px 20px);
  font-family: var(--label);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-align: center;
  color: #a39e92;
}

/* Several mockups or photos side by side inside a stop */
.stop-gallery { display: grid; gap: 18px; align-items: end; }
.photo { margin: 0; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.device figcaption, .photo figcaption, .photo-slot figcaption {
  margin-top: 10px;
  font-family: var(--label);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}
.device:has(figcaption) { display: flex; flex-direction: column; }
.device figcaption { order: 2; }

/* The road: a small decorative rail that links the levels */
.road { position: relative; display: flex; flex-direction: column; gap: 40px; margin-top: 12px; padding-left: 34px; }
.road::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 10px;
  bottom: 10px;
  width: 6px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(transparent 0 5px, var(--bone) 5px 10px) center / 1px 100% no-repeat,
    var(--kombu);
}
.stop { position: relative; display: flex; flex-direction: column; gap: 14px; }
.stop::before { /* milestone on the road */
  content: "";
  position: absolute;
  left: -32px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--kombu);
}
.stop-head { display: flex; flex-direction: column; gap: 2px; }
.stop-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; color: var(--kombu); }
.stop-ps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.stop-ps > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stop-ps p { margin: 0; font-size: 0.95rem; line-height: 1.55; }
.stop-solution { color: var(--kombu) !important; font-weight: 500; }
.stop-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink);
}
.stop-label::before { content: ""; width: 16px; height: 2px; border-radius: 1px; background: var(--moss); }
.stop-label--solution { color: var(--kombu); }
.stop-label--solution::before { background: var(--kombu); }
.stop .device--laptop { padding: 0 6%; }
.stop .device--tablet { width: 94%; margin: 0 auto; }

/* Key figures inside a stop */
.stop-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.stop-stats > div { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.stop-stats dt { font-family: var(--display); font-size: 1.7rem; line-height: 1.1; color: var(--kombu); font-variant-numeric: tabular-nums; }
.stop-stats dd { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); }

/* Decision rules of the prototype */
.rules { display: flex; flex-direction: column; gap: 8px; }
.rules-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: center; padding: 10px 14px; font-size: 0.92rem; }
.rule + .rule { border-top: 1px solid var(--line); }
.rule-cond { font-family: var(--label); font-size: 0.78rem; color: var(--ink); }
.rule-act { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.rule-act::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--moss); }
.rule--on .rule-act { color: var(--kombu); font-weight: 600; }
.rule--on .rule-act::before { background: var(--kombu); border-color: var(--kombu); }

/* Reserved photo slot, shown until the image is added */
.photo-slot { margin: 0; }
.photo-slot-inner {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--moss);
  border-radius: 10px;
  background: repeating-linear-gradient(135deg, rgba(107, 107, 107, 0.06) 0 10px, transparent 10px 20px);
  padding: 10px;
  text-align: center;
  font-family: var(--label);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

@media (max-width: 560px) {
  .stop-gallery, .mock-hero { gap: 12px; }
  .mock-hero:has(.device--phone) { margin: 0; padding: 12px 0 16px; }
  .device-screen--empty, .photo-slot-inner { font-size: 0.62rem; overflow-wrap: anywhere; }
  .device--phone .device-body { border-radius: 22px; }
  .device--phone .device-screen--empty { padding: 3px; font-size: 0.56rem; }
  .device--phone .device-screen { border-radius: 14px; }
  .mock-hero { margin: 0 -20px; padding: 20px 10px 22px; }
  .road { gap: 30px; padding-left: 26px; }
  .road::before { left: 5px; width: 5px; }
  .stop::before { left: -26px; width: 11px; height: 11px; }
  .stop .device--tablet { width: 100%; }
  .stop-ps { grid-template-columns: 1fr; gap: 14px; }
  .stop-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule { grid-template-columns: 1fr; gap: 4px; }
  .device--laptop::after { height: 9px; }
  .device--monitor::after { height: 22px; }
}

/* A project's banner across the top of its panel, fading into the page below */
.panel-banner { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; flex: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent); mask-image: linear-gradient(to bottom, #000 88%, transparent); }
.panel-banner[hidden] { display: none; }
/* A piece that flies out of the banner to its place (world.js: flyFromBanner) */
.flying-piece { position: relative; z-index: 3; transform-origin: 0 0; will-change: transform; }
.panel:has(.flying-piece) { overflow-x: hidden; }

/* ---------- No WebGL: the trail sign becomes the whole page ---------- */
.no-webgl {
  background: radial-gradient(120% 90% at 50% 45%, var(--deep), var(--night) 70%);
}
.no-webgl .trail { left: 50%; bottom: 50%; transform: translate(-50%, 50%); }
.no-webgl .hint { display: none; }

.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; }

/* ---------- Phones ---------- */
@media (max-width: 720px) {
  .top { padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 28px; }
  .about-btn { width: 54px; height: 54px; font-size: 0.95rem; }
  .brand h1 { font-size: 1.6rem; }
  .tagline { font-size: 0.75rem; letter-spacing: 0.08em; max-width: 190px; }

  .trail {
    left: 0;
    right: 0;
    width: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    padding: 0 16px;
  }
  .trail-head { display: none; }
  .trail.is-closed .trail-list { transform: none; opacity: 1; pointer-events: auto; }
  .trail .sign { height: auto; padding: 7px 12px; border-radius: 999px; background: var(--glass); grid-template-columns: auto auto; }
  .sign.has-banner:hover { height: auto; }
  .trail { bottom: calc(env(safe-area-inset-bottom, 0px) + 40px); background: none; border: 0; box-shadow: none; backdrop-filter: none; }
  .trail-list { gap: 6px; }
  .trail-list li + li { border-bottom: 0; }
  .sign { padding: 7px 12px; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; grid-template-columns: auto auto auto; }
  .sign::before { display: none; }
  .sign[aria-current="true"] { background: var(--kombu); color: var(--bone); }
  .sign[aria-current="true"] .sign-num, .sign[aria-current="true"] .sign-alt { color: var(--tan); }
  .credit { left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 6px); text-align: left; font-size: 0.66rem; }
  .trail-list {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .trail-list li { flex: 0 0 auto; }
  .sign { width: auto; }

  .hint { bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); font-size: 0.68rem; white-space: normal; text-align: center; width: max-content; max-width: calc(100% - 32px); }

  .panel {
    top: auto;
    left: 0;
    width: 100%;
    height: 68%;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
  }
  .panel.closing { transform: translateY(105%); }
  .panel-body { padding: 22px 20px calc(env(safe-area-inset-bottom, 0px) + 28px); }
  .panel h2 { font-size: 1.8rem; }
  .about-photo { width: 210px; height: 210px; }

  .no-webgl .trail-list { flex-direction: column-reverse; }
  .no-webgl .trail { left: 0; transform: translateY(50%); }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .sign, .trail .sign, .sign::after, .trail-fold svg, .trail-fold, .trail-list, .hint, .peak-tag, .tag-label, .tag-marker { transition: none; }
}

/* Mar i Muntanya: the copper orange of its presentation and simulator */
.panel[data-layout="cupra"] { --cu: #c8783a; --cu-deep: #9a531f; }
.panel[data-layout="cupra"] .chip { border-color: var(--cu); color: var(--cu-deep); background: rgba(200, 120, 58, 0.08); }
.panel[data-layout="cupra"] .case-title .accent, .panel[data-layout="cupra"] .case-lead { color: var(--cu-deep) !important; }
.panel[data-layout="cupra"] .case-title::after { content: "."; color: var(--cu); }
.panel[data-layout="cupra"] .road::before { left: 8px; width: 8px; border-radius: 4px; background: repeating-linear-gradient(transparent 0 5px, #fff 5px 10px) center / 1px 100% no-repeat, #6e6e6e; }
.panel[data-layout="cupra"] .stop::before { border-color: #6e6e6e; }
.panel[data-layout="cupra"] .stop-title { color: var(--cu-deep); }
.panel[data-layout="cupra"] .stop-label--challenge::before { background: var(--cu); }
.panel[data-layout="cupra"] .stop-label--solution { color: var(--cu-deep); }
.panel[data-layout="cupra"] .stop-label--solution::before { background: var(--cu-deep); }
.panel[data-layout="cupra"] .stop-solution { color: #111 !important; }
.panel[data-layout="cupra"] .panel-link { background: var(--cu); border-color: var(--cu); color: #fff; }
.panel[data-layout="cupra"] .panel-close { border-color: var(--cu); color: var(--cu-deep); }
/* Level points sit centred on the road (road centre 12px from the rail's left edge, 8px on phones) */
.panel[data-layout="cupra"] .stop::before { left: -30px; width: 16px; height: 16px; top: 4px; }
@media (max-width: 560px) {
  .panel[data-layout="cupra"] .road::before { left: 4px; width: 8px; }
  .panel[data-layout="cupra"] .stop::before { left: -25px; width: 14px; height: 14px; }
}

/* Small captioned stills under a level (key moments of the simulation) */
.stop-frames { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px 10px; }
.stop-frames figure { margin: 0; }
.stop-frames img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.stop-frames figcaption { margin-top: 5px; font-size: 0.78rem; color: var(--muted); }
@media (max-width: 560px) { .stop-frames { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* L5: the central screen, with a link to try it */
.stop-screen { display: flex; flex-direction: column; gap: 10px; }
.stop-screen > p { margin: 0; font-size: 0.95rem; line-height: 1.55; }
.stop-link { align-self: flex-start; font-weight: 600; color: var(--kombu); text-underline-offset: 3px; }
.panel[data-layout="cupra"] .stop-link { color: var(--cu-deep); }
.panel-link + .panel-link--alt { margin-top: -6px; }
.panel .panel-link--alt { background: transparent; color: var(--kombu); }
.panel[data-layout="cupra"] .panel-link--alt { background: transparent; color: var(--cu-deep); }
/* Mar i Muntanya: a smaller opening laptop */
.panel[data-layout="cupra"] .mock-hero .device--laptop { width: 72%; margin: 0 auto; }
@media (max-width: 560px) { .panel[data-layout="cupra"] .mock-hero .device--laptop { width: 88%; } }

/* Awards at the end of a case study */
.case-awards { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.case-awards figure { margin: 0; }
.case-awards img { display: block; width: 45%; height: auto; border-radius: 8px; }
@media (max-width: 560px) { .case-awards img { width: 80%; } }
.case-awards figcaption { margin-top: 8px; font-weight: 600; font-size: 0.92rem; }
.panel[data-layout="cupra"] .case-awards figcaption { color: var(--cu-deep); }

/* Project and About panels float over the map like a tablet: inset, rounded, outlined, softly shadowed.
   Each project keeps its own look inside, clipped to the rounded frame. */
.panel {
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(var(--panel-w), calc(100% - 32px));
  border: 1px solid rgba(17, 17, 17, 0.22);
  border-radius: 20px;
  background: #fff;
  backdrop-filter: none;
  box-shadow: 0 24px 60px rgba(17, 17, 17, 0.16), 0 4px 12px rgba(17, 17, 17, 0.08);
  overflow-x: hidden;
}
.panel.panel--wide { width: min(740px, calc(100% - 32px)); }
.panel.closing { transform: translateX(calc(100% + 40px)); }
@media (max-width: 720px) {
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 68%; border: 1px solid rgba(17, 17, 17, 0.22); border-radius: 18px; }
  .panel.panel--wide { width: auto; }
  .panel.closing { transform: translateY(calc(100% + 24px)); }
}

/* Smaller floating panels; the map fades back while one is open */
:root { --panel-w: 400px; }
.panel { top: 28px; bottom: 28px; right: 28px; }
.panel.panel--wide { width: min(660px, calc(100% - 56px)); }
#world, #labels { transition: opacity 0.4s ease; }
body.panel-open #world, body.panel-open #labels { opacity: 0.35; }
@media (max-width: 720px) {
  .panel { top: auto; bottom: 8px; right: 8px; height: 64%; }
  .panel.panel--wide { width: auto; }
}
/* Mar i Muntanya: smaller stills under each level */
.panel[data-layout="cupra"] .stop-frames { width: 80%; gap: 10px 8px; }
.panel[data-layout="cupra"] .stop-frames figcaption { font-size: 0.72rem; }
@media (max-width: 560px) { .panel[data-layout="cupra"] .stop-frames { width: 100%; } }

/* Every project page takes half the screen on a computer, beside the map, and the whole screen on a phone. */
@media (min-width: 721px) {
  .panel, .panel.panel--wide { left: auto; width: calc(50vw - 16px); }
}
@media (max-width: 720px) {
  .panel, .panel.panel--wide { top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; border: 0; border-radius: 0; }
  .panel.closing { transform: translateY(100%); }
}

/* The close cross stays at the top right of the page while it scrolls: just a soft white cross,
   half transparent, that comes up fully when you pass over it */
.panel .panel-close {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 10px); z-index: 20;
  display: grid; place-items: center; margin: 10px 10px -54px auto;
  width: 40px; height: 40px; padding: 0; border: 0 !important; border-radius: 0; background: none !important;
  font-size: 1.25rem; line-height: 1; cursor: pointer;
  color: #fff !important; opacity: 0.45; text-shadow: 0 0 6px rgba(0, 0, 0, 0.45), 0 0 1px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.panel .panel-close:hover, .panel .panel-close:focus-visible { opacity: 1; transform: scale(1.12); }
