/* ==========================================================================
   Form Rehab theme — inspired by Basho
   ========================================================================== */

:root {
    --color-text: #15171A;
    --color-text-muted: #6B7280;
    --color-border: #E5E7EB;
    --color-bg: #FFFFFF;
    --color-bg-soft: #F7F7F8;
    --accent: var(--ghost-accent-color, #9C27B0);
    --radius: 14px;
    --container-width: 1120px;
    --container-narrow: 720px;
    --container-wide: 960px;
}

html[data-theme="dark"] {
    --color-text: #F2F2F3;
    --color-text-muted: #9CA3AF;
    --color-border: #2D2F34;
    --color-bg: #101113;
    --color-bg-soft: #17181B;
}
html[data-theme="dark"] .tag-pill { background: rgba(255,255,255,0.12); color: #fff; }
html[data-theme="dark"] .post-card__image--placeholder { background: linear-gradient(135deg, #1c1d20, #101113); }
html[data-theme="dark"] .footer-subscribe input,
html[data-theme="dark"] .hero__subscribe input { background: var(--color-bg); color: var(--color-text); }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    font-size: 17px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}
.container--narrow { max-width: var(--container-narrow); }
.container--wide { max-width: var(--container-wide); }

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 12px 22px;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
}
.btn--small { padding: 8px 16px; font-size: 14px; }
.btn:hover { opacity: 0.92; }

/* ---- Header ---- */
.site-header {
    border-bottom: 1px solid var(--color-border);
    padding: 20px 0;
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.site-logo { display: flex; align-items: center; gap: 10px; }
.site-logo img { height: 34px; width: auto; }
.site-logo__text { font-size: 20px; font-weight: 800; }

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 28px;
    margin: 0;
    padding: 0;
}
.site-nav a { font-weight: 600; font-size: 15px; }
.site-nav a:hover { color: var(--accent); }

.site-header__actions { display: flex; align-items: center; gap: 16px; }
.site-header__signin { font-weight: 600; font-size: 15px; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}
.nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--color-text);
    display: block;
    border-radius: 2px;
}

/* ---- Icon buttons (search, theme toggle, social) ---- */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s;
}
.icon-btn:hover { background: var(--color-bg-soft); }

.theme-toggle__moon { display: none; }
html[data-theme="dark"] .theme-toggle__sun { display: none; }
html[data-theme="dark"] .theme-toggle__moon { display: block; }

.social-icons {
    display: flex;
    gap: 4px;
    margin-top: 16px;
}
.social-icons .icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--color-border);
}

/* ---- Hero ---- */
.hero {
    padding: 72px 0 56px;
    text-align: center;
    background: linear-gradient(180deg, var(--color-bg-soft), var(--color-bg));
}
.hero__title {
    font-size: 42px;
    max-width: 720px;
    margin: 0 auto 16px;
}
.hero__subtitle {
    color: var(--color-text-muted);
    font-size: 18px;
    max-width: 560px;
    margin: 0 auto 28px;
}
.hero__subscribe {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 440px;
    margin: 0 auto;
}
.hero__subscribe input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-size: 15px;
}
.hero__subscribe-note {
    color: var(--color-text-muted);
    font-size: 13px;
    margin-top: 10px;
}

/* ---- Section heading ---- */
.section-heading {
    margin: 56px 0 24px;
}
.section-heading h2 {
    font-size: 24px;
    margin: 0;
}

/* ---- Post feed / cards ---- */
.post-feed {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}
.post-feed--compact { grid-template-columns: repeat(3, 1fr); }

