/*
 * Inbound Books Shop — site styles
 *
 * Goal: visual continuity with https://inboundbooks.org so a visitor
 * moving between the WP site and the shop perceives a single brand.
 *
 * Palette values pulled directly from the live WP site's rendered
 * --wp--preset--color-* custom properties (book-store-lite child theme
 * as customized by Jayne via the Block Editor).
 *
 * Structural zones (matches inboundbooks.org top-to-bottom):
 *   - Header (logo area):   warm beige, logo in dark navy
 *   - Header (nav strip):   warm beige, navy menu links, white
 *                           dividers above + below
 *   - Main content area:    warm beige (continuous with header,
 *                           one large branded background field)
 *   - Footer:               dark navy, cream text
 *
 * The body BG is one continuous warm beige from the top of the page
 * to the navy footer. White hairline dividers separate the three
 * header zones (logo, nav, main) — same low-contrast subtle dividers
 * the WP site uses.
 *
 * The logo asset is the same BW source PNG the WP site uses. The WP
 * theme applies an SVG duotone to recolor it; for the shop we let it
 * render as the source bytes (black on transparent), which reads as
 * editorial-dark on the beige header — close to the WP visual without
 * needing a CSS duotone polyfill.
 */

@import url('https://fonts.googleapis.com/css?family=Noto+Sans:300,400,500,700&family=Roboto:300,400,500,700&family=EB+Garamond:400,500,600,700&display=swap');

:root {
    /* --- Brand palette (matches inboundbooks.org as rendered) --- */
    --ib-rust:        #a84e11;  /* deep rust — accents, hero rule */
    --ib-rust-warm:   #a65f19;  /* warm rust brown — body links */
    --ib-rust-bright: #c53f09;  /* brighter rust — hover states */
    --ib-beige:       #d9ccc4;  /* warm beige — header zones + main BG */
    --ib-beige-edge:  #c4b3a7;  /* slightly darker beige — reserved (currently unused) */
    --ib-cream:       #f7f6f5;  /* warm off-white — cards inside main */
    --ib-gold:        #cb964c;  /* warm gold — secondary accents */
    --ib-slate:       #485467;  /* slate blue-gray — quiet accents */
    --ib-navy:        #0a2b40;  /* dark navy — logo color, nav links, footer */
    --ib-base:        #ffffff;  /* pure white — card surfaces inside main */

    /* Text */
    --ib-text:        #1b1a18;
    --ib-text-soft:   #5f5e5d;
    --ib-text-muted:  #8d8c8b;
    --ib-border:      #d1d1d1;

    /* Semantic aliases */
    --ib-link:        var(--ib-rust-warm);
    --ib-link-hover:  var(--ib-rust-bright);
    --ib-heading:     var(--ib-rust);

    /* Zones — these are what feature CSS should refer to so a future
       palette tweak only touches the alias definitions, not every block.
       Header BG and main BG are both warm beige — one continuous brand
       field from the top of the page to the footer. White dividers
       segment the three header zones (logo / nav / main). */
    --ib-header-bg:   var(--ib-beige);
    --ib-header-text: var(--ib-navy);
    --ib-divider:     var(--ib-base);  /* white hairline */
    --ib-main-bg:     var(--ib-beige);
    --ib-footer-bg:   var(--ib-navy);
    --ib-footer-text: var(--ib-cream);

    /* --- Fonts --- */
    --ib-font-body:    "Noto Sans", "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
    --ib-font-heading: "Roboto", "Noto Sans", sans-serif;
    --ib-font-display: "EB Garamond", Georgia, "Times New Roman", serif;
    --ib-font-mono:    ui-monospace, "SF Mono", Menlo, monospace;

    /* --- Type scale --- */
    --ib-text-xs:   0.75rem;
    --ib-text-sm:   0.875rem;
    --ib-text-base: 1rem;
    --ib-text-lg:   1.125rem;
    --ib-text-xl:   1.25rem;
    --ib-text-2xl:  1.5rem;
    --ib-text-3xl:  1.875rem;
    --ib-text-4xl:  2.25rem;
    --ib-text-5xl:  3rem;

    --ib-leading-tight:   1.2;
    --ib-leading-snug:    1.4;
    --ib-leading-relaxed: 1.65;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--ib-main-bg);
    color: var(--ib-text);
    font-family: var(--ib-font-body);
    font-size: var(--ib-text-base);
    font-weight: 400;
    line-height: var(--ib-leading-relaxed);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Headings --- */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ib-font-heading);
    font-weight: 700;
    line-height: var(--ib-leading-tight);
    color: var(--ib-text);
    margin: 0 0 1rem;
}

/* --- Links (in body content) --- */

a {
    color: var(--ib-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--ib-link-hover);
}

/* --- Header zone (warm beige, matches WP site) --- */

.site-header {
    background: var(--ib-header-bg);
}

