/* =============================================================================
   tokenlimit-news theme -- screen.css
   ----------------------------------------------------------------------------
   Editorial / serious palette. System fonts. No gradients, no oversized hero
   images. Plain text + good typography. Mobile-first.

   Scope:
     - Reset + base typography
     - Layout primitives (.container)
     - Site chrome (header, footer)
     - Landing page (hero + 4 below-the-fold sections)
     - Post / page / archive
     - Subscribe form (Ghost Portal-wired)
   ============================================================================= */

/* ----- Tokens ----- */
:root {
    --color-bg: #faf9f6;          /* warm off-white */
    --color-surface: #ffffff;      /* card background */
    --color-text: #1a1a1a;         /* near-black */
    --color-text-muted: #5a5a5a;   /* secondary copy */
    --color-text-subtle: #8a8a8a;  /* dates, eyebrows */
    --color-rule: #e3e0d8;         /* hairline separators */
    --color-accent: #b54224;       /* terracotta -- single accent for CTAs */
    --color-accent-hover: #8e3219;
    --color-link: #1a1a1a;
    --color-link-hover: var(--color-accent);

    --font-serif: "Iowan Old Style", "Apple Garamond", "Baskerville",
                  "Times New Roman", "Droid Serif", Times, serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;

    --container-narrow: 640px;
    --container-default: 880px;
    --container-wide: 1100px;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;

    --radius-sm: 4px;
    --radius-md: 8px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    font-size: 16px;
    line-height: 1.6;
}

body {
    margin: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-serif);
    font-size: 1.0625rem; /* ~17px */
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
    transition: color 120ms ease;
}

a:hover,
a:focus-visible {
    color: var(--color-link-hover);
}

h1, h2, h3, h4 {
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 var(--space-4);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

p {
    margin: 0 0 var(--space-4);
}

ul, ol {
    padding-left: 1.25rem;
}

/* ----- Layout primitives ----- */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1 0 auto;
}

.container {
    width: 100%;
    max-width: var(--container-default);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-5);
    padding-right: var(--space-5);
}

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

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

/* ----- Site header ----- */
.site-header {
    border-bottom: 1px solid var(--color-rule);
    background-color: var(--color-bg);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    padding-top: var(--space-5);
    padding-bottom: var(--space-5);
}

.site-logo {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--color-text);
}

.site-logo-mark {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--color-text);
    border-radius: var(--radius-sm);
}

.site-logo-name {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
}

.site-nav {
    display: flex;
    gap: var(--space-5);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
}

.site-nav a {
    text-decoration: none;
    color: var(--color-text-muted);
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--color-accent);
}

/* ----- Site footer ----- */
.site-footer {
    border-top: 1px solid var(--color-rule);
    margin-top: var(--space-9);
    padding-top: var(--space-7);
    padding-bottom: var(--space-7);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.site-footer-inner {
    text-align: center;
}

.site-footer-tagline {
    margin-bottom: var(--space-4);
}

.site-footer-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-5);
    margin-bottom: var(--space-4);
}

.site-footer-nav a {
    text-decoration: none;
    color: var(--color-text-muted);
}

.site-footer-nav a:hover {
    color: var(--color-accent);
}

.site-footer-copyright {
    color: var(--color-text-subtle);
    margin: 0;
}

/* =============================================================================
   LANDING PAGE
   ============================================================================= */

.landing > section {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
}

.landing > section + section {
    border-top: 1px solid var(--color-rule);
}

/* ----- Hero ----- */
.hero {
    padding-top: var(--space-9);
}

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

.hero-title {
    font-size: clamp(2.25rem, 5vw + 1rem, 3.5rem);
    margin-bottom: var(--space-4);
    letter-spacing: -0.02em;
}

.hero-tagline {
    font-size: 1.1875rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
    max-width: 36rem;
}

.hero-latest {
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-rule);
}

