/* ==========================================================================
   Joe Denman Theme — theme.css
   Color palette: white + near-black + warm amber accent
   Typography: Lora (serif headings) + Inter (body)
   ========================================================================== */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-text-light: #555555;
    --color-accent: #A0622E;
    --color-accent-hover: #7D4D24;
    --color-accent-light: #F5EDE6;
    --color-border: #e0e0e0;
    --color-bg-alt: #f8f6f3;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Lora', Georgia, 'Times New Roman', serif;
    --container-width: 1140px;
    --container-narrow: 760px;
    --header-height: 72px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-accent-hover);
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* ---------- Utility ---------- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container--narrow {
    max-width: var(--container-narrow);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-accent {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.btn-accent:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.btn-outline:hover {
    background: var(--color-accent);
    color: #fff;
}

.btn-lg {
    padding: 1rem 2.25rem;
    font-size: 1.05rem;
}

/* ---------- Header ---------- */
.site-header {
    position: relative;
    top: 0;
    z-index: 1000;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.site-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.site-logo:hover {
    color: var(--color-accent);
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-list li a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s, color 0.2s;
}

.nav-list li a:hover,
.nav-list li.current-menu-item a,
.nav-list li.current_page_item a,
.nav-list li.current-menu-parent a {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* Hamburger */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 5px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    transition: transform 0.3s, opacity 0.3s;
}

/* ---------- Page Hero ---------- */
.page-hero {
    padding: 4rem 0 3rem;
    text-align: center;
    background: var(--color-bg-alt);
}

.page-hero h1 {
    margin-bottom: 0.5rem;
}

.page-hero-sub {
    font-size: 1.1rem;
    color: var(--color-text-light);
}

/* ---------- Home: Hero ---------- */
.hero {
    padding: 5rem 0;
    background: var(--color-bg-alt);
    position: relative;
    overflow: hidden;
}

/* Ambient center glow — always visible */
.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(160, 98, 46, 0.06) 0%, transparent 50%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

/* Interactive glow orb — follows mouse with spring physics */
.hero-glow {
    position: absolute;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(160, 98, 46, 0.07) 0%,
        rgba(160, 98, 46, 0.06) 10%,
        rgba(160, 98, 46, 0.05) 20%,
        rgba(160, 98, 46, 0.04) 35%,
        rgba(160, 98, 46, 0.025) 50%,
        rgba(160, 98, 46, 0.015) 65%,
        rgba(160, 98, 46, 0.008) 80%,
        transparent 100%
    );
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 0;
    filter: blur(60px);
    opacity: 1;
    animation: jd-glow-pulse 8s ease-in-out infinite;
    transition: filter 1s ease, background 1s ease;
}

/* Intensify on hover */
.hero:hover .hero-glow {
    filter: blur(50px);
    background: radial-gradient(circle,
        rgba(160, 98, 46, 0.1) 0%,
        rgba(160, 98, 46, 0.09) 10%,
        rgba(160, 98, 46, 0.07) 20%,
        rgba(160, 98, 46, 0.055) 35%,
        rgba(160, 98, 46, 0.04) 50%,
        rgba(160, 98, 46, 0.025) 65%,
        rgba(160, 98, 46, 0.012) 80%,
        transparent 100%
    );
}

@keyframes jd-glow-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.03); }
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    line-height: 1.15;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--color-accent);
    font-weight: 500;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
    font-style: italic;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--color-text-light);
    margin-bottom: 2rem;
    line-height: 1.8;
}

