:root {
  --carta: #f7f5f0;          /* the warm paper of the page */
  --inchiostro: #171717;     /* the ink (the site's foreground) */
  --grigio: #8a867d;         /* the muted grey of the small labels */
  --riga: #dcd8cf;           /* the hairlines */
  --accento: #b4532a;        /* the only accent: the brown-red of a seed coat */
  --tenda-chiara: rgba(247, 245, 240, .98); /* the second curtain, the page at 98% as on the site */
  --magia: cubic-bezier(.33, 0, 0, 1);      /* the site's signature curve */
  --rimbalzo: cubic-bezier(.175, .885, .43, 1.6); /* the site's overshoot curve */
}

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

html, body { height: 100%; }

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(9px, min(1.05vw, 1.6vh), 12px);
  letter-spacing: .02em;
  text-transform: uppercase;
}

.solo-lettore {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.pagina {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

/* ---- the header ---- */
.testa {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--testa, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(14px, 2.4vw, 32px);
  z-index: 5;
}

.marchio {
  display: flex;
  align-items: baseline;
  gap: .6em;
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(15px, min(1.9vw, 3.2vh), 26px);
  line-height: 1;
  min-width: 0;
}

.conta { display: inline-flex; font-variant-numeric: tabular-nums; }

.cifra {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  width: .62em;
}

.striscia {
  display: block;
  width: .62em;
  word-spacing: 100vw; /* one digit per line */
  line-height: 1;
  white-space: normal;
  text-align: center;
  will-change: transform;
}

.etichetta {
  display: inline-block;
  height: 1.3em;
  overflow: hidden;
  font-size: .46em;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--grigio);
  white-space: nowrap;
  transform: translateY(.15em);
}

.etichetta__riga { display: flex; flex-direction: column; }
.etichetta__riga > span { height: 1.3em; line-height: 1.3em; }

.testa__nome {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.indietro {
  position: relative;
  border: 0;
  background: none;
  color: var(--inchiostro);
  padding: .55em .35em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
}

.indietro__fondo {
  position: absolute;
  inset: .3em 0;
  background: var(--inchiostro);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .3s cubic-bezier(.19, 1, .22, 1);
}

.indietro__testo { position: relative; transition: color .3s cubic-bezier(.19, 1, .22, 1); }

@media (hover: hover) {
  .indietro:hover .indietro__fondo { transform: scaleX(1); }
  .indietro:hover .indietro__testo { color: var(--carta); }
}

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

/* ---- the grid of seeds ---- */
.griglia {
  position: absolute;
  inset: var(--testa, 72px) 0 0 0;
}

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--lato, 200px);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: opacity .45s var(--magia);
  -webkit-tap-highlight-color: transparent;
}

.card:focus-visible { outline: none; }
.card:focus-visible .card__media { outline: 1px solid var(--accento); outline-offset: 3px; }

.card__cap {
  display: block;
  overflow: hidden;
  height: var(--cap, 22px);
}

.card__line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(8px, min(.8vw, 1.45vh), 11px);
  line-height: 1.3;
  letter-spacing: .02em;
  text-transform: uppercase;
  will-change: transform;
}

.stretta .card__resto { display: none; }

.card__nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.card__resto {
  display: flex;
  flex-direction: column;
  height: 1.3em;
  overflow: hidden;
  color: var(--grigio);
  flex: none;
  text-align: right;
}

.card__resto > span {
  height: 1.3em;
  transition: transform .45s var(--magia), color .45s var(--magia);
}

.card__ombra {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -4px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(23, 23, 23, .3), rgba(23, 23, 23, 0));
  filter: blur(5px);
  will-change: transform, opacity;
}

.card__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--carta);
  will-change: transform;
}

.card__inner {
  position: absolute;
  inset: 0;
  overflow: hidden;
  will-change: transform;
}

.card__zoom {
  position: absolute;
  inset: 0;
  transition: transform .8s var(--magia);
}

.card__zoom img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

/* a hairline of light on the top edge of the photo */
.card__inner::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 1px rgba(23, 23, 23, .06);
  pointer-events: none;
}

@media (hover: hover) {
  .griglia:has(.card:hover) .card:not(:hover) { opacity: .55; }
  .card:hover .card__zoom { transform: scale(1.035); }
  .card:hover .card__resto > span { transform: translateY(-100%); }
  .card:hover .card__resto > span:last-child { color: var(--accento); }
}

