/* ==========================================================================
   Blog (blog.php only). Uses the color tokens from style.css, so both themes
   keep WCAG 2.2 AA contrast.
   ========================================================================== */

html { scroll-padding-bottom: 96px; } /* focused fields stay clear of the floating signup button */
.primary-nav ul a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.blog-main { padding-bottom: 0; }

/* ---------- Blog hero ---------- */
.blog-hero { padding: clamp(48px, 8vw, 88px) 0 clamp(28px, 4vw, 40px); background: radial-gradient(60% 120% at 0% 0%, var(--hero-glow-a), transparent 70%), radial-gradient(50% 100% at 100% 0%, var(--hero-glow-b), transparent 70%); }
.blog-title { font-size: clamp(2.3rem, 5.4vw, 3.6rem); letter-spacing: -.035em; max-width: 820px; margin-bottom: 1rem; }
.blog-intro { font-size: clamp(1.08rem, 1.6vw, 1.22rem); color: var(--muted); max-width: 640px; }

.tag-filter { margin-top: 1.8rem; }
.tag-filter ul { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-filter a {
    display: inline-flex; align-items: center; min-height: 44px; padding: .45rem 1rem; border-radius: 999px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: .95rem; text-decoration: none;
}
.tag-filter a:hover { border-color: var(--text); }
.tag-filter a[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.draft-flag { display: inline-block; margin: .8rem 0 0; padding: .2rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 700; color: var(--error); background: var(--error-bg); border: 1px solid currentColor; }
.card-meta .draft-flag { margin: 0 0 0 .3rem; padding: 0 .5rem; font-size: .78rem; }

/* ---------- Post list ---------- */
.blog-list { padding: clamp(24px, 4vw, 40px) 0 clamp(56px, 8vw, 96px); }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; margin-top: 1.4rem; }

.post-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.post-card:hover, .post-card:focus-within { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.post-card:hover .card-media img { transform: scale(1.03); }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 1.4rem 1.5rem 1.5rem; }
.card-kicker { font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-text); margin-bottom: .5rem; }
.card-meta { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.card-title { font-size: 1.3rem; line-height: 1.25; margin-bottom: .6rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; } /* whole card is the link */
.card-title a:focus-visible { outline: none; }
.post-card:has(.card-title a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.card-excerpt { color: var(--muted); margin-bottom: 1rem; }
.card-tags { font-size: .85rem; font-weight: 600; color: var(--teal-text); margin-bottom: 1rem; }
.card-more { display: inline-flex; align-items: center; gap: .35rem; margin-top: auto; font-weight: 700; color: var(--brand-text); }
.card-more .icon { width: 1em; height: 1em; transition: transform .2s var(--ease); }
.post-card:hover .card-more .icon { transform: translateX(3px); }

/* Text-only cards (no photo, or a photo that failed to load) get a quiet accent instead of an empty box. */
.post-card.no-photo { border-top: 4px solid transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; }

/* Featured (newest) post */
.post-card.is-featured { display: grid; grid-template-columns: 1.15fr 1fr; }
.post-card.is-featured .card-media { aspect-ratio: auto; min-height: 340px; }
.post-card.is-featured .card-body { justify-content: center; padding: clamp(1.6rem, 4vw, 3rem); }
.post-card.is-featured .card-title { font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -.03em; }
.post-card.is-featured .card-excerpt { font-size: 1.1rem; }
.post-card.is-featured.no-photo { grid-template-columns: 1fr; }
.post-card.is-featured.no-photo .card-body { max-width: 820px; }

.blog-empty { padding: 2rem; border-radius: var(--radius-lg); border: 1px dashed var(--border-strong); background: var(--bg-soft); margin-bottom: 1.4rem; }
.blog-empty h2 { font-size: 1.5rem; margin-bottom: .5rem; }
.blog-empty p { color: var(--muted); }

.pagination { margin-top: 2.4rem; }
.pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.pagination a {
    display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 .9rem; border-radius: 12px;
    border: 1px solid var(--border-strong); color: var(--text); font-weight: 600; text-decoration: none;
}
.pagination a:hover { border-color: var(--text); }
.pagination a[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Single post ---------- */
.post-header { max-width: 860px; padding-top: clamp(32px, 6vw, 64px); padding-bottom: clamp(24px, 4vw, 40px); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: .2rem .5rem; font-size: .92rem; margin-bottom: 1.6rem; }
.breadcrumb li { display: flex; align-items: center; gap: .5rem; color: var(--muted); }
.breadcrumb li + li::before { content: '/'; color: var(--muted); }
.breadcrumb a { color: var(--brand-text); font-weight: 600; }
.breadcrumb a[aria-current="page"] { color: var(--muted); font-weight: 400; text-decoration: none; display: inline-block; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.post-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.post-tags a { display: inline-flex; align-items: center; min-height: 32px; padding: .2rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 700; color: var(--teal-text); background: color-mix(in srgb, var(--teal-text) 12%, var(--surface)); text-decoration: none; }
.post-tags a:hover { text-decoration: underline; }
.post-title { font-size: clamp(2.2rem, 5.2vw, 3.5rem); letter-spacing: -.035em; margin-bottom: 1.1rem; }
.post-dek { font-size: clamp(1.1rem, 1.8vw, 1.3rem); color: var(--muted); margin-bottom: 1.6rem; }
.post-meta { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .95rem; line-height: 1.4; }
.post-avatar, .author-mark {
    display: inline-grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
    background: var(--grad); color: #fff; font: 800 .95rem/1 var(--font-display);
}
.post-author { display: block; color: var(--text); font-weight: 650; }
.post-meta-line { display: block; }

.post-lead-wrap { max-width: 1100px; }
.post-lead { margin: 0 0 clamp(32px, 5vw, 56px); }
.post-lead img { width: 100%; border-radius: var(--radius-lg); aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }

.post-layout { max-width: 720px; }
.post-body { font-size: 1.15rem; line-height: 1.75; }
.post-body > * { margin-top: 0; margin-bottom: 0; }
.post-body > * + * { margin-top: 1.25em; }
.post-body h2 { font-size: clamp(1.5rem, 2.6vw, 1.85rem); margin-top: 2.2em; letter-spacing: -.02em; }
.post-body h3 { font-size: 1.3rem; margin-top: 1.8em; }
.post-body h2 + *, .post-body h3 + * { margin-top: .7em; }
.post-body ul, .post-body ol { padding-left: 1.4rem; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li + li { margin-top: .5em; }
.post-body li::marker { color: var(--brand-text); font-weight: 700; }
.post-body a { font-weight: 600; }
.post-body strong { font-weight: 700; }

.post-quote {
    margin: 2em 0; padding: 1.2rem 0 1.2rem 1.4rem; border-left: 4px solid; border-image: var(--grad) 1;
    font: 650 clamp(1.25rem, 2.2vw, 1.5rem)/1.45 var(--font-display); letter-spacing: -.01em;
}

.post-figure { margin: 2.2em 0; }
.post-figure img { width: 100%; border-radius: var(--radius); background: var(--surface-2); }
@media (min-width: 1000px) { .post-figure { margin-inline: -60px; } }
.post-figure figcaption, .post-lead figcaption { margin-top: .7rem; font-size: .92rem; line-height: 1.5; color: var(--muted); text-align: center; }

.post-footer { margin-top: clamp(40px, 6vw, 64px); padding-top: 2rem; border-top: 1px solid var(--border); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; margin-bottom: 2rem; }
.share-title { font: 700 1rem var(--font-body); letter-spacing: 0; }
.share-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.share-btn {
    display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .45rem .95rem; border-radius: 12px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: .95rem; font-weight: 600; text-decoration: none;
}
.share-btn:hover { border-color: var(--text); }
.share-btn .icon { width: 1.05em; height: 1.05em; }

.author-card { display: flex; gap: 1.1rem; align-items: flex-start; padding: 1.5rem; border-radius: var(--radius-lg); background: var(--bg-soft); border: 1px solid var(--border); }
.author-mark { width: 56px; height: 56px; font-size: 1.1rem; }
.author-name { font: 750 1.15rem var(--font-display); margin-bottom: .25rem; }
.author-bio { color: var(--muted); margin-bottom: 1rem; }

.post-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 720px; margin-top: clamp(40px, 6vw, 56px); margin-bottom: clamp(56px, 8vw, 88px); }
.pager-card { display: flex; flex-direction: column; gap: .25rem; padding: 1.2rem 1.4rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); text-decoration: none; }
.pager-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.pager-card.is-next { grid-column: 2; text-align: right; }
.pager-label { font-size: .85rem; font-weight: 700; color: var(--muted); }
.pager-title { font: 700 1.05rem/1.35 var(--font-display); color: var(--text); }

/* ---------- Inline signup band (always shown; the no-JavaScript fallback too) ---------- */
.signup-band { position: relative; overflow: hidden; isolation: isolate; padding: clamp(48px, 7vw, 80px) 0; background: #0b0d17; color: #eef0f8; }
.signup-band::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 120% at 100% 0%, rgba(99, 102, 241, .35), transparent 65%), radial-gradient(50% 100% at 0% 100%, rgba(20, 184, 166, .22), transparent 65%); }
.signup-band-inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 64px); align-items: center; }
.signup-band-title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: .7rem; }
.signup-band-copy p:last-child { color: #c7cbe0; font-size: 1.1rem; }
.signup-band .signup-panel-kicker { color: #9ef0e2; }
.signup-band a { color: #c7cdff; }
.signup-band .signup-note { color: #c7cbe0; }
.signup-band .signup-form input { background: #fff; color: #0f1222; border-color: #fff; }
.signup-band .signup-status.is-success { color: #75e0a7; }
.signup-band .signup-status.is-error { color: #ffb4ab; }

.signup-panel-kicker { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .6rem; font-size: .85rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--teal-text); }
.signup-panel-kicker .icon { width: 1.1em; height: 1.1em; }

/* ---------- Signup form ---------- */
.signup-row { display: flex; gap: .5rem; }
.signup-form input[type="email"] {
    flex: 1; min-width: 0; min-height: 52px; padding: .7rem 1rem; border-radius: 12px; font: inherit;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.signup-form input[type="email"]::placeholder { color: #6b7088; }
.signup-form input[type="email"]:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
.signup-band .signup-form input[type="email"]:focus { outline-color: #b4bcff; }
.signup-form input[aria-invalid="true"] { border: 2px solid var(--error); }
.signup-form .btn { min-height: 52px; white-space: nowrap; }
.signup-status { min-height: 0; margin: .6rem 0 0; font-weight: 600; font-size: .95rem; }
.signup-status:empty { display: none; }
.signup-status.is-success { color: var(--success); }
.signup-status.is-error { color: var(--error); }
.signup-status:focus { outline: none; }
.signup-note { margin: .6rem 0 0; font-size: .88rem; color: var(--muted); }
.signup-form.is-sending { opacity: .8; }
.signup-form.is-done .signup-row { display: none; }

/* ---------- Floating call to action ---------- */
.signup-float {
    position: fixed; right: 24px; bottom: 24px; z-index: 45;
    display: flex; flex-direction: column; align-items: flex-end; gap: .7rem;
    transition: transform .35s var(--ease), opacity .35s var(--ease), visibility .35s;
}
.signup-float[hidden] { display: none; }
.signup-float.is-tucked { transform: translateY(calc(100% + 32px)); opacity: 0; visibility: hidden; } /* hidden from keyboard too */
.signup-pill-wrap { position: relative; }
.signup-pill {
    display: inline-flex; align-items: center; gap: .55rem; min-height: 52px; padding: .7rem 1.3rem .7rem 1.1rem;
    border: 0; border-radius: 999px; color: var(--on-grad); background: var(--grad); font-weight: 700;
    box-shadow: 0 14px 34px -12px rgba(79, 70, 229, .75);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.signup-pill:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -12px rgba(79, 70, 229, .85); }
.signup-pill .icon { width: 1.2em; height: 1.2em; }
.signup-pill[aria-expanded="true"] { box-shadow: var(--shadow-sm); }
@media (prefers-reduced-motion: no-preference) {
    .signup-float.is-new .signup-pill { animation: signup-nudge 2.4s var(--ease) 1; }
}
@keyframes signup-nudge { 0%, 100% { transform: none; } 15% { transform: translateY(-6px); } 30% { transform: none; } 45% { transform: translateY(-3px); } 60% { transform: none; } }

.signup-dismiss {
    position: absolute; top: -10px; left: -10px; display: grid; place-items: center;
    width: 26px; height: 26px; padding: 0; border-radius: 50%;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.signup-dismiss::after { content: ''; position: absolute; inset: -9px; } /* 44px touch target */
.signup-dismiss .icon { width: 14px; height: 14px; }
.signup-pill[aria-expanded="true"] + .signup-dismiss { display: none; }

.signup-panel {
    position: relative; width: min(380px, calc(100vw - 32px)); padding: 1.5rem 1.4rem 1.3rem;
    border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.signup-panel[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
    .signup-panel:not([hidden]) { animation: signup-in .3s var(--ease); }
}
@keyframes signup-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.signup-close { position: absolute; top: 10px; right: 10px; }
.signup-panel-title { font-size: 1.35rem; margin: 0 2.4rem .5rem 0; }
.signup-panel-text { color: var(--muted); font-size: .98rem; margin-bottom: 1rem; }
.signup-panel .signup-row { flex-direction: column; }

/* The booking bar from the footer would compete with the signup button on phones; the post's
   author card and the header still offer booking. */
.mobile-cta { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .post-grid { grid-template-columns: repeat(2, 1fr); }
    .post-card.is-featured { grid-template-columns: 1fr; }
    .post-card.is-featured .card-media { min-height: 0; aspect-ratio: 16 / 9; }
    .signup-band-inner { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .post-grid { grid-template-columns: 1fr; }
    .post-body { font-size: 1.07rem; }
    .signup-row { flex-direction: column; }
    .post-pager { grid-template-columns: 1fr; }
    .pager-card.is-next { grid-column: auto; }
    .author-card { flex-direction: column; }
    .breadcrumb a[aria-current="page"] { max-width: 22ch; }
    .signup-float { right: 16px; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); align-items: stretch; }
    .signup-pill-wrap { align-self: flex-end; }
    .signup-panel { width: 100%; }
}

/* ---------- Preferences ---------- */
@media (forced-colors: active) {
    .post-card, .signup-panel, .share-btn, .pager-card, .signup-pill, .tag-filter a, .pagination a { border: 1px solid CanvasText; }
    .post-card:has(.card-title a:focus-visible) { outline-color: Highlight; }
}
@media print {
    .signup-float, .signup-band, .share, .post-pager, .tag-filter { display: none !important; }
}

/* ---------- Daily / weekly choice ---------- */
.signup-freq { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin: 0 0 .7rem; padding: 0; border: 0; }
.signup-freq legend { float: left; margin-right: .3rem; font-size: .92rem; font-weight: 650; }
.freq-option { position: relative; display: inline-flex; cursor: pointer; }
.freq-option input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.freq-option span {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .4rem .95rem; border-radius: 999px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: .92rem; font-weight: 600;
}
.freq-option span::before { content: ''; width: .75em; height: .75em; border-radius: 50%; border: 2px solid currentColor; }
.freq-option input:checked + span { border-color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--brand-text); }
.freq-option input:checked + span::before { background: var(--brand-text); border-color: var(--brand-text); box-shadow: inset 0 0 0 2px var(--surface); }
.freq-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.signup-band .signup-freq legend { color: #eef0f8; }
.signup-band .freq-option span { background: transparent; border-color: #7d84a6; color: #eef0f8; }
.signup-band .freq-option input:checked + span { border-color: #b4bcff; box-shadow: inset 0 0 0 1px #b4bcff; }
.signup-band .freq-option input:checked + span::before { background: #b4bcff; border-color: #b4bcff; box-shadow: inset 0 0 0 2px #0b0d17; }
.signup-band .freq-option input:focus-visible + span { outline-color: #b4bcff; }
.signup-form.is-done .signup-freq { display: none; }
@media (forced-colors: active) { .freq-option input:checked + span::before { background: Highlight; } }
.signup-panel .signup-freq legend { width: 100%; margin: 0 0 .1rem; }

/* ---------- Unsubscribe page ---------- */
.unsub-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.unsub-form { max-width: 440px; margin-top: 1.4rem; }
