/* ===========================================================================
   Referencia de las APIs de Elhuyar (Swagger UI y ReDoc de Aditu, Elia y TTS).
   El MISMO fichero en los tres proyectos. El original es el de TTS: después de cambiarlo, ejecutar
   tts_api/scripts/elh_api_docs_sync.sh (con --check solo comprueba).
   Los colores y la letra son los de elh_shell.css, la cabecera y el footer de las webs.
   =========================================================================== */
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap;
	src: local("Fira Sans"), local("FiraSans-Regular"), url("../fonts/fira-sans-400.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap;
	src: local("Fira Sans Medium"), local("FiraSans-Medium"), url("../fonts/fira-sans-500.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap;
	src: local("Fira Sans SemiBold"), local("FiraSans-SemiBold"), url("../fonts/fira-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 700; font-display: swap;
	src: local("Fira Sans Bold"), local("FiraSans-Bold"), url("../fonts/fira-sans-700.woff2") format("woff2"); }

:root {
	color-scheme: light;
	--elh-blue: #1A3AAB;
	--elh-blue-dark: #142e8a;
	--elh-blue-soft: #e8ecfb;
	--elh-teal: #00ACA9;
	--elh-teal-dark: #00807e;
	--elh-ink: #1d1d1b;
	--elh-muted: #5f5e5a;
	--elh-line: #dcdad5;
	--elh-line-soft: #ecebe7;
	--elh-paper: #f7f6f3;
	--elh-danger: #b42318;
	--elh-radius: 6px;
	--elh-font: "Fira Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	--elh-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	--api-width: 1160px;
}

html, body, body.swagger-body { margin: 0; background: #fff; color: var(--elh-ink); font-family: var(--elh-font); }
body { display: flex; flex-direction: column; min-height: 100vh; }
body > #swagger-ui, body > redoc { flex: 1 0 auto; }
body > .api-footer { flex-shrink: 0; }

/* --- Cabecera ---------------------------------------------------------------- */
.api-header { display: flex; align-items: center; gap: 2rem; padding: 1rem 2rem; background: #fff; box-shadow: 0 1px 0 var(--elh-line); }
.api-header__brand { display: flex; align-items: center; }
.api-header__brand img { display: block; height: 44px; width: auto; }
.api-header nav { display: flex; align-items: center; gap: .25rem; }
.api-header__views { margin-left: auto; }
.api-header__theme { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-left: -1rem; padding: 0; border: 1px solid var(--elh-line); border-radius: 50%; background: none; color: var(--elh-blue); cursor: pointer; }
.api-header__theme:hover, .api-header__theme:focus-visible { border-color: var(--elh-teal); color: var(--elh-teal-dark); }
.api-header__theme svg { fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.api-header__theme .api-theme-sun { display: none; }
.api-header nav a { position: relative; padding: .55rem .95rem; color: var(--elh-blue); font-size: 1rem; text-decoration: none; white-space: nowrap; transition: color .15s ease; }
.api-header__views a { font-size: .9rem; color: var(--elh-muted); }
.api-header nav a:hover, .api-header nav a:focus { color: var(--elh-teal-dark); }
.api-header nav a::after { content: ""; position: absolute; left: .95rem; right: .95rem; bottom: .15rem; height: 3px; border-radius: 3px; background: var(--elh-teal); transform: scaleX(0); transition: transform .2s ease; }
.api-header nav a.is-active { color: var(--elh-ink); font-weight: 500; }
.api-header nav a.is-active::after { transform: scaleX(1); }

/* --- Footer y ejemplos ---------------------------------------------------------- */
.api-footer { display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap; margin-top: 4rem; padding: 2rem; background: var(--elh-blue); color: #fff; }
.api-footer img { display: block; width: 132px; height: auto; }
.api-footer p { margin: 0; font-size: .95rem; }
.api-footer a { color: #fff; text-underline-offset: 3px; }
.api-footer a:hover { color: #d9fffe; }

.api-examples { box-sizing: border-box; width: 100%; max-width: var(--api-width); margin: 3rem auto 0; padding: 0 20px; }
.api-examples h2 { margin: 0 0 .35rem; color: var(--elh-blue); font-size: 1.5rem; font-weight: 600; }
.api-examples > p { margin: 0 0 1.25rem; color: var(--elh-muted); line-height: 1.5; }
.api-examples__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.api-examples__grid li { padding: 1rem 1.15rem; border: 1px solid var(--elh-line); border-radius: var(--elh-radius); background: #fff; }
.api-examples__grid h3 { margin: 0 0 .35rem; color: var(--elh-ink); font-size: 1rem; font-weight: 600; }
.api-examples__grid p { margin: 0 0 .55rem; color: var(--elh-muted); font-size: .9rem; line-height: 1.45; }
.api-examples__grid a { color: var(--elh-blue); font-family: var(--elh-mono); font-size: .85rem; }
.api-examples__grid a:hover { color: var(--elh-teal-dark); }

/* --- Swagger UI ------------------------------------------------------------------ */
.swagger-ui, .swagger-ui .info, .swagger-ui .opblock-tag, .swagger-ui .opblock .opblock-summary-description,
.swagger-ui .opblock .opblock-section-header h4, .swagger-ui .parameter__name, .swagger-ui .response-col_status,
.swagger-ui table thead tr td, .swagger-ui table thead tr th, .swagger-ui .btn, .swagger-ui label,
.swagger-ui .tab li, .swagger-ui .responses-inner h4, .swagger-ui .responses-inner h5,
.swagger-ui .markdown p, .swagger-ui .renderedMarkdown p, .swagger-ui .opblock-description-wrapper p,
.swagger-ui .opblock-external-docs-wrapper p, .swagger-ui .opblock-title_normal p, .swagger-ui .response-col_description { font-family: var(--elh-font); }
.swagger-ui .wrapper { max-width: var(--api-width); }
.swagger-ui .topbar, .swagger-ui .scheme-container, .swagger-ui .filter-container { display: none; }
.swagger-ui .info { margin: 2.5rem 0 1.5rem; }
.swagger-ui .info hgroup.main { margin-bottom: 1.25rem; }
.swagger-ui .info hgroup.main a, .swagger-ui .info .base-url, .swagger-ui .info .info__contact, .swagger-ui .info .title small.version-stamp,
.swagger-ui .opblock .opblock-summary .opblock-summary-operation-id, .swagger-ui .opblock .opblock-summary-control .opblock-summary-operation-id { display: none; }
.swagger-ui .info .title { color: var(--elh-blue); font-family: var(--elh-font); font-size: 2.2rem; font-weight: 600; }
.swagger-ui .info .title small { top: -.2rem; background: var(--elh-teal-dark); }
.swagger-ui .info .title small pre { color: #fff; font-family: var(--elh-font); }
.swagger-ui .info p, .swagger-ui .info li, .swagger-ui .info table, .swagger-ui .info th, .swagger-ui .info td, .swagger-ui .info a { color: var(--elh-ink); font-family: var(--elh-font); font-size: 1rem; line-height: 1.6; }
.swagger-ui .info a, .swagger-ui .markdown a { color: var(--elh-blue); }
.swagger-ui .info a:hover { color: var(--elh-teal-dark); }
.swagger-ui .info h2 { margin: 2rem 0 .6rem; color: var(--elh-blue); font-family: var(--elh-font); font-size: 1.35rem; font-weight: 600; }
.swagger-ui .info h3 { margin: 1.25rem 0 .4rem; color: var(--elh-ink); font-family: var(--elh-font); font-size: 1.05rem; font-weight: 600; }
.swagger-ui .info .description { max-width: 860px; }
.swagger-ui .info code, .swagger-ui .markdown code, .swagger-ui .renderedMarkdown code { padding: .1rem .35rem; border-radius: 4px; background: var(--elh-blue-soft); color: var(--elh-blue-dark); font-family: var(--elh-mono); font-size: .88em; font-weight: 400; }
.swagger-ui .info pre { margin: .75rem 0; padding: 1rem 1.15rem; overflow-x: auto; border-radius: var(--elh-radius); background: #17203f; color: #f4f6fd; line-height: 1.5; }
.swagger-ui .info pre code { padding: 0; background: none; color: inherit; font-size: .85rem; white-space: pre; }
.swagger-ui .info table { width: 100%; margin: 1rem 0; padding: 0; border-collapse: collapse; }
.swagger-ui .info table th, .swagger-ui .info table td { padding: .55rem .75rem; border-bottom: 1px solid var(--elh-line-soft); font-size: .95rem; text-align: left; vertical-align: top; }
.swagger-ui .info table th { border-bottom: 2px solid var(--elh-line); color: var(--elh-muted); font-weight: 500; }

.swagger-ui .opblock-tag { padding: .75rem 0; border-bottom: 1px solid var(--elh-line); color: var(--elh-blue); font-size: 1.3rem; font-weight: 600; }
.swagger-ui .opblock-tag small { padding: 0 1rem; color: var(--elh-muted); font-family: var(--elh-font); font-size: .92rem; font-weight: 400; }
.swagger-ui .opblock-tag:hover { background: none; }
.swagger-ui .opblock { border-radius: var(--elh-radius); box-shadow: none; }
.swagger-ui .opblock.opblock-post { border-color: var(--elh-teal); background: rgba(0, 172, 169, .06); }
.swagger-ui .opblock.opblock-post .opblock-summary { border-color: var(--elh-teal); }
.swagger-ui .opblock.opblock-post .opblock-summary-method { border-radius: 4px; background: var(--elh-teal-dark); font-family: var(--elh-font); font-weight: 600; }
.swagger-ui .opblock.opblock-post .tab-header .tab-item.active h4 span::after { background: var(--elh-teal); }
.swagger-ui .opblock .opblock-summary-path, .swagger-ui .opblock .opblock-summary-path__deprecated { color: var(--elh-ink); font-family: var(--elh-mono); font-size: .95rem; font-weight: 600; }
.swagger-ui .opblock .opblock-summary-description { color: var(--elh-muted); font-size: .92rem; }
.swagger-ui .opblock .opblock-section-header { background: rgba(255, 255, 255, .75); box-shadow: none; }
.swagger-ui .opblock-description-wrapper, .swagger-ui .opblock-description-wrapper p { color: var(--elh-ink); font-size: .95rem; line-height: 1.55; }
.swagger-ui .parameter__name.required::after { color: var(--elh-danger); }
.swagger-ui .parameter__name.required span { color: var(--elh-danger) !important; }
.swagger-ui .btn { border-radius: var(--elh-radius); box-shadow: none; }
.swagger-ui .btn.execute { border-color: var(--elh-blue); background: var(--elh-blue); color: #fff; }
.swagger-ui .btn.execute:hover { border-color: var(--elh-blue-dark); background: var(--elh-blue-dark); }
.swagger-ui .btn.try-out__btn { border-color: var(--elh-blue); color: var(--elh-blue); }
.swagger-ui .btn.try-out__btn.cancel { border-color: var(--elh-danger); color: var(--elh-danger); }
.swagger-ui input[type=text], .swagger-ui textarea, .swagger-ui select { border-color: var(--elh-line); border-radius: var(--elh-radius); box-shadow: none; }
.swagger-ui input[type=text]:focus, .swagger-ui textarea:focus, .swagger-ui select:focus { border-color: var(--elh-teal); outline: 2px solid rgba(0, 172, 169, .25); }
.swagger-ui .response-col_status { font-weight: 600; }
.swagger-ui .responses-table td { color: var(--elh-ink); }
.swagger-ui section.models { border-color: var(--elh-line); border-radius: var(--elh-radius); }

/* --- ReDoc ------------------------------------------------------------------------ */
/* ReDoc genera sus estilos con clases propias: hace falta !important */
redoc *:not(pre):not(pre *):not(code) { font-family: var(--elh-font) !important; }
redoc h1, redoc h2, redoc h3, redoc h5 { color: var(--elh-blue) !important; font-weight: 600 !important; }
body > .api-header { position: relative; z-index: 5; }

/* --- Tema oscuro (botón de la cabecera). Solo los colores: la estructura es la del tema claro ------------------- */
html.api-dark {
	color-scheme: dark;
	--elh-blue: #9db2ff;
	--elh-blue-dark: #c3d0ff;
	--elh-blue-soft: #252f52;
	--elh-teal: #2cc9c6;
	--elh-teal-dark: #5fdcd9;
	--elh-ink: #eceef5;
	--elh-muted: #a9adbd;
	--elh-line: #363b4d;
	--elh-line-soft: #2a2e3d;
	--elh-danger: #ff8a7a;
	--api-bg: #14161f;
	--api-surface: #1c1f2b;
}
html.api-dark, html.api-dark body, html.api-dark body.swagger-body { background: var(--api-bg); }
html.api-dark .api-header { background: var(--api-surface); }
html.api-dark .api-header__brand img { padding: 2px 6px; border-radius: 6px; background: #fff; }
html.api-dark .api-header__theme .api-theme-moon { display: none; }
html.api-dark .api-header__theme .api-theme-sun { display: inline; }
html.api-dark .api-footer { background: #101a4d; }
html.api-dark .api-examples__grid li { background: var(--api-surface); }
html.api-dark .swagger-ui, html.api-dark .swagger-ui .info .title, html.api-dark .swagger-ui .opblock-tag,
html.api-dark .swagger-ui .opblock .opblock-section-header h4, html.api-dark .swagger-ui .opblock-title_normal,
html.api-dark .swagger-ui .parameter__name, html.api-dark .swagger-ui .parameter__type, html.api-dark .swagger-ui .parameter__in,
html.api-dark .swagger-ui table thead tr td, html.api-dark .swagger-ui table thead tr th, html.api-dark .swagger-ui .response-col_status,
html.api-dark .swagger-ui .response-col_links, html.api-dark .swagger-ui .responses-inner h4, html.api-dark .swagger-ui .responses-inner h5,
html.api-dark .swagger-ui label, html.api-dark .swagger-ui .tab li, html.api-dark .swagger-ui .prop-format, html.api-dark .swagger-ui .opblock-description-wrapper h4,
html.api-dark .swagger-ui .model, html.api-dark .swagger-ui .model-title, html.api-dark .swagger-ui .models h4, html.api-dark .swagger-ui section.models h4 { color: var(--elh-ink); }
html.api-dark .swagger-ui .info .title { color: var(--elh-blue); }
html.api-dark .swagger-ui .opblock-tag { color: var(--elh-blue); border-bottom-color: var(--elh-line); }
html.api-dark .swagger-ui .opblock.opblock-post { background: rgba(44, 201, 198, .08); }
html.api-dark .swagger-ui .opblock .opblock-section-header { background: var(--api-surface); }
html.api-dark .swagger-ui .opblock.opblock-post .opblock-summary-method { background: #00807e; }
html.api-dark .swagger-ui .opblock .opblock-summary-control svg, html.api-dark .swagger-ui .opblock-tag svg, html.api-dark .swagger-ui .expand-operation svg { fill: var(--elh-ink); }
html.api-dark .swagger-ui .opblock-tag-section .arrow, html.api-dark .swagger-ui .expand-methods svg { fill: var(--elh-ink); }
html.api-dark .swagger-ui input[type=text], html.api-dark .swagger-ui textarea, html.api-dark .swagger-ui select, html.api-dark .swagger-ui input[type=file] { background: var(--api-bg); color: var(--elh-ink); }
html.api-dark .swagger-ui .btn { color: var(--elh-ink); }
html.api-dark .swagger-ui .btn.execute { background: #1A3AAB; border-color: #1A3AAB; color: #fff; }
html.api-dark .swagger-ui .btn.try-out__btn { border-color: var(--elh-blue); color: var(--elh-blue); }
html.api-dark .swagger-ui .responses-table td, html.api-dark .swagger-ui .renderedMarkdown p, html.api-dark .swagger-ui .markdown p { color: var(--elh-ink); }
html.api-dark redoc *:not(pre):not(pre *):not(code) { border-color: var(--elh-line); }
html.api-dark redoc .menu-content, html.api-dark redoc .api-content, html.api-dark redoc table, html.api-dark redoc table * { background-color: var(--api-bg) !important; }
html.api-dark redoc .menu-content, html.api-dark redoc .menu-content * { background-color: var(--api-surface) !important; }
html.api-dark redoc .menu-content label.active { background-color: var(--elh-blue-soft) !important; }
html.api-dark redoc :is(p, li, td, th, label, span, div, button, input) { color: var(--elh-ink) !important; }
html.api-dark redoc :is(p, li, td, th, label, span, div, button, input):has(> .http-verb) { color: var(--elh-ink) !important; }
html.api-dark redoc code { background: var(--elh-blue-soft) !important; color: var(--elh-blue-dark) !important; border-color: var(--elh-line) !important; }
html.api-dark redoc pre code { border: 0 !important; background: none !important; color: inherit !important; }
html.api-dark redoc .menu-content svg polygon { fill: var(--elh-muted); }
html.api-dark redoc pre { background: #0d0f16 !important; }
html.api-dark redoc a { color: var(--elh-blue) !important; }

@media (max-width: 760px) {
	.api-header { flex-wrap: wrap; gap: .5rem 1rem; padding: .75rem 1rem; }
	.api-header__views { margin-left: 0; width: 100%; }
	.api-examples__grid { grid-template-columns: 1fr; }
}