.hero-latest-eyebrow {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-subtle);
    margin-bottom: var(--space-3);
}

.hero-latest-title {
    font-size: 1.5rem;
    margin-bottom: var(--space-3);
}

.hero-latest-title a {
    text-decoration: none;
}

.hero-latest-title a:hover {
    text-decoration: underline;
}

.hero-latest-excerpt {
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

.hero-latest-readmore {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    margin: 0;
}

/* ----- Section heading shared ----- */
.section-heading {
    font-size: 1.625rem;
    margin-bottom: var(--space-6);
    letter-spacing: -0.015em;
}

/* ----- "What's in each issue" ----- */
.sections-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
}

@media (min-width: 700px) {
    .sections-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.section-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

.section-card-title {
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    margin-bottom: var(--space-3);
    color: var(--color-accent);
}

.section-card-body {
    color: var(--color-text-muted);
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ----- Recent issues ----- */
.recent-issues-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-6);
}

.recent-issues-item {
    padding-bottom: var(--space-5);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-rule);
}

.recent-issues-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.recent-issues-date {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-2);
}

.recent-issues-title {
    font-size: 1.25rem;
    margin-bottom: var(--space-3);
}

.recent-issues-title a {
    text-decoration: none;
}

.recent-issues-title a:hover {
    text-decoration: underline;
}

.recent-issues-excerpt {
    color: var(--color-text-muted);
    margin: 0;
    font-size: 0.9375rem;
}

.recent-issues-empty {
    color: var(--color-text-muted);
    font-style: italic;
}

.recent-issues-viewall {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    margin: 0;
}

/* ----- About ----- */
.about-body {
    font-size: 1.0625rem;
    color: var(--color-text-muted);
    max-width: 36rem;
    margin: 0;
}

/* ----- Final CTA ----- */
.final-cta {
    background-color: var(--color-surface);
}

.final-cta-inner {
    max-width: var(--container-narrow);
    text-align: center;
}

.final-cta-heading {
    font-size: 1.875rem;
    margin-bottom: var(--space-3);
    letter-spacing: -0.015em;
}

.final-cta-body {
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}

.final-cta .subscribe-form {
    text-align: left;
}

/* =============================================================================
   SUBSCRIBE FORM
   ============================================================================= */

.subscribe-form {
    margin: 0;
}

.subscribe-form-label {
    /* Visually hidden but available to screen readers; the placeholder
       carries the visual cue for sighted users. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.subscribe-form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

@media (min-width: 520px) {
    .subscribe-form-row {
        flex-direction: row;
        align-items: stretch;
    }
}

.subscribe-form-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-sm);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.subscribe-form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(181, 66, 36, 0.18);
}

.subscribe-form-button {
    flex: 0 0 auto;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--color-accent);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.subscribe-form-button:hover,
.subscribe-form-button:focus-visible {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    outline: none;
}

.subscribe-form-meta {
    margin-top: var(--space-3);
    margin-bottom: 0;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: var(--color-text-subtle);
}

.subscribe-form-success,
.subscribe-form-error {
    margin-top: var(--space-3);
    margin-bottom: 0;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    display: none; /* Ghost Portal toggles via [data-members-success] / [data-members-error] */
}

.subscribe-form-success {
    color: #2a7a4f;
}

.subscribe-form-error {
    color: var(--color-accent);
}

/* =============================================================================
   POST / PAGE / ARCHIVE
   ============================================================================= */

.post,
.page {
    padding-top: var(--space-7);
    padding-bottom: var(--space-7);
}

.post-header,
.page-header {
    margin-bottom: var(--space-6);
    text-align: center;
}

.post-eyebrow {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-subtle);
    margin-bottom: var(--space-3);
}

.post-tag {
    color: var(--color-text-subtle);
    text-decoration: none;
}

.post-tag:hover {
    color: var(--color-accent);
}

