/* ─────────────────────────────────────────────────────────────
   pages.css — shared styles for LoreLoom public content pages
   (legal, about, contact, public discover, character profiles).
   Builds on landing.css design tokens (--bg-dark, --accent-*,
   fonts). Link BOTH landing.css and pages.css on these pages.
   ───────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────
   NAVBAR CLEARANCE — why every wrapper below repeats padding-top

   The top padding on .page-wrap / .blog-wrap / .discover-wrap /
   .profile-wrap exists for exactly one reason: to clear the fixed
   floating navbar, which sits at `top: calc(16px + var(--safe-top))`
   (landing.css:122, and 10px in its own mobile override).

   The navbar tracks the status-bar inset. These paddings did not. In a
   desktop browser --safe-top is 0 so the two agreed by accident, but in
   the Android app the inset is real -- 48.76px on a Pixel-class phone --
   and the navbar moved down while the page did not, so the page slid
   underneath it. Measured on device, not inferred: the <h1> on /about and
   /privacy rendered at y=92 against a navbar bottom edge of y=105, i.e.
   13px BEHIND the navbar, and /blog was touching at -1px.

   So each rule keeps its shorthand -- that value is the design intent and
   the number to edit -- and follows it with one padding-top longhand that
   adds the inset. --safe-top resolves to 0 in a browser (tokens.css), so
   every computed value on the live site is byte-identical to before.

   Re-verified 2026-08-30 with the display face changed to Fraunces, injecting
   --safe-top: 48.76px to reproduce device geometry rather than trusting the
   browser's 0: navbar bottom 105.8, h1 top 140.8 on /about and /privacy
   (clearance +35px, was -13px) and 152.8 on /blog (+47px, was -1px). Fraunces
   raised the h1 line box to 34.5px at 32px, which moves what is BELOW the
   heading, not the heading's own top edge -- padding-top is what sets that, so
   the clearance is face-independent by construction. Probe: llshots/p32verify.mjs
   ───────────────────────────────────────────────────────────── */

/* Readable article container for legal / about / content-policy pages */
.page-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 140px 6% 100px;
    padding-top: calc(140px + var(--safe-top));
}

.page-wrap h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-wrap .updated {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 40px;
}

.page-wrap h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin: 40px 0 12px;
    color: var(--text-primary);
}

.page-wrap h3 {
    font-size: 1.1rem;
    margin: 24px 0 8px;
    color: var(--text-primary);
}

.page-wrap p,
.page-wrap li {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: 14px;
}

.page-wrap ul,
.page-wrap ol {
    padding-left: 22px;
    margin-bottom: 14px;
}

.page-wrap a.inline {
    color: var(--accent-color);
}

.page-wrap a.inline:hover {
    text-decoration: underline;
}

.lead {
    font-size: 1.15rem !important;
    color: var(--text-primary) !important;
}

/* Simple footer link row reused across pages */
footer .footer-links a {
    color: var(--text-secondary);
    margin: 0 10px;
    transition: color 0.3s ease;
}

footer .footer-links a:hover {
    color: var(--accent-color);
}

/* ── Content polish: animated headings + section entrance ──── */
.page-wrap h2 {
    position: relative;
    padding-left: 18px;
}

.page-wrap h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 4px;
    border-radius: 999px;
    background: var(--accent-gradient);
    box-shadow: 0 0 12px -2px rgba(167, 119, 227, 0.7);
}

.page-wrap h1,
.page-wrap .updated,
.page-wrap .lead,
.page-wrap h2,
.page-wrap > p,
.page-wrap > ul {
    animation: policyFadeUp 0.7s cubic-bezier(.16, 1, .3, 1) both;
}

.page-wrap .updated { animation-delay: .05s; }
.page-wrap .lead { animation-delay: .1s; }
.page-wrap h2 { animation-delay: .12s; }

@keyframes policyFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-wrap ul li {
    position: relative;
    list-style: none;
    padding-left: 26px;
}

