/*
 * Pop Books sign-up, download and follow-up pages. Loaded after books.css, which supplies the sage, terracotta and cream tokens (.bk),
 * the readable light header and the buttons. Contrast as on the product page (ink on white 9.9:1, mute 6.7:1, white on money 5.4:1,
 * error rust 6.9:1). Layout target: the whole form and its button sit on screen at 1366x768 and 375x812 without scrolling.
 */
/* The site's warm tokens, re-pointed to the Pop Books palette for anything that still uses them (download cards, account buttons). */
.bkf { --terra: var(--bk-money); --terra-hi: var(--bk-money-deep); --terracotta-ink: var(--bk-money); --cream: var(--bk-white); --cream-50: var(--bk-white); --cream-white: var(--bk-white); --cream-200: var(--bk-soft); --card: var(--bk-white); --ink: var(--bk-ink); --ink-soft: var(--bk-mute); --ink-mute: var(--bk-mute); --line: var(--bk-line); --brass: var(--bk-money); background: linear-gradient(180deg, var(--bk-white) 0%, var(--bk-paper) 100%); }
.bkf .btn-primary { background: var(--bk-money); border-color: var(--bk-money); color: var(--bk-white); }
.bkf .btn-ghost { background: var(--bk-white); border-color: var(--bk-money); color: var(--bk-money-deep); }
.bkf a { color: var(--bk-money-deep); }
.bkf a.btn-primary, .bkf a.bk-btn--solid { color: var(--bk-white); }
.bkf .bk-top { height: 72px; background: transparent; }

/* ---------- Sign-up page: two columns on a laptop, form first on a phone ---------- */
.bkf__grid { display: grid; gap: 1rem; padding-block: 1rem 2rem; grid-template-areas: "head" "main" "side"; }
.bkf__head { grid-area: head; display: grid; grid-template-columns: auto 1fr; gap: .1rem .9rem; align-items: center; }
.bkf__logo { display: block; line-height: 0; border-radius: var(--radius-sm); }
.bkf__logo img { width: 64px; height: auto; display: block; }
.bkf__head h1 { font-size: var(--step-3); line-height: 1.08; letter-spacing: -.02em; }
.bkf__head .chip { grid-column: 1 / -1; justify-self: start; }
.bkf__promise { grid-column: 1 / -1; color: var(--bk-mute); font-size: 1rem; }
.bkf__main { grid-area: main; background: var(--bk-white); border: 1px solid var(--bk-line); border-radius: var(--radius-lg); padding: 1rem; box-shadow: var(--bk-shadow); display: grid; gap: .8rem; align-content: start; min-width: 0; }
.bkf__side { grid-area: side; display: grid; gap: .9rem; }
@media (min-width: 900px) {
  .bkf__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 480px); grid-template-areas: "head main" "side main"; column-gap: clamp(2rem, 6vw, 5rem); row-gap: 1.4rem; align-content: center; align-items: start; padding-block: 1.4rem 2rem; min-height: calc(100svh - 72px); }
  .bkf__head { grid-template-columns: 1fr; gap: 1rem; align-self: end; }
  .bkf__logo img { width: 92px; }
  .bkf__promise { font-size: var(--step-0); max-width: 34ch; }
  .bkf__main { grid-row: 1 / span 2; align-self: center; padding: 1.5rem; }
  .bkf__side { align-self: start; }
}
@media (max-height: 800px) and (min-width: 900px) { .bkf__grid { padding-block: .6rem 1rem; row-gap: 1rem; } .bkf__head { gap: .6rem; } .bkf__logo img { width: 72px; } }

