/* ==========================================================================
   FarmaTraz — sistema de diseño
   Tokens, reset y utilidades de layout
   ========================================================================== */

:root {
    /* Verdes de marca */
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-200: #bbf7d0;
    --green-300: #86efac;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-800: #166534;
    --green-900: #14532d;
    --green-950: #0b3d2e;

    /* Teal de acento */
    --teal-400: #2dd4bf;
    --teal-500: #14b8a6;
    --teal-600: #0ea5a4;
    --teal-700: #0f766e;
    --teal-900: #134e4a;

    /* Neutros */
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --muted-light: #94a3b8;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --surface: #ffffff;
    --canvas: #f8fafc;

    /* Estados */
    --info: #3b82f6;
    --warning: #f59e0b;
    --danger: #ef4444;
    --success: var(--green-600);

    /* Semánticos */
    --brand: var(--green-600);
    --brand-strong: var(--green-700);
    --brand-deep: var(--green-900);
    --accent: var(--teal-600);
    --gradient: linear-gradient(135deg, var(--green-500), var(--teal-600));
    --gradient-soft: linear-gradient(135deg, rgba(34, 197, 94, .12), rgba(14, 165, 164, .12));

    /* Elevación y forma */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
    --shadow: 0 4px 16px rgba(15, 23, 42, .07);
    --shadow-lg: 0 18px 45px rgba(15, 23, 42, .1);
    --shadow-brand: 0 14px 34px rgba(22, 163, 74, .22);

    /* Medidas */
    --header-h: 76px;
    --container: 1180px;
    --container-narrow: 780px;
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* Reset ------------------------------------------------------------------ */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    /* Red de seguridad: ningún bloque debe provocar desplazamiento lateral. */
    overflow-x: hidden;
    font-family: Inter, 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--ink-soft);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .75rem;
    color: var(--ink);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.02em;
}

h1 { font-size: clamp(2.125rem, 4.4vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-strong); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--brand); }

ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin-bottom: .375rem; }

strong { color: var(--ink); font-weight: 600; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

:focus-visible {
    outline: 3px solid rgba(34, 197, 94, .45);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection { background: var(--green-200); color: var(--green-950); }

/* Layout ------------------------------------------------------------------ */

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
}

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

.section { padding: clamp(3.5rem, 7vw, 6.5rem) 0; }
.section-sm { padding: clamp(2.5rem, 4vw, 4rem) 0; }
.section-alt { background: var(--surface); }

.section-dark {
    background: var(--green-950);
    color: rgba(255, 255, 255, .75);
    position: relative;
    overflow: hidden;
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark strong { color: #fff; }

.section-dark a { color: var(--green-300); }
.section-dark a:hover { color: var(--green-200); }

.section-header { max-width: 720px; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section-header.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-header p { color: var(--muted); font-size: 1.0625rem; margin-bottom: 0; }
.section-dark .section-header p { color: rgba(255, 255, 255, .72); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .875rem;
    padding: .3125rem .75rem;
    border-radius: 999px;
    background: var(--green-50);
    border: 1px solid var(--green-200);
    color: var(--green-800);
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .01em;
}

.eyebrow::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green-500);
}

.section-dark .eyebrow {
    background: rgba(34, 197, 94, .14);
    border-color: rgba(34, 197, 94, .3);
    color: var(--green-300);
}

.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stack > * + * { margin-top: 1rem; }

/* Utilidades -------------------------------------------------------------- */

.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.lead { font-size: 1.125rem; color: var(--muted); }
.section-dark .lead { color: rgba(255, 255, 255, .78); }
.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;
}
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 2rem; }

/* Aparición al hacer scroll ----------------------------------------------- */

/* El contenido solo se oculta si JavaScript puede volver a mostrarlo. */
.js .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
}

.reveal.is-visible { opacity: 1; transform: none; }
.reveal-1 { transition-delay: .1s; }
.reveal-2 { transition-delay: .2s; }
.reveal-3 { transition-delay: .3s; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