.page-wrap ul {
    padding-left: 4px;
}

.page-wrap ul li::before {
    content: "\f111";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.45rem;
    color: var(--accent-color);
    position: absolute;
    left: 6px;
    top: 0.62em;
}

@media (prefers-reduced-motion: reduce) {
    .page-wrap h1, .page-wrap .updated, .page-wrap .lead,
    .page-wrap h2, .page-wrap > p, .page-wrap > ul { animation: none; }
}

/* ── Public Discover grid ───────────────────────────────────── */
.discover-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 130px 5% 100px;
    padding-top: calc(130px + var(--safe-top));   /* see NAVBAR CLEARANCE at top */
}

.discover-head {
    text-align: center;
    margin-bottom: 40px;
}

.discover-head h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 12px;
}

.discover-head p {
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.7;
}

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.char-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
}

.char-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-color);
}

.char-card img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    background: #18181b;
}

.char-card .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.char-card h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
}

.char-card .tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1;
}

.char-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.char-card .tag {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(167, 119, 227, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(167, 119, 227, 0.25);
}

/* ── Character profile page ─────────────────────────────────── */
.profile-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 130px 5% 100px;
    padding-top: calc(130px + var(--safe-top));   /* see NAVBAR CLEARANCE at top */
}

.profile-hero {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 40px;
}

.profile-hero img {
    width: 260px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid var(--border-color);
}

.profile-hero .meta {
    flex: 1;
    min-width: 260px;
}

.profile-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    margin-bottom: 8px;
}

.profile-hero .tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.profile-section {
    margin-bottom: 28px;
}

.profile-section h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.profile-section p {
    color: var(--text-secondary);
    line-height: 1.75;
}

/* ── Sectioned biography (server-rendered /character page) ──
   Mirrors the .lore-* rules in styles.css so the crawled page and the in-app
   profile show the same structure. Markup comes from formatLoreSections()
   in lore-format.js. Kept as a separate copy because this page loads
   pages.css only — styles.css is the dashboard bundle. */
.lore-body {
    white-space: pre-wrap;
}

.lore-body .lore-para {
    color: var(--text-secondary);
    line-height: 1.75;
    margin: 0 0 14px;
}

.lore-body .lore-para:last-child {
    margin-bottom: 0;
}

.lore-rule {
    position: relative;
    height: 1px;
    width: min(180px, 55%);
    margin: 30px auto 22px;
    white-space: normal;
    background: linear-gradient(90deg,
            transparent, rgba(110, 142, 251, 0.55), transparent);
}

.lore-rule::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    transform: translate(-50%, -50%) rotate(45deg);
    background: rgba(167, 119, 227, 0.9);
}

.lore-body > .lore-rule:first-child {
    margin-top: 4px;
}