/* ---- the seed's own page ---- */
.scheda {
  position: absolute;
  inset: var(--testa, 72px) 0 0 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(20px, 4vw, 64px);
  padding: 0 clamp(14px, 2.4vw, 32px) clamp(14px, 4vh, 48px);
}

.scheda[hidden] { display: none; }

.scheda__testo { align-self: center; max-width: 30em; }

.scheda__piccolo { color: var(--grigio); margin-bottom: 1.2em; }

.scheda__nome {
  font-weight: 500;
  font-stretch: 112%;
  font-size: clamp(22px, min(3.6vw, 6.4vh), 56px);
  line-height: .98;
  letter-spacing: -.02em;
}

.scheda__latino {
  margin-top: .9em;
  text-transform: none;
  font-style: italic;
  color: var(--grigio);
}

.scheda__storia {
  margin-top: 1.6em;
  font-size: clamp(12px, min(1.15vw, 2vh), 16px);
  line-height: 1.5;
  max-width: 26em;
}

.scheda__foto {
  position: relative;
  width: min(36vw, 58vh);
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--riga);
}

.scheda__foto img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

.tenda {
  position: absolute;
  inset: -1px;
  transform-origin: right center;
  will-change: transform;
}

.tenda--scura { background: var(--inchiostro); }
.tenda--chiara { background: var(--tenda-chiara); }

.scheda__dati { justify-self: end; width: min(100%, 17em); }

.scheda__dati dl { display: grid; gap: clamp(10px, 2.2vh, 20px); }

.scheda__dati dl > div {
  display: grid;
  gap: .35em;
  padding-bottom: clamp(8px, 1.6vh, 14px);
  border-bottom: 1px solid var(--riga);
}

.scheda__dati dt { color: var(--grigio); }

.scheda__dati dd { font-size: clamp(13px, min(1.25vw, 2.2vh), 18px); font-stretch: 105%; }

/* the elastic pill */
.prendi {
  position: relative;
  margin-top: clamp(14px, 3.4vh, 32px);
  border: 0;
  background: none;
  color: var(--carta);
  font: inherit;
  font-size: clamp(12px, min(1.1vw, 2vh), 15px);
  font-weight: 500;
  padding: .95em 1.5em;
  cursor: pointer;
  isolation: isolate;
}

.prendi__fondo {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--inchiostro);
  z-index: -1;
  transition: transform .55s var(--rimbalzo), background-color .4s var(--magia);
}

.prendi__finestra { display: block; height: 1.25em; overflow: hidden; }

.prendi__testo { display: flex; flex-direction: column; will-change: transform; }

.prendi__testo > span {
  height: 1.25em;
  line-height: 1.25em;
  white-space: nowrap;
  font-stretch: 100%;
  transition: font-stretch .5s var(--rimbalzo);
}

@media (hover: hover) {
  .prendi:hover .prendi__fondo { transform: scale(1.06, 1.12); }
  .prendi:hover .prendi__testo > span { font-stretch: 116%; }
}

.prendi:active .prendi__fondo { transform: scale(.97); transition-duration: .12s; }
.prendi.is-preso .prendi__fondo { background-color: var(--accento); }
.prendi:focus-visible { outline: 1px solid var(--accento); outline-offset: 3px; border-radius: 999px; }

/* ---- small screens and the phone box (341 by 410) ---- */
@media (max-width: 760px), (max-height: 520px) {
  .testa__nome { display: none; }

  .scheda {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-content: center;
    align-items: start;
    column-gap: 16px;
    row-gap: clamp(10px, 3vh, 22px);
  }

  .scheda__fotocol { grid-column: 1; grid-row: 1; }
  .scheda__testo { grid-column: 2; grid-row: 1; align-self: center; }
  .scheda__dati { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; width: 100%; }

  .scheda__foto { width: min(40vw, 30vh); }
  .scheda__piccolo { display: none; }
  .scheda__storia { margin-top: .8em; font-size: clamp(11px, 3.4vw, 13px); }

  .scheda__dati dl { grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 8px; }
  .scheda__dati dl > div { padding-bottom: 6px; }
  .prendi { margin-top: 12px; }
}
