/* Standalone blog pages: posts, archive, newsletter page.
   Paper by default, navy at night (prefers-color-scheme), same tokens as the
   main site. Headlines in Josefin Sans, body in the system sans for long
   reads. */

:root {
    --bg: #f6f3ec;
    --bg-soft: #ece6d9;
    --ink: #15133c;
    --ink-soft: rgba(21, 19, 60, 0.72);
    --ink-faint: rgba(21, 19, 60, 0.12);
    --accent: #c15f3c;
    --accent-ink: #f4f3ee;
    --sand: #f9c784;
    --card: rgba(21, 19, 60, 0.05);
    --radius: 12px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --display: 'Josefin Sans', sans-serif;
    --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #15133c;
        --bg-soft: #1d1a4c;
        --ink: #f4f3ee;
        --ink-soft: rgba(244, 243, 238, 0.75);
        --ink-faint: rgba(244, 243, 238, 0.14);
        --card: rgba(255, 255, 255, 0.06);
    }
}

:root[data-theme="dark"] {
    --bg: #15133c;
    --bg-soft: #1d1a4c;
    --ink: #f4f3ee;
    --ink-soft: rgba(244, 243, 238, 0.75);
    --ink-faint: rgba(244, 243, 238, 0.14);
    --card: rgba(255, 255, 255, 0.06);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--body);
    font-size: 18px;
    line-height: 1.7;
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
}

a:hover {
    color: var(--accent);
}

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

