/* The pages around the canvas: the landing frame and the library grid. Same register as
   the canvas page: white ground, one serif, the spine's green as the only accent. */

:root {
  --ink: #111;
  --paper: #fff;
  --green: #2f4f3a;
  --muted: #777;
  --line: #e6e6e6;
  --track: #d7e4db;     /* pale sage: how much there is */
  --pop: #5f9a72;       /* calm leaf green: how far along */
  --serif: Baskerville, "Libre Baskerville", "Times New Roman", Georgia, serif;
}

/* The canvas stylesheet locks the document to one screen; these pages continue below it. */
html:has(body.landing), html:has(body.library-page) {
  overflow: auto;
  height: auto;
}

body.landing, body.library-page {
  overflow: visible;
  height: auto;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
}

/* The live design fills the first screen; the page continues beneath it. */
#live {
  position: relative;
  height: 100vh;
  height: 100dvh;
}

body.landing #page {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

body.landing #top, body.landing #hint, body.landing #finished { position: absolute; }
body.landing #top { padding-top: calc(10px + env(safe-area-inset-top)); }
body.landing #who { background: none; color: var(--muted); font-size: 14px; }
body.landing #hint, body.landing #finished { bottom: calc(58px + env(safe-area-inset-bottom)); }

#below {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  padding: 6px 14px;
  font-size: 15px;
  color: var(--green);
  background: rgba(255, 255, 255, .85);
  border: 1px solid var(--line);
  border-radius: 3px;
  text-decoration: none;
}

#below::after { content: " ↓"; }

#library {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 16px 64px;
}

#library h1 {
  font-weight: normal;
  font-size: 28px;
  margin: 0 0 8px;
}

#library h1 a { color: var(--ink); text-decoration: none; }

.lede {
  color: var(--muted);
  margin: 0 0 32px;
  font-size: 17px;
  max-width: 40em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px 16px;
}

.card {
  display: block;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
}

.card .pic { display: block; position: relative; }

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 219 / 286;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--paper);
}

/* The person's own cells, in black, over the grey render. */
.card canvas.own {
  position: absolute;
  inset: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  pointer-events: none;
}

.card.finished img { border-color: var(--green); }

.meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 2px 0;
  font-size: 14px;
  line-height: 1.3;
}

.meta .n { color: var(--muted); }
.meta .t { flex: 1; }
.meta .e { color: var(--green); letter-spacing: .08em; font-size: 12px; }

.ring { flex: none; align-self: center; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: var(--track); stroke-width: 3.5; }
.ring .done { stroke: var(--pop); stroke-linecap: round; }

/* What the page is for, said once, above the design, and gone once the person is doing it. */
#lead {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 12%;
  margin: 0;
  max-width: calc(100% - 32px);
  padding: 14px 22px 16px;
  text-align: center;
  font-weight: normal;
  font-size: clamp(30px, 8.2vw, 60px);
  line-height: 1.12;
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 6px 30px rgba(0, 0, 0, .08);
  pointer-events: none;
  transition: opacity 1.2s;
}

#lead.away { opacity: 0; }

/* After the first own fill: one quiet line, then nothing. */
#carry {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(58px + env(safe-area-inset-bottom));
  padding: 8px 16px 10px;
  font-size: clamp(19px, 4.8vw, 24px);
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 4px 20px rgba(0, 0, 0, .08);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s;
}

#carry[hidden] { display: none; }

/* The demonstration: a pulse where the tap would be, and a word beside it. */
#pulse {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid var(--green);
  border-radius: 50%;
  pointer-events: none;
  animation: pulse .9s ease-out forwards;
}

#pulse[hidden] { display: none; }

@keyframes pulse {
  from { transform: scale(.4); opacity: .9; }
  to { transform: scale(2.2); opacity: 0; }
}

#caption {
  position: absolute;
  padding: 8px 16px 10px;
  font-size: clamp(20px, 5.2vw, 26px);
  line-height: 1.2;
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 4px 20px rgba(0, 0, 0, .08);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 1.2s;
}

#caption[hidden] { display: none; }

/* Pinned at the top of the library while it scrolls, so the design is one tap away. */
#above {
  position: sticky;
  top: 10px;
  float: right;
  z-index: 2;
  padding: 6px 14px;
  font-size: 15px;
  color: var(--green);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 3px;
  text-decoration: none;
}

#above::after { content: " ↑"; }
