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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Paper-grain overlay across the whole page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.35;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.4 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* Layered above the noise overlay */
.topbar, main, .footer { position: relative; z-index: 2; }

main { flex: 1; }

.shell {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px;
}
@media (max-width: 640px) {
    .shell { padding: 0 18px; }
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    z-index: 200;
    background: var(--ink);
    color: #f5f1e8;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}
.skip-link:focus { top: 8px; outline: 3px solid var(--accent-soft); }

.hidden { display: none !important; }

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