/* ═══════════════════════════════════════════════════════════════════════════════
   ODDAK DİJİTAL AJANS — Navigation Styles
   File: /assets/css/nav.css
   Authority: Sprint 4 Design System — Section 3.1–3.4 (Nav Components)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── NAV BAR ───────────────────────────────────────────────────────────────── */
/* QA FIX: was a bare `nav` element selector, which matches EVERY <nav> tag
   on the page — not just this one. That silently forced position:fixed;
   top:0;left:0;right:0 onto the footer's <nav class="ft-col"> sitemap
   columns and the mega-panel's internal <nav class="mega-cats">/
   <nav class="mega-simple-grid"> (neither sets its own `position`, so they
   inherited this rule by default), pinning footer link text to the top of
   the viewport on every page. Scoped to the #nav id so only the real site
   header is ever affected. */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  padding: 0 var(--nav-pad);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.3s, box-shadow 0.3s;
  gap: 12px;
}

#nav.sol {
  background: rgba(248, 246, 241, 0.98);
  box-shadow: 0 1px 0 var(--bdr);
  /* QA FIX: backdrop-filter removed from this fixed, always-on-top bar.
     The background is already ~98% opaque so the blur added negligible
     visual value, but backdrop-filter on a position:fixed element with a
     high z-index is a known trigger for GPU layer/compositing bugs at
     non-100% browser zoom — which is the most likely cause of the
     persistent ghosted double-rendering reported at high zoom levels. */
}

[data-theme="dark"] #nav.sol {
  background: rgba(14, 13, 11, 0.98);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ─── LOGO ──────────────────────────────────────────────────────────────────── */
.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo svg {
  height: 32px;
  width: auto;
  display: block;
}

/* ─── DESKTOP NAV LINKS CONTAINER ───────────────────────────────────────────── */
.nlinks {
  display: none;
  gap: 0;
  align-items: center;
  flex: 1;
  justify-content: center;
}

@media (min-width: 1100px) {
  .nlinks { display: flex; }
}

/* ─── NAV RIGHT ACTIONS ─────────────────────────────────────────────────────── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── NAV ITEM (with mega trigger) ─────────────────────────────────────────── */
.nl-item {
  position: relative;
}

.nl-item > a,
.nl-btn {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink2);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  transition: color var(--dur-fast), background var(--dur-fast);
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: none;
  font-family: var(--fb);
  white-space: nowrap;
  line-height: 1;
}

@media (pointer: coarse) {
  .nl-item > a,
  .nl-btn { cursor: pointer; }
}

.nl-item > a:hover,
.nl-btn:hover,
.nl-item.mm-open .nl-btn {
  color: var(--ink);
  background: rgba(20, 18, 16, 0.05);
}

[data-theme="dark"] .nl-item > a:hover,
[data-theme="dark"] .nl-btn:hover,
[data-theme="dark"] .nl-item.mm-open .nl-btn {
  background: rgba(255, 255, 255, 0.06);
}

/* Chevron */
.nl-chev {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s var(--ease);
  flex-shrink: 0;
}

.nl-item.mm-open .nl-chev {
  transform: rotate(180deg);
}

/* ─── PHONE LINK IN NAV ─────────────────────────────────────────────────────── */
.nav-phone {
  font-family: var(--fd);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink2);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color var(--dur-fast);
  white-space: nowrap;
}

.nav-phone:hover {
  color: var(--r);
}

@media (max-width: 1280px) {
  .nav-phone { display: none; }
}

/* ─── THEME TOGGLE ──────────────────────────────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1.5px solid var(--bdr2);
  border-radius: var(--radius-pill);
  cursor: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-base), background var(--dur-base);
  flex-shrink: 0;
  position: relative;
}

.theme-toggle:hover {
  border-color: var(--r);
  background: var(--r2);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  stroke: var(--ink2);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--dur-slow);
  position: absolute;
}

.theme-toggle:hover svg {
  stroke: var(--r);
}

.ico-sun,
.ico-moon {
  transition: opacity 0.3s, transform 0.3s;
}

.ico-sun  { opacity: 1; transform: scale(1); }
.ico-moon { opacity: 0; transform: scale(0.5); }

[data-theme="dark"] .ico-sun  { opacity: 0; transform: scale(0.5); }
[data-theme="dark"] .ico-moon { opacity: 1; transform: scale(1); }

@media (pointer: coarse) {
  .theme-toggle { cursor: pointer; }
}

/* ─── HAMBURGER ─────────────────────────────────────────────────────────────── */
.mbb {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: none;
  padding: 0;
  flex-shrink: 0;
}

