/* ==========================================================================
   Layout shells
   ========================================================================== */

.page {
    max-width: 45rem;
    margin: 0 auto;
    padding: var(--page-pad-y) var(--page-pad-x) var(--page-pad-b);
}

.page--wide {
    max-width: 68.75rem;
    position: relative;
    overflow-x: hidden;
}

.page--gallery {
    max-width: 87.5rem;
    position: relative;
    overflow-x: hidden;
}

/* Skip navigation */

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 100;
    padding: var(--space-s) var(--space-l);
    background: var(--color-bg);
    color: var(--color-heading);
    font-family: var(--font-mono);
    font-size: var(--text-size-ui);
    text-decoration: none;
    border: 2px solid var(--color-accent);
    border-radius: 4px;
}

.skip-link:focus {
    position: fixed;
    left: var(--space-s);
    top: var(--space-s);
    width: auto;
    height: auto;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.top-bar {
    display: flex;
    font-family: var(--font-mono);
    font-size: var(--text-size-ui);
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
}

.top-bar--stacked {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: var(--space-2xl);
    gap: var(--space-xs);
}

.top-bar a {
    border-bottom: 1px dotted var(--color-muted);
    padding: var(--space-xs) 0;
    transition:
        border-color 0.2s ease,
        color 0.2s ease;
}

.top-bar a:hover {
    border-bottom-color: var(--color-heading);
    color: var(--color-heading);
}

/* ==========================================================================
   Page header
   ========================================================================== */

h1 {
    font-family: var(--font-mono);
    font-size: var(--text-size-h1);
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 0 0 var(--space-2xl) 0;
    color: var(--color-heading);
}

h2 {
    font-family: var(--font-mono);
    font-size: var(--text-size-body);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: var(--space-2xl) 0 var(--space-l) 0;
    padding-bottom: var(--space-s);
    border-bottom: 1px solid var(--color-subtle);
}

h2:first-of-type {
    margin-top: 0;
}

.intro {
    font-size: var(--text-size-body);
    line-height: 1.7;
    margin: 0 0 var(--space-2xl) 0;
}

/* ==========================================================================
   Site footer
   ========================================================================== */

.site-footer {
    font-family: var(--font-mono);
    margin-top: var(--space-2xl);
    padding-top: var(--space-m);
    border-top: 1px solid var(--color-subtle);
    letter-spacing: 0.06em;
}

.site-footer p {
    line-height: 1.4;
    margin: 0;
    letter-spacing: 0;
    font-size: var(--text-size-code);
}

.site-footer p,
.site-footer p a {
    color: var(--color-muted);
}

.site-footer p a {
    text-decoration: underline;
    text-decoration-color: var(--color-subtle);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
    transition:
        text-decoration-color 0.4s ease,
        color 0.2s ease;
}

.site-footer p a:hover {
    color: var(--color-fg);
    text-decoration-color: var(--color-fg);
}

/* ==========================================================================
   Utilities & animations
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-20px, 20px);
    }
    to {
        opacity: 1;
        transform: translate(0, 0);
    }
}

@keyframes fadeInOnly {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================================================
   Motion: fade-in animations as progressive enhancement
   ========================================================================== */

.js-animated .top-bar {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.2s forwards;
}
.js-animated h1 {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.3s forwards;
}
.js-animated .intro {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.35s forwards;
}
.js-animated h2 {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.4s forwards;
}
.js-animated .site-footer {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.6s forwards;
}
