/* Shared shell: main app nav + footer (matches index.php look).
   Font Awesome is loaded per-page where icons are needed — no @import here
   (a failed CDN @import can cause browsers to ignore this entire file). */
:root {
  --obsidian: #090a0d;
  --void: #0d0e12;
  --surface: #12141a;
  --rim: #1e2129;
  --muted: #2a2d38;
  --subtle: #3a3e4d;
  --text-dim: #6b7190;
  --text-mid: #9ea3b8;
  --text-body: #c8ccdc;
  --text-head: #eef0f5;
  --text-bright: #f8f9fc;
  --gold: #1ef876;
  --gold-light: #17d968;
  --gold-dim: #0b8a43;
}

html { scroll-behavior: smooth; }

/* ── Site-themed scrollbars (dark) — matches index.php; applies to every page
   that loads app-shell.css (dashboard, account, showcase, viewer, blog, cms,
   api/v2, 404, reset-password). Firefox uses scrollbar-color; WebKit/Chromium
   use the ::-webkit-scrollbar pseudo-elements. ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) var(--obsidian);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--obsidian); }
::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 5px;
  border: 2px solid var(--obsidian);
}
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
::-webkit-scrollbar-corner { background: var(--obsidian); }

body.app-shell-page {
  margin: 0;
  background: var(--obsidian);
  color: var(--text-body);
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 300;
  font-size: 17px;
  line-height: 1.65;
  padding-top: 70px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.app-shell-page::before {
  content: '';
  position: fixed;
  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='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.app-shell-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(74,108,247,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,108,247,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.app-shell-main {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
}

.app-shell-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 60px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: rgba(9,10,13,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.app-shell-nav .nav-logo { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.app-shell-nav .logo-mark { width: 42px; height: 42px; flex-shrink: 0; }
.app-shell-nav .logo-mark svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 0 8px rgba(30,248,118,0.45)); }
.app-shell-nav .logo-mark .lm-halo { transform-origin: 16px 16px; animation: lm-halo 2.8s ease-in-out infinite; }
.app-shell-nav .logo-mark .lm-cube {
  transform-box: fill-box;
  transform-origin: center;
  animation: lm-spin 9s linear infinite;
}
.app-shell-nav .nav-logo:hover .logo-mark svg { filter: drop-shadow(0 0 12px rgba(30,248,118,0.7)); }
.app-shell-nav .nav-logo:hover .logo-mark .lm-cube { animation-duration: 3.5s; }
@keyframes lm-spin { to { transform: rotate(360deg); } }
@keyframes lm-halo { 0%,100% { opacity: 0.16; transform: scale(0.97); } 50% { opacity: 0.32; transform: scale(1.05); } }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.app-shell-nav .logo-text-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1; }
.app-shell-nav .logo-text-3d {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  color: #f4f7f5;
  text-shadow:
    0 0 18px rgba(30,248,118,0.35),
    0 1px 0 rgba(30,248,118,0.35),
    0 2px 0 rgba(11,138,67,0.25);
}
.app-shell-nav .logo-text-wire {
  display: block;
  font-family: 'Outfit', 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #1ef876;
  line-height: 1.1;
  margin-top: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .app-shell-nav .logo-mark .lm-cube,
  .app-shell-nav .logo-mark .lm-halo { animation: none; }
}

.app-shell-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.app-shell-nav .nav-links li { list-style: none; }
.app-shell-nav .nav-links a {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.2s;
}
.app-shell-nav .nav-links a:hover { color: var(--text-bright); }
.app-shell-nav .nav-links a.app-shell-nav-active {
  color: var(--gold-light);
  box-shadow: 0 1px 0 0 var(--gold-dim);
}

.app-shell-nav .app-shell-logout {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mid);
  background: transparent;
  border: 1px solid var(--rim);
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.app-shell-nav .app-shell-logout:hover {
  color: var(--text-bright);
  border-color: var(--subtle);
}

.app-shell-nav .nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rim);
  border-radius: 4px;
  background: var(--void);
  color: var(--text-mid);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.app-shell-nav .nav-toggle:hover { color: var(--text-bright); border-color: var(--subtle); }
.app-shell-nav .nav-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

.app-shell-nav.public-shell-nav {
  justify-content: flex-start;
  gap: 28px;
}
.app-shell-nav.public-shell-nav .nav-links {
  flex: 1;
  justify-content: center;
}
.app-shell-nav.public-shell-nav .nav-actions {
  margin-left: 0;
}

.app-shell-nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.app-shell-nav .public-nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #17d968 0%, #1ef876 55%, #12b85a 100%);
  color: #090a0d !important;
  padding: 10px 22px;
  border-radius: 2px;
  border: 1px solid #1ef876;
  text-decoration: none !important;
  white-space: nowrap;
  line-height: 1.2;
  transition: background 0.2s, filter 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 10px rgba(30, 248, 118, 0.25);
}
.app-shell-nav .public-nav-cta:hover {
  filter: brightness(1.06);
  color: #090a0d !important;
  box-shadow: 0 3px 14px rgba(30, 248, 118, 0.35);
}

/* ── Logged-in identity — the SAME component everywhere the nav appears (index,
   showcase, blog, landers, viewer, 404, gallery, dashboard, account). A user
   should see one consistent "who am I / log out" control regardless of page. ── */