.post-card__image-link { position: relative; display: block; }
.post-card__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--color-bg-soft);
}
.post-card__image--placeholder { background: linear-gradient(135deg, #eee, #f7f7f8); }

.post-card__tags {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 6px;
}

.tag-pill {
    background: rgba(255,255,255,0.92);
    color: var(--color-text);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 5px 10px;
    border-radius: 999px;
}
.tag-pill--large { font-size: 13px; padding: 6px 14px; }

.post-card__body { padding-top: 16px; }

.post-card__authors { display: flex; margin-bottom: 10px; }
.author-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--color-bg-soft);
    background-size: cover;
    background-position: center;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--color-border);
    display: inline-block;
}
.post-card__authors .author-avatar + .author-avatar { margin-left: -10px; }
.author-avatar--large { width: 56px; height: 56px; }

.post-card__title {
    font-size: 20px;
    margin: 0 0 8px;
}
.post-card__title a:hover { color: var(--accent); }

.post-card__excerpt {
    color: var(--color-text-muted);
    font-size: 15px;
    margin: 0;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 48px 0 64px;
}
.pagination a, .pagination span {
    font-weight: 600;
    padding: 10px 20px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
}

/* ---- Single post ---- */
.post-full__header {
    padding: 56px 0 32px;
    text-align: center;
}
.post-full__tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}
.post-full__title {
    font-size: 40px;
    margin: 0 0 16px;
}
.post-full__excerpt {
    font-size: 19px;
    color: var(--color-text-muted);
    margin: 0 0 24px;
}
.post-full__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.post-full__meta-text {
    color: var(--color-text-muted);
    font-size: 14px;
}
.post-full__meta-text a { font-weight: 700; color: var(--color-text); }

.post-full__feature-image { margin: 0 auto 40px; }
.post-full__feature-image img { border-radius: var(--radius); width: 100%; }

.post-full__content { margin: 0 auto; }
.gh-content { font-size: 18px; }
.gh-content > * + * { margin-top: 24px; }
.gh-content h2 { font-size: 28px; margin-top: 48px; }
.gh-content h3 { font-size: 22px; margin-top: 36px; }
.gh-content img { border-radius: var(--radius); }

.kg-width-wide {
    width: 100%;
    max-width: calc(var(--container-width) - 48px);
    margin-left: 50%;
    transform: translateX(-50%);
}
.kg-width-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}
.kg-width-full img { border-radius: 0; }
.gh-content blockquote {
    border-left: 4px solid var(--accent);
    margin: 32px 0;
    padding-left: 20px;
    font-style: italic;
    color: var(--color-text-muted);
}

/* Ghost's native Button card */
.gh-content .kg-button-card { display: flex; justify-content: center; margin: 32px 0; }
.gh-content .kg-btn {
    background: var(--accent);
    color: #fff !important;
    padding: 14px 28px;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none !important;
    display: inline-block;
}
.gh-content .kg-btn:hover { opacity: 0.92; }

.post-full__disclosure {
    margin: 40px auto 0;
    padding: 16px 20px;
    background: var(--color-bg-soft);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--color-text-muted);
}

.author-card {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin: 48px auto 0;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}
.author-card__body h4 { margin: 0 0 6px; font-size: 17px; }
.author-card__body p { margin: 0; color: var(--color-text-muted); font-size: 15px; }

.post-newsletter-cta {
    margin: 40px auto 0;
    padding: 32px;
    background: var(--color-bg-soft);
    border-radius: var(--radius);
    text-align: center;
}
.post-newsletter-cta__text { font-size: 17px; font-weight: 600; margin: 0 0 16px; }
.post-newsletter-cta__form {
    display: flex;
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
}
.post-newsletter-cta__form input {
    flex: 1;
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-size: 15px;
}

/* ---- Table of contents ---- */
.post-toc {
    display: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 32px;
    background: var(--color-bg-soft);
}
.post-toc--visible { display: block; }
.post-toc__label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin: 0 0 10px;
}
.post-toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: toc;
}
.post-toc li {
    counter-increment: toc;
    margin: 6px 0;
}
.post-toc li::before {
    content: counter(toc) ".";
    color: var(--accent);
    font-weight: 700;
    margin-right: 8px;
}
.post-toc li.post-toc__sub { margin-left: 20px; font-size: 14px; }
.post-toc li.post-toc__sub::before { content: "\2013"; }
.post-toc a { font-size: 15px; }
.post-toc a:hover { color: var(--accent); }

