/* =========================================================
   APP SHELL
   ========================================================= */

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;

  padding:
    22px max(16px, env(safe-area-inset-right)) 42px max(16px, env(safe-area-inset-left));

  position: relative;
  z-index: 1;
}


/* =========================================================
   TOPBAR / WORKSPACE HEADER
   ========================================================= */

.topbar,
.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;
  margin-bottom: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;

  margin-inline: -8px;
  padding: 8px;

  border:
    1px solid rgba(var(--gold-light-rgb), 0.16);

  border-radius: 0 0 8px 8px;

  background:
    linear-gradient(180deg,
      rgba(35, 15, 4, 0.80),
      rgba(3, 16, 34, 0.88));

  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.36);

  backdrop-filter: blur(18px);
}

body:not(.workspace-active):not(.setup-active) .topbar {
  display: none;
}

.workspace-active .topbar,
.setup-active .topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  margin-bottom: 18px;
}

.workspace-active .brand-logo {
  width: clamp(100px, 12vw, 156px);
  max-height: 72px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.app-menu-toggle {
  display: none;
  place-items: center;
  gap: 5px;
  width: 54px;
  height: 46px;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid rgba(159, 207, 255, 0.26);
  border-radius: 8px;
  background: rgba(5, 14, 26, 0.82);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
}

.app-menu-toggle span {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #bfe3ff;
  box-shadow: 0 0 8px rgba(98, 182, 255, 0.42);
  transform-origin: center;
  transition: transform 180ms ease, opacity 180ms ease;
}

body.app-menu-open .app-menu-toggle span:nth-child(1),
.app-menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

body.app-menu-open .app-menu-toggle span:nth-child(2),
.app-menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

body.app-menu-open .app-menu-toggle span:nth-child(3),
.app-menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.brand-lockup,
.brand-home-button {
  min-width: 0;
}

.brand-lockup,
body.landing-active .brand-lockup,
body.workspace-active .brand-lockup,
body.setup-active .brand-lockup {
  flex: 0 0 clamp(100px, 12vw, 156px);
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}


/* =========================================================
   APP MENU
   ========================================================= */

.app-menu {
  display: flex;
  align-items: center;
  flex-wrap: wrap;

  gap: 6px;
  width: 540px;
  max-width: 540px;
  flex: 0 1 540px;
  min-width: 0;
}

.app-menu .module-link {
  min-height: 38px;
  padding: 0.5rem 0.72rem;
  text-decoration: none;
  /* Match the line-height a real <button> gets from base.css regardless of
     whether this is rendered as a <button> or an <a> (guide/privacy pages
     need real hrefs, so they use <a> here). */
  line-height: 1.3;

  border:
    1px solid rgba(var(--gold-light-rgb), 0.18);

  background:
    linear-gradient(180deg,
      rgba(var(--gold-light-rgb), 0.035),
      rgba(0, 0, 0, 0.14));

  color: var(--muted);

  font-size: 0.8rem;
}

.app-menu .module-link:hover {
  border-color:
    rgba(var(--gold-bright-rgb), 0.38);

  color: var(--gold-light);

  background:
    rgba(var(--gold-rgb), 0.08);
}

.app-menu .module-link.active {
  border-color:
    rgba(var(--gold-bright-rgb), 0.58);

  color: var(--gold-light);

  background:
    linear-gradient(180deg,
      rgba(var(--gold-rgb), 0.18),
      rgba(var(--gold-dark-rgb), 0.10));

  box-shadow:
    0 8px 18px rgba(var(--gold-rgb), 0.18);
}


/* =========================================================
   LANGUAGE PICKER
   ========================================================= */

.language-picker {
  display: grid;
  gap: 0.28rem;
  min-width: 138px;
}

.language-picker span {
  color: var(--muted);

  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  line-height: 1.2;
  text-transform: uppercase;
}

.language-picker select {
  min-height: 42px;

  padding-top: 0.52rem;
  padding-bottom: 0.52rem;

  font-size: 0.82rem;
}


/* =========================================================
   BRAND
   ========================================================= */

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-home-button {
  display: flex;
  align-items: center;
  min-height: 0;
  padding: 0;

  border: 0;
  border-radius: 8px;

  background: transparent;
}

button.brand-home-button:not(:disabled):hover {
  transform: none;
}

.brand-home-button:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 4px;
}

.brand-logo {
  display: block;
  width: clamp(54px, 5.5vw, 78px);
  max-height: 78px;
  height: auto;

  object-fit: contain;

  filter:
    drop-shadow(0 10px 18px rgba(30, 120, 255, 0.24));
}
