/* ============================================================
   Journal — editorial layout + long-form article typography.

   Loaded only by blog.php and blog-post.php via $pageStyles, so none of this
   ships on the shop or checkout path. Every colour comes from the tokens
   already declared in app.css (:root and html.dark), which is what keeps the
   Journal in both themes without a second palette to maintain.
   ============================================================ */

/* ── Listing: featured post ──────────────────────────────
   The newest post is deliberately larger than the rest. A uniform grid gives
   the reader no entry point; one oversized slot does. */

.journal-featured {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
    padding: 1.75rem;
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    background: var(--surface-cream);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

@media (min-width: 900px) {
    .journal-featured {
        grid-template-columns: 1.15fr 1fr;
        gap: 3rem;
        padding: 2.25rem;
    }
}

.journal-featured:hover {
    border-color: rgba(200, 169, 110, 0.5);
    box-shadow: 0 24px 60px -34px rgba(200, 169, 110, 0.55);
}

.journal-featured__media {
    position: relative;
    overflow: hidden;
    border-radius: 0.9rem;
    aspect-ratio: 16 / 10;
    background: var(--surface-sunken);
}

.journal-featured__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Compositor-friendly only — no width/height animation. */
    transition: transform 0.6s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

.journal-featured:hover .journal-featured__media img { transform: scale(1.04); }

.journal-featured__title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.75rem, 1.2rem + 2vw, 2.75rem);
    line-height: 1.12;
    color: var(--ink);
    margin: 0.75rem 0 0.9rem;
}

.journal-featured__excerpt {
    color: var(--ink-body);
    font-size: 0.98rem;
    line-height: 1.7;
}

/* ── Listing: cards ──────────────────────────────────── */

.journal-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--surface);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.journal-card:hover {
    transform: translateY(-4px);
    border-color: rgba(200, 169, 110, 0.45);
    box-shadow: 0 20px 44px -28px rgba(20, 17, 12, 0.45);
}

.journal-card__media {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--surface-sunken);
}

.journal-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

.journal-card:hover .journal-card__media img { transform: scale(1.05); }

.journal-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 1.25rem 1.35rem 1.4rem;
}

.journal-card__title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.35rem;
    line-height: 1.25;
    color: var(--ink);
    margin: 0.55rem 0 0.5rem;
}

.journal-card__excerpt {
    flex: 1 1 auto;
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--ink-body);
}

.journal-card__meta,
.journal-featured__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.journal-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-light);
    color: var(--accent-dark);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Category filter pills */
.journal-pill {
    display: inline-block;
    padding: 0.42rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--ink-muted);
    background: var(--surface);
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.journal-pill:hover {
    color: var(--accent-dark);
    border-color: rgba(200, 169, 110, 0.55);
}

.journal-pill.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--surface);
}

/* ── Article body ────────────────────────────────────────
   Scoped to .journal-prose so it only ever styles sanitised post HTML, never
   surrounding chrome. Measure is capped near 68ch: long-form reading falls
   apart past that regardless of how wide the viewport is. */

.journal-prose {
    max-width: 68ch;
    color: var(--ink-body);
    font-size: 1.02rem;
    line-height: 1.78;
}

.journal-prose > * + * { margin-top: 1.15rem; }

.journal-prose h2,
.journal-prose h3,
.journal-prose h4 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: var(--ink);
    line-height: 1.2;
}

/* Asymmetric spacing: a heading belongs to the text beneath it, so the gap
   above is much larger than the gap below. */
.journal-prose h2 { font-size: 1.9rem; margin-top: 2.75rem; margin-bottom: 0.4rem; }
.journal-prose h3 { font-size: 1.45rem; margin-top: 2.1rem; margin-bottom: 0.35rem; }
.journal-prose h4 { font-size: 1.15rem; margin-top: 1.7rem; margin-bottom: 0.3rem; font-family: 'Inter', sans-serif; font-weight: 600; }

.journal-prose a {
    color: var(--accent-dark);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
    transition: color 0.18s ease;
}

.journal-prose a:hover { color: var(--ink); }

.journal-prose strong { color: var(--ink); font-weight: 600; }

.journal-prose ul,
.journal-prose ol { padding-left: 1.35rem; }

.journal-prose ul { list-style: disc; }
.journal-prose ol { list-style: decimal; }
.journal-prose li { margin-top: 0.5rem; }
.journal-prose li::marker { color: var(--accent); }

.journal-prose blockquote {
    margin-top: 2rem;
    margin-bottom: 2rem;
    padding: 0.35rem 0 0.35rem 1.35rem;
    border-left: 2px solid var(--accent);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.35rem;
    font-style: italic;
    line-height: 1.5;
    color: var(--ink);
}

.journal-prose img {
    width: 100%;
    height: auto;
    border-radius: 0.85rem;
    margin-top: 2rem;
    margin-bottom: 0.6rem;
}

.journal-prose figcaption {
    font-size: 0.78rem;
    color: var(--ink-faint);
    text-align: center;
}

.journal-prose hr {
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    border: 0;
    border-top: 1px solid var(--line);
}

/* Tables scroll inside their own box rather than forcing the page sideways. */
.journal-prose table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.journal-prose th,
.journal-prose td {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--line);
    text-align: left;
}

.journal-prose th {
    background: var(--surface-sunken);
    color: var(--ink);
    font-weight: 600;
}

/* ── Article furniture ─────────────────────────────────── */

.journal-hero__title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2rem, 1.2rem + 3.4vw, 3.5rem);
    line-height: 1.08;
    color: var(--ink);
}

.journal-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 1.1rem;
    background: var(--surface-sunken);
}

/* Reading-progress rail. transform-only so it never triggers layout. */
.journal-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    height: 2px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: var(--accent);
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    .journal-progress { display: none; }

    .journal-card,
    .journal-featured,
    .journal-card__media img,
    .journal-featured__media img {
        transition: none;
    }

    .journal-card:hover { transform: none; }
    .journal-card:hover .journal-card__media img,
    .journal-featured:hover .journal-featured__media img { transform: none; }
}