.post-title,
.page-title {
    font-size: clamp(1.875rem, 3vw + 1rem, 2.625rem);
    margin-bottom: var(--space-3);
    letter-spacing: -0.02em;
}

.post-subtitle,
.page-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin: 0;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.post-feature-image,
.page-feature-image {
    margin: 0 auto var(--space-7);
}

.post-feature-image img,
.page-feature-image img {
    border-radius: var(--radius-md);
}

.post-feature-image figcaption {
    text-align: center;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--color-text-subtle);
    margin-top: var(--space-3);
}

.post-content,
.page-content {
    font-size: 1.0625rem;
    line-height: 1.75;
}

.post-content h2,
.page-content h2 {
    font-size: 1.5rem;
    margin-top: var(--space-7);
    margin-bottom: var(--space-4);
}

.post-content h3,
.page-content h3 {
    font-size: 1.1875rem;
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
}

.post-content blockquote,
.page-content blockquote {
    border-left: 3px solid var(--color-accent);
    margin-left: 0;
    padding-left: var(--space-5);
    color: var(--color-text-muted);
    font-style: italic;
}

.post-content pre,
.page-content pre {
    background-color: #1a1a1a;
    color: #f5f5f0;
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.post-content code,
.page-content code {
    font-family: var(--font-mono);
    font-size: 0.9375em;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
}

.post-content pre code,
.page-content pre code {
    background: transparent;
    padding: 0;
}

.post-content img,
.page-content img {
    border-radius: var(--radius-sm);
    margin: var(--space-5) auto;
}

/* Koenig editor width helpers -- required by Ghost.
   .kg-width-wide  : break out of the narrow column to a wider rail.
   .kg-width-full  : full viewport width edge-to-edge.
   The viewport-centring trick (margin-left:50% + translateX(-50%)) lets the
   element extend past its parent container without restructuring markup. */
.kg-width-wide {
    position: relative;
    width: min(85vw, var(--container-wide));
    margin-left: 50%;
    transform: translateX(-50%);
}
.kg-width-wide img {
    width: 100%;
    height: auto;
}

.kg-width-full {
    position: relative;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}
.kg-width-full img {
    width: 100%;
    height: auto;
}

.post-footer {
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-rule);
}

.post-author {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-7);
}

.post-cta {
    background-color: var(--color-surface);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    text-align: center;
}

.post-cta-heading {
    font-size: 1.375rem;
    margin-bottom: var(--space-2);
}

.post-cta-body {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    margin-bottom: var(--space-5);
}

.post-cta .subscribe-form {
    text-align: left;
}

/* ----- Archive (/issues/) ----- */
.archive {
    padding-top: var(--space-7);
    padding-bottom: var(--space-7);
}

.archive-header {
    margin-bottom: var(--space-7);
    text-align: center;
}

.archive-title {
    font-size: clamp(1.875rem, 3vw + 1rem, 2.5rem);
    margin-bottom: var(--space-3);
    letter-spacing: -0.02em;
}

.archive-subtitle {
    color: var(--color-text-muted);
    margin: 0;
}

.archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-item {
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--color-rule);
}

.archive-item:last-child {
    border-bottom: none;
}

.archive-item-date {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-2);
}

.archive-item-title {
    font-size: 1.375rem;
    margin-bottom: var(--space-3);
}

.archive-item-title a {
    text-decoration: none;
}

.archive-item-title a:hover {
    text-decoration: underline;
}

.archive-item-excerpt {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    margin: 0;
}

.archive-empty {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
}

/* ----- Pagination (Ghost-rendered) ----- */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-7);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-rule);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
}

.pagination a {
    text-decoration: none;
    color: var(--color-text-muted);
}

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

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

/* =============================================================================
   PRINT
   ============================================================================= */
@media print {
    .site-header,
    .site-footer,
    .subscribe-form,
    .final-cta,
    .post-cta {
        display: none;
    }

    body {
        color: #000;
        background: #fff;
    }
}
