/*
 * ReadPals layer over Ghost Source (loaded after built/screen.css).
 *
 * Tokens are copied from products/reading/marketing/src/app/globals.css; nav,
 * footer and prose mirror NavBar.tsx, Footer.tsx and Prose.tsx. No webfonts:
 * the marketing site uses the system rounded stack, and so does the blog.
 *
 * Readability deviations from the marketing tokens (WCAG AA 4.5:1 on cream):
 *   - article body text uses --rp-ink (12.9:1) instead of --rp-ink-soft (6.1:1);
 *   - secondary text uses --rp-ink-soft, never --rp-ink-muted (3.2:1);
 *   - links use --rp-link #167268 (5.4:1), a deeper --rp-teal-deep (3.8:1);
 *   - --rp-teal-wash is the site eyebrow wash (#D8F3EF) and --rp-sunny-soft the
 *     CTA card tint; only --rp-link / --rp-ink text sits on them;
 *   - the coral pill uses --rp-coral-ink #BF3B2B behind white text (5.4:1)
 *     instead of --rp-coral (2.8:1).
 */
:root {
    --rp-cream: #fff7ec;
    --rp-cream-deep: #fdecd3;
    --rp-surface: #ffffff;
    --rp-surface-alt: #fff1e0;
    --rp-coral: #ff6b5e;
    --rp-coral-deep: #e8503f;
    --rp-coral-ink: #bf3b2b;
    --rp-teal: #2fb6a6;
    --rp-teal-deep: #1f8e82;
    --rp-link: #167268;
    --rp-teal-wash: #d8f3ef;
    --rp-sunny-soft: #ffe3b8;
    --rp-sunny: #ffc53d;
    --rp-berry: #b85c8a;
    --rp-sky: #6ec1e4;
    --rp-ink: #3b2a20;
    --rp-ink-soft: #6e5a4c;
    --rp-ink-muted: #9c8878;
    --rp-border: #f0dfc8;
    --rp-radius-sm: 12px;
    --rp-radius: 20px;
    --rp-radius-lg: 28px;
    --rp-radius-pill: 9999px;
    --rp-shadow-soft: 0 6px 20px rgba(232, 80, 63, 0.10);
    --rp-shadow-card: 0 10px 30px rgba(59, 42, 32, 0.08);
    --rp-shadow-lift: 0 16px 40px rgba(59, 42, 32, 0.14);
    --rp-font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", system-ui,
        -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Source's own variables, remapped onto the ReadPals tokens. */
    --background-color: var(--rp-cream);
    --font-sans: var(--rp-font);
    --gh-font-heading: var(--rp-font);
    --gh-font-body: var(--rp-font);
    --color-darker-gray: var(--rp-ink);
    --color-primary-text: var(--rp-ink);
    --color-secondary-text: var(--rp-ink-soft);
    --color-border: var(--rp-border);
    --color-dark-border: var(--rp-ink-soft);
    --color-lighter-gray: var(--rp-surface-alt);
    --container-width: 1080px;
    --content-width: 720px;
}

body {
    background: var(--rp-cream);
    color: var(--rp-ink);
    font-family: var(--rp-font);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--rp-font);
    color: var(--rp-ink);
    letter-spacing: -0.02em;
}

a:hover {
    opacity: 1;
}

:focus-visible {
    outline: 3px solid var(--rp-teal);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Buttons: the site's chunky coral pill. */
.rp-btn,
.gh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: 2px solid transparent;
    border-radius: var(--rp-radius-pill);
    background: var(--rp-coral-ink);
    color: #fff;
    box-shadow: var(--rp-shadow-soft);
    font-family: var(--rp-font);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.55;
    letter-spacing: normal;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.rp-btn:hover,
.gh-button:hover {
    opacity: 1;
    background: #9f2f22;
    transform: translateY(-1px);
}

/* ---- Nav (NavBar.tsx) --------------------------------------------------- */
.rp-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 247, 236, 0.86);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--rp-border);
}

.rp-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1080px;
    height: 64px;
    margin: 0 auto;
    padding: 0 24px;
}

.rp-nav-logo {
    display: flex;
    align-items: center;
}

.rp-nav-links {
    display: flex;
    align-items: center;
    gap: 26px;
}

