/* ==========================================================================
   GFR Finance — layout: topbar, header, navigation, footer, floats
   ========================================================================== */

/* --------------------------------------------------------------- Topbar --- */

.topbar {
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  overflow: visible;
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  min-height: 42px;
  padding: 0.35rem 0;
  overflow: visible;
}
.topbar__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.topbar__meta li { margin: 0; position: relative; }
.topbar__meta li + li::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 50%;
  width: 1px;
  height: 11px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.22);
}
.topbar a { color: rgba(255, 255, 255, 0.82); }
.topbar a:hover { color: #fff; }
.topbar__hours { color: var(--gold-400); }

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex: 0 0 auto;
  overflow: visible;
  position: relative;
  z-index: 170;
}
.topbar__portal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.7rem;
}
.topbar__portal:hover { background: rgba(255, 255, 255, 0.1); }

/* ------------------------------------------------------ Language switch --- */

.langswitch { position: relative; }
.langswitch > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.15rem;
  list-style: none;
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  font-size: 0.76rem;
}
.langswitch > summary::-webkit-details-marker { display: none; }
.langswitch__flag {
  font-size: 1rem;
  line-height: 1;
  filter: none;
}
.langswitch__code {
  padding: 0.12rem 0.38rem;
  background: rgba(168, 135, 63, 0.95);
  color: #fff;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  border-radius: 2px;
}
.caret {
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s var(--ease);
}
details[open] > summary .caret { transform: rotate(-135deg) translateY(-2px); }

.langswitch__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.55rem);
  z-index: 160;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 1.5rem));
  max-height: min(70vh, 420px);
  padding: 0.95rem 0.85rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  overflow: hidden;
}
.langswitch__title {
  flex: 0 0 auto;
  margin: 0 0 0.65rem;
  padding: 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #0b1f33;
}
.langswitch__grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.15rem;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 0.1rem;
}
/* Force black text: .topbar a is white and would otherwise win */
.langswitch__item,
.topbar .langswitch__item,
.langswitch__panel a.langswitch__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.5rem 0.55rem;
  color: #0b1f33 !important;
  font-size: 0.82rem;
  border-radius: 3px;
  text-decoration: none;
  background: transparent;
}
.langswitch__item:hover,
.topbar .langswitch__item:hover,
.langswitch__panel a.langswitch__item:hover {
  background: #f4f2ee;
  color: #071523 !important;
}
.langswitch__item.is-active,
.topbar .langswitch__item.is-active,
.langswitch__panel a.langswitch__item.is-active {
  background: rgba(168, 135, 63, 0.14);
  color: #071523 !important;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(168, 135, 63, 0.35);
}
.langswitch__text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  flex: 1;
}
.langswitch__abbr {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #a8873f !important;
  line-height: 1.1;
}
.langswitch__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0b1f33 !important;
  font-size: 0.8rem;
  font-weight: 500;
}
.langswitch__item.is-active .langswitch__label { color: #071523 !important; }
.langswitch__dot {
  width: 6px; height: 6px;
  margin-left: auto;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold-400);
}

/* --------------------------------------------------------------- Header --- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 244, 240, 0.97);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}
.masthead.is-stuck {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 6px 24px rgba(11, 31, 51, 0.08);
}
@supports ((-webkit-backdrop-filter: blur(12px)) or (backdrop-filter: blur(12px))) {
  @media (min-width: 1101px) {
    .masthead {
      background: rgba(246, 244, 240, 0.88);
      -webkit-backdrop-filter: saturate(1.3) blur(10px);
      backdrop-filter: saturate(1.3) blur(10px);
    }
    .masthead.is-stuck {
      background: rgba(255, 255, 255, 0.92);
    }
  }
}
.masthead__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 84px;
  padding: 0.7rem 0;
}
.masthead.is-stuck .masthead__inner { min-height: 70px; }

.logo {
  flex: 0 1 auto;
  display: block;
  min-width: 0;
  max-width: min(210px, 52vw);
}
.logo img {
  display: block;
  height: 46px;
  width: auto;
  max-width: 100%;
  transition: height 0.3s var(--ease);
}
.masthead.is-stuck .logo img { height: 40px; }

.mainnav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}
.mainnav__drawerhead { display: none; }
.mainnav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.62rem;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
}
.mainnav__link::after {
  content: "";
  position: absolute;
  left: 0.62rem;
  right: 0.62rem;
  bottom: 0.28rem;
  height: 1.5px;
  background: var(--gold-500);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.mainnav__link:hover::after, .mainnav__link.is-active::after { transform: scaleX(1); }
.mainnav__link.is-active { color: var(--navy-800); }

.mainnav__group { position: relative; }

.dropdown {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.5rem);
  z-index: 130;
  width: min(720px, calc(100vw - 2.5rem));
  transform: translateX(-50%) translateY(-6px);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0.22s;
}
.mainnav__group.is-open .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.dropdown__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 0.6rem;
}
.dropdown__item {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 2px;
}
.dropdown__item:hover { background: var(--paper); }
.dropdown__name {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy-800);
}
.dropdown__meta {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
}
.dropdown__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 1.3rem;
  padding: 0.85rem 1.35rem;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.dropdown__foot a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy-800);
}
.dropdown__foot a:hover { color: var(--gold-600); }

.masthead__actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 0 0 auto;
  margin-left: 0.35rem;
}
.mainnav__mobile { display: none; }

.burger {
  position: relative;
  z-index: 150;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  margin-left: 0.35rem;
  padding: 0 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
}
.burger span {
  display: block;
  height: 1.5px;
  background: var(--navy-800);
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.navbackdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(7, 21, 35, 0.52);
}
.navbackdrop[hidden] { display: none !important; }

/* --------------------------------------------------------------- Footer --- */