.bkf-ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.bkf-ticks li { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.bkf-ticks svg { flex: none; width: 1.35rem; height: 1.35rem; padding: .22rem; border-radius: 50%; background: var(--bk-money); color: var(--bk-white); margin-top: .05rem; }
.bkf-reassure { color: var(--bk-mute); font-size: .95rem; max-width: 46ch; padding: .6rem .8rem; border-radius: var(--radius-xs); background: var(--bk-gold-soft); }
.bkf-links { font-size: .95rem; color: var(--bk-mute); }
@media (max-width: 899px) { .bkf-ticks li:nth-child(n+3) { display: none; } .bkf-reassure { font-size: .9rem; } }

/* Which plan: two links that read as one switch */
.bkf-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; padding: .3rem; border-radius: var(--radius); background: var(--bk-paper); border: 1px solid var(--bk-line); }
.bkf-switch a { display: grid; gap: .05rem; padding: .55rem .7rem; border-radius: var(--radius-xs); text-decoration: none; color: var(--bk-mute); line-height: 1.2; min-height: 48px; align-content: center; }
.bkf-switch a strong { color: var(--bk-ink); font-size: .98rem; }
.bkf-switch a span { font-size: .8rem; }
.bkf-switch a[aria-current="page"] { background: var(--bk-white); box-shadow: 0 1px 2px rgba(59, 48, 41, .2), 0 0 0 2px var(--bk-money); }
@media (hover: hover) and (pointer: fine) { .bkf-switch a:not([aria-current]):hover { background: var(--bk-soft); } }

/* ---------- Form ---------- */
.bkf-form { display: grid; gap: .7rem; }
.bkf-f { display: grid; gap: .3rem; min-width: 0; }
.bkf-f[hidden] { display: none; }
.bkf-f label { font-weight: 600; font-size: .95rem; }
.bkf-form input:not([type="checkbox"]), .bkf-form select, .bkf-input { width: 100%; min-height: 48px; padding: .55rem .8rem; border: 1.5px solid var(--sage-600); border-radius: var(--radius-xs); background: var(--bk-white); color: var(--bk-ink); font: 500 1rem/1.2 var(--bk-sans); }
.bkf-form select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--bk-ink) 50%), linear-gradient(135deg, var(--bk-ink) 50%, transparent 50%); background-repeat: no-repeat; background-position: right 1.05rem center, right .72rem center; background-size: .35rem .35rem, .35rem .35rem; padding-right: 2.2rem; }
.bkf-form input:focus-visible, .bkf-form select:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; border-color: var(--sage-700); }
.bkf-form [aria-invalid="true"] { border-color: var(--bk-rust); border-width: 2px; }
.bkf-row { display: grid; grid-template-columns: 1fr; gap: .7rem; }
.bkf-row:has([data-region]:not([hidden])) { grid-template-columns: 1fr 1fr; }
.bkf-err { display: flex; gap: .35rem; align-items: flex-start; color: var(--bk-rust); font-size: .88rem; font-weight: 600; line-height: 1.3; }
.bkf-err[hidden] { display: none; }
.bkf-err::before { content: "!"; flex: none; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--bk-rust); color: var(--bk-white); font: 700 .72rem/1.05rem var(--bk-sans); text-align: center; margin-top: .05rem; }
.bkf-errsum { padding: .7rem .9rem; border-radius: var(--radius-xs); background: var(--danger-soft); border: 1px solid var(--bk-rust); color: var(--danger-ink-strong); font-size: .93rem; }
.bkf-errsum--ok { background: var(--bk-soft); border-color: var(--bk-line-strong); color: var(--bk-ink); }
.bkf-ck { display: flex; gap: .65rem; align-items: flex-start; font-size: .9rem; color: var(--bk-mute); }
.bkf-ck input { width: 22px; height: 22px; flex: none; margin: .1rem 0 0; accent-color: var(--bk-money); }
.bkf-ck label { font-weight: 400; font-size: .9rem; }
.bkf-ck:has([aria-invalid="true"]) { color: var(--bk-rust); }
.bkf-submit { width: 100%; position: relative; }
.bkf-submit[aria-busy="true"] { pointer-events: none; opacity: .9; }
.bkf-spin { display: none; width: 1.1rem; height: 1.1rem; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: var(--bk-white); border-radius: 50%; }
.bkf-submit[aria-busy="true"] .bkf-spin { display: inline-block; animation: bkf-rot .8s linear infinite; }
@keyframes bkf-rot { to { transform: rotate(360deg); } }
.bkf-fine { color: var(--bk-mute); font-size: .85rem; text-align: center; }
.bkf-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Follow-up pages ---------- */
.bkf__msgwrap { display: grid; place-items: start center; padding-block: 1.5rem 3rem; min-height: calc(100svh - 72px); }
.bkf-msg { width: min(100%, 620px); background: var(--bk-white); border: 1px solid var(--bk-line); border-radius: var(--radius-lg); padding: clamp(1.3rem, 4vw, 2.2rem); box-shadow: var(--bk-shadow); display: grid; gap: .9rem; justify-items: start; }
.bkf-msg .bkf__logo img { width: 72px; }
.bkf-msg h1 { font-size: var(--step-3); }
.bkf-msg__text { color: var(--bk-mute); font-size: 1.05rem; }
.bkf-msg__icon svg { width: 2.4rem; height: 2.4rem; display: block; }
.bkf-msg--ok .bkf-msg__icon { color: var(--bk-money); } .bkf-msg--wait .bkf-msg__icon { color: var(--bk-money-deep); } .bkf-msg--problem .bkf-msg__icon { color: var(--bk-rust); }
.bkf-msg .bkf-form { width: 100%; }
.bkf-steps { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; gap: .8rem; width: 100%; }
.bkf-steps li { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem .9rem; border-radius: var(--radius-sm); background: var(--bk-paper); }
.bkf-steps__n { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--bk-money); color: var(--bk-white); display: grid; place-items: center; font: 600 1rem var(--bk-serif); }
.bkf-steps div { display: grid; gap: .1rem; } .bkf-steps span:not(.bkf-steps__n) { color: var(--bk-mute); font-size: .95rem; }
.bkf-msg__cta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }
.bkf-msg__cta form { margin: 0; }
.bkf-msg .bkf-fine { text-align: left; }