.rp-nav-links a {
    color: var(--rp-ink-soft);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

.rp-nav-links a:hover,
.rp-nav-links a[aria-current="page"] {
    color: var(--rp-ink);
}

@media (max-width: 860px) {
    .rp-nav-links { display: none; }
}

/* ---- Home hero ---------------------------------------------------------- */
.rp-hero {
    max-width: 760px;
    margin: 0 auto;
    padding: clamp(40px, 7vw, 72px) 24px 8px;
    text-align: center;
}

.rp-eyebrow {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--rp-radius-pill);
    background: var(--rp-cream-deep);
    color: var(--rp-coral-ink);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rp-hero-title {
    margin: 18px 0 0;
    font-size: clamp(30px, 5vw, 44px);
    font-weight: 800;
    line-height: 1.1;
}

.rp-hero-lede {
    margin: 16px auto 0;
    max-width: 620px;
    color: var(--rp-ink-soft);
    font-size: 19px;
    line-height: 1.6;
}

/* ---- Post list ---------------------------------------------------------- */
.gh-container-title {
    color: var(--rp-ink-soft);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-color: var(--rp-border);
}

.gh-container.is-list .gh-card + .gh-card::before {
    background-color: var(--rp-border);
}

.gh-card-title {
    color: var(--rp-ink);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.gh-card-link:hover .gh-card-title {
    opacity: 1;
    color: var(--rp-link);
}

.gh-card-excerpt {
    color: var(--rp-ink-soft);
    font-size: 16.5px;
    line-height: 1.6;
}

.gh-card-meta,
.gh-article-meta-content,
.gh-article-author-name {
    color: var(--rp-ink-soft);
}

.gh-card-image,
.gh-article-image img {
    border-radius: var(--rp-radius);
    overflow: hidden;
}

/* Share opens Ghost Portal, which the blog runs without (no members). */
.gh-button-share {
    display: none;
}

/* ---- Article hero ------------------------------------------------------- */
.post-template .gh-article {
    padding-top: 0;
}

.gh-article-header {
    margin: 0 0 8px;
    padding: clamp(40px, 6vw, 72px) 0 36px;
    background:
        radial-gradient(900px 420px at 8% -20%, rgba(255, 197, 61, 0.20), transparent 60%),
        radial-gradient(800px 420px at 100% -10%, rgba(47, 182, 166, 0.14), transparent 55%),
        var(--rp-cream);
    border-bottom: 1px solid var(--rp-border);
}

.gh-article-tag {
    display: inline-block;
    justify-self: start;
    width: fit-content;
    margin-bottom: 18px;
    padding: 6px 14px;
    border-radius: var(--rp-radius-pill);
    background: var(--rp-cream-deep);
    color: var(--rp-coral-ink) !important;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gh-article-title {
    font-size: clamp(32px, 5vw, 46px);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.gh-article-excerpt {
    margin-top: 16px;
    color: var(--rp-ink-soft);
    font-size: 19px;
    line-height: 1.6;
    letter-spacing: normal;
}

.rp-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin: 20px 0 0;
    color: var(--rp-ink-soft);
    font-size: 15px;
    font-weight: 700;
}

.rp-article-meta a {
    color: inherit;
}

/* ---- Article body (Prose.tsx + Section/HowItWorks/CTA patterns) --------- */
.gh-content {
    --rp-flow: 1.1em;
    color: var(--rp-ink);
    font-size: 18px;
    line-height: 1.7;
    letter-spacing: normal;
}

.gh-content > * + *,
.rp-section > * + * {
    margin-top: var(--rp-flow);
    margin-bottom: 0;
}

.gh-content > :first-child {
    margin-top: 40px;
}

/* A heading pulls its first paragraph close; the section gap goes above. */
.gh-content :is(h2, h3) + * {
    margin-top: 0.55em;
}

.gh-content h2 {
    font-size: clamp(26px, 3.4vw, 31px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.gh-content h3 {
    margin-top: 1.7em;
    color: var(--rp-coral-ink);
    font-size: 21px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* Every H2 opens a section (partials/readpals/sections-script.hbs). Plain sections get a
   generous gap and a soft rule, like the site's stacked Section bands. */
.gh-content > .rp-section {
    margin-top: 3em;
}

.gh-content > .rp-section:not(.rp-step, .rp-cta) {
    padding-top: 2.4em;
    border-top: 2px solid var(--rp-border);
}

.gh-content > .rp-toc + .rp-section,
.gh-content > .rp-section:first-child {
    border-top: 0;
    padding-top: 0;
}

/* Without the script, H2s still get the section gap. */
.gh-content > h2:not(:first-child) {
    margin-top: 2.6em;
}

/* Steps: numbered cards, like HowItWorks. */
.rp-step {
    padding: 28px clamp(20px, 4vw, 36px) 32px;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-lg);
    background: var(--rp-cream-deep);
    box-shadow: var(--rp-shadow-card);
}

.gh-content > .rp-step + .rp-step {
    margin-top: 24px;
}

.rp-step h2 {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 16px;
    align-items: center;
}

.rp-step-num {
    grid-row: span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--rp-coral-ink);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: var(--rp-shadow-soft);
}

.rp-step-label {
    color: var(--rp-coral-ink);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
}

.rp-step-title {
    font-size: clamp(22px, 3vw, 27px);
    line-height: 1.25;
}

.rp-step h2 + * {
    margin-top: 16px;
}

/* Lists: roomy, with brand-colour markers. */
.gh-content :is(ul, ol) {
    padding-left: 1.5em;
}

.gh-content li {
    padding-left: 0.3em;
}

.gh-content li + li {
    margin-top: 0.6em;
}

.gh-content ul > li::marker {
    color: var(--rp-coral-deep);
    font-size: 1.15em;
}

.gh-content ol > li::marker {
    color: var(--rp-coral-ink);
    font-weight: 800;
}

/* Bold lead-ins read as mini-headings. */
.gh-content .rp-lead > strong:first-child {
    display: block;
    margin-bottom: 2px;
    color: var(--rp-ink);
    font-weight: 800;
}

.gh-content a,
.gh-content a:visited {
    color: var(--rp-link);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(47, 182, 166, 0.55);
}

.gh-content a:hover {
    text-decoration-color: currentColor;
}

.gh-content strong {
    color: var(--rp-ink);
}

.gh-content blockquote:not([class]) {
    padding: 16px 22px;
    border-left: 4px solid var(--rp-sunny);
    border-radius: 0 var(--rp-radius-sm) var(--rp-radius-sm) 0;
    background: var(--rp-surface-alt);
    color: var(--rp-ink);
    font-style: normal;
}

.gh-content :not(pre) > code {
    padding: 1px 5px;
    border: 1px solid var(--rp-border);
    border-radius: 6px;
    background: var(--rp-surface-alt);
    color: var(--rp-ink);
    font-size: 0.92em;
}

.gh-content hr {
    border-color: var(--rp-border);
}

/* Table of contents for long posts. */
.rp-toc {
    padding: 22px 26px 24px;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    background: var(--rp-surface);
    box-shadow: var(--rp-shadow-card);
}

.rp-toc-title {
    display: inline-block;
    margin: 0 0 12px;
    padding: 5px 12px;
    border-radius: var(--rp-radius-pill);
    background: var(--rp-teal-wash);
    color: var(--rp-link);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rp-toc ul {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 16px;
    line-height: 1.45;
}

.gh-content .rp-toc li {
    padding-left: 0;
}

.rp-toc li + li {
    margin-top: 7px;
}

.rp-toc li.rp-toc-step {
    padding-left: 14px;
    border-left: 3px solid var(--rp-cream-deep);
}

.gh-content .rp-toc a,
.gh-content .rp-toc a:visited {
    color: var(--rp-ink);
    font-weight: 600;
    text-decoration: none;
}

.gh-content .rp-toc a:hover {
    color: var(--rp-link);
    text-decoration: underline;
}

.gh-content [id] {
    scroll-margin-top: 84px;
}

/* Closing CTA card (the site's CTA band, in AA-safe colours). */
.rp-cta {
    padding: clamp(28px, 5vw, 44px);
    border: 2px solid var(--rp-sunny);
    border-radius: var(--rp-radius-lg);
    background: linear-gradient(135deg, var(--rp-surface-alt) 0%, var(--rp-sunny-soft) 100%);
    box-shadow: var(--rp-shadow-lift);
}

.rp-cta h2 {
    font-size: clamp(26px, 3.6vw, 32px);
}

.gh-content .rp-cta .rp-cta-actions {
    margin-top: 20px;
}

.gh-content .rp-cta .rp-btn,
.gh-content .rp-cta .rp-btn:visited {
    color: #fff;
    text-decoration: none;
}

.rp-btn-lg {
    padding: 15px 30px;
    font-size: 18px;
}

.gh-read-next,
.gh-comments {
    background: var(--rp-cream-deep);
}

/* ---- Footer (Footer.tsx) ------------------------------------------------ */
.rp-footer {
    margin-top: clamp(56px, 8vw, 96px);
    padding: 56px 24px 40px;
    background: var(--rp-surface-alt);
    border-top: 1px solid var(--rp-border);
}

.rp-footer-inner {
    max-width: 1080px;
    margin: 0 auto;
}

.rp-footer-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(4, 1fr);
    gap: 40px;
    align-items: start;
}

.rp-footer-brand p {
    max-width: 280px;
    margin: 14px 0 0;
    color: var(--rp-ink-soft);
    font-size: 15px;
    line-height: 1.55;
}

.rp-footer-grid h2 {
    margin: 0 0 14px;
    color: var(--rp-ink-soft);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.rp-footer-grid ul {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rp-footer .rp-footer-grid a {
    color: var(--rp-ink-soft);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.rp-footer .rp-footer-grid a:hover {
    color: var(--rp-ink);
}

.rp-footer .rp-footer-grid .rp-footer-email {
    display: inline-block;
    margin-top: 14px;
    color: var(--rp-link);
    font-weight: 700;
}

.rp-footer-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-top: 44px;
    padding-top: 24px;
    border-top: 1px solid var(--rp-border);
    color: var(--rp-ink-soft);
    font-size: 14px;
}

@media (max-width: 960px) {
    .rp-footer-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 720px) {
    .rp-footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- Guide links after a post (partials/readpals/guide-links.hbs) -------- */
.rp-guide-links {
    margin-top: 48px;
    padding: 24px 26px;
    background: var(--rp-cream-deep);
    border-radius: var(--rp-radius);
}

.rp-guide-links-title {
    margin: 0 0 8px;
    color: var(--rp-ink);
    font-size: 21px;
}

.rp-guide-links-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Each link is a full-width row at least 44px tall, so it is an easy tap. */
.rp-guide-links-list a {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--rp-link);
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
}

.rp-guide-links-list a::after {
    content: "\2192";
    margin-left: 8px;
}

.rp-guide-links-list a:hover {
    text-decoration: underline;
}
