@font-face { font-family: "W95Fa"; src: url("../../../assets/fonts/W95FA.otf") format("opentype"); }

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Color */
  --page-bg: #ffffff;
  --panel-text: #050505;
  --panel-muted: #4b4b4b;
  --panel-glass: rgba(255, 255, 255, 0.78);
  --teal-dark: #004946;
  --teal-mid: #007d7c;
  --pink: #f02686;
  --chrome-silver: #96aeb4;
  --button-shadow: rgba(0, 42, 44, 0.28);
  --panel-shadow: rgba(0, 0, 0, 0.14);

  /* Font size */
  --fs-1: 0.72rem;
  --fs-2: 0.85rem;
  --fs-3: clamp(0.92rem, 0.68rem + 0.62vw, 1.16rem);
  --fs-4: clamp(1.02rem, 0.78rem + 0.72vw, 1.28rem);
  --fs-5: clamp(0.82rem, 0.46rem + 0.72vw, 1.18rem);
  --fs-6: clamp(1.75rem, 0.98rem + 2.2vw, 3.2rem);

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 44px;
  /* clears the fixed Home button: tracks its mobile width plus a gap */
  --sp-9: calc(clamp(58px, 13vw, 76px) + var(--sp-2));
}

body {
  min-height: 100vh;
  background: var(--page-bg) url("frames/background.png") center / cover fixed no-repeat;
  color: var(--panel-text);
  font-family: "W95Fa", "Courier New", monospace;
  padding: clamp(var(--sp-4), 2.4vw, var(--sp-8));
}

.page {
  width: 100%;
  min-height: calc(100vh - clamp(var(--sp-4), 2.4vw, var(--sp-8)) * 2);
  display: grid;
  place-items: center;
}

.livi-console {
  position: relative;
  width: min(100%, 1500px);
  aspect-ratio: 1672 / 941;
}

.livi-console::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: url("frames/frame.png") center / contain no-repeat;
  pointer-events: none;
}

.pill-nav,
.content-area {
  position: absolute;
}

.pill-nav {
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.console-title {
  position: absolute;
  top: 5.8%;
  left: 22%;
  right: 10%;
  z-index: 5;
  color: var(--panel-text);
  font-size: var(--fs-6);
  line-height: 1;
  margin: 0;
  text-align: center;
  pointer-events: none;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.84),
    0 4px 12px rgba(255, 255, 255, 0.72);
}

.pill-btn {
  position: absolute;
  width: 14.6%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  color: var(--panel-text);
  cursor: pointer;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 10px 14px var(--button-shadow));
  font-family: "W95Fa", "Courier New", monospace;
  font-size: var(--fs-5);
  line-height: 1;
  pointer-events: auto;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.84),
    0 4px 12px rgba(255, 255, 255, 0.72);
  transform: translate(-50%, -50%);
  transition: filter 180ms ease, transform 180ms ease;
}

.pill-btn:hover,
.pill-btn.active {
  filter: drop-shadow(0 14px 18px var(--button-shadow)) brightness(1.05) saturate(1.12);
  transform: translate(-50%, -50%) scale(1.04);
}

.pill-gallery {
  top: 31.8%;
  left: 7.65%;
  background-image: url("frames/button-1.png");
}

.pill-tablet {
  top: 51.5%;
  left: 7.65%;
  background-image: url("frames/button-2.png");
}

.pill-about {
  top: 70.7%;
  left: 7.65%;
  background-image: url("frames/button-3.png");
}

.content-area {
  top: 15.2%;
  right: 7.2%;
  bottom: 9.8%;
  left: 18.4%;
  z-index: 2;
  border-radius: 28px;
  background: var(--panel-glass);
  box-shadow: 0 18px 34px var(--panel-shadow);
  overflow: visible;
}

.section {
  display: none;
  width: 100%;
  height: 100%;
  padding: clamp(var(--sp-4), 2vw, var(--sp-7));
}

.section.active {
  display: block;
}

.panel-title {
  display: none;
  color: var(--panel-text);
  font-size: var(--fs-6);
  line-height: 1;
  margin-bottom: var(--sp-4);
  text-align: center;
}

