/* Inkwell — lessons, journal, library, about, easter eggs */

/* ---------- lessons ---------- */
.lessons-grid { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: clamp(14px, 2vw, 26px); align-items: start; }
.lesson-side { position: sticky; top: 86px; display: grid; gap: 12px; }
.side-h { margin: 6px 0 0; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.course-tabs { display: grid; gap: 6px; }
.course-tab {
  display: grid; text-align: left; gap: 2px; min-height: 56px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .18); color: var(--text);
  transition: transform .3s var(--spring), background .25s, border-color .25s;
}
.course-tab small { color: var(--muted); font-size: .76rem; }
.ct-name { font-family: var(--display); font-style: italic; font-size: 1.1rem; }
.course-tab:hover { transform: translateX(4px); border-color: var(--brass); }
.course-tab.on { background: linear-gradient(90deg, rgba(246, 226, 164, .2), rgba(246, 226, 164, .03)); border-color: var(--brass); box-shadow: inset 4px 0 0 var(--brass); }
.glyph-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.glyph-chip {
  display: grid; place-items: center; gap: 0; min-height: 64px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--noise), var(--paper-card); color: var(--paper-ink); box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
  transition: transform .3s var(--spring), box-shadow .3s;
}
.gc-ch { font-family: var(--display); font-size: 1.6rem; line-height: 1.1; }
.gc-st { font-size: .62rem; color: #a07a24; letter-spacing: .05em; }
.glyph-chip:hover { transform: translateY(-3px) rotate(-2deg); }
.glyph-chip.on { box-shadow: 0 0 0 3px var(--brass), 0 8px 16px rgba(0, 0, 0, .35); transform: translateY(-3px); }
.lesson-main { min-width: 0; display: grid; gap: 12px; }
.lesson-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; }
.lesson-title { margin: 0; font-family: var(--display); font-style: italic; font-size: clamp(1.3rem, 1rem + 1.4vw, 2rem); color: var(--brass-hi); }
.lesson-step { margin: 2px 0 0; color: var(--muted); font-size: .92rem; max-width: 52em; }
.lesson-sheet { --ar: 1.3158; --chrome: 380px; }
.lesson-foot { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.score-panel { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 6px 16px; align-items: center; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .18); }
.score-panel.pop { animation: pop .6s var(--spring); }
@keyframes pop { 40% { transform: scale(1.04); box-shadow: 0 0 0 4px rgba(246, 226, 164, .25); } }
.score-bars { display: flex; gap: 5px; align-items: flex-end; height: 46px; }
.sbar { position: relative; width: 22px; height: 46px; border-radius: 5px; background: rgba(0, 0, 0, .3); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5); }
.sbar i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, var(--brass-lo), var(--brass-hi)); transition: height .6s var(--spring); }
.sbar span { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font-size: .66rem; font-weight: 700; color: var(--text); text-shadow: 0 1px 2px #000; }
.sbar.cur { box-shadow: 0 0 0 2px var(--brass-hi); }
.score-total { display: grid; justify-items: center; line-height: 1; }
#scoreTotal { font-family: var(--display); font-size: 2rem; color: var(--brass-hi); font-variant-numeric: tabular-nums; }
.score-stars { color: var(--brass); letter-spacing: .1em; font-size: 1.1rem; }
.score-msg { margin: 0; font-style: italic; font-size: .92rem; }
.lesson-notes h3 { margin: 0 0 6px; font-family: var(--display); font-style: italic; color: var(--brass-hi); }
.lesson-notes p { margin: 0 0 8px; max-width: 70em; }

/* ---------- journal ---------- */
.journal-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: clamp(14px, 2vw, 26px); align-items: start; }
.journal-left { display: grid; gap: 14px; }
.journal-main { min-width: 0; display: grid; gap: 12px; }
.date-bar { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; padding: 14px; }
.date-label { display: grid; text-align: center; line-height: 1.2; }
#jDate { font-family: var(--display); font-style: italic; font-size: 1.05rem; color: var(--brass-hi); }
#jStatus { color: var(--muted); font-size: .78rem; letter-spacing: .06em; }
.prompt-card {
  position: relative; padding: 22px 20px 16px; border-radius: 4px; transform: rotate(-1deg);
  background: repeating-linear-gradient(180deg, transparent 0 27px, rgba(52, 78, 150, .16) 27px 28px), var(--noise), var(--paper-card);
  color: var(--paper-ink); box-shadow: 0 12px 26px rgba(0, 0, 0, .35); transition: transform .4s var(--spring);
}
.prompt-card:hover { transform: rotate(0) translateY(-2px); }
.prompt-card::before { content: ""; position: absolute; top: -10px; left: 50%; width: 92px; height: 24px; transform: translateX(-50%) rotate(2deg); background: rgba(240, 224, 180, .7); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.prompt-kicker { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: #8a3b14; }
.prompt-text { font-family: var(--display); font-style: italic; font-size: 1.2rem; margin: 6px 0 12px; line-height: 1.35; }
.prompt-text.flip { animation: flipIn .6s var(--spring); }
@keyframes flipIn { from { opacity: 0; transform: rotateX(80deg); } }
.stamp-drawer { display: grid; gap: 10px; }
.stamp-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stamp-btn {
  display: grid; justify-items: center; gap: 2px; padding: 8px 4px 6px; min-height: 92px; border-radius: 10px;
  border: 1px solid var(--line); background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .08), transparent 70%), rgba(0, 0, 0, .15); color: var(--text);
  transition: transform .3s var(--spring), border-color .2s, background .2s;
}
.stamp-btn canvas { width: 58px; height: 58px; transition: transform .35s var(--spring); }
.stamp-btn span { font-size: .68rem; color: var(--muted); text-align: center; line-height: 1.2; }
.stamp-btn:hover canvas { transform: rotate(-8deg) scale(1.06); }
.stamp-btn[aria-pressed="true"] { border-color: var(--brass-hi); background: rgba(246, 226, 164, .16); transform: translateY(-3px); }
.stamp-btn[aria-pressed="true"] canvas { animation: hover 1.2s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-4px) rotate(-4deg); } }
.seal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.seal-letter { width: 52px; min-height: 44px; text-align: center; font-family: var(--display); font-size: 1.3rem; font-weight: 700; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); }
.seal-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.seal-swatch { width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .45), transparent 40%), var(--sw); box-shadow: 0 3px 6px rgba(0, 0, 0, .4), inset 0 -3px 6px rgba(0, 0, 0, .35); transition: transform .3s var(--spring); }
.seal-swatch:hover { transform: scale(1.08); }
.seal-swatch.on { border-color: var(--brass-hi); transform: scale(1.1); }
.month-card { padding: 16px; }
.cal-title { font-family: var(--display); font-style: italic; color: var(--brass-hi); margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd { text-align: center; font-size: .68rem; color: var(--muted); }
.cal-d { position: relative; min-height: 44px; border-radius: 8px; border: 1px solid transparent; background: rgba(0, 0, 0, .14); color: var(--text); font-size: .86rem; padding: 0; }
.cal-d.has::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--brass-hi); box-shadow: 0 0 6px var(--brass); }
.cal-d.today { border-color: var(--brass); }
.cal-d.on { background: linear-gradient(180deg, var(--brass-hi), var(--brass)); color: #1d1406; font-weight: 700; }
.journal-sheet { --chrome: 200px; }
.journal-sheet.thud { animation: thud .35s var(--ease); }
@keyframes thud { 30% { transform: scale(.992) translateY(2px); } }
.journal-sheet.turn-l { animation: turnL .55s var(--ease); }
.journal-sheet.turn-r { animation: turnR .55s var(--ease); }
@keyframes turnL { 0% { transform: perspective(1400px) rotateY(0); } 40% { transform: perspective(1400px) rotateY(-14deg) translateX(-10px); opacity: .7; } 100% { transform: none; } }
@keyframes turnR { 0% { transform: perspective(1400px) rotateY(0); } 40% { transform: perspective(1400px) rotateY(14deg) translateX(10px); opacity: .7; } 100% { transform: none; } }
.sealed-banner {
  position: absolute; z-index: 8; left: 50%; bottom: 22%; transform: translateX(-50%) rotate(-2deg); width: min(86%, 420px);
  padding: 14px 18px; text-align: center; border-radius: 6px; color: #f6ecd8;
  background: linear-gradient(180deg, #7d1a20, #4f0e13); box-shadow: 0 14px 30px rgba(0, 0, 0, .45);
  animation: cardIn .5s var(--spring);
}
.sealed-banner p { margin: 0 0 10px; font-style: italic; }
.note-label { font-size: .86rem; color: var(--muted); }
.note-area {
  width: 100%; min-height: 96px; resize: vertical; border-radius: 6px; border: 1px solid var(--line); padding: 10px 14px; line-height: 28px;
  background: repeating-linear-gradient(180deg, transparent 0 27px, rgba(52, 78, 150, .18) 27px 28px), var(--paper-card); color: var(--paper-ink);
  font-family: var(--serif); font-size: 1rem; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .18);
}

/* ---------- library ---------- */
.lib-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.lib-head > div:first-child { max-width: 48em; }
.lib-head p { margin: 0; }
.lib-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.lib-card {
  display: grid; gap: 6px; align-content: start; padding: 12px; border-radius: 12px;
  background: rgba(0, 0, 0, .2); border: 1px solid var(--line); box-shadow: 0 10px 24px rgba(0, 0, 0, .3);
  transition: transform .35s var(--spring), box-shadow .35s; animation: cardIn .5s var(--spring) both;
}
.lib-card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 18px 34px rgba(0, 0, 0, .4); }
.thumb { position: relative; border-radius: 4px; overflow: hidden; background: var(--paper-card); box-shadow: 0 4px 10px rgba(0, 0, 0, .35); }
.thumb canvas { width: 100%; height: auto; display: block; aspect-ratio: 1000 / 1300; }
.badge { position: absolute; left: 8px; top: 8px; padding: 2px 9px; border-radius: 20px; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; background: rgba(29, 43, 79, .85); color: #f1e8d2; }
.badge.journal { background: rgba(110, 30, 34, .88); }
.badge.sealed { left: auto; right: 8px; background: #9e1b22; }
.lib-title { margin: 4px 0 0; font-family: var(--display); font-style: italic; font-size: 1.1rem; overflow-wrap: anywhere; }
.meta { margin: 0; font-size: .78rem; color: var(--muted); }
.lib-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.lib-actions .brass-btn { flex: 1 1 auto; }
.lib-empty, .lib-none { text-align: center; padding: 40px 16px; color: var(--muted); }
.lib-empty svg { width: 120px; height: 80px; opacity: .6; animation: breathe 4s ease-in-out infinite; }
.lib-empty p:first-of-type { font-family: var(--display); font-style: italic; font-size: 1.4rem; color: var(--text); margin: 10px 0 4px; }

/* ---------- about ---------- */
.about-wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(14px, 2vw, 26px); align-items: start; max-width: 1240px; margin: 0 auto; }
.about-card h2 { font-family: var(--display); font-style: italic; margin: 1.2em 0 .3em; font-size: 1.3rem; }
.about-card .lead { font-size: 1.12rem; }
.about-card ul { padding-left: 1.2em; }
.kbd-list { list-style: none; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.credits { display: grid; gap: 10px; }
.maker { font-size: 1.15rem; margin: 0; }
.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.link-list a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); text-decoration: none; transition: background .25s, transform .3s var(--spring); }
.link-list a:hover { background: rgba(246, 226, 164, .12); transform: translateY(-2px); }

