/*
 * ============================================================================
 * MFKA Base Styles — Sustainable Governance Hub
 * ============================================================================
 *
 * Layers (cascade order):
 *   1. tokens.css     — CSS variables, theme definitions
 *   2. base.css       — reset, typography, layout (THIS FILE)
 *   3. components.css — reusable building blocks (button, form, card)
 *   4. pages.css      — page-specific overrides
 *
 * ============================================================================
 */

/* ============================================================================
 * MODERN CSS RESET (modified from Andy Bell's reset)
 * ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100dvh;
    line-height: var(--leading-normal);
}

img, picture, svg, video {
    display: block;
    max-width: 100%;
    height: auto;
}

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

a {
    color: inherit;
    text-decoration: none;
}

ul[role="list"], ol[role="list"] {
    list-style: none;
}

/* ============================================================================
 * TYPOGRAPHY
 * ========================================================================== */
html {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--mfka-ink-700);
    background-color: var(--mfka-cream);
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--mfka-ink-900);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;             /* progressive enhancement, modern browsers */
}

h1 {
    font-size: clamp(2rem, 4vw + 1rem, var(--text-5xl));
    font-weight: 700;
}

h2 {
    font-size: clamp(1.5rem, 2.5vw + 1rem, var(--text-4xl));
    font-weight: 600;
}

h3 {
    font-size: clamp(1.25rem, 1.5vw + 1rem, var(--text-3xl));
}

h4 {
    font-size: var(--text-2xl);
}

h5 {
    font-size: var(--text-xl);
}

h6 {
    font-size: var(--text-lg);
}

p, li {
    text-wrap: pretty;              /* progressive enhancement */
}

p + p {
    margin-top: var(--space-4);
}

a {
    color: var(--mfka-green-600);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--mfka-gold-300);
    transition: color var(--duration-fast) var(--ease-out),
                text-decoration-color var(--duration-fast) var(--ease-out);
}

a:hover,
a:focus-visible {
    color: var(--mfka-green-700);
    text-decoration-color: var(--mfka-green-600);
}

a:focus-visible {
    outline: 2px solid var(--mfka-gold-400);
    outline-offset: 3px;
    border-radius: 2px;
}

strong, b {
    font-weight: 700;
    color: var(--mfka-ink-900);
}

em, i {
    font-style: italic;
}

small {
    font-size: var(--text-sm);
}

code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background-color: var(--mfka-paper);
    padding: 0.1em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--mfka-ink-700);
}

/* ============================================================================
 * LAYOUT — composition primitives
 * ========================================================================== */

/* Container — caps content width, centers horizontally */
.container {
    width: 100%;
    max-width: var(--content-width-default);
    margin-inline: auto;
    padding-inline: var(--space-5);
}

@media (min-width: 768px) {
    .container {
        padding-inline: var(--space-6);
    }
}

.container--narrow {
    max-width: var(--content-width-narrow);
}

.container--prose {
    max-width: var(--content-width-prose);
}

.container--wide {
    max-width: var(--content-width-wide);
}

/* Stack — vertical rhythm */
.stack > * + * {
    margin-block-start: var(--space-4);
}

.stack-sm > * + * { margin-block-start: var(--space-3); }
.stack-md > * + * { margin-block-start: var(--space-5); }
.stack-lg > * + * { margin-block-start: var(--space-7); }
.stack-xl > * + * { margin-block-start: var(--space-9); }

/* Cluster — horizontal grouping with wrap */
.cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
}

.cluster-sm { gap: var(--space-2); }
.cluster-lg { gap: var(--space-6); }

/* Center horizontally + content alignment */
.center {
    text-align: center;
    margin-inline: auto;
}

/* Visually hidden but accessible */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Skip link — accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: var(--space-4);
    background: var(--mfka-green-700);
    color: var(--mfka-cream);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: 600;
    z-index: var(--z-toast);
    transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
    top: var(--space-4);
}

/* ============================================================================
 * SECTIONS
 * ========================================================================== */
.section {
    padding-block: var(--space-8);
}

@media (min-width: 768px) {
    .section {
        padding-block: var(--space-9);
    }
}

.section--tight {
    padding-block: var(--space-6);
}

.section--spacious {
    padding-block: var(--space-10);
}

/* Alternating section backgrounds */
.section--paper {
    background-color: var(--mfka-paper);
}

.section--green {
    background-color: var(--mfka-green-700);
    color: var(--mfka-cream);
}

.section--green h1,
.section--green h2,
.section--green h3 {
    color: var(--mfka-cream);
}

.section--green a {
    color: var(--mfka-gold-200);
    text-decoration-color: var(--mfka-gold-400);
}

.section--green a:hover {
    color: var(--mfka-gold-100);
}

/* ============================================================================
 * DECORATIVE ELEMENTS — the circular motif from the logo
 * ========================================================================== */

/* Curved divider — subtle nod to the logo's arcs */
.curved-divider {
    height: 4px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--mfka-gold-300) 30%,
        var(--mfka-gold-400) 50%,
        var(--mfka-gold-300) 70%,
        transparent 100%
    );
    border: none;
    margin-block: var(--space-6);
}

/* Subtle background pattern, optional decoration */
.has-pattern-corner {
    position: relative;
    isolation: isolate;
}

.has-pattern-corner::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(
            circle at top right,
            var(--mfka-gold-50) 0%,
            transparent 40%
        );
    pointer-events: none;
    z-index: -1;
}