.lore-head {
    margin: 0 0 16px;
    text-align: center;
    white-space: normal;
    font-family: var(--font-heading);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.lore-head.is-rose { color: #ff5c8a; }
.lore-head.is-amber { color: #f0932b; }
.lore-head.is-violet { color: #a777e3; }
.lore-head.is-cyan { color: #34d8d8; }

.lore-sub {
    margin: 18px 0 8px;
    padding: 7px 14px;
    white-space: normal;
    border-left: 3px solid #6e8efb;
    border-radius: 0 8px 8px 0;
    background: rgba(110, 142, 251, 0.08);
    color: #34d8d8;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--accent-color);
    font-weight: 500;
}

/* ── Responsive (consumes shared tokens.css scales) ──────────────
   Canonical anchors: --bp-md 768px (phone/tablet), --bp-sm 480px.
   Public/legal pages had NO width breakpoints before this block. */

/* Tablet and below: trim the oversized fixed top/bottom padding so
   content isn't pushed far down the viewport, and tighten grid gaps. */
@media (max-width: 768px) {
    .page-wrap {
        padding: 104px var(--space-5) var(--space-8);
        padding-top: calc(104px + var(--safe-top));   /* see NAVBAR CLEARANCE at top */
    }

    .discover-wrap,
    .profile-wrap {
        padding: 96px var(--space-4) var(--space-8);
        padding-top: calc(96px + var(--safe-top));    /* see NAVBAR CLEARANCE at top */
    }

    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 44vw, 200px), 1fr));
        gap: var(--space-4);
    }

    .profile-hero {
        gap: var(--space-5);
    }

    /* Hero image no longer forces a fixed 260px next to the meta column;
       meta can shrink below 260 so it never overflows a narrow screen. */
    .profile-hero img {
        width: min(220px, 60vw);
    }

    .profile-hero .meta {
        min-width: 0;
        flex-basis: 100%;
    }
}

/* Small phones: single readable column, smaller lead text. */
@media (max-width: 480px) {
    .page-wrap {
        padding: 92px var(--space-4) var(--space-7);
        padding-top: calc(92px + var(--safe-top));    /* see NAVBAR CLEARANCE at top */
    }

    .char-grid {
        grid-template-columns: 1fr;
    }

    .lead {
        font-size: 1.05rem !important;
    }

    .discover-head,
    .profile-hero {
        text-align: left;
    }
}

/* ── Blog / Guides ──────────────────────────────────────────────
   Listing grid for /blog and shared article furniture. Reuses the
   same tokens as the rest of pages.css; no new colour or font. */
.blog-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 140px 6% 100px;
    padding-top: calc(140px + var(--safe-top));   /* see NAVBAR CLEARANCE at top */
}

.blog-head {
    text-align: center;
    margin-bottom: 48px;
}

.blog-head h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.blog-head p {
    color: var(--text-secondary);
    max-width: 620px;
    margin: 0 auto;
    line-height: 1.7;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}

/* Each card is the whole clickable link — no nested anchors. */
a.blog-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 26px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

a.blog-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-color);
    box-shadow: 0 14px 34px -18px rgba(167, 119, 227, 0.55);
}

/* Keyboard focus: a clear ring so tab-users can see where they are.
   :focus-visible keeps it off mouse clicks. */
a.blog-card:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
    border-color: var(--accent-color);
}

.blog-card .blog-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-color);
    font-weight: 600;
}

.blog-card h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
}

.blog-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    flex: 1;
}

.blog-card .blog-more {
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 4px;
    transition: transform 0.25s ease;
}

/* Nudge the "Read the guide →" label on card hover/focus for affordance. */
a.blog-card:hover .blog-more,
a.blog-card:focus-visible .blog-more {
    transform: translateX(4px);
}

/* Article furniture that sits inside .page-wrap on each guide. */
.page-wrap .back-to-blog {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-decoration: none;
    border-radius: 6px;
}

.page-wrap .back-to-blog:hover {
    text-decoration: underline;
}

.page-wrap .back-to-blog:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

/* Inline code / macro chips like {{char}} used in the RP + character guides. */
.page-wrap code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: rgba(167, 119, 227, 0.12);
    border: 1px solid rgba(167, 119, 227, 0.22);
    color: var(--text-primary);
    padding: 1px 6px;
    border-radius: 6px;
}

