/* Justin's Finds — editorial newsletter theme */

:root {
    --font-display: var(--gh-font-heading, "Instrument Serif"), "Instrument Serif", "Times New Roman", Times, serif;
    --font-sans: var(--gh-font-body, Inter), Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --accent: var(--ghost-accent-color, #e31c3d);
    --bg: #efece7;
    --paper: #ffffff;
    --ink: #161616;
    --muted: #5c5c5c;
    --line: #e3dfd8;
    --beige: #e8dcc8;
    --banner: #e7e4de;
    --radius: 22px;
    --radius-sm: 16px;
    --max: 1160px;
    --header-h: 72px;
    --shadow: 0 1px 2px rgba(22, 22, 22, 0.04);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input { font: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 400; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute;
    left: 1rem; top: -40px;
    background: var(--ink); color: #fff;
    padding: 0.5rem 0.8rem;
    z-index: 100;
    border-radius: 6px;
}
.skip-link:focus { top: 0.5rem; }

.shell {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto;
}
.display, .card-title.display, .article-title, .page-title, .footer-title, .wordmark {
    font-family: var(--font-display);
    font-weight: 400;
}
.card-title.serif { font-family: var(--font-display); }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(239, 236, 231, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto;
    min-height: var(--header-h);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}
.header-nav {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.header-nav .nav,
.mobile-nav .nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 1.05rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.header-nav a[aria-current="page"],
.header-nav .nav-current a,
.mobile-nav .nav-current a { color: var(--accent); }
.wordmark {
    font-size: clamp(1.35rem, 2.2vw, 1.85rem);
    letter-spacing: 0.12em;
    color: var(--ink);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}
.wordmark:hover { color: var(--ink); }
.header-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}
.btn-subscribe {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.95rem 0.45rem 1.05rem;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-subscribe:hover {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.btn-arrow { font-size: 1em; line-height: 1; }
.btn-subscribe-block { justify-content: center; width: 100%; margin-top: 1rem; }

.menu-toggle {
    display: none;
    width: 40px; height: 40px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.menu-toggle-bars,
.menu-toggle-bars:before,
.menu-toggle-bars:after {
    display: block;
    width: 14px; height: 1.5px;
    background: var(--ink);
    position: relative;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle-bars:before,
.menu-toggle-bars:after {
    content: "";
    position: absolute;
    left: 0;
}
.menu-toggle-bars:before { top: -5px; }
.menu-toggle-bars:after { top: 5px; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars:before { top: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars:after { top: 0; transform: rotate(-45deg); }

.mobile-menu {
    display: none;
    padding: 0 16px 24px;
    border-top: 1px solid var(--line);
    background: var(--bg);
}
.mobile-menu[hidden] { display: none !important; }
.mobile-nav { padding-top: 8px; }
.mobile-nav .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex-wrap: nowrap;
}
.mobile-nav a {
    font-family: var(--font-display);
    font-size: 1.6rem;
    padding: 6px 0;
}

/* Welcome */
.home-main { padding: 28px 0 80px; }
.welcome {
    background: var(--banner);
    border-radius: var(--radius);
    padding: 28px 32px 30px;
    text-align: center;
    margin-bottom: 22px;
}
.welcome-kicker {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}
.welcome-tagline {
    margin: 0 auto 18px;
    max-width: 36rem;
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 3vw, 2.05rem);
    line-height: 1.3;
    color: var(--ink);
}
.welcome-tagline em {
    font-style: italic;
    color: var(--accent);
    font-family: var(--font-display);
}

/* Topics */
.topics {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 2px 18px;
    margin-bottom: 6px;
    scrollbar-width: none;
}
.topics::-webkit-scrollbar { display: none; }
.topic-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 72px;
    color: var(--ink);
    flex: 0 0 auto;
}
.topic-dot {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 1.5px solid var(--ink);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 1.35rem;
    line-height: 1;
    text-transform: uppercase;
    color: var(--ink);
    background:
        radial-gradient(circle at 50% 50%, var(--paper) 58%, transparent 59%),
        conic-gradient(from 180deg, var(--accent), #f6b3c0, var(--accent));
}
.topic-name {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Bento */
.bento {
    display: grid;
    grid-template-columns: 1.35fr 0.95fr 0.85fr;
    gap: 16px;
    margin-bottom: 48px;
    align-items: start;
}
.bento-mid, .bento-rail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.card {
    background: var(--paper);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    min-width: 0;
}
.card-body { padding: 18px 20px 20px; }
.card-lead { display: flex; flex-direction: column; height: 100%; }
.card-lead .card-body { flex: 1; display: flex; flex-direction: column; padding: 22px 24px 24px; }
.card-media {
    display: block;
    overflow: hidden;
    background: #d9d6d0;
}
.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(1) contrast(1.05);
    transition: transform 0.5s ease, filter 0.5s ease;
}
.card-media:hover img { transform: scale(1.03); }
.card-lead .card-media { aspect-ratio: 4 / 3; }
.card-media.is-short { aspect-ratio: 16 / 10; }
.card-media.is-thumb { aspect-ratio: 16 / 10; }
.card-media.is-dark img { filter: grayscale(1) brightness(0.85); }

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.card-title {
    margin: 0 0 10px;
    font-size: 1.25rem;
    line-height: 1.2;
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--ink); }
.card-lead .card-title {
    font-size: clamp(2.4rem, 4.6vw, 4.1rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
}
.word-hl {
    background: var(--accent);
    color: #fff !important;
    padding: 0 0.12em 0.02em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    display: inline;
    line-height: 1.05;
}
.card-title .word-hl, .card-title .word-hl a { color: #fff; }
.card-excerpt {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}
.card-lead .card-excerpt { font-size: 1.02rem; max-width: 36em; }
.card-foot {
    margin: 0;
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 12px;
    color: var(--muted);
}
.card-tag, .pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #f4dbe2;
    color: var(--accent);
}
.card-kicker {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

/* Section card */
.card-section {
    background: var(--beige);
    padding: 22px 22px 16px;
}
.section-kicker {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}
.section-list { list-style: none; margin: 0; padding: 0; }
.section-list li + li { border-top: 1px solid rgba(22,22,22,0.08); }
.section-list a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 12px 0;
    font-family: var(--font-display);
    font-size: 1.55rem;
    color: var(--ink);
}
.section-count {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

/* Stats / social / CTA */
.stat-row, .social-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.card-stat {
    padding: 16px 14px 14px;
    text-align: left;
}
.card-stat strong {
    display: block;
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1;
    font-weight: 400;
}
.card-stat span {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.card-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
}
.card-social:hover { color: var(--ink); background: #f7f5f1; }
.card-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 18px 20px;
    background: var(--paper);
}
.cta-label {
    font-family: var(--font-display);
    font-size: 1.45rem;
    line-height: 1.15;
    color: var(--ink);
}
.cta-arrow {
    flex: 0 0 42px;
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}
.card-cta:hover { color: inherit; }
.card-cta:hover .cta-arrow { background: var(--accent); }
.card-dark {
    background: #1a1a1a;
    color: #f4f4f4;
}
.card-dark .card-title a,
.card-dark .card-kicker { color: #f4f4f4; }
.card-dark .card-kicker { color: #ffb3c1; }

/* Bands */
.band { margin: 8px 0 48px; }
.band-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.band-head h2 {
    font-family: var(--font-display);
    font-size: 2rem;
}
.see-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.latest-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.archive-grid { grid-template-columns: repeat(3, 1fr); }
.card-pick {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    min-height: 280px;
}
.card-pick .card-media { aspect-ratio: auto; min-height: 280px; }
.card-pick .card-body { padding: 32px 32px 32px 28px; display: flex; flex-direction: column; }
.card-pick .card-title { font-size: clamp(2rem, 3.5vw, 3.1rem); line-height: 0.95; letter-spacing: -0.03em; }

/* Subscribe form */
.sub-form { width: min(520px, 100%); margin: 0 auto; }
.sub-row { display: flex; gap: 8px; }
.sub-form input[type="email"] {
    flex: 1;
    min-width: 0;
    border: 0;
    background: var(--paper);
    border-radius: 999px;
    padding: 0.75rem 1.1rem;
    color: var(--ink);
    outline: none;
    box-shadow: inset 0 0 0 1px transparent;
}
.sub-form input[type="email"]:focus { box-shadow: inset 0 0 0 2px var(--ink); }
.sub-form button {
    border: 0;
    background: var(--ink);
    color: #fff;
    border-radius: 999px;
    padding: 0.75rem 1.15rem;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.sub-form button:hover { background: #000; }
.sub-form .label-loading,
.sub-form .label-success,
.sub-form .label-error,
.sub-form.loading .label-default,
.sub-form.success .label-default,
.sub-form.error .label-default { display: none; }
.sub-form.loading .label-loading,
.sub-form.success .label-success,
.sub-form.error .label-error { display: inline; }
.sub-success, .sub-error { display: none; margin: 10px 0 0; font-size: 13px; }
.sub-form.success .sub-success { display: block; color: #157a3a; }
.sub-form.error .sub-error { display: block; color: var(--accent); }
.site-footer .sub-form { margin: 0; }
.site-footer .sub-form input[type="email"] { background: #fff; }
.site-footer .sub-form button {
    background: #fff;
    color: #161616;
}
.site-footer .sub-form button:hover { background: var(--accent); color: #fff; }

/* Article */
.article-wrap {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 40px 0 20px;
}
.article-header { margin-bottom: 24px; }
.article-title {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    line-height: 0.98;
    letter-spacing: -0.03em;
    margin: 12px 0 14px;
}
.article-dek {
    font-size: 1.15rem;
    color: var(--muted);
    margin: 0 0 16px;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}
.article-media {
    margin: 0 0 32px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #d9d6d0;
}
.article-media img {
    width: 100%;
    filter: grayscale(1) contrast(1.04);
}
.article-media figcaption {
    font-size: 12px;
    color: var(--muted);
    padding: 8px 4px 0;
}
.article-body {
    font-size: 1.08rem;
    line-height: 1.7;
}
.article-body > *:first-child { margin-top: 0; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.article-body h2, .article-body h3 {
    font-family: var(--font-display);
    margin: 2rem 0 0.7rem;
}
.article-body h2 { font-size: 1.8rem; }
.article-body img { border-radius: 12px; }
.article-body blockquote {
    margin: 1.6rem 0;
    padding: 0 0 0 1.1rem;
    border-left: 3px solid var(--accent);
    font-family: var(--font-display);
    font-size: 1.4rem;
    line-height: 1.35;
}

.post-subscribe {
    width: min(760px, calc(100% - 32px));
    margin: 28px auto 64px;
    background: var(--banner);
    border-radius: var(--radius);
    padding: 32px 28px;
    text-align: center;
}
.post-subscribe h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin: 0 0 8px;
}
.post-subscribe p { margin: 0 0 16px; color: var(--muted); }
.post-subscribe .footer-kicker { color: var(--muted); }
.more-issues { padding-bottom: 64px; }

.page-head { padding: 36px 0 24px; }
.page-title { font-size: clamp(2.4rem, 5vw, 4rem); letter-spacing: -0.03em; }
.page-dek { color: var(--muted); max-width: 36em; }
.empty-note { color: var(--muted); grid-column: 1 / -1; }

/* Footer */
.site-footer {
    background: #161616;
    color: #f3f1ec;
    padding: 64px 0 40px;
    margin-top: auto;
}
.footer-inner {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: end;
}
.footer-kicker {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #b8b4ac;
}
.footer-title { font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 10px; color: #fff; }
.footer-copy { color: #c8c4bc; margin: 0 0 18px; max-width: 28rem; }
.wordmark-footer { color: #fff; display: inline-block; margin-bottom: 10px; }
.wordmark-footer:hover { color: #fff; }
.footer-legal, .footer-links { margin: 0 0 8px; font-size: 13px; color: #b8b4ac; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.footer-links a, .footer-legal { color: #b8b4ac; }
.footer-links a:hover { color: #fff; }

.pagination {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 28px 0 8px;
    font-size: 14px;
    font-weight: 500;
}

.error-wrap { padding: 80px 0; text-align: center; }

/* Ghost card tweaks */
.kg-width-wide, .kg-width-full { max-width: 100%; }
.kg-image { margin-left: auto; margin-right: auto; }

/* Responsive */
@media (max-width: 980px) {
    .header-nav { display: none; }
    .menu-toggle { display: inline-flex; }
    .header-inner { grid-template-columns: auto 1fr auto; }
    .wordmark { justify-self: center; }
    .bento { grid-template-columns: 1fr 1fr; }
    .card-lead { grid-column: 1 / -1; }
    .latest-grid, .archive-grid { grid-template-columns: 1fr 1fr; }
    .card-pick { grid-template-columns: 1fr; }
    .card-pick .card-media { min-height: 0; aspect-ratio: 16 / 9; }
    .footer-inner { grid-template-columns: 1fr; }
    .mobile-menu:not([hidden]) { display: block; }
}

@media (max-width: 640px) {
    :root { --radius: 18px; --header-h: 64px; }
    .welcome { padding: 22px 18px 24px; }
    .bento, .latest-grid, .archive-grid, .stat-row { grid-template-columns: 1fr; }
    .bento { gap: 14px; }
    .card-lead .card-title { font-size: 2.35rem; }
    .header-inner { width: calc(100% - 20px); }
    .btn-subscribe span.btn-arrow { display: none; }
    .sub-row { flex-direction: column; }
    .sub-form button, .sub-form input[type="email"] { width: 100%; text-align: center; }
    .article-wrap, .post-subscribe { width: calc(100% - 24px); }
    .home-main { padding-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .card-media img, .cta-arrow, .btn-subscribe { transition: none; }
}
