/* Poetic Prompts — the landing page (home).
   One wide sheet of the ledger paper: the welcome and streak candle on the left,
   recent poems in the middle, the fresco and the skin bar on the right, and
   Start Ascent along the bottom. On phones it stacks with Start Ascent near the top. */

.ledger.home {
  width: min(1140px, 100%);
  padding: 46px clamp(20px, 4vw, 60px) 40px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(0, 1.15fr);
  grid-template-areas:
    "welcome poems fresco"
    "streak  poems skins"
    "start   start start";
  column-gap: clamp(22px, 3.4vw, 46px);
  row-gap: 18px;
  align-items: start;
}
.h-welcome { grid-area: welcome; }
.h-streak { grid-area: streak; }
.h-poems { grid-area: poems; }
.h-fresco { grid-area: fresco; }
.h-skins { grid-area: skins; }
.h-start { grid-area: start; }

.h-welcome .ledger-kicker { text-align: left; white-space: nowrap; }
.welcome { margin: 4px 0 0; font: 600 clamp(28px, 3.2vw, 38px)/1.12 "Cinzel", serif; letter-spacing: 0.03em; }
.welcome .who { display: block; font: 400 clamp(42px, 5vw, 60px)/1.05 "Pinyon Script", cursive; letter-spacing: 0; color: var(--rubric);
  overflow-wrap: anywhere; }

.h-head { margin: 0 0 10px; font: 600 15px/1.3 "Cinzel", serif; letter-spacing: 0.12em; text-transform: uppercase; color: #2f4f86;
  padding-bottom: 6px; border-bottom: 1.5px solid rgba(42, 33, 25, 0.16); }
.h-more { margin: 10px 0 0; font: 500 16.5px/1.4 "Cormorant Garamond", serif; color: var(--ink-soft); text-align: right; }
.h-more a { color: var(--rubric); font-weight: 600; text-decoration: none; }
.h-more a:hover { text-decoration: underline; }

