/* ── homepage: no scroll, fits exactly in the viewport ──────────────────── */
html,
body {
  overflow: hidden;
  height: 100%;
}

/* ── remove band, dashed line and blue texts on all screens ─────────────── */
.home-band,
.home-band-text,
.home-band-text2 {
  display: none;
}

/* ── nav and banner stay above the canvas (z-index: 5) ──────────────────── */
.home-banner {
  position: relative;
  z-index: 10;
  margin-top: var(--nav-height); /* sits flush below the fixed nav */
  background: #efefef00;
  border-top: 0px solid #444444;
  height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  user-select: none;
  overflow: hidden;
  pointer-events: none; /* lets carousel items (z-index 6) receive clicks through the banner */
}

/* logo row: absolutely centered on the axis intersection */
.home-banner > .row {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
}

/* logo: full width, flush edges */
.home-logo {
  display: block;
  width: 100%;
  height: auto;
  line-height: 0;
  padding-left: var(--home-margin);
  padding-right: var(--home-margin);
}

.home-logo svg {
  display: block;
  width: 100%;
  height: auto;
  padding-left: var(--home-margin);
  padding-right: var(--home-margin);
}

/* ── mathematics — sits in normal flow, resting on the band's top edge ───── */
.home-mathematics {
  position: relative;
  z-index: 4;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 200px;
  margin-bottom: 18px; /* letters overlap the band top edge slightly */
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 900;
  font-size: 22px;
  color: #cfcfcf;
  user-select: none;
  padding-left: var(--home-margin);
  padding-right: var(--home-margin);
}

/* ── horizontal band — MATHEMATICS sits centered on it ───────────────────── */
.home-band {
  position: relative;
  top: 10%; /* slightly below the centered MATHEMATICS */
  left: 0;
  width: 100%;
  height: 26px; /* tall enough to frame the letters */

  background: #d6ffd7;

  z-index: 2; /* below math text (z-index:4), above background */
  pointer-events: none;
}

/* ── dashed tick line — sits above the band (above the letters) ──────────── */
.home-band::before {
  content: "";
  position: absolute;
  top: -15px; /* clears the 22px letters + a small gap */
  left: 0;
  width: 100%;
  height: 8px;

  background: repeating-linear-gradient(
    to right,
    rgba(35, 35, 35, 0.35) 0px,
    rgba(35, 35, 35, 0.35) 1.5px,
    transparent 1.5px,
    transparent 30px
  );

  z-index: 3;
}

/* ── band text (below the band, in normal flow within .home-tilt) ────────── */
.home-band-text {
  position: relative;
  top: 20px;

  font-family: "Aeonik TRIAL";
  font-weight: 400;
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);

  color: #1683ff;
}

.home-band-text2 {
  position: relative;
  top: 40px;

  font-family: "KMRWaldenburg";
  font-weight: 500;
  font-size: 14px;

  line-height: 1.2;

  color: #1683ff;
}

/* ── tilt entire hero group ───────────────── */
.home-tilt {
  /*transform: rotate(-15deg) translateY(180px) translateX(-50px);*/
  position: absolute;
  top: 68%;
  left: 0;
  width: 100%;
}

