/* 1. Predictable sizing model for everything */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 2. Responsive media defaults (no giant images or layout overflow) */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* 3. Smooth scrolling and text size preservation */
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

/* 4. Custom properties */
:root {
    /* 4a. Spatial rhythm: power-of-two or 4px/8px scale */
    --space-xs: 0.5rem; /* 8px */
    --space-sm: 1rem; /* 16px */
    --space-md: 1.5rem; /* 24px */
    --space-lg: 2.5rem; /* 40px */

    /* 4b. Palette */
    --color-surface: #ffffff;
    --color-canvas: #f8fafc;
    --color-text-main: #0f172a;
    --color-text-muted: #64748b;
    --color-accent: #2563eb;

    /* 4c. Typography scale */
    --font-display: 'Metamorphous', Georgia, serif;
    --font-serif: 'Cormorant Unicase', Georgia, serif;
    --font-sans: system-ui, -apple-system, sans-serif;

    --text-base: 1rem;
    --text-xl: 1.5rem;
}

/* 5. Base body defaults */
body {
    min-height: 100vh;
    line-height: 1.5;
    font-family: var(--font-serif);
    font-weight: 500;
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    color: var(--color-text-main);
    background-color: var(--color-canvas);
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    letter-spacing: 0.05em;
}

/* 6. Inherit fonts on form controls (browsers set them to monospace/ugly defaults) */
input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* 7. Avoid text overflow on long words, URLs, or code */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

/* 8. Remove list styling when used for layout */
ul[role='list'],
ol[role='list'] {
    list-style: none;
}

/* 9. Make textareas vertically resizable only (prevents breaking layouts horizontally) */
textarea {
    resize: vertical;
}
