/* =========================================================
   Base: reset, tipografía, header, footer
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--sc-yellow);
  accent-color: var(--sc-yellow);
  min-height: 100vh;
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
main { flex: 1; }
main:focus { outline: none; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p a, .help a, .notice a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(240,233,35,.6); }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; margin: 0; letter-spacing: -.02em; font-weight: 800; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--sc-yellow); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--sc-yellow); color: var(--on-yellow); }
.num { font-variant-numeric: tabular-nums; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: var(--z-toast); background: var(--sc-yellow); color: var(--on-yellow); padding: 10px 16px; border-radius: var(--r-sm); font-weight: 800; }
.skip-link:focus { top: 12px; }

/* ---------- Header: transparente sobre el billboard, sólido al hacer scroll ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-header);
  background-color: transparent;
  background-image: linear-gradient(180deg, rgba(11,13,16,.85) 0%, rgba(11,13,16,0) 100%);
  transition: background-color var(--t-med) ease, box-shadow var(--t-med) ease;
}
.site-header.is-solid { background-color: var(--bg); box-shadow: 0 1px 0 var(--line); }
body:not([data-page="inicio"]):not([data-page="titulo"]) main { padding-top: var(--header-h); }
.site-header__inner { height: var(--header-h); display: flex; align-items: center; gap: var(--s-6); padding-inline: var(--gutter); }

/* Logo oficial (versión con fondo transparente) */
.brand-plate { display: inline-flex; align-items: center; flex-shrink: 0; border-radius: 8px; }
.brand-plate img { height: 46px; width: auto; filter: drop-shadow(0 3px 10px rgba(0,0,0,.45)); }

.main-nav { display: flex; align-items: center; gap: var(--s-5); }
.main-nav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2);
  transition: color var(--t-fast) ease; white-space: nowrap;
}
.main-nav a svg { display: none; width: 20px; height: 20px; }
.main-nav a[aria-current="page"] { color: var(--text); }
.main-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 2px; border-radius: 2px; background: var(--sc-red); }
.main-nav a.nav-hot { color: var(--sc-yellow); }
@media (hover: hover) { .main-nav a:hover { color: var(--text); } }

.header-actions { display: flex; align-items: center; gap: var(--s-3); margin-left: auto; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border-radius: var(--r-pill); border: 0; background: transparent; color: var(--text);
  cursor: pointer; transition: background-color var(--t-fast) ease;
}
.icon-btn svg { width: 22px; height: 22px; }
@media (hover: hover) { .icon-btn:hover { background: rgba(255,255,255,.1); } }
.icon-btn.boxed { background: var(--surface); border: 1px solid var(--line); }
.icon-btn[aria-pressed="true"] { background: var(--sc-yellow); color: var(--on-yellow); }

/* Avatar de perfil = logo circular oficial (identidad del brief) */
.me-btn { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; font-size: var(--fs-sm); color: var(--text-2); }
.me-btn .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; transition: box-shadow var(--t-fast) ease; }
.me-btn .avatar img { width: 32px; height: auto; }
.me-btn[aria-current="page"] .avatar, .me-btn:focus-visible .avatar { box-shadow: 0 0 0 2px var(--sc-yellow); }
@media (hover: hover) { .me-btn:hover { color: var(--text); } .me-btn:hover .avatar { box-shadow: 0 0 0 2px var(--text); } }
.me-btn .count { position: absolute; top: 0; left: 26px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; background: var(--sc-red); color: #fff; border-radius: var(--r-pill); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.me-btn .count[hidden] { display: none; }
.menu-toggle { display: none; }

@media (max-width: 1240px) { .main-nav { gap: var(--s-4); } .me-btn .label { display: none; } }
@media (max-width: 1080px) {
  .menu-toggle { display: inline-grid; }
  .site-header__inner { gap: var(--s-3); }
  .brand-plate img { height: 38px; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 0 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: var(--s-4) var(--gutter) var(--s-7); background: var(--bg);
    opacity: 0; transform: translateY(-8px); visibility: hidden; pointer-events: none;
    transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out), visibility 0s linear var(--t-med);
    overflow-y: auto; overscroll-behavior: contain;
  }
  .main-nav.is-open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .main-nav a { min-height: 52px; padding: 0 12px; font-size: var(--fs-lg); border-radius: var(--r-md); gap: 14px; }
  .main-nav a svg { display: block; }
  .main-nav a[aria-current="page"] { background: var(--surface-2); }
  .main-nav a[aria-current="page"]::after { display: none; }
  .site-header.menu-open { background-color: var(--bg); }
}

/* ---------- Footer ---------- */
.site-footer { margin-top: var(--s-9); border-top: 1px solid var(--line); background: var(--bg-elev); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--s-6); padding-block: var(--s-8) var(--s-6); }
.footer-brand .brand-plate img { height: 64px; }
.footer-brand p { color: var(--text-2); margin-top: var(--s-4); max-width: 36ch; font-size: var(--fs-sm); }
.footer-tagline { font-family: var(--font-display); font-weight: 800; color: var(--sc-yellow); margin-top: var(--s-3); letter-spacing: .04em; }
.site-footer h2 { font-size: var(--fs-sm); font-family: var(--font-body); font-weight: 700; color: var(--text-3); margin-bottom: var(--s-3); letter-spacing: 0; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.site-footer ul a { display: inline-flex; align-items: center; min-height: 36px; color: var(--text-2); font-size: var(--fs-sm); transition: color var(--t-fast) ease; }
@media (hover: hover) { .site-footer ul a:hover { color: var(--text); } }
.socials { display: flex; gap: 8px; margin-top: var(--s-4); }
.socials a { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); transition: background-color var(--t-fast) ease; }
@media (hover: hover) { .socials a:hover { background: var(--sc-red); } }
.socials svg { width: 18px; height: 18px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3); padding-block: var(--s-5); border-top: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-xs); }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
#out:focus { outline: none; }
[hidden] { display: none !important; }