@media (min-width: 1100px) {
  .mbb { display: none; }
}

@media (pointer: coarse) {
  .mbb { cursor: pointer; }
}

.mbb span {
  display: block;
  width: 21px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  margin: 0 auto;
  transition: transform 0.28s var(--ease), opacity 0.2s, background 0.2s;
  transform-origin: center;
}

.mbb.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mbb.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mbb.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ─── MEGA MENU PANEL ───────────────────────────────────────────────────────── */
.mega-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-panel) var(--ease),
              transform var(--dur-panel) var(--ease);
  background: var(--w);
  background-color: var(--w);
  /* Belt-and-braces: guarantees this panel is always a fully opaque,
     self-contained paint layer. Even if 'mm-open' happens to be toggled
     rapidly (see QA FIX in main.js for the click/hover race this used to
     have), the panel can never appear as a translucent "ghost" blending
     with whatever sits behind the fixed nav. */
  isolation: isolate;
  border: 1px solid var(--bdr);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-lg);
  min-width: 680px;
  overflow: hidden;
  z-index: 600;
}

.nl-item.mm-open .mega-panel {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

/* Wide variant (Hizmetler) */
.mega-panel.wide {
  min-width: 820px;
}

/* Simple variant (Kurumsal) */
.mega-panel.simple {
  min-width: 340px;
}

[data-theme="dark"] .mega-panel {
  background: #161410;
  border-color: rgba(255, 255, 255, 0.08);
}

/* ─── MEGA MENU INNER GRID ──────────────────────────────────────────────────── */
.mega-inner {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
}

/* Left: category list */
.mega-cats {
  padding: 16px 0;
  border-right: 1px solid var(--bdr);
}

.mega-cats-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink3);
  padding: 8px 18px 4px;
  font-family: var(--fd);
  display: block;
}

.mega-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  cursor: none;
  transition: background var(--dur-fast);
  text-decoration: none;
}

@media (pointer: coarse) {
  .mega-cat-item { cursor: pointer; }
}

.mega-cat-item:hover,
.mega-cat-item.active {
  background: rgba(255, 59, 31, 0.06);
}

[data-theme="dark"] .mega-cat-item:hover,
[data-theme="dark"] .mega-cat-item.active {
  background: rgba(255, 59, 31, 0.12);
}

.mega-cat-item.active .mega-cat-name {
  color: var(--r);
}

.mega-cat-ico {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mega-cat-ico svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mega-cat-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  transition: color var(--dur-fast);
  font-family: var(--fb);
}

/* Center: sub-services */
.mega-services {
  padding: 18px 20px;
  border-right: 1px solid var(--bdr);
}

.mega-services-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink3);
  margin-bottom: 10px;
  font-family: var(--fd);
  display: block;
}

.mega-svc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-xs);
}

.mega-svc-link {
  font-size: 12px;
  color: var(--ink2);
  text-decoration: none;
  padding: 6px 9px;
  border-radius: var(--radius-xs);
  transition: background var(--dur-fast), color var(--dur-fast);
  display: block;
  font-weight: 400;
}

.mega-svc-link:hover {
  background: rgba(255, 59, 31, 0.07);
  color: var(--r);
}

.mega-svc-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--r);
  text-decoration: none;
  font-family: var(--fd);
  letter-spacing: 0.02em;
  margin-top: 12px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 59, 31, 0.07);
  transition: background var(--dur-fast);
}

.mega-svc-all:hover {
  background: rgba(255, 59, 31, 0.13);
}

/* Right: featured card + cities */
.mega-right {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mega-feat-card {
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--bdr);
  overflow: hidden;
  position: relative;
  text-decoration: none;
  display: block;
  transition: transform var(--dur-base) var(--spring);
}

.mega-feat-card:hover {
  transform: translateY(-2px);
}

