/* ==========================================================================
   Moondance — moonlight on manuscript
   Palette: space indigo, ink indigo, moonstone white, brass gold, silver-lavender
   Type: EB Garamond (display) · Source Serif 4 (body)
   ========================================================================== */

:root {
    --midnight: #251B3A;
    --midnight-soft: #34264F;
    --ink: #2E2438;
    --ink-muted: #6B5A6E;
    --moonstone: #F9F5EE;
    --paper: #FFFFFF;
    --gold: #CDA83E;
    --rose: #C4838E;
    --gold-bright: #E2C25C;
    --silver: #F9E9FF;
    --rose-light: #D2A3AB;
    --rose-deep: #93465A;
    --pearl: #F2ECE2;
    --hairline: rgba(46, 36, 56, 0.16);
    --hairline-dark: rgba(249, 233, 255, 0.22);

    --font-display: var(--gh-font-heading, "Cormorant Garamond", Georgia, serif);
    --font-body: var(--gh-font-body, "Source Serif 4", Georgia, serif);

    --measure: 68ch;
    --wide: 1120px;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

/* --- Reset & base ------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--moonstone);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: inherit; text-decoration-color: var(--rose); text-underline-offset: 3px; }
a:hover { color: var(--rose-deep); }

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 1px;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.12;
    margin: 0;
    letter-spacing: 0;
}

/* --- Buttons ------------------------------------------------------------ */

.button {
    display: inline-block;
    padding: 0.7em 1.5em;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 3px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.button:hover { background: rgba(35, 34, 58, 0.06); color: var(--ink); }

.button-primary {
    background: var(--pearl);
    border-color: var(--pearl);
    color: #2E2438;
}

.button-ink {
    background: var(--midnight);
    border-color: var(--midnight);
    color: var(--pearl);
}

.button-primary:hover,
.button-ink:hover {
    background: var(--rose-deep);
    border-color: var(--rose-deep);
    color: var(--pearl);
}

/* --- Header ------------------------------------------------------------- */

.site-header {
    background: #2E2247;
    color: var(--moonstone);
    border-bottom: 1px solid rgba(205, 168, 62, 0.4);
}

.site-header-inner {
    max-width: var(--wide);
    margin: 0 auto;
    padding: 1rem var(--gutter);
    display: flex;
    align-items: center;
    gap: 2rem;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--moonstone);
}

.brand-moon { width: 26px; height: 26px; color: var(--pearl); flex: none; }

.site-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    white-space: nowrap;
}

.site-nav { flex: 1; }

.site-nav .nav, .footer-col .nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.4rem;
}

.site-nav .nav a {
    color: var(--rose-light);
    text-decoration: none;
    font-size: 0.95rem;
}

.site-nav .nav a:hover,
.site-nav .nav .nav-current a { color: var(--moonstone); }

.site-nav .nav .nav-current a {
    border-bottom: 1px solid var(--pearl);
    padding-bottom: 2px;
}

.header-actions { display: flex; align-items: center; gap: 1rem; }

.site-header .button-book { color: #fff; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--moonstone);
    margin: 5px 0;
}

.mobile-nav {
    display: none;
    padding: 0.5rem var(--gutter) 1.5rem;
    border-top: 1px solid var(--hairline-dark);
}

.mobile-nav .nav {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.mobile-nav .nav li { margin: 0.75rem 0; }

.mobile-nav .nav a {
    color: var(--moonstone);
    text-decoration: none;
    font-size: 1.05rem;
}

/* --- Hero --------------------------------------------------------------- */

.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #140C17 0%, #1E1430 42%, #3B2547 76%, #5C3450 94%, #6E3E55 100%);
    color: var(--moonstone);
}

.hero-moon {
    position: absolute;
    top: -12%;
    right: -4%;
    width: clamp(260px, 32vw, 430px);
    height: auto;
    color: var(--pearl);
    opacity: 0.34;
    pointer-events: none;
}

.hero-inner {
    position: relative;
    max-width: var(--wide);
    margin: 0 auto;
    padding: clamp(4rem, 10vw, 7.5rem) var(--gutter);
}

.hero-title {
    font-weight: 500;
    font-size: clamp(2.1rem, 5vw, 3.2rem);
    max-width: 17ch;
}

.hero-lede {
    max-width: 46ch;
    margin: 1.5rem 0 2.25rem;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.45rem;
    line-height: 1.5;
    color: var(--silver);
}

.hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.hero-secondary-link { color: var(--moonstone); text-decoration-color: var(--pearl); }
.hero-secondary-link:hover { color: var(--pearl); }

/* --- Home sections ------------------------------------------------------ */

.home-section { padding: clamp(3rem, 7vw, 5rem) var(--gutter); }

.home-section-inner { max-width: var(--wide); margin: 0 auto; }

.home-section-title {
    font-size: clamp(1.7rem, 3.5vw, 2.3rem);
    margin-bottom: 2rem;
}

.readings-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2.5rem 3rem;
}

.reading-type h3 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}

.reading-type h3 a {
    text-decoration: none;
    color: inherit;
}

.reading-type h3 a:hover {
    color: var(--rose-deep);
}

