/* The photographer's portfolio with the contact strip: a dark folio card on a warm near black page, a lightbox of opal
   glass on top and one strip of contact prints under it. The flying print (.fly) lives inside the lightbox; GSAP moves
   it with transforms only, so the CSS never puts a transform on it. */
:root {
  --page: #0c0b0a;            /* the page */
  --card: #171513;            /* the folio card */
  --card-low: #11100e;        /* the bottom of the card */
  --edge: rgba(255, 246, 230, 0.08); /* the 1px edge of the card */
  --ink: #efe9df;             /* the words */
  --muted: #8e877c;           /* the small words */
  --glass: #f3eee5;           /* the lightbox at its brightest */
  --glass-edge: #b7ad9d;      /* the lightbox at its edges */
  --film: #1b1916;            /* the printed film edge */
  --edge-print: #9a917f;      /* the numbers printed on the edge */
  --pencil: #e2321f;          /* the red grease pencil */
  --pointer: #f7f4ef;         /* the drawn pointer */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(243, 226, 196, 0.07), transparent 70%),
    radial-gradient(120% 90% at 50% 120%, rgba(0, 0, 0, 0.6), transparent 60%),
    var(--page);
}

/* a whisper of grain over the whole page */
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---- the folio card ---- */
.folio {
  --pad: clamp(10px, 2.4vmin, 16px);
  position: relative;
  z-index: 1;
  width: min(680px, 92vw, 100%, calc((100vh - 48px) * 0.96));
  padding: var(--pad);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--card), var(--card-low));
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 246, 230, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 14px 28px -14px rgba(0, 0, 0, 0.7),
    0 40px 80px -30px rgba(0, 0, 0, 0.85);
  opacity: 0;
}

.folio__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px calc(var(--pad) * 0.8);
  font-size: clamp(10.5px, 1.9vmin, 12.5px);
  white-space: nowrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.brand__mark {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.brand__name {
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.005em;
}

.brand__sub,
.roll {
  color: var(--muted);
  font-stretch: 92%;
}

.roll {
  font-variant-numeric: tabular-nums;
}

/* ---- the lightbox ---- */
.viewer {
  position: relative;
  aspect-ratio: 3 / 2;
  container-type: inline-size;
  border-radius: 10px;
  isolation: isolate;
}

.glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background:
    radial-gradient(70% 80% at 50% 46%, var(--glass) 0%, #e6dfd2 46%, var(--glass-edge) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 0 40px rgba(120, 104, 82, 0.35),
    0 0 50px -6px rgba(243, 226, 196, 0.14);
  opacity: 0;
}

/* ruler ticks along the top and bottom of the glass */
.glass__ticks {
  position: absolute;
  inset: 6px 10px;
  background:
    repeating-linear-gradient(90deg, rgba(60, 50, 38, 0.22) 0 1px, transparent 1px 5%) top / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, rgba(60, 50, 38, 0.22) 0 1px, transparent 1px 5%) bottom / 100% 5px no-repeat;
}

.hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #7b7164;
  font-size: clamp(11px, 3.1cqi, 14px);
  font-stretch: 94%;
}

.hint__loupe {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.fly {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 10px;
  overflow: hidden;
  visibility: hidden;
  --lift: 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 calc(var(--lift) * 18px) calc(var(--lift) * 40px) calc(var(--lift) * -8px) rgba(0, 0, 0, 0.75),
    0 calc(var(--lift) * 4px) calc(var(--lift) * 10px) rgba(0, 0, 0, calc(var(--lift) * 0.5));
  will-change: transform;
}

.fly__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* the gloss of the print catching the light as it lands */
.fly__sheen {
  position: absolute;
  inset: -10% -60%;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 250, 240, 0.16) 47%, rgba(255, 250, 240, 0.32) 50%, rgba(255, 250, 240, 0.16) 53%, transparent 62%);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}

.fly__scrim {
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(180deg, transparent, rgba(6, 5, 4, 0.72));
  opacity: 0;
}

/* ---- the caption ---- */
.cap {
  position: absolute;
  z-index: 3;
  left: 4.2cqi;
  right: 4.2cqi;
  bottom: 3.6cqi;
  margin: 0;
  pointer-events: none;
}

