/*
Theme Name: Humanotes Minimal
Theme URI: https://humanotes.co
Author: Çağla A, D.
Geliştirici: Çağla A, D.
Description: A premium, editorial-focused WordPress theme.
Version: 1.0.9
Changelog: 1.0.9 - Spacing system, robust category headers, and premium default cover overlay.
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: humanotes
*/

:root {
    /* --- Premium Editorial Palette (Light) --- */
    --c-bg: #fcfbf9;
    --c-card-bg: #ffffff;
    --c-text: #292929;
    --c-text-light: #757575;
    --c-primary: #1a1a1a;
    --c-accent: #c0392b;
    --c-border: #eaeaea;
    --c-line: #f2f2f2;
    --c-overlay: rgba(255, 255, 255, 0.98);

    /* Shadows */
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);

    /* Typography Fonts */
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;

    /* --- Design System STABILIZATION Layer --- */
    /* Spacing Tokens */
    --hn-space-1: 6px;
    --hn-space-2: 10px;
    --hn-space-3: 14px;
    --hn-space-4: 20px;
    --hn-space-5: 28px;
    --hn-space-6: 40px;

    /* Radius & Borders */
    --hn-radius: 14px;
    --hn-border: 1px solid rgba(0, 0, 0, 0.08);

    /* Typography Scale */
    --hn-title: clamp(1.15rem, 1.1rem + 0.5vw, 1.45rem);
    --hn-body: 1rem;
    --hn-small: 0.92rem;
    --hn-micro: 0.82rem;

    /* Line Heights */
    --hn-lh-title: 1.25;
    --hn-lh-body: 1.55;
    --hn-lh-micro: 1.35;

    /* Legacy Maps (to keep existing partials working for now) */
    --container-max: 1140px;
    --content-max: 720px;
    --radius: 4px;
    /* Legacy radius for buttons etc */
    --radius-card: var(--hn-radius);
    --archive-maxw: 68ch;
    --archive-title-size: clamp(1.75rem, 5vw, 2.25rem);
    --archive-meta-size: 0.85rem;
    --archive-excerpt-lh: 1.7;
    --archive-gap: clamp(3rem, 5vw, 5rem);
}

/* --- Dark Mode Overrides --- */
body.dark-mode {
    --c-bg: #1a1a1a;
    --c-card-bg: #2d2d2d;
    --c-text: #e0e0e0;
    --c-text-light: #a0a0a0;
    --c-primary: #ffffff;
    --c-accent: #e74c3c;
    --c-border: #404040;
    --c-line: #333333;
    --c-overlay: rgba(26, 26, 26, 0.98);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Reset & Basics */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-sans);
    line-height: 1.7;
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-wrap: break-word;
    /* Defensive: Prevent long words/URLs from breaking layout */
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius);
}

/* --- Layout --- */
.site-wrapper {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header --- */
.site-header {
    padding: 3rem 0;
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--c-line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Branding */
.site-branding {
    text-align: left;
}

.site-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1;
}

.site-description {
    display: none;
}

/* Hide description for cleaner look */

/* Nav */
.main-navigation ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-navigation a {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--c-text-light);
}

.main-navigation a:hover {
    color: var(--c-primary);
}

/* Actions */
.site-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.action-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--c-text);
    padding: 0.5rem;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    transform: scale(1.1);
    color: var(--c-accent);
}

/* Dark Mode Icon Logic */
body:not(.dark-mode) .icon-sun {
    display: none;
}

body.dark-mode .icon-moon {
    display: none;
}

/* --- Featured Section (Editors' Picks) --- */
.featured-section {
    margin-bottom: 5rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--c-line);
}

.section-title {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2rem;
    color: var(--c-text-light);
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
    row-gap: var(--space-5);
    align-items: stretch;
    column-count: initial;
    columns: initial;
    column-gap: initial;
}

.featured-card {
    transition: transform 0.2s;
}

.featured-card:hover {
    transform: translateY(-5px);
}

