/* Danish Modern Warmth — editorial web design */

/* Reset and base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables — warm, comfortable system */
:root {
    /* Light mode colors — Danish warm palette */
    --color-paper: #f9f7f4;
    --color-text: #2d2d2d;
    --color-text-secondary: #6b6b6b;
    --color-border: #e7e3dc;
    --color-accent: #3d5a4f;
    --color-surface: #ffffff;
    
    /* Spacing scale — looser, more generous */
    --space-1: 0.5rem;   /* 8px */
    --space-2: 1rem;     /* 16px */
    --space-3: 1.5rem;   /* 24px */
    --space-4: 2rem;     /* 32px */
    --space-5: 2.5rem;   /* 40px */
    --space-6: 3rem;     /* 48px */
    --space-7: 3.5rem;   /* 56px */
    --space-8: 4rem;     /* 64px */
    --space-10: 5rem;    /* 80px */
    --space-12: 6rem;    /* 96px */
    --space-14: 7rem;    /* 112px */
    --space-16: 8rem;    /* 128px */
    --space-20: 10rem;   /* 160px */
    
    /* Typography scale — comfortable reading sizes */
    --text-xs: 0.875rem;    /* 14px */
    --text-sm: 0.9375rem;   /* 15px */
    --text-base: 1.125rem;  /* 18px */
    --text-lg: 1.375rem;    /* 22px */
    --text-xl: 1.625rem;    /* 26px */
    --text-2xl: 2.125rem;   /* 34px */
    --text-3xl: 2.75rem;    /* 44px */
    --text-4xl: 3.25rem;    /* 52px */
    
    /* Line heights — generous for warmth */
    --leading-tight: 1.3;
    --leading-snug: 1.45;
    --leading-normal: 1.65;
    --leading-relaxed: 1.75;
    
    /* Layout constraints */
    --width-text: 68ch;
    --width-container: 1080px;
    --border-width: 1px;
    --border-radius: 2px;
}

/* Dark mode colors — warm, easy on the eyes */
[data-theme="dark"] {
    --color-paper: #1a1816;
    --color-text: #e8e6e3;
    --color-text-secondary: #a8a6a3;
    --color-border: #2d2b28;
    --color-accent: #7fa690;
    --color-surface: #221f1c;
}

/* Typography — warm, readable system */
body {
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--color-text);
    background-color: var(--color-paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
}

h1, h2, h3 {
    font-weight: 500;
    line-height: var(--leading-snug);
    letter-spacing: -0.01em;
}

h1 {
    font-size: var(--text-4xl);
    font-weight: 400;
    letter-spacing: -0.015em;
}

h2 {
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: var(--text-xl);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

h3 {
    font-size: var(--text-2xl);
    font-weight: 400;
    line-height: var(--leading-tight);
}

/* Accessibility — skip link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--color-text);
    color: var(--color-paper);
    padding: var(--space-2) var(--space-3);
    text-decoration: none;
    z-index: 100;
    font-size: var(--text-sm);
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

.skip-link:focus {
    top: var(--space-2);
    left: var(--space-2);
    clip: auto;
    clip-path: none;
    overflow: visible;
    white-space: normal;
}

/* Container — centered, comfortable */
.container {
    max-width: var(--width-container);
    margin: 0 auto;
    padding: 0 var(--space-5);
}

/* Site navigation */
.site-nav {
    padding: var(--space-5) 0;
    border-bottom: var(--border-width) solid var(--color-border);
}

.site-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.site-logo:hover {
    opacity: 0.6;
}

.site-logo:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

.site-logo-img {
    height: 40px;
    width: auto;
}

.site-logo-img-light {
    display: block;
}

.site-logo-img-dark {
    display: none;
}

[data-theme="dark"] .site-logo-img-light {
    display: none;
}

[data-theme="dark"] .site-logo-img-dark {
    display: block;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-family: inherit;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.theme-toggle:hover {
    border-color: var(--color-text-secondary);
    color: var(--color-text);
}

.theme-toggle:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.theme-toggle-icon {
    font-size: var(--text-base);
    line-height: 1;
}

/* Header and Hero */
header {
    padding: var(--space-20) 0 var(--space-14);
    border-bottom: var(--border-width) solid var(--color-border);
}

.hero {
    max-width: var(--width-text);
}

.hero h1 {
    margin-bottom: var(--space-4);
}

.hero .subline {
    font-size: var(--text-lg);
    font-weight: 400;
    margin-bottom: var(--space-7);
    line-height: var(--leading-snug);
    color: var(--color-text);
}

.hero .supporting {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-10);
    max-width: 60ch;
}

/* Book page specific styles */
.book-series {
    font-size: var(--text-sm);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
}

.book-meta {
    margin-top: var(--space-8);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    font-style: italic;
}

/* CTA — invitational, not assertive */
.cta {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--color-accent);
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 2px;
    transition: opacity 0.2s ease;
}

.cta:hover {
    opacity: 0.7;
}