/* Do / Don't example pair for the roleplay guide. */
.rp-example {
    border-radius: 12px;
    padding: 14px 16px 14px 44px;
    margin: 10px 0 16px;
    position: relative;
    line-height: 1.6;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.rp-example::before {
    position: absolute;
    left: 16px;
    top: 14px;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.rp-example.good {
    border-color: rgba(var(--color-ok-rgb), 0.4);
}

.rp-example.good::before {
    content: "\f00c";
    color: var(--color-ok);
}

.rp-example.bad {
    border-color: var(--color-danger-border);
}

.rp-example.bad::before {
    content: "\f00d";
    color: var(--color-danger);
}

/* FAQ question blocks reuse h2/h3 rhythm but tighten the answer spacing. */
.faq-q {
    margin-top: 32px;
}

@media (max-width: 768px) {
    .blog-wrap {
        padding: 104px var(--space-4) var(--space-8);
        padding-top: calc(104px + var(--safe-top));   /* see NAVBAR CLEARANCE at top */
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
}

/* Honour reduced-motion: drop card lift + arrow nudge, keep focus/hover
   colour so state stays visible without movement. */
@media (prefers-reduced-motion: reduce) {
    a.blog-card,
    .blog-card .blog-more {
        transition: none;
    }

    a.blog-card:hover {
        transform: none;
    }

    a.blog-card:hover .blog-more,
    a.blog-card:focus-visible .blog-more {
        transform: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   TOUCH INPUT — public content pages
   Fourth sibling of the TOUCH INPUT blocks in landing.css, footer.css and
   styles.css; see the landing.css header for why this is keyed on pointer
   capability rather than a width breakpoint, and why both `hover: none` and
   `pointer: coarse` are listed. Keep all four in step.
   ═══════════════════════════════════════════════════════════════════ */

@media (hover: none), (pointer: coarse) {

    /* A tap leaves :hover applied until the next tap lands elsewhere, so each of
       these lifts would freeze mid-air on the card that was just tapped. Only
       `transform` is reset -- the border and colour changes are fine frozen, and
       on a card that navigates they read as "this is the one you picked".
       The reduced-motion block above already says this for .blog-card; a phone
       with motion enabled needs it too, hence the repeat. */
    .char-card:hover,
    a.blog-card:hover,
    a.blog-card:hover .blog-more {
        transform: none;
    }

    /* Tap targets, measured on an API 36 device against --tap-min: 44px.
       Both of these are the page's way back -- "← Back to LoreLoom" on the legal
       and about pages (also on the server-rendered character profiles) and
       "← All guides" on each blog article -- and both were text-height only:
       24px and 21px. inline-flex is what gives min-height something to centre
       against on a box that was inline-block; width stays intrinsic so the
       underline on tap still matches the label.

       Not raised: the `a.inline` links inside paragraph copy, at 19px. WCAG 2.5.8
       exempts a target inline in a sentence, and the class marks them as
       deliberately part of the prose. */
    .back-link,
    .page-wrap .back-to-blog {
        display: inline-flex;
        align-items: center;
        min-height: var(--tap-min, 44px);
    }

    /* The one `a.inline` that IS raised, and it has to be marked by class rather than
       found by structure. This rule read `p > a.inline:only-child` until 2026-08-21, on
       the stated reasoning that ":only-child means the link is the entire paragraph, so
       there is no sentence around it". That is not what :only-child tests -- it counts
       ELEMENT children and ignores text nodes, so
       `<p>Reach us through our <a class="inline">Contact</a> page.</p>` matched too.
       Across the 14 reading pages: 22 paragraphs matched while carrying real sentence
       text, against the 1 that is genuinely a bare link.

       Those 22 were correct as they stood -- :689 above exempts them under WCAG 2.5.8 --
       and the misfire damaged them. inline-flex makes the link a flex container, so a
       multi-word label can no longer wrap: at 320dp one became a single unbreakable
       288px box sitting exactly on the column edge, and min-height inflated its line
       box to 44-56px in the middle of 19px prose.

       CSS cannot ask "does this element contain no text", so the intent is declared
       instead. `standalone-link` means the link is the whole block, so no sentence
       surrounds it to be exempt inside -- today only the "Next: every character field,
       explained →" link at the foot of blog-how-to-roleplay.html, measured 303x19.

       The structural check did not go away, it moved to where it can be exact:
       build-www.mjs fails the build on a text-free block wrapping an `a.inline` that
       lacks this class, and on this class appearing inside prose. So the next person to
       end a guide with `<p><a class="inline">` gets told, rather than silently getting
       the wrong target size -- which is what the old selector was reaching for. */
    .page-wrap a.inline.standalone-link {
        display: inline-flex;
        align-items: center;
        min-height: var(--tap-min, 44px);
    }
}
