:root {
    --color-primary: var(--color-teal);
    --color-primary-light: var(--color-teal);
    --color-primary-dark: var(--color-teal-dark);
    --color-primary-glow: rgba(13, 110, 110, 0.11);
    --color-bg: var(--color-white);
    --color-surface: var(--color-white);
    --color-surface-alt: var(--color-green-soft);
    --color-border: rgb(11 41 45 / 15%);
    --color-text: #193538;
    --color-text-secondary: #53696b;
    --color-text-muted: #53696b;
    --font-display: "Source Serif 4", Georgia, serif;
    --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
    --container-max: 1120px;
    --reading-max: 760px;
    --container-padding: clamp(1.25rem, 4vw, 3rem);
    --radius-sm: 8px;
    --radius-md: 14px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--color-text);
    background: var(--color-bg);
    font-family: var(--font-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--color-primary-dark);
}

a:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(20, 145, 155, 0.35);
    outline-offset: 3px;
    border-radius: 4px;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--color-primary-dark);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--color-border);
    background: #fff;
    backdrop-filter: blur(16px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    width: min(100%, var(--container-max));
    min-height: 72px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.logo img {
    display: block;
    width: auto;
    height: 32px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-link {
    color: var(--color-primary-dark);
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
}

.back-link:hover {
    color: var(--color-primary);
}

.language-switcher {
    position: relative;
}

.language-switcher > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.4rem;
    padding: 0.52rem 0.78rem;
    border: 1px solid var(--color-primary-dark);
    border-radius: 999px;
    background: var(--color-primary-dark);
    color: #fff;
    font-size: 0.77rem;
    font-weight: 750;
    line-height: 1;
    list-style: none;
    cursor: pointer;
}

.language-switcher > summary::-webkit-details-marker {
    display: none;
}

.language-switcher > summary:hover {
    border-color: #155b5b;
    color: #fff;
    background: #155b5b;
}

.language-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    display: grid;
    min-width: 9rem;
    gap: 0.2rem;
    padding: 0.35rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 30px rgba(26, 43, 60, 0.13);
}

.language-switcher:not([open]) .language-menu {
    display: none;
}

.language-menu a {
    padding: 0.52rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--color-primary-dark);
    font-size: 0.88rem;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}

.language-menu a:hover {
    color: var(--color-primary);
    background: var(--color-surface-alt);
}

.language-menu a[aria-current="page"] {
    color: var(--color-primary-dark);
    background: var(--color-primary-glow);
}

.legal-hero {
    padding: clamp(3.6rem, 8vw, 6.5rem) var(--container-padding) clamp(2.8rem, 6vw, 4.6rem);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.legal-hero-inner {
    width: min(100%, var(--container-max));
    margin: 0 auto;
}

.eyebrow {
    margin: 0 0 0.8rem;
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    line-height: 1.2;
}

h1 {
    max-width: 850px;
    margin: 0 0 1.1rem;
    font-family: var(--font-display);
    font-size: clamp(2.55rem, 7vw, 5rem);
    font-weight: 500;
    letter-spacing: -0.025em;
}

.hero-summary {
    max-width: 760px;
    margin: 0 0 1.25rem;
    color: var(--color-text-secondary);
    font-size: clamp(1.03rem, 2vw, 1.2rem);
}

.updated {
    display: inline-flex;
    margin: 0;
    padding: 0.3rem 0.72rem;
    border-radius: 999px;
    background: var(--color-surface-alt);
    color: var(--color-primary-dark);
    font-size: 0.8rem;
    font-weight: 700;
}

.legal-shell {
    display: grid;
    grid-template-columns: minmax(0, var(--reading-max)) minmax(220px, 280px);
    justify-content: space-between;
    align-items: start;
    gap: clamp(2rem, 6vw, 5rem);
    width: min(100%, var(--container-max));
    margin: 0 auto;
    padding: clamp(2.8rem, 6vw, 5rem) var(--container-padding);
}

.legal-content {
    min-width: 0;
}

.legal-content section {
    scroll-margin-top: 96px;
}

.legal-content section + section {
    margin-top: 2.8rem;
    padding-top: 2.8rem;
    border-top: 1px solid var(--color-border);
}

.legal-content h2 {
    margin: 0 0 1rem;
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 3vw, 2.15rem);
    font-weight: 550;
}

.legal-content h3 {
    margin: 1.6rem 0 0.55rem;
    font-size: 1.03rem;
}

.legal-content p,
.legal-content ul {
    color: var(--color-text-secondary);
}

.legal-content p {
    margin: 0 0 1rem;
}

.legal-content ul {
    margin: 0 0 1rem;
    padding-left: 1.3rem;
}

.legal-content li + li {
    margin-top: 0.55rem;
}

.summary-card,
.notice {
    padding: 1.15rem 1.25rem;
    border-radius: var(--radius-md);
}

