/*
Theme Name: James E Hamelton Jr
Theme URI: https://jamesehameltonjr.com
Author: James E. Hamelton Jr
Description: Single-page style author hub theme for James E. Hamelton Jr with books, story worlds, reading guide and schema.org support.
Version: 1.0.0
License: GPL-2.0-or-later
Text Domain: jameseh
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

/* THEME COLORS */
:root {
    --bg: #f5f8ff;
    --text: #171923;
    --accent: #3658ff;
    --accent-soft: rgba(54, 88, 255, 0.1);
    --card-bg: #ffffff;
    --border: #dde3f0;
    --nav-bg: rgba(245, 248, 255, 0.9);
    --shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #050711;
        --text: #e2e8f0;
        --accent: #7aa5ff;
        --accent-soft: rgba(122, 165, 255, 0.12);
        --card-bg: #101321;
        --border: #22263a;
        --nav-bg: rgba(5, 7, 17, 0.9);
        --shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.6);
    }
}

body.dark-mode {
    --bg: #050711;
    --text: #e2e8f0;
    --accent: #7aa5ff;
    --accent-soft: rgba(122, 165, 255, 0.12);
    --card-bg: #101321;
    --border: #22263a;
    --nav-bg: rgba(5, 7, 17, 0.9);
    --shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.6);
}

.wrapper {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* NAVIGATION */
nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(16px);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    padding-bottom: 2px;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.2s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#themeToggle {
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text);
    padding: 0.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: color 0.25s, background 0.25s, border 0.25s;
}

#themeToggle:hover {
    background: var(--accent-soft);
    border-color: var(--border);
}

#menuToggle {
    display: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.4rem 0.45rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

#menuToggle:hover {
    background: var(--accent-soft);
    border-color: var(--border);
}

/* HERO */
.hero {
    padding: 3.5rem 0 2.5rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
    gap: 2.5rem;
    align-items: center;
}

.hero-copy h1 {
    font-size: 2.3rem;
    margin-bottom: 0.6rem;
}

.hero-copy h2 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.hero-copy p {
    margin-top: 0.8rem;
    max-width: 34rem;
    font-size: 1.02rem;
}

.hero-actions {
    margin-top: 1.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn {
    border-radius: 999px;
    border: none;
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7b4dff);
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.hero-badge-row {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    font-size: 0.85rem;
}

.hero-badge {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.5);
}

body.dark-mode .hero-badge {
    background: rgba(0, 0, 0, 0.2);
}

/* Hero card and image */
.hero-visual {
    position: relative;
}

.hero-card {
    background: radial-gradient(circle at top, var(--accent-soft), var(--card-bg));
    border-radius: 1.4rem;
    padding: 1.3rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    max-width: 360px;
    margin: 0 auto;
}

.hero-avatar {
    width: 100%;
    border-radius: 1rem;
    background: linear-gradient(135deg, #10193a, #111827);
    aspect-ratio: 4 / 5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.9rem;
    text-align: center;
    padding: 0.75rem;
    overflow: hidden;
}

.hero-avatar img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    object-fit: contain;
}

/* SECTIONS */
.section {
    padding: 2.5rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 1.6rem;
}

.section-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.section-title {
    font-size: 1.6rem;
}

/* ABOUT */
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.2fr);
    gap: 2rem;
}

.about-grid p {
    font-size: 0.98rem;
}

.about-points {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-top: 0.6rem;
}

.about-points div {
    background: var(--card-bg);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    padding: 0.75rem 0.9rem;
    font-size: 0.9rem;
}

/* BOOK GRID */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.7rem;
}

.book-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.book-cover {
    width: 100%;
    height: 310px;
    background: linear-gradient(135deg, #020617, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5f5;
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* Cover image scaling: keep full image in view, text readable */
.book-cover img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    image-rendering: auto;
}

.book-body {
    padding: 0.9rem 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.book-meta {
    font-size: 0.8rem;
    opacity: 0.75;
}

.book-links {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.book-links a {
    text-decoration: none;
    color: var(--accent);
}

/* STORY WORLDS */
.worlds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.4rem;
}

.world-card {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-soft);
    font-size: 0.95rem;
}

.world-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    margin-bottom: 0.5rem;
}

/* READING GUIDE */
.guide-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr);
    gap: 1.75rem;
    align-items: start;
}

.guide-card {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-soft);
    font-size: 0.93rem;
}

.guide-list {
    margin-top: 0.5rem;
    list-style: none;
}

.guide-list li {
    margin-bottom: 0.4rem;
}

/* LINKS SECTION */
.links-section {
    background: radial-gradient(circle at top, var(--accent-soft), transparent);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.3rem;
    margin-top: 1rem;
}

.link-item {
    background: var(--card-bg);
    border-radius: 0.9rem;
    border: 1px solid var(--border);
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
}

.link-item a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

/* CONTACT */
.contact-card {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.contact-icons {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 0.9rem;
}

.contact-icons a {
    font-size: 1.1rem;
    color: var(--accent);
    text-decoration: none;
}

/* FOOTER */
footer {
    padding: 2rem 1.25rem;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.75;
}

/* MODAL */
.book-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1500;
}

.book-modal-backdrop.active {
    display: flex;
}

.book-modal {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 1.2rem 1.3rem;
    max-width: 640px;
    width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-soft);
}

/* Images inside modals: keep them in view, readable */
.book-modal img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    margin: 0 auto 1rem;
    object-fit: contain;
}

.book-modal-close {
    text-align: right;
    margin-bottom: 0.5rem;
}

.book-modal-close button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .hero {
        padding-top: 2.5rem;
    }
}

@media (max-width: 768px) {
    #menuToggle {
        display: inline-flex;
    }
    .nav-links {
        position: fixed;
        inset: 3.3rem 1rem auto 1rem;
        flex-direction: column;
        background: var(--card-bg);
        border-radius: 0.9rem;
        border: 1px solid var(--border);
        box-shadow: var(--shadow-soft);
        padding: 0.7rem 0.9rem;
        display: none;
    }
    .nav-links.nav-open {
        display: flex;
    }
    .hero-grid,
    .about-grid,
    .guide-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* General content images safety net */
.entry-content img,
.page-content img {
    max-width: 100%;
    height: auto;
}
