:root {
  --wall: #ecd1ae;              /* the plaster of the house front */
  --wall-dark: #d6ad84;         /* the stains and the shade on the plaster */
  --stone: #e6dac4;             /* the stone round the window and the sill */
  --stone-dark: #b7a281;
  --shutter: #2f6a4c;           /* the paint of the shutters */
  --shutter-light: #4f8f69;
  --shutter-dark: #1b4332;
  --iron: #2a2320;              /* hinges, latch and catches */
  --ink: #2b1d14;
  --ink-soft: #7d604a;
  --paper: #fbf3e6;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--ink);
  background-color: var(--wall);
  /* the plaster: soft stains and a fine grain drawn here, no photo */
  background-image:
    radial-gradient(120% 70% at 12% 8%, color-mix(in oklab, var(--wall-dark) 34%, transparent), transparent 60%),
    radial-gradient(90% 60% at 92% 96%, color-mix(in oklab, var(--wall-dark) 40%, transparent), transparent 62%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .28 0 0 0 0 .16 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- the page */
.stage {
  --gutter: 28px;
  --ratio: 0.72;                /* the window, width over height */
  --stone-w: clamp(10px, 1.6vw, 18px);
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 18px var(--gutter) 24px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__mark rect { fill: var(--shutter); }
.brand__mark path { stroke: var(--paper); stroke-width: 1.3; stroke-linecap: round; opacity: 0.75; }
.brand__name {
  font-family: 'Newsreader Variable', Georgia, serif;
  font-size: 21px;
  font-weight: 560;
  font-variation-settings: 'opsz' 40;
  letter-spacing: -0.01em;
}
.top__note {
  font-size: 12.5px;
  font-weight: 540;
  font-stretch: 112%;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.listing {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  min-height: 0;
}

/* ---------------------------------------------------------------- the window */
.scene {
  /* as tall as the page lets it, and narrow enough for the two leaves to lie open on the wall on either side */
  --h: max(190px, min(calc(100svh - 410px), calc((100vw - 2 * var(--gutter)) / 2.14 / var(--ratio))));
  --w: calc(var(--h) * var(--ratio));
  position: relative;
  width: var(--w);
  height: var(--h);
  margin: calc(var(--stone-w) + 10px) 0 calc(var(--h) * 0.05 + 22px);
  perspective: calc(var(--w) * 3.4);
  perspective-origin: 50% 46%;
  touch-action: pan-y;
}
.window {
  position: absolute;
  inset: 0;
  z-index: 0;
}
/* the stone frame round the opening */
.window::before {
  content: '';
  position: absolute;
  inset: calc(var(--stone-w) * -1);
  z-index: -1;
  border-radius: 3px;
  background:
    linear-gradient(135deg, color-mix(in oklab, var(--stone) 92%, #fff), var(--stone) 40%, color-mix(in oklab, var(--stone), var(--stone-dark) 45%));
  box-shadow:
    inset 0 0 0 1px color-mix(in oklab, var(--stone-dark) 60%, transparent),
    0 2px 0 color-mix(in oklab, var(--stone-dark) 70%, transparent),
    6px 10px 18px -6px rgba(70, 40, 15, 0.35);
}
.view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #2a2320;
}
.photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.photo[hidden] { display: none; }
/* the depth of the opening: the stone throws a shadow on the top and on the left */
.view::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 10px 14px 18px -10px rgba(30, 15, 5, 0.55), inset -2px -2px 0 rgba(255, 240, 220, 0.2);
}
.view__shade {
  position: absolute;
  inset: 0;
  background: #140d08;
  opacity: 0.5;
  pointer-events: none;
}
.view__sheen {
  position: absolute;
  inset: -20% -60%;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 250, 238, 0.32) 47%, rgba(255, 250, 238, 0.08) 53%, transparent 60%);
  transform: translateX(-70%);
  pointer-events: none;
  mix-blend-mode: soft-light;
}

/* shadows of the open leaves on the wall: the script stretches them as the leaves come near */
.cast {
  position: absolute;
  top: 2%;
  height: 99%;
  width: 50%;
  background: rgba(70, 38, 14, 0.42);
  filter: blur(7px);
  opacity: 0;
  pointer-events: none;
}
.cast--l { right: 100%; transform-origin: 100% 50%; }
.cast--r { left: 100%; transform-origin: 0% 50%; }

/* ---------------------------------------------------------------- the shutters */
.leaves {
  position: absolute;
  inset: 0;
  z-index: 1;
  transform-style: preserve-3d;
  pointer-events: none;
}
.leaf {
  --dim: 0;
  --paint: color-mix(in oklab, var(--shutter), #0b0604 calc(var(--dim) * 100%));
  --paint-light: color-mix(in oklab, var(--shutter-light), #0b0604 calc(var(--dim) * 100%));
  --paint-dark: color-mix(in oklab, var(--shutter-dark), #0b0604 calc(var(--dim) * 100%));
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  pointer-events: auto;
}
.leaf--l { left: 0; transform-origin: 0% 50%; }
.leaf--r { right: 0; transform-origin: 100% 50%; }
.leaf > span { position: absolute; display: block; }
/* stiles and rails: a frame with nothing in the middle, so the photo shows between the slats */
.leaf__bar {
  background: var(--paint);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}
.leaf__bar--top { left: 0; right: 0; top: 0; height: 5.5%; background: linear-gradient(var(--paint-light), var(--paint) 45%); }
.leaf__bar--bottom { left: 0; right: 0; bottom: 0; height: 5.5%; background: linear-gradient(var(--paint), var(--paint-dark)); }
.leaf__bar--hinge, .leaf__bar--meet { top: 5.5%; bottom: 5.5%; }
.leaf--l .leaf__bar--hinge { left: 0; width: 11%; }
.leaf--l .leaf__bar--meet { right: 0; width: 9%; }
.leaf--r .leaf__bar--hinge { right: 0; width: 11%; }
.leaf--r .leaf__bar--meet { left: 0; width: 9%; }
.leaf--l .leaf__bar--hinge, .leaf--r .leaf__bar--meet { background: linear-gradient(90deg, var(--paint-light), var(--paint) 40%); }
.leaf--r .leaf__bar--hinge, .leaf--l .leaf__bar--meet { background: linear-gradient(90deg, var(--paint), var(--paint-dark)); }
.leaf__rail {
  top: 48%;
  height: 4%;
  background: linear-gradient(var(--paint-light), var(--paint) 40%, var(--paint-dark));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}
/* behind the slats when they are shut, so no hairline of the photo shows between them */
.leaf__back {
  top: 5.5%;
  bottom: 5.5%;
  background: var(--paint-dark);
  transform: translateZ(-2px);
}
.slat {
  background: linear-gradient(var(--paint-light) 0%, var(--paint) 34%, var(--paint-dark) 100%);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.22);
}
.leaf--l :is(.slat, .leaf__back, .leaf__rail) { left: 11%; right: 9%; }
.leaf--r :is(.slat, .leaf__back, .leaf__rail) { left: 9%; right: 11%; }
/* the thickness of the leaf, seen when it stands out from the wall */
.leaf__edge {
  top: 0;
  height: 100%;
  width: 7px;
  background: var(--paint-dark);
}
.leaf--l .leaf__edge { left: 100%; transform-origin: 0 50%; transform: rotateY(90deg); }
.leaf--r .leaf__edge { right: 100%; transform-origin: 100% 50%; transform: rotateY(-90deg); }
.leaf__hinge {
  width: 13%;
  height: 1.8%;
  background: var(--iron);
  border-radius: 0 3px 3px 0;
  transform: translateZ(1px);
}
.leaf--l .leaf__hinge { left: -2px; }
.leaf--r .leaf__hinge { right: -2px; border-radius: 3px 0 0 3px; }
/* the latch on the right leaf: an iron rod with a handle that turns before the leaves open */
.latch {
  left: 4.6%;
  top: 4%;
  bottom: 4%;
  width: 4px;
  border-radius: 2px;
  background: var(--iron);
  transform: translateZ(14px);
}
.latch__handle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 22%;
  margin-left: -3px;
  border-radius: 3px;
  background: var(--iron);
  transform-origin: 50% 8%;
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--iron), #fff 18%);
}
.pin {
  position: absolute;
  width: 7px;
  height: 3.6%;
  border-radius: 3px;
  background: var(--iron);
  transform: translateZ(1px);
}
/* the iron catches on the wall that hold the open leaves */
.catch {
  position: absolute;
  top: 74%;
  width: 16px;
  height: 30px;
  margin-left: -8px;
  transform-origin: 50% 4px;
  pointer-events: none;
}
.catch svg { width: 100%; height: 100%; display: block; overflow: visible; }
.catch path { fill: none; stroke: var(--iron); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.catch circle { fill: var(--iron); }

/* the sill and its geranium */
.sill {
  position: absolute;
  left: calc(var(--stone-w) * -1 - 4%);
  right: calc(var(--stone-w) * -1 - 4%);
  top: calc(100% + var(--stone-w) - 2px);
  height: calc(var(--h) * 0.045 + 10px);
  transform-style: preserve-3d;
  border-radius: 2px;
  background: linear-gradient(color-mix(in oklab, var(--stone) 80%, #fff) 0 34%, color-mix(in oklab, var(--stone), var(--stone-dark) 55%) 34% 100%);
  box-shadow: 0 12px 16px -8px rgba(70, 40, 15, 0.45);
}
.pot {
  position: absolute;
  left: 9%;
  bottom: 60%;
  width: calc(var(--w) * 0.2);
  height: auto;
  aspect-ratio: 60 / 64;
  transform: translateZ(10px);
  overflow: visible;
}

/* ---------------------------------------------------------------- the listing card */
.card {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 6px;
}
.card__name {
  margin: 0;
  font-family: 'Newsreader Variable', Georgia, serif;
  font-weight: 500;
  font-size: clamp(28px, 2.2vw + 14px, 50px);
  font-variation-settings: 'opsz' 72;
  line-height: 1.04;
  letter-spacing: -0.015em;
}
.card__mask {
  display: inline-block;
  overflow: clip;
  padding: 0 0.06em 0.1em;
  margin-bottom: -0.1em;
}
.word { display: inline-block; white-space: nowrap; }
.char { display: inline-block; will-change: transform; }
.card__place {
  margin: 0;
  font-size: 13.5px;
  font-weight: 520;
  font-stretch: 108%;
  letter-spacing: 0.015em;
  color: var(--ink-soft);
}
.card__facts {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 4px;
}
.card__price {
  margin: 0;
  font-size: 19px;
  font-weight: 680;
  font-stretch: 112%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}
.card__stats {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.card__stats li { display: inline-flex; align-items: center; gap: 5px; }
.card__stats svg { width: 19px; height: 19px; fill: none; stroke: var(--shutter); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.card__unit { font-weight: 500; color: var(--ink-soft); }

/* ---------------------------------------------------------------- the choice of home */
.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.arrow {
  position: relative;
  width: 46px;
  height: 46px;
  flex: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--paper);
}
.arrow__ground {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--shutter);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.55s cubic-bezier(0.34, 1.8, 0.5, 1), background-color 0.3s ease;
}
.arrow svg {
  position: relative;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s cubic-bezier(0.34, 1.8, 0.5, 1);
}
.arrow:active .arrow__ground { transform: scale(0.9); transition-duration: 0.12s; }
.arrow:focus-visible { outline: none; }
.arrow:focus-visible .arrow__ground { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--shutter); }

.tabs {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--paper) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--stone-dark) 45%, transparent);
}
.tabs__pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--shutter);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.tab {
  position: relative;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 10px 17px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 580;
  font-stretch: 100%;
  white-space: nowrap;
  color: var(--ink);
  transition: font-stretch 0.5s cubic-bezier(0.34, 1.7, 0.5, 1), color 0.3s ease;
}
.tab[aria-pressed='true'] { color: var(--paper); font-stretch: 110%; }
/* the widest the label gets, kept invisible, so the tabs never change size and the pill stays under them */
.tab::after {
  content: attr(data-label);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-stretch: 116%;
}
.tab:focus-visible { outline: 2px solid var(--shutter); outline-offset: 2px; }

