/*
 * Off‑Canvas Panel – 4D King Results
 *
 * Backdrop, sliding panel (from left, anchored under the hamburger button),
 * close button, navigation links with round icon + arrow, and footer.
 */

/* ---------- Backdrop Overlay ---------- */
.offcanvas-backdrop {
  position: fixed;
  inset: 0;                         /* fills the viewport without vw/vh scrollbar quirks */
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.offcanvas-open .offcanvas-backdrop {
  opacity: 1;
  visibility: visible;
}

/* ---------- Off‑canvas Panel (slides in from the left) ---------- */
.offcanvas-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 80vw;
  height: 100vh;
  height: 100dvh;
  background: var(--white);
  transform: translateX(-100%);     /* hidden off-screen to the left */
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

body.offcanvas-open .offcanvas-panel {
  transform: translateX(0);
}

/* Close button */
.offcanvas-header {
  display: flex;
  justify-content: flex-start;      /* close button on the left */
  padding: 20px;
  border-bottom: 1px solid var(--light-grey);
  flex-shrink: 0;
}

.close-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -10px;                    /* offset the added tap area so layout doesn't shift */
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary-red);
  padding: 0;
  transition: opacity 0.15s;
}

.close-menu:hover {
  opacity: 0.8;
}

.close-menu svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* ---------- Navigation Links (round icon + text + arrow) ---------- */
.offcanvas-panel #offcanvas-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}

.offcanvas-panel #offcanvas-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--dark);
  text-decoration: none;
  border-bottom: 1px solid var(--light-grey);
  transition: background 0.15s, color 0.15s;
  position: relative;
}

/* Round red dot before the text */
.offcanvas-panel #offcanvas-menu a::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: var(--primary-red);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Chevron arrow after the text */
.offcanvas-panel #offcanvas-menu a::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 12px;
  margin-left: auto;
  background-color: var(--primary-red);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E") no-repeat center;
  mask-size: contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E") no-repeat center;
  -webkit-mask-size: contain;
  flex-shrink: 0;
}

.offcanvas-panel #offcanvas-menu a:hover {
  background: #fff5f5;
  color: var(--primary-red);
}

.offcanvas-panel #offcanvas-menu li:last-child a {
  border-bottom: none;
}

/* ---------- Panel Footer ---------- */
.offcanvas-footer {
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0)); /* clear iOS home indicator */
  border-top: 1px solid var(--light-grey);
  flex-shrink: 0;
}

/* Reset WordPress list styles */
.offcanvas-footer .legal-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.offcanvas-footer .legal-nav li {
  margin: 0;
}

.offcanvas-footer .legal-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--dark);
  text-decoration: none;
  background: #f8f8f8;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

/* Small red dot – matches the main offcanvas links */
.offcanvas-footer .legal-nav a::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: var(--primary-red);
  border-radius: 50%;
  flex-shrink: 0;
}

.offcanvas-footer .legal-nav a:hover {
  background: #fff5f5;
  color: var(--primary-red);
}