.site-header-logo {
    text-align: center;
    padding: 2.5rem 1.5rem 1.5rem;
}

.site-logo-link {
    display: inline-block;
    line-height: 0;
    text-decoration: none;
}

.site-logo {
    /*
     * BW source PNG (black on transparent). Rendering as-is on the
     * beige header reads as crisp editorial dark — visually equivalent
     * to the WP site's CSS duotone treatment of the same asset, without
     * needing an SVG filter.
     */
    height: auto;
    width: 275px;
    max-width: 70vw;
}

.site-header-nav {
    border-top: 1px solid var(--ib-divider);
    border-bottom: 1px solid var(--ib-divider);
}

.site-nav {
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 1.25rem 1.5rem;
}

.site-nav a {
    color: var(--ib-header-text);  /* navy */
    text-decoration: none;
    font-family: var(--ib-font-heading);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: var(--ib-text-sm);
    transition: color 0.15s ease;
}

.site-nav a:hover {
    color: var(--ib-rust);
}

.site-nav a.external::after {
    content: " ↗";
    margin-left: 0.15em;
}

/* Authenticated nav: display name + sign out button. The form wrapper
   exists so signout can be a POST (required for state-changing
   actions). Styled to read as a link, not a button. */
.site-nav-user {
    color: var(--ib-header-text);
    font-family: var(--ib-font-heading);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: var(--ib-text-sm);
    opacity: 0.75;
}

.site-nav-signout-form {
    margin: 0;
    padding: 0;
    display: inline;
}

.site-nav-signout {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ib-header-text);
    font-family: var(--ib-font-heading);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: var(--ib-text-sm);
    padding: 0;
    transition: color 0.15s ease;
}

.site-nav-signout:hover {
    color: var(--ib-rust);
}

/* --- Main / central catalog area (continues the beige header zone) --- */

.site-main {
    background: var(--ib-main-bg);
    border-top: 1px solid var(--ib-divider);  /* white hairline below nav strip */
    min-height: 60vh;
    padding: 4rem 0;
}

.hero {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--ib-rust);                /* rust orange card on beige main */
    color: var(--ib-base);                     /* white text inherited by children */
    box-shadow: 0 2px 16px rgba(10, 43, 64, 0.10);
}

.hero h1 {
    font-family: var(--ib-font-display);
    font-size: var(--ib-text-5xl);
    font-weight: 600;
    color: var(--ib-base);                     /* white display serif on rust */
    margin: 0 0 1.5rem;
    letter-spacing: -0.01em;
}

.hero .lede {
    font-size: var(--ib-text-lg);
    color: var(--ib-base);
    margin: 0 0 2rem;
    line-height: var(--ib-leading-snug);
}

/* Inside the hero, `.muted` reads as cream-with-some-transparency so
   it still reads as secondary copy against the rust card. Outside the
   hero (anywhere else on the site), .muted falls back to the default
   warm gray. */
.hero .muted {
    color: var(--ib-cream);
    opacity: 0.85;
}

.muted {
    color: var(--ib-text-soft);
}

/* --- Auth card (sign-in form) --- */

.auth-card {
    max-width: 460px;
    margin: 3rem auto;
    background: var(--ib-base);
    padding: 2.5rem 2rem;
    box-shadow: 0 2px 16px rgba(10, 43, 64, 0.08);
}

.auth-card h1 {
    font-family: var(--ib-font-display);
    font-size: var(--ib-text-3xl);
    color: var(--ib-rust);
    margin: 0 0 0.75rem;
    text-align: center;
}

.auth-card p.muted {
    text-align: center;
    margin: 0 0 1.5rem;
}

.auth-info,
.auth-error {
    padding: 0.875rem 1rem;
    margin: 0 0 1.5rem;
    font-size: var(--ib-text-sm);
    border-left: 3px solid var(--ib-rust);
    background: var(--ib-cream);
}

.auth-error {
    border-left-color: #c53f09;
    color: #8a3208;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-label {
    font-family: var(--ib-font-heading);
    font-weight: 600;
    font-size: var(--ib-text-sm);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ib-navy);
    margin-bottom: 0.25rem;
}