/* ---------- Download page, signed out and signed in ---------- */
.bkf--dl .acc { padding: 1rem 0 2.5rem; background: transparent; min-height: 0; }
.bkf--dl .acc h1 { font-family: var(--bk-serif); color: var(--bk-ink); letter-spacing: -.02em; font-size: var(--step-3); margin: .3rem 0 .4rem; }
.bkf--dl .acc h2 { font-family: var(--bk-serif); color: var(--bk-ink); }
.bkf--dl .acc .lede, .bkf--dl .acc p, .bkf--dl .acc .note { color: var(--bk-mute); }
.bkf--dl .bkf__logo--sm img { width: 64px; }
.bkf--dl .acc-card { background: var(--bk-white); border-color: var(--bk-line); border-radius: var(--radius-lg); box-shadow: var(--bk-shadow); }
.bkf--dl .acc-form input, .bkf--dl .acc-key, .bkf--dl .fld input { min-height: 48px; border: 1.5px solid var(--sage-600); border-radius: var(--radius-xs); background: var(--bk-white); color: var(--bk-ink); }
.bkf--dl .acc-notice { background: var(--bk-soft); border: 1px solid var(--bk-line-strong); color: var(--bk-ink); border-radius: var(--radius-xs); padding: .7rem .9rem; }
.bkf--dl .acc-alert { background: var(--danger-soft); border: 1px solid var(--bk-rust); color: var(--danger-ink-strong); border-radius: var(--radius-xs); padding: .7rem .9rem; }
.bkf--dl .btn { border-radius: var(--radius-pill); min-height: 48px; font-weight: 600; }
.bkf--dl .btn-ghost { background: var(--bk-white); }
.bkf--dl .pr-crumb { display: none; }

@media (prefers-reduced-motion: reduce) { .bkf-submit[aria-busy="true"] .bkf-spin { animation: none; } }
