:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: rgba(20, 24, 33, 0.08);
  --linea: #eceef1;
  --riga: #f4f5f7;           /* the soft highlight that slides under the row */
  --testo: #15181e;
  --testo-2: #646a75;
  --testo-3: #a2a7b0;
  --icona: #b7bcc4;          /* the outline of the file icons */
  --accento: #2b54e6;        /* the one accent: the active icon, the caret side, Open, the selection, the waveform */
  --accento-tenue: #e9eefd;
  --carta-foglio: #fbfbfc;   /* the small pages and slides */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: 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;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
ul { list-style: none; }
h2 { font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: clamp(8px, 9vh, 120px) 12px 12px;
}

/* ---- the group: the file list and the card that opens from it ---- */
.group {
  --lw: 100%;
  --rowh: clamp(38px, 9.4vh, 48px);
  position: relative;
  width: min(400px, 100%);
}

/* ---- the file list ---- */
.files {
  position: relative;
  width: var(--lw);
  padding: 6px;
  border-radius: 18px;
  background: var(--carta);
  box-shadow: 0 0 0 1px var(--bordo), 0 1px 2px rgba(20, 24, 33, 0.03), 0 18px 40px -30px rgba(20, 24, 33, 0.2);
}
.files__head {
  display: flex; align-items: center; gap: 8px;
  height: clamp(30px, 8vh, 42px);
  padding: 0 10px 0 8px;
  border-bottom: 1px solid var(--linea);
  margin: 0 2px 4px;
  font-size: 12.5px;
}
.folder { width: 18px; height: 18px; flex: none; color: var(--testo-2); }
.folder svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.crumb { display: flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; }
.crumb__ws { color: var(--testo-3); font-weight: 500; }
.crumb__sep { width: 7px; height: 10px; fill: none; stroke: var(--testo-3); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.crumb__dir { font-weight: 640; color: var(--testo); overflow: hidden; text-overflow: ellipsis; }
.files__count { margin-left: auto; color: var(--testo-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.files__body { position: relative; }
.hl {
  position: absolute; left: 0; right: 0; top: 0;
  height: var(--rowh);
  border-radius: 11px;
  background: var(--riga);
  box-shadow: inset 0 0 0 1px rgba(20, 24, 33, 0.035);
  opacity: 0;
  pointer-events: none;
}
.rows { position: relative; }
.rows li { position: relative; }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: var(--rowh);
  padding: 0 10px 0 9px;
  border-radius: 11px;
  font-size: 13px;
  outline: none;
}
.row:focus-visible { box-shadow: inset 0 0 0 2px var(--accento); }
.row__name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.row__title { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__sub { font-size: 11.5px; color: var(--testo-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row__size, .row__date { display: none; color: var(--testo-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; text-align: right; }

/* the file icon: a sheet with a folded corner, a mark for the kind and a small tag */
.ico { position: relative; display: block; width: 22px; height: 26px; margin-left: 2px; }
.ico svg { display: block; width: 100%; height: 100%; overflow: visible; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.ico__sheet { fill: #fff; stroke: var(--icona); stroke-width: 1.2; transition: stroke 0.25s; }
.ico__fold { stroke: var(--icona); stroke-width: 1.2; transition: stroke 0.25s; }
.ico__mark { stroke: var(--testo-3); stroke-width: 1.2; transition: stroke 0.25s; }
.ico__tag {
  position: absolute; left: -5px; bottom: 2px;
  padding: 1px 3px 0.5px;
  border-radius: 3px;
  font-size: 6.6px; font-weight: 760; letter-spacing: 0.04em; line-height: 1.2;
  color: var(--testo-2);
  background: #fff;
  box-shadow: 0 0 0 1px var(--linea);
  transition: color 0.25s, background-color 0.25s, box-shadow 0.25s;
}
.row.is-on .ico__sheet, .row.is-on .ico__fold { stroke: #9ea5b0; }
.row.is-on .ico__mark { stroke: var(--accento); }
.row.is-on .ico__tag { color: #fff; background: var(--accento); box-shadow: 0 0 0 1px var(--accento); }

/* ---- the preview card ---- */
.card {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  z-index: 3;
  border-radius: 16px;
  background: var(--carta);
  box-shadow:
    0 0 0 1px var(--bordo),
    0 1px 2px rgba(20, 24, 33, 0.05),
    0 12px 28px -14px rgba(20, 24, 33, 0.22),
    0 40px 70px -40px rgba(20, 24, 33, 0.3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.card.is-open { pointer-events: auto; }
.card::before {
  /* a thread of light on the top edge */
  content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  border-radius: 1px; z-index: 2; pointer-events: none;
}
.card__caret {
  position: absolute; left: 0; top: 0;
  width: 11px; height: 11px;
  margin: -5.5px 0 0 -5.5px;
  background: var(--carta);
  border-radius: 2px;
  box-shadow: -1px -1px 0 0 var(--bordo);
  z-index: 1;
}
.card__in { position: relative; z-index: 2; padding: 10px; border-radius: 16px; background: var(--carta); }

.card__head { display: none; flex-direction: column; gap: 1px; padding: 2px 3px 0; }
.swap { position: relative; display: grid; overflow: hidden; }
.swap > span { grid-area: 1 / 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-head-name] { font-size: 13.5px; font-weight: 640; }
.swap--meta { font-size: 11.5px; color: var(--testo-3); }

.view { position: relative; height: 80px; overflow: hidden; border-radius: 11px; background: #f6f7f9; box-shadow: inset 0 0 0 1px rgba(20, 24, 33, 0.04); }
.pane { position: absolute; left: 0; right: 0; top: 0; height: var(--h); opacity: 0; visibility: hidden; }
.pane--pdf { --h: clamp(72px, 19vh, 138px); }
.pane--sheet { --h: clamp(68px, 17vh, 118px); }
.pane--slides { --h: clamp(72px, 19vh, 124px); }
.pane--image { --h: clamp(76px, 20vh, 152px); }
.pane--audio { --h: clamp(54px, 13vh, 84px); }

/* pdf */
.pane--pdf { display: flex; align-items: center; gap: 14px; padding: 0 14px 0 18px; }
.pages { position: relative; flex: none; height: calc(100% - 14px); aspect-ratio: 0.74; margin-top: 3px; }
.page {
  position: absolute; inset: 0;
  border-radius: 3px;
  background: var(--carta-foglio);
  box-shadow: 0 0 0 1px rgba(20, 24, 33, 0.08), 0 4px 10px -6px rgba(20, 24, 33, 0.25);
}
.page--back { transform: translate(7px, -4px) rotate(5deg); background: #f0f1f4; }
.page--mid { transform: translate(3.5px, -2px) rotate(2.4deg); background: #f5f6f8; }
.page--front { display: flex; flex-direction: column; gap: 6%; padding: 13% 12% 0; background: #fff; overflow: hidden; }
.pl { display: block; height: 2.2%; min-height: 2px; border-radius: 2px; background: #dfe2e7; flex: none; }
.pl--kicker { width: 28%; background: var(--accento); }
.pl--title { width: 86%; height: 5.2%; background: #2b2f37; }
.pl--title2 { width: 58%; height: 5.2%; background: #2b2f37; margin-top: -2%; }
.pl--swatches { display: flex; gap: 6%; height: auto; background: none; margin: 2% 0; }
.pl--swatches i { display: block; width: 17%; aspect-ratio: 1; border-radius: 2px; background: var(--accento); }
.pl--swatches i:nth-child(2) { background: #9db0f5; }
.pl--swatches i:nth-child(3) { background: #2b2f37; }
.pl--swatches i:nth-child(4) { background: #e3e5ea; }
.pl--s { width: 74%; }
.pl--xs { width: 46%; }
.pdfinfo { display: flex; flex-direction: column; min-width: 0; }
.bignum { font-size: clamp(22px, 6.4vh, 34px); font-weight: 680; font-stretch: 92%; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pdfinfo__lbl { font-size: 12px; color: var(--testo-2); margin-top: 2px; }
.pdfinfo__note { font-size: 11px; color: var(--testo-3); margin-top: 6px; }

/* sheet */
.pane--sheet { padding: 8px; }
.grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  grid-template-rows: repeat(5, 1fr);
  height: 100%;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(20, 24, 33, 0.08);
  overflow: hidden;
}
.cell { position: relative; display: flex; align-items: center; justify-content: flex-end; padding: 0 5px; border-right: 1px solid var(--linea); border-bottom: 1px solid var(--linea); }
.cell:nth-child(5n) { border-right: 0; }
.cell:nth-last-child(-n + 5) { border-bottom: 0; }
.cell--first { justify-content: flex-start; }
.cell--head { background: #f8f9fb; }
.cell--total { background: #fafbff; }
.cell i { display: block; height: 3px; border-radius: 2px; background: #cfd3da; transform-origin: right center; }
.cell--first i { transform-origin: left center; background: #b6bbc4; }
.cell--head i { background: #8d939d; height: 3.5px; }
.cell--total i { background: #2b2f37; height: 3.5px; }
.cell--up i { background: var(--accento); }
.sel { position: absolute; left: 0; top: 0; width: 20px; height: 12px; border: 1.5px solid var(--accento); border-radius: 2px; box-shadow: 0 0 0 3px rgba(43, 84, 230, 0.12); opacity: 0; pointer-events: none; }
.sel::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 5px; height: 5px; border-radius: 1px; background: var(--accento); box-shadow: 0 0 0 1px #fff; }

/* slides */
.pane--slides { display: grid; place-items: center; }
.deck { position: relative; height: calc(100% - 30px); aspect-ratio: 16 / 9; margin-top: 10px; transform: translateX(-12px); }
.slide {
  position: absolute; inset: 0;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(20, 24, 33, 0.08), 0 6px 14px -8px rgba(20, 24, 33, 0.3);
  overflow: hidden;
}
.slide--a { background: var(--accento); }
.sa__t { position: absolute; left: 9%; top: 22%; width: 46%; height: 9%; border-radius: 2px; background: #fff; }
.sa__t--2 { top: 38%; width: 30%; opacity: 0.6; height: 6%; }
.sa__ring { position: absolute; right: -9%; bottom: -26%; width: 52%; aspect-ratio: 1; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.55); }
.sb__t { position: absolute; left: 8%; top: 13%; width: 36%; height: 7%; border-radius: 2px; background: #2b2f37; }
.sb__bars { position: absolute; left: 8%; right: 8%; bottom: 13%; height: 52%; display: flex; align-items: flex-end; gap: 6%; border-bottom: 1px solid var(--linea); }
.sb__bars i { flex: 1; border-radius: 2px 2px 0 0; background: #d5daf8; transform-origin: bottom; }
.sb__bars i:nth-child(1) { height: 34%; }
.sb__bars i:nth-child(2) { height: 52%; }
.sb__bars i:nth-child(3) { height: 44%; }
.sb__bars i:nth-child(4) { height: 70%; }
.sb__bars i:nth-child(5) { height: 96%; background: var(--accento); }
.slide--c { background: #16191f; }
.sc__big { position: absolute; left: 9%; top: 18%; width: 22%; height: 30%; border-radius: 2px; background: #fff; }
.sc__l { position: absolute; left: 9%; top: 60%; width: 60%; height: 5%; border-radius: 2px; background: rgba(255, 255, 255, 0.4); }
.sc__l--2 { top: 70%; width: 48%; }
.sc__l--3 { top: 80%; width: 54%; background: var(--accento); }

/* image */
.pane--image { padding: 0; }
.photo { position: absolute; inset: 0; overflow: hidden; border-radius: 11px; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.photo__dims {
  position: absolute; left: 8px; bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--testo);
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}

/* audio */
.pane--audio { display: flex; align-items: center; gap: 12px; padding: 0 14px 0 12px; }
.play { display: grid; place-items: center; flex: none; width: clamp(28px, 7.6vh, 34px); aspect-ratio: 1; border-radius: 50%; background: var(--accento); box-shadow: 0 4px 10px -4px rgba(43, 84, 230, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.play svg { width: 56%; height: 56%; fill: #fff; }
.wave { flex: 1; min-width: 0; height: 62%; overflow: visible; }
.wave line { stroke: #c3c8d0; stroke-width: 1.6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.wave line.is-played { stroke: var(--accento); }
.wave .head { stroke: var(--testo); stroke-width: 1.2; }
.atime { flex: none; font-size: 12px; font-weight: 600; color: var(--testo-2); font-variant-numeric: tabular-nums; }

/* rolling digits */
.roll { display: inline-flex; align-items: flex-start; height: 1.15em; line-height: 1.15em; overflow: hidden; }
.roll .s, .roll .d { display: block; height: 1.15em; }
.roll .d { overflow: hidden; }
.roll .d__col { display: block; }
.roll .d__col > span { display: block; height: 1.15em; }

/* footer of the card */
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.avatar {
  display: grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 8.5px; font-weight: 720; letter-spacing: 0.02em; color: var(--accento);
  background: var(--accento-tenue);
  box-shadow: inset 0 0 0 1px rgba(43, 84, 230, 0.16);
}
.who__text { display: flex; flex-direction: column; min-width: 0; font-size: 11.5px; line-height: 1.3; }
[data-who] { color: var(--testo); font-weight: 540; }
.swap--when { display: none; color: var(--testo-3); }
.acts { display: flex; gap: 6px; flex: none; }
.act {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 620;
  outline: none;
}
.act__bg { position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.act__lbl, .act__tick { position: relative; z-index: 1; }
.act--open { color: #fff; }
.act--open .act__bg { background: var(--accento); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 10px -5px rgba(43, 84, 230, 0.6); }
.act--share .act__bg { background: #fff; box-shadow: inset 0 0 0 1px rgba(20, 24, 33, 0.12); }
.act--share.is-done { color: var(--accento); }
.act__tick { width: 0; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.act--share.is-done .act__tick { width: 12px; }
.act:focus-visible .act__bg { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accento); }
.act.is-hover.act--open .act__bg { background: #2247cf; }
.act.is-hover.act--share .act__bg { background: #f5f6f8; }
@media (hover: hover) {
  .act--open:hover .act__bg { background: #2247cf; }
  .act--share:hover .act__bg { background: #f5f6f8; }
}

/* ---- side by side when there is room: the card opens to the right of the row ---- */
@media (min-width: 720px) {
  .stage { place-items: center; padding: 24px; }
  .group { --lw: 384px; --rowh: clamp(40px, 6.6vh, 50px); width: calc(384px + 22px + 268px); }
  .row { grid-template-columns: 26px minmax(0, 1fr) 62px 52px; font-size: 13.5px; }
  .row__sub { display: none; }
  .row__size, .row__date { display: block; }
  .card { width: 268px; }
  .card__caret { box-shadow: -1px 1px 0 0 var(--bordo); }
  .card__in { padding: 12px; }
  .card__head { display: flex; }
  .view { margin-top: 10px; }
  .card__foot { flex-direction: column; align-items: stretch; gap: 10px; margin-top: 11px; }
  .who { padding: 0 2px; }
  .avatar { width: 26px; height: 26px; font-size: 9.5px; }
  .swap--when { display: grid; }
  .acts { gap: 8px; }
  .act { flex: 1; height: 32px; }
}

/* short boxes (the phone preview is 341 by 410): the list goes to the top */
@media (max-width: 719px) and (max-height: 560px) {
  .stage { padding-top: 6px; padding-bottom: 6px; }
  .files__head { height: 30px; margin-bottom: 2px; }
}

/* the narrow box of the phone preview */
@media (max-width: 360px) {
  .crumb__ws, .crumb__sep { display: none; }
  .act { padding: 0 10px; }
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #111114;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .ico__sheet, .ico__fold, .ico__mark, .ico__tag { transition: none; }
}
