/* Architecture projects, each photo opening from its plan: the project index of Ostrava Studio, a made-up architecture
   practice. A warm paper card with a 1px edge and soft layered shadows; on the left the list (a small plan in thin
   lines, the name, the city, the year, the floor area), on the right the viewer, a sheet of drafting paper where the
   real photos open out of the plans. On a phone the viewer sits above the list. Positions and clip shapes are written
   by the script. */
:root {
  --fondo: #ece6db;        /* the warm page behind the card */
  --carta: #f8f4ec;        /* the card */
  --foglio: #f3eee4;       /* the drafting paper of the viewer */
  --inchiostro: #1b1814;   /* names, lines of the plans */
  --tenue: #8c8478;        /* city, year, area at rest */
  --sottile: #ddd5c8;      /* the 1px edges and the grid of the paper */
  --accento: #a9532c;      /* burnt clay: the plan that lifts and the lit area */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(110% 80% at 12% -10%, #f7f2e9 0%, rgba(247, 242, 233, 0) 60%),
    radial-gradient(90% 70% at 100% 115%, rgba(169, 83, 44, 0.07), rgba(169, 83, 44, 0) 70%),
    var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* a fine grain over the page, so the paper is never flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 0.35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.palco {
  display: grid;
  place-items: center;
  height: 100vh;
  height: 100dvh;
  padding: clamp(10px, 3vh, 28px) clamp(10px, 3vw, 28px);
}

/* ------------------------------------------------------------ the card */
.indice {
  width: min(960px, 100%);
  padding: clamp(12px, 3.2vh, 26px) clamp(12px, 2.6vw, 26px);
  border-radius: clamp(14px, 2vw, 20px);
  background: linear-gradient(180deg, #fbf8f2 0%, var(--carta) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 0 0 1px rgba(60, 46, 30, 0.08),
    0 1px 2px rgba(60, 46, 30, 0.06),
    0 10px 24px -10px rgba(60, 46, 30, 0.16),
    0 40px 70px -40px rgba(60, 46, 30, 0.3);
  opacity: 0;
}

.testa {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: clamp(8px, 2.2vh, 16px);
  border-bottom: 1px solid var(--sottile);
}

.marchio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: clamp(13px, 1.5vw, 15px);
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.marchio__segno {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  align-self: center;
}

.testa__nota {
  margin: 0;
  color: var(--tenue);
  font-size: clamp(11px, 1.2vw, 13px);
  font-weight: 450;
  white-space: nowrap;
}

.testa__anni {
  margin-left: 6px;
  color: var(--inchiostro);
  font-weight: 520;
}

.corpo {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(14px, 2.6vw, 30px);
  align-items: center;
  padding-top: clamp(10px, 2.4vh, 20px);
}

/* ------------------------------------------------------------ the list */
.elenco {
  position: relative;
}

.righe {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  list-style: none;
}

.righe li + li .riga::before {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 0;
  height: 1px;
  background: var(--sottile);
  transition: opacity 0.3s;
}

/* the soft card that slides under the lit row */
.lente {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 10px;
  z-index: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdf9, #fbf7f0);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(60, 46, 30, 0.09),
    0 6px 16px -8px rgba(60, 46, 30, 0.22),
    0 18px 30px -22px rgba(60, 46, 30, 0.3);
  opacity: 0;
  pointer-events: none;
}

.riga {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(40px, 10.4vh, 74px);
  padding: 0 10px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.riga:focus-visible {
  outline: 1.5px solid var(--accento);
  outline-offset: -2px;
  border-radius: 12px;
}

.riga__dentro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: clamp(10px, 1.6vw, 18px);
  height: 100%;
}

.riga__pianta {
  position: relative;
  display: block;
  width: clamp(28px, 6.4vh, 44px);
  height: clamp(28px, 6.4vh, 44px);
}

/* the shadow under the small plan, out of sight until the plan lifts */
.riga__ombra {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -3px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(60, 40, 20, 0.32), rgba(60, 40, 20, 0));
  opacity: 0;
}

.pianta {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--inchiostro);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pianta .pianta__fuori {
  stroke-width: 1.5;
  fill: rgba(255, 255, 255, 0.55);
}

.pianta .pianta__muri {
  stroke-width: 0.9;
}

.pianta .pianta__fine {
  stroke-width: 0.7;
  opacity: 0.6;
}

.pianta path,
.pianta circle,
.pianta rect,
.pianta polygon {
  vector-effect: non-scaling-stroke;
}

.riga__nome {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.riga__titolo {
  overflow: hidden;
  font-size: clamp(13px, 1.75vw, 18px);
  font-weight: 460;
  font-stretch: 100%;
  letter-spacing: -0.012em;
  line-height: 1.15;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: font-weight 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), font-stretch 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.riga__citta,
.riga__dato {
  color: var(--tenue);
  font-size: clamp(10.5px, 1.2vw, 12.5px);
  font-weight: 440;
  line-height: 1.2;
  white-space: nowrap;
  transition: color 0.35s, font-weight 0.45s;
}

.riga__dato {
  min-width: 3.4em;
  text-align: right;
}

.riga__area {
  min-width: 5.4em;
}

.riga.is-accesa .riga__titolo {
  font-weight: 650;
  font-stretch: 104%;
}

.riga.is-accesa .riga__citta,
.riga.is-accesa .riga__dato {
  color: var(--inchiostro);
  font-weight: 540;
}

.riga.is-accesa .riga__area {
  color: var(--accento);
}

.elenco.is-viva .riga::before {
  opacity: 0.55;
}

/* ------------------------------------------------------------ the viewer */
.vista {
  position: relative;
  height: min(54vh, 400px);
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--foglio);
  box-shadow:
    inset 0 0 0 1px rgba(60, 46, 30, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.8),
    0 14px 30px -18px rgba(60, 46, 30, 0.3);
  isolation: isolate;
}

/* the drafting paper: a faint grid of 1px lines, finer every five */
.vista__carta {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(60, 46, 30, 0.07) 1px, transparent 1px) 0 0 / 50px 50px,
    linear-gradient(90deg, rgba(60, 46, 30, 0.07) 1px, transparent 1px) 0 0 / 50px 50px,
    linear-gradient(rgba(60, 46, 30, 0.035) 1px, transparent 1px) 0 0 / 10px 10px,
    linear-gradient(90deg, rgba(60, 46, 30, 0.035) 1px, transparent 1px) 0 0 / 10px 10px;
}

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