.nav-profile-wrap { position: relative; }
.profile-trigger {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 4px;
  background: #1ef876;
  color: #062b14;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s, color 0.2s;
  box-shadow: none;
}
.profile-trigger i { filter: none; color: inherit; }
.profile-trigger:hover { background: #17d968; color: #062b14; }
.profile-trigger[aria-expanded="true"] { background: #17d968; color: #062b14; }
.profile-trigger:active { transform: scale(0.94); }
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: var(--void);
  border: 1px solid var(--rim);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  padding: 6px 0;
  z-index: 200;
}
.profile-dropdown-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  text-decoration: none;
  padding: 10px 16px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-mid);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.profile-dropdown-item:hover { background: rgba(30,248,118,0.12); color: var(--gold-light); }
.profile-dropdown-logout { border-top: 1px solid var(--rim); margin-top: 4px; padding-top: 10px; color: var(--text-dim); }
.profile-dropdown-logout:hover { color: #e87878; background: var(--surface); }
@media (max-width: 900px) {
  /* Scoped to the mobile menu: the header-bar copy (.nav-actions) must NOT stretch
     full-width or it crushes the logo and hamburger. */
  .nav-links .nav-profile-wrap { width: 100%; }
  .nav-links .profile-trigger { width: 100%; height: auto; border-radius: 4px; padding: 12px 0; gap: 8px; font-family: 'DM Mono', ui-monospace, monospace; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
  .nav-links .profile-trigger::after { content: 'Account'; }
  .nav-links .profile-dropdown { position: static; margin-top: 4px; width: 100%; box-shadow: none; }
  /* Account lives inside the hamburger menu on mobile; keep only the guest CTA in the bar. */
  .app-shell-nav .nav-actions .nav-profile-wrap { display: none !important; }
}

.public-footer .footer-made {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}
.public-footer .footer-made a { color: var(--gold); text-decoration: none; }
.public-footer .footer-links {
  display: flex;
  gap: 32px;
  list-style: none;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}
.public-footer .footer-links a {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.2s;
}
.public-footer .footer-links a:hover { color: var(--text-bright); }
.public-footer .footer-copy {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-dim);
}

/* Back-to-top: bright at rest (matches brand CTA), recedes to a muted dark state on hover. */
.scroll-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--obsidian);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: opacity 0.2s, visibility 0.2s, color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 28px rgba(30, 248, 118, 0.35);
}
.scroll-to-top.visible { display: flex; }
.scroll-to-top:hover {
  color: var(--text-mid);
  background: var(--void);
  border-color: var(--rim);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.scroll-to-top i { font-size: 20px; line-height: 1; }

.app-shell-footer {
  position: relative;
  z-index: 1;
  padding: 48px 60px;
  border-top: 1px solid var(--rim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: auto;
  flex-shrink: 0;
}
.app-shell-footer .footer-logo-block { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.app-shell-footer .footer-logo-block .logo-mark { width: 32px; height: 32px; }
.app-shell-footer .logo-text-wrap { display: flex; flex-direction: column; line-height: 1; }
.app-shell-footer .logo-text-3d {
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-bright);
}
.app-shell-footer .logo-text-wire {
  display: block;
  margin-top: 2px;
  line-height: 0;
}
.app-shell-footer .logo-text-3d {
  font-size: 18px;
  color: #f4f7f5;
  text-shadow: 0 0 12px rgba(30,248,118,0.3);
}
.app-shell-footer .logo-text-wire {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #1ef876;
}
.app-shell-footer .logo-mark svg { filter: drop-shadow(0 0 6px rgba(30,248,118,0.35)); }
.app-shell-footer .logo-mark .lm-cube { animation: lm-spin 12s linear infinite; }
.app-shell-footer .footer-made {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-mid);
  margin-top: 8px;
}
.app-shell-footer .footer-made a { color: var(--text-mid); text-decoration: none; transition: color 0.2s; }
.app-shell-footer .footer-made a:hover { color: var(--text-bright); }
.app-shell-footer .footer-made a.footer-powered { color: var(--gold); }
.app-shell-footer .footer-made a.footer-powered:hover { color: var(--gold-light); }
.app-shell-footer .footer-links { display: flex; gap: 40px; list-style: none; flex-wrap: wrap; margin: 0; padding: 0; }
.app-shell-footer .footer-links a {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.2s;
}
.app-shell-footer .footer-links a:hover { color: var(--text-bright); }
.app-shell-footer .footer-copy {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-mid);
}
.app-shell-footer .generations-counter-inline { color: var(--gold); }