.featured-cat {
    display: block;
    font-size: 0.75rem;
    color: var(--c-accent);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.featured-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    color: var(--c-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-meta {
    font-size: 0.85rem;
    color: var(--c-text-light);
}

.featured-link {
    display: grid;
    gap: 0.9rem;
    color: inherit;
    text-decoration: none;
}

.featured-media {
    margin-bottom: 0.1rem;
}

/* --- Homepage Grid --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
    row-gap: var(--space-5);
    margin-bottom: 5rem;
    align-items: stretch;
    column-count: initial;
    columns: initial;
    column-gap: initial;
}

.category-card {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--c-line);
}

.category-grid>.category-card:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.category-card-header {
    margin: 0;
    padding: 0;
    border: 0;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.section-head__title {
    min-width: 0;
    flex: 1 1 auto;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.section-head__count {
    flex: 0 0 auto;
    white-space: nowrap;
    opacity: 0.7;
}

.category-title {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1 1 auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-post-list {
    list-style: none;
    display: grid;
    gap: var(--space-5);
    row-gap: var(--space-5);
    grid-auto-rows: 1fr;
    align-items: stretch;
    column-count: initial;
    columns: initial;
    column-gap: initial;
}

.category-post-list li {
    margin: 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--c-line);
    height: 100%;
}

.category-post-list li:last-child {
    border: none;
    padding: 0;
}

.post-title {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.3rem;
    display: block;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.post-date {
    font-size: 0.8rem;
    color: var(--c-text-light);
    font-style: italic;
    line-height: 1.4;
    min-height: 1.4em;
}

.post-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-card__media {
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1px solid var(--c-line);
    background: var(--c-card-bg);
    flex-shrink: 0;
    position: relative;
    margin-bottom: var(--space-2);
}

.post-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f6f1e9 0%, #fffdf8 55%, #f0ebe2 100%);
}

.post-card__badge {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-text-light);
    border: 1px solid var(--c-border);
    background: rgba(255, 255, 255, 0.8);
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
}

.post-card__content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0.4rem;
    padding-top: 0;
    height: clamp(8.25rem, 11vw, 9.5rem);
}

.post-excerpt {
    font-size: 0.95rem;
    color: var(--c-text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3em;
}

.post-card__meta {
    margin-top: auto;
    padding-top: 0.4rem;
}

.post-card__excerpt--empty {
    visibility: hidden;
}

.post-card__media.is-default-cover .post-card__cover-title {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(252, 251, 249, 0.78);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
    color: rgba(20, 20, 20, 0.92);
    font-family: var(--hn-heading-font);
    font-weight: var(--hn-heading-weight);
    letter-spacing: var(--hn-heading-tracking);
    line-height: var(--hn-heading-leading);
    font-size: 1.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.view-all-link {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Single Post --- */
.post-article {
    max-width: var(--content-max);
    margin: 0 auto 5rem;
}

.entry-header {
    text-align: center;
    margin-bottom: 3rem;
}

.entry-meta {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--c-text-light);
    margin-bottom: 1rem;
}

.entry-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    line-height: 1.15;
    margin-bottom: 1rem;
    color: var(--c-primary);
}

.entry-content {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.8;
}

.entry-content p {
    margin-bottom: 1.8rem;
}

.entry-content h2,
.entry-content h3 {
    font-family: var(--font-sans);
    font-weight: 700;
    margin: 3rem 0 1rem;
    color: var(--c-primary);
}

/* --- Single Post Typography (Micro) --- */
.entry-content ul,
.entry-content ol {
    margin: 2rem 0;
    padding-left: 2rem;
}

.entry-content li {
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
}

.entry-content hr {
    border: 0;
    height: 1px;
    background: var(--c-line);
    margin: 4rem auto;
    width: 60%;
}

