/*
Theme Name: Hemingway 2026
Theme URI: https://alittlestupid.com
Description: A modernized, rebuilt version of the classic Hemingway Reloaded theme for 2026.
Version: 1.1.0
Author: alittlestupid
*/
:root {
    --bg-color: #ffffff;
    --text-color: #222222;
    --text-light: #666666;
    --header-bg: #111111;
    --header-text: #ffffff;
    --accent: #d93025;
    --border: #e8e8e8;
    --code-bg: #1e1e1e;
    --code-text: #e0e0e0;
    --code-border: #333333;
    --font-main: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "Fira Code", Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
    --container: 1000px;
}

/* Dark mode variables */
html[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --text-light: #a0a0a0;
    --header-bg: #000000;
    --header-text: #ffffff;
    --accent: #ff6b6b;
    --border: #2a2a2a;
    --code-bg: #0a0a0a;
    --code-text: #e0e0e0;
    --code-border: #2a2a2a;
}

/* Modern base */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body { font-family: var(--font-main); color: var(--text-color); margin: 0; background: var(--bg-color); line-height: 1.6; transition: background-color 0.2s ease, color 0.2s ease; }

/* Selection */
::selection { background: var(--accent); color: #fff; }

/* Focus */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Skip link */
.skip-link:not(:focus) {
    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:focus {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: var(--accent);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 4px 4px;
    font-weight: 700;
    text-decoration: none;
}
a { color: var(--text-color); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

/* Header */
.site-header { background: var(--header-bg); color: var(--header-text); padding: clamp(3rem, 8vw, 6rem) 2rem; text-align: center; position: relative; }
.site-header .site-title a:focus-visible { outline-color: #fff; }
.site-header a { color: var(--header-text); text-decoration: none; }
.site-title { font-size: clamp(2rem, 6vw, 4.5rem); margin: 0; font-weight: 800; letter-spacing: -0.05em; line-height: 1.1; }
.site-description { font-size: clamp(1rem, 2vw, 1.25rem); opacity: 0.7; margin-top: 1rem; font-weight: 300; }

/* Dark mode toggle button */
.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--header-text);
    font-size: 1.25rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    padding: 0;
    line-height: 1;
}
.theme-toggle:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

/* Layout */
.container { max-width: var(--container); margin: 0 auto; padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem); }

/* Screen-reader-only utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }

/* Two-column Stories (Index) */
.twocol-stories { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 3rem; }
.story { display: flex; flex-direction: column; }
.story h3 { font-size: 1.75rem; margin: 0 0 1rem; line-height: 1.2; letter-spacing: -0.02em; }
.story h3 a { text-decoration: none; }
.entry-summary { flex-grow: 1; color: var(--text-light); }
.story .details { font-size: 0.85rem; color: var(--text-light); margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.05em; }

/* Single */
.single-story { max-width: 800px; margin: 0 auto; }
.single-story h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; margin-bottom: 0.5rem; letter-spacing: -0.03em;}
.single-story .details { font-size: 0.9rem; color: var(--text-light); margin-bottom: 2rem; text-transform: uppercase; letter-spacing: 0.05em; }
.entry-content p { margin-bottom: 1.5rem; font-size: 1.125rem; }

/* Code blocks / source code */
.entry-content pre,
.entry-content .source-code-block {
    background: var(--code-bg);
    color: var(--code-text);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre;
    word-wrap: normal;
    tab-size: 4;
}
.entry-content pre code,
.source-code-block code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    white-space: pre;
}
.entry-content code {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}
.entry-content pre::-webkit-scrollbar { height: 8px; }
.entry-content pre::-webkit-scrollbar-track { background: transparent; }
.entry-content pre::-webkit-scrollbar-thumb { background: var(--code-border); border-radius: 4px; }

/* Footer (Ancillary) */
.site-footer { background: var(--header-bg); color: var(--header-text); padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem); margin-top: 2rem; }
.ancillary { max-width: var(--container); margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: clamp(1.5rem, 3vw, 3rem); }
.ancillary h4 { margin-top: 0; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.1em; border-bottom: 1px solid rgba(255,255,255,0.15); padding-bottom: 1rem; margin-bottom: 1.5rem; color: #aaa; }
.ancillary p, .ancillary ul { font-size: 0.9rem; color: #888; }
.ancillary a { color: #ccc; text-decoration: none; }
.ancillary a:hover, .ancillary a:focus-visible { color: #fff; }
.ancillary a:focus-visible { outline-color: #fff; }
.ancillary ul { list-style: none; padding: 0; margin: 0; }
.ancillary li { margin-bottom: 0.75rem; }

/* Print */
@media print {
    .site-header, .site-footer, .theme-toggle, .pagination, .skip-link { display: none !important; }
    body { background: #fff; color: #000; }
    a { text-decoration: underline; color: #000; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
    .container { max-width: 100%; padding: 0; }
    .entry-content pre { white-space: pre-wrap; word-break: break-word; border: 1px solid #ccc; background: #f5f5f5; }
}

/* Comments */
.comments-area { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); }

/* Pagination */
.pagination { margin-top: 4rem; display: flex; gap: 1rem; font-size: 0.9rem; font-weight: bold; }
.pagination .nav-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.pagination a { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 4px; text-decoration: none; transition: border-color 0.2s, background-color 0.2s; }
.pagination a:hover, .pagination a:focus-visible { border-color: var(--accent); background: rgba(217,48,37,0.05); }
.pagination .current { padding: 0.5rem 1rem; border: 1px solid var(--accent); border-radius: 4px; background: var(--accent); color: #fff; }

/* Block editor alignments (for classic theme with block support) */
.alignwide { max-width: var(--container); margin-left: auto; margin-right: auto; }
.alignfull { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.wp-block-image img, .wp-block-video video { max-width: 100%; height: auto; }
