@font-face {
  font-family: 'FluxischElse-Regular';
  src: url('FluxischElse-Regular.otf') format('opentype');
}

@font-face {
  font-family: 'FluxischElse-Bold';
  src: url('FluxischElse-Bold.otf') format('opentype');
}

:root {
  /* Corner dots on gallery images — tweak these two and everything follows */
  --corner-dot-size: 7px;
  --corner-dot-inset: -3px;  /* raise this to float the dots inside the image */
  --corner-dot-color: #000;

  /* Dot under the active projects / illustrations link */
  --toggle-dot-size: 7px;

  /* Asterisk icon — matches the down-arrow's size */
  --caption-toggle-size: 34px;

  /* How far the caption box floats in from the image edges */
  --caption-inset: 14px;
}

html {
  scroll-behavior: smooth;
}

/* Reset and base styles */
body {
  margin: 0;
  padding: 5%;
  background: white;
  color: black;
  text-align: center;
  font-family: 'FluxischElse-Regular', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  padding-top: 10px;
  min-height: 100vh;
}

.info {
  position: relative;
  z-index: 5;
  margin-top: 0;
  margin-bottom: 40px;
}

.info h1 {
  margin-bottom: 0;
  font-size: 12pt;
  line-height: 15pt;
  font-family: 'FluxischElse-Bold', sans-serif;
}

.info p {
  margin: 0;
  font-size: 12pt;
  line-height: 15pt;
}

a {
  color: black;
  text-decoration: none;
}

a:hover {
  color: lightgrey;
  cursor: default;
}

/* Gallery toggle links */
.gallery-toggle a {
  position: relative;
  font-family: 'FluxischElse-Regular', sans-serif;
  font-weight: normal;
  text-decoration: none;
  color: black;
}

.gallery-toggle a:hover {
  color: lightgrey;
}

.gallery-toggle a.active {
  font-family: 'FluxischElse-Bold', sans-serif;
  font-weight: normal;
}

/* Dot under the selected toggle */
.gallery-toggle a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.85em;
  width: var(--toggle-dot-size);
  height: var(--toggle-dot-size);
  border-radius: 50%;
  background: black;
  transform: translateX(-50%) scale(0);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.gallery-toggle a.active::after {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

/* Dog image */
.dog-image {
  position: absolute;
  top: 15%;
  left: 10%;
  cursor: grab;
  touch-action: none;
  transition: opacity 0.3s ease;
  user-select: none;
  z-index: 1;
}

#dog {
  width: auto;
  height: 380px;
  user-select: none;
}

/* Hide dog on scroll for small screens */
.dog-image.hide-on-scroll {
  opacity: 0;
  pointer-events: none;
}

/* Arrow */
.down-arrow {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) rotate(0deg);
  cursor: pointer;
  transition: transform 0.3s ease, top 0.3s ease, bottom 0.3s ease;
  z-index: 20;
}

.down-arrow img {
  width: 34px;
  height: auto;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.down-arrow.sticky {
  position: fixed;
  top: 20px;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  z-index: 1000;
}

/* Gallery */
.image-gallery {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 80px 2% 50px;
  background: white;
  flex-wrap: nowrap;
}

.column {
  flex: 1 1 33.33%;
  max-width: 33.33%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Image stack ---- */
.image-wrapper {
  position: relative;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.image-wrapper.is-hidden {
  display: none;
}

/* Only stacks with more than one image invite a click */
.image-wrapper.has-multiple {
  cursor: pointer;
}

.slide {
  display: none;
  position: relative;
  margin: 0;
}

.slide.is-active {
  display: block;
}

.slide img {
  display: block;
  width: 100%;
  height: auto;
  z-index: 1;
  user-select: none;
  -webkit-user-drag: none;
}

/* Colour layer sits exactly on top of the b&w one */
.slide .img-color {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.image-wrapper.is-color .slide.is-active .img-color {
  opacity: 1;
}

/* ---- Asterisk / caption toggle ----
   The asterisk sits top-right of the image and only appears while the stack
   is hovered (desktop) or tapped (mobile) — same trigger as the colour swap.
   Clicking it opens a caption reading from the active slide's data-caption
   attribute; clicking again closes it. Once opened it's "remembered" even
   after the pointer leaves, so hovering back over the image brings the
   caption straight back without a second click. */
.slide .caption-toggle {
  position: absolute;
  top: var(--caption-inset);
  right: var(--caption-inset);
  z-index: 5;
  width: var(--caption-toggle-size);
  height: var(--caption-toggle-size);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.image-wrapper.is-color .slide.is-active .caption-toggle {
  opacity: 1;
  pointer-events: auto;
}

.image-wrapper::before {
  content: attr(data-caption);
  position: absolute;
  bottom: var(--caption-inset);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 80%;
  z-index: 4;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 12pt;
  line-height: 1.3;
  text-align: center;
  color: white;
  background: black;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.image-wrapper.is-color.caption-open::before {
  opacity: 1;
}

/* ---- Corner dots ----
   Four radial-gradient circles, one per corner. Real circles, so they render
   round everywhere — unlike `border: dotted`, which Chrome and Firefox draw
   as squares once the width gets past a few pixels. */
.image-wrapper::after {
  content: "";
  position: absolute;
  top: var(--corner-dot-inset);
  right: var(--corner-dot-inset);
  bottom: var(--corner-dot-inset);
  left: var(--corner-dot-inset);
  pointer-events: none;
  z-index: 3;
  background-image:
    radial-gradient(circle closest-side, var(--corner-dot-color) 96%, transparent 100%),
    radial-gradient(circle closest-side, var(--corner-dot-color) 96%, transparent 100%),
    radial-gradient(circle closest-side, var(--corner-dot-color) 96%, transparent 100%),
    radial-gradient(circle closest-side, var(--corner-dot-color) 96%, transparent 100%);
  background-size: var(--corner-dot-size) var(--corner-dot-size);
  background-position: left top, right top, left bottom, right bottom;
  background-repeat: no-repeat;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  width: max-content;
  max-width: 220px;
  background-color: black;
  color: white;
  text-align: center;
  font-size: 12pt;
  padding: 5px 10px;
  border-radius: 5px;
  position: absolute;
  z-index: 1;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tooltip.show .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Visible keyboard focus on the stacks */
.image-wrapper:focus-visible {
  outline: 2px solid black;
  outline-offset: 4px;
}

/* Responsive styles */
@media screen and (max-width: 767px) {
  :root {
    --corner-dot-size: 5px;
    --toggle-dot-size: 5px;
    --caption-toggle-size: 25px;
  }

  #dog {
    width: 300px;
  }

  .down-arrow img {
    width: 25px;
  }

  .dog-image.hide-on-scroll {
    opacity: 0;
    pointer-events: none;
  }

  .container {
    padding-top: 10px;
  }

  .image-gallery {
    flex-wrap: wrap;
    flex-direction: column;
    padding: 80px 5% 50px;
  }

  .column {
    max-width: 100%;
    flex-basis: 100%;
  }

  .down-arrow.sticky {
    top: 20px;
    bottom: auto;
  }

  .down-arrow {
    bottom: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide .img-color,
  .gallery-toggle a::after,
  .down-arrow,
  .down-arrow img { transition: none; }
}