/* Book cover placeholder */
.book-cover-placeholder {
    background: linear-gradient(145deg, #2c2c2c 0%, #1a1a1a 100%);
    aspect-ratio: 2/3;
    max-width: 320px;
    margin: 0 auto;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.book-cover-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid var(--color-accent);
    border-radius: 4px;
    margin: 12px;
    opacity: 0.4;
}

.placeholder-inner {
    text-align: center;
    padding: 2rem;
    color: #fff;
}

.placeholder-title {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.placeholder-subtitle {
    display: block;
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.8;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.placeholder-author {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    color: var(--color-accent);
}

.placeholder-note {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.5;
}

.book-cover-img {
    max-width: 320px;
    margin: 0 auto;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* ---------- Home: Author Intro ---------- */
.author-intro {
    padding: 5rem 0;
}

.author-intro-inner {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    align-items: center;
}

.author-intro-photo img {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.author-intro-content h2 {
    margin-bottom: 1rem;
}

.author-intro-content p {
    font-size: 1.1rem;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* ---------- Home: Signup ---------- */
.site-signup {
    padding: 5rem 0;
    background: var(--color-bg-alt);
}

.signup-block {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.signup-block h2 {
    margin-bottom: 0.75rem;
}

.signup-block p {
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
}

/* Signup form (shared between home and footer) */
.signup-form {
    display: flex;
    gap: 0.75rem;
    max-width: 480px;
    margin: 0 auto;
}

.signup-form input[type="email"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.signup-form input[type="email"]:focus {
    border-color: var(--color-accent);
}

.signup-note {
    font-size: 0.8rem;
    color: var(--color-text-light);
    opacity: 0.7;
    margin-top: 0.75rem;
}

/* ---------- About ---------- */
.about-content {
    padding: 4rem 0;
}

.about-inner {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 3rem;
    align-items: start;
}

.about-photo img {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: calc(var(--header-height) + 2rem);
}

.about-bio p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

.about-bio p:last-child {
    margin-bottom: 0;
}

/* ---------- Book Page ---------- */
.book-layout {
    padding: 4rem 0;
}

.book-layout-inner {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 3rem;
    align-items: start;
}

.book-layout-cover {
    position: sticky;
    top: 2rem;
    align-self: start;
}

.admin-bar .book-layout-cover {
    top: calc(32px + 2rem);
}

.book-cover-placeholder--large {
    max-width: 320px;
}

.book-cover-placeholder--large .placeholder-title {
    font-size: 1.6rem;
}

.book-purchase-sticky {
    margin-top: 1.5rem;
}

.purchase-logos {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.purchase-logo {
    display: block;
    flex: 1;
    color: var(--color-text);
    opacity: 0.55;
    transition: opacity 0.2s;
}

.purchase-logo:hover {
    opacity: 1;
}

.purchase-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 28px;
    object-fit: contain;
}

.purchase-note {
    font-size: 0.8rem;
    color: var(--color-text-light);
    font-style: italic;
    margin-top: 0.75rem;
}

.book-main-title {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.book-main-subtitle {
    font-size: 1.15rem;
    font-family: var(--font-heading);
    font-style: italic;
    color: var(--color-accent);
    margin-bottom: 2rem;
}

.book-description {
    margin-bottom: 2.5rem;
}

.book-description p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* Inline highlights */
.book-highlights-inline {
    margin-bottom: 2.5rem;
}

.book-highlights-inline h3 {
    margin-bottom: 1rem;
}

.highlights-list {
    list-style: none;
    text-align: left;
}

.highlights-list li {
    padding: 1rem 0 1rem 2rem;
    border-bottom: 1px solid var(--color-border);
    position: relative;
    font-size: 1.05rem;
}

.highlights-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.35rem;
    width: 10px;
    height: 10px;
    background: var(--color-accent);
    border-radius: 50%;
}

.highlights-list li:last-child {
    border-bottom: none;
}

/* TOC Accordion */
.book-toc-inline {
    margin-bottom: 2.5rem;
}

.book-toc-inline h3 {
    margin-bottom: 0.5rem;
}

.toc-intro {
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.toc-accordion {
    border-top: 1px solid var(--color-border);
}

.toc-item {
    border-bottom: 1px solid var(--color-border);
}

.toc-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.85rem 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    color: var(--color-text);
    transition: color 0.2s;
}

.toc-trigger:hover {
    color: var(--color-accent);
}

.toc-chevron {
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--color-text-light);
    margin-left: 1rem;
    transition: transform 0.2s;
}

.toc-trigger[aria-expanded="true"] .toc-chevron {
    transform: rotate(180deg);
}

.toc-panel {
    padding: 0 0 1rem 1rem;
}

.toc-panel p {
    color: var(--color-text-light);
    font-size: 0.9rem;
    line-height: 1.7;
}

.book-resources-cta {
    margin-top: 1rem;
}

/* ---------- Resources ---------- */
.resources-content {
    padding: 4rem 0;
}

.resources-nav {
    max-width: 500px;
    margin: 0 auto 2.5rem;
}

.appendix-select {
    width: 100%;
    padding: 0.85rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.appendix-select:focus {
    border-color: var(--color-accent);
}

.appendix-panel h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-accent);
}

.appendix-body {
    line-height: 1.8;
}

.appendix-body p {
    margin-bottom: 1rem;
}

.appendix-default {
    text-align: center;
    color: var(--color-text-light);
    padding: 3rem 0;
    font-size: 1.1rem;
}

/* ---------- Blog ---------- */
.blog-listing {
    padding: 4rem 0;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.post-card {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.post-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.post-card-thumb img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.post-card-body {
    padding: 1.5rem;
}

.post-card-date {
    font-size: 0.8rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-card-title {
    font-size: 1.25rem;
    margin: 0.5rem 0 0.75rem;
}

.post-card-title a {
    color: var(--color-text);
}

.post-card-title a:hover {
    color: var(--color-accent);
}

.post-card-excerpt {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.post-card-link {
    font-weight: 600;
    font-size: 0.9rem;
}

.pagination {
    margin-top: 3rem;
    text-align: center;
}

/* ---------- Single Post ---------- */
.single-post-header {
    padding: 4rem 0 3rem;
    background: var(--color-bg-alt);
    text-align: center;
}

.single-post-date {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.single-post-content {
    padding: 3rem 0;
}

.single-post-content p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

.single-post-content h2,
.single-post-content h3 {
    margin: 2rem 0 1rem;
}

.single-post-content blockquote {
    border-left: 3px solid var(--color-accent);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: var(--color-bg-alt);
    font-style: italic;
}

.single-post-content ul,
.single-post-content ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.single-post-content li {
    margin-bottom: 0.5rem;
}

.single-post-featured {
    margin-bottom: 2rem;
}

.single-post-featured img {
    border-radius: 8px;
}

/* Post nav */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding-bottom: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.post-nav-link {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.post-nav-label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-nav-title {
    font-weight: 600;
    color: var(--color-accent);
}

.post-nav-next {
    text-align: right;
    margin-left: auto;
}

/* ---------- Default Content ---------- */
.default-content {
    padding: 3rem 0 5rem;
}

.default-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* ---------- Footer ---------- */
.site-footer {
    background: #ece8e2;
    color: var(--color-text-light);
    padding: 2rem 0 1.5rem;
}

.footer-bottom {
    text-align: center;
    font-size: 0.85rem;
}

.footer-bottom p {
    margin-bottom: 0;
}

.footer-publisher a {
    color: var(--color-accent);
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }

    /* Mobile nav */
    .menu-toggle {
        display: flex;
    }

    .primary-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--color-bg);
        display: none;
        z-index: 999;
    }

    .primary-nav.is-open {
        display: block;
    }

    .admin-bar .primary-nav {
        top: calc(var(--header-height) + 32px);
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
    }

    .nav-list li {
        border-bottom: 1px solid var(--color-border);
    }

    .nav-list li a {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        border-bottom: none;
    }

    /* Hamburger animation */
    .menu-toggle.is-active .hamburger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .menu-toggle.is-active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.is-active .hamburger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Hero */
    .hero {
        padding: 3rem 0;
    }

    .hero-glow {
        width: 400px;
        height: 400px;
        animation: jd-glow-drift 12s ease-in-out infinite;
    }

    @keyframes jd-glow-drift {
        0%   { top: 30%; left: 20%; }
        25%  { top: 50%; left: 70%; }
        50%  { top: 20%; left: 60%; }
        75%  { top: 60%; left: 30%; }
        100% { top: 30%; left: 20%; }
    }

    .hero-inner {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }

    .hero-title {
        font-size: 2.25rem;
    }

    .hero-book {
        order: -1;
    }

    .book-cover-placeholder,
    .book-cover-img {
        max-width: 240px;
    }

    /* Author intro */
    .author-intro-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .author-intro-photo {
        max-width: 250px;
        margin: 0 auto;
    }

    /* About */
    .about-inner {
        grid-template-columns: 1fr;
    }

    .about-photo {
        max-width: 280px;
        margin: 0 auto;
    }

    .about-photo img {
        position: static;
    }

    /* Book */
    .book-layout-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .book-layout-cover {
        position: static;
        max-width: 280px;
        margin: 0 auto;
    }

    .book-cover-placeholder--large {
        max-width: 280px;
    }

    .book-layout-content {
        text-align: left;
    }

    .purchase-logos {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        max-width: 200px;
        margin: 0 auto;
    }

    /* Blog */
    .posts-grid {
        grid-template-columns: 1fr;
    }

    /* Signup form */
    .signup-form {
        flex-direction: column;
    }

    /* Post nav */
    .post-nav {
        flex-direction: column;
    }

    .post-nav-next {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }

    .btn-lg {
        padding: 0.85rem 1.5rem;
        font-size: 1rem;
    }
}

/* ---------- Admin bar offset for mobile ---------- */
@media (max-width: 782px) {
    .admin-bar .primary-nav {
        top: calc(var(--header-height) + 46px);
    }

    .admin-bar .book-layout-cover {
        top: calc(46px + 2rem);
    }
}