[data-theme="dark"] .mega-feat-card {
  background: #1E1C18;
  border-color: rgba(255, 255, 255, 0.06);
}

.mega-feat-card-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--r);
  font-family: var(--fd);
  margin-bottom: 6px;
  display: block;
}

.mega-feat-card-ttl {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  font-family: var(--fd);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 5px;
}

.mega-feat-card-p {
  font-size: 11px;
  color: var(--ink3);
  line-height: 1.6;
}

.mega-cities {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mega-cities-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink3);
  font-family: var(--fd);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mega-city-item {
  font-size: 11.5px;
  color: var(--ink2);
  text-decoration: none;
  padding: 4px 7px;
  border-radius: var(--radius-xs);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.mega-city-item:hover {
  background: rgba(20, 18, 16, 0.05);
  color: var(--ink);
}

[data-theme="dark"] .mega-city-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.mega-city-item span {
  font-size: 9.5px;
  color: var(--ink3);
  margin-left: 4px;
}

.mega-cities-all {
  font-size: 11px;
  font-weight: 600;
  color: var(--r);
  text-decoration: none;
  padding: 4px 7px;
  font-family: var(--fd);
}

/* Simple mega (Kurumsal) */
.mega-simple-inner {
  padding: 14px;
}

.mega-simple-section {
  margin-bottom: 14px;
}

.mega-simple-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink3);
  margin-bottom: 7px;
  font-family: var(--fd);
  display: block;
}

.mega-simple-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-xs);
}

.mega-simple-link {
  font-size: 12px;
  color: var(--ink2);
  text-decoration: none;
  padding: 6px 9px;
  border-radius: var(--radius-xs);
  transition: background var(--dur-fast), color var(--dur-fast);
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 400;
}

.mega-simple-link:hover {
  background: rgba(255, 59, 31, 0.07);
  color: var(--r);
}

.mega-simple-link svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
  flex-shrink: 0;
}

.mega-stats-row {
  display: flex;
  gap: 14px;
  padding: 10px 9px;
  border-top: 1px solid var(--bdr);
  margin-top: 4px;
}

.mega-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mega-stat-n {
  font-family: var(--fd);
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1;
}

.mega-stat-l {
  font-size: 9px;
  color: var(--ink3);
  font-family: var(--fd);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ─── MOBILE NAV OVERLAY ────────────────────────────────────────────────────── */
.mob-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  /* QA FIX: backdrop-filter removed — see nav.sol above for rationale.
     Slightly increased base opacity (0.5→0.55) to compensate for the
     lost blur so the dimming effect still reads clearly. */
  z-index: 505;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.mob-nav-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ─── MOBILE NAV DRAWER ─────────────────────────────────────────────────────── */
.mob-nav-wrap {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 92vw);
  background: var(--w);
  /* QA FIX: was 490 (below nav's 500). At that value, the persistent nav
     bar rendered on top of this drawer's own header in the region where
     both occupy the same top-right corner, obscuring the drawer's own
     close (X) button behind the main nav. The drawer must render above
     the nav entirely while open. */
  z-index: 510;
  transform: translateX(100%);
  transition: transform var(--dur-drawer) var(--ease);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mob-nav-wrap.open {
  transform: translateX(0);
}

/* HARD SAFEGUARD: the mobile drawer and its dimming overlay must never be
   able to render at desktop widths, regardless of any 'open' class state
   left over from a stale JS event, back-forward cache restore, or a stray
   click. This is a belt-and-braces rule on top of the .nlinks/.mbb
   breakpoint switch above — desktop visitors should never be able to see
   this drawer under any circumstance. */
@media (min-width: 1100px) {
  .mob-nav-wrap,
  .mob-nav-overlay {
    display: none !important;
  }
}

[data-theme="dark"] .mob-nav-wrap {
  background: #0E0D0B;
}

/* Drawer header */
.mob-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--nav-h);
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}

.mob-nav-logo svg {
  height: 28px;
  width: auto;
}

.mob-nav-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1.5px solid var(--bdr2);
  background: none;
  cursor: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-base), background var(--dur-base);
}

.mob-nav-close:hover {
  border-color: var(--r);
  background: var(--r2);
}