@media (hover: hover) and (pointer: fine) {
  .arrow:hover .arrow__ground { transform: scale(1.12); background-color: color-mix(in oklab, var(--shutter), #000 14%); }
  .arrow--next:hover svg { transform: translateX(2.5px); }
  .arrow--prev:hover svg { transform: translateX(-2.5px); }
  .tab:hover { font-stretch: 116%; }
  .tab[aria-pressed='false']:hover { color: var(--shutter-dark); }
}

/* ---------------------------------------------------------------- phone */
@media (max-width: 640px) {
  .stage { --gutter: 16px; --ratio: 0.5; padding-top: 14px; padding-bottom: 18px; }
  .scene { --h: max(190px, min(calc(100svh - 400px), calc((100vw - 2 * var(--gutter)) / 2.1 / var(--ratio)))); }
  .brand__name { font-size: 18px; }
  .top__note { font-size: 11.5px; }
  .card__price { font-size: 17px; }
  .card__stats { font-size: 13px; gap: 12px; }
  .nav { gap: 6px; }
  .arrow { width: 36px; height: 36px; }
  .arrow svg { width: 18px; height: 18px; }
  .tab { padding: 9px 8px; font-size: 12px; font-stretch: 84%; }
  .tab[aria-pressed='true'] { font-stretch: 94%; }
  .tab::after { font-stretch: 94%; }
  .tab:hover, .tab[aria-pressed='true']:hover { font-stretch: 94%; }
  .tab[aria-pressed='false']:hover { font-stretch: 84%; }
}
@media (max-width: 640px) and (max-height: 700px) {
  .top__note { display: none; }
}