@media (min-width: 601px) and (max-width: 1024px) {
  .app-shell-nav { padding: 0 32px; }
  .app-shell-nav .nav-links { gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
  .wrap { padding-left: 28px; padding-right: 28px; }
  .app-shell-footer { padding-left: 32px; padding-right: 32px; }
}

@media (max-width: 900px) {
  .app-shell-nav { padding: 0 16px 0 20px; height: 60px; gap: 10px; }
  .app-shell-nav.public-shell-nav { justify-content: flex-start; }
  .app-shell-nav.public-shell-nav .nav-links { flex: none; }
  body.app-shell-page { padding-top: 60px; }
  .app-shell-nav .nav-toggle { display: inline-flex; flex-shrink: 0; order: 3; }
  .app-shell-nav .nav-actions { margin-left: auto; margin-right: 0; order: 2; }
  .app-shell-nav .nav-logo { min-width: 0; }
  .app-shell-nav .public-nav-cta {
    padding: 8px 14px;
    font-size: 10px;
    letter-spacing: 0.08em;
  }
  .app-shell-nav .public-nav-cta-item { display: list-item; list-style: none; }
  .app-shell-nav .public-nav-cta-item .public-nav-cta {
    display: flex;
    width: 100%;
    margin-top: 8px;
    box-sizing: border-box;
  }
  .app-shell-nav .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 24px 20px;
    background: rgba(9,10,13,0.97);
    border-bottom: 1px solid var(--rim);
    display: none;
    z-index: 99;
  }
  .app-shell-nav.nav-open .nav-links { display: flex; }
  .app-shell-nav .nav-links li { list-style: none; }
  .app-shell-nav .nav-links a:not(.public-nav-cta) { padding: 14px 0; border-bottom: 1px solid var(--rim); }
  .app-shell-nav .nav-links .app-shell-logout {
    width: 100%;
    text-align: left;
    margin-top: 4px;
    padding: 14px 0;
    border: none;
    border-bottom: 1px solid var(--rim);
    border-radius: 0;
  }
  .app-shell-footer { flex-direction: column; text-align: center; padding: 32px 24px; }
}

@media (min-width: 901px) {
  .app-shell-nav .nav-toggle { display: none !important; }
  .app-shell-nav .public-nav-cta-item { display: none; }
}

/* ── Back-to-top button (app-shell pages) ── */
.app-scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 4px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #090a0d;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  box-shadow: 0 6px 28px rgba(30,248,118,0.35);
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.app-scroll-top.visible { display: flex; }
.app-scroll-top:hover {
  color: var(--text-mid);
  background: var(--void);
  border-color: var(--rim);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.app-scroll-top i { font-size: 20px; line-height: 1; }
