/* =========================================================
   Peribahasa — Base
   Reset, typography, layout primitives
   ========================================================= */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background-color var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
    overflow-x: hidden;
}

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

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

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

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    padding: 0;
}

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

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--space-4);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

h1 { font-size: clamp(2.5rem, 6vw, 4.75rem); letter-spacing: -0.035em; line-height: 1.05; }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h4 { font-size: 1rem; letter-spacing: 0; }

p { margin: 0 0 var(--space-4); color: var(--text-muted); }
ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--accent); color: var(--accent-contrast); }

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: var(--space-2);
    background: var(--accent);
    color: var(--accent-contrast);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    z-index: 1000;
    font-weight: 600;
}
.skip-link:focus { left: var(--space-2); }

/* ---------- Layout primitives ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--space-5);
}
.container-narrow { max-width: var(--container-narrow); }
.container-wide { max-width: var(--container-wide); }

.section {
    padding: clamp(3rem, 7vw, 5rem) 0;
}
.section-tight { padding: clamp(2rem, 4vw, 3rem) 0; }

.section-head {
    max-width: 720px;
    margin: 0 auto var(--space-7);
    text-align: center;
}
.section-head.left { margin-left: 0; text-align: left; }
.section-head h2 { margin-bottom: var(--space-3); }
.section-head .eyebrow { margin-bottom: var(--space-4); }
.section-sub {
    font-size: 1.0625rem;
    color: var(--text-muted);
    max-width: 60ch;
    margin: 0 auto;
}
.section-head.left .section-sub { margin: 0; }

/* ---------- Type helpers ---------- */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: var(--space-3);
}
.eyebrow-plain {
    color: var(--text-muted);
    font-weight: 600;
}
.eyebrow::before {
    content: "";
    width: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}
.eyebrow.eyebrow-plain::before { display: none; }

.serif { font-family: var(--font-serif); }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-center { text-align: center; }

/* ---------- Hero gradient text ---------- */
.grad-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline;
}

/* ---------- Decorative background pattern ---------- */
.bg-pattern {
    position: relative;
}
.bg-pattern::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
    background-size: 24px 24px;
    opacity: 0.4;
    pointer-events: none;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent 80%);
}
.bg-pattern > * { position: relative; z-index: 1; }

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