.text-panel {
  height: 100%;
  overflow: auto;
  padding: var(--sp-5) var(--sp-6);
  border-radius: 28px;
  background: transparent;
  color: var(--panel-text);
  font-size: var(--fs-4);
  line-height: 1.5;
}

.text-panel::-webkit-scrollbar {
  width: 10px;
}

.text-panel::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(0, 73, 70, 0.08);
}

.text-panel::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: linear-gradient(
      to right,
      rgba(150, 174, 180, 0.55) 0%,
      rgba(255, 255, 255, 0.95) 24%,
      rgba(228, 240, 242, 0.9) 44%,
      rgba(152, 176, 182, 0.6) 76%,
      rgba(212, 228, 231, 0.85) 100%
    ) padding-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.text-panel::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
      to right,
      rgba(168, 192, 198, 0.7) 0%,
      rgba(255, 255, 255, 1) 24%,
      rgba(240, 250, 252, 0.96) 44%,
      rgba(168, 192, 198, 0.72) 76%,
      rgba(226, 240, 243, 0.92) 100%
    ) padding-box;
}

/* Firefox has no scrollbar pseudo-elements, and setting these in Chrome would
   switch the gradient thumb above back off — so scope the flat fallback. */
@supports not selector(::-webkit-scrollbar) {
  .text-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(196, 214, 218, 0.85) rgba(255, 255, 255, 0.22);
  }
}

.text-panel p {
  margin-bottom: var(--sp-4);
}

.text-panel a {
  color: var(--teal-mid);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.text-panel a:hover {
  color: var(--pink);
}

.text-panel blockquote {
  margin: var(--sp-4) 0;
  padding: var(--sp-3) var(--sp-4);
  border: 3px solid var(--chrome-silver);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

.image-figure {
  margin: 0 0 var(--sp-4);
}

.tablet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--sp-6);
}

.tablet-copy > :last-child {
  margin-bottom: 0;
}

.image-pair {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-bottom: 0;
}

.image-pair .image-figure {
  flex: 0 0 auto;
  width: min(100%, 300px);
  min-width: 0;
  margin: 0 auto;
}

.image-pair .image-figure .featured-image {
  width: 100%;
  height: auto;
  margin: 0;
}

.tablet-pair {
  display: flex;
  gap: 2px;
  margin-bottom: var(--sp-4);
}

.tablet-pair .image-figure {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
}

.featured-image {
  display: block;
  width: min(100%, 420px);
  max-height: 240px;
  object-fit: contain;
  margin: 0 auto;
}

.installation-view .featured-image {
  max-height: none;
}

.slideshow {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border-radius: 28px;
  background: transparent;
}

.slide-stage {
  position: relative;
  height: 100%;
  min-height: 0;
}

.slide-frame {
  position: relative;
  width: calc(100% - 180px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  overflow: hidden;
}

.slide-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}

.slide-control {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: clamp(38px, 4.3vw, 70px);
  height: clamp(52px, 5.8vw, 94px);
  border: 0;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  cursor: pointer;
  filter: drop-shadow(0 7px 10px var(--button-shadow));
  transform: translateY(-50%);
  transition: filter 160ms ease, transform 160ms ease;
}

.slide-control:hover {
  filter: drop-shadow(0 10px 14px var(--button-shadow)) brightness(1.06);
  transform: translateY(-50%) scale(1.05);
}

.slide-control-prev {
  left: 20px;
  background-image: url("frames/left.png");
}

.slide-control-next {
  right: 20px;
  background-image: url("frames/right.png");
}

.thumbnail-strip {
  width: min(72%, 560px);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-1);
  align-self: end;
  padding: 0;
}

.thumb-btn {
  min-width: 0;
  min-height: 0;
  height: 64px;
  border: 2px solid rgba(0, 73, 70, 0.38);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.48);
  cursor: pointer;
  overflow: hidden;
  opacity: 0.76;
  padding: var(--sp-1);
  transition: border-color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: var(--sp-3);
  padding: clamp(var(--sp-5), 5vw, var(--sp-8));
  background: rgba(0, 25, 25, 0.82);
}

