/* ============================================
   Alpha-Pe Base Styles & Reset
   ============================================ */

/* ── Modern Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    hanging-punctuation: first last;
}

body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    color: var(--text-primary);
    background: var(--surface-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ── Skip-to-content (accessibility) ── */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--sp-4);
    z-index: calc(var(--z-toast) + 1);
    padding: var(--sp-3) var(--sp-6);
    background: var(--clr-primary);
    color: var(--text-inverse);
    font-weight: var(--fw-semibold);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    text-decoration: none;
    transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--clr-gold);
    outline-offset: 2px;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    color: var(--text-heading);
    line-height: var(--lh-tight);
    text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); font-weight: var(--fw-black); }
h2 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); }
h3 { font-size: var(--fs-xl); font-weight: var(--fw-bold); }
h4 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
h5 { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
h6 { font-size: var(--fs-base); font-weight: var(--fw-semibold); }

p {
    max-width: 70ch;
    text-wrap: pretty;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--clr-accent-light);
}

/* ── Focus Styles ── */
:focus-visible {
    outline: 3px solid var(--clr-accent);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* ── Selection ── */
::selection {
    background: hsla(var(--clr-accent-h), var(--clr-accent-s), var(--clr-accent-l), 0.2);
    color: var(--clr-primary);
}

/* ── Media defaults ── */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

/* ── Form reset ── */
input, button, textarea, select {
    font: inherit;
    color: inherit;
}

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

/* ── Lists ── */
ul, ol {
    list-style: none;
}

/* ── Table ── */
table {
    border-collapse: collapse;
}

/* ── Screen-reader only utility ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Container utility ── */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-padding);
}

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

/* ── Section spacing ── */
.section {
    padding-block: var(--sp-20);
    padding-inline: var(--container-padding);
}

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