/*
 * landing-shell.css — Global header & mobile drawer (all landing views)
 * Pure black luxury aesthetic · portal-mounted · static-page safe
 */

:root {
  --shell-primary: #10b981;
  --shell-primary-glow: rgba(16, 185, 129, 0.4);
  --shell-primary-soft: rgba(16, 185, 129, 0.1);
  --shell-black: #000000;
  --shell-black-soft: #0a0a0a;
  --shell-text: #fafafa;
  --shell-text-dim: rgba(250, 250, 250, 0.45);
  --shell-border: rgba(255, 255, 255, 0.08);
  --shell-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shell-ui: 0.5s;
  --landing-shell-offset: 72px;
  --v4-header-offset: var(--landing-shell-offset);
}

/* ── HEADER ── */
.landing-shell-header,
.v4-header.landing-shell-mounted {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 320;
  padding: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.55) 75%, transparent 100%);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  transition: transform 0.9s var(--shell-ease), opacity 0.7s var(--shell-ease), background 0.35s var(--shell-ease);
}

.landing-shell-header--cinematic {
  transform: translateY(-120%);
  opacity: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.landing-shell-header--cinematic.is-visible,
.landing-shell-header--static.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.landing-shell-header--cinematic.is-hidden {
  transform: translateY(-120%);
  opacity: 0;
}

.landing-shell-header--static {
  transform: translateY(0);
  opacity: 1;
}

.landing-shell-header--static.is-scrolled {
  background: rgba(0, 0, 0, 0.96);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 40px rgba(0, 0, 0, 0.5);
}

.landing-shell-bar,
.v4-header-bar.landing-shell-mounted {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1280px;
  padding:
    calc(14px + env(safe-area-inset-top, 0px))
    max(20px, env(safe-area-inset-right, 0px))
    14px
    max(20px, env(safe-area-inset-left, 0px));
  pointer-events: auto;
  gap: 16px;
}

.landing-shell-logo,
.v4-logo.landing-shell-mounted {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.landing-shell-logo img,
.v4-logo.landing-shell-mounted img {
  height: 34px;
  width: auto;
  flex-shrink: 0;
}

.landing-shell-logo span,
.v4-logo.landing-shell-mounted span {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--shell-text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landing-shell-nav {
  flex: 2;
  display: flex;
  justify-content: center;
}

.landing-shell-nav-list {
  display: flex;
  align-items: center;
  gap: 40px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.landing-shell-nav-link {
  color: var(--shell-text-dim) !important;
  text-decoration: none !important;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 6px 0;
  transition: color var(--shell-ui) var(--shell-ease);
  white-space: nowrap;
  position: relative;
}

.landing-shell-nav-link::after {
  display: none !important;
}

.landing-shell-nav-link:hover,
.landing-shell-nav-link.is-active {
  color: var(--shell-text) !important;
  opacity: 1 !important;
}

.landing-shell-nav-link.is-active::after {
  display: block !important;
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--shell-primary);
  width: 100% !important;
}

.landing-shell-actions,
.v4-header-actions.landing-shell-mounted {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.landing-shell-lang,
.v4-lang-switch.landing-shell-mounted {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--shell-border);
}

.landing-shell-lang-btn,
.v4-lang-btn.landing-shell-mounted {
  background: transparent;
  border: none;
  color: var(--shell-text-dim);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--shell-ui) var(--shell-ease);
}

.landing-shell-lang-btn.is-active,
.v4-lang-btn.landing-shell-mounted.active {
  color: var(--shell-text);
  background: rgba(255, 255, 255, 0.1);
}

.landing-shell-panel,
.v4-btn-panel.landing-shell-mounted {
  background: var(--shell-primary);
  color: #fff !important;
  padding: 9px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px var(--shell-primary-glow);
  transition: all var(--shell-ui) var(--shell-ease);
  white-space: nowrap;
}

.landing-shell-toggle,
.v4-mobile-toggle.landing-shell-mounted {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--shell-border);
  cursor: pointer;
  padding: 0;
  border-radius: 11px;
  flex-shrink: 0;
  transition: background var(--shell-ui) var(--shell-ease), border-color var(--shell-ui) var(--shell-ease);
}

.landing-shell-toggle span,
.v4-mobile-toggle.landing-shell-mounted span {
  display: block;
  width: 15px;
  height: 1.5px;
  margin: 0 auto;
  background: #fff;
  border-radius: 2px;
  transition: all 0.38s var(--shell-ease);
}

.landing-shell-toggle.is-open span:nth-child(1),
.v4-mobile-toggle.landing-shell-mounted.active span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.landing-shell-toggle.is-open span:nth-child(2),
.v4-mobile-toggle.landing-shell-mounted.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.landing-shell-toggle.is-open span:nth-child(3),
.v4-mobile-toggle.landing-shell-mounted.active span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ── BACKDROP ── */
.landing-shell-backdrop,
.v4-nav-backdrop.landing-shell-mounted {
  position: fixed;
  inset: 0;
  z-index: 310;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.55s var(--shell-ease), visibility 0s linear 0.55s;
}

.landing-shell-backdrop.is-visible,
.v4-nav-backdrop.landing-shell-mounted.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

/* ── DRAWER (full-screen black) ── */
nav.landing-shell-drawer,
nav.v4-nav.landing-shell-mounted {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  z-index: 330 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  transform: translateY(8%) scale(1.02);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 0.6s var(--shell-ease),
    opacity 0.5s var(--shell-ease),
    visibility 0s linear 0.6s;
  overflow: hidden;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

nav.landing-shell-drawer.is-open,
nav.v4-nav.landing-shell-mounted.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

nav.landing-shell-drawer::before,
nav.v4-nav.landing-shell-mounted::before {
  display: none !important;
}

.landing-shell-drawer-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding:
    calc(16px + env(safe-area-inset-top, 0px))
    24px
    calc(20px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(16, 185, 129, 0.07) 0%, transparent 60%),
    var(--shell-black);
  position: relative;
}

.landing-shell-drawer-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.4;
}