.summary-card {
    margin-bottom: 2.8rem;
    border: 1px solid rgba(13, 110, 110, 0.17);
    background: var(--color-primary-glow);
}

.summary-card h2 {
    font-family: var(--font-body);
    font-size: 1rem;
}

.summary-card p:last-child,
.notice p:last-child {
    margin-bottom: 0;
}

.notice {
    margin: 1.25rem 0;
    border-left: 4px solid var(--color-primary);
    background: var(--color-surface-alt);
}

.process-flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1.5rem 0;
    padding: 0;
    color: var(--color-text-secondary);
    list-style: none;
}

.process-flow li {
    position: relative;
    min-width: 0;
    min-height: 11.5rem;
    padding: 3.25rem 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.process-flow .step-number {
    position: absolute;
    top: 0.9rem;
    left: 0.85rem;
    display: grid;
    width: 1.85rem;
    height: 1.85rem;
    place-items: center;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 750;
}

.process-flow li:not(:last-child)::after {
    position: absolute;
    top: 1.82rem;
    left: 100%;
    z-index: 1;
    width: 0.75rem;
    border-top: 2px solid rgba(13, 110, 110, 0.28);
    content: "";
}

.process-flow strong,
.process-flow span {
    display: block;
}

.process-flow strong {
    margin-bottom: 0.5rem;
    color: var(--color-text);
    font-size: 0.88rem;
    line-height: 1.35;
}

.process-flow span {
    font-size: 0.78rem;
    line-height: 1.55;
}

.notice strong {
    color: var(--color-text);
}

.table-scroll {
    width: 100%;
    margin: 1.35rem 0;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.88rem;
    line-height: 1.55;
}

th:nth-child(1),
td:nth-child(1) {
    width: 18%;
}

th:nth-child(2),
td:nth-child(2) {
    width: 27%;
}

th:nth-child(3),
td:nth-child(3) {
    width: 26%;
}

th:nth-child(4),
td:nth-child(4) {
    width: 29%;
}

th,
td {
    padding: 0.9rem 0.85rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--color-surface-alt);
    color: var(--color-text);
    font-size: 0.78rem;
    letter-spacing: 0.025em;
}

td {
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.contents {
    position: sticky;
    top: 96px;
    padding: 1.3rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.contents h2 {
    margin: 0 0 0.8rem;
    font-size: 0.94rem;
}

.contents ol {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--color-text-muted);
}

.contents li + li {
    margin-top: 0.48rem;
}

.contents a {
    color: var(--color-text-secondary);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
}

.contents a:hover {
    color: var(--color-primary);
}

.site-footer {
    padding: 2.6rem var(--container-padding);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.footer-inner {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) auto;
    gap: 2rem;
    width: min(100%, var(--container-max));
    margin: 0 auto;
}

.footer-brand p {
    margin: 0.7rem 0 0;
    color: var(--color-text-muted);
    font-size: 0.86rem;
}

.footer-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, auto));
    gap: 2rem;
}

.footer-title {
    margin: 0 0 0.65rem;
    color: var(--color-text);
    font-size: 0.82rem;
    font-weight: 750;
}

.footer-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-links li + li {
    margin-top: 0.42rem;
}

.footer-links a {
    color: var(--color-text-secondary);
    font-size: 0.84rem;
    text-decoration: none;
}

.footer-links a:hover,
.footer-links a[aria-current="page"] {
    color: var(--color-primary);
}

