/* ═══════════════════════════════════════════════════════════
   BOOK KEYS (pages/keys.html): a row of book buttons, grouped by Shop section, and the chosen book's pane.
   The buttons follow the World Engine / Isanzure panel bar (layers.css) but wrap onto new lines on a phone
   instead of scrolling sideways. Brand guidelines Edition 1.0: shared.css tokens only, Veilstone only.
   ═══════════════════════════════════════════════════════════ */

main { margin-top: 0; }
.kz-intro .story-desc + .story-desc { margin-top: 0.9rem; }
.kz-intro .kz-fine { font-family: 'Veilstone Text', Georgia, serif; font-size: 0.98rem; font-style: italic; color: var(--wood-light); margin-top: 1.1rem; }
.ts-box { display: flex; justify-content: center; margin-top: 1rem; }
.ts-box:empty { margin: 0; }
.kz-loading { font-family: 'Veilstone Text', Georgia, serif; font-size: 1.05rem; color: var(--parchment); text-align: center; opacity: 0.85; }

/* ── The row of books ── */
.kz-row { max-width: 1000px; margin: 0 auto 2.4rem; display: flex; flex-direction: column; gap: 1.3rem; }
.kz-group-name {
    font-family: 'Veilstone Sans', sans-serif; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--gold); text-align: center; margin: 0 0 0.6rem;
}
.kz-books {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 0.4rem;
    border-top: 1px solid var(--border-ornate); border-bottom: 1px solid var(--border-ornate);
    background: var(--bg-frame); padding: 0.15rem 0.5rem;
}
.kz-book {
    display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
    padding: 0.75rem 1rem 0.6rem; border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer;
    color: var(--parchment-dark); font-family: 'Veilstone Sans', sans-serif; font-size: 0.75rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.25; text-align: center;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.kz-book small {
    font-family: 'Veilstone Text', Georgia, serif; font-size: 0.9rem; font-weight: 400; letter-spacing: 0; text-transform: none;
    color: var(--border-ornate); transition: color 0.2s ease;
}
.kz-book:hover { color: var(--parchment); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.kz-book:hover small { color: var(--gold); }
.kz-book[aria-pressed="true"] { color: var(--parchment); border-bottom-color: var(--gold); }
.kz-book[aria-pressed="true"] small { color: var(--gold-light); }
.kz-book:focus-visible { outline: 2px solid var(--gold-light); outline-offset: -2px; }
.kz-book .kz-mark { font-size: 0.6rem; letter-spacing: 0.14em; color: var(--gold); min-height: 1em; }

/* ── The pane ── */
.kz-pane {
    max-width: 860px; margin: 0 auto; display: grid; grid-template-columns: 200px 1fr; gap: 2.2rem; align-items: start;
    border: 1px solid var(--border-ornate); background: color-mix(in srgb, var(--bg-frame) 70%, transparent); padding: 2rem;
}
.kz-pane.is-arriving { animation: kz-arrive 0.35s ease; }
@keyframes kz-arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .kz-pane.is-arriving { animation: none; } }
.kz-cover img { width: 100%; height: auto; display: block; border: 1px solid var(--border-ornate); box-shadow: 0 8px 24px color-mix(in srgb, var(--bg-dark) 60%, transparent); }
.kz-cover .kz-nocover { aspect-ratio: 2 / 3; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border-ornate);
    font-family: 'Veilstone Sans', sans-serif; font-size: 0.7rem; letter-spacing: 0.15em; color: var(--border-ornate); }
.kz-body { min-width: 0; }
.kz-author { font-family: 'Veilstone Sans', sans-serif; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin: 0 0 0.4rem; }
.kz-title { font-family: 'Veilstone Sans', sans-serif; font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 400; letter-spacing: 0.06em; color: var(--parchment); margin: 0 0 1.2rem; line-height: 1.25; }
.kz-state { font-family: 'Veilstone Text', Georgia, serif; font-size: 1.15rem; color: var(--gold-light); margin: 0 0 0.6rem; }
.kz-text { font-family: 'Veilstone Text', Georgia, serif; font-size: 1.05rem; line-height: 1.6; color: var(--parchment); opacity: 0.92; margin: 0 0 0.8rem; }
.kz-text a, .kz-opened a { color: var(--gold-light); text-underline-offset: 3px; }

/* the questions */
.kz-form { display: flex; flex-direction: column; gap: 1.3rem; margin-top: 0.4rem; }
.kz-q label { display: block; }
.kz-ch { display: block; font-family: 'Veilstone Sans', sans-serif; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--border-ornate); margin-bottom: 0.3rem; }
.kz-qt { display: block; font-family: 'Veilstone Text', Georgia, serif; font-size: 1.08rem; line-height: 1.5; color: var(--parchment); margin-bottom: 0.5rem; }
.kz-q input {
    width: 100%; box-sizing: border-box; padding: 0.75rem 0.9rem; border: 1px solid var(--border-ornate); background: rgba(232,220,196,0.08);
    color: var(--parchment); font-family: 'Veilstone Text', Georgia, serif; font-size: 1.05rem; outline: none; border-radius: 0;
}
.kz-q input:focus { border-color: var(--gold); }
.kz-q input::placeholder { color: var(--border-ornate); opacity: 0.8; }
.kz-actions { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.kz-actions button {
    padding: 0.85rem 1.8rem; font-family: 'Veilstone Sans', sans-serif; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    background: var(--border-ornate); color: var(--parchment); border: none; cursor: pointer; transition: all 0.3s ease;
}
.kz-actions button:hover:not(:disabled) { background: var(--gold); color: var(--text-dark); }
.kz-actions button:disabled { opacity: 0.6; cursor: default; }
.kz-tries { font-family: 'Veilstone Text', Georgia, serif; font-size: 0.95rem; font-style: italic; color: var(--parchment-dark); opacity: 0.85; }
.kz-msg { min-height: 1.5em; font-family: 'Veilstone Text', Georgia, serif; font-size: 1rem; color: var(--gold); margin: 0; }

/* what a key opened */
.kz-opened { list-style: none; margin: 0.4rem 0 1rem; padding: 0; font-family: 'Veilstone Text', Georgia, serif; font-size: 1.05rem; color: var(--parchment); }
.kz-opened li { display: flex; gap: 0.8rem; padding: 0.55rem 0; border-bottom: 1px solid rgba(139,115,85,0.35); }
.kz-opened li strong { font-family: 'Veilstone Sans', sans-serif; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--gold); min-width: 5.5rem; padding-top: 0.25rem; }

.kz-empty { max-width: 640px; margin: 0 auto; text-align: center; font-family: 'Veilstone Text', Georgia, serif; font-size: 1.05rem; color: var(--parchment); }

@media (max-width: 720px) {
    .kz-pane { grid-template-columns: 1fr; padding: 1.4rem; gap: 1.4rem; }
    .kz-cover { max-width: 160px; margin: 0 auto; }
    .kz-body { text-align: left; }
    .kz-book { padding: 0.65rem 0.7rem 0.5rem; }
}

/* the link to the Shop in the explanation */
.kz-intro .kz-fine a { color: var(--wood-dark); font-style: normal; font-weight: 700; text-underline-offset: 3px; }
.kz-intro .kz-fine a:hover { color: var(--seal-crimson); }
