/* ==========================================================================
   PEXAFY — layout.css : Header, Footer, Mobile Drawer
   ========================================================================== */

/* ---- HEADER --------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 60px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  /* Default: solid */
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .site-header {
  background: rgba(248, 248, 252, 0.85);
}

/* Transparent variant for homepage hero */
.site-header--transparent {
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* After scroll */
.site-header--solid {
  background: rgba(10, 10, 15, 0.95) !important; /* accessibility override */
  border-bottom-color: var(--color-border) !important;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .site-header--solid {
  background: rgba(248, 248, 252, 0.96) !important;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  width: 100%;
  flex-wrap: nowrap;
}

/* ---- LOGO ----------------------------------------------------------------- */
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.site-logo:hover {
  color: var(--color-text);
}

.site-logo .logo-text {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- DESKTOP NAV ---------------------------------------------------------- */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 1;
  min-width: 0;
}

.nav-desktop a {
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.nav-desktop a:hover,
.nav-desktop a.nav-active,
.nav-desktop a.is-active {
  color: var(--color-text);
  background: var(--color-surface);
}

/* Active nav — stronger highlight */
.nav-desktop a.is-active {
  color: var(--color-primary);
  font-weight: 600;
  background: rgba(139, 92, 246, 0.1);
}

[data-theme="light"] .nav-desktop a.is-active {
  color: var(--color-primary);
  background: rgba(139, 92, 246, 0.08);
}

/* ---- HEADER RIGHT --------------------------------------------------------- */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* Auth zones — the swap targets chrome_hydrate.js replaces on CDN-cached pages
   (static/js/chrome_hydrate.js). They exist only to be addressable: display:contents
   keeps them out of the layout, so the bell, the user menu and the drawer's links
   stay direct flex items of their parent exactly as before the wrappers existed. */
.header-auth,
.drawer-auth,
.drawer-auth-cta {
  display: contents;
}

/* ---- USER DROPDOWN -------------------------------------------------------- */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  cursor: pointer;
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 500;
}

.user-menu-trigger:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
}

.user-menu-trigger:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.user-menu-caret {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
}

.user-menu[aria-expanded="true"] .user-menu-caret {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 310;
  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity var(--transition), visibility var(--transition),
    transform var(--transition);
}

.user-menu[aria-expanded="true"] .user-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.user-dropdown a,
.user-dropdown button {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-align: start;
  transition: background var(--transition), color var(--transition);
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.user-dropdown .dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

.user-dropdown .dropdown-signout {
  color: var(--color-error);
}

.user-dropdown .dropdown-signout:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--color-error);
}

/* ---- NOTIFICATION BELL --------------------------------------------------- */
.notif-bell-wrapper {
  position: relative;
}

.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl, 50%);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition, 180ms ease);
}
.notif-bell-btn:hover {
  color: var(--color-text);
  border-color: var(--color-primary, #8b5cf6);
}
.notif-bell-btn:active {
  transform: scale(0.95);
}
.notif-bell-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.notif-bell-btn svg {
  transition: transform 300ms ease;
}
.notif-bell-btn:hover svg {
  transform: rotate(12deg);
}

.notif-bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: notifBadgePulse 2s ease-in-out infinite;
}

@keyframes notifBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ---- NOTIFICATION DROPDOWN ----------------------------------------------- */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 310;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: notifFadeIn 0.15s ease-out;
}

@keyframes notifFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}
.notif-dropdown__title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}
.notif-dropdown__mark-all {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.notif-dropdown__mark-all:hover { text-decoration: underline; }

.notif-dropdown__body {
  flex: 1;
  overflow-y: auto;
  max-height: 340px;
}

.notif-dropdown__loading {
  padding: 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.notif-dd-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
}
.notif-dd-item:hover { background: var(--color-surface-hover); }
.notif-dd-item--unread {
  background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
}
.notif-dd-item--unread .notif-dd-item__title { font-weight: 600; }

.notif-dd-item__icon { font-size: 1.125rem; flex-shrink: 0; margin-top: 2px; }
.notif-dd-item__body { flex: 1; min-width: 0; }
.notif-dd-item__title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-dd-item__time {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.notif-dropdown__empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.notif-dropdown__footer {
  padding: 10px 16px;
  border-top: 1px solid var(--color-border);
  text-align: center;
}
.notif-dropdown__footer a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}
.notif-dropdown__footer a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .notif-dropdown {
    width: calc(100vw - 32px);
    right: -60px;
  }
}

/* ---- HAMBURGER ------------------------------------------------------------ */
.menu-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.menu-hamburger:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
}

