/* Page frame: container, header, navigation, sections, footer */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: calc(760px + var(--gutter) * 2);
}

/* Product bar: above the header (and not sticky with it), says which Tuka you're looking at */

.product-bar {
  background: var(--slate-ink);
  color: var(--color-on-dark-muted);
  font-size: var(--text-sm);
}

.product-bar__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  white-space: nowrap;
}

.product-bar__label {
  display: none;
}
@media (min-width: 720px) {
  .product-bar__label {
    display: inline;
  }
}

.product-bar__home {
  flex: none;
  padding-right: var(--space-3);
  border-right: 1px solid rgb(255 255 255 / 0.18);
  color: var(--color-on-dark);
  font-weight: 700;
  text-decoration: none;
}
.product-bar__home:hover {
  color: var(--mustard);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(251 246 236 / 0.9);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
}

.site-header--scrolled,
.site-header:has(.nav-menu[open]) {
  border-bottom-color: var(--color-border);
}

.site-header__bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--eye);
  text-decoration: none;
  margin-right: auto;
}

.brand__logo {
  width: 38px;
  height: auto;
}

.brand__product {
  align-self: flex-end;
  margin-bottom: 0.4em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rust-ink);
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.site-nav {
  display: none;
}

.site-nav__list {
  display: flex;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  color: var(--color-text);
  font-weight: 550;
  font-size: 0.95rem;
  text-decoration: none;
}

.site-nav__link:hover {
  background: var(--sand);
}
.site-nav__link[aria-current="page"] {
  background: var(--eye);
  color: var(--white);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

@media (max-width: 419px) {
  .site-header__actions .site-header__cta {
    display: none;
  }
}

/* "Entrar" on pages of no product: a <details> listing each product's app */

.login-menu {
  position: relative;
}
.login-menu > summary {
  list-style: none;
  cursor: pointer;
}
.login-menu > summary::-webkit-details-marker {
  display: none;
}
.login-menu > summary::after {
  content: "▾";
  margin-left: var(--space-1);
  font-size: 0.8em;
}

.login-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  z-index: 60;
  width: min(280px, calc(100vw - var(--gutter) * 2));
  padding: var(--space-3);
  background: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.login-menu__title {
  margin: var(--space-1) var(--space-2) var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.login-menu__panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.login-menu__link {
  display: grid;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
}

.login-menu__link:hover {
  background: var(--sand);
}
.login-menu__link span {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* On phones the menu panel already lists both apps */
@media (max-width: 559px) {
  .login-menu {
    display: none;
  }
}

/* Mobile menu: a <details>, so it works without JavaScript */

.nav-menu {
  position: static;
}

.nav-menu > summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--eye);
  color: var(--white);
  cursor: pointer;
  list-style: none;
}

.nav-menu > summary::-webkit-details-marker {
  display: none;
}

.nav-menu__icon,
.nav-menu__icon::before,
.nav-menu__icon::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease;
}

.nav-menu__icon {
  position: relative;
}
.nav-menu__icon::before,
.nav-menu__icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-menu__icon::before {
  top: -6px;
}
.nav-menu__icon::after {
  top: 6px;
}
.nav-menu[open] .nav-menu__icon {
  background: transparent;
}
.nav-menu[open] .nav-menu__icon::before {
  transform: translateY(6px) rotate(45deg);
}
.nav-menu[open] .nav-menu__icon::after {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-menu__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  padding: var(--space-4) var(--gutter) var(--space-8);
  background: var(--cream);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
}

.nav-menu__list {
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
}

.nav-menu__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-menu__link::after {
  content: "→";
  color: var(--rust-ink);
}
.nav-menu__link[aria-current="page"] {
  color: var(--rust-ink);
}

.nav-menu__actions {
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 960px) {
  .site-nav {
    display: block;
  }
  .nav-menu {
    display: none;
  }
}

/* Sections */

.section {
  padding-block: var(--space-section);
  position: relative;
}
.section--tight {
  padding-block: clamp(2.5rem, 2rem + 3vw, 4.5rem);
}
.section--sand {
  background: var(--sand);
}
.section--white {
  background: var(--white);
}
.section--dark {
  background: var(--slate-deep);
  color: var(--color-on-dark);
}
.section--dark a:not(.btn),
.hero a:not(.btn) {
  color: var(--mustard);
}

.section-head {
  max-width: 760px;
  margin-bottom: var(--space-12);
}
.section-head--center {
  margin-inline: auto;
  text-align: center;
}
.section-head p {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}
.section--dark .section-head p {
  color: var(--color-on-dark-muted);
}

/* Footer */

.site-footer {
  background: var(--slate-ink);
  color: var(--color-on-dark-muted);
  padding-block: var(--space-16) var(--space-8);
  font-size: var(--text-sm);
}

.site-footer a {
  color: var(--color-on-dark);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}

.site-footer__top {
  display: grid;
  gap: var(--space-10);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}

@media (min-width: 720px) {
  .site-footer__top {
    grid-template-columns: repeat(2, 1fr);
  }
  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1000px) {
  .site-footer__top {
    grid-template-columns: 1.4fr repeat(4, 1fr);
  }
  .site-footer__brand {
    grid-column: auto;
  }
}

