/* Mobilní Menu portálu — barevná mřížka, vejde se na jeden displej */

.portal-menu {
  position: relative;
  flex: 0 0 auto;
  z-index: 60;
}

.portal-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.4rem 0.85rem 0.4rem 0.65rem;
  border-radius: 999px;
  background: var(--color-brand);
  color: var(--color-on-brand, #fff);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  list-style: none;
  box-shadow: var(--elevation-1);
  white-space: nowrap;
  box-sizing: border-box;
}

.portal-menu-trigger::-webkit-details-marker {
  display: none;
}

.portal-menu-trigger:focus-visible {
  outline: 2px solid var(--color-on-brand, #fff);
  outline-offset: 2px;
}

.portal-menu-burger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.5px;
  width: 0.9rem;
  flex-shrink: 0;
}

.portal-menu-burger span {
  display: block;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
}

.portal-menu-trigger-label {
  letter-spacing: 0.01em;
}

.portal-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 58;
  margin: 0;
  padding: 0;
  border: none;
  background: rgb(15 23 42 / 28%);
  cursor: pointer;
}

.portal-menu[open] > .portal-menu-backdrop {
  display: block;
}

.portal-menu-panel {
  position: fixed;
  z-index: 59;
  left: 0.5rem;
  right: 0.5rem;
  width: auto;
  max-width: 22.5rem;
  margin-left: auto;
  margin-right: auto;
  /* Pod sticky chrome + řádek Vše | Menu */
  top: calc(var(--community-nav-h, 30px) + var(--header-h, 56px) + 3.1rem);
  transform: none;
  max-height: calc(
    100dvh - var(--community-nav-h, 30px) - var(--header-h, 56px) - var(--bottom-nav-h, 56px) -
      env(safe-area-inset-bottom, 0px) - 3.6rem
  );
  padding: 0.45rem;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: rgb(255 255 255 / calc(var(--glass-card-pct, 88) * 1%));
  border: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);
  box-shadow: var(--elevation-2);
}

/* Po přesunu na body (viz portal-menu.js) — jistota proti rodičům s transform/filter */
.portal-menu-panel--ported {
  z-index: 1210;
}

.portal-menu-backdrop--ported {
  display: block;
  z-index: 1200;
}

.portal-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
}

.portal-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.65rem 1rem;
  flex: 0 0 auto;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 12px;
  box-sizing: border-box;
}

.portal-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-height: 0;
  padding: 0.4rem 0.25rem 0.35rem;
  border-radius: 12px;
  text-decoration: none;
  text-align: center;
  background: linear-gradient(160deg, rgb(255 255 255 / 92%), rgb(248 250 252 / 88%));
  border: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
  box-shadow: 0 1px 0 rgb(15 23 42 / 4%);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.portal-menu-item:active {
  transform: scale(0.97);
}

.portal-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 10px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgb(15 23 42 / 12%);
}

.portal-menu-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.portal-menu-label {
  font-size: clamp(0.62rem, 2.7vw, 0.72rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-text, #0f172a);
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Barevné tóny ikon (ne jen barva tématu) */
.portal-menu-item--elections .portal-menu-icon {
  background: linear-gradient(145deg, #7c3aed, #a855f7);
}
.portal-menu-item--aktuality .portal-menu-icon {
  background: linear-gradient(
    145deg,
    var(--color-brand, #0f766e),
    color-mix(in srgb, var(--color-brand, #0f766e) 55%, #38bdf8)
  );
}
.portal-menu-item--map .portal-menu-icon {
  background: linear-gradient(145deg, #0d9488, #2dd4bf);
}
.portal-menu-item--weather .portal-menu-icon {
  background: linear-gradient(135deg, #0ea5e9, #fbbf24);
}
.portal-menu-item--whatsnew .portal-menu-icon {
  background: linear-gradient(145deg, #0891b2, #34d399);
}
.portal-menu-item--services .portal-menu-icon {
  background: linear-gradient(145deg, #d97706, #fbbf24);
}
.portal-menu-item--clubs .portal-menu-icon {
  background: linear-gradient(145deg, #16a34a, #4ade80);
}
.portal-menu-item--council .portal-menu-icon {
  background: linear-gradient(145deg, #475569, #94a3b8);
}
.portal-menu-item--newsletter .portal-menu-icon {
  background: linear-gradient(145deg, #4f46e5, #818cf8);
}
.portal-menu-item--kdojak .portal-menu-icon {
  background: linear-gradient(145deg, #db2777, #f472b6);
}
.portal-menu-item--eshop .portal-menu-icon {
  background: linear-gradient(145deg, #ea580c, #fb923c);
}
.portal-menu-item--contact .portal-menu-icon {
  background: linear-gradient(145deg, #0284c7, #38bdf8);
}

/* Menu je u kategorií i na tabletu / desktopu (vedle zkrácené lišty) */
@media (min-width: 768px) {
  .category-nav-bar > .portal-menu {
    display: flex;
    align-items: stretch;
  }

  .category-nav-bar > .portal-menu .portal-menu-trigger {
    height: 100%;
    min-height: 0;
    padding: 0 0.9rem 0 0.7rem;
    font-size: 0.875rem;
    border-radius: var(--radius-lg, 12px);
  }
}

/* Úzký / nízký displej — hustší mřížka, stále bez scrollu */
@media (max-width: 767.98px) and (max-height: 640px) {
  .portal-menu-panel {
    padding: 0.35rem;
    top: calc(var(--community-nav-h, 30px) + var(--header-h, 52px) + 2.85rem);
  }

  .portal-menu-grid {
    gap: 0.28rem;
  }

  .portal-menu-item {
    padding: 0.28rem 0.18rem 0.25rem;
    gap: 0.18rem;
    border-radius: 10px;
  }

  .portal-menu-icon {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 8px;
  }

  .portal-menu-icon svg {
    width: 0.9rem;
    height: 0.9rem;
  }

  .portal-menu-label {
    font-size: 0.6rem;
  }

  .portal-menu-close {
    min-height: 2.4rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 767.98px) and (max-height: 430px) and (orientation: landscape) {
  .portal-menu-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .portal-menu-panel {
    max-height: calc(100dvh - 0.5rem);
    top: 0.25rem;
  }
}