.entry-content blockquote {
    font-size: 1.4rem;
    font-style: italic;
    color: var(--c-primary);
    border-left: 3px solid var(--c-accent);
    padding: 1rem 1.5rem;
    margin: 3rem 0;
    background: rgba(0, 0, 0, 0.02);
    /* Very subtle bg */
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* --- Table of Contents --- */
.humanotes-toc {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0 3rem;
    display: inline-block;
    min-width: 300px;
    max-width: 100%;
}

.toc-title {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 1rem 0 !important;
    /* Override entry content h3 margin */
    color: var(--c-text-light) !important;
}

.toc-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.toc-item {
    margin-bottom: 0.5rem !important;
    font-size: 0.95rem;
    padding-left: 0 !important;
}

.toc-level-3 {
    padding-left: 1.5rem !important;
    font-size: 0.9rem;
}

.toc-item a {
    color: var(--c-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.toc-item a:hover {
    color: var(--c-accent);
    border-bottom-color: var(--c-accent);
}

/* --- Like / Save Button --- */
.humanotes-like-container {
    text-align: center;
    margin: 4rem 0;
}

.like-btn {
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: 50px;
    padding: 0.8rem 2rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--c-text);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.like-icon {
    font-size: 1.2rem;
    color: var(--c-text-light);
    transition: color 0.2s ease;
}

.like-btn:hover {
    border-color: var(--c-accent);
    color: var(--c-accent);
}

.like-btn:hover .like-icon {
    color: var(--c-accent);
}

.like-btn.liked {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: #fff;
}

.like-btn.liked .like-icon {
    color: #fff;
}

/* --- Series Box --- */
.humanotes-series-box {
    background: var(--c-bg);
    border: 1px solid var(--c-primary);
    padding: 1.5rem;
    margin: 3rem 0;
    font-family: var(--font-sans);
}

.series-label {
    display: block;
    font-size: 0.85rem;
    color: var(--c-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    text-align: center;
}

.series-label strong {
    color: var(--c-primary);
}

.series-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.series-link {
    max-width: 40%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--c-primary);
    font-weight: 500;
}

.series-link.disabled {
    color: var(--c-border);
}

.series-count {
    color: var(--c-text-light);
    font-size: 0.8rem;
}

/* --- Post Navigation --- */
.post-navigation {
    max-width: var(--content-max);
    margin: 4rem auto;
    border-top: 1px solid var(--c-line);
    padding-top: 2rem;
}

.nav-links {
    display: flex;
    justify-content: space-between;
}

.nav-previous,
.nav-next {
    max-width: 45%;
}

.nav-previous a,
.nav-next a {
    display: flex;
    flex-direction: column;
}

.meta-nav {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--c-text-light);
    margin-bottom: 0.25rem;
    letter-spacing: 1px;
}

.post-navigation .post-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--c-primary);
    transition: color 0.2s;
}

.post-navigation a:hover .post-title {
    color: var(--c-accent);
}

/* --- Footer --- */
.site-footer {
    padding: 4rem 0;
    border-top: 1px solid var(--c-border);
    margin-top: auto;
    text-align: center;
    font-size: 0.9rem;
    color: var(--c-text-light);
}

.site-footer a {
    font-weight: 500;
    color: var(--c-text);
}

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

/* --- Archive & Category Templates (Micro-Typography) --- */
.archive .post-article {
    max-width: var(--archive-maxw);
    margin: 0 auto;
    padding-bottom: 3rem;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--c-line);
    text-align: left;
    /* Reset center from single */
}

/* Clear vertical rhythm */
/* 
 * =========================================
/* 
/* 
 * =========================================
 * PHASE 2: HUMANOTES DESIGN SYSTEM (SCOPED)
 * =========================================
 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * DO NOT MODIFY THIS BLOCK.
 * LOCKED FOR PRODUCTION STABILITY.
 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * 
 * STRICTLY SCOPED to .hn-home (The Homepage)
 * Uses .hn-* prefix for all components.
 */

/* Phase 2: Design Tokens (Scoped Application) */
.hn-home {
    /* Ensure clean slate for homepage container */
    width: 100%;
    margin: 0 auto;
    padding-bottom: 4rem;

    /* Typographic Locks (Homepage Only) */
    --hn-title: clamp(1.15rem, 1.1rem + 0.5vw, 1.45rem);
    --hn-body: 1rem;
    --hn-small: 0.92rem;
    --hn-micro: 0.82rem;

    /* Line Height Locks */
    --hn-lh-title: 1.18;
    --hn-lh-body: 1.55;
    --hn-lh-micro: 1.35;
}

/* Phase 3.2: Section Spacing Contract */
.hn-home .hn-section {
    position: relative;
    width: 100%;
    margin-top: var(--hn-space-6);
    /* 40px */
    margin-bottom: var(--hn-space-5);
    /* 28px */
}

.hn-home .hn-section:first-child {
    margin-top: 0;
}

/* Phase 3.1: Professional Header Row */
.hn-home .hn-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--hn-space-3);
    /* 14px */
    padding-bottom: var(--hn-space-2);
    margin-bottom: var(--hn-space-4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.hn-home .hn-section__title {
    font-family: var(--font-sans);
    font-size: var(--hn-small);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-primary);
    margin: 0;
    min-width: 0;
    flex: 1 1 auto;
}

