/* Lauramon — a podcast & blog theme for Ghost, styled like an old terminal
   ------------------------------------------------------------------------
   Two colors are injected from Ghost Admin (Settings → Design):
     --highlight    the "phosphor" — links, buttons, cursor, accents
     --background   page background
   Everything else is derived from those with color-mix(), so the theme
   re-tints itself around whatever the admin picks. Defaults are green
   phosphor on near-black; amber (#ffb000) works just as well. */

:root {
    /* Working colors start as the admin-picked ones; the visitor's
       scheme toggle (html.mode-flipped) swaps in derived counterparts. */
    --highlight: var(--highlight-picked);
    --background: var(--background-picked);

    /* Counterpart background for the toggle: picked-light sites flip
       to pure black… */
    --background-alt: #000000;

    --text: color-mix(in srgb, var(--highlight) 12%, #1a1a1a);
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--background));
    --border: color-mix(in srgb, var(--text) 30%, var(--background));
    --surface: color-mix(in srgb, var(--text) 6%, var(--background));
    --highlight-soft: color-mix(in srgb, var(--highlight) 14%, var(--background));
    --glow: color-mix(in srgb, var(--highlight) 40%, transparent);

    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
        "Liberation Mono", monospace;

    --container: 1000px;
    --container-narrow: 720px;
}

/* …and picked-dark sites flip to pure white. `dark-bg` is set by the
   inline script in default.hbs when the ADMIN-picked background is dark. */
.dark-bg {
    --background-alt: #ffffff;
}

/* Visitor flipped the scheme: swap in the counterpart background, and
   re-tune the highlight so it keeps contrast on the new background. */
.mode-flipped {
    --background: var(--background-alt);
}

.dark-bg.mode-flipped {
    /* picked dark, now on light: highlight goes near-black, keeping a
       10% trace of the picked color (white picked → black highlight) */
    --highlight: color-mix(in srgb, var(--highlight-picked) 10%, #000000);
}

.mode-flipped:not(.dark-bg) {
    /* picked light, now on dark: highlight goes near-white
       (black picked → white highlight) */
    --highlight: color-mix(in srgb, var(--highlight-picked) 10%, #ffffff);
}

/* Light-on-dark text whenever the EFFECTIVE background is dark:
   picked-dark and not flipped, or picked-light and flipped. */
.dark-bg:not(.mode-flipped),
.mode-flipped:not(.dark-bg) {
    --text: color-mix(in srgb, var(--highlight) 22%, #ececec);
}

/* ── Reset & base ─────────────────────────────────────────── */

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

body {
    margin: 0;
    /* --gh-font-body / --gh-font-heading are injected by Ghost when the
       admin picks custom fonts in Design settings. */
    font-family: var(--gh-font-body, var(--font-mono));
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
}

/* CRT scanlines — tinted from the text color so they work on any
   background. Purely decorative, static (no flicker). */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        color-mix(in srgb, var(--text) 3%, transparent) 0 1px,
        transparent 1px 3px
    );
}

::selection {
    background: var(--highlight);
    color: var(--background);
}

:focus-visible {
    outline: 1px dashed var(--highlight);
    outline-offset: 2px;
}

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

a {
    color: var(--highlight);
    text-decoration: none;
}

a:hover {
    background: var(--highlight);
    color: var(--background);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--gh-font-heading, var(--font-mono));
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
}

/* Form controls don't inherit fonts by default. */
button, input, select, textarea {
    font: inherit;
}

/* Code always stays monospace, even when the admin picks proportional
   fonts in Settings → Design → Typography. */
pre, code, kbd, samp {
    font-family: var(--font-mono);
}

.inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 4vw;
}

.inner-narrow {
    max-width: var(--container-narrow);
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--highlight);
    color: var(--background);
    padding: 8px 16px;
    z-index: 100;
}

.skip-link:focus {
    top: 16px;
}

/* ── Header & navigation ──────────────────────────────────── */

.site-header {
    border-bottom: 1px solid var(--border);
    background-color: var(--background);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 64px;
}

/* Desktop: brand and menu stacked and centered. */
@media (min-width: 721px) {
    .site-header-inner {
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        min-height: 0;
        padding-top: 24px;
        padding-bottom: 20px;
    }
}

.site-brand {
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
}

.site-brand:hover {
    background: none;
    color: var(--highlight);
}

.site-logo {
    max-height: 32px;
    width: auto;
}

