:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #17191d;
  --soft: #7a7d84;
  --line: rgba(23, 25, 29, 0.09);
  --accent: #3457d5;
  --soon: #e07a1f;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 12px 16px;
}

.lib {
  width: min(360px, 100%);
  padding: 16px 16px 8px;
  border-radius: 26px;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(23, 25, 29, 0.05),
    0 1px 2px rgba(23, 25, 29, 0.06),
    0 34px 60px -32px rgba(23, 25, 29, 0.3);
}
.lib__head { display: flex; align-items: baseline; justify-content: space-between; }
.lib__title { font-size: 15px; font-weight: 660; font-stretch: 106%; letter-spacing: -0.008em; }
.lib__brand { font-size: 12px; font-weight: 520; color: var(--soft); }

/* four weeks share one line of days: the labels on top, a faint rule for each week through all the rows */
.lib__weeks { display: grid; grid-template-columns: repeat(4, 1fr); margin: 12px 0 0 46px; font-size: 10.5px; font-weight: 540; color: var(--soft); }
.lib__weeks span { padding-left: 4px; white-space: nowrap; }
.lib__rows { position: relative; margin-top: 4px; }
.lib__grid { position: absolute; left: 46px; right: 0; top: 0; bottom: 8px; display: grid; grid-template-columns: repeat(4, 1fr); pointer-events: none; }
.lib__grid i { border-left: 1px dashed rgba(23, 25, 29, 0.12); }
.lib__grid i:first-child { border-left: 1px solid rgba(23, 25, 29, 0.5); }

.loan { --tone: var(--accent); position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 10px 0 11px; }
.loan + .loan { border-top: 1px solid var(--line); }
.loan.is-soon { --tone: var(--soon); }
.loan__cover { grid-row: span 2; width: 34px; height: 46px; }
.loan__cover svg { display: block; width: 34px; height: 46px; overflow: visible; filter: drop-shadow(0 4px 5px rgba(23, 25, 29, 0.18)); }
.loan__top { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 4px; background: linear-gradient(90deg, var(--card) 70%, transparent); position: relative; }
.loan__what { flex: 1; min-width: 0; }
.loan__name { display: block; font-size: 13.5px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loan__by { display: block; font-size: 11.5px; font-weight: 460; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loan__btn { flex: none; position: relative; height: 28px; padding: 0 12px; border: 0; border-radius: 99px; background: var(--ink); color: #ffffff; font: inherit; font-size: 12px; font-weight: 620; cursor: pointer; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.loan__btn span { display: block; }
.loan__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.loan__btn:disabled { background: rgba(23, 25, 29, 0.07); color: var(--soft); cursor: default; }
.loan__track { position: relative; height: 16px; margin-top: 7px; }
.loan__bar { position: absolute; left: 0; top: 4px; height: 8px; width: calc(var(--d) / 28 * 100%); min-width: 6px; border-radius: 0 99px 99px 0; background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 35%, #ffffff), var(--tone)); transition: background 0.5s ease; }
.loan__due { position: absolute; left: calc(var(--d) / 28 * 100%); top: 0; margin-left: 7px; height: 16px; font-size: 11.5px; line-height: 16px; font-weight: 640; color: color-mix(in srgb, var(--tone) 85%, #000000); white-space: nowrap; transition: color 0.5s ease; }
.loan.is-far .loan__due { left: auto; right: calc(100% - var(--d) / 28 * 100%); margin: 0 8px 0 0; top: -17px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #ffffff;
  stroke: #14151a;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}

@media (max-height: 430px) {
  .lib { padding: 13px 14px 4px; }
  .loan { padding: 8px 0 9px; }
  .lib__weeks { margin-top: 8px; }
}
@media (min-width: 700px) and (min-height: 500px) {
  .lib { zoom: 1.3; }
}
@media (min-width: 1100px) and (min-height: 760px) {
  .lib { zoom: 1.65; }
}