/* ---- Previous / Next post nav ---- */
.post-adjacent {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 48px auto 0;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}
.post-adjacent__link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.post-adjacent__link:hover { border-color: var(--accent); }
.post-adjacent__link--next { text-align: right; align-items: flex-end; grid-column: 2; }
.post-adjacent__label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}
.post-adjacent__title { font-size: 15px; font-weight: 600; }

@media (max-width: 600px) {
    .post-adjacent { grid-template-columns: 1fr; }
    .post-adjacent__link--next { grid-column: 1; text-align: left; align-items: flex-start; }
}

/* ---- Archive headers (tag / author) ---- */
.archive-header {
    text-align: center;
    padding: 64px 0 48px;
    background: var(--color-bg-soft);
}
.archive-header--image {
    background-size: cover;
    background-position: center;
    position: relative;
    padding: 96px 0 64px;
}
.archive-header--image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}
.archive-header--image .container {
    position: relative;
    z-index: 1;
}
.archive-header--image .archive-header__title,
.archive-header--image .archive-header__description {
    color: #fff;
}
.archive-header--align-left { text-align: left; }
.archive-header--align-right { text-align: right; }
.archive-header--author .author-avatar--large { margin: 0 auto 16px; }
.archive-header__title { font-size: 34px; margin: 0 0 12px; }
.archive-header__description { color: var(--color-text-muted); font-size: 17px; margin: 0; }

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--color-border);
    margin-top: 80px;
    padding: 56px 0 24px;
    background: var(--color-bg-soft);
}
.site-footer__inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1.4fr;
    gap: 40px;
}
.site-footer__brand { display: flex; flex-direction: column; align-items: flex-start; }
.site-footer__brand p { color: var(--color-text-muted); font-size: 15px; margin-top: 12px; max-width: 320px; }
.site-footer__logo { height: 30px; margin-bottom: 8px; }

.site-footer__col h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 16px; }
.site-footer__col ul { list-style: none; margin: 0; padding: 0; }
.site-footer__col li { margin-bottom: 10px; }
.site-footer__col a { color: var(--color-text-muted); }
.site-footer__col a:hover { color: var(--accent); }

.footer-subscribe { display: flex; gap: 8px; }
.footer-subscribe input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-size: 14px;
}
.footer-subscribe__note { color: var(--color-text-muted); font-size: 12px; margin-top: 10px; }

.site-footer__legal {
    display: flex;
    justify-content: space-between;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 13px;
    flex-wrap: wrap;
    gap: 12px;
}

/* ---- Brand pages ---- */
.brand-hero {
    background-color: var(--color-bg-soft);
    background-size: cover;
    background-position: center;
    padding: 96px 24px;
    text-align: center;
}
.brand-hero--image { padding: 140px 24px; }
.brand-hero__overlay {
    background: linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.35));
    margin: -96px -24px;
    padding: 96px 24px;
}
.brand-hero--image .brand-hero__overlay { margin: -140px -24px; padding: 140px 24px; }
.brand-hero--image .brand-hero__title,
.brand-hero--image .brand-hero__tagline { color: #fff; }

.brand-hero--align-left { text-align: left; }
.brand-hero--align-left .brand-hero__title,
.brand-hero--align-left .brand-hero__tagline { margin-left: 0; margin-right: auto; }
.brand-hero--align-right { text-align: right; }
.brand-hero--align-right .brand-hero__title,
.brand-hero--align-right .brand-hero__tagline { margin-left: auto; margin-right: 0; }

.brand-hero__title {
    font-size: clamp(28px, 4.2vw, 44px);
    margin: 0 auto 12px;
    max-width: 680px;
    line-height: 1.15;
}
.brand-hero__tagline { font-size: 19px; color: var(--color-text-muted); margin: 0; max-width: 560px; margin: 0 auto; }

.brand-page__content { padding: 56px 24px; }
.brand-page__content > * + * { margin-top: 24px; }

/* Product grid — paste this markup into an HTML card in the Ghost editor:
<div class="product-grid">
  <div class="product-card">
    <img src="IMAGE_URL" alt="Product name">
    <h3>Product name</h3>
    <p>One-line benefit or tagline.</p>
    <a href="AFFILIATE_LINK" class="btn">Shop now</a>
  </div>
  ... repeat product-card blocks ...
</div>
*/
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px;
    margin: 32px 0;
}
.product-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: calc(var(--radius) - 6px);
    margin-bottom: 16px;
}
.product-card h3 { font-size: 18px; margin: 0 0 6px; }
.product-card p { color: var(--color-text-muted); font-size: 14px; margin: 0 0 16px; }