/* ── cartesian plane ─────────────────────────────────────────────────────── */
.home-cartesian {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* world: the zoomable layer — everything inside scales together */
.cp-world {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
}

/* default cursor — no drag interaction */
.home-logo {
  cursor: default;
}

.cartesian-axis {
  position: absolute;
  background: #4e4e4e;
}

/* horizontal — x axis */
.cartesian-x {
  top: 50%;
  left: -400%;
  width: 900%; /* extends far beyond world bounds so it zooms naturally */
  height: 1px;
  transform: translateY(-50%) scaleY(var(--inv-zoom, 1));
  transform-origin: center center;
}

/* vertical — y axis */
.cartesian-y {
  left: 50%;
  top: -400%;
  height: 900%;
  width: 1px;
  transform: translateX(-50%) scaleX(var(--inv-zoom, 1));
  transform-origin: center center;
}

.cartesian-label {
  position: absolute;
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 500;
  font-size: 11px;
  color: #717171;
  letter-spacing: 0.02em;
  user-select: none;
}

.cartesian-label-x {
  right: 10px;
  top: 50%;
  transform: translateY(-150%);
}

.cartesian-label-y {
  left: 50%;
  top: 8px;
  transform: translateX(6px);
}

/* ── cartesian background overlay (hover effect) ─────────────────────────── */
.cp-bg-overlay {
  position: absolute;
  width: 33.33%; /* ~4 of 12 columns */
  height: 40%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: -1; /* behind logo, axes, points — everything */
  pointer-events: none;
}

.cp-bg-overlay.cp-bg-visible {
  opacity: 1;
}

/* ── cartesian image points ──────────────────────────────────────────────── */
.cp-point {
  position: absolute;
  display: flex;
  flex-direction: column;
  z-index: 2;
  pointer-events: auto; /* restored — banner is pointer-events:none so this is needed */
}

/* x >= 0: top-left corner sits on the coordinate */
.cp-pos {
  transform: translate(0, 0);
  align-items: flex-start;
}

/* x < 0: top-right corner sits on the coordinate */
.cp-neg {
  transform: translate(-100%, 0);
  align-items: flex-end;
}

/* ── Label size — controlled by LABEL_SIZE_FAR / LABEL_SIZE_NEAR in home-cartesian.js */
:root {
  --cp-label-size: 12px;
} /* fallback only */

/* ── unified tag: dot + label in one colorable container ─────────────────── */
.cp-tag {
  position: absolute;
  top: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0px 2px;
  white-space: nowrap;
  background-color: #16161600;
  transition: background-color 0.2s ease;
}

.cp-pos .cp-tag {
  left: 0;
}
.cp-neg .cp-tag {
  right: 0;
  flex-direction: row-reverse;
}

.cp-point:hover .cp-tag {
  background-color: var(--point-color);
}

.cp-point:hover .cp-label {
  color: #ffffff;
}

.cp-point:hover .cp-dot {
  background: #ffffff;
}

.cp-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #4e4e4e;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.cp-label {
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 500;
  font-size: var(--cp-label-size);
  color: #4e4e4e;
  letter-spacing: 0em;
  user-select: none;
  transition: color 0.2s ease;
}

/* ── point thumbnail image ───────────────────────────────────────────────── */
.cp-img {
  width: 50px;
  height: 20px;
  display: block;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cp-img.cp-img-visible {
  opacity: 1;
}

/* ── projection lines ────────────────────────────────────────────────────── */
.cp-proj {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.cp-proj-h {
  height: 1px;
  border-top: 1px dashed #c0c0c0;
}

.cp-proj-v {
  width: 1px;
  border-left: 1px dashed #c0c0c0;
}

/* ── lightbox ────────────────────────────────────────────────────────────── */
#cp-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding-top: 10px;
  padding-bottom: 80px; /* ← increase to give more room at the bottom */
}

#cp-lightbox.cp-lb-open {
  display: flex;
}

/* inner card — vertical stack */
.cp-lb-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 68vw;
  animation: cp-lb-fade-in 0.25s ease;
}

/* top row — 4-column grid, each text block spans 2 cols */
.cp-lb-top {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  align-items: end;
}

.cp-lb-top-l {
  grid-column: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 60px;
}

.cp-lb-top-r {
  grid-column: 3 / 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-bottom: 64px;
}

.cp-lb-num {
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #1a1a1a;
  line-height: 1;
  -webkit-font-smoothing: subpixel-antialiased;
}

.cp-lb-title {
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 700;

  font-size: 15px;
  color: #1b1b1b;
  margin: 0;
  -webkit-font-smoothing: subpixel-antialiased;
}

.cp-lb-num,
.cp-lb-title {
  line-height: 0.9;
}

.cp-lb-date,
.cp-lb-author {
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 400;
  font-size: 11px;
  color: #828282;
  margin: 0;
  line-height: 1.2; /* ← tweak this to control spacing between date and author */
}

/* full-width image */
.cp-lb-media {
  width: 100%;
}

/* bottom row — 4-column grid: desc=col1, detail=cols3-4 */
.cp-lb-bottom {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: start;
}

.cp-lb-bot-l {
  grid-column: 1 / 2;
}

.cp-lb-bot-r {
  grid-column: 3 / 5;
}

/* params table — key left, value right */
.cp-lb-params {
  width: 100%;
  border-collapse: collapse;
}

.cp-lb-params tr:first-child td {
  padding-top: 0;
}

.cp-lb-params tr {
  border-bottom: 1px solid #e0e0e0;
}

