/* =====================================================================
   Cómputos FI — CSS general.
   Las páginas pueden pisar cualquier cosa: variables en :root o reglas
   propias en el campo "HTML de <head>" del editor.
   ===================================================================== */
:root {
  /* Paleta institucional: fondo Pantone 296 C (#061B2B) + acento verde */
  --brand: #061B2B;
  --bg: #061B2B;
  --surface: #0C2A40;
  --surface-2: #123550;
  --text: #F8FAFC;
  --muted: #9FB4C4;
  --accent: #047857;
  --accent-text: #FFFFFF;
  --link: #34D399;
  --ok: #10B981;
  --warn: #F59E0B;
  --down: #EF4444;
  --border: #1D4661;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .22);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --maxw: 1080px;
  --header-h: 56px;
  --bottom-h: 62px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F6F8FA;
  --surface: #FFFFFF;
  --surface-2: #EEF3F6;
  --text: #061B2B;
  --muted: #56697A;
  --accent: #047857;
  --link: #047857;
  --ok: #059669;
  --warn: #D97706;
  --down: #DC2626;
  --border: #DCE4EA;
  --shadow: 0 1px 2px rgb(6 27 43 / .06), 0 4px 16px rgb(6 27 43 / .06);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font: 16px/1.55 var(--font);
}
a { color: var(--link); }
img, video { max-width: 100%; height: auto; }
code, pre, kbd { font-family: var(--mono); font-size: .92em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
main.site-main { flex: 1; padding: 20px 0 32px; }

/* ------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text) !important; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand svg { width: 28px; height: 28px; }
.brand-logo { height: var(--logo-h, 32px); width: auto; max-width: 220px; display: block; }
.brand .logo-light { display: none; }
:root[data-theme="light"] .brand .logo-dark { display: none; }
:root[data-theme="light"] .brand .logo-light { display: block; }
@media (max-width: 480px) { .brand-logo { height: calc(var(--logo-h, 32px) * .85); max-width: 160px; } }
.top-nav { display: none; gap: 4px; margin-left: 12px; }
.top-nav a { color: var(--muted) !important; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.top-nav a:hover, .top-nav a[aria-current="page"] { color: var(--text) !important; background: var(--surface); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px;
  background: transparent; color: var(--muted); border: 1px solid transparent; cursor: pointer; font: inherit; text-decoration: none;
}
.icon-btn:hover { color: var(--text); background: var(--surface); }
.icon-btn svg { width: 20px; height: 20px; }
.search-trigger { border-color: var(--border); background: var(--surface); color: var(--muted); }
.search-trigger kbd { border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; font-size: .75rem; }
.search-trigger .label, .search-trigger kbd { display: none; }
.header-account { display: none; }

/* ------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding: 22px 0 calc(var(--bottom-h) + 22px); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-footer a { color: var(--muted) !important; }

/* ------------------------------------------------------------ bottom bar (móvil) */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
.bottom-bar a, .bottom-bar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted) !important; text-decoration: none; font: 500 .7rem var(--font);
  background: none; border: 0; cursor: pointer;
}
.bottom-bar svg { width: 22px; height: 22px; }
.bottom-bar [aria-current="page"] { color: var(--link) !important; }

@media (min-width: 820px) {
  .top-nav { display: flex; }
  .bottom-bar { display: none; }
  .site-footer { padding-bottom: 22px; }
  .search-trigger { min-width: 220px; justify-content: flex-start; }
  .search-trigger .label { display: inline; }
  .search-trigger kbd { display: inline; margin-left: auto; }
  .header-account { display: inline-flex; }
}

/* ------------------------------------------------------------ componentes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text) !important;
  font: 600 .95rem var(--font); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text) !important; }
.btn.danger { color: var(--down) !important; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: .85rem; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 500 .85rem var(--font); cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag { font-size: .75rem; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.badge.aviso { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.published { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.unlisted { background: color-mix(in srgb, #38BDF8 20%, transparent); color: #7DD3FC; }
:root[data-theme="light"] .badge.unlisted { color: #0369A1; }
.muted { color: var(--muted); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; font-size: 1.15rem; }
.section-title a { font-size: .9rem; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface); }
.flash.error { border-color: var(--down); }

/* estados */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot.up { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot.down { background: var(--down); box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 25%, transparent); }
.dot.pending, .dot.maintenance { background: var(--warn); }

/* skeletons */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 7%, transparent), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ------------------------------------------------------------ home */
.hero { padding: 8px 0 4px; }
.hero h1 { font-size: clamp(1.5rem, 4.5vw, 2.2rem); line-height: 1.2; margin: 0 0 6px; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); }
.hero-search { margin-top: 16px; width: 100%; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; font: inherit; color: var(--muted); text-align: left; cursor: text; }
.hero-search svg { width: 20px; height: 20px; flex: none; }

