@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&display=swap');

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #333;
    --accent-color: #e74c3c;
    --text-light: #666;
    --background: #faf8f5;
    --white: #ffffff;
    --border-light: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-padding-top: 120px;
}

body {
    font-family: 'Newsreader', serif;
    line-height: 1.6;
    color: var(--primary-color);
    background-color: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

.logo {
    font-size: 1.6rem;
    font-weight: 500;
    text-decoration: none;
    color: #d01216;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    position: relative;
}

.logo img {
    height: 42px;
    width: auto;
    position: relative;
    bottom: 0.2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 400;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    position: relative;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--secondary-color);
    transition: all 0.3s ease;
    position: absolute;
    left: 8px;
}

.hamburger span:nth-child(1) {
    top: 12px;
}

.hamburger span:nth-child(2) {
    top: 19px;
}

.hamburger span:nth-child(3) {
    top: 26px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg);
    top: 19px;
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg);
    top: 19px;
}

.hero {
    padding: 5rem 0;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-content {
    text-align: left;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 350;
    line-height: 1.0;
    margin-bottom: 1.5rem;
    color: rgb(83, 91, 59);
}

.hero p {
    font-size: 1.4rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 0 2rem;
    line-height: 1.4;
}

.hero-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.cta-button {
    display: inline-block;
    padding: 0.50rem 4rem;
    background-color: #d01216;
    color: var(--white);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.cta-button-outline {
    display: inline-block;
    padding: 0.45rem 3rem;
    background-color: transparent;
    color: rgb(83, 91, 59);
    border: 2px solid rgb(83, 91, 59);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.cta-button-outline:hover {
    background-color: rgb(83, 91, 59);
    color: var(--white);
}

.section {
    padding: 4rem 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 3rem;
    text-align: center;
}

.featured-stories-section {
    padding: 4rem 0;
}

.featured-stories-block {
    background-color: #e8e3dc;
    border-radius: 10px;
    padding: 1.5rem 2rem;
}

.featured-left .featured-block-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 1.5rem;
    text-align: left;
}

.featured-stories-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.featured-description {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.featured-story-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.story-card-featured {
    background: linear-gradient(to bottom, #fafafa 0%, #f0f0f0 100%);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Book cover effect with subtle shadow and depth */
    box-shadow: 
        0 1px 1px rgba(0,0,0,0.1),
        0 2px 2px rgba(0,0,0,0.08),
        0 4px 4px rgba(0,0,0,0.06),
        0 8px 8px rgba(0,0,0,0.04),
        0 16px 16px rgba(0,0,0,0.02),
        -3px 0 8px rgba(0,0,0,0.08); /* Left side shadow for depth */
    border: 1px solid rgba(0,0,0,0.08);
    /* Aspect ratio similar to real books */
    aspect-ratio: 2/3;
}

.story-card-featured:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 2px 2px rgba(0,0,0,0.12),
        0 4px 4px rgba(0,0,0,0.10),
        0 8px 8px rgba(0,0,0,0.08),
        0 16px 16px rgba(0,0,0,0.06),
        0 32px 32px rgba(0,0,0,0.04),
        -4px 0 12px rgba(0,0,0,0.10);
}

/* Book spine effect */
.story-card-featured::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, 
        rgba(0,0,0,0.05) 0%, 
        rgba(0,0,0,0.02) 40%, 
        transparent 100%);
    pointer-events: none;
}

.story-thumbnail {
    width: 100%;
    height: 75%;
    background-color: #2c3e50;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    /* Subtle overlay for better text readability if needed */
    isolation: isolate;
}

/* Glossy book cover effect overlay */
.story-thumbnail::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.1) 0%, 
        transparent 40%, 
        rgba(0,0,0,0.05) 100%);
    pointer-events: none;
}

.story-card-featured h3 {
    font-size: 1.1rem;
    margin: 1rem 1.2rem 0.3rem;
    color: var(--primary-color);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.3px;
    text-align: center;
    font-family: 'Newsreader', serif;
    /* Title as main focus like modern book covers */
    flex: 0;
}

.story-card-featured .author {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0 1.2rem 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 400;
    opacity: 0.7;
}

.story-patterns-section {
    padding: 5rem 0;
    background-color: var(--background);
}

.pattern-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 32px;
    margin-top: 3rem;
}

