/* ==========================================================================
   layout.css — structural app shell + header/footer behavior
   Owns shell layout, sticky regions, and structural header/footer motion.
   ========================================================================== */

/* ==========================================================================
   App shell
   ========================================================================== */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-body {
  background: var(--bg);
}

.app-main {
  flex: 1;
  padding-top: var(--space-6);
  padding-bottom: calc(var(--footer-h) + var(--space-7) + 88px);
}

/* ==========================================================================
   Header
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  min-height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.header-inner {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px var(--space-4);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
}

.header-brandBlock {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
  justify-self: end;
}

.header-statusText {
  font-size: var(--text-sm);
  white-space: nowrap;
}

.header-statusDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(31, 42, 46, 0.22);
  box-shadow: 0 0 0 4px rgba(31, 42, 46, 0.06);
  flex: 0 0 auto;
}

.header-statusDot.is-loading {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
}

.app-header .brandLink {
  transform-origin: left center;
}

.app-header .brand,
.app-header .brand-sub,
.app-header .brandMark,
.app-header .brandBadge,
.app-header .brandLogo,
.app-header .header-statusText,
.app-header .header-statusDot,
.app-header .header-inner,
.app-header .brandLink {
  transition:
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease,
    gap 220ms ease,
    padding 220ms ease,
    width 260ms cubic-bezier(0.22, 1, 0.36, 1),
    height 260ms cubic-bezier(0.22, 1, 0.36, 1),
    font-size 260ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease;
}

.app-header.is-condensed {
  box-shadow: var(--shadow-1);
}

.app-header.is-condensed .header-inner {
  padding-top: 9px;
  padding-bottom: 9px;
}

.app-header.is-condensed .brandLink {
  gap: 10px;
}

.app-header.is-condensed .brand {
  font-size: 21px;
}

.app-header.is-condensed .brand-sub {
  opacity: 0.75;
  transform: translateY(-1px);
}

.app-header.is-condensed .brandMark {
  width: 30px;
  height: 30px;
  transform: rotate(-5deg) scale(0.94);
}

.app-header.is-condensed .brandBadge {
  height: 20px;
  padding: 0 7px;
  font-size: 10px;
}

.app-header.is-condensed .header-statusText {
  font-size: 12px;
}

.app-header.is-condensed .header-statusDot {
  transform: scale(0.92);
}

/* ==========================================================================
   Utility layout helpers
   ========================================================================== */

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.space-between {
  justify-content: space-between;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  .header-inner {
    padding-top: 10px;
    padding-bottom: 10px;
    align-items: center;
    grid-template-columns: 1fr;
  }

  .header-brandBlock {
    justify-content: center;
  }

  .header-status {
    display: none;
  }

  .app-header.is-condensed .brand {
    font-size: 20px;
  }

  .app-main {
    padding-bottom: calc(var(--footer-h) + var(--space-7) + 88px);
  }
}