/* ==========================================================================
   Site header
   At rest it sits on top of the hero (transparent). After the hero it slides
   down as a fixed white bar (.is-fixed, set by js/header.js) with the same
   content. Moisés can "speak" from it with a speech bubble (.owner__say).
   ========================================================================== */
.site-header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 80; /* under the gallery overlay (100) */
  padding: 24px 0;
}

.site-header.is-fixed {
  position: fixed;
  padding: 10px 0;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border), 0 12px 32px -16px rgba(11, 27, 46, .18);
  animation: header-in 420ms var(--ease) both;
}

.site-header.is-leaving { animation: header-out 260ms ease both; }

@keyframes header-in  { from { opacity: 0; transform: translateY(-100%); } }
@keyframes header-out { to   { opacity: 0; transform: translateY(-100%); } }

/* full width: brand + menu on the left, Moisés + buttons on the right */
.site-header .site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: none;
  padding: 0 40px;
}

/* ---- brand ------------------------------------------------------------------ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-strong);
  text-decoration: none;
}

.brand img { width: 44px; height: auto; mix-blend-mode: multiply; }

.brand__name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---- navigation ------------------------------------------------------------- */
.site-nav {
  display: flex;
  gap: 28px;
  margin-left: 8px;
}

.site-nav a {
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease;
}

.site-nav a:hover { color: var(--text-strong); }

/* ---- Moisés: photo, name, role, call + WhatsApp --------------------------------- */
.owner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.owner__avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 18px;
  font-weight: 600;
}

/* photo covers the initial; if it fails to load (alt=""), the initial shows */
.owner__avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.owner__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  white-space: nowrap;
}

.owner__name { color: var(--text-strong); font-size: 15px; font-weight: 600; }
.owner__role { color: var(--text); font-size: 13px; }

.owner__actions {
  display: flex;
  gap: 8px;
  margin-left: 8px;
}

.hbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.hbtn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hbtn--primary { background: var(--accent); color: #fff; }
.hbtn--primary:hover { background: var(--accent-hover); }
.hbtn--soft { background: var(--accent-soft); color: var(--accent-text); font-variant-numeric: tabular-nums; }
.hbtn--soft:hover { background: color-mix(in oklch, var(--accent) 16%, transparent); }

/* ---- "Menú" button (small screens) -------------------------------------------- */
.menu-btn {
  display: none;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.menu-btn:hover,
.menu-btn[aria-expanded="true"] { background: var(--surface-subtle); }

/* ---- speech bubble -------------------------------------------------------------- */
.owner__say {
  --tail: 24px; /* horizontal position of the tail, set from JS to point at the photo */
  position: absolute;
  top: calc(100% + 18px);
  left: -8px; /* tail (over the photo centre) sits clear of the rounded corner */
  width: 300px;
  padding: 14px 40px 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lift), 0 0 0 1px rgba(9, 11, 21, .05);
  color: var(--text-strong);
  font-size: 15px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(-6px) scale(.96);
  transform-origin: var(--tail) 0;
  transition: opacity 220ms ease, transform 420ms var(--ease);
}

.owner__say::before {
  content: "";
  position: absolute;
  top: -6px;
  left: calc(var(--tail) - 7px);
  width: 14px;
  height: 14px;
  border-radius: 3px 0 0 0;
  background: var(--surface);
  box-shadow: -1px -1px 0 rgba(9, 11, 21, .05);
  transform: rotate(45deg);
}

.owner__say[hidden] { display: none; }
.owner__say.is-visible { opacity: 1; transform: none; }

.owner__msg {
  margin: 0;
  transition: opacity 250ms ease;
}

/* "typing…" dots shown for a moment before the message */
.owner__typing {
  position: absolute;
  top: 50%;
  left: 16px;
  display: none;
  gap: 4px;
  transform: translateY(-50%);
}

.owner__typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1s ease-in-out infinite;
}

.owner__typing i:nth-child(2) { animation-delay: 150ms; }
.owner__typing i:nth-child(3) { animation-delay: 300ms; }

@keyframes typing {
  0%, 60%, 100% { opacity: .35; transform: none; }
  30% { opacity: 1; transform: translateY(-3px); }
}

.owner__say.is-typing .owner__typing { display: flex; }
.owner__say.is-typing .owner__msg { opacity: 0; }

.owner__say-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.owner__say-close:hover { background: var(--surface-subtle); color: var(--text); }

.owner__say-close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

/* ---- smaller screens ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .site-header .site-header__inner { gap: 24px; padding: 0 24px; }
  .site-nav { gap: 20px; margin-left: 0; }
}

/* links move into a dropdown opened by "Menú" */
@media (max-width: 960px) {
  .menu-btn { display: inline-flex; }

  .site-nav {
    position: absolute;
    top: calc(100% + 10px);
    left: 24px;
    display: none;
    flex-direction: column;
    gap: 0;
    min-width: 220px;
    padding: 8px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-lift), 0 0 0 1px rgba(9, 11, 21, .05);
  }

  .site-nav.is-open { display: flex; animation: menu-in 260ms var(--ease) both; }

  .site-nav a {
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--text-strong);
  }

  .site-nav a:hover { background: var(--surface-subtle); }
}

@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }

@media (max-width: 720px) {
  .site-header { padding: 14px 0; }
  .site-header.is-fixed { padding: 8px 0; }
  .site-header .site-header__inner { gap: 10px; padding: 0 16px; }
  .brand { gap: 8px; }
  .brand img { width: 34px; }
  .brand__name { font-size: 13px; line-height: 1.15; letter-spacing: .1em; }
  .brand__name > span { display: block; } /* ESTORES / TENERIFE on two lines */

  /* "Menú" on the right, dropdown opens under it */
  .menu-btn { margin-left: auto; }
  .site-nav { right: 16px; left: auto; }

  /* Moisés + buttons: a dock fixed in the bottom-right corner
     (js/header.js moves .owner out of the header on small screens) */
  .owner--dock {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 85;
    gap: 6px;
    margin: 0;
    padding: 6px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-lift), 0 0 0 1px rgba(9, 11, 21, .05);
  }

  .owner--dock .owner__avatar { width: 44px; height: 44px; }
  .owner--dock .owner__text { display: none; }
  .owner--dock .owner__actions { gap: 6px; margin-left: 0; }
  .owner--dock .hbtn { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .owner--dock .hbtn svg { width: 22px; height: 22px; }
  .owner--dock .hbtn span { display: none; }
  /* the call button also shows the number */
  .owner--dock .hbtn--soft { width: auto; padding: 0 16px 0 13px; }
  .owner--dock .hbtn--soft span { display: inline; }

  /* speech bubble opens above the dock, tail pointing down at the photo */
  .owner--dock .owner__say {
    top: auto;
    right: 0;
    bottom: calc(100% + 14px);
    left: auto;
    width: min(300px, calc(100vw - 32px));
    transform: translateY(6px) scale(.96);
    transform-origin: var(--tail) 100%;
  }

  .owner--dock .owner__say.is-visible { transform: none; }

  .owner--dock .owner__say::before {
    top: auto;
    bottom: -6px;
    box-shadow: 1px 1px 0 rgba(9, 11, 21, .05);
  }
}