.site-nav .nav {
    display: flex;
    align-items: center;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav .nav a {
    color: var(--text-muted);
    text-transform: lowercase;
}

.site-nav .nav a:hover {
    background: none;
    color: var(--text);
}

.site-nav .nav-current a {
    color: var(--highlight);
}

/* Header action cluster: search, account, scheme toggle, hamburger. */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-toggle,
.search-toggle,
.account-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.mode-toggle:hover,
.search-toggle:hover,
.account-button:hover {
    background: none;
    border-color: var(--highlight);
    color: var(--highlight);
}

.mode-toggle svg,
.search-toggle svg,
.account-button svg {
    width: 16px;
    height: 16px;
}

/* Scheme toggle: moon shown when the effective scheme is light (switch
   to dark), sun when it is dark (switch to light). */

.mode-toggle .icon-sun {
    display: none;
}

.dark-bg:not(.mode-flipped) .mode-toggle .icon-sun,
.mode-flipped:not(.dark-bg) .mode-toggle .icon-sun {
    display: block;
}

.dark-bg:not(.mode-flipped) .mode-toggle .icon-moon,
.mode-flipped:not(.dark-bg) .mode-toggle .icon-moon {
    display: none;
}

/* Desktop header is a centered stack — pin the actions to the corner. */
@media (min-width: 721px) {
    .site-header {
        position: relative;
    }

    .header-actions {
        position: absolute;
        top: 50%;
        right: 4vw;
        transform: translateY(-50%);
    }
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: 0;
    padding: 8px;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 720px) {
    .nav-toggle {
        display: flex;
    }

    /* Row layout: brand left, action cluster right. */
    .header-actions {
        margin-left: auto;
    }

    .site-header-inner {
        gap: 12px;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--background);
        border-bottom: 1px solid var(--border);
        padding: 16px 4vw 24px;
        z-index: 50;
    }

    .site-header {
        position: relative;
    }

    .site-nav.is-open {
        display: block;
    }

    .site-nav .nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .nav-toggle[aria-expanded="true"] span:first-child {
        transform: translateY(4px) rotate(45deg);
    }

    .nav-toggle[aria-expanded="true"] span:last-child {
        transform: translateY(-4px) rotate(-45deg);
    }
}

/* ── Hero (home) ──────────────────────────────────────────── */

.hero {
    padding: 88px 0 64px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(ellipse at center top,
            var(--highlight-soft), transparent 65%);
}

.hero-title {
    font-size: clamp(2.2rem, 6vw, 3.6rem);
    margin-bottom: 0.4em;
    text-shadow: 0 0 18px var(--glow);
}

/* Blinking block cursor after the site title. */
.hero-title::after {
    content: "▊";
    color: var(--highlight);
    margin-left: 0.12em;
    animation: cursor-blink 1.1s steps(1) infinite;
}

@keyframes cursor-blink {
    50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-title::after {
        animation: none;
    }
}

.hero-description {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 32px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.button {
    display: inline-block;
    padding: 10px 22px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid var(--highlight);
    transition: box-shadow 0.15s ease;
}

.button:hover {
    box-shadow: 0 0 14px var(--glow);
}

.button-primary {
    background: var(--highlight);
    /* Background color as text keeps contrast whatever highlight is picked:
       the highlight must already stand out against the background. */
    color: var(--background);
}

.button-primary:hover {
    background: var(--highlight);
    color: var(--background);
}

.button-secondary {
    color: var(--highlight);
}

.button-secondary:hover {
    background: var(--highlight);
    color: var(--background);
}

/* ── Sections & listings ──────────────────────────────────── */

.home-section {
    padding: 48px 0;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.section-heading h2 {
    font-size: 1.25rem;
    margin: 0;
}

.section-link {
    font-size: 0.9rem;
    white-space: nowrap;
}

.page-header {
    padding: 64px 0 32px;
    text-align: center;
}

.page-header h1 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    text-shadow: 0 0 14px var(--glow);
}

.page-header-description {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 560px;
    margin: 0 auto;
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px;
    border: 1px solid var(--border);
}

.post-feed-section {
    padding: 24px 0 72px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.empty-note {
    color: var(--text-muted);
    text-align: center;
    padding: 32px 0;
}

/* ── Episode list (episodes index) ────────────────────────── */

.post-list {
    border-top: 1px solid var(--border);
}

.post-row {
    border-bottom: 1px solid var(--border);
}

.post-row-link {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 8px 24px;
    padding: 18px 8px;
    color: inherit;
}

.post-row-link:hover {
    background: var(--surface);
    color: inherit;
}

.post-row-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.post-row-title {
    font-size: 1.05rem;
    margin: 0;
    display: inline;
}

/* "> " marker that lights up on hover, without shifting the layout. */
.post-row-title::before {
    content: "> ";
    color: var(--highlight);
    opacity: 0;
    transition: opacity 0.1s ease;
}

.post-row-link:hover .post-row-title::before {
    opacity: 1;
}

.post-row-excerpt {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 4px 0 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.post-row-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .post-row-link {
        grid-template-columns: 1fr auto;
    }

    .post-row-date {
        order: 2;
    }

    .post-row-main {
        grid-column: 1 / -1;
        order: 1;
    }

    .post-row-meta {
        order: 3;
    }
}

/* ── Post card (home & blog) ──────────────────────────────── */

.post-card {
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.post-card:hover {
    border-color: var(--highlight);
    box-shadow: 0 0 16px var(--glow);
}

.post-card-link {
    color: inherit;
    display: block;
    height: 100%;
}

.post-card-link:hover {
    background: none;
    color: inherit;
}

.post-card-image {
    border-bottom: 1px solid var(--border);
}

.post-card-image img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    width: 100%;
}

.post-card-body {
    padding: 18px 20px 20px;
}

.post-card-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--highlight);
    margin: 0 0 8px;
}