/* Limit to 3 columns max */
@media (min-width: 1400px) {
    .pattern-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.pattern-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 1px solid #f0f0f0;
    text-decoration: none;
    color: var(--primary-color);
    display: block;
}

.pattern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pattern-card-image-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #f0f0f0;
}

.pattern-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pattern-card:hover .pattern-card-image {
    transform: scale(1.05);
}

.pattern-card-content {
    padding: 24px;
}

.pattern-card-content h3 {
    font-family: 'Newsreader', serif;
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
    color: var(--primary-color);
    line-height: 1.3;
}

.feature-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 3rem 0;
}

.chip {
    padding: 0.5rem 1.5rem;
    background-color: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 25px;
    text-decoration: none;
    color: var(--secondary-color);
    transition: all 0.3s ease;
}

.chip:hover {
    background-color: var(--accent-color);
    color: var(--white);
    border-color: var(--accent-color);
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.story-card {
    background-color: var(--white);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px var(--shadow);
    transition: transform 0.3s ease;
}

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

.story-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.story-card p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.story-card .author {
    font-style: italic;
    color: var(--text-light);
    font-size: 0.9rem;
}

footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 3rem 0 2rem;
    margin-top: 5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 400;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: #ccc;
    text-decoration: none;
    line-height: 2;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #444;
    color: #999;
    font-size: 0.9rem;
}

.page-header {
    padding: 3rem 0;
    text-align: center;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
    font-size: 3rem;
    font-weight: 300;
}

.page-content {
    padding: 4rem 0;
    max-width: 800px;
    margin: 0 auto;
}

.page-content h2 {
    font-size: 2rem;
    margin: 2rem 0 1rem;
    font-weight: 400;
}

.page-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

@media (max-width: 768px) {
    .pattern-cards-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .hamburger {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--white);
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

    .nav-links.active {
        max-height: 400px;
        padding: 1rem 0;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        padding: 0;
    }

    .nav-links a {
        display: block;
        padding: 1rem;
        font-size: 1rem;
    }

    nav {
        position: relative;
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-content {
        text-align: center;
        order: 2;
    }
    
    .hero-illustration {
        order: 1;
        margin-bottom: 2rem;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.2rem;
        margin: 0 auto 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .featured-stories-block {
        padding: 2rem;
    }
    
    .featured-block-title {
        font-size: 2rem;
        text-align: center;
    }
    
    .featured-stories-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .featured-left {
        text-align: center;
    }
    
    .featured-story-stack {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Layout */
.page-content-with-sidebar {
    padding: 4rem 0;
}

.page-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: start;
}

.main-content {
    max-width: 800px;
}

.main-content h2 {
    font-size: 2rem;
    margin: 2rem 0 1rem;
    font-weight: 400;
}

.main-content h2:first-child {
    margin-top: 0;
}

.main-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

.sidebar {
    position: sticky;
    top: 120px;
}

.toc {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px var(--shadow);
}

.toc h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 500;
}

.toc ul {
    list-style: none;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

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

/* Mobile responsiveness for sidebar */
@media (max-width: 768px) {
    .page-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .sidebar {
        position: static;
        order: -1;
    }

    .toc {
        margin-bottom: 2rem;
    }
}

/* Inline Illustrations */
.inline-illustration {
    margin: 3rem 0;
    text-align: center;
}

.inline-illustration img {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow);
}

.inline-illustration.transparent {
    margin: 0;
}

.inline-illustration.transparent img {
    width: 100%;
    max-width: 600px;
    height: auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.inline-illustration.full-width img {
    max-width: 100%;
}

.inline-illustration.transparent.full-width {
    margin-bottom: 2rem;
}

/* Footer Character Animation - Easter Egg */
.footer-characters {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
    display: none;
}

.footer-characters.active {
    display: block;
}

.footer-char {
    position: absolute;
    font-size: 24px;
    opacity: 0;
}

.footer-characters.active .footer-char {
    opacity: 0.6;
    animation-name: float-across;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes float-across {
    from {
        transform: translateX(-50px);
    }
    to {
        transform: translateX(calc(100vw + 50px));
    }
}

.char-1 {
    top: 20%;
}

.char-2 {
    top: 45%;
}

.char-3 {
    top: 65%;
}

.char-4 {
    top: 35%;
}

.char-5 {
    top: 55%;
}

footer {
    position: relative;
}

.footer-bottom p {
    cursor: pointer;
    user-select: none;
}