:root {
    --bg: #f6f0e8;
    --fg: #552e24;
    --muted: #8a6b62;
    --accent: #552e24;
    --line: rgba(85, 46, 36, 0.18);
    --tint: rgba(85, 46, 36, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1310;
        --fg: #f0e6dc;
        --muted: #b8a89e;
        --accent: #f0e6dc;
        --line: rgba(240, 230, 220, 0.18);
        --tint: rgba(240, 230, 220, 0.06);
    }
}

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

html,
body {
    height: 100%;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    background-color: var(--bg);
    background-image: radial-gradient(
        ellipse 140% 100% at 50% 40%,
        transparent 40%,
        rgba(0, 0, 0, 0.16) 100%
    );
    background-attachment: fixed;
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='280' height='280' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 280px 280px;
    background-repeat: repeat;
    opacity: 0.12;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 0;
}

@media (prefers-color-scheme: dark) {
    body::before {
        mix-blend-mode: screen;
        opacity: 0.09;
    }
}

.page-header,
.legal,
.site-footer {
    position: relative;
    z-index: 1;
}

.page-header {
    width: 100%;
    max-width: 42rem;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1.25rem;
    text-align: center;
}

.page-header a {
    display: inline-block;
    text-decoration: none;
    color: var(--fg);
    border-bottom: none;
    transition: opacity 0.2s ease;
}

.page-header a:hover,
.page-header a:focus-visible {
    opacity: 0.85;
}

.page-header a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 2px;
}

.page-header img {
    display: block;
    width: 100%;
    max-width: 24rem;
    height: auto;
    margin: 0 auto;
    opacity: 0.65;
}

@media (prefers-color-scheme: dark) {
    .page-header img {
        filter: invert(1) brightness(1.05);
        opacity: 0.75;
    }
}

.legal {
    flex: 1 0 auto;
    width: 100%;
    max-width: 42rem;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
    font-size: 0.98rem;
}

.legal h1 {
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: 0.5rem 0 1.5rem;
}

.legal h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 2.25rem 0 1.1rem;
    color: var(--fg);
}

.legal h3 {
    font-size: 0.98rem;
    font-weight: 600;
    margin: 1.25rem 0 0.4rem;
    color: var(--fg);
}

.legal p {
    margin-bottom: 1rem;
    color: var(--fg);
}

.legal ul {
    margin: 0 0 1rem 1.25rem;
    padding: 0;
}

.legal li {
    margin-bottom: 0.35rem;
}

.legal address {
    font-style: normal;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.legal a {
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
    transition: border-color 0.2s ease, color 0.2s ease;
    word-break: break-word;
}

.legal a:hover,
.legal a:focus-visible {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.legal a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

.placeholder-note {
    background: var(--tint);
    border-left: 3px solid var(--accent);
    padding: 0.85rem 1.1rem;
    margin-bottom: 2rem;
    border-radius: 2px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.placeholder {
    color: var(--fg);
    background: var(--tint);
    padding: 0 5px;
    border-radius: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    letter-spacing: 0;
}

.back-link {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
    color: var(--fg);
    border-bottom-color: var(--line);
}

.back-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

.legal .updated {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 2rem;
}

.site-footer {
    flex-shrink: 0;
    padding: 1.5rem 1.5rem 2rem;
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.site-footer a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    color: var(--fg);
    border-bottom-color: var(--line);
}

.site-footer a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

.site-footer .sep {
    display: inline-block;
    margin: 0 0.75rem;
    opacity: 0.5;
}

.back-to-top {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--fg);
    text-decoration: none;
    z-index: 10;
    opacity: 0.75;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    transition:
        opacity 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    opacity: 1;
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.back-to-top:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.back-to-top svg {
    width: 16px;
    height: 16px;
    display: block;
}

@media (max-width: 480px) {
    .page-header img {
        max-width: 18rem;
    }
    .site-footer .sep {
        margin: 0 0.5rem;
    }
    .site-footer > span:first-child {
        display: block;
        margin-bottom: 0.45rem;
    }
    .site-footer > span:first-child + .sep {
        display: none;
    }
    .back-to-top {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 2.5rem;
        height: 2.5rem;
    }
}