.reading-type p { margin: 0; color: var(--ink-muted); }

.home-section-cta { margin: 2.5rem 0 0; }

.home-calculator-text { max-width: var(--measure); color: var(--ink-muted); }

/* --- Moon divider ------------------------------------------------------- */

.moon-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.2rem;
    padding: 0.5rem var(--gutter);
    color: var(--ink);
}

.divider-moon { width: 13px; height: 13px; opacity: 0.85; }

.site-footer .moon-divider { color: var(--pearl); padding-bottom: 2rem; }

/* --- Page head (index, tag, error) -------------------------------------- */

.page-head {
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    padding: clamp(3rem, 7vw, 4.5rem) var(--gutter);
}

.page-head-inner { max-width: var(--wide); margin: 0 auto; }

.page-head-title { font-size: clamp(2rem, 5vw, 3rem); }

.page-head-lede {
    max-width: 56ch;
    margin: 1rem 0 0;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    color: var(--ink-muted);
    font-size: 1.35rem;
    line-height: 1.5;
}

/* --- Post index (journal style) ----------------------------------------- */

.post-index-section { padding: clamp(2rem, 5vw, 3.5rem) var(--gutter); }

.post-index {
    max-width: var(--wide);
    margin: 0 auto;
}

.post-item {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 1.5rem;
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--hairline);
}

.post-item:first-child { padding-top: 0.5rem; }

.post-item-date {
    color: var(--ink-muted);
    font-size: 0.9rem;
    padding-top: 0.45em;
    font-variant-numeric: oldstyle-nums;
}

.post-item-title {
    font-size: 1.7rem;
    margin-bottom: 0.4rem;
}

.post-item-title a { text-decoration: none; }

.post-item-title a:hover { color: var(--rose-deep); }

.post-item-excerpt {
    margin: 0 0 0.6rem;
    color: var(--ink-muted);
    max-width: var(--measure);
}

.post-item-meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink-muted);
    display: flex;
    gap: 1.25rem;
}

.post-item-tag { color: var(--rose-deep); font-style: italic; }

.post-item-lock {
    border: 1px solid var(--hairline);
    border-radius: 2px;
    padding: 0 0.5em;
}

/* --- Pagination --------------------------------------------------------- */

.pagination {
    max-width: var(--wide);
    margin: 2.5rem auto 0;
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.pagination .page-number { color: var(--ink-muted); }

/* --- Article ------------------------------------------------------------ */

.article { padding: clamp(3rem, 7vw, 4.5rem) var(--gutter) 2rem; }

.article-header {
    max-width: var(--measure);
    margin: 0 auto 2.5rem;
}

.article-meta {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin: 0 0 1rem;
}

.article-meta a { color: var(--rose-deep); text-decoration: none; }

.article-title { font-size: clamp(2rem, 5vw, 2.9rem); }

.article-lede {
    margin: 1.25rem 0 0;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.5rem;
    line-height: 1.45;
    color: var(--ink-muted);
}

.article-image {
    max-width: var(--wide);
    margin: 0 auto 2.5rem;
}

.article-image img { display: block; width: 100%; }

.article-image figcaption {
    font-size: 0.85rem;
    color: var(--ink-muted);
    margin-top: 0.6rem;
    text-align: center;
}

/* --- Ghost content ------------------------------------------------------ */

.gh-content {
    max-width: var(--measure);
    margin: 0 auto;
}

.gh-content > * + * { margin-top: 1.4em; }

.gh-content h2 { font-size: 1.8rem; margin-top: 2.2em; }
.gh-content h3 { font-size: 1.4rem; margin-top: 1.8em; }

.gh-content blockquote {
    margin: 2em 0;
    padding-left: 1.5rem;
    border-left: 2px solid var(--rose);
    font-style: italic;
    color: var(--ink-muted);
}

.gh-content hr {
    border: none;
    border-top: 1px solid var(--hairline);
    margin: 3em auto;
    width: 40%;
}

.gh-content pre {
    background: var(--midnight);
    color: var(--moonstone);
    padding: 1.25rem;
    border-radius: 3px;
    overflow-x: auto;
    font-size: 0.9rem;
}

.gh-content table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.95rem;
}

.gh-content th, .gh-content td {
    border-bottom: 1px solid var(--hairline);
    padding: 0.6em 0.75em;
    text-align: left;
}

.gh-content th { font-weight: 600; }

.gh-content .kg-width-wide { max-width: var(--wide); margin-left: auto; margin-right: auto; }
.gh-content .kg-width-full { max-width: none; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }

/* --- Ghost image cards -------------------------------------------------- */
/* Normal images are intentionally thumbnail-sized. Wide and full cards remain large. */
.gh-content .kg-image-card:not(.kg-width-wide):not(.kg-width-full) {
    width: 45%;
    max-width: 45%;
    margin-left: auto;
    margin-right: auto;
}

.gh-content .kg-image-card:not(.kg-width-wide):not(.kg-width-full) img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.gh-content .kg-image-card.kg-width-wide,
.gh-content .kg-image-card.kg-width-full {
    width: auto;
}