.status-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.status-strip::-webkit-scrollbar { display: none; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); white-space: nowrap; color: var(--text) !important; text-decoration: none; font-size: .9rem; }
.status-pill.skeleton { width: 120px; height: 38px; border-radius: 999px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.feed { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .feed { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .feed { grid-template-columns: repeat(3, 1fr); } }
.feed-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; text-decoration: none; color: var(--text) !important; transition: border-color .15s, transform .15s; }
.feed-card:hover { border-color: var(--accent); }
.feed-card:active { transform: scale(.99); }
.feed-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.feed-card p { margin: 0; color: var(--muted); font-size: .93rem; }
.feed-card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; font-size: .8rem; color: var(--muted); }
.feed-empty { padding: 28px; text-align: center; color: var(--muted); }

.link-groups { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .link-groups { grid-template-columns: repeat(2, 1fr); } }
.link-group { padding: 14px 16px; }
.link-group h3 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.link-group ul { list-style: none; margin: 0; padding: 0; }
.link-group li a { display: flex; flex-direction: column; padding: 9px 0; border-top: 1px solid var(--border); text-decoration: none; color: var(--text) !important; }
.link-group li:first-child a { border-top: 0; }
.link-group li small { color: var(--muted); }

/* ------------------------------------------------------------ accesos rápidos */
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick-links .btn { min-height: 38px; border-radius: 999px; font-weight: 600; }
.link-group .more { display: inline-block; margin-top: 6px; font-size: .88rem; }

/* ------------------------------------------------------------ home: grilla con columna de noticias */
.home-grid { display: grid; gap: 0 24px; grid-template-columns: 1fr; grid-template-areas: "guides" "news" "links"; }
.home-guides { grid-area: guides; min-width: 0; }
.home-news { grid-area: news; min-width: 0; }
.home-links { grid-area: links; min-width: 0; }
@media (min-width: 980px) {
  /* La columna de noticias ocupa las dos filas. Con filas "auto" la altura que sobra (noticias más
     largas que las guías) se repartía entre las dos y "Enlaces útiles" bajaba según la página de noticias.
     Así la primera fila mide lo que miden las guías y los enlaces quedan pegados debajo. */
  .home-grid { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "guides news" "links news";
               grid-template-rows: auto 1fr; }
  .home-guides, .home-links { align-self: start; }
  .home-grid.no-news { grid-template-columns: 1fr; grid-template-areas: "guides" "links"; grid-template-rows: auto auto; }
  .home-news { align-self: start; position: sticky; top: calc(var(--header-h) + 12px); }
  .home-grid .feed { grid-template-columns: repeat(2, 1fr); }
}

.news-box { overflow: hidden; }
.news-page { animation: news-in .35s ease; }
@keyframes news-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.news-row { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); text-decoration: none; color: var(--text) !important; }
.news-row:first-child { border-top: 0; }
.news-row:hover strong { text-decoration: underline; }
.news-row strong { display: block; font-size: .95rem; line-height: 1.3; }
.news-num { flex: none; width: 22px; font-size: 1.5rem; font-weight: 300; line-height: 1; color: var(--muted); }
.news-meta { display: block; margin-top: 4px; font-size: .78rem; color: var(--muted); }
.news-row.featured { flex-direction: column; gap: 0; padding: 0; background: var(--surface-2); }
.news-row.featured .news-body { display: flex; gap: 12px; padding: 12px 16px 14px; }
.news-row.featured strong { font-size: 1.02rem; }
.news-img { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--surface); overflow: hidden; }
.news-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-img .play { position: absolute; left: 50%; top: 50%; width: 56px; height: 40px; margin: -20px 0 0 -28px; border-radius: 10px; background: rgb(0 0 0 / .7); }
.news-img .play::after { content: ""; position: absolute; left: 22px; top: 11px; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff; }
.news-nav { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; border-top: 1px solid var(--border); }
.news-nav .icon-btn { font-size: 1.4rem; line-height: 1; }
.news-dots { display: flex; gap: 6px; }
.news-dots button { width: 8px; height: 8px; padding: 0; border-radius: 50%; border: 0; background: var(--border); cursor: pointer; }
.news-dots button[aria-current="true"] { background: var(--link); width: 20px; border-radius: 4px; }

