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

@font-face {
    font-family: "Fragmenta Logo";
    src: url("/static/Fragmenta-IBMPlexSans-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --color-bg: #0f0f0f;
    --color-text: #f0f0f0;
    --color-muted: #a0a0a0;
    --color-subtle: #606060;
    --color-dim: #555555;
    --color-border: #1e1e1e;
    --color-heading-muted: #e0e0e0;
    --color-inline-link: #c0c0c0;
    --color-button-bg: #ffffff;
    --color-button-bg-hover: #e0e0e0;
    --color-button-text: #0f0f0f;
    --color-toggle-bg: #181818;
    --color-toggle-bg-hover: #222222;
    --color-toggle-border: #303030;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --color-bg: #fafafa;
        --color-text: #151515;
        --color-muted: #555555;
        --color-subtle: #747474;
        --color-dim: #6a6a6a;
        --color-border: #e3e3e3;
        --color-heading-muted: #303030;
        --color-inline-link: #303030;
        --color-button-bg: #151515;
        --color-button-bg-hover: #343434;
        --color-button-text: #ffffff;
        --color-toggle-bg: #ffffff;
        --color-toggle-bg-hover: #f1f1f1;
        --color-toggle-border: #d3d3d3;
    }
}

:root[data-theme="light"] {
    color-scheme: light;
    --color-bg: #fafafa;
    --color-text: #151515;
    --color-muted: #555555;
    --color-subtle: #747474;
    --color-dim: #6a6a6a;
    --color-border: #e3e3e3;
    --color-heading-muted: #303030;
    --color-inline-link: #303030;
    --color-button-bg: #151515;
    --color-button-bg-hover: #343434;
    --color-button-text: #ffffff;
    --color-toggle-bg: #ffffff;
    --color-toggle-bg-hover: #f1f1f1;
    --color-toggle-border: #d3d3d3;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Nav */
header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-border);
}

nav {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.25rem;
    margin-left: auto;
}

.nav-links a {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--color-text);
}

.logo {
    font-family: "Fragmenta Logo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text);
    text-decoration: none;
}

.theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-toggle-border);
    border-radius: 999px;
    background: var(--color-toggle-bg);
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
    background: var(--color-toggle-bg-hover);
    border-color: var(--color-muted);
}

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

.theme-icon {
    width: 1.05rem;
    height: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon--sun {
    display: none;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .theme-icon--sun {
        display: block;
    }

    :root:not([data-theme="dark"]) .theme-icon--moon {
        display: none;
    }
}

:root[data-theme="light"] .theme-icon--sun {
    display: block;
}

:root[data-theme="light"] .theme-icon--moon {
    display: none;
}

:root[data-theme="dark"] .theme-icon--sun {
    display: none;
}

:root[data-theme="dark"] .theme-icon--moon {
    display: block;
}

/* Hero */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
}

.hero {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    padding: 6rem 2rem 4rem;
}

.hero h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1.25rem;
}

.tagline {
    font-size: 1.125rem;
    color: var(--color-muted);
    margin-bottom: 2.5rem;
}

.cta-button {
    display: inline-block;
    padding: 0.85rem 2rem;
    background: var(--color-button-bg);
    color: var(--color-button-text);
    text-decoration: none;
    font-weight: 600;
    border-radius: 6px;
    transition: background 0.2s;
}

.cta-button:hover {
    background: var(--color-button-bg-hover);
}

/* Why section */
.why {
    padding: 4rem 2rem;
    border-top: 1px solid var(--color-border);
}

.why-grid {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.why-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.why-card p {
    font-size: 0.95rem;
    color: var(--color-muted);
    line-height: 1.6;
}

/* Contact section */
.contact {
    text-align: center;
    padding: 5rem 2rem;
    border-top: 1px solid var(--color-border);
}

.contact h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.contact p {
    font-size: 1rem;
    color: var(--color-muted);
    margin-bottom: 2rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 2rem;
    font-size: 0.875rem;
    color: var(--color-dim);
    border-top: 1px solid var(--color-border);
}

.footer-nav {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.footer-nav a {
    color: var(--color-dim);
    text-decoration: none;
}

.footer-nav a:hover {
    color: var(--color-muted);
}

/* Legal pages (Impressum, Datenschutz) */
.legal {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1rem;
    line-height: 1.7;
}

.legal h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
}

.legal h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    color: var(--color-heading-muted);
}

.legal p,
.legal ul {
    color: var(--color-muted);
    margin-bottom: 0.75rem;
}

.legal ul {
    padding-left: 1.5rem;
}

/* Blog list */
.blog-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.blog-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    gap: 0 1rem;
}

.blog-list a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    align-self: center;
}

.blog-list a:hover {
    text-decoration: underline;
}

.post-excerpt {
    grid-column: 1 / -1;
    color: var(--color-subtle);
    font-size: 0.9rem;
    margin: 0.35rem 0 0;
    line-height: 1.5;
}

.legal .post-excerpt--article {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--color-subtle);
    margin: 0.5rem 0 2rem;
    line-height: 1.6;
}

.post-date {
    color: var(--color-subtle);
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Individual post */
.post-meta {
    color: var(--color-subtle);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

article.legal h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 2rem;
    color: var(--color-text);
}

article.legal h1:not(:first-of-type) {
    margin-top: 3.5rem;
}

article.legal h2 {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
    margin-top: 3rem;
    margin-bottom: 0.85rem;
    color: var(--color-text);
}

article.legal .post-excerpt--article+h2 {
    margin-top: 0;
}

article.legal h3 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    margin-top: 1.8rem;
    margin-bottom: 0.4rem;
    color: var(--color-heading-muted);
}

article.legal h4 {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    margin-top: 1.35rem;
    margin-bottom: 0.3rem;
    color: var(--color-muted);
}

article.legal h5 {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.4;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    color: var(--color-subtle);
}

.rss-link {
    font-size: 0.875rem;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

.rss-link a {
    color: var(--color-subtle);
    text-decoration: none;
}

.rss-link a:hover {
    color: var(--color-text);
}

/* Inline links inside blog post body */
article.legal a {
    color: var(--color-inline-link);
    text-decoration: underline;
    text-decoration-color: var(--color-subtle);
    text-underline-offset: 2px;
}

article.legal a:hover {
    color: var(--color-text);
    text-decoration-color: var(--color-muted);
}

article.legal a.cta-button {
    color: var(--color-button-text);
    text-decoration: none;
}

article.legal a.cta-button:hover {
    color: var(--color-button-text);
    text-decoration: none;
}

@media (max-width: 540px) {
    header {
        padding: 1.25rem 1rem;
    }

    nav {
        gap: 1rem;
    }

    .nav-links {
        gap: 0.9rem;
    }

    .nav-links a {
        font-size: 0.9rem;
    }

    .logo {
        font-size: 1.1rem;
        letter-spacing: 0.12em;
    }
}