.landing-shell-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--shell-border);
  position: relative;
  z-index: 1;
  opacity: 0;
}

nav.landing-shell-drawer.is-open .landing-shell-drawer-head {
  animation: shellHeadIn 0.45s var(--shell-ease) 0.06s both;
}

.landing-shell-drawer-brand {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--shell-text-dim);
}

.landing-shell-drawer-close {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--shell-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--shell-text);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s var(--shell-ease), border-color 0.3s var(--shell-ease);
}

.landing-shell-drawer-close:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}

.landing-shell-drawer-nav {
  list-style: none !important;
  margin: 0 !important;
  padding: 28px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  gap: 2px !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
  align-self: stretch;
  min-height: 0;
}

.landing-shell-drawer-link {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 16px 4px 16px 8px !important;
  min-height: 58px;
  text-decoration: none !important;
  color: var(--shell-text-dim) !important;
  font-size: clamp(1.42rem, 5.5vw, 1.72rem) !important;
  font-weight: 600 !important;
  letter-spacing: -0.03em !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  transition: color 0.3s var(--shell-ease) !important;
  position: relative;
  opacity: 0;
  transform: translateY(10px);
}

.landing-shell-drawer-link::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 24px;
  background: var(--shell-primary);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 10px var(--shell-primary-glow);
  opacity: 0;
  transition: opacity 0.35s var(--shell-ease);
}

nav.landing-shell-drawer.is-open .landing-shell-drawer-link {
  animation: shellNavIn 0.65s var(--shell-ease) backwards;
}

nav.landing-shell-drawer.is-open .landing-shell-drawer-link:nth-child(1) { animation-delay: 0.12s; }
nav.landing-shell-drawer.is-open .landing-shell-drawer-link:nth-child(2) { animation-delay: 0.18s; }
nav.landing-shell-drawer.is-open .landing-shell-drawer-link:nth-child(3) { animation-delay: 0.24s; }
nav.landing-shell-drawer.is-open .landing-shell-drawer-link:nth-child(4) { animation-delay: 0.3s; }

.landing-shell-drawer-link::after {
  display: none !important;
}

.landing-shell-drawer-link:last-child {
  border-bottom: none !important;
}

.landing-shell-drawer-link .nav-index {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: rgba(16, 185, 129, 0.45);
  min-width: 24px;
  font-variant-numeric: tabular-nums;
}

.landing-shell-drawer-link .nav-label {
  flex: 1;
}

.landing-shell-drawer-link .nav-arrow {
  width: 18px;
  flex-shrink: 0;
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s var(--shell-ease);
  color: var(--shell-primary);
  font-size: 1rem;
  font-weight: 400;
}

.landing-shell-drawer-link:hover,
.landing-shell-drawer-link.is-active {
  color: var(--shell-text) !important;
}

.landing-shell-drawer-link.is-active .nav-arrow {
  opacity: 1;
}

.landing-shell-drawer-link.is-active .nav-index {
  color: var(--shell-primary);
}

