/* Quire Audio, the now-playing card of The Salt Keeper: the chapter arc around a typographic cover */
:root {
  --pagina: #efeae1;           /* warm white page */
  --card: #fbf9f5;             /* the card */
  --inchiostro: #1d1b18;       /* type, the chapter arc, the play key */
  --grigio: #8a8479;           /* small type */
  --filo: rgba(29, 27, 24, 0.13); /* hairlines, the ring's track */
  --copertina: #24211d;        /* the cover's ground */
  --crema: #f3eadb;            /* type on the cover */
  --accento: #d8682c;          /* the one accent: the lighthouse lamp */
  --disco: min(212px, 46vh, 64vw);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(120% 90% at 50% 0%, #f6f2eb 0%, var(--pagina) 60%);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  overflow: hidden;
}
p, h1 { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.pagina {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
}

.card {
  position: relative;
  width: min(326px, calc(100vw - 24px));
  padding: clamp(12px, 3.6vh, 22px) clamp(14px, 4vw, 22px) clamp(12px, 3.4vh, 20px);
  background: linear-gradient(180deg, #fdfcf9 0%, var(--card) 100%);
  border-radius: 26px;
  box-shadow:
    0 0 0 1px rgba(29, 27, 24, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(29, 27, 24, 0.05),
    0 8px 18px -8px rgba(29, 27, 24, 0.12),
    0 30px 60px -24px rgba(29, 27, 24, 0.22);
  display: grid;
  justify-items: center;
  gap: clamp(6px, 1.8vh, 12px);
}

.testa {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 12px;
  letter-spacing: 0.01em;
  font-variation-settings: 'wdth' 96;
  white-space: nowrap;
}
.testa__cap, .testa__sep { color: var(--grigio); }
.testa__nome { font-weight: 560; }

/* the ring and the cover */
.disco {
  position: relative;
  width: var(--disco);
  aspect-ratio: 1;
}
.anelli { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.anelli path, .anelli line { fill: none; stroke-linecap: round; }
.libro { stroke: var(--filo); stroke-width: 1; }
.libro--letto { stroke: rgba(29, 27, 24, 0.32); }
.libro--capitolo { stroke: var(--inchiostro); stroke-width: 1.4; }
.tacche line { stroke: rgba(29, 27, 24, 0.3); stroke-width: 1; }
.tacche line.passata { stroke: rgba(29, 27, 24, 0.55); }
.traccia { stroke: var(--filo); stroke-width: 1.5; }
.resto { stroke: var(--accento); stroke-width: 1.6; opacity: 0; }
.corso { stroke: var(--inchiostro); stroke-width: 2.4; }
.fine { stroke: rgba(29, 27, 24, 0.45); stroke-width: 1.2; }
.segno { stroke: var(--accento); stroke-width: 1.8; opacity: 0; }
.testina { fill: var(--card); stroke: var(--inchiostro); stroke-width: 1.6; filter: drop-shadow(0 1px 1.5px rgba(29, 27, 24, 0.25)); }

/* the cover sits in the middle with plain offsets: the transform belongs to GSAP */
.copertina-posto {
  position: absolute;
  left: 29%;
  top: 19.5%;
  width: 42%;
  height: 57%;
  perspective: 500px;
  container-type: inline-size;
}
.copertina {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 4px 7px 7px 4px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0, rgba(255, 255, 255, 0.10) 3.5%, rgba(0, 0, 0, 0.12) 6%, transparent 9%),
    radial-gradient(120% 70% at 70% 26%, #3a332b 0%, var(--copertina) 62%);
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.4),
    0 2px 3px rgba(29, 27, 24, 0.22),
    0 10px 18px -6px rgba(29, 27, 24, 0.38),
    0 22px 30px -18px rgba(29, 27, 24, 0.4);
  color: var(--crema);
  padding: 9cqw 10cqw 8cqw 14cqw;
  display: flex;
  flex-direction: column;
}
.copertina::after {
  /* a soft paper grain over the cover */
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23g)'/%3E%3C/svg%3E");
  pointer-events: none;
}
.copertina__segno { position: absolute; inset: 0; width: 100%; height: 100%; }
.orizzonte { stroke: rgba(243, 234, 219, 0.35); stroke-width: 0.6; }
.faro { fill: var(--accento); }
.copertina__autore {
  position: relative;
  font-size: 6.6cqw;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-variation-settings: 'wdth' 120;
  font-weight: 520;
  opacity: 0.78;
}
.copertina__titolo {
  position: relative;
  margin-top: auto;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: 21cqw;
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 72, 'wght' 330, 'SOFT' 100, 'WONK' 1;
}
.copertina__piede {
  position: relative;
  margin-top: 6cqw;
  font-size: 6cqw;
  letter-spacing: 0.08em;
  font-style: italic;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  opacity: 0.6;
}
.copertina__luce {
  position: absolute;
  inset: -40%;
  background: radial-gradient(closest-side, rgba(255, 248, 236, 0.28), rgba(255, 248, 236, 0) 70%);
  opacity: 0;
  pointer-events: none;
}

/* the minutes left, in the ring's gap */
.resta {
  position: absolute;
  left: 0;
  right: 0;
  top: 83.5%;
  display: grid;
  justify-items: center;
  line-height: 1.1;
}
.resta__min {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: clamp(12px, 3.2vh, 14px);
  font-weight: 600;
  font-variation-settings: 'wdth' 92;
  font-variant-numeric: tabular-nums;
}
.resta__finestra { display: inline-block; overflow: hidden; height: 1.15em; vertical-align: bottom; }
.resta__num { display: inline-block; }
.resta__di { font-size: 10px; color: var(--grigio); letter-spacing: 0.01em; }

.libro-info { display: grid; justify-items: center; gap: 2px; margin-top: clamp(4px, 1.6vh, 10px); }
.titolo { font-size: clamp(15px, 4.2vh, 17px); font-weight: 620; letter-spacing: -0.01em; font-variation-settings: 'wdth' 100; }
.stato { position: relative; height: 18px; width: 240px; overflow: hidden; }
.stato__riga {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  color: var(--grigio);
  white-space: nowrap;
}
.stato__riga + .stato__riga { opacity: 0; transform: translateY(100%); }
.stato__riga svg { width: 13px; height: 13px; fill: var(--accento); }
.stato__riga[data-riga="sonno"], .stato__riga[data-riga="segno"] { color: var(--inchiostro); }

/* the keys */
.tasti {
  display: grid;
  grid-template-columns: 40px 44px 58px 44px 40px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: clamp(2px, 1vh, 6px);
}
.tasto {
  position: relative;
  display: grid;
  place-items: center;
  height: 44px;
  border-radius: 50%;
  justify-self: center;
  width: 100%;
}
.tasto::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: rgba(29, 27, 24, 0.06);
  transform: scale(0.6);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.25s;
}
@media (hover: hover) {
  .tasto:not(.tasto--play):hover::before { transform: scale(1); opacity: 1; }
  .tasto--play:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 10px 22px -8px rgba(29, 27, 24, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
}
.tasto svg { position: relative; width: 24px; height: 24px; overflow: visible; }
.tasto--sonno svg path, .tasto--segno svg path { fill: transparent; stroke: var(--inchiostro); stroke-width: 1.5; stroke-linejoin: round; }
.giro { position: relative; display: grid; place-items: center; width: 30px; height: 30px; }
.giro svg { width: 30px; height: 30px; }
.giro path { fill: none; stroke: var(--inchiostro); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.salto__num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 650;
  font-variation-settings: 'wdth' 88;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.tasto--play {
  width: 56px;
  height: 56px;
  background: radial-gradient(120% 100% at 50% 0%, #34302a 0%, var(--inchiostro) 70%);
  color: var(--crema);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 6px 14px -6px rgba(29, 27, 24, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: box-shadow 0.3s;
}
.tasto--play svg { width: 24px; height: 24px; }
.tasto--play path { fill: var(--crema); stroke: var(--crema); stroke-width: 0.8; stroke-linejoin: round; }
.tasto:focus-visible { outline: 1.5px solid var(--accento); outline-offset: 2px; }