/* ---------- the streak: a small pixel candle (tools/make_candle_sprite.py) ---------- */
.streak-box {
  --row: 0;
  display: inline-flex; align-items: flex-end; gap: 14px; padding: 10px 18px 10px 12px;
  border: 2px solid #b8913a; border-radius: 4px; background: rgba(255, 248, 230, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 236, 180, 0.5);
}
.px-candle {
  /* frames are 16x28, shown at 3x; one row per flame colour, four flicker frames */
  display: block; width: 48px; height: 84px; image-rendering: pixelated;
  background: url("assets/candle-sprite.png") 0 calc(var(--row) * -84px) / 192px 504px no-repeat;
  animation: candle-flicker 0.8s steps(4) infinite;
}
@keyframes candle-flicker { to { background-position-x: -192px; } }
.streak-box[data-flame="amber"] { --row: 1; }
.streak-box[data-flame="orange"] { --row: 2; }
.streak-box[data-flame="crimson"] { --row: 3; }
.streak-box[data-flame="blue"] { --row: 4; }
.streak-box[data-flame="white-gold"] { --row: 5; }
.streak-box[data-flame="none"] .px-candle { animation-duration: 1.6s; }
.streak-n { margin: 0 0 4px; }
.streak-n b { display: block; font: 600 40px/1 "Cinzel", serif; color: var(--rubric); }
.streak-n span { font: 600 12px/1.3 "Cinzel", serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.streak-week { margin: 10px 0 0; }

/* ---------- Start Ascent ---------- */
.h-start { display: flex; justify-content: center; padding: 18px 0 22px; }
/* a plain red button, with the pixel quill in its inkwell beside it (tools/make_icons.py) */
.start-ascent { display: inline-flex; align-items: flex-end; gap: 10px; text-decoration: none; cursor: pointer; }
.sa-ink { position: relative; display: block; flex: none; width: 56px; height: 68px; }
.sa-ink img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.sa-quill { transform-origin: 30% 75%; }
.sa-btn {
  position: relative; overflow: hidden; display: inline-block; padding: 16px 36px; border-radius: 6px;
  font: 600 22px/1 "Cinzel", serif; letter-spacing: 0.12em; text-transform: uppercase; color: #fff3dc;
  background: linear-gradient(#bd3c26, #96281a); border: 2px solid #5e150c;
  box-shadow: inset 0 1px 0 rgba(255, 210, 180, 0.45), 0 4px 0 #5e150c, 0 8px 14px rgba(60, 20, 10, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, letter-spacing 0.25s ease;
}
/* hover: the button rises and glows, a gleam of gold sweeps across it, and the quill dips into the ink */
.sa-btn::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 228, 160, 0.45), transparent); transform: translateX(-130%) skewX(-18deg); }
.start-ascent:hover .sa-btn { background: linear-gradient(#cc4630, #a42d1d); transform: translateY(-3px); letter-spacing: 0.16em;
  box-shadow: inset 0 1px 0 rgba(255, 210, 180, 0.5), 0 7px 0 #5e150c, 0 14px 22px rgba(60, 20, 10, 0.4), 0 0 18px rgba(240, 150, 70, 0.45); }
.start-ascent:hover .sa-btn::after { animation: gleam 0.9s ease-out; }
@keyframes gleam { to { transform: translateX(330%) skewX(-18deg); } }
/* the quill lifts out of the well and dips back in, once per hover */
.start-ascent:hover .sa-quill { animation: quill-dip 1.1s ease-in-out 1; }
@keyframes quill-dip {
  0% { transform: translateY(0) rotate(0); }
  35% { transform: translate(4px, -26px) rotate(10deg); }
  60% { transform: translate(4px, -26px) rotate(6deg); }
  85% { transform: translate(0, 2px) rotate(-1deg); }
  100% { transform: translateY(0) rotate(0); }
}
.start-ascent:active .sa-btn { transition-duration: 0.06s; transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 210, 180, 0.4), 0 1px 0 #5e150c, 0 3px 6px rgba(60, 20, 10, 0.3); }
.start-ascent:focus-visible { outline: none; }
.start-ascent:focus-visible .sa-btn { outline: 3px solid #26437e; outline-offset: 4px; }
.sa-label { color: inherit; }
.sa-sub { display: none; }
/* once sealed: a small, quiet stone-grey button, no inkwell */
.start-ascent.sealed .sa-ink { display: none; }
.start-ascent.sealed .sa-btn { padding: 9px 24px; border-radius: 999px; font-size: 15px; letter-spacing: 0.08em; text-transform: none;
  color: #f4efe6; background: #8c857b; border: 0; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.25), 0 3px 8px rgba(40, 30, 20, 0.25); }
.start-ascent.sealed:hover .sa-btn { background: #7d766c; transform: translateY(-1px); letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3), 0 5px 10px rgba(40, 30, 20, 0.3); }
.start-ascent.sealed .sa-btn::after { display: none; }

/* ---------- recent poems ---------- */
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.r-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when score" "line score";
  gap: 2px 12px; padding: 10px 12px; border-radius: 4px; text-decoration: none; color: var(--ink);
  background: rgba(255, 250, 236, 0.45); border: 1px solid rgba(42, 33, 25, 0.14);
}
.r-card:hover { background: rgba(255, 250, 236, 0.75); }
.r-when { grid-area: when; font: 600 13px/1.3 "Cormorant SC", serif; letter-spacing: 0.06em; color: var(--ink-soft); }
.r-line { grid-area: line; font: italic 400 18px/1.35 "IM Fell English", serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-score { grid-area: score; align-self: center; text-align: right; line-height: 1; }
.r-score b { display: block; font: 600 26px/1 "Cinzel", serif; color: var(--rubric); }
.r-score i { font: normal 600 12px "Cinzel", serif; color: #2f4f86; }
.r-empty { font: italic 500 18px/1.4 "Cormorant Garamond", serif; color: var(--ink-soft); }

/* ---------- mini fresco ---------- */
.mini-fresco { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.mf { text-align: center; }
.mf-art { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 3px; overflow: hidden;
  border: 1.5px solid rgba(42, 33, 25, 0.35); background: linear-gradient(#e7dcc2, #d8c9a8); }
.mf-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mf-art .icarus-mini { inset: auto; left: 8%; top: 6%; width: 70%; height: auto; object-fit: contain; }
.mf.grisaille .mf-art img { filter: grayscale(1) contrast(0.9) brightness(1.05); }
.mf.gold .mf-art { border-color: #c79a2a; box-shadow: 0 0 0 2px rgba(214, 170, 60, 0.45), 0 0 10px rgba(240, 200, 90, 0.5); }
.mf.future .mf-art { opacity: 0.45; border-style: dashed; }
.mf-day { display: block; margin-top: 3px; font: 600 12px/1 "Cinzel", serif; color: var(--ink-soft); }

/* ---------- the skin bar ---------- */
/* pictures only; the hovered (or chosen) bird's name and how to earn it show in one line underneath */
.skin-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.skin {
  position: relative; display: grid; place-items: center; padding: 4px 2px; min-height: 52px;
  border: 1.5px solid rgba(42, 33, 25, 0.25); border-radius: 6px; background: rgba(255, 250, 236, 0.4);
  color: var(--ink); cursor: pointer; font: inherit; text-align: center;
}
.skin:hover:not(:disabled) { background: rgba(255, 250, 236, 0.8); }
.skin:focus-visible { outline: 3px solid #26437e; outline-offset: 2px; }
.skin.on { border-color: var(--rubric); background: rgba(255, 244, 220, 0.9); box-shadow: 0 0 0 2px rgba(166, 50, 31, 0.25); }
.skin.locked { cursor: default; }
.skin-art {
  /* one idle frame (no. 4) of the 11-frame, 52x44 sheet, at 1x so the pixels stay crisp */
  display: block; width: 52px; height: 44px;
  background: no-repeat -208px 0 / 572px 44px; image-rendering: pixelated;
}
.skin[data-skin="gold"].owned .skin-art { filter: drop-shadow(0 0 6px rgba(255, 210, 100, 0.8)); }
.skin[data-skin="phoenix"].owned .skin-art { filter: drop-shadow(0 0 6px rgba(255, 140, 60, 0.8)); }
.skin.locked .skin-art { filter: brightness(0) opacity(0.28); }
.skin-name, .skin-how { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skin-info { margin: 8px 0 0; min-height: 1.4em; font: 500 17px/1.35 "Cormorant Garamond", serif; color: var(--ink-soft); }
.skin-info b { font: 600 14px "Cinzel", serif; letter-spacing: 0.04em; color: var(--ink); }
.skin-note { margin: 8px 0 0; min-height: 1.4em; font: 500 16px/1.4 "Cormorant Garamond", serif; color: var(--ink-soft); }

/* ---------- tablets: two columns ---------- */
@media (max-width: 980px) {
  .ledger.home {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    grid-template-areas: "welcome poems" "streak poems" "streak fresco" "start start" "skins skins";
  }
}
/* ---------- phones: one column, Start Ascent right under the candle ---------- */
@media (max-width: 640px) {
  .ledger.home {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "welcome" "streak" "start" "poems" "fresco" "skins";
    padding-top: 38px;
    row-gap: 22px;
  }
  .h-welcome, .h-welcome .ledger-kicker { text-align: center; }
  .h-streak { display: flex; flex-direction: column; align-items: center; }
  .h-start { padding-top: 0; }
  .sa-btn { padding: 15px 26px; font-size: 20px; }
  .skin-bar { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
}