.cp-lb-pk {
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #828282;
  padding: 4px 0;
  white-space: nowrap;
  text-align: left;
}

.cp-lb-pv {
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 400;
  font-size: 10px;
  color: #828282;
  padding: 4px 0;
  text-align: right;
}

.cp-lb-desc,
.cp-lb-detail {
  font-family: "KMRWaldenburg", sans-serif;
  font-weight: 900;
  font-size: 12px;
  color: #282828;
  line-height: 1.2;
  margin: 0;
}

/* ── vertical carousel ───────────────────────────────────────────────────── */
#cp-carousel {
  position: fixed;
  top: var(
    --nav-height
  ); /* start below the nav so 50% = centre of content area */
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6; /* banner has pointer-events:none so items receive clicks through it */
  pointer-events: none; /* container is pass-through — only items capture events */
}

.cp-car-item {
  position: absolute;
  top: 50%;
  left: 50%;
  overflow: hidden;
  aspect-ratio: 7 / 4; /* consistent crop for all items — true proportion shown in lightbox */
  /* width, border-radius, transition — all set by CAR config in JS */
  will-change: transform, opacity;
  pointer-events: none; /* JS flips this per item */
}

.cp-car-item img {
  display: block;
  width: 100%;
  height: 100%; /* fill the fixed aspect-ratio box */
  object-fit: cover; /* crop to fill — preserves composition without distortion */
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* active point — mirrors the hover state so the current artwork's point is highlighted */
.cp-point-active .cp-tag {
  background-color: var(--point-color);
}
.cp-point-active .cp-dot {
  background: #ffffff;
}
.cp-point-active .cp-label {
  color: #ffffff;
}

/* ── lightbox nav arrows ─────────────────────────────────────────────────── */
.cp-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    box-shadow 0.15s ease,
    background 0.15s ease;
  user-select: none;
}

.cp-lb-nav:hover {
  background: #f0f0f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.cp-lb-prev {
  left: 2vw;
}
.cp-lb-next {
  right: 2vw;
}

.cp-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(18px);
  animation: cp-lb-fade-in 0.25s ease;
}

.cp-lb-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 0px;
}

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

/* ── hero image container ────────────────────────────────────────────────── */
/* Change --home-image-height to resize the container */
:root {
  --home-image-height: 60vh;
}

.home-image-wrap {
  position: relative;
  z-index: 6;
  margin-top: 40px;
  margin-bottom: 40px;
}

.home-image {
  height: var(--home-image-height);
  overflow: hidden;
}

.home-image img,
.home-image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — homepage
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Keep axes visible on mobile — hide only coordinate points and projection lines */
  .cp-point,
  .cp-proj {
    display: none;
  }

  /* Logo — full width with a small margin.
     SVG padding is zeroed here because CSS padding on <svg> is unreliable
     on iOS Safari — it can distort the viewBox scale and make text look wrong.
     All spacing is handled by the parent div instead. */
  .home-logo {
    padding-left: 20px;
    padding-right: 20px;
  }

  .home-logo svg {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  /* MATHEMATICS — smaller letters, less top margin */
  .home-mathematics {
    font-size: 13px;
    margin-top: 100px;
    margin-bottom: 10px;
  }

  /* Carousel items — portrait 3:4 on mobile */
  .cp-car-item {
    aspect-ratio: 3 / 4;
  }

  /* ── Lightbox: single-column layout ─────────────────────────────── */
  #cp-lightbox {
    padding-top: 16px;
    padding-bottom: 40px;
  }

  .cp-lb-inner {
    width: 88vw;
  }

  /* Top: stack number/title and date/author vertically */
  .cp-lb-top {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .cp-lb-top-l {
    grid-column: 1;
    margin-bottom: 8px;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
  }

  .cp-lb-top-r {
    grid-column: 1;
    margin-bottom: 16px;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
  }

  /* Bottom: params and description stack vertically */
  .cp-lb-bottom {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .cp-lb-bot-l {
    grid-column: 1;
  }

  .cp-lb-bot-r {
    grid-column: 1;
  }

  /* Nav arrows: smaller, pulled to edges so they don't crowd the content */
  .cp-lb-nav {
    width: 32px;
    height: 32px;
  }

  .cp-lb-prev {
    left: 4px;
  }
  .cp-lb-next {
    right: 4px;
  }
}