@media (max-width: 600px) {
    .brand-hero, .brand-hero--image { padding: 64px 20px; }
    .brand-hero--image .brand-hero__overlay { margin: -64px -20px; padding: 64px 20px; }
    .brand-hero__title { font-size: 30px; }
}

/* ---- Featured hero (homepage cover style: Featured) ---- */
.featured-hero { position: relative; margin-bottom: 48px; }
.featured-hero__link { display: block; position: relative; color: #fff; }
.featured-hero__image {
    width: 100%;
    height: 480px;
    object-fit: cover;
    display: block;
}
.featured-hero__body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 48px 24px 40px;
    background: linear-gradient(0deg, rgba(0,0,0,0.75), rgba(0,0,0,0));
}
.featured-hero__title { font-size: 36px; color: #fff; margin: 12px 0; max-width: 720px; }
.featured-hero__excerpt { color: rgba(255,255,255,0.85); max-width: 560px; margin: 0 0 20px; }

@media (max-width: 600px) {
    .featured-hero__image { height: 320px; }
    .featured-hero__title { font-size: 26px; }
}

/* ---- Infinite scroll ---- */
.infinite-scroll-sentinel { height: 1px; }
.infinite-scroll-status {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    margin: 24px 0 48px;
}

/* ---- Error page ---- */
.error-page { text-align: center; padding: 100px 0; }
.error-page h1 { font-size: 72px; margin: 0; color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .post-feed, .post-feed--compact { grid-template-columns: repeat(2, 1fr); }
    .site-footer__inner { grid-template-columns: 1fr; }

    .site-header__inner { position: relative; flex-wrap: wrap; }
    .nav-toggle { display: flex; }

    .site-nav {
        display: none;
        width: 100%;
        order: 10;
        background: var(--color-bg);
        border-top: 1px solid var(--color-border);
        margin-top: 16px;
        padding-top: 16px;
    }
    .site-header.nav-open .site-nav { display: block; }
    .site-nav ul {
        flex-direction: column;
        gap: 4px;
    }
    .site-nav a {
        display: block;
        padding: 10px 0;
    }
}

@media (max-width: 600px) {
    .post-feed, .post-feed--compact { grid-template-columns: 1fr; }
    .hero__title { font-size: 30px; }
    .post-full__title { font-size: 28px; }
    .hero__subscribe { flex-direction: column; }
}

/* ---- Product grid (for recommendation/shop-style pages) ---- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 28px;
    margin: 32px 0;
}

.product-card {
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.15s, transform 0.15s;
}
.product-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.product-card__image-link { display: block; }
.product-card__image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--color-bg-soft);
    display: block;
}

.product-card__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.product-card__badge {
    align-self: flex-start;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 4px;
}

.product-card__title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.product-card__price {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin: 0;
}

.product-card__blurb {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.5;
}

.product-card__cta {
    margin-top: auto;
    padding-top: 10px;
}
.product-card__cta .btn {
    display: block;
    text-align: center;
    width: 100%;
}

/* Compact variant for tighter/narrower page layouts */
.product-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
}
.product-grid--compact .product-card__body { padding: 12px; }