@media (max-width: 820px) {
    .legal-shell {
        grid-template-columns: 1fr;
    }

    .contents {
        position: static;
        grid-row: 1;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .header-inner {
        min-height: 64px;
    }

    .back-link {
        display: none;
    }

    .legal-hero {
        padding-top: 3rem;
    }

    .footer-nav {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .process-flow {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .process-flow li {
        min-height: 0;
        padding: 1rem 1rem 1rem 3.75rem;
    }

    .process-flow .step-number {
        top: 1rem;
        left: 1rem;
    }

    .process-flow li:not(:last-child)::after {
        top: 100%;
        left: 1.9rem;
        width: 0;
        height: 0.85rem;
        border-top: 0;
        border-left: 2px solid rgba(13, 110, 110, 0.28);
    }

    .table-scroll {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    table,
    tbody {
        display: block;
    }

    table {
        font-size: 0.86rem;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    tbody {
        display: grid;
        gap: 0.85rem;
    }

    tbody tr {
        display: block;
        overflow: hidden;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        background: var(--color-surface);
        box-shadow: var(--shadow-sm);
    }

    td,
    td:nth-child(n) {
        display: grid;
        grid-template-columns: minmax(6.5rem, 0.42fr) minmax(0, 1fr);
        gap: 0.8rem;
        width: 100%;
        padding: 0.78rem 0.9rem;
    }

    td::before {
        color: var(--color-text);
        font-size: 0.74rem;
        font-weight: 750;
        letter-spacing: 0.02em;
    }

    html[lang="es"] td:nth-child(1)::before {
        content: "Categoría";
    }

    html[lang="es"] td:nth-child(2)::before {
        content: "Finalidad";
    }

    html[lang="es"] td:nth-child(3)::before {
        content: "Base jurídica";
    }

    html[lang="es"] td:nth-child(4)::before {
        content: "Conservación";
    }

    html[lang="en"] td:nth-child(1)::before {
        content: "Category";
    }

    html[lang="en"] td:nth-child(2)::before {
        content: "Purpose";
    }

    html[lang="en"] td:nth-child(3)::before {
        content: "Legal basis";
    }

    html[lang="en"] td:nth-child(4)::before {
        content: "Retention";
    }

    tbody tr:last-child td,
    td:last-child {
        border-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}

.legal-hero .notice { width: 100%; margin: 1.5rem 0 0; padding-top: 0.25rem; padding-right: 0; padding-bottom: 0.25rem; padding-left: 1rem; border: 0; border-left: 2px solid rgba(13, 110, 110, 0.28); border-radius: 0; background: transparent; }
.legal-hero .notice p { margin: 0; color: var(--color-text-muted); font-size: 0.94rem; }
.legal-hero .notice strong { color: var(--color-text); font-weight: 700; }

.legal-hero .summary-card { width: 100%; margin: 1.5rem 0 0; padding: 0.25rem 0 0.25rem 1rem; border: 0; border-left: 2px solid rgba(13, 110, 110, 0.28); border-radius: 0; background: transparent; }
.legal-hero .summary-card h2 { margin: 0 0 0.25rem; color: var(--color-text); font-size: 1rem; }
.legal-hero .summary-card p { margin: 0; color: var(--color-text-muted); font-size: 0.94rem; }

.legal-hero h1 { max-width: 100%; }

.legal-hero .hero-summary { margin-top: 0.75rem; }

.legal-content .essential-note { margin: 1.25rem 0; padding: 0.25rem 0 0.25rem 1rem; border: 0; border-left: 2px solid rgba(13, 110, 110, 0.28); border-radius: 0; background: transparent; }
.legal-content .essential-note p { margin: 0; color: var(--color-text-muted); }
.legal-content .essential-note strong { color: var(--color-text); }

.process-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin: 1.5rem 0;
}

.process-flow li {
    display: grid;
    grid-template-columns: 1.85rem minmax(0, 1fr);
    grid-template-areas:
        "number title"
        "number description";
    column-gap: 1rem;
    align-items: start;
    min-height: 0;
    padding: 0 0 1.5rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.process-flow .step-number {
    position: relative;
    z-index: 1;
    top: auto;
    left: auto;
    grid-area: number;
    width: 1.85rem;
    height: 1.85rem;
}

.process-flow li:not(:last-child)::after {
    position: absolute;
    top: 0.925rem;
    bottom: -0.925rem;
    left: 0.925rem;
    width: 2px;
    height: auto;
    border: 0;
    background: rgba(13, 110, 110, 0.28);
    content: "";
}

.process-flow strong {
    grid-area: title;
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.process-flow span:not(.step-number) {
    grid-area: description;
    font-size: 0.92rem;
}

.process-flow .step-number { align-self: start; justify-self: center; }

/* Shared semantic editorial typography for legal pages (ES/EN).
   Base brand values and type scale are supplied by site.css -> tokens.css. */
.legal-page .legal-hero, .legal-page .legal-shell {
  --text-heading: var(--color-teal-dark);
  --text-body: var(--color-text);
  --text-muted: var(--color-text-muted);
  --text-accent: var(--color-teal);
  --text-link: var(--color-teal);
}
.legal-page .legal-hero h1 {
  color: var(--text-heading);
  font: 500 var(--type-h1)/1.08 var(--font-display);
}
.legal-page .legal-hero .eyebrow {
  color: var(--text-accent);
  font: 700 var(--type-eyebrow)/1.3 var(--font-body);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.legal-page .legal-hero .hero-summary {
  color: var(--text-body);
  font: 400 var(--type-lead)/1.55 var(--font-body);
}
.legal-page .legal-hero .updated,
.legal-page .legal-hero .notice p,
.legal-page .legal-hero .summary-card p {
  color: var(--text-muted);
}
.legal-page .legal-content h2 {
  color: var(--text-heading);
  font: 500 var(--type-h2)/1.15 var(--font-display);
}
.legal-page .legal-content h3 {
  color: var(--text-heading);
  font: 500 var(--type-h3)/1.2 var(--font-display);
}
.legal-page .legal-content p,
.legal-page .legal-content li {
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--type-body);
  line-height: 1.7;
}
.legal-page .legal-content a,
.legal-page .contents a { color: var(--text-link); }
.legal-page .legal-content .essential-note p,
.legal-page .legal-content .notice p { color: var(--text-muted); }
.legal-page .legal-hero .summary-card h2,
.legal-page .contents h2 { color: var(--text-heading); }
