@layer layout {
  .container {
    width: 100%;
    max-width: 1240px;
    margin-inline: auto;
    padding-inline: var(--gutter);
  }
  .container--mid { max-width: 920px; }
  .container--narrow { max-width: 620px; }

  .skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 100;
    background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: var(--r-sm);
  }
  .skip-link:focus { top: 12px; color: #fff; }

  .site-main { flex: 1; padding-block: var(--s-5) var(--s-8); }

  /* --- Cabecera --------------------------------------------------------- */
  .site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgb(255 253 248 / 0.92);
    backdrop-filter: saturate(1.4) blur(10px);
    box-shadow: 0 1px 0 var(--line), 0 6px 20px -16px rgb(22 50 79 / 0.4);
  }
  .site-header__inner {
    height: var(--header-h);
    display: flex; align-items: center; gap: var(--s-4);
  }
  .site-nav { display: none; }
  .site-header__actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-1); }

  @media (min-width: 860px) {
    .site-nav { display: flex; gap: clamp(0.75rem, 2vw, 2rem); margin-left: auto; }
    .site-nav a {
      position: relative; text-decoration: none; font-weight: 700; color: var(--ink-2);
      padding-block: 0.4rem;
    }
    .site-nav a::after {
      content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; border-radius: 3px;
      background: var(--slime); transform: scaleX(0); transition: transform 0.2s var(--ease);
    }
    .site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }
    .site-nav a[aria-current="page"] { color: var(--slime-600); }
    .site-header__actions { margin-left: var(--s-4); gap: var(--s-2); }
  }

  .logo { display: inline-flex; align-items: center; gap: 0.45rem; text-decoration: none; flex: none; }
  .logo__mark { width: 44px; height: 44px; }
  .logo__text { font-weight: 900; font-size: 1.55rem; letter-spacing: -0.02em; color: var(--ink); }
  .logo__text span { color: var(--slime); }
  .logo:hover { color: inherit; }
  @media (min-width: 1024px) {
    .logo__mark { width: 52px; height: 52px; }
    .logo__text { font-size: 1.85rem; }
  }

  .profile-link { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; text-decoration: none; padding: 0.25rem 0.5rem 0.25rem 0.25rem; border-radius: var(--r-pill); }
  .profile-link[aria-current="page"] span { text-decoration: underline 3px var(--slime); text-underline-offset: 6px; }
  .user-menu > summary { list-style: none; cursor: pointer; }
  .user-menu > summary::-webkit-details-marker { display: none; }
  .user-menu > summary:hover { background: var(--cream); }
  .user-menu[open] > summary .icon { transform: rotate(180deg); }
  .user-menu .menu__panel { min-width: 240px; }
  .user-menu__head { display: grid; padding: 0.5rem 0.75rem 0.6rem; line-height: 1.3; }
  .menu__sep { border: 0; height: 1px; background: var(--line); margin: 0.35rem 0; }
  .header-login { white-space: nowrap; }
  @media (max-width: 479px) {
    .site-header .lang-switch { display: none; } /* en el pie de página sigue disponible */
    .site-header__actions .icon-btn { min-width: 40px; }
    .logo__text { font-size: 1.35rem; }
    .logo__mark { width: 38px; height: 38px; }
  }
  .header-drops { display: inline-flex; align-items: center; height: 36px; padding: 0 0.7rem; border-radius: var(--r-pill); background: var(--slime-100); color: var(--slime-600); text-decoration: none; font-size: var(--fs-sm); }
  .header-drops:hover { background: #c9ece7; color: var(--ink); }
  @media (max-width: 859px) { .profile-link { padding: 0.15rem; } .profile-link .avatar { --size: 34px; } }

  .bell { position: relative; }
  .bell__count {
    position: absolute; top: 2px; right: 0;
    min-width: 18px; height: 18px; padding-inline: 4px;
    display: grid; place-items: center;
    border-radius: var(--r-pill); background: var(--cta); color: var(--ink);
    font-size: 0.7rem; font-weight: 900; border: 2px solid var(--paper);
  }

  /* --- Barra inferior (móvil) ------------------------------------------- */
  .tab-bar {
    position: fixed; inset: auto 0 0 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--paper);
    box-shadow: 0 -1px 0 var(--line), 0 -8px 24px -18px rgb(22 50 79 / 0.5);
  }
  .tab-bar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 0.7rem; font-weight: 700; text-decoration: none; color: var(--muted);
  }
  .tab-bar .icon { width: 24px; height: 24px; }
  .tab-bar a[aria-current="page"] { color: var(--slime-600); }
  .tab-bar a[aria-current="page"] .icon { stroke-width: 2.5; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

  @media (min-width: 860px) {
    .tab-bar { display: none; }
    body { padding-bottom: 0; }
  }

  /* --- Pie --------------------------------------------------------------- */
  .site-footer { border-top: 1px solid var(--line); background: var(--paper); padding-block: var(--s-6); }
  .site-footer__inner { display: grid; gap: var(--s-4); }
  .site-footer__brand p { color: var(--muted); margin-top: var(--s-2); }
  .site-footer__brand .logo__mark { width: 36px; height: 36px; }
  .site-footer__brand .logo__text { font-size: 1.3rem; }
  .site-footer__links { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
  .site-footer__links a, .site-footer__lang a { text-decoration: none; font-weight: 600; color: var(--ink-2); }
  .site-footer__links a:hover, .site-footer__lang a:hover { text-decoration: underline; }
  .site-footer__lang { display: flex; align-items: center; gap: var(--s-3); }
  .site-footer__lang a[aria-current="true"] { color: var(--slime-600); text-decoration: underline 2px; }
  .site-footer__copy { color: var(--muted); font-size: var(--fs-sm); }

  @media (min-width: 860px) {
    .site-footer__inner { grid-template-columns: 1.2fr 2fr auto; align-items: start; }
    .site-footer__copy { grid-column: 1 / -1; }
  }

  /* --- Contenedor "hoja" de los mockups ---------------------------------- */
  .sheet {
    position: relative;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: clamp(1.1rem, 3vw, 2.75rem);
    isolation: isolate;
  }
  .sheet + .sheet { margin-top: var(--s-5); }
  @media (max-width: 639px) {
    .sheet { border-radius: var(--r); }
  }

  .page-head { margin-block: var(--s-3) var(--s-5); }
  .page-head h1 em { font-style: normal; color: var(--ink-2); background: linear-gradient(transparent 62%, var(--slime-100) 0); }
}
