/* Mega menü — CodePen OPJQppX uyarlaması (Telefoncular) */

:root {
  --nav-mega-ease: 0.35s ease;
  --nav-mega-radius: 24px;
  --nav-mega-item-radius: 14px;
  --nav-mega-notch-rise: var(--section-notch-rise, clamp(11px, 1.85vw, 26px));
  --nav-mega-shell-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-mega-shell-duration: 0.52s;
  --nav-mega-inner-max: min(1280px, 100%);
  --nav-mega-list-width: min(540px, 50%);
  --nav-mega-clip-both: var(--clip-section-both, polygon(0% 2.5%, 2.5% 0%, 38% 0%, 41.5% 2%, 58.5% 2%, 62% 0%, 97.5% 0%, 100% 2.5%, 100% 97.5%, 97.5% 100%, 62% 100%, 58.5% 98%, 41.5% 98%, 38% 100%, 2.5% 100%, 0% 97.5%));
}

@media (min-width: 1100px) {
  .site-nav,
  .header {
    overflow: visible;
  }

  .site-nav > .nav-mega-panel,
  .header > .nav-mega-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 98;
    padding: var(--nav-mega-notch-rise) clamp(16px, 2.5vw, 28px) calc(20px + var(--nav-mega-notch-rise));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    overflow: visible;
    content-visibility: hidden;
    contain: layout style;
    transition:
      opacity 0.22s ease,
      visibility 0.22s ease,
      transform 0.22s ease;
  }

  /* Anasayfa birleşik kabuk — base panel kurallarını geçersiz kıl */
  .site-nav > .nav-mega-panel.is-mega-animating,
  .site-nav > .nav-mega-panel.is-mega-closing,
  .site-nav.is-mega-open > .nav-mega-panel.is-visible {
    transform: none;
    transition: none;
    content-visibility: visible;
    contain: none;
  }

  .nav-has-mega {
    padding-bottom: 18px;
    margin-bottom: -18px;
  }

  /* Fare geçiş köprüsü (header ile panel arası) */
  .site-nav > .nav-mega-panel::before,
  .header > .nav-mega-panel::before {
    content: '';
    position: absolute;
    top: -24px;
    left: 0;
    right: 0;
    height: 24px;
  }

  .site-nav > .nav-mega-panel.is-visible,
  .header > .nav-mega-panel.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    z-index: 110;
    content-visibility: visible;
  }

  /* Panel açıkken nav linkleri panelin altında kalsın — sağa geçerken yanlış menü tetiklenmesin */
  .site-nav:has(> .nav-mega-panel.is-visible) .site-nav-links,
  .header:has(> .nav-mega-panel.is-visible) .header-inner {
    position: relative;
    z-index: 1;
  }

  .site-nav:has(> .nav-mega-panel.is-visible),
  .site-nav:has(> .nav-mega-panel.is-mega-animating),
  .site-nav:has(> .nav-mega-panel.is-mega-closing),
  .header:has(> .nav-mega-panel.is-visible) {
    z-index: 120;
  }

  /* Anasayfa — birleşik beyaz full-width mega kabuk */
  .site-nav {
    clip-path: none;
    -webkit-clip-path: none;
  }

  .site-nav.is-mega-open {
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: center;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    overflow: hidden;
    clip-path: var(--clip-section-bottom);
    -webkit-clip-path: var(--clip-section-bottom);
    padding-bottom: calc(20px + var(--nav-mega-notch-rise));
    z-index: 120;
  }

  .site-nav.is-mega-open > .nav-mega-panel.is-mega-animating,
  .site-nav.is-mega-open > .nav-mega-panel.is-visible,
  .site-nav.is-mega-open > .nav-mega-panel.is-mega-closing {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    flex: 0 0 100%;
    width: 100%;
    order: 10;
    padding: 0;
    margin-top: 0;
    border-top: none;
    transform: none;
    overflow: hidden;
    visibility: visible;
    pointer-events: auto;
    content-visibility: visible;
    contain: none;
  }

  .site-nav.is-mega-open > .nav-mega-panel.is-visible:not(.is-mega-animating) {
    opacity: 1;
    max-height: none;
  }

  .site-nav.is-mega-open > .nav-mega-panel.is-mega-closing {
    opacity: 1;
    overflow: hidden;
    pointer-events: none;
  }

  .site-nav.is-mega-open > .nav-mega-panel:not(.is-visible):not(.is-mega-animating):not(.is-mega-closing) {
    position: absolute;
    top: 100%;
    flex: none;
    width: auto;
    padding: 0;
    border-top: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .site-nav.is-mega-open .nav-mega-panel__box {
    width: 100%;
    max-width: none;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    clip-path: none;
    -webkit-clip-path: none;
    padding: 24px clamp(16px, 2.5vw, 28px) calc(28px + var(--nav-mega-notch-rise));
    overflow: visible;
    transform: none;
  }

  .site-nav.is-mega-open .nav-mega-layout {
    max-width: var(--nav-mega-inner-max);
    margin-inline: auto;
    width: 100%;
  }

  .nav-mega-panel__box {
    width: var(--nav-mega-inner-max);
    margin-inline: auto;
    margin-top: calc(-1 * var(--nav-mega-notch-rise));
    margin-bottom: calc(-1 * var(--nav-mega-notch-rise));
    position: relative;
    isolation: isolate;
    color: var(--text, #1a2332);
    border: 1px solid var(--border, rgba(17, 56, 89, 0.1));
    border-radius: 0;
    clip-path: var(--nav-mega-clip-both);
    -webkit-clip-path: var(--nav-mega-clip-both);
    box-shadow:
      0 28px 64px -20px rgba(17, 56, 89, 0.18),
      0 10px 24px -8px rgba(17, 56, 89, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
    padding:
      calc(28px + var(--nav-mega-notch-rise))
      28px
      calc(36px + var(--nav-mega-notch-rise));
    overflow: hidden;
  }

  .nav-mega-list__title {
    width: max-content;
    margin-bottom: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted, #697587);
  }

  .nav-mega-layout {
    display: grid;
    grid-template-columns: var(--nav-mega-list-width) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    width: 100%;
    min-height: 280px;
  }

  .nav-mega-list-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: none;
    overflow: visible;
    z-index: 2;
  }

  .nav-mega-list-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    align-items: start;
  }

  .nav-mega-list-cols--single {
    grid-template-columns: 1fr;
  }

  .nav-mega-list-col {
    min-width: 0;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(17, 56, 89, 0.08);
    background: rgba(255, 255, 255, 0.42);
  }

  .nav-mega-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .nav-mega-list__item {
    position: relative;
    display: block;
    cursor: pointer;
  }

  .nav-mega-list__item-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 10px 5px 5px;
    border-radius: var(--nav-mega-item-radius);
    transition: background var(--nav-mega-ease), box-shadow var(--nav-mega-ease);
  }

  .nav-mega-list__item.is-active .nav-mega-list__item-wrap {
    background: rgba(17, 56, 89, 0.08);
    box-shadow: inset 0 0 0 1px rgba(17, 56, 89, 0.1);
  }

  .nav-mega-list__item.is-active:hover .nav-mega-list__item-wrap {
    background: rgba(17, 56, 89, 0.11);
  }

  /* Hover — yalnızca aktif olmayan öğelerde hafif vurgu */
  .nav-mega-list__item:not(.is-active):hover .nav-mega-list__item-wrap {
    background: rgba(17, 56, 89, 0.05);
  }

  .nav-mega-list__item:not(.is-active):hover .nav-mega-arrow {
    opacity: 0.45;
    visibility: visible;
  }

  .nav-mega-list__item-wrap > .nav-mega-arrow {
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0;
    visibility: hidden;
    color: var(--brand, #113859);
    transition:
      opacity var(--nav-mega-ease),
      visibility var(--nav-mega-ease),
      transform var(--nav-mega-ease);
  }

  .nav-mega-list__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(17, 56, 89, 0.07);
    color: var(--brand, #113859);
    font-size: 1.15rem;
  }

  .nav-mega-list__link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
  }

  .nav-mega-list__name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text, #1a2332);
    line-height: 1.25;
  }

  .nav-mega-list__sub {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted, #697587);
    line-height: 1.3;
  }

  .nav-mega-preview {
    position: relative;
    min-width: 0;
    min-height: clamp(210px, 24vh, 280px);
    z-index: 4;
  }

  .nav-mega-preview__inner {
    width: 100%;
    height: 100%;
  }

  .nav-mega-list__item.is-active .nav-mega-arrow {
    opacity: 1;
    visibility: visible;
  }

  .nav-mega-list__item.is-active .nav-mega-list__name,
  .nav-mega-list__item:not(.is-active):hover .nav-mega-list__name {
    color: var(--brand, #113859);
  }

  .nav-mega-list__item:not(.is-active):hover .nav-mega-list__icon {
    background: rgba(17, 56, 89, 0.1);
  }

  .nav-mega-list__item.is-active .nav-mega-list__icon {
    background: rgba(17, 56, 89, 0.12);
    color: var(--brand, #113859);
  }

  /* Sağ panel — önizleme kartı */
  .nav-mega-flip {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: clamp(210px, 24vh, 280px);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(17, 56, 89, 0.08);
    border: 1px solid rgba(17, 56, 89, 0.1);
    contain: layout style;
  }

  .nav-mega-flip__media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .nav-mega-flip__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      180deg,
      rgba(4, 12, 20, 0.08) 0%,
      rgba(4, 12, 20, 0.42) 42%,
      rgba(4, 12, 20, 0.92) 100%
    );
    pointer-events: none;
  }

  .nav-mega-flip__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 18px 20px 20px;
    color: #fff;
  }

  .nav-mega-flip__title {
    margin: 0;
    font-family: var(--font-display, 'Archivo Black', 'Inter', system-ui, sans-serif);
    font-size: clamp(0.95rem, 1.35vw, 1.12rem);
    font-weight: var(--display-weight-soft, 400);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.15;
  }

  .nav-mega-flip__desc {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.84);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .nav-mega-flip__cta {
    align-self: flex-start;
    margin-top: 0.15rem;
  }

  /* Hero modunda panel içi linkler her zaman okunaklı */
  .site-nav:not(.is-scrolled) .nav-mega-panel a:not(.btn),
  .site-nav:not(.is-scrolled) .nav-mega-panel .nav-mega-list__name {
    color: var(--text, #1a2332);
    text-shadow: none;
  }

  .site-nav:not(.is-scrolled) .nav-mega-panel .nav-mega-list__sub {
    color: var(--muted, #697587);
    text-shadow: none;
  }

  .nav-has-mega:hover > .nav-trigger,
  .nav-has-mega:hover > .nav-link--mega,
  .nav-has-mega:focus-within > .nav-trigger,
  .nav-has-mega:focus-within > .nav-link--mega {
    color: var(--brand, #113859) !important;
    text-shadow: none !important;
  }

  .site-nav:not(.is-scrolled):not(.is-mega-open) .nav-has-mega:hover > .nav-trigger,
  .site-nav:not(.is-scrolled):not(.is-mega-open) .nav-has-mega:hover > .nav-link--mega,
  .site-nav:not(.is-scrolled):not(.is-mega-open) .nav-has-mega:focus-within > .nav-trigger,
  .site-nav:not(.is-scrolled):not(.is-mega-open) .nav-has-mega:focus-within > .nav-link--mega {
    color: #fff !important;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.28) !important;
  }

  .site-nav.is-mega-open .nav-has-mega.is-mega-open > .nav-trigger,
  .site-nav.is-mega-open .nav-has-mega.is-mega-open > .nav-link--mega {
    color: var(--brand, #113859) !important;
    text-shadow: none !important;
    font-weight: 700;
  }

  .site-nav.is-scrolled .nav-has-mega:hover > .nav-trigger,
  .site-nav.is-scrolled .nav-has-mega:hover > .nav-link--mega,
  .site-nav.is-scrolled .nav-has-mega:focus-within > .nav-trigger,
  .site-nav.is-scrolled .nav-has-mega:focus-within > .nav-link--mega {
    color: var(--brand, #113859) !important;
    text-shadow: none !important;
  }

  /* Hizmet sayfası header — mega tetikleyici */
  .header .header-mega-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    padding: 9px 14px;
    border-radius: 999px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.28s ease, color 0.28s ease;
  }

  .header .header-mega-trigger:hover,
  .header .nav-has-mega.is-mega-open > .header-mega-trigger,
  .header .header-mega-trigger.is-active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
  }

  .header .nav-plus {
    font-size: 0.95em;
    font-weight: 700;
    line-height: 1;
    opacity: 0.9;
  }

  .header .nav-mega-panel a:not(.btn),
  .header .nav-mega-panel .nav-mega-list__name {
    color: var(--text, #1a2332);
    text-shadow: none;
  }

  .header .nav-mega-panel .nav-mega-list__sub {
    color: var(--muted, #697587);
    text-shadow: none;
  }
}

@media (max-width: 1099px) {
  .nav-mega-panel {
    display: none !important;
  }
}

@media (min-width: 1100px) and (max-width: 1280px) {
  :root {
    --nav-mega-list-width: min(500px, 52%);
  }

  .nav-mega-layout {
    gap: 18px;
  }

  .nav-mega-list-cols {
    gap: 8px 10px;
  }

  .nav-mega-list-col {
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-mega-panel,
  .nav-mega-list__item-wrap,
  .nav-mega-panel .btn {
    transition: none !important;
  }
}

html.is-low-power .nav-mega-panel__box {
  clip-path: none;
  -webkit-clip-path: none;
}

html.is-low-power .site-nav.is-mega-open {
  clip-path: none;
  -webkit-clip-path: none;
}
