/* The landscape gallery where each photo opens along its horizon: the portfolio viewer of Fellmark, a made-up
   landscape studio, on a near black page. Every photo is two layers of the same picture, the sky above its horizon
   and the land below it, so the two can part from the line. The line of light, the thirds and the pointer light sit
   over the photos; the veil on top holds the inner edge and a soft vignette. */
:root {
  --page: #0b0c0e;          /* the page */
  --card: #15161a;          /* the body of the viewer */
  --card-low: #111215;      /* the bottom of the viewer */
  --edge: rgba(255, 255, 255, 0.07); /* the thin edge that takes the light */
  --ink: #eceae6;           /* the words */
  --muted: #8d8b86;         /* the small words */
  --sun: #f0cf9f;           /* the low sun of the line of light */
}

* {
  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;
}

p,
ul {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

.palco {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vmin, 32px);
  overflow: hidden;
  background:
    radial-gradient(60% 45% at 50% 38%, rgba(240, 207, 159, 0.06), transparent 70%),
    var(--page);
}

/* the viewer */
.viewer {
  position: relative;
  width: min(92vw, 600px, calc((100vh - 196px) * 1.5 + 28px));
  display: grid;
  gap: clamp(8px, 1.8vmin, 14px);
  padding: clamp(10px, 2.2vmin, 16px);
  border-radius: clamp(16px, 3vmin, 22px);
  background: linear-gradient(180deg, var(--card), var(--card-low));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px var(--edge),
    0 2px 4px rgba(0, 0, 0, 0.35),
    0 22px 44px -18px rgba(0, 0, 0, 0.75),
    0 60px 110px -40px rgba(0, 0, 0, 0.7);
  opacity: 0;
}

.testa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  line-height: 1;
}

.marchio {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 620;
  font-variation-settings: 'wdth' 108;
  letter-spacing: 0.01em;
}

.marchio__segno {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--sun);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.serie {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.serie span {
  color: var(--muted);
  margin-left: 6px;
}

/* the frame */
.cornice {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: clamp(10px, 2vmin, 14px);
  overflow: hidden;
  isolation: isolate;
  background: #0e0f11;
  touch-action: pan-y;
  cursor: grab;
}

.cornice:active {
  cursor: grabbing;
}

.lastra {
  position: absolute;
  inset: 0;
  margin: 0;
  visibility: hidden;
}

.meta {
  position: absolute;
  inset: 0;
  will-change: clip-path;
}

.meta img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

/* the thirds of the viewfinder, seen only while the photo changes */
.terzi {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}

.terzi i {
  position: absolute;
  background: rgba(255, 255, 255, 0.5);
}

.terzi i:nth-child(1),
.terzi i:nth-child(2) {
  top: 0;
  bottom: 0;
  width: 1px;
}

.terzi i:nth-child(1) { left: 33.333%; }
.terzi i:nth-child(2) { left: 66.667%; }

.terzi i:nth-child(3),
.terzi i:nth-child(4) {
  left: 0;
  right: 0;
  height: 1px;
}

.terzi i:nth-child(3) { top: 33.333%; }
.terzi i:nth-child(4) { top: 66.667%; }

/* the line of light: the wrapper is as tall as the frame and moves by yPercent, so the line sits on the horizon */
.guida {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.linea {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  opacity: 0;
}

.linea__filo {
  position: absolute;
  left: 0;
  right: 0;
  top: -0.5px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sun) 14%, #fffaf2 50%, var(--sun) 86%, transparent);
  box-shadow: 0 0 6px rgba(240, 207, 159, 0.8);
}

/* the anamorphic bloom around the line */
.linea__alone {
  position: absolute;
  left: 8%;
  right: 8%;
  top: -22px;
  height: 44px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(240, 207, 159, 0.42), rgba(240, 207, 159, 0.1) 45%, transparent 72%);
  mix-blend-mode: screen;
}

/* the two little level marks at the ends */
.linea__capo {
  position: absolute;
  left: 10px;
  top: -5px;
  width: 1px;
  height: 10px;
  background: #fffaf2;
  border-radius: 1px;
}

.linea__capo--destra {
  left: auto;
  right: 10px;
}

/* the soft light that follows the pointer */
.luce {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  --x: 50%;
  --y: 40%;
  background: radial-gradient(240px circle at var(--x, 50%) var(--y, 40%), rgba(255, 244, 228, 0.16), transparent 70%);
  mix-blend-mode: soft-light;
}

/* the inner edge, the vignette and a breath of grain */
.velo {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 -60px 80px -60px rgba(0, 0, 0, 0.45);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.9;
  mix-blend-mode: overlay;
}

/* the caption */
.didascalia {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 14px;
  flex-wrap: wrap;
  min-height: 0;
}

.didascalia__nomi {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.titolo {
  position: relative;
  font-size: clamp(15px, 1.4vw + 9px, 21px);
  line-height: 1.15;
  font-weight: 580;
  font-variation-settings: 'wdth' 112;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  padding-bottom: 2px;
}

.luogo {
  position: relative;
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
}

.dati {
  display: flex;
  gap: 4px;
  padding: 0;
  list-style: none;
}

.dato {
  position: relative;
  display: inline-flex;
  justify-content: center;
  overflow: hidden;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 540;
  color: #d9d4cb;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* the rolling letters */
.strato {
  display: inline-block;
  white-space: pre;
}

.strato--via {
  position: absolute;
  left: 0;
  top: 0;
}

.dato .strato--via {
  left: 8px;
  top: 5px;
}

.lettera {
  display: inline-block;
  white-space: pre;
}

/* the strip */
.fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.miniature {
  position: relative;
  display: flex;
  gap: clamp(4px, 1vmin, 7px);
  padding: 3px;
}

.miniatura {
  position: relative;
  z-index: 1;
  width: clamp(36px, 7.6vmin, 60px);
  aspect-ratio: 3 / 2;
  padding: 0;
  border: 0;
  border-radius: 7px;
  overflow: hidden;
  background: #0e0f11;
  cursor: pointer;
  opacity: 0.5;
  -webkit-tap-highlight-color: transparent;
}

.miniatura img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.miniatura:focus-visible {
  outline: 1px solid var(--sun);
  outline-offset: 2px;
}

/* the ring that springs from thumbnail to thumbnail, with the thin run of the autoplay inside */
.selettore {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  border-radius: 9px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 250, 242, 0.85), 0 0 14px rgba(240, 207, 159, 0.22);
  opacity: 0;
}

.selettore__corsa {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 4px;
  height: 1.5px;
  border-radius: 2px;
  background: #fffaf2;
  transform-origin: 0 50%;
  transform: scaleX(0);
  opacity: 0.9;
}

.frecce {
  display: flex;
  gap: 6px;
}

.freccia {
  width: clamp(28px, 5.4vmin, 34px);
  height: clamp(28px, 5.4vmin, 34px);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 10px -4px rgba(0, 0, 0, 0.6);
  -webkit-tap-highlight-color: transparent;
}

.freccia svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.freccia:focus-visible {
  outline: 1px solid var(--sun);
  outline-offset: 2px;
}

@media (hover: hover) {
  .freccia:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
  }
}

@media (max-width: 420px) {
  .serie span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terzi,
  .guida {
    display: none;
  }
}