.post-card-badge::before {
    content: "[";
}

.post-card-badge::after {
    content: "]";
}

.post-card-title {
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.post-card-excerpt {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin: 0 0 14px;
}

.post-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Article (post & page) ────────────────────────────────── */

.article-header {
    padding: 64px 0 24px;
    text-align: center;
}

.article-kicker {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 14px;
}

.article-kicker a::before {
    content: "[";
}

.article-kicker a::after {
    content: "]";
}

.article-title {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    text-shadow: 0 0 14px var(--glow);
}

.article-excerpt {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

.article-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.article-author {
    font-weight: 700;
    color: var(--text);
}

.article-image {
    margin: 24px 0 0;
}

.article-image img {
    border: 1px solid var(--border);
    width: 100%;
}

.article-image figcaption {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 10px;
}

.article-content {
    padding: 40px 0 48px;
}

.article-footer {
    padding-bottom: 72px;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-chip {
    border: 1px solid var(--border);
    padding: 4px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tag-chip::before {
    content: "#";
    opacity: 0.7;
}

.tag-chip:hover {
    background: none;
    border-color: var(--highlight);
    color: var(--highlight);
}

/* ── Post content (Ghost cards render inside .gh-content) ─── */

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

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

.gh-content h3 {
    font-size: 1.15rem;
    margin-top: 1.6em;
}

.gh-content blockquote {
    border-left: 2px solid var(--highlight);
    margin: 1.4em 0;
    padding: 0.2em 0 0.2em 1.2em;
    color: var(--text-muted);
}

.gh-content pre {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 20px;
    overflow-x: auto;
    font-size: 0.88rem;
}

.gh-content code {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.1em 0.35em;
    font-size: 0.9em;
}

.gh-content pre code {
    background: none;
    border: 0;
    padding: 0;
}

.gh-content hr {
    border: 0;
    border-top: 1px dashed var(--border);
    margin: 2.5em 0;
}

.gh-content img {
    border: 1px solid var(--border);
    margin-left: auto;
    margin-right: auto;
}

.gh-content figcaption {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 10px;
}

/* Wide and full-width editor cards break out of the narrow column. */
.gh-content .kg-width-wide {
    width: min(var(--container), 92vw);
    margin-left: calc(50% - min(calc(var(--container) / 2), 46vw));
}

.gh-content .kg-width-full {
    width: 100vw;
    margin-left: calc(50% - 50vw);
}

.gh-content .kg-width-full img {
    border: 0;
    width: 100%;
}

/* Ghost audio/file cards pick up the accent automatically via
   --ghost-accent-color; keep our highlight in sync visually. */
.kg-audio-card,
.kg-file-card {
    border-color: var(--border) !important;
    border-radius: 0 !important;
}

/* ── Listen links (home page) ─────────────────────────────── */

.listen-section {
    padding: 16px 0 72px;
}

.listen-heading {
    text-align: center;
    font-size: 1.25rem;
    margin-bottom: 28px;
}

.listen-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

.listen-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    padding: 10px 20px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.listen-button:hover {
    background: none;
    border-color: var(--highlight);
    color: var(--highlight);
    box-shadow: 0 0 14px var(--glow);
}

.listen-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ── Pagination ───────────────────────────────────────────── */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
    font-size: 0.9rem;
}

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

/* ── Error page ───────────────────────────────────────────── */

.error-page {
    padding: 120px 0;
}

.error-page h1 {
    font-size: 5rem;
    color: var(--highlight);
    text-shadow: 0 0 24px var(--glow);
    margin-bottom: 0;
}

.error-page .button {
    margin-top: 24px;
}

/* ── Footer ───────────────────────────────────────────────── */

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 48px;
    padding: 32px 0 28px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Link bar: primary + secondary navigation flow together as one
   centered row (display: contents lifts the list items into the
   shared flex container). */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 32px;
    padding-bottom: 24px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.footer-links .nav {
    display: contents;
}

.footer-links li {
    list-style: none;
}

.footer-links a {
    color: var(--text);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}

.footer-links a:hover {
    background: none;
    color: var(--highlight);
}

.site-footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.site-footer p {
    margin: 0;
}

.site-footer-meta a {
    color: var(--text-muted);
}

.site-footer-meta a:hover {
    background: none;
    color: var(--highlight);
}
