/* =============================================
   RESET & BASE
   ============================================= */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    line-height: 1.6;
    background-color: var(--color-bg);
    color: var(--color-text);
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
    overflow-x: hidden; /* Evita overflow horizontal */
}

[data-theme="light"] body {
    background-image: linear-gradient(to bottom, #fbfbfb 0, #fbfbfb 120px, #ffffff 420px);
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

img.is-fallback {
    object-fit: cover;
    background: var(--color-bg-alt);
    filter: saturate(0.88) contrast(1.03);
}

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

ul {
    list-style: none;
}

/* =============================================
   DESIGN TOKENS
   ============================================= */

:root {
    /* COLORS */
    --color-black: #0a0a0a;
    --color-white: #ffffff;

    --color-primary: #111111;
    --color-accent: #c00000;

    --color-bg: #ffffff;
    --color-bg-alt: #fafafa;

    --color-border: #e5e5e5;

    --color-text: #1a1a1a;
    --color-text-muted: #555555;   /* Contraste aumentado */

    --color-gray-100: #f5f5f5;
    --color-gray-200: #e5e5e5;
    --color-gray-300: #cccccc;
    --color-gray-400: #999999;
    --color-gray-500: #666666;
    --color-gray-600: #444444;
    --color-gray-700: #333333;
    --color-gray-800: #1a1a1a;

    /* FEEDBACK */
    --update-bg: #fdf2f2;
    --update-text: #b71c1c;

    /* TYPOGRAPHY */
    --font-display: "Playfair Display", Georgia, serif;
    --font-body: "Source Serif 4", Georgia, serif;
    --font-ui: "DM Sans", system-ui, sans-serif;
    --font-sans: "DM Sans", system-ui, sans-serif;

    /* EFFECTS */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.1);

    --radius: 6px;

    --transition-fast: 0.2s ease;

    /* SPACING */
    --section-gap: 24px;   /* Espaçamento vertical uniforme */
}

/* =============================================
   DARK THEME
   ============================================= */

[data-theme="dark"] {
    --color-primary: #f0f0f0;
    --color-accent: #ff6b6b;

    --color-bg: #101214;
    --color-bg-alt: #171b1f;

    --color-border: #2a3138;

    --color-text: #e0e0e0;
    --color-text-muted: #a0a8b0;   /* Mais claro para manter contraste */

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.5);

    --update-bg: #1a1a1a;
    --update-text: #d4d4d4;

    --color-white: #e0e0e0;
}

/* =============================================
   UTILITIES
   ============================================= */

.container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 16px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    border: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    padding: 4px 8px;
    background: #111;
    color: #fff;
    z-index: 20;
}

.skip-link:focus {
    top: 8px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Feedback tátil para mobile */
a:active {
    opacity: 0.8;
}

button:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}