.cta:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

/* Sections — generous breathing room */
section {
    padding: var(--space-14) 0;
    border-bottom: var(--border-width) solid var(--color-border);
}

section:last-of-type {
    border-bottom: none;
}

section h2 {
    margin-bottom: var(--space-8);
}

/* Text blocks — book page feeling */
.text-block {
    max-width: var(--width-text);
}

.text-block p {
    margin-bottom: var(--space-5);
    line-height: var(--leading-relaxed);
}

.text-block p:last-child {
    margin-bottom: 0;
}

.intro {
    font-weight: 400;
    font-size: var(--text-lg);
    margin-bottom: var(--space-6);
    line-height: var(--leading-normal);
    color: var(--color-text);
}

/* Lists — gentle, readable */
ul {
    list-style: none;
    max-width: var(--width-text);
}

ul li {
    padding-left: var(--space-4);
    position: relative;
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
}

ul li:before {
    content: "·";
    position: absolute;
    left: var(--space-2);
    color: var(--color-text-secondary);
    font-size: var(--text-lg);
}

ul li:last-child {
    margin-bottom: var(--space-4);
}

/* Books section — catalogue feeling */
.books {
    scroll-margin-top: var(--space-4);
}

.book-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-10);
    margin-top: var(--space-10);
}

@media (min-width: 768px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-8);
    }
}

/* Book cards — catalogue entries */
.book-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    transition: border-color 0.3s ease;
}

.book-card:hover {
    border-color: var(--color-text-secondary);
}

/* Book covers — simple printed title pages */
.book-cover {
    aspect-ratio: 5 / 7;
    background: var(--color-paper);
    border-bottom: var(--border-width) solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    position: relative;
}

/* Book cover images */
img.book-cover {
    width: 100%;
    height: auto;
    object-fit: cover;
    padding: 0;
    display: block;
}

.book-cover-title {
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: var(--text-4xl);
    font-weight: 300;
    letter-spacing: -0.01em;
    color: var(--color-text);
    text-align: center;
    line-height: var(--leading-tight);
}

/* Hats cover — simple typographic treatment */
.book-cover-hats {
    background: linear-gradient(to bottom, var(--color-paper) 0%, #f5f2ed 100%);
}

.book-cover-hats .book-cover-title {
    font-style: italic;
}

/* Tea cover — quiet border accent */
.book-cover-tea {
    background: var(--color-surface);
    border: 8px solid var(--color-paper);
    border-bottom-width: 1px;
}

.book-cover-tea .book-cover-title {
    font-style: italic;
}

/* Book info — comfortable reading space */
.book-info {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: var(--color-surface);
}

.book-info h3 {
    line-height: var(--leading-snug);
    margin-bottom: var(--space-2);
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: var(--text-xl);
}

.book-subtitle {
    font-size: var(--text-sm);
    font-style: italic;
    color: var(--color-text-secondary);
    line-height: var(--leading-normal);
    margin-bottom: var(--space-1);
}

.book-description {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    flex-grow: 1;
    color: var(--color-text);
}

/* Book links — gentle invitation */
.book-link {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-accent);
    text-decoration: none;
    margin-top: var(--space-4);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--color-accent);
    align-self: flex-start;
    transition: opacity 0.2s ease;
}

.book-link:hover {
    opacity: 0.7;
}

.book-link:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

/* Footer — quiet, restful */
footer {
    padding: var(--space-14) 0 var(--space-10);
    border-top: var(--border-width) solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

footer p {
    margin-bottom: var(--space-3);
    line-height: var(--leading-relaxed);
}

footer p:last-of-type {
    margin-bottom: var(--space-6);
}

.footer-links {
    display: flex;
    gap: var(--space-5);
}

.footer-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    border-bottom: var(--border-width) solid transparent;
    transition: border-color 0.2s ease;
    font-size: var(--text-sm);
}

.footer-links a:hover {
    border-bottom-color: var(--color-text-secondary);
}

.footer-links a:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Focus states — always visible */
*:focus {
    outline-color: var(--color-accent);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Responsive — maintain warmth at all sizes */
@media (max-width: 767px) {
    :root {
        --text-4xl: 2.5rem;
        --text-3xl: 2rem;
        --text-2xl: 1.75rem;
        --space-20: 7rem;
        --space-14: 5rem;
    }
    
    header {
        padding: var(--space-14) 0 var(--space-10);
    }
    
    section {
        padding: var(--space-10) 0;
    }
    
    .container {
        padding: 0 var(--space-4);
    }
    
    .book-info {
        padding: var(--space-5);
    }
    
    .book-cover {
        padding: var(--space-6);
    }
    
    .site-logo-img {
        height: 32px;
    }
}

@media (max-width: 480px) {
    :root {
        --text-4xl: 2rem;
        --text-3xl: 1.75rem;
    }
    
    .container {
        padding: 0 var(--space-3);
    }
    
    .site-logo-img {
        height: 24px;
    }
}
