/* =====================================================================
   Lead With Prayer — Prayer Cards
   Global Stylesheet  (v2 – physical card redesign)
   ===================================================================== */

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans:  'Inter', system-ui, sans-serif;

    --brand:        #54C5E8;   /* LWP sky blue */
    --brand-dark:   #2FA8CF;
    --brand-deeper: #1C7A9A;

    --color-bg:       #F5F5F2;
    --color-surface:  #FFFFFF;
    --color-border:   #E8E5DF;
    --color-text:     #111111;
    --color-text-mid: #555555;
    --color-text-dim: #999999;

    --shadow-sm:   0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:   0 4px 16px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);
    --shadow-lg:   0 12px 40px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.06);
    --shadow-card: 0 6px 28px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.08);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;

    --transition: 200ms ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
ul { list-style: none; }

/* ── Layout ───────────────────────────────────────────────────────── */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}
@media (min-width: 640px)  { .container { padding: 0 32px; } }
@media (min-width: 1024px) { .container { padding: 0 48px; } }

/* ── Site Header ──────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    gap: 16px;
    flex-wrap: wrap;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--color-text);
}

.logo-icon { font-size: 1.1rem; }
.logo-accent { color: var(--brand); }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: var(--color-text-mid);
    flex-wrap: wrap;
}
.breadcrumb a:hover { color: var(--color-text); text-decoration: underline; }
.breadcrumb-sep { color: var(--color-text-dim); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 50px;
    font-family: var(--font-sans);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(84,197,232,.35);
}

.btn-ghost {
    background: rgba(255,255,255,.18);
    color: #fff;
    border-color: rgba(255,255,255,.5);
    backdrop-filter: blur(4px);
}
.btn-ghost:hover {
    background: rgba(255,255,255,.28);
    border-color: rgba(255,255,255,.8);
    transform: translateY(-1px);
}

.btn-ghost-dark {
    background: transparent;
    color: var(--color-text-mid);
    border-color: var(--color-border);
}
.btn-ghost-dark:hover {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-text-dim);
}

.btn-large { padding: 13px 30px; font-size: .95rem; }
.btn-sm    { padding: 7px 16px; font-size: .8rem; }

.btn-flip {
    background: var(--btn-color, var(--brand));
    color: #fff;
    border-color: var(--btn-color, var(--brand));
    padding: 11px 34px;
    font-size: .9rem;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
}
.btn-flip:hover {
    opacity: .88;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-flip svg { width: 16px; height: 16px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
    background: var(--brand);
    color: #fff;
    padding: 64px 0 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 70% 30%, rgba(255,255,255,.12) 0%, transparent 60%),
        radial-gradient(circle at 20% 80%, rgba(0,100,140,.2) 0%, transparent 50%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: center;
    padding-bottom: 48px;
}

@media (max-width: 600px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-cover-wrap { display: none; }
}

.hero-text { max-width: 520px; }

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .75rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255,255,255,.8);
    background: rgba(255,255,255,.15);
    padding: 5px 14px;
    border-radius: 50px;
    margin-bottom: 18px;
    font-weight: 600;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 700;
    line-height: 1.15;
    color: #fff;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,.82);
    max-width: 460px;
    margin-bottom: 32px;
    line-height: 1.7;
}
.hero-subtitle em { color: rgba(255,255,255,.95); font-style: italic; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Primary button inside hero: show white border to match ghost sibling */
.hero .btn-primary { border-color: rgba(255,255,255,.65); }

.hero-cover-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.hero-cover {
    width: 150px;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0,60,100,.28), 0 4px 12px rgba(0,0,0,.15);
    transform: rotate(2deg);
    transition: transform .3s ease;
}

.hero-cover:hover { transform: rotate(0deg) scale(1.03); }

.hero-wave {
    width: 100%;
    height: 44px;
    position: relative;
}
.hero-wave svg { width: 100%; height: 100%; display: block; }

/* ── How to Use ───────────────────────────────────────────────────── */
.how-to-use {
    padding: 28px 0;
    border-bottom: 1px solid var(--color-border);
}

.how-to-details { width: 100%; }

.how-to-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
    padding: 0 4px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--color-text-mid);
    user-select: none;
}
.how-to-summary::-webkit-details-marker { display: none; }
.how-to-summary:hover { color: var(--color-text); }
.how-to-summary .chevron { width: 20px; height: 20px; transition: transform var(--transition); flex-shrink: 0; }
details[open] .chevron { transform: rotate(180deg); }

.how-to-body { padding: 24px 0 8px; }

.how-to-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
@media (min-width: 640px) { .how-to-grid { grid-template-columns: 1fr 1fr; } }

.how-to-item { display: flex; gap: 14px; align-items: flex-start; }

.how-to-num {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    font-weight: 700;
}
.how-to-item strong { display: block; margin-bottom: 2px; }
.how-to-item p { font-size: .86rem; color: var(--color-text-mid); }