/* ---------- easter eggs ---------- */
.paw-layer { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.paw { position: absolute; width: 40px; height: 40px; opacity: 0; transform: rotate(-35deg);
  background:
    radial-gradient(ellipse 34% 28% at 50% 68%, #16161b 98%, transparent 100%),
    radial-gradient(circle at 18% 36%, #16161b 11%, transparent 12%), radial-gradient(circle at 38% 18%, #16161b 11%, transparent 12%),
    radial-gradient(circle at 62% 18%, #16161b 11%, transparent 12%), radial-gradient(circle at 82% 36%, #16161b 11%, transparent 12%);
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, .4));
}
body[data-theme="midnight"] .paw, body[data-theme="oxblood"] .paw, body[data-theme="sumi"] .paw { filter: invert(.9) drop-shadow(0 0 2px rgba(0, 0, 0, .4)); }
.paw.r { transform: rotate(-25deg) scaleX(-1); }
.paw-layer.go .paw { animation: pawStep 3.6s ease forwards; }
@keyframes pawStep { 0% { opacity: 0; scale: .6; } 8% { opacity: .85; scale: 1; } 70% { opacity: .85; } 100% { opacity: 0; } }
.ink-spill { position: fixed; left: 50%; top: 40%; z-index: 79; width: 120px; height: 120px; margin: -60px 0 0 -60px; pointer-events: none; opacity: 0; border-radius: 48% 52% 60% 40% / 50% 45% 55% 50%; background: radial-gradient(circle at 40% 35%, #2b4ba8, #0b1430 70%); }
.ink-spill.go { animation: spill 2.6s var(--ease) forwards; }
@keyframes spill { 0% { opacity: .95; transform: scale(.1) rotate(0); } 30% { transform: scale(3.4) rotate(20deg); border-radius: 60% 40% 45% 55% / 40% 60% 45% 55%; opacity: .9; } 100% { opacity: 0; transform: scale(5) rotate(35deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .lessons-grid, .journal-grid, .about-wrap { grid-template-columns: 1fr; }
  .lesson-side { position: relative; top: 0; }
  .course-tabs { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .journal-left { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); align-items: start; }
  .lesson-sheet { --chrome: 300px; }
}
@media (max-width: 640px) {
  .lesson-foot { grid-template-columns: 1fr 1fr; }
  .score-panel { grid-column: 1 / -1; order: -1; grid-template-columns: auto auto; }
  .score-msg { grid-column: 1 / -1; }
  .lesson-head .tb-group { width: 100%; }
  .stamp-tray { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .date-bar { grid-template-columns: auto 1fr auto; }
  .date-bar #jToday { grid-column: 1 / -1; }
  .lib-controls { width: 100%; }
  .lib-controls .title-input { flex: 1 1 100%; }
  .paper-card { padding: 20px; }
  .leather { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-ink-level, .ink-lvl, .sheet-empty span { animation: none !important; }
}
@media print {
  .topbar, .site-footer, .tray-details, .sheet-toolbar, .sheet-status, .journal-left, .lesson-side { display: none !important; }
  body { background: #fff; }
}

/* footer credit links: 44px touch targets on every device */
footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .3em; }
