/* The gallery of a flat to rent: a card with one large photo of the living room (a real photo drawn in a canvas, with the light of the hour laid over it) and
   the slider of the day under it. The canvas fills .photo; the loupe sits over it; the ghost pointer is the
   autopilot. */
:root {
  --fondo: #ebe7e0;           /* the page */
  --fondo-luce: #f7f3ec;      /* the soft light on the page */
  --carta: #fbfaf7;           /* the card */
  --testo: #1c1b19;           /* the words */
  --testo-2: #6c6962;         /* the small words */
  --testo-3: #a6a29a;         /* the quiet words */
  --bordo: rgba(28, 27, 25, 0.09);
  --riga: rgba(28, 27, 25, 0.08);
  --accento: #d9772f;         /* the colour of the evening */
  --mattino: #8fa8c8;         /* the colour of the morning */
  --mezzogiorno: #e9d9b4;     /* the colour of noon */
  --focus: #5b6cff;
}

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

html, body { height: 100%; }

body {
  background:
    radial-gradient(120% 80% at 30% 0%, var(--fondo-luce) 0%, rgba(247, 243, 236, 0) 60%),
    radial-gradient(90% 70% at 100% 100%, #e3ddd3 0%, rgba(227, 221, 211, 0) 70%),
    var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* a whisper of grain on the page, so the background is never flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.09  0 0 0 0 0.08  0 0 0 0.09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

.card {
  --w: min(660px, 92vw, 100%);
  position: relative;
  width: var(--w);
  background: var(--carta);
  border-radius: 22px;
  padding: 12px;
  box-shadow:
    0 0 0 1px var(--bordo),
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(28, 27, 25, 0.05),
    0 10px 24px -14px rgba(60, 44, 28, 0.22),
    0 40px 70px -40px rgba(60, 44, 28, 0.38);
  user-select: none;
  -webkit-user-select: none;
}

/* ---- the head: the mark, the name of the flat, the rent ---- */
.head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px 10px;
}
.mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(160deg, #2a2723, #14130f);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 4px 10px -4px rgba(0, 0, 0, 0.45);
}
.mark svg { width: 18px; height: 18px; fill: none; stroke: #f1e3cc; stroke-width: 1.5; stroke-linecap: round; }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.15; }
.brand { font-size: 11px; color: var(--testo-2); letter-spacing: 0.01em; }
.title {
  font-size: 15px;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.price { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.price b { font-size: 15px; font-weight: 640; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.price small { font-size: 11px; color: var(--testo-2); }

/* ---- the photo ---- */
.photo {
  position: relative;
  height: clamp(140px, min(calc((min(660px, 92vw) - 24px) * 0.6), calc(100vh - 200px)), 400px);
  border-radius: 14px;
  overflow: hidden;
  background: #cfc7ba;
  box-shadow: 0 0 0 1px rgba(28, 27, 25, 0.1), 0 2px 6px -2px rgba(28, 27, 25, 0.2);
  isolation: isolate;
  cursor: none;
  touch-action: pan-y;
}
.photo__cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* a hairline of light on the inside of the photo's edge, like a print under glass */
.photo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 3;
}

.chip {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 560;
  color: #fff;
  background: rgba(24, 20, 16, 0.32);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 4px 12px -6px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.chip svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.chip--room { top: 10px; left: 10px; }
.chip--count { top: 10px; right: 10px; }

.hint {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.hint svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3)); }

/* ---- the loupe: a thin ring of glass with the detail magnified, and a tag that names it ---- */
.lens {
  --d: 120px;
  position: absolute;
  z-index: 4;
  left: 0;
  top: 0;
  width: var(--d);
  height: var(--d);
  margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.lens__glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.85),
    0 0 0 2px rgba(20, 16, 12, 0.18),
    0 14px 30px -10px rgba(20, 14, 8, 0.55),
    0 3px 8px -2px rgba(20, 14, 8, 0.3);
}
.lens__glass canvas { width: 100%; height: 100%; display: block; }
/* the glass: a curved reflection on the top left and a darker rim, so it reads as a lens and not a hole */
.lens__glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(70% 55% at 30% 18%, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 62%, rgba(10, 8, 6, 0.28) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.lens__tag {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 560;
  color: #fff;
  background: rgba(22, 18, 14, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 14px -6px rgba(0, 0, 0, 0.5);
}
.lens__tag > span { display: block; }
.lens.is-up .lens__tag { top: auto; bottom: calc(100% + 8px); }

/* ---- the readout: the time that rolls, the light in words, the exposure ---- */
.readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 4px 8px;
}
.clock { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.time {
  display: inline-flex;
  font-size: 24px;
  line-height: 1;
  height: 1em;
  font-weight: 600;
  font-stretch: 92%;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--testo);
}
.digit { position: relative; display: inline-block; width: 0.6em; height: 1em; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 13%, #000 87%, transparent 100%); mask-image: linear-gradient(180deg, transparent 0, #000 13%, #000 87%, transparent 100%); }
.digit > span { position: absolute; left: 0; top: 0; width: 100%; display: flex; flex-direction: column; will-change: transform; }
.digit i { display: block; height: 1em; font-style: normal; text-align: center; }
.colon { display: inline-block; width: 0.3em; text-align: center; transform: translateY(-0.04em); color: var(--testo-2); }
.phase {
  display: block;
  height: 15px;
  overflow: hidden;
  font-size: 12px;
  line-height: 15px;
  color: var(--testo-2);
  white-space: nowrap;
}
.phase > span { display: block; }

.facing { flex: none; display: flex; align-items: center; gap: 8px; }
.compass { width: 26px; height: 26px; flex: none; overflow: visible; }
.compass__ring { fill: #fff; stroke: var(--riga); stroke-width: 1; }
.compass__ticks path { stroke: var(--testo-3); stroke-width: 1; stroke-linecap: round; }
.compass__n { fill: var(--accento); }
.compass__s { fill: #cfc9bf; }
.compass__hub { fill: #fff; stroke: var(--testo-2); stroke-width: 0.8; }
.facing__txt { display: flex; flex-direction: column; line-height: 1.2; }
.facing__txt b { font-size: 12px; font-weight: 600; }
.facing__txt small { font-size: 10.5px; color: var(--testo-2); font-variant-numeric: tabular-nums; }

/* ---- the slider of the day ---- */
.track { position: relative; padding: 6px 4px 0; touch-action: none; cursor: pointer; }
.rail {
  position: relative;
  height: 6px;
  border-radius: 999px;
  margin: 6px 9px 0;
  background: linear-gradient(90deg, var(--mattino) 0%, #cdd6df 22%, var(--mezzogiorno) 50%, #f0c27f 74%, var(--accento) 90%, #6c6a8e 100%);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
}
.rail__ticks { position: absolute; left: 0; right: 0; top: 10px; height: 5px; }
.rail__ticks i { position: absolute; top: 0; width: 1px; height: 4px; margin-left: -0.5px; background: var(--testo-3); opacity: 0.55; }
.rail__ticks i.is-big { height: 6px; opacity: 0.9; }
.knob {
  position: absolute;
  left: 0;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  outline: none;
  cursor: grab;
}
.knob__in {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffffff, #f3f0ea);
  box-shadow:
    0 0 0 1px rgba(28, 27, 25, 0.12),
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 4px 10px -3px rgba(40, 28, 16, 0.35),
    0 1px 2px rgba(40, 28, 16, 0.2);
}
.knob__in svg { width: 15px; height: 15px; fill: none; stroke: var(--sole, #e0a03c); stroke-width: 1.4; stroke-linecap: round; }
.knob__in svg circle { fill: var(--sole, #e0a03c); stroke: none; }
.knob:focus-visible .knob__in { box-shadow: 0 0 0 2px var(--focus), 0 4px 10px -3px rgba(40, 28, 16, 0.35); }

.stops { display: flex; justify-content: space-between; margin-top: 12px; }
.stops button {
  font: inherit;
  font-size: 12px;
  font-weight: 520;
  font-stretch: 100%;
  color: var(--testo-3);
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
  transition: color 0.3s, font-stretch 0.3s, font-weight 0.3s;
}
.stops button.is-on { color: var(--testo); font-weight: 620; font-stretch: 108%; }
.stops button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---- the ghost pointer of the autopilot ---- */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  z-index: 10;
  fill: #1c1b19;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.28));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 440px) {
  .card { padding: 10px; border-radius: 20px; }
  .head { padding-bottom: 8px; }
  .mark { width: 28px; height: 28px; border-radius: 9px; }
  .title, .price b { font-size: 13.5px; }
  .time { font-size: 21px; }
  .phase { font-size: 11px; }
  .facing__txt b { font-size: 11px; }
  .facing__txt small { font-size: 10px; }
  .compass { width: 22px; height: 22px; }
  .chip { height: 22px; font-size: 10.5px; padding: 0 8px; }
  .lens { --d: 92px; }
  .stops button { font-size: 11px; }
}
@media (max-width: 360px) {
  .facing__txt small { display: none; }
  .phase { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}
@media (max-height: 460px) {
  .readout { padding: 9px 4px 6px; }
  .stops { margin-top: 9px; }
}