.lightbox-image {
  max-width: min(94vw, 1200px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  max-width: min(94vw, 900px);
  color: #ffffff;
  font-size: var(--fs-3);
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 101;
  width: 44px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  cursor: pointer;
  font-family: "W95Fa", "Courier New", monospace;
  font-size: 2rem;
  line-height: 1;
}

.thumb-btn:hover,
.thumb-btn.active {
  border-color: var(--pink);
  opacity: 1;
  transform: scale(1.05);
}

.thumb-btn img {
  display: block;
  width: auto;
  height: 100%;
  object-fit: contain;
}

.back-link {
  position: fixed;
  top: var(--sp-4);
  left: var(--sp-4);
  z-index: 20;
  width: clamp(64px, 7vw, 96px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: transparent url("frames/button-4.png") center / contain no-repeat;
  color: var(--panel-text);
  font-family: "W95Fa", "Courier New", monospace;
  font-size: var(--fs-5);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  filter: drop-shadow(0 10px 14px var(--button-shadow));
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.84),
    0 4px 12px rgba(255, 255, 255, 0.72);
  transition: filter 180ms ease, transform 180ms ease;
}

.back-link:hover {
  filter: drop-shadow(0 14px 18px var(--button-shadow)) brightness(1.05) saturate(1.12);
  transform: scale(1.04);
}

@media (max-width: 980px) {
  body {
    padding: var(--sp-4);
  }

  .page {
    min-height: auto;
    place-items: start center;
  }

  .back-link {
    width: clamp(58px, 13vw, 76px);
  }

  .livi-console {
    aspect-ratio: auto;
    min-height: auto;
    padding-top: calc(clamp(150px, 28vw, 210px) + var(--sp-9));
  }

  .livi-console::after { display: none; }

  .console-title { display: none; }

  .pill-nav {
    top: var(--sp-9);
    left: 0;
    right: 0;
    bottom: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-3);
    pointer-events: auto;
  }

  .pill-btn {
    position: static;
    width: min(29vw, 180px);
    justify-self: center;
    transform: none;
  }

  .pill-btn:hover,
  .pill-btn.active {
    transform: scale(1.04);
  }

  .content-area {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    padding: var(--sp-5);
    border-radius: 48px;
    background: rgba(210, 225, 226, 0.84);
    box-shadow: 0 20px 36px var(--panel-shadow);
    overflow: visible;
    pointer-events: auto;
  }

  .section {
    padding: 0;
  }

  .panel-title {
    display: block;
    margin-bottom: var(--sp-3);
  }

  .text-panel {
    height: 520px;
  }

  .tablet-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-4);
  }

  .image-pair {
    order: -1;
    flex-direction: row;
    align-items: flex-start;
  }

  .image-pair .image-figure {
    flex: 1 1 0;
  }

  .slide-frame {
    width: 100%;
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .slide-image {
    height: auto;
    aspect-ratio: auto;
    max-height: none;
  }

  .slide-stage {
    display: contents;
  }

  .slide-control {
    position: static;
    grid-row: 2;
    align-self: center;
    width: 40px;
    height: 52px;
    transform: none;
  }

  .slide-control:hover {
    transform: scale(1.05);
  }

  .slide-control-prev {
    grid-column: 1;
  }

  .slide-control-next {
    grid-column: 3;
  }

  .thumbnail-strip {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    align-self: center;
  }

  .thumb-btn {
    height: 52px;
  }

  .slideshow {
    height: auto;
    padding: 0;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}

@media (max-width: 560px) {
  body {
    padding: var(--sp-3);
  }

  .livi-console {
    padding-top: calc(128px + var(--sp-9));
  }

  .pill-btn {
    width: min(30vw, 118px);
    font-size: var(--fs-2);
  }

  .content-area {
    padding: var(--sp-4);
    border-radius: 30px;
  }

  .text-panel {
    height: 470px;
    padding: var(--sp-4);
  }
}