.cap__row {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.cap__row > span {
  display: inline-block;
}

.cap__place {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-style: italic;
  font-weight: 380;
  font-size: clamp(15px, 5.4cqi, 30px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #fbf7f0;
}

.cap__row--meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0.35em;
  font-size: clamp(10px, 2.5cqi, 13px);
  font-stretch: 90%;
  color: rgba(251, 247, 240, 0.72);
  font-variant-numeric: tabular-nums;
}

.cap__place,
.cap__film,
.cap__year {
  transform: translateY(110%);
}

/* ---- the back button ---- */
.back {
  position: absolute;
  z-index: 3;
  top: 3cqi;
  left: 3cqi;
  padding: 0;
  border: 0;
  background: none;
  color: #fbf7f0;
  font: inherit;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
}

.back__face {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  background: rgba(18, 16, 14, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 14px -6px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  font-size: clamp(10px, 2.4cqi, 12.5px);
  font-stretch: 94%;
}

.back__face svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back:focus-visible {
  outline: none;
}

.back:focus-visible .back__face {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 0 0 2px var(--pencil);
}

/* ---- the contact strip ---- */
.strip {
  --fw: 50px;                 /* the width of a frame, set by the script */
  position: relative;
  margin-top: calc(var(--pad) * 0.9);
  padding: 0 calc(var(--fw) * 0.12);
  border-radius: 4px;
  background: linear-gradient(180deg, #211e1a, var(--film) 30%, var(--film) 70%, #15130f);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 10px 18px -10px rgba(0, 0, 0, 0.8);
  opacity: 0;
}

.strip__edge {
  position: relative;
  overflow: hidden;
  height: max(9px, calc(var(--fw) * 0.14));
  color: var(--edge-print);
  font-size: max(6.5px, calc(var(--fw) * 0.085));
  font-weight: 620;
  font-stretch: 78%;
  letter-spacing: 0.08em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.edge__num {
  position: absolute;
  bottom: 1px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.edge__num--half {
  opacity: 0.7;
}

.edge__num svg {
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.15em;
  fill: currentColor;
  vertical-align: -0.02em;
}

.edge__film {
  position: absolute;
  top: 1px;
  white-space: nowrap;
  opacity: 0.85;
}

.edge__bars {
  display: inline-block;
  width: 3.4em;
  height: 0.8em;
  margin-left: 0.5em;
  vertical-align: -0.05em;
  background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 2px, currentColor 2px 4px, transparent 4px 5px, currentColor 5px 6px, transparent 6px 8px);
  opacity: 0.8;
}

.strip__edge--bottom .edge__film {
  top: 2px;
}

.strip__holes {
  display: block;
  width: 100%;
  height: calc(var(--fw) * 0.1);
  min-height: 6px;
}

.strip__frames {
  display: flex;
  justify-content: space-between;
  gap: calc(var(--fw) * 0.07);
  padding: calc(var(--fw) * 0.05) 0;
}

.frame {
  position: relative;
  flex: 1 1 0;
  aspect-ratio: 3 / 2;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: #050505;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.frame__lift {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, filter 0.35s ease;
}

.frame__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.frame:focus-visible {
  outline: none;
}

.frame:focus-visible .frame__lift {
  box-shadow: 0 0 0 2px var(--pencil);
}

.strip.is-looking .frame__lift {
  filter: brightness(0.72);
}

.strip.is-looking .frame.is-hover .frame__lift {
  filter: brightness(1.08);
}

.frame.is-hover .frame__lift {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 14px -6px rgba(0, 0, 0, 0.9);
}

@media (hover: hover) {
  .strip:has(.frame:hover) .frame__lift {
    filter: brightness(0.72);
  }

  .strip .frame:hover .frame__lift {
    filter: brightness(1.08);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 14px -6px rgba(0, 0, 0, 0.9);
  }
}

/* the grease pencil marks, drawn over the strip */
.marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.mark path {
  fill: none;
  stroke: var(--pencil);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- the drawn pointer ---- */
.pointer {
  position: absolute;
  z-index: 5;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  margin: -4px 0 0 -6px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.55));
}

.pointer__shape {
  fill: var(--pointer);
  stroke: #1a1815;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

@media (max-width: 380px) {
  .roll__more,
  .brand__sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .frame__lift {
    transition: filter 0.3s ease;
  }

  .frame.is-hover .frame__lift,
  .strip .frame:hover .frame__lift {
    transform: none;
  }
}