.site-footer__brand .brand {
  gap: var(--space-3);
  color: var(--color-on-dark);
}

/* The toucan is mostly black, and would vanish on the dark footer: it sits on a cream tile, like the app icon */
.site-footer__brand .brand__logo {
  width: 52px;
  padding: 8px;
  border-radius: 14px;
  background: var(--cream);
}
.site-footer__brand p {
  max-width: 32ch;
  margin-top: var(--space-4);
}

.site-footer__title {
  margin-bottom: var(--space-3);
  color: var(--color-on-dark);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

.site-footer__title--next {
  margin-top: var(--space-6);
}

.site-footer__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-2);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: space-between;
  padding-top: var(--space-6);
}

/* Every header follows the scroll (a scroll-driven animation, no JavaScript). It starts see-through and, once it
   reaches the top (the product bar gone), settles into the frosted cream header with its border over the next 140px.
   Over a dark hero (the home page and each product's landing page) it is immersive: it starts in the hero's own
   colour, light on dark, and its text turns dark halfway. Browsers without scroll-driven animations show the usual
   cream header from the start. */

/* The home page's header is minimal, only the logo and two buttons: with no menu button, both stay on phones too */
.site-header--minimal .login-menu { display: block; }
.site-header--minimal .site-header__cta { display: inline-flex; }

/* The menu button: on the dark hero, a light ring keeps it visible until the header settles */
.site-header--immersive .nav-menu > summary { box-shadow: 0 0 0 2px rgb(255 255 255 / 0.25); }

@supports (animation-timeline: scroll()) {
  .site-header,
  .site-header--immersive .brand,
  .site-header--immersive .brand__product,
  .site-header--immersive .site-header__login,
  .site-header--immersive .site-header__login > .btn,
  .site-header--immersive .site-nav__link:not([aria-current="page"]) {
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: scroll(root);
    /* From when the header reaches the top (the product bar, 44px, has scrolled away), over the next 140px */
    animation-range: 44px 184px;
  }

  .site-header { animation-name: header-frost; }
  .site-header--immersive { animation-name: header-settle; }
  .site-header--immersive .brand,
  .site-header--immersive a.site-header__login,
  .site-header--immersive .site-header__login > .btn,
  .site-header--immersive .site-nav__link:not([aria-current="page"]) { animation-name: header-ink; }
  .site-header--immersive .brand__product { animation-name: header-accent; }

  /* The global reduced-motion rule shortens every animation; a colour that follows the scroll isn't motion, and
     a time duration would break the scroll timeline, so these keep theirs */
  @media (prefers-reduced-motion: reduce) {
    .site-header,
    .site-header--immersive .brand,
    .site-header--immersive .brand__product,
    .site-header--immersive .site-header__login,
    .site-header--immersive .site-header__login > .btn,
    .site-header--immersive .site-nav__link:not([aria-current="page"]) { animation-duration: auto !important; }
  }
}

@keyframes header-frost {
  from { background-color: transparent; border-bottom-color: transparent; }
  to { background-color: rgb(251 246 236 / 0.9); border-bottom-color: var(--color-border); }
}

@keyframes header-settle {
  from { background-color: var(--slate-deep); border-bottom-color: transparent; }
  to { background-color: rgb(251 246 236 / 0.9); border-bottom-color: var(--color-border); }
}

/* The text swaps quickly halfway, so it never sits grey on grey while the background blends */
@keyframes header-ink {
  0%, 40% { color: var(--color-on-dark); }
  60%, 100% { color: var(--eye); }
}

/* The product's name beside the logo: mustard on dark, the beak's darker orange on cream */
@keyframes header-accent {
  0%, 40% { color: var(--mustard); }
  60%, 100% { color: var(--rust-ink); }
}

/* On phones "Entrar" isn't at the edge (Contacto is beside it): its panel hangs from the header's right edge */
@media (max-width: 559px) {
  .site-header--minimal .login-menu {
    position: static;
  }
  .site-header--minimal .login-menu__panel {
    right: var(--gutter);
    top: calc(100% - var(--space-2));
  }
}

/* Outside click closes the open menu (the phone menu or "Entrar"), without JavaScript: while a <details> is open,
   its summary stretches an invisible layer over the whole page, so a click anywhere outside the panel lands on
   the summary and toggles it shut. The panels sit above that layer. The header's backdrop-filter would make it
   the containing block of that fixed layer (keeping it inside the header), so it's dropped while a menu is open,
   with a solid background instead. */

.nav-menu[open] > summary::before,
.login-menu[open] > summary::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  cursor: default;
}

.nav-menu__panel,
.login-menu__panel {
  z-index: 2;
}

/* "Entrar" is a .btn, which lifts on hover with a transform: that too would trap the layer inside the button */
.login-menu[open] > summary {
  transform: none;
}

.site-header:has(.nav-menu[open], .login-menu[open]) {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.site-header:not(.site-header--immersive):has(
    .nav-menu[open],
    .login-menu[open]
  ) {
  /* !important: it must beat the header's scroll animation, which would leave it see-through at the top */
  background: var(--cream) !important;
}