.hn-home .hn-section__count {
    font-family: var(--font-sans);
    font-size: var(--hn-micro);
    color: var(--c-text-light);
    white-space: nowrap;
    flex: 0 0 auto;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
    /* Tabular numbers as requested */
}

.hn-home .hn-section__head a {
    color: inherit;
    text-decoration: none;
}

/* Phase 3.3: Grid System (Contract) */
.hn-home .hn-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    /* STRICT 32px breathing room */
    width: 100%;
    align-items: stretch;
}

/* Phase 2: Card Component (Scoped) */
.hn-home .hn-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    transition: transform 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.hn-home .hn-card:hover {
    transform: translateY(-3px);
}

.hn-home .hn-card__media {
    display: block;
    aspect-ratio: 4/3;
    width: 100%;
    border-radius: var(--hn-radius);
    overflow: hidden;
    margin-bottom: var(--hn-space-2);
    border: var(--hn-border);
    background-color: var(--c-line);
    position: relative;
    z-index: 1;
}

.hn-home .hn-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
    border-radius: 0;
    /* Neutralize bleed: ensure inner img has no extra radius */
}

.hn-home .hn-card:hover .hn-card__media img {
    transform: scale(1.03);
}

/* Phase 4.2: Default Cover Overlay (Glass Panel) */
/* Renders ONLY when .is-default-cover is present */
.hn-home .hn-card__media.is-default-cover .hn-defaultcover__brand {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    padding: 12px 14px;
    /* Slightly more breathe */
    border-radius: 12px;

    background: rgba(252, 251, 249, 0.86);
    /* Paper glass */
    backdrop-filter: blur(8px);

    color: #2b2b2b;
    /* Charcoal, not black */
    font-family: var(--font-serif);
    font-weight: 700;
    letter-spacing: normal;
    line-height: var(--hn-lh-title);
    font-size: 1.25rem;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Card Content & Type Scale (Phase 4.3) */
.hn-home .hn-card__content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: var(--hn-space-1);
}

.hn-home .hn-card__kicker {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    /* Hard floor */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-accent);
    margin-bottom: 2px;
    display: block;
}

.hn-home .hn-card__title {
    font-family: var(--font-serif);
    font-size: var(--hn-title);
    font-weight: 700;
    line-height: var(--hn-lh-title);
    color: var(--c-primary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hn-home .hn-card:hover .hn-card__title {
    color: var(--c-accent);
}

.hn-home .hn-card__excerpt {
    font-family: var(--font-sans);
    font-size: 0.96rem;
    /* Readable body */
    line-height: var(--hn-lh-body);
    color: var(--c-text-light);
    margin: 4px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hn-home .hn-card__meta {
    margin-top: auto;
    padding-top: var(--hn-space-2);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--c-text-light);
    opacity: 0.8;
}

/* Phase 5: Mobile & Responsiveness */
@media (max-width: 900px) {
    .hn-home .hn-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--hn-space-4);
    }
}

