/**
 * Header — Menú al capdamunt (mateix estil que la nav lateral).
 * Logo fix sobre el hero amb efecte pin/relleu.
 */

:root {
  --origo-sidebar-width: 200px;
}

/* Sense sidebar: sense padding lateral al body */
@media (min-width: 1024px) {
  body.has-origo-sidebar {
    padding-left: 0;
  }
}

body.has-origo-sidebar #main-content {
  margin-left: 0;
  width: 100%;
}

/* ========== MENÚ SUPERIOR (desktop) — mateix estil que abans ========== */
.origo-header-top {
  display: none;
}

@media (min-width: 1024px) {
  .origo-header-top {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 1.25rem 2rem;
    background: rgba(255, 255, 255, 0.28);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 24px rgba(39, 56, 55, 0.06);
  }

  .origo-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2rem;
  }

  .origo-header-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .origo-header-menu li {
    margin: 0;
  }

  .origo-header-menu a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--origo-dark);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s ease, border-color 0.2s ease;
  }

  .origo-header-menu a:hover,
  .origo-header-menu .current-menu-item a {
    color: var(--origo-blue);
    border-bottom-color: var(--origo-blue);
  }

  .origo-header-cta {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--origo-blue);
    color: #fff;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  .origo-header-cta:hover {
    background: #8ab8ba;
    box-shadow: 0 4px 12px rgba(160, 201, 203, 0.4);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
  }
}

/* ========== LOGO FIX A LA CAPÇALERA — 30% més gran, sense efectes, mateixa posició ========== */
.origo-logo-pin {
  position: fixed;
  left: calc(2rem + 3cm);
  top: 3rem;
  z-index: 60;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.origo-logo-pin .origo-logo-pin-card {
  pointer-events: auto;
  display: block;
  text-decoration: none;
  /* Logo escalat: +50% més (1,105 × 1,50 ≈ 1,66) */
  transform: scale(1.66);
  transform-origin: left center;
}

/* Logo: dimensions màximes + escala per si no és custom logo */
.origo-logo-pin-card img,
.origo-logo-pin-card .custom-logo-link img {
  display: block;
  width: auto !important;
  max-width: 276px !important;
  height: auto !important;
  max-height: 82px !important;
}

.origo-logo-pin-card .custom-logo-link {
  display: block;
}

body:not(.home) .origo-logo-pin {
  top: 3rem;
}

@media (min-width: 1024px) {
  .origo-logo-pin {
    top: 3rem;
  }
}

@media (max-width: 1023px) {
  .origo-logo-pin {
    left: 1rem;
    top: 7rem;
  }

  .origo-logo-pin-card img,
  .origo-logo-pin-card .custom-logo-link img {
    max-width: 159px !important;
    max-height: 48px !important;
  }
}

/* ========== MÒBIL: botó menú (hamburguesa) ========== */
.origo-drawer-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: rgba(245, 244, 237, 0.95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(39, 56, 55, 0.15);
  color: var(--origo-dark);
  cursor: pointer;
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.origo-drawer-toggle:hover {
  opacity: 0.9;
  box-shadow: 0 4px 16px rgba(39, 56, 55, 0.2);
}

@media (max-width: 1023px) {
  .origo-drawer-toggle {
    display: flex;
  }
}

@media (min-width: 1024px) {
  .origo-drawer-toggle {
    display: none !important;
  }
}

.origo-drawer-toggle[aria-expanded="true"] .origo-drawer-toggle-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.origo-drawer-toggle[aria-expanded="true"] .origo-drawer-toggle-bar:nth-child(2) {
  opacity: 0;
}

.origo-drawer-toggle[aria-expanded="true"] .origo-drawer-toggle-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.origo-drawer-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* ========== DRAWER MÒBIL ========== */
.origo-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  max-width: 320px;
  background: var(--origo-cream);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

.origo-drawer.is-open {
  transform: translateX(0);
}

.origo-drawer[aria-hidden="false"] {
  transform: translateX(0);
}

.origo-drawer-inner {
  padding: 4rem 1.5rem 2rem;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.origo-drawer-nav {
  flex: 1 1 auto;
}

.origo-drawer-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.origo-drawer-menu li {
  border-bottom: 1px solid var(--origo-grey);
}

.origo-drawer-menu a {
  display: block;
  padding: 1rem 0;
  color: var(--origo-dark);
  text-decoration: none;
  font-size: 1.0625rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.origo-drawer-menu a:hover {
  color: var(--origo-blue);
}

.origo-drawer-cta {
  display: block;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--origo-blue);
  color: #fff;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 0.5rem;
  transition: background 0.2s ease;
}

.origo-drawer-cta:hover {
  background: #8ab8ba;
  color: #fff;
  text-decoration: none;
}

.origo-drawer-logo {
  margin-top: auto;
  padding-top: 2rem;
}

.origo-drawer-logo a {
  display: block;
}

.origo-drawer-logo img {
  max-width: 144px;
  height: auto;
}

.origo-drawer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--origo-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.origo-drawer-close:hover {
  opacity: 0.7;
}

.origo-drawer-close svg {
  width: 24px;
  height: 24px;
}

.origo-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(39, 56, 55, 0.4);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.origo-drawer-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

@media (min-width: 1024px) {
  .origo-drawer,
  .origo-drawer-backdrop {
    display: none !important;
  }
}

/* Espai per no tapar contingut: el header superior ocupa alçada */
@media (min-width: 1024px) {
  body.has-origo-sidebar {
    padding-top: 0;
  }
}

@media (max-width: 1023px) {
  body.has-origo-sidebar {
    padding-top: 0;
  }
}

/* ========== Pàgina d'inici (mòbil): capçalera i menú correctes ========== */
@media (max-width: 1023px) {
  body.home #site-header.origo-header-top,
  body.home .origo-header-top {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  body.home .origo-logo-pin {
    left: 1rem;
    top: 7rem;
    z-index: 60;
  }
  body.home .origo-drawer-toggle {
    display: flex !important;
    top: 1rem;
    right: 1rem;
    z-index: 60;
  }
  /* Assegurar que el contingut de la portada no tapi logo/hamburguesa */
  body.home #main-content.homepage-radical,
  body.home #hero {
    position: relative;
    z-index: 0;
  }
}
