/* 02-layout.css
   Header / nav / footer + layout utilities (container, offsets).
   This is the ONLY place that should style the global chrome.
*/

/* Optional helper container for pages that want it */
.container{
  width: min(92vw, var(--container));
  margin: 0 auto;
}

/* Offset opt-in so fixed header doesn't cover content */
.with-header-offset{ padding-top: var(--header-offset); }

/* Anchors: prevent jumping under the fixed header */
[id]{ scroll-margin-top: var(--header-offset); }

/* ==========================================================
   Header
   Default (scroll): floating glass card
   At/near top: compact, full-width bar
   Toggle via html.is-at-top (see layout.js)
   ========================================================== */

header{
  position: fixed;
  top: 12px;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 12px;
}

.header-container{
  width: min(92vw, var(--container));
  margin: 0 auto;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 10px 14px;
  border-radius: var(--r-lg);

  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));

  box-shadow: var(--shadow-soft);
  transition:
    padding var(--ease),
    border-radius var(--ease),
    box-shadow var(--ease),
    background var(--ease),
    border-color var(--ease);

  position: relative; /* anchor for mobile dropdown */
}

/* At top: compact + adhered + elongated */
html.is-at-top header{ top: 0; padding: 0; }
html.is-at-top .header-container{
  width: 100%;
  max-width: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: 6px 18px;
  background: var(--surface-solid);
  border-color: var(--border-strong);
  box-shadow: 0 8px 22px rgba(15,17,21,0.09);
}

/* Brand micro-logo swap (BCC ↔ ∴) */
.logo-link{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-brand);
  font-weight: 700;
  letter-spacing: 0.04em;
  width: 34px;
  height: 34px;
}

.logo-text, .logo-symbol{
  position: absolute;
  transition: opacity var(--ease), transform var(--ease);
}

/* arriba: BCC */
html.is-at-top .logo-text{ opacity: 1; transform: translateY(0); }
html.is-at-top .logo-symbol{ opacity: 0; transform: translateY(2px); }

/* scrolleado/compacto: ∴ */
html:not(.is-at-top) .logo-text{ opacity: 0; transform: translateY(-2px); }
html:not(.is-at-top) .logo-symbol{ opacity: 1; transform: translateY(0); }

/* ---- Navigation ---- */
nav{
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

nav h1{
  margin: 0;
  display: flex;
  align-items: center;
}

/* Works with <img class="logo"> inside h1 */
header .header-container nav h1 img{
  height: 34px;
  width: auto;
}
html.is-at-top header .header-container nav h1 img{ height: 30px; }

.logo{
  height: 34px;
  width: auto;
}
html.is-at-top .logo{ height: 30px; }

/* Legacy separator used in older markup */
hr.solid{ display: none; }

nav ul{
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

nav li{ margin: 0; }

nav a{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
  white-space: nowrap;
}

#blog-link{ white-space: nowrap; }

nav a:hover{
  background: rgba(237,70,36,0.08);
  color: var(--ink);
}

nav a:active{ transform: translateY(1px); }

/* ---- Hamburger ---- */
.menu-toggle{
  display: none; /* enabled on mobile */
  align-items: center;
  justify-content: center;

  width: 40px;
  height: 40px;

  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgbax: rgba(255,255,255,0.70);
  background: rgba(255,255,255,0.70);
  color: var(--ink);

  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;

  box-shadow: 0 2px 10px rgba(15,17,21,0.06);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

/* Permite que el toggle esté a la derecha aunque venga antes en el DOM */
.header-container > nav{ order: 1; }
.header-container > .menu-toggle{ order: 2; margin-left: auto; }

.menu-toggle:hover{
  border-color: var(--border-strong);
  background: rgba(255,255,255,0.92);
}

.menu-toggle:active{ transform: translateY(1px); }

.menu-toggle:focus-visible{
  outline: 2px solid rgba(237,70,36,0.35);
  outline-offset: 2px;
}

/* ---- Mobile dropdown ---- */
@media (max-width: 860px){
  .menu-toggle{ display: flex; margin-left: auto; }
  nav ul{ display: none; }

  nav.active ul{
    display: flex;
    flex-direction: column;

    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 10px);

    margin: 0 12px;
    padding: 10px;

    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);

    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));

    box-shadow: var(--shadow);
    gap: 6px;
  }

  nav.active ul a{
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
  }
}

/* ==========================================================
   Footer
   ========================================================== */

footer{
  margin-top: 40px;
  padding: 22px 12px;
  color: rgba(15,17,21,0.75);
}

footer p{ margin: 0; font-size: 0.95rem; }

.footer-social{
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.footer-social a{
  padding: 6px 8px;
  border-radius: 10px;
}

.footer-social a:hover{
  background: rgba(237,70,36,0.06);
  color: var(--accent);
}