.footer {
  margin-top: auto;
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.1fr;
  gap: 2.5rem;
  padding: clamp(3rem, 5vw, 4.5rem) 0 2.5rem;
}
.footer__logo { height: 44px; width: auto; margin-bottom: 1.2rem; }
.footer__text { max-width: 34ch; color: rgba(255, 255, 255, 0.66); }
.footer h3 {
  margin-bottom: 1.1rem;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.footer a { color: rgba(255, 255, 255, 0.78); }
.footer a:hover { color: var(--gold-400); }

.footer__links, .footer__facts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer__links li { margin-bottom: 0.5rem; font-size: 0.88rem; }
.footer__links--plain li { color: rgba(255, 255, 255, 0.66); line-height: 1.6; }
.footer__more { color: var(--gold-400) !important; font-weight: 600; }

.footer__facts { margin-top: 1.4rem; }
.footer__facts li {
  display: flex;
  gap: 0.5rem;
  font-size: 0.79rem;
  color: rgba(255, 255, 255, 0.58);
  margin-bottom: 0.35rem;
}
.footer__facts span {
  flex: 0 0 auto;
  min-width: 92px;
  color: rgba(255, 255, 255, 0.4);
}

.footer__col--brand .btn { margin-top: 1rem; }

.footer__disclaimer {
  padding-bottom: 1.6rem;
  font-size: 0.78rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding-top: 1.4rem;
}

.footer__bottom { background: rgba(0, 0, 0, 0.25); }
.footer__bottom-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}
.footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer__legal li { margin: 0; }

/* ---------------------------------------------------- Floating elements --- */

.floaters {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.floater {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--navy-800);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}
.floater:hover { transform: scale(1.06); }
.floater svg { width: 25px; height: 25px; fill: currentColor; }
.floater--wa { background: #1f8f5f; }
.floater__pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--navy-800);
  animation: gfrPulse 2.6s ease-out infinite;
}
@keyframes gfrPulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