.mob-nav-close svg {
  width: 15px;
  height: 15px;
  stroke: var(--ink2);
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (pointer: coarse) {
  .mob-nav-close { cursor: pointer; }
}

/* Drawer body */
.mob-nav-body {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

/* Accordion items */
.mob-acc-item {
  border-bottom: 1px solid var(--bdr);
}

.mob-acc-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 20px;
  background: none;
  border: none;
  cursor: none;
  font-family: var(--fb);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  transition: background var(--dur-fast), color var(--dur-fast);
}

@media (pointer: coarse) {
  .mob-acc-btn { cursor: pointer; }
}

.mob-acc-btn:hover {
  background: rgba(20, 18, 16, 0.04);
}

[data-theme="dark"] .mob-acc-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mob-acc-ico {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mob-acc-ico svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mob-acc-btn-label {
  flex: 1;
}

.mob-acc-chev {
  width: 14px;
  height: 14px;
  stroke: var(--ink3);
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--dur-slow) var(--ease);
  flex-shrink: 0;
}

.mob-acc-btn.is-open .mob-acc-chev {
  transform: rotate(180deg);
}

/* Accordion content */
.mob-acc-content {
  max-height: 0;
  overflow: hidden;
  background: rgba(20, 18, 16, 0.03);
  transition: max-height var(--dur-drawer) var(--ease);
}

.mob-acc-content.open {
  max-height: 600px;
}

[data-theme="dark"] .mob-acc-content {
  background: #0A0908;
}

.mob-service-link {
  display: block;
  font-size: 13px;
  color: var(--ink2);
  text-decoration: none;
  padding: 9px 20px 9px 64px;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.mob-service-link:hover {
  background: rgba(255, 59, 31, 0.07);
  color: var(--r);
}

[data-theme="dark"] .mob-service-link:hover {
  background: rgba(255, 59, 31, 0.10);
}

.mob-service-all {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--r);
  text-decoration: none;
  padding: 9px 20px 12px 64px;
  font-family: var(--fd);
  letter-spacing: 0.02em;
}

/* Plain links (non-accordion nav items) */
.mob-plain-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink2);
  text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast);
  border-bottom: 1px solid var(--bdr);
}

.mob-plain-link:hover {
  background: rgba(20, 18, 16, 0.04);
  color: var(--ink);
}

.mob-nav-divider {
  height: 1px;
  background: var(--bdr);
  margin: 8px 0;
}

/* Drawer footer */
.mob-nav-footer {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.mob-nav-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--fd);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: none;
  transition: transform var(--dur-base) var(--spring), box-shadow var(--dur-base);
}

@media (pointer: coarse) {
  .mob-nav-cta-btn { cursor: pointer; }
}

.mob-nav-cta-btn.primary {
  background: var(--r);
  color: #fff;
}

.mob-nav-cta-btn.primary:hover {
  box-shadow: var(--shadow-r);
  transform: scale(1.02);
}

.mob-nav-cta-btn.secondary {
  background: rgba(20, 18, 16, 0.05);
  color: var(--ink2);
}

/* Mobile theme pill */
.mob-theme-pill {
  display: flex;
  background: rgba(20, 18, 16, 0.05);
  border-radius: var(--radius-pill);
  padding: 3px;
  margin-top: 4px;
}

[data-theme="dark"] .mob-theme-pill {
  background: rgba(255, 255, 255, 0.07);
}

.mob-theme-opt {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink3);
  background: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 0;
  cursor: none;
  font-family: var(--fd);
  transition: background var(--dur-base), color var(--dur-base), box-shadow var(--dur-base);
  text-align: center;
}

@media (pointer: coarse) {
  .mob-theme-opt { cursor: pointer; }
}

.mob-theme-opt.active {
  background: var(--w);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ─── MOBILE HEADER FIT FIX ───────────────────────────────────────────────────
   At mobile widths the desktop CTA remained visible, pushing the hamburger
   outside the viewport. Keep only logo + theme toggle + hamburger on phones. */
   @media (max-width: 640px) {
     .nav-actions .bp {
       display: none;
     }
   }

  #nav .logo svg {
    height: 27px;
  }

  #nav .nav-actions {
    gap: 4px;
  }

  #nav .nav-actions > a.bp.bpr {
    display: none;
  }
}