.auth-input {
    font-family: var(--ib-font-body);
    font-size: var(--ib-text-base);
    padding: 0.75rem 1rem;
    border: 1px solid var(--ib-border);
    border-radius: 4px;
    background: var(--ib-base);
    color: var(--ib-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input:focus {
    outline: none;
    border-color: var(--ib-rust);
    box-shadow: 0 0 0 3px rgba(168, 78, 17, 0.15);
}

.auth-submit {
    margin-top: 1rem;
    width: 100%;
    cursor: pointer;
    border: 2px solid var(--ib-rust);
    /* Inherits .btn-primary base; just keeps the auth context compact. */
}

/* Secondary "email me a link instead" path — small underlined link
   below the primary CTA. Visually quieter than .btn so the password
   path remains the primary affordance. */
.auth-alt-link {
    margin-top: 1rem;
    text-align: center;
    font-size: var(--ib-text-sm);
}

.auth-alt-link a {
    color: var(--ib-rust-warm);
}

.auth-alt-link a:hover {
    color: var(--ib-rust-bright);
}

.auth-card-wide {
    max-width: 560px;
}

.auth-recovery {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ib-border);
    text-align: center;
}

/* --- TOTP enrollment --- */

.totp-qr {
    margin: 1.5rem auto;
    max-width: 240px;
    text-align: center;
    padding: 1rem;
    background: var(--ib-base);
}

.totp-qr svg {
    width: 100%;
    height: auto;
    display: block;
}

.totp-manual-secret {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--ib-cream);
    border: 1px solid var(--ib-border);
}

.totp-manual-secret summary {
    cursor: pointer;
    font-family: var(--ib-font-heading);
    font-size: var(--ib-text-sm);
    font-weight: 600;
    color: var(--ib-rust-warm);
}

.totp-secret {
    display: block;
    margin: 1rem 0 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--ib-base);
    font-family: var(--ib-font-mono);
    font-size: var(--ib-text-base);
    letter-spacing: 0.05em;
    word-break: break-all;
    border-radius: 4px;
    border: 1px solid var(--ib-border);
}

/* --- Passkey (sign-in form) --- */

.auth-passkey-block {
    margin-top: 1.25rem;
    text-align: center;
}

.auth-passkey-btn {
    width: 100%;
    cursor: pointer;
}

.passkey-status {
    margin: 0.5rem 0 0;
    min-height: 1.25em;  /* reserve space so layout doesn't jump */
}

/* --- Passkey list (/me/security) --- */

.security-section-h {
    font-family: var(--ib-font-heading);
    font-size: var(--ib-text-xl);
    margin: 2rem 0 1rem;
    color: var(--ib-text);
}

.passkey-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.passkey-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: var(--ib-cream);
    border: 1px solid var(--ib-border);
    border-radius: 4px;
}

.passkey-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.passkey-delete-form {
    margin: 0;
}

.passkey-delete {
    padding: 0.5rem 1rem;
    font-size: var(--ib-text-sm);
}

.passkey-register {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--ib-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.passkey-register .btn {
    margin-top: 0.5rem;
    align-self: flex-start;
    cursor: pointer;
}

/* --- Backup codes --- */

.backup-codes {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.backup-codes li code {
    display: block;
    padding: 0.875rem 1rem;
    background: var(--ib-cream);
    border: 1px solid var(--ib-border);
    font-family: var(--ib-font-mono);
    font-size: var(--ib-text-base);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-align: center;
    border-radius: 4px;
}

@media (max-width: 540px) {
    .backup-codes {
        grid-template-columns: 1fr;
    }
}

.small {
    font-size: var(--ib-text-sm);
}

/* --- Buttons (for future CTAs) --- */

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 999px;
    font-family: var(--ib-font-heading);
    font-weight: 500;
    font-size: var(--ib-text-sm);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-primary {
    background: var(--ib-rust);
    color: var(--ib-base);
    border: 2px solid var(--ib-rust);
}

.btn-primary:hover {
    background: var(--ib-rust-bright);
    border-color: var(--ib-rust-bright);
    color: var(--ib-base);
}

.btn-secondary {
    background: transparent;
    color: var(--ib-rust);
    border: 2px solid var(--ib-rust);
}

.btn-secondary:hover {
    background: var(--ib-rust);
    color: var(--ib-base);
}

/* --- Footer (dark navy band, mirrors WP-site visual weight) --- */

.site-footer {
    background: var(--ib-footer-bg);
    color: var(--ib-footer-text);
    padding: 2.5rem 0;
    text-align: center;
}

.site-footer p {
    margin: 0.5rem 0;
    color: var(--ib-footer-text);
}

.site-footer a {
    color: var(--ib-footer-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-footer a:hover {
    color: var(--ib-gold);
}

.site-footer .footer-meta {
    font-size: var(--ib-text-sm);
    opacity: 0.85;
}

.site-footer .dot {
    margin: 0 0.4em;
    opacity: 0.6;
}

.site-footer .version {
    font-family: var(--ib-font-mono);
    font-size: 0.75rem;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .site-header-logo {
        padding: 1.5rem 1.5rem 1rem;
    }

    .site-logo {
        width: 200px;
    }

    .site-nav {
        gap: 1.25rem;
        padding: 0.875rem 1.5rem;
    }

    .hero {
        padding: 2.5rem 1.25rem;
    }

    .hero h1 {
        font-size: var(--ib-text-3xl);
    }

    .site-main {
        padding: 2rem 0;
    }
}