.chatbox {
  position: fixed;
  right: 1.1rem;
  bottom: 5.2rem;
  z-index: 96;
  display: none;
  flex-direction: column;
  width: min(370px, calc(100vw - 1.6rem));
  height: min(520px, calc(100vh - 8rem));
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chatbox.is-open { display: flex; }
.chatbox__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  background: var(--navy-800);
  color: #fff;
}
.chatbox__head strong { display: block; color: #fff; font-family: var(--font-display); font-weight: 500; font-size: 1rem; }
.chatbox__head span { font-size: 0.75rem; color: rgba(255, 255, 255, 0.65); }
.chatbox__head button {
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.chatbox__body {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  background: var(--paper);
}
.bubble {
  max-width: 84%;
  margin-bottom: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 0.88rem;
  line-height: 1.55;
}
.bubble--mine {
  margin-left: auto;
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}
.bubble__time {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  opacity: 0.6;
}
.chatbox__form {
  display: flex;
  gap: 0.45rem;
  padding: 0.7rem;
  border-top: 1px solid var(--line);
}
.chatbox__form input { flex: 1; padding: 0.65rem 0.75rem; font-size: 0.9rem; }
.chatbox__legal {
  margin: 0;
  padding: 0.45rem 0.8rem 0.7rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

.cookiebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 97;
  background: var(--navy-800);
  color: rgba(255, 255, 255, 0.82);
  box-shadow: 0 -8px 30px rgba(7, 21, 35, 0.25);
}
.cookiebar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  padding: 0.95rem 0;
  font-size: 0.85rem;
}
.cookiebar p { margin: 0; }
.cookiebar a { color: var(--gold-400); text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------- Breakpoints ---- */

@media (max-width: 1280px) {
  .mainnav__link { padding: 0.5rem 0.45rem; font-size: 0.82rem; }
  .masthead__inner { gap: 0.85rem; }
}

@media (max-width: 1024px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .topbar__meta li:nth-child(n+3) { display: none; }
}

@media (max-width: 1100px) {
  .burger { display: inline-flex; }
  .masthead__actions .btn { display: none; }
  .masthead__inner {
    justify-content: space-between;
    min-height: 68px;
    padding: 0.6rem 0;
    gap: 1.25rem;
  }
  .logo { max-width: calc(100% - 68px); }
  .logo img { height: 38px; }
  .masthead.is-stuck .logo img { height: 36px; }
  .masthead__actions {
    margin-left: auto;
    gap: 0;
  }

  .mainnav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 140;
    width: min(320px, 88vw);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0 0 1.5rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 40px rgba(7, 21, 35, 0.18);
    transform: translateX(105%);
    transition: transform 0.3s var(--ease);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .mainnav.is-open { transform: translateX(0); }

  .mainnav__drawerhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 1rem 1.15rem;
    margin-bottom: 0.35rem;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }
  .mainnav__drawerhead strong {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--navy-800);
  }
  .mainnav__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--navy-800);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 3px;
  }

  .mainnav__link {
    padding: 0.95rem 1.15rem;
    border-bottom: 1px solid var(--line-soft);
    font-size: 1rem;
    justify-content: space-between;
    white-space: normal;
  }
  .mainnav__link::after { display: none; }
  .mainnav__group { position: static; width: 100%; }
  .dropdown {
    position: static;
    left: auto;
    top: auto;
    width: 100%;
    max-width: 100%;
    transform: none;
    opacity: 1;
    visibility: visible;
    display: none;
    border: 0;
    box-shadow: none;
    background: var(--paper);
  }
  .mainnav__group.is-open .dropdown {
    display: block;
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .dropdown__grid {
    grid-template-columns: 1fr;
    padding: 0.35rem 0.75rem 0.6rem;
  }
  .dropdown__foot {
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.75rem 1.15rem;
  }
  .mainnav__mobile {
    display: grid;
    gap: 0.65rem;
    margin-top: auto;
    padding: 1.2rem 1.15rem 0.4rem;
  }

  body.nav-open { overflow: hidden; }
  body.nav-open .masthead { z-index: 120; }

  .topbar__inner {
    gap: 0.6rem;
    min-height: 0;
    padding: 0.45rem 0;
  }
  .topbar__meta {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }
  .topbar__meta li {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .topbar__actions {
    flex: 0 0 auto;
    gap: 0.55rem;
  }
}

@media (max-width: 720px) {
  .topbar__inner {
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
  }
  .topbar__meta { width: auto; max-width: calc(100% - 10rem); }
  .topbar__meta li:nth-child(n+2) { display: none; }
  .topbar__actions {
    width: auto;
    margin-left: auto;
    gap: 0.45rem;
  }
  .topbar__portal {
    padding: 0.28rem 0.5rem;
    font-size: 0.62rem;
  }
  .langswitch__name { display: none; }
  .langswitch__panel {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
    top: 3.1rem;
    max-height: min(72vh, 480px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .langswitch__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .footer__grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .footer__bottom-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .cookiebar__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
  .cookiebar__inner .btn { width: 100%; }
  .floaters { right: 0.7rem; bottom: 0.7rem; }
  .floater { width: 48px; height: 48px; }
  .chatbox {
    right: 0.7rem;
    left: 0.7rem;
    width: auto;
    bottom: 4.5rem;
    height: min(70vh, 480px);
  }
  .masthead__inner { gap: 1.4rem; }
  .burger { margin-left: 0.5rem; }
}

@media (max-width: 420px) {
  .topbar__meta { display: none; }
  .masthead__inner { min-height: 60px; gap: 1.5rem; }
  .logo img { height: 34px; }
  .burger { width: 40px; height: 40px; }
}