.scripture-note {
    font-size: .78rem;
    color: var(--color-text-dim);
    margin-top: 20px;
    border-top: 1px solid var(--color-border);
    padding-top: 14px;
}

/* ── Categories Section ───────────────────────────────────────────── */
.categories-section { padding: 52px 0 76px; }

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.section-subtitle {
    color: var(--color-text-mid);
    font-size: .92rem;
    text-align: center;
    max-width: 520px;
    margin: 0 auto 40px;
}

.category-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 480px) { .category-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .category-grid { grid-template-columns: repeat(4, 1fr); } }

.category-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.category-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.category-card-top {
    height: 6px;
    background: var(--cat-color, #6B7280);
}

.category-card-body {
    padding: 18px 18px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.color-dot {
    width: 13px; height: 13px;
    border-radius: 50%;
    flex-shrink: 0;
}
.color-dot-lg {
    width: 42px; height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
}

.card-count {
    font-size: .75rem;
    color: var(--color-text-dim);
    font-weight: 500;
}

.category-name {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 700;
    flex: 1;
    line-height: 1.3;
}

.category-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.btn-cat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1.5px solid transparent;
    text-decoration: none;
}
.btn-cat svg { width: 12px; height: 12px; }

.btn-cat-browse {
    background: var(--cat-color-light, #F3F4F6);
    color: var(--cat-color, #6B7280);
    border-color: var(--cat-color, #6B7280);
}
.btn-cat-browse:hover { opacity: .78; }

.btn-cat-random {
    background: transparent;
    color: var(--color-text-mid);
    border-color: var(--color-border);
}
.btn-cat-random:hover {
    background: var(--cat-color-light, #F3F4F6);
    color: var(--cat-color, #6B7280);
    border-color: var(--cat-color, #6B7280);
}

/* ── Browse Page ──────────────────────────────────────────────────── */
.browse-hero {
    padding: 36px 0 28px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.browse-hero-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}

.browse-title {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    font-weight: 700;
}
.browse-count { font-size: .86rem; color: var(--color-text-mid); margin-top: 4px; }

.browse-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.card-list-section { padding: 32px 0 72px; }

.card-list { display: flex; flex-direction: column; gap: 9px; }

.card-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 15px 18px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text);
}
.card-list-item:hover {
    border-color: var(--cat-color, #6B7280);
    box-shadow: var(--shadow-md);
    transform: translateX(3px);
}

.card-list-num {
    width: 34px; height: 34px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    font-weight: 700;
    flex-shrink: 0;
}

.card-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.card-list-title { font-family: var(--font-serif); font-size: 1rem; font-weight: 600; }
.card-list-sub { font-size: .78rem; color: var(--color-text-mid); }

.card-list-arrow { width: 17px; height: 17px; color: var(--color-text-dim); flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════════
   CARD PAGE — Physical card look
   ══════════════════════════════════════════════════════════════════ */

.card-main { padding: 28px 0 68px; }

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 13px 4px 9px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 700;
    border: 1.5px solid;
    letter-spacing: .04em;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Flip Card Wrapper ────────────────────────────────────────────── */
.flip-wrapper {
    perspective: 1400px;
    width: 100%;
    max-width: 400px;
    cursor: pointer;
    outline: none;
    margin: 0 auto;
}

.flip-wrapper:focus-visible .flip-inner {
    outline: 3px solid var(--page-color, var(--brand));
    outline-offset: 4px;
    border-radius: var(--radius-lg);
}

.flip-inner {
    position: relative;
    min-height: 420px; /* JS overrides this with the taller face's measured height */
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.62s cubic-bezier(.4,0,.2,1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.flip-inner.is-flipped {
    transform: rotateY(180deg);
}

/* ── Card Face — physical card design ────────────────────────────── */
.flip-face {
    position: absolute;
    top: 0; left: 0; right: 0;
    min-height: 420px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    transform: rotateY(0deg) translateZ(1px);
    -webkit-transform: rotateY(0deg) translateZ(1px);
}

.flip-back {
    transform: rotateY(180deg) translateZ(1px);
    -webkit-transform: rotateY(180deg) translateZ(1px);
    background: #FFFFFF;
}

/* Card number — in-flow row (no absolute positioning; avoids mobile 3D quirks) */
.face-num-row {
    display: flex;
    margin-bottom: 4px;
}
.face-num-right { justify-content: flex-end; }
.face-num-left  { justify-content: flex-start; }

.corner-num {
    font-size: .78rem;
    font-weight: 600;
    color: var(--color-text-dim);
    font-family: var(--font-sans);
    line-height: 1;
}

/* Main face content area */
.face-content {
    flex: 1;
    padding: 36px 28px 20px;
    overflow-y: auto;
}

@media (min-width: 480px) {
    .face-content { padding: 38px 36px 20px; }
}

/* Category bar at bottom — THE key physical-card element */
.face-category-bar {
    background: var(--page-color, var(--brand));
    color: #fff;
    text-align: center;
    padding: 12px 16px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* Tap hint sits just above the category bar */
.flip-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 16px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--page-color, var(--brand));
    border-top: 1px solid #F0EDE8;
    background: #FAFAF8;
    flex-shrink: 0;
}
.flip-hint svg { width: 13px; height: 13px; }

/* ── Card Front Content Typography ───────────────────────────────── */

/* Title on the card face itself */
.card-face-title {
    font-family: var(--font-sans);
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    font-weight: 800;
    line-height: 1.2;
    color: #111;
    margin-bottom: 3px;
}

.card-face-subtitle {
    font-family: var(--font-sans);
    font-size: clamp(.9rem, 2.5vw, 1.05rem);
    font-weight: 700;
    color: #111;
    margin-bottom: 22px;
    line-height: 1.3;
}

/* Scripture list */
.scripture-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.scripture-item { }

.scripture-text {
    font-family: var(--font-sans);
    font-size: clamp(.88rem, 2.2vw, .96rem);
    line-height: 1.75;
    color: #333;
    margin-bottom: 5px;
    white-space: pre-line;
}

.scripture-ref {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #111;
    font-style: normal;
}

/* ── Card Back Content Typography ────────────────────────────────── */

.back-heading {
    font-family: var(--font-sans);
    font-size: clamp(.82rem, 2.2vw, .92rem);
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #111;
    margin-bottom: 22px;
    text-align: center;
    line-height: 1.45;
}

.back-note {
    font-size: .82rem;
    color: var(--color-text-mid);
    font-style: italic;
    margin-bottom: 14px;
    text-align: center;
}

/* Back list — centered, no bullets, generous spacing */
.back-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.back-list li {
    font-family: var(--font-sans);
    font-size: clamp(.86rem, 2.2vw, .94rem);
    line-height: 1.55;
    color: #333;
    text-align: center;
    padding: 7px 0;
    border-bottom: 1px solid #F0EDE8;
}
.back-list li:last-child { border-bottom: none; }

.back-body p {
    font-family: var(--font-sans);
    font-size: clamp(.86rem, 2.2vw, .94rem);
    line-height: 1.85;
    color: #333;
    text-align: center;
    white-space: pre-line;
}

/* For back sections (multi-heading backs like card 27) */
.back-section { margin-bottom: 18px; }
.back-section:last-child { margin-bottom: 0; }
.back-section .back-heading { margin-bottom: 12px; font-size: .78rem; }

/* ── Flip Button Row ──────────────────────────────────────────────── */
.flip-btn-row {
    display: flex;
    justify-content: center;
    margin: 22px 0 18px;
}

/* ── Card Navigation ──────────────────────────────────────────────── */
.card-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 28px;
    margin-bottom: 20px;
}

.card-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 50px;
    font-size: .82rem;
    font-weight: 500;
    border: 1.5px solid var(--color-border);
    color: var(--color-text-mid);
    background: var(--color-surface);
    transition: var(--transition);
    text-decoration: none;
    cursor: pointer;
}
.card-nav-btn:not(.disabled):hover {
    border-color: var(--page-color, var(--brand));
    color: var(--page-color, var(--brand));
    background: #fff;
}
.card-nav-btn.disabled { opacity: 0; pointer-events: none; }
.card-nav-btn svg { width: 16px; height: 16px; }
.card-nav-back { background: transparent; font-weight: 500; }

.card-random-bar {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
}

/* Override .btn-ghost for non-hero context */
.card-random-bar .btn-ghost,
.browse-actions .btn-ghost-dark {
    background: transparent;
    color: var(--color-text-mid);
    border-color: var(--color-border);
}
.card-random-bar .btn-ghost:hover,
.browse-actions .btn-ghost-dark:hover {
    color: var(--color-text);
    background: var(--color-surface);
    border-color: var(--color-text-dim);
}

/* ── Browse Hero ──────────────────────────────────────────────────── */
.browse-hero .btn-primary { color: #fff !important; }

/* ── Site Footer ──────────────────────────────────────────────────── */
.site-footer {
    background: #1A1A1A;
    color: rgba(255,255,255,.65);
    padding: 32px 0;
    text-align: center;
    font-size: .84rem;
}

.footer-inner { display: flex; flex-direction: column; gap: 8px; align-items: center; }

.site-footer a { color: var(--brand); transition: color var(--transition); }
.site-footer a:hover { color: #fff; }
.site-footer em { color: rgba(255,255,255,.85); font-style: italic; }
.footer-sub { color: rgba(255,255,255,.38); font-size: .76rem; }
.footer-divider { color: rgba(255,255,255,.2); }

/* ── Utilities ────────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Mobile tweaks ────────────────────────────────────────────────── */
@media (max-width: 400px) {
    .flip-inner, .flip-face { min-height: 360px; }
    .face-content { padding: 24px 18px 14px; }
    .card-nav-btn { padding: 7px 11px; font-size: .78rem; }
}

/* ── Fade-in animation ───────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hero-inner,
.category-grid,
.card-list,
.flip-wrapper {
    animation: fadeUp .4s ease both;
}
