/* ========================================
   MOBILE NAVIGATION — Bottom Nav + Fullscreen Menu
   ======================================== */

/* SYNC: header height also defined in layout.css */
:root {
  --header-h: 82px;
}
@media (max-width: 640px) {
  :root { --header-h: 72px; }
}
@media (max-width: 420px) {
  :root { --header-h: 65px; }
}

/* Bottom navigation bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: none;
  justify-content: center;
  padding: 0 8px;
}

@media (max-width: 1023px) {
  .bottom-nav { display: flex; }
}

/* Invisible shield — blocks any clicks from leaking through to page content below */
.bottom-nav::before {
  content: '';
  position: absolute;
  top: -30px;
  left: 0;
  right: 0;
  bottom: 0;
}

.bottom-nav__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 70px;
  display: flex;
  align-items: stretch;
  padding: 0 6px;
  background: rgba(245, 243, 238, 0.97);
  border: 1px solid rgba(255,255,255,0.6);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 30px rgba(174,183,196,0.15), inset 0 1px 2px rgba(255,255,255,0.6);
}

.bottom-nav__left,
.bottom-nav__right {
  display: flex;
  flex: 1;
  align-items: stretch;
  justify-content: space-around;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.bottom-nav__center {
  width: 72px;
  flex-shrink: 0;
  /* Prevent clicks from passing through the gap to elements below */
  pointer-events: auto;
}

/* Hide entire bottom nav when menu is open */
.bottom-nav.menu-open {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* Hide bottom nav when any modal/overlay is open */
body.scroll-locked .bottom-nav {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* Nav items */
.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  text-decoration: none;
  cursor: pointer;
  padding: 4px 6px 12px;
  position: relative;
  transition: all 0.3s ease;
  -webkit-user-select: none;
  user-select: none;
}

.bottom-nav__item:active { transform: scale(0.92); }

.bottom-nav__icon,
.bottom-nav__icon svg,
.bottom-nav__label {
  pointer-events: none;
}

.bottom-nav__icon svg {
  width: 22px;
  height: 22px;
  stroke: #4a5568;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.3s ease;
}

.bottom-nav__label {
  font-size: 10px;
  font-weight: 500;
  color: #4a5568;
  letter-spacing: 0.2px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.bottom-nav__item.active .bottom-nav__icon svg { stroke: #c41230; }
.bottom-nav__item.active .bottom-nav__label { color: #c41230; font-weight: 600; }

.bottom-nav__item.active::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: -10px;
  right: -10px;
  height: 42px;
  background: rgba(196,18,48,0.05);
  border: 1px solid rgba(196,18,48,0.1);
  border-radius: 12px;
  z-index: -1;
}

/* Burger button — center circle */
.bottom-nav__burger {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(240,243,248,0.95));
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 4px 24px rgba(174,183,196,0.25), 0 0 0 3px rgba(196,18,48,0.12), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav__burger:active { transform: translateX(-50%) scale(0.93); }

.bottom-nav__burger.open {
  background: linear-gradient(145deg, #d4163a, #c41230, #a80e28);
  border-color: rgba(196,18,48,0.3);
  box-shadow: 0 4px 24px rgba(196,18,48,0.35), 0 0 0 3px rgba(255,255,255,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.bottom-nav__burger-line {
  width: 22px;
  height: 2px;
  background: #c41230;
  border-radius: 2px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.bottom-nav__burger-line:nth-child(2) { width: 15px; }

.bottom-nav__burger.open .bottom-nav__burger-line { background: white; width: 22px; }
.bottom-nav__burger.open .bottom-nav__burger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.bottom-nav__burger.open .bottom-nav__burger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.bottom-nav__burger.open .bottom-nav__burger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.bottom-nav__burger-label {
  position: absolute;
  bottom: -17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 500;
  color: #4a5568;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* ========================================
   FULLSCREEN MENU (opened by burger)
   ======================================== */

/* Menu starts below the header */
.fullscreen-menu {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fullscreen-menu.open {
  opacity: 1;
  visibility: visible;
}

/* Decorative gradient background */
.fullscreen-menu::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: rgba(245, 243, 238, 0.97);
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(255,255,255,0.6) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(200,210,225,0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.3) 0%, transparent 40%);
  pointer-events: none;
}

/* ---- Main screen ---- */
.fullscreen-menu__main {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

/* Slide main screen left when a submenu is active */
.fullscreen-menu.submenu-active .fullscreen-menu__main {
  transform: translateX(-30%);
  opacity: 0;
  pointer-events: none;
}

/* Glass card frame for main links */
.fullscreen-menu__frame {
  position: relative;
  z-index: 1;
  padding: 12px 24px;
  border-radius: 28px;
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 8px 40px rgba(174,183,196,0.12), inset 0 1px 0 rgba(255,255,255,0.5);
  width: 100%;
  max-width: 380px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 0;
}

.fullscreen-menu__frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 30px;
  right: 30px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8) 30%, rgba(255,255,255,0.8) 70%, transparent);
}

/* Submenu trigger button (looks like a link, with chevron) */
.fullscreen-menu__submenu-trigger {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 11px 20px;
  border: none;
  border-radius: 14px;
  background: none;
  cursor: pointer;
  text-align: left;
  opacity: 0;
  transform: translateY(12px);
  transition: background 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
}

.fullscreen-menu__submenu-trigger:active {
  background: rgba(196,18,48,0.06);
}

.fullscreen-menu__trigger-chev {
  width: 18px;
  height: 18px;
  margin-left: auto;
  flex-shrink: 0;
  fill: none;
  stroke: var(--text-secondary, #6b7280);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Menu links */
.fullscreen-menu__link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  padding: 11px 20px;
  border-radius: 14px;
  width: 100%;
  opacity: 0;
  transform: translateY(12px);
  transition: background 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
}

.fullscreen-menu__link:active {
  background: rgba(196,18,48,0.06);
}

.fullscreen-menu__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-menu__icon svg {
  width: 22px;
  height: 22px;
  stroke: #c41230;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fullscreen-menu__text {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  color: #1a202c;
}

/* Stagger animation — 13 items (2 triggers + divider + 9 links + divider + phone = 13 nth-child) */
.fullscreen-menu.open .fullscreen-menu__link,
.fullscreen-menu.open .fullscreen-menu__submenu-trigger {
  opacity: 1;
  transform: translateY(0);
}

.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(1)  { transition-delay: 0.05s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(2)  { transition-delay: 0.08s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(3)  { transition-delay: 0.11s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(4)  { transition-delay: 0.14s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(5)  { transition-delay: 0.17s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(6)  { transition-delay: 0.20s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(7)  { transition-delay: 0.23s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(8)  { transition-delay: 0.26s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(9)  { transition-delay: 0.29s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(10) { transition-delay: 0.32s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(11) { transition-delay: 0.35s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(12) { transition-delay: 0.38s; }
.fullscreen-menu.open .fullscreen-menu__frame > :nth-child(13) { transition-delay: 0.41s; }

/* Divider */
.fullscreen-menu__divider {
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148,163,184,0.4), transparent);
  margin: 6px 0;
  opacity: 0;
  transition: opacity 0.4s ease 0.3s;
  align-self: center;
}

.fullscreen-menu.open .fullscreen-menu__divider { opacity: 1; }

/* Phone */
.fullscreen-menu__phone {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 500;
  color: #4a5568;
  text-decoration: none;
  padding: 8px 20px;
  letter-spacing: 0.8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease 0.36s, transform 0.4s ease 0.36s;
}

.fullscreen-menu__phone svg {
  width: 20px;
  height: 20px;
  stroke: #c41230;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.fullscreen-menu.open .fullscreen-menu__phone { opacity: 1; transform: translateY(0); }
.fullscreen-menu__phone:active { color: #c41230; }

/* Messengers in bottom bar */
.fullscreen-menu__bar-messengers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fullscreen-menu__bar-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(44, 36, 23, 0.025);
  border: 1px solid rgba(44, 36, 23, 0.06);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.fullscreen-menu__bar-msg:active { transform: scale(0.9); }
.fullscreen-menu__bar-msg--max { background: linear-gradient(135deg, #00c8ff 0%, #5533ee 60%, #9933dd 100%); border: none; }
.fullscreen-menu__bar-msg--max svg path { fill: #fff; }
.fullscreen-menu__bar-msg--max:hover { opacity: 0.85; }
.fullscreen-menu__bar-msg--tg:hover { background: rgba(38,165,230,0.07); border-color: rgba(38,165,230,0.15); }

.fullscreen-menu__bar-msg svg {
  display: block;
  width: 32px;
  height: 32px;
}

/* ---- Bottom action bar (close + CTA side by side) ---- */
.fullscreen-menu__bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(245,243,238,1) 60%, rgba(245,243,238,0) 100%);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease 0.15s, transform 0.35s ease 0.15s;
}

.fullscreen-menu.open .fullscreen-menu__bottom-bar {
  opacity: 1;
  transform: translateY(0);
}

/* Close (X) button in bottom bar */
.fullscreen-menu__close-btn {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 2px 12px rgba(174,183,196,0.2);
  transition: all 0.2s ease;
}

.fullscreen-menu__close-btn:active {
  transform: scale(0.9);
  background: rgba(196,18,48,0.08);
}

.fullscreen-menu__close-btn svg {
  width: 20px;
  height: 20px;
  stroke: #4a5568;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

/* CTA button in bottom bar */
.fullscreen-menu__cta {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  background: linear-gradient(145deg, #d4163a, #c41230, #a80e28);
  color: white;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(196,18,48,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.2s ease;
}

.fullscreen-menu__cta:active { transform: scale(0.96); }

/* ========================================
   SUBMENU PANEL (slides in from right)
   ======================================== */

.fullscreen-menu__submenu {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.fullscreen-menu__submenu.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* Back button */
.fullscreen-menu__back {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 10px 16px;
  margin-bottom: 8px;
  width: 100%;
  max-width: 340px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.fullscreen-menu__back:active {
  background: rgba(196,18,48,0.06);
}

.fullscreen-menu__back-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: #c41230;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fullscreen-menu__back-text {
  font-size: 15px;
  font-weight: 500;
  color: #c41230;
}

/* Submenu title */
.fullscreen-menu__submenu-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: #1a202c;
  width: 100%;
  max-width: 340px;
  padding: 0 16px 12px;
}

/* Sublink list — glass card */
.fullscreen-menu__sublist {
  width: 100%;
  max-width: 340px;
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 8px 40px rgba(174,183,196,0.12), inset 0 1px 0 rgba(255,255,255,0.5);
  border-radius: 20px;
  padding: 8px;
  display: flex;
  flex-direction: column;
}

/* Individual sublinks */
.fullscreen-menu__sublink {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.fullscreen-menu__sublink:active {
  background: rgba(196,18,48,0.06);
}

.fullscreen-menu__sublink-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(196,18,48,0.3);
  flex-shrink: 0;
}

.fullscreen-menu__sublink-text {
  font-size: 16px;
  font-weight: 400;
  color: #1a202c;
}

/* ---- Adaptive sizing by screen height ---- */
/* flex: 1 + space-evenly on __frame handles most distribution automatically.
   Media queries only tweak font/icon sizes and frame padding for extremes. */

/* Tablets: iPad Mini (1024), iPad Air (1180) */
@media (max-width: 1023px) and (min-height: 1000px) {
  .fullscreen-menu__frame { padding: 20px 32px; border-radius: 32px; }
  .fullscreen-menu__text { font-size: 22px; }
  .fullscreen-menu__icon svg { width: 26px; height: 26px; }
  .fullscreen-menu__phone { font-size: 20px; }
  .fullscreen-menu__cta { padding: 16px 36px; font-size: 15px; }
  .fullscreen-menu__submenu-title { font-size: 24px; }
  .fullscreen-menu__sublink { padding: 14px 20px; }
  .fullscreen-menu__sublink-text { font-size: 19px; }
}

/* ≤670px — iPhone SE (667) and shorter: scale down text */
@media (max-height: 670px) {
  .fullscreen-menu__main { padding: 8px 12px 80px; }
  .fullscreen-menu__frame { padding: 6px 16px; border-radius: 22px; }
  .fullscreen-menu__text { font-size: 16px; }
  .fullscreen-menu__icon svg { width: 18px; height: 18px; }
  .fullscreen-menu__phone { font-size: 14px; }
  .fullscreen-menu__cta { padding: 10px 20px; font-size: 11px; }
  .fullscreen-menu__bottom-bar { padding: 8px 14px; gap: 8px; }
  .fullscreen-menu__close-btn { width: 40px; height: 40px; }
  .fullscreen-menu__close-btn svg { width: 17px; height: 17px; }
  .fullscreen-menu__bar-msg { width: 36px; height: 36px; }
  .fullscreen-menu__bar-msg svg { width: 26px; height: 26px; }
}

/* ≤600px — extreme landscape / very small */
@media (max-height: 600px) {
  .fullscreen-menu__frame { padding: 4px 12px; border-radius: 18px; }
  .fullscreen-menu__text { font-size: 14px; }
  .fullscreen-menu__icon svg { width: 16px; height: 16px; }
  .fullscreen-menu__phone { font-size: 12px; }
  .fullscreen-menu__cta { padding: 8px 16px; font-size: 10px; }
  .fullscreen-menu__bottom-bar { padding: 6px 12px; gap: 6px; }
  .fullscreen-menu__close-btn { width: 34px; height: 34px; }
  .fullscreen-menu__close-btn svg { width: 15px; height: 15px; }
  .fullscreen-menu__bar-msg { width: 30px; height: 30px; }
  .fullscreen-menu__bar-msg svg { width: 22px; height: 22px; }
}

/* Safe area for iPhones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
}

/* Add bottom padding to body so content isn't hidden behind bottom nav */
@media (max-width: 1023px) {
  body {
    padding-bottom: 80px;
  }
}