.video-modal { position: fixed; inset: 0; z-index: 150; background: rgb(0 0 0 / .8); display: flex; align-items: center; justify-content: center; padding: 16px; }
.video-modal[hidden] { display: none; }
.video-frame { position: relative; width: min(960px, 100%); }
.video-slot { aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.video-slot iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-close { position: absolute; top: -48px; right: 0; color: #fff; }

/* ------------------------------------------------------------ status page */
.status-overall { display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 16px; }
.status-overall .dot { width: 16px; height: 16px; }
.status-overall h1 { margin: 0; font-size: 1.25rem; }
.status-group { padding: 6px 16px; margin-bottom: 12px; }
.status-group h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 4px; }
.monitor { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.monitor:first-of-type { border-top: 0; }
.monitor .name { font-weight: 600; }
.monitor .uptime { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }
.beats { grid-column: 1 / -1; display: flex; gap: 2px; height: 22px; }
.beats i { flex: 1; border-radius: 3px; background: var(--muted); opacity: .35; }
.beats i.up { background: var(--ok); opacity: 1; }
.beats i.down { background: var(--down); opacity: 1; }
.beats i.pending, .beats i.maintenance { background: var(--warn); opacity: 1; }
.notice { padding: 14px 16px; margin-bottom: 14px; border-left: 4px solid var(--warn); }

/* ------------------------------------------------------------ contenido de páginas */
.page-content { max-width: 780px; margin: 0 auto; }
.page-content h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); line-height: 1.2; letter-spacing: -.02em; }
.page-content h2 { margin-top: 1.8em; }
.page-content table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.page-content th, .page-content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.page-content blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--accent); color: var(--muted); }
.page-content pre { position: relative; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; height: 30px; padding: 0 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 500 .8rem var(--font); cursor: pointer;
}
.copy-btn.done { color: var(--ok); border-color: var(--ok); }
.preview-banner { background: var(--warn); color: #111; text-align: center; padding: 6px 12px; font-size: .9rem; font-weight: 600; }
.edit-fab { position: fixed; right: 16px; bottom: calc(var(--bottom-h) + 16px); z-index: 30; box-shadow: var(--shadow); }
@media (min-width: 820px) { .edit-fab { bottom: 20px; } }

/* ------------------------------------------------------------ búsqueda (overlay) */
.search-overlay { position: fixed; inset: 0; z-index: 100; display: none; background: rgb(2 6 23 / .6); }
.search-overlay.open { display: block; }
.search-panel { background: var(--bg); height: 100%; display: flex; flex-direction: column; }
@media (min-width: 820px) {
  .search-panel { height: auto; max-height: 76vh; max-width: 680px; margin: 10vh auto 0; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
}
.search-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.search-box input { flex: 1; height: 44px; border: 0; background: transparent; color: var(--text); font: 1.05rem var(--font); outline: none; }
.search-results { overflow-y: auto; padding: 8px; flex: 1; }
.search-results a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text) !important; }
.search-results a:hover, .search-results a.active { background: var(--surface); }
.search-results small { display: block; color: var(--muted); }
.search-results h4 { margin: 10px 12px 4px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.search-empty { margin: 6px 4px 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.search-empty strong { display: block; }
.search-empty span { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.search-weak a { opacity: .85; }
.src-badge { display: inline-block; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border);
  font-size: .75rem; line-height: 1.5; color: var(--text); }
.search-results mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; }

/* ------------------------------------------------------------ formularios */
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { resize: vertical; }
.form-narrow { max-width: 420px; margin: 20px auto; padding: 22px; }
.form-row { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .form-row { grid-template-columns: repeat(2, 1fr); } .form-row.three { grid-template-columns: repeat(3, 1fr); } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.help { font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* ------------------------------------------------------------ splash */
.splash {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--brand) center / cover no-repeat; color: #F8FAFC;
  transition: opacity .45s ease, transform .45s ease;
}
.splash-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.splash-shade { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgb(6 27 43 / .35), rgb(6 27 43 / .85)); }
.splash canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.splash-center { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 24px; text-align: center; }
.splash-logo { height: clamp(56px, 14vw, 96px); width: auto; margin-bottom: 6px; filter: drop-shadow(0 2px 16px rgb(0 0 0 / .45)); }
.splash-brand { font-weight: 800; font-size: clamp(1.8rem, 8vw, 3.2rem); letter-spacing: -.02em; text-shadow: 0 2px 20px rgb(0 0 0 / .5); }
.splash-sub { color: #C9D7E1; font-size: clamp(.95rem, 3.5vw, 1.15rem); }
.splash-enter { margin-top: 18px; min-width: 150px; min-height: 48px; font-size: 1.05rem; opacity: 0; animation: splash-in .5s .6s forwards; }
@keyframes splash-in { to { opacity: 1; } }
.splash-skip { position: absolute; bottom: calc(28px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #9FB4C4; font-size: .85rem; }
.splash-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgb(255 255 255 / .08); }
.splash-progress i { display: block; height: 100%; width: 100%; background: var(--link); transform-origin: left; transform: scaleX(0); }
.splash.hide { opacity: 0; transform: translateY(-40px); pointer-events: none; }
html.no-splash .splash { display: none; }
body.splash-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.btn svg, .meta svg { width: 18px; height: 18px; flex: none; }
.meta svg { width: 15px; height: 15px; }
.search-box > svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