.landing-shell-drawer-link.is-active::before {
  opacity: 1;
}

.landing-shell-drawer-foot {
  margin-top: 0;
  padding-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--shell-border);
  position: relative;
  z-index: 1;
  opacity: 0;
  width: 100%;
}

nav.landing-shell-drawer.is-open .landing-shell-drawer-foot {
  animation: shellFootIn 0.45s var(--shell-ease) 0.28s both;
}

.landing-shell-lang--drawer {
  position: relative;
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 320px;
  height: 54px;
  padding: 4px !important;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--shell-border);
  gap: 0 !important;
}

.landing-shell-lang--drawer::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.32);
  border-radius: 10px;
  transition: transform 0.42s var(--shell-ease);
  z-index: 0;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.12);
}

.landing-shell-lang--drawer[data-active="en"]::before {
  transform: translateX(calc(100% + 0px));
}

.landing-shell-lang--drawer .landing-shell-lang-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  padding: 0 !important;
  border-radius: 10px;
  letter-spacing: 0.06em;
}

.landing-shell-lang--drawer .landing-shell-lang-btn.is-active {
  background: transparent !important;
  color: var(--shell-text) !important;
}

.landing-shell-panel--drawer {
  width: 100%;
  max-width: 320px;
  padding: 15px 20px;
  font-size: 0.88rem;
  border-radius: 14px;
  background: var(--shell-primary) !important;
}

/* Menu open states */
body.landing-shell-menu-open {
  touch-action: none;
  overflow: hidden;
}

body.landing-shell-menu-open .landing-shell-actions .landing-shell-lang,
body.landing-shell-menu-open .v4-header-actions .v4-lang-switch {
  display: none;
}

body.landing-shell-menu-open .v4-dots {
  opacity: 0;
  pointer-events: none;
}

/* Static page layout */
body.landing-shell-static .page-shell,
body.landing-shell-static .shell {
  padding-top: calc(var(--landing-shell-offset) + 8px);
}

body.landing-shell-static .hero {
  margin-top: 12px;
}

body.landing-shell-static.landing-shell-revealed .hero,
body.landing-shell-static.landing-shell-revealed .document,
body.landing-shell-static.landing-shell-revealed .page-grid,
body.landing-shell-static.landing-shell-revealed .delete-shell {
  animation: shellContentIn 0.85s var(--shell-ease) backwards;
}

body.landing-shell-static.landing-shell-revealed .document,
body.landing-shell-static.landing-shell-revealed .page-grid {
  animation-delay: 0.12s;
}

@keyframes shellHeadIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shellFootIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

nav.landing-shell-drawer:not(.is-open) .landing-shell-drawer-link,
nav.landing-shell-drawer:not(.is-open) .landing-shell-drawer-head,
nav.landing-shell-drawer:not(.is-open) .landing-shell-drawer-foot {
  animation: none !important;
  opacity: 0;
}

nav.landing-shell-drawer:not(.is-open) .landing-shell-drawer-foot {
  opacity: 0;
}

@keyframes shellNavIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shellContentIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .landing-shell-bar,
  .v4-header-bar.landing-shell-mounted {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "logo actions toggle";
    gap: 10px;
    padding:
      calc(10px + env(safe-area-inset-top, 0px))
      max(16px, env(safe-area-inset-right, 0px))
      12px
      max(16px, env(safe-area-inset-left, 0px));
  }

  .landing-shell-logo,
  .v4-logo.landing-shell-mounted { grid-area: logo; flex: unset; }

  .landing-shell-actions,
  .v4-header-actions.landing-shell-mounted { grid-area: actions; gap: 8px; }

  .landing-shell-toggle,
  .v4-mobile-toggle.landing-shell-mounted { grid-area: toggle; display: flex; }

  .landing-shell-nav { display: none; }

  .landing-shell-actions .landing-shell-panel,
  .v4-header-actions .v4-btn-panel.landing-shell-mounted { display: none; }

  .landing-shell-logo img,
  .v4-logo.landing-shell-mounted img { height: 30px; }

  .landing-shell-logo span,
  .v4-logo.landing-shell-mounted span { font-size: 0.9rem; }
}

@media (max-width: 360px) {
  .landing-shell-logo span,
  .v4-logo.landing-shell-mounted span { display: none; }
}

@media (min-width: 901px) {
  nav.landing-shell-drawer,
  .landing-shell-backdrop,
  .landing-shell-drawer-close { display: none !important; }
}