.menu-hamburger:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ---- MOBILE DRAWER -------------------------------------------------------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  width: min(320px, 85vw);
  background: var(--color-surface);
  border-inline-start: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), opacity 300ms ease, visibility 300ms ease;
}

.mobile-drawer.is-open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--color-border);
  height: 60px;
}

.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.drawer-close:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
}

.drawer-close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-6);
}

.drawer-nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px var(--sp-3);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.drawer-nav a:hover,
.drawer-nav a.nav-active {
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.drawer-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--sp-3) 0;
}

.drawer-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* ---- FOOTER --------------------------------------------------------------- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding-top: var(--sp-12);
  padding-bottom: var(--sp-8);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-8);
  margin-bottom: var(--sp-8);
  max-width: 800px;
  margin-inline-start: auto;
  margin-inline-end: auto;
}

.footer-col-title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: var(--sp-4);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.footer-links a {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--color-text);
}

.footer-links .badge {
  font-size: 0.625rem;
  padding: 2px 6px;
}

.footer-social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.footer-social-icon:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

.footer-social-icon svg {
  width: 18px;
  height: 18px;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.footer-bottom-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.powered-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #22d3ee;
  background: #0e2428;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-xl);
}
[data-theme="light"] .powered-badge {
  color: #0c6a84;
  background: #e0f6fa;
  border-color: rgba(6, 182, 212, 0.35);
}

/* ---- RESPONSIVE ----------------------------------------------------------- */
@media (max-width: 1024px) {
  .nav-desktop { display: none; }
  .menu-hamburger { display: inline-flex; }
  .header-right .btn { display: none; }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-6);
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
  .footer-bottom-left {
    flex-direction: column;
    gap: var(--sp-2);
  }
}

@media (min-width: 1025px) {
  .menu-hamburger { display: none; }
  .drawer-overlay,
  .mobile-drawer { display: none; }
}

/* ---- PLACEHOLDER PAGES ---------------------------------------------------- */
.placeholder-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-16) var(--sp-4);
}

.placeholder-page h1 {
  margin-bottom: var(--sp-4);
}

.placeholder-page p {
  max-width: 480px;
  font-size: 1.1rem;
}

/* cache-bust 2026-06-16: force new content-hash after the redeploy unstyle window (issue #1) */

/* ===========================================================================
   i18n — language switcher + suggestion banner  (logical properties → RTL-safe)
   =========================================================================== */
.lang-switcher{position:relative;display:inline-block}
.lang-switcher__toggle{display:inline-flex;align-items:center;gap:6px;height:40px;padding-inline:10px;
    border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface);
    color:var(--color-text-muted);cursor:pointer;font-size:.85rem;list-style:none;user-select:none;white-space:nowrap}
.lang-switcher__toggle::-webkit-details-marker{display:none}
.lang-switcher__toggle::marker{content:""}
.lang-switcher__toggle:hover,.lang-switcher[open] .lang-switcher__toggle{color:var(--color-text)}
.lang-switcher__globe{flex-shrink:0}
.lang-switcher__current{max-width:10ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lang-switcher__menu{position:absolute;z-index:300;inset-block-start:calc(100% + 6px);inset-inline-end:0;
    min-width:210px;max-height:min(60vh,420px);overflow-y:auto;margin:0;padding:6px;list-style:none;
    background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-md);box-shadow:var(--shadow-md)}
.lang-switcher__option{display:block;inline-size:100%;text-align:start;padding:8px 12px;border:0;
    border-radius:var(--radius-md);background:transparent;color:var(--color-text);font-size:.875rem;cursor:pointer;text-decoration:none}
.lang-switcher__option:hover,.lang-switcher__option:focus-visible{background:var(--color-surface-hover)}
.lang-switcher__option.is-current{color:var(--color-primary);font-weight:600}
/* Footer switcher: open upward (it sits at the bottom of the page) + push to the inline end */
.lang-switcher--footer{margin-inline-start:auto}
.lang-switcher--footer .lang-switcher__menu{inset-block-start:auto;inset-block-end:calc(100% + 6px)}
/* Header switcher hidden on mobile — footer switcher serves small screens. */
@media(max-width:1024px){.lang-switcher--header{display:none}}

.lang-banner{display:flex;align-items:center;gap:12px;padding:10px 16px;background:var(--color-surface);
    border-block-end:1px solid var(--color-border);font-size:.9rem;color:var(--color-text)}
.lang-banner__text{flex:1;min-inline-size:0}
.lang-banner__cta{margin:0}
.lang-banner__dismiss{background:transparent;border:0;color:var(--color-text-muted);font-size:1.4rem;
    line-height:1;cursor:pointer;padding-inline:6px}
.lang-banner__dismiss:hover{color:var(--color-text)}