@media (max-width: 720px) {
    .hn-home .hn-section__head {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {

    /* Full width on mobile */
    .hn-home .hn-grid {
        grid-template-columns: 1fr;
        gap: var(--hn-space-5);
        /* 28px */
    }

    /* Phase 5: Mobile 'Editor's Picks' Horizontal Scroll */
    .hn-home .hn-section.editor-picks .hn-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 1.5rem;
        /* Space for shadow/scroll */
        gap: 16px;
        /* Hide scrollbar roughly */
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .hn-home .hn-section.editor-picks .hn-grid::-webkit-scrollbar {
        display: none;
    }

    .hn-home .hn-section.editor-picks .hn-card {
        min-width: 78vw;
        /* Tuned to ~78vw */
        max-width: 78vw;
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    .hn-home .hn-section.editor-picks .hn-card__title {
        font-size: 1.3rem;
        /* Good size for mobile */
    }
}

.archive .entry-title {
    font-size: var(--archive-title-size);
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

.archive .entry-title a {
    color: var(--c-primary);
    text-decoration: none;
    background-image: linear-gradient(var(--c-accent), var(--c-accent));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size .3s;
}

.archive .entry-title a:hover {
    background-size: 100% 2px;
    color: var(--c-primary);
    /* Keep text black, underline red */
}

.archive .entry-meta {
    font-size: var(--archive-meta-size);
    margin-bottom: 1rem;
    color: var(--c-text-light);
    font-family: var(--font-sans);
}

.archive .entry-content {
    font-size: 1.05rem;
    /* Slightly smaller than single */
    line-height: var(--archive-excerpt-lh);
    color: #444;
    /* Soften from pure black */
}

.archive .read-more {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Reading Progress --- */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--c-accent);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s;
}

/* --- Related Posts --- */
.related-posts {
    margin-top: 6rem;
    padding-top: 4rem;
    padding-bottom: 2rem;
    /* Spacing before footer */
    border-top: 1px solid var(--c-primary);
    /* Stronger separation */
}

.related-title {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2rem;
    color: var(--c-text-light);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.related-card {
    background: var(--c-card-bg);
    /* Subtle if different from bg */
}

.related-cat {
    font-size: 0.75rem;
    color: var(--c-accent);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.related-post-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.related-meta {
    font-size: 0.8rem;
    color: var(--c-text-light);
}

/* --- Editorial Library Template --- */
.library-template {
    max-width: var(--container-max);
    /* Wider container for toolbar */
}

/* Header & Toolbar */
.library-header {
    text-align: center;
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--c-line);
}

.library-toolbar {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.library-search-field,
.library-filter select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--c-text);
    min-width: 200px;
}

.library-filter select {
    cursor: pointer;
    appearance: none;
    /* Custom arrow if needed, mostly browser default is robust */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.65rem auto;
    padding-right: 2.5rem;
}

/* List Layout */
.library-content {
    max-width: var(--archive-maxw);
    margin: 0 auto;
}

.library-list {
    list-style: none;
}

.library-item {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--c-line);
}

.library-item:last-child {
    border: none;
}

.library-item-title {
    font-family: var(--font-sans);
    /* Clean sans for list view */
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.library-item-title a {
    color: var(--c-primary);
}

.library-item-meta {
    font-size: 0.85rem;
    color: var(--c-text-light);
    margin-bottom: 0.75rem;
    font-family: var(--font-sans);
}

.library-item-excerpt {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--c-text);
}

.library-pagination {
    margin-top: 4rem;
    text-align: center;
}

.library-pagination .page-numbers {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.library-pagination .current {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

/* --- Search Overlay --- */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--c-overlay);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.search-container {
    text-align: center;
    width: 100%;
    max-width: 800px;
    padding: 2rem;
}

.search-field {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--c-text-light);
    font-family: var(--font-serif);
    font-size: 3rem;
    color: var(--c-primary);
    padding: 1rem 0;
    outline: none;
    text-align: center;
}

.search-field::placeholder {
    color: var(--c-border);
}

.search-submit {
    display: none;
}

/* Hide button, rely on enter */
.search-instruction {
    margin-top: 1rem;
    color: var(--c-text-light);
}

.search-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    font-size: 3rem;
    cursor: pointer;
    color: var(--c-text);
}

/* --- Breadcrumbs --- */
.site-breadcrumbs {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-text-light);
    margin-bottom: 1.5rem;
    text-align: center;
}

.site-breadcrumbs a {
    border-bottom: 1px solid transparent;
}

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

.site-breadcrumbs .current {
    color: var(--c-text);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1024px) {

    .category-grid,
    .related-grid,
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-header {
        flex-direction: column;
        gap: 2rem;
    }

    .entry-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 720px) {
    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-head__count {
        margin-top: -6px;
    }
}

@media (max-width: 640px) {

    .category-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .category-post-list {
        gap: 24px;
    }

    .featured-grid {
        display: flex;
        gap: 16px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        grid-template-columns: none;
    }

    .featured-card {
        min-width: 76vw;
        max-width: 76vw;
        scroll-snap-align: start;
    }

    .featured-cat {
        font-size: 0.7rem;
        letter-spacing: 0.5px;
        color: var(--c-text-light);
        text-transform: none;
    }

    .featured-title {
        font-size: 1.2rem;
        -webkit-line-clamp: 2;
    }

    .featured-meta {
        font-size: 0.8rem;
        color: var(--c-text-light);
    }

    .search-field {
        font-size: 2rem;
    }
}