::selection {
    background: var(--accent);
    color: var(--accent-ink);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- header / footer ---------- */
.site-header {
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.site-brand {
    display: inline-flex;
    line-height: 0;
    text-decoration: none;
}

.site-brand img {
    width: 72px;
    height: 43px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 26px;
    font-family: var(--display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.site-nav a {
    text-decoration: none;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.site-nav a:hover {
    border-bottom-color: var(--accent);
    color: inherit;
}

.site-nav .nav-cta {
    padding: 9px 18px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

.site-nav .nav-cta:hover {
    background: var(--ink);
    color: var(--bg);
    border-bottom-color: var(--ink);
}

.site-footer {
    max-width: 1100px;
    margin: 64px auto 0;
    padding: 24px;
    border-top: 1px solid var(--ink-faint);
    font-size: 14px;
    color: var(--ink-soft);
}

.site-footer a {
    text-decoration: none;
}

/* ---------- layout ---------- */
main {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 24px 0;
}

.post-header {
    margin: 24px 0 36px;
}

.post-kicker {
    margin: 0 0 14px;
    font-family: var(--display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.post-kicker a {
    text-decoration: none;
}

h1 {
    font-family: var(--display);
    font-size: clamp(34px, 5vw, 48px);
    line-height: 1.12;
    letter-spacing: -0.01em;
    margin: 0 0 18px;
}

.lede {
    font-size: 20px;
    color: var(--ink-soft);
    margin: 0;
    max-width: 60ch;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 0;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--ink-faint);
    font-family: var(--display);
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.post-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* ---------- post body ---------- */
.post-body > p,
.post-body > ul,
.post-body > blockquote {
    margin: 0 0 24px;
}

.post-body h3 {
    font-family: var(--display);
    font-size: 26px;
    line-height: 1.25;
    margin: 52px 0 14px;
    padding-top: 18px;
    position: relative;
}

.post-body h3::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 36px;
    height: 3px;
    border-radius: 2px;
    background: var(--accent);
}

.post-body ul {
    padding-left: 0;
    list-style: none;
}

.post-body li {
    position: relative;
    padding-left: 26px;
    margin-bottom: 12px;
}

.post-body li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.72em;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--accent);
}

.post-body strong {
    font-weight: 600;
}

.post-body blockquote {
    position: relative;
    padding: 30px 32px 24px 36px;
    border-left: 5px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--card);
    font-family: var(--display);
    font-size: 23px;
    font-weight: 700;
    line-height: 1.45;
}

.post-body blockquote::before {
    content: "\201C";
    position: absolute;
    top: 2px;
    left: 14px;
    font-size: 72px;
    line-height: 1;
    font-family: Georgia, serif;
    color: var(--accent);
    opacity: 0.4;
}

.post-body blockquote .quote-author {
    display: block;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--ink-faint);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.post-body .btn_one {
    display: inline-block;
    margin: 6px 0 0;
    padding: 12px 28px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    font-family: var(--display);
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

.post-body .btn_one:hover {
    background: var(--ink);
    color: var(--bg);
}

/* The in-page carousel becomes a plain gallery here: every slide shown. */
.post-body .blog-carousel {
    margin: 32px 0;
}

.post-body .carousel-slide {
    display: block;
    margin-bottom: 28px;
    text-align: center;
}

.post-body .carousel-slide img {
    border-radius: var(--radius);
    box-shadow: 0 14px 40px rgba(21, 19, 60, 0.18);
}

.post-body .carousel-caption {
    margin: 10px 0 0;
    font-size: 15px;
    color: var(--ink-soft);
}

.post-body .carousel-controls,
.post-body .carousel-dots {
    display: none;
}

/* ---------- share, subscribe, nav, author ---------- */
.share-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin: 40px 0 0;
    padding: 20px 0;
    border-top: 1px solid var(--ink-faint);
    border-bottom: 1px solid var(--ink-faint);
    font-family: var(--display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.share-label {
    color: var(--ink-soft);
}

.share-row a,
.share-row .permalink {
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.share-row a:hover {
    border-bottom-color: var(--accent);
    color: inherit;
}

.share-row .permalink {
    margin-left: auto;
    color: var(--ink-soft);
    font-weight: 400;
}

.copy-link {
    appearance: none;
    font: inherit;
    color: inherit;
    background: transparent;
    border: 2px solid var(--ink-faint);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    letter-spacing: inherit;
    text-transform: inherit;
    transition: border-color 0.3s var(--ease);
}

.copy-link:hover,
.copy-link.is-done {
    border-color: var(--accent);
}

.subscribe-box {
    margin: 44px 0 0;
    padding: 32px;
    border-radius: 16px;
    background: var(--card);
}

.subscribe-box h2,
.follow-box h2,
.recent h2 {
    font-family: var(--display);
    font-size: 26px;
    line-height: 1.2;
    margin: 0 0 8px;
}

.subscribe-box p {
    margin: 0 0 18px;
    color: var(--ink-soft);
}

.subscribe-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.subscribe-form input[type="email"] {
    flex: 1 1 240px;
    min-width: 0;
    padding: 13px 18px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
}

.subscribe-form input[type="email"]::placeholder {
    color: var(--ink-soft);
}

.subscribe-form input[type="email"]:focus {
    outline: 3px solid rgba(193, 95, 60, 0.35);
    outline-offset: 2px;
}

.subscribe-form button {
    padding: 13px 28px;
    border: 2px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-family: var(--display);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s var(--ease), filter 0.2s var(--ease);
}

.subscribe-form button:hover {
    filter: brightness(1.08);
}

.subscribe-form button:active {
    transform: translateY(1px);
}

.subscribe-status {
    min-height: 1.4em;
    margin: 12px 0 0 !important;
    font-size: 15px;
    color: var(--ink) !important;
}

.subscribe-alt {
    margin: 10px 0 0 !important;
    font-size: 14px;
}

.post-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 36px 0 0;
}

.post-nav a {
    display: block;
    padding: 18px 20px;
    border: 1px solid var(--ink-faint);
    border-radius: var(--radius);
    text-decoration: none;
    font-family: var(--display);
    font-weight: 700;
    line-height: 1.3;
    transition: border-color 0.3s var(--ease);
}

.post-nav a:hover {
    border-color: var(--accent);
    color: inherit;
}

.post-nav a span {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.post-nav .older {
    grid-column: 2;
    text-align: right;
}

.post-nav .newer {
    grid-column: 1;
}

.author-box {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin: 44px 0 0;
    padding-top: 28px;
    border-top: 1px solid var(--ink-faint);
    font-size: 16px;
    color: var(--ink-soft);
}

.author-box img {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}

.author-box p {
    margin: 0 0 8px;
}

.author-name {
    font-family: var(--display);
    font-weight: 700;
    font-size: 18px;
    color: var(--ink);
}

/* ---------- archive & subscribe page ---------- */
.archive-list,
.recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-list li {
    border-top: 1px solid var(--ink-faint);
}

.archive-list li:last-child {
    border-bottom: 1px solid var(--ink-faint);
}

.archive-list a {
    display: block;
    padding: 24px 0;
    text-decoration: none;
}

.archive-list a:hover .archive-title {
    color: var(--accent);
}

.archive-title {
    display: block;
    font-family: var(--display);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    transition: color 0.3s var(--ease);
}

.archive-meta {
    display: block;
    margin: 6px 0 8px;
    font-family: var(--display);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.archive-excerpt {
    display: block;
    color: var(--ink-soft);
}

.follow-box {
    margin: 28px 0 0;
    padding: 32px;
    border: 1px solid var(--ink-faint);
    border-radius: 16px;
}

.follow-box p {
    margin: 0 0 14px;
    color: var(--ink-soft);
}

.feed-url {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
}

.feed-url code {
    flex: 1 1 260px;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--card);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.feed-apps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    font-family: var(--display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.feed-apps a {
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.feed-apps a:hover {
    border-bottom-color: var(--accent);
    color: inherit;
}

.recent {
    margin: 44px 0 0;
}

.recent-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    padding: 12px 0;
    border-top: 1px solid var(--ink-faint);
}

.recent-list time {
    font-family: var(--display);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

@media (max-width: 640px) {
    body {
        font-size: 17px;
    }

    .site-header {
        padding: 14px 16px;
    }

    .site-nav {
        gap: 16px;
        font-size: 12px;
    }

    main {
        padding: 16px 16px 0;
    }

    .post-body blockquote {
        padding: 26px 20px 20px 24px;
        font-size: 20px;
    }

    .subscribe-box,
    .follow-box {
        padding: 24px 20px;
    }

    .post-nav {
        grid-template-columns: 1fr;
    }

    .post-nav .older,
    .post-nav .newer {
        grid-column: 1;
        text-align: left;
    }

    .share-row .permalink {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

.subscribe-status.is-good { color: var(--accent); font-weight: 600; }
.subscribe-status.is-error { color: #b23a2a; font-weight: 600; }
