/*
Theme Name: Editorial Network
Description: Clean editorial reading experience for GeneratePress sites. Configurable typography and palette, single-column posts, whitespace-first design.
Version: 1.2.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Template: generatepress
License: Proprietary
Text Domain: editorial-network
*/

/* ── Design tokens ───────────────────────────────────────────────────────
   This file is now byte-identical across every site in the network. All
   per-site variation is three constants in functions.php (EN_PALETTE,
   EN_TYPE, EN_ACCENT) — EN_PALETTE picks a class below, EN_ACCENT is
   injected as --en-accent via an inline <style> block in wp_head. Nothing
   in here should ever need hand-editing per site again. ──────────────── */

:root {
    --en-font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --homey-accent: var(--en-accent, #8a7a63);

    /* Headings default to the body font, which is what every EN_TYPE did
       before pairing existed. Every .en-t-* class below restates this
       literally rather than deferring with var(--en-font), because a
       `--en-font-display: var(--en-font)` written here would resolve
       against :root's --en-font (Montserrat) and inherit that computed
       value downward — the type classes sit on <body>, so their override
       lands too late to be seen. That silently reverts every slab/grotesk
       site's headings to Montserrat. Keep these literal. */
    --en-font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Previously hardcoded on `body` and the heading rule. Lifted to tokens
       so a palette can carry its own ink; defaults are the old literals. */
    --homey-text: #2e3236;
    --homey-heading: #1a1a1a;

    /* Bylines, dates, reading time. #888 was the long-standing literal, and
       it fails WCAG AA at the 13-14px it is actually used at: 3.37:1 on a
       white-ish card against the 4.5:1 small-text floor. Kept as the default
       so this release stays a no-op elsewhere — flipping it here fixes the
       whole network in one line. */
    --homey-muted: #888;
}

.en-t-slab {
    --en-font: 'Roboto Slab', Georgia, Cambria, 'Times New Roman', serif;
    --en-font-display: 'Roboto Slab', Georgia, Cambria, 'Times New Roman', serif;
}

.en-t-grotesk {
    --en-font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --en-font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* The one type that pairs two families: a display serif over a sans body.
   Requires fonts/editorial.css, which ships both as variable woff2. */
.en-t-editorial {
    --en-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --en-font-display: 'Literata', Georgia, Cambria, 'Times New Roman', serif;
}

/* The global -0.02em on h1 is tuned for the tight-set grotesks. Literata is
   a serif with generous sidebearings and already-connected rhythm; the same
   negative tracking collapses its serifs into each other at display sizes. */
.en-t-editorial h1,
.en-t-editorial .entry-title {
    letter-spacing: -0.005em;
}

/* Palette: clay — warm off-white, soft radius, gentle shadow (the original
   1.0.x default look, kept as the baseline). */
.en-p-clay {
    --homey-bg: #f7f5f1;
    --homey-card-bg: #fffdfa;
    --homey-border: #ece7dd;
    --homey-radius: 10px;
    --homey-radius-lg: 12px;
    --homey-shadow: 0 1px 3px rgba(30, 20, 10, 0.05);
}

/* Palette: anodize — cool, flat, hairline borders, no shadow. */
.en-p-anodize {
    --homey-bg: #f2f4f6;
    --homey-card-bg: #ffffff;
    --homey-border: #dde2e7;
    --homey-radius: 4px;
    --homey-radius-lg: 6px;
    --homey-shadow: none;
}

/* Palette: fieldbook — warm paper tone, generous radius. */
.en-p-fieldbook {
    --homey-bg: #f7f2e7;
    --homey-card-bg: #fffcf4;
    --homey-border: #e8dcc0;
    --homey-radius: 14px;
    --homey-radius-lg: 16px;
    --homey-shadow: 0 1px 2px rgba(60, 45, 10, 0.06);
}

/* Palette: signal — near-white, high contrast, deeper shadow. */
.en-p-signal {
    --homey-bg: #fafafa;
    --homey-card-bg: #ffffff;
    --homey-border: #e4e4e4;
    --homey-radius: 16px;
    --homey-radius-lg: 20px;
    --homey-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Palette: shopfloor — utilitarian, square corners, solid border, flat. */
.en-p-sandstone {
    --homey-bg: #f5f0ea;
    --homey-card-bg: #faf9f7;
    --homey-border: #e8ddd1;
    --homey-radius: 12px;
    --homey-radius-lg: 16px;
    --homey-shadow: 0 1px 3px rgba(74, 59, 42, 0.06);

    /* Neutral-gray ink reads cold and slightly dirty against a cream
       ground — the warm paper needs warm ink to look intentional. */
    --homey-text: #33302b;
    --homey-heading: #1f1f1f;
    /* 4.99:1 on the card, 4.64:1 on the page ground — clears AA everywhere
       it lands, and stays warm enough to read as muted rather than as body. */
    --homey-muted: #726b63;

    /* GeneratePress owns more surface than this stylesheet does: the header,
       nav, sidebar widgets, footer and every link outside .entry-content are
       all painted from GP's own global colors, which are still on its cool
       stock defaults (--base-3 #ffffff, --base-2 #f7f8f9, --accent #1e73be).
       The --homey-* tokens above cannot reach them, so a warm palette that
       only sets --homey-* lands as warm cards floating in a cold shell —
       white header, white sidebar, blue links.
       
       GP declares these on :root and this class sits on <body>, so
       redefining them here wins for the whole document without touching
       generate_settings in the DB. That keeps the palette a pure theme-file
       concern and keeps this stylesheet byte-identical across the network.
       No other palette does this — the other five are near enough to GP's
       stock neutrals that they never needed it. */
    --base:       #e8ddd1;
    --base-2:     #f5f0ea;
    --base-3:     #faf9f7;
    --contrast:   #1f1f1f;
    --contrast-2: #6e665c;
    --contrast-3: #b8ada0;
    --accent:     var(--homey-accent);
}

.en-p-shopfloor {
    --homey-bg: #eef0f1;
    --homey-card-bg: #ffffff;
    --homey-border: #c7cdd1;
    --homey-radius: 2px;
    --homey-radius-lg: 2px;
    --homey-shadow: none;
}

/* ── Base Typography ────────────────────────────────────────────────── */

body {
    font-family: var(--en-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--homey-text);
    background-color: var(--homey-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Headings ───────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6,
.entry-title {
    font-family: var(--en-font-display);
    color: var(--homey-heading);
}

h1, .entry-title {
    font-size: 40px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.entry-content h2 {
    font-size: 32px;
    line-height: 1.3;
    font-weight: 600;
    margin-top: 2em;
    margin-bottom: 0.75em;
    padding-bottom: 0.35em;
    border-bottom: 1px solid var(--homey-border);
}

.entry-content h3 {
    font-size: 24px;
    line-height: 1.25;
    font-weight: 600;
    margin-top: 1.75em;
    margin-bottom: 0.5em;
}

.entry-content h4 {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

/* ── Body Content ───────────────────────────────────────────────────── */

.entry-content {
    line-height: 1.75;
}

.entry-content p {
    margin-bottom: 1.5em;
    font-weight: 400;
}

.entry-content > p:first-of-type {
    font-size: 1.07em;
    color: #333;
}

.entry-content a {
    color: var(--homey-accent);
    text-decoration-color: var(--homey-border);
}

.entry-content a:hover {
    color: var(--homey-heading);
    text-decoration-color: var(--homey-accent);
}

.entry-content blockquote {
    font-family: Georgia, Cambria, 'Times New Roman', Times, serif;
    font-size: 1.08em;
    font-style: italic;
    line-height: 1.6;
    background: var(--homey-bg);
    border-left: 3px solid var(--homey-accent);
    border-radius: 0 6px 6px 0;
    margin: 1.5em 0;
    padding: 0.5em 1.5em;
    color: #555;
}

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.entry-content li {
    margin-bottom: 0.5em;
}

.entry-content img {
    border-radius: 4px;
}

/* ── Single Post Layout ─────────────────────────────────────────────── */

.editorial-single .site-content .content-area {
    max-width: 720px;
    margin: 0 auto;
    float: none;
}

.editorial-single .inside-article {
    padding: 44px 40px;
    border-radius: var(--homey-radius-lg);
}

.editorial-single .entry-header {
    margin-bottom: 2em;
}

.editorial-single .entry-meta {
    font-size: 14px;
    color: var(--homey-muted);
    margin-top: 0.75em;
    font-family: Georgia, Cambria, 'Times New Roman', Times, serif;
    font-style: italic;
    letter-spacing: 0.01em;
}

/* Scoped to .en-byline specifically, not the shared .entry-meta class —
   that class is also on the unrelated footer categories/tags block, and a
   flex layout change there would be a landmine.
   Deliberately NOT scoped under .editorial-single: en_byline() renders on
   archive/index loop items too (generate_after_entry_header fires there),
   and .editorial-single is only added to <body> on single-post views — so
   scoping under it left the avatar unstyled (square, native size) on every
   listing page. */
.en-byline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}

.en-byline .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* GP's single-post featured image wrapper is .featured-image (verified
   live — the theme never had a .post-image on singles; that class only
   exists in GP's archive-loop markup, see Archive Cards below). */
.editorial-single .featured-image {
    margin-bottom: 2em;
}

.editorial-single .featured-image img {
    width: 100%;
    height: auto;
    border-radius: var(--homey-radius);
}

/* ── Reading Time Badge ─────────────────────────────────────────────── */

.en-reading-time {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    color: var(--homey-muted);
    letter-spacing: 0.02em;
    margin-top: 0.5em;
    font-family: Georgia, Cambria, 'Times New Roman', Times, serif;
    font-style: italic;
}

/* ── Header / Branding ──────────────────────────────────────────────── */
/* When a custom logo image already contains the site name, GeneratePress
   still renders a separate "main-title" text link next to it, which reads
   as a duplicated site name (most noticeable on mobile where the header
   stacks/compresses). Visually hide the redundant text link but keep it
   in the markup for accessibility/SEO — it only ever applies on sites
   that actually have a custom logo set (site-logo + site-branding are
   only adjacent siblings in that case), so this is a no-op everywhere
   else. */

.site-logo + .site-branding .main-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Navigation ─────────────────────────────────────────────────────── */

.main-navigation,
.main-navigation .main-nav ul li a {
    font-family: var(--en-font);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.02em;
}

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

.en-footer-archives {
    padding: 30px 0;
    border-top: 1px solid var(--homey-border);
    text-align: center;
    font-size: 13px;
    color: #595959;
    background-color: var(--homey-card-bg);
    border-radius: var(--homey-radius-lg) var(--homey-radius-lg) 0 0;
}

.en-footer-archives-title {
    font-weight: 600;
    color: var(--homey-text);
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.en-footer-archives-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
}

.en-footer-archives-list a {
    color: #666;
    text-decoration: none;
}

.en-footer-archives-list a:hover {
    color: var(--homey-text);
    text-decoration: underline;
}

.en-footer-archives-list .count {
    color: #595959;
    font-size: 12px;
}

/* ── Author Bio Widget ──────────────────────────────────────────────── */

.en-bio {
    text-align: center;
}

.en-bio img {
    border-radius: 50%;
    margin-bottom: 12px;
}

.en-bio strong {
    display: block;
    font-family: var(--en-font);
    font-size: 15px;
    margin-bottom: 6px;
}

.en-bio p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* ── Buttons (sandstone only) ───────────────────────────────────────── */
/* GP hardcodes button fills as a literal #55555e rather than a global, so
   unlike every other surface it survives the --base/--contrast remap above
   and leaves a cool-gray slab (the search button, mainly) sitting in a warm
   palette. Scoped to this palette so the other five keep GP's stock gray.
   White on #7E6549 is 5.46:1. */
.en-p-sandstone button,
.en-p-sandstone html input[type="button"],
.en-p-sandstone input[type="reset"],
.en-p-sandstone input[type="submit"],
.en-p-sandstone a.button,
.en-p-sandstone a.wp-block-button__link:not(.has-background) {
    background-color: var(--homey-accent);
    color: #fff;
}

.en-p-sandstone button:hover,
.en-p-sandstone input[type="submit"]:hover,
.en-p-sandstone a.button:hover {
    background-color: var(--homey-heading);
    color: #fff;
}

/* ── Plugin overrides (sandstone only) ──────────────────────────────── */
/* The cross-promo and infinite-scroll strings come from the
   editorial-network *plugin* stylesheet, which hardcodes #999 — 2.71:1 on
   white at 11-12px, the worst contrast on the page. Overridden here rather
   than in the plugin because the plugin ships to all 28 sites and this
   release is scoped to one; a two-class selector beats the plugin's single
   class regardless of stylesheet order. The plugin's own #999 is still
   worth fixing network-wide as a separate change. */
.en-p-sandstone .en-cross-promo__label,
.en-p-sandstone .en-cross-promo__site,
.en-p-sandstone .en-infinite-scroll-end {
    color: var(--homey-muted);
}

/* ── Archive/Homepage Cards ─────────────────────────────────────────── */

.site-content .inside-article {
    border-bottom: 1px solid #f0f0f0;
    background-color: var(--homey-card-bg);
    border: 1px solid var(--homey-border);
    border-radius: var(--homey-radius);
    box-shadow: var(--homey-shadow);
    margin-bottom: 24px;
    padding: 28px 28px 8px;
}

/* Real GP archive-loop markup (verified live on the blog index) — a plain
   .post-image wrapper, unscoped, distinct from .featured-image on singles.
   The old stylesheet had this under .editorial-single, which never matches
   an archive page and never matched anything. */
.post-image {
    margin-bottom: 1em;
}

.post-image img {
    width: 100%;
    height: auto;
    border-radius: var(--homey-radius);
}

/* ── Sidebar Tweaks (archive/home pages) ────────────────────────────── */

.widget-area .widget {
    font-family: var(--en-font);
    font-size: 14px;
}

.widget-area .widget-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--homey-text);
}

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    h1, .entry-title {
        font-size: 28px;
    }

    .entry-content h2 {
        font-size: 24px;
    }

    .entry-content h3 {
        font-size: 20px;
    }

    .editorial-single .inside-article {
        padding: 28px 20px;
    }

    .site-content .inside-article {
        padding: 20px 18px 4px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    body,
    .entry-content p,
    .entry-content li {
        font-size: 18px !important;
        line-height: 1.75 !important;
    }

    h1, .entry-title {
        font-size: 26px;
    }

    .entry-content h2 {
        font-size: 22px;
    }

    .entry-content h3 {
        font-size: 19px;
    }

    .entry-content h4 {
        font-size: 17px;
    }
}