.gh-content figcaption {
    font-size: 0.85rem;
    color: var(--ink-muted);
    text-align: center;
    margin-top: 0.6rem;
}

/* --- Article footer & author -------------------------------------------- */

.article-footer {
    max-width: var(--measure);
    margin: 3rem auto 0;
    color: var(--ink);
}

.article-author {
    color: var(--ink);
    border-top: 1px solid var(--hairline);
    padding-top: 1.75rem;
    margin-top: 1rem;
}

.article-author-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin: 0 0 0.35rem;
}

.article-author-bio { margin: 0; color: var(--ink-muted); }

.article-comments {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 2rem var(--gutter) 3rem;
}

/* --- Subscribe CTA ------------------------------------------------------ */

.subscribe-cta {
    background: linear-gradient(180deg, #251B3A 0%, #3B2547 100%);
    color: var(--moonstone);
    padding: clamp(3.5rem, 8vw, 5.5rem) var(--gutter);
    margin-top: 3rem;
}

.subscribe-cta-inner { max-width: 640px; margin: 0 auto; text-align: center; }

.subscribe-cta-title { font-size: clamp(1.8rem, 4vw, 2.4rem); }

.subscribe-cta-text {
    color: var(--silver);
    margin: 1rem 0 1.75rem;
}

.subscribe-form {
    display: flex;
    gap: 0.75rem;
    max-width: 440px;
    margin: 0 auto;
}

.subscribe-input {
    flex: 1;
    min-width: 0;
    padding: 0.7em 1em;
    font-family: var(--font-body);
    font-size: 0.95rem;
    border: 1px solid var(--rose);
    border-radius: 2px;
    background: #493A66;
    color: var(--moonstone);
}

.subscribe-input:focus {
    border-color: var(--pearl);
}

.subscribe-input::placeholder { color: var(--silver); }

.subscribe-credibility {
    margin: 1.5rem 0 0;
    font-size: 0.85rem;
    color: var(--silver);
}

/* Ghost members form states */
.subscribe-form.loading .button { opacity: 0.6; pointer-events: none; }
.subscribe-form.success::after {
    content: "Check your inbox to confirm your subscription.";
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    color: var(--gold-bright);
    font-size: 0.9rem;
}
.subscribe-form.error::after {
    content: "That didn't work — please check the address and try again.";
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    color: #D08770;
    font-size: 0.9rem;
}
.subscribe-form.success, .subscribe-form.error { flex-wrap: wrap; }

/* --- Footer ------------------------------------------------------------- */

.site-footer {
    background: var(--midnight);
    color: var(--silver);
    padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) 2rem;
}

.subscribe-cta + .site-footer { border-top: 1px solid var(--hairline-dark); }

.footer-inner { max-width: var(--wide); margin: 0 auto; }

.footer-columns {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2.5rem;
}

.footer-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--moonstone);
    margin: 0 0 0.5rem;
}

.footer-note { margin: 0; font-size: 0.9rem; max-width: 36ch; }

.footer-heading {
    color: var(--moonstone);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.footer-col .nav { display: block; }

.footer-col .nav li { margin: 0.45rem 0; }

.footer-col .nav a {
    color: var(--silver);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-col .nav a:hover { color: var(--moonstone); }

.footer-bottom {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--hairline-dark);
    font-size: 0.8rem;
}

.footer-bottom p { margin: 0; }

/* --- Error page --------------------------------------------------------- */

.error-page { min-height: 40vh; }

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 860px) {
    .site-nav { display: none; }
    .nav-toggle { display: block; }
    .site-header .header-actions .button-book { display: none; }
    .mobile-nav.is-open { display: block; }
    .footer-columns { grid-template-columns: 1fr; gap: 2rem; }
    .post-item { grid-template-columns: 1fr; gap: 0.25rem; }
    .post-item-date { padding-top: 0; }
}

@media (max-width: 520px) {
    .subscribe-form { flex-direction: column; }
    .hero-moon { opacity: 0.16; }
}

/* --- Motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
    .hero-moon {
        animation: moonrise 1.6s ease-out both;
    }
    @keyframes moonrise {
        from { transform: translateY(24px); opacity: 0; }
        to { transform: translateY(0); opacity: 0.26; }
    }
}


/* --- Book section --------------------------------------------------------- */

.bg-light { background: var(--paper); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.bg-beige { background: var(--moonstone); }

.book-grid {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}

.book-cover img,
.book-cover-placeholder {
    width: 100%;
    height: auto;
    display: block;
}

.book-eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rose-deep);
}

.book-copy .home-section-title { margin-bottom: 0.5rem; }

.book-byline {
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    color: var(--ink-muted);
    font-style: italic;
}

.book-lede {
    max-width: 46ch;
    color: var(--ink-muted);
    font-size: 1.05rem;
    margin: 0 0 1.75rem;
}

.book-copy .home-section-cta {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.book-learn-more { color: var(--ink); text-decoration-color: var(--rose); }
.book-learn-more:hover { color: var(--rose); }

@media (max-width: 700px) {
    .book-grid { grid-template-columns: 1fr; }
    .book-cover { max-width: 220px; margin: 0 auto; }
}