.vista__foto img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* the grain that ties the four photos together; it shows only over a photo */
.vista__grana {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background-image: var(--grana, none);
  background-size: 160px 160px;
  mix-blend-mode: overlay;
}

.pianta--grande {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 7;
  width: 100px;
  height: 100px;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.pianta--grande .pianta__fuori {
  stroke-width: 1.6;
  fill: none;
}

.pianta--grande .pianta__muri {
  stroke-width: 1;
}

.vista.is-foto .pianta--grande {
  stroke: #fff;
}

.nord {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--inchiostro);
  stroke-width: 1;
  transition: stroke 0.4s;
}

.nord path {
  fill: var(--inchiostro);
  stroke: none;
  transition: fill 0.4s;
}

.vista.is-foto .nord {
  stroke: rgba(255, 255, 255, 0.9);
}

.vista.is-foto .nord path {
  fill: rgba(255, 255, 255, 0.95);
}

.vista__nota {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 8;
  margin: 0;
  color: var(--tenue);
  font-size: 11.5px;
  font-weight: 480;
  letter-spacing: 0.01em;
}

.vista__piede {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 8;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

/* the frosted chip with the main material of the building */
.materiale {
  overflow: hidden;
  max-width: 62%;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(40, 32, 24, 0.34), rgba(24, 19, 14, 0.42));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 18px -8px rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
  color: #fff;
  font-size: 11px;
  font-weight: 540;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0;
}

.scala {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  width: 64px;
  color: #fff;
  font-size: 9px;
  font-weight: 520;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  opacity: 0;
}

.scala svg {
  grid-column: 1 / -1;
  width: 64px;
  height: 8px;
  overflow: visible;
  fill: none;
  stroke: #fff;
  stroke-width: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

.scala span:last-child {
  transform: translateX(6px);
}

/* ------------------------------------------------------------ the drawn pointer of the walk on its own */
.cursore {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(36, 26, 18, 0.28));
}

.cursore path {
  fill: var(--inchiostro);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------ narrow boxes: the photo above the list */
@media (max-width: 700px) {
  .corpo {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(8px, 2vh, 14px);
    padding-top: clamp(8px, 2vh, 14px);
  }

  .vista {
    order: -1;
    height: min(34vh, 58vw, 300px);
  }

  .riga {
    height: clamp(36px, 8.8vh, 58px);
    padding: 0 8px;
  }

  .riga__anno {
    display: none;
  }

  .nord {
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
  }

  .vista__nota {
    left: 10px;
    top: 10px;
    font-size: 10.5px;
  }

  .materiale {
    padding: 5px 9px;
    font-size: 10px;
  }
}

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