/**
 * @file
 * SM shell: page background, typography, top bar and layout.
 * Selectors are scoped to .sm-body / .sm-shell so the active theme's own
 * pages are untouched.
 */
html:has(body.sm-body),
body.sm-body {
  background: var(--sm-night);
}

body.sm-body {
  margin: 0;
  color: var(--sm-ink);
  font-family: var(--sm-font-body);
  font-size: var(--sm-text-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.sm-shell {
  min-height: 100vh;
  color: var(--sm-ink);
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgba(111, 220, 242, 0.08), transparent 70%),
    var(--sm-night);
}

.sm-shell *,
.sm-shell *::before,
.sm-shell *::after {
  box-sizing: border-box;
}

/* Type. */
.sm-shell h1,
.sm-shell h2,
.sm-shell h3 {
  margin: 0 0 var(--sm-space-3);
  font-family: var(--sm-font-display);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0.01em;
  color: var(--sm-ink);
}

.sm-shell h1 {
  font-size: var(--sm-text-3xl);
}

.sm-shell h2 {
  font-size: var(--sm-text-2xl);
  font-weight: 700;
}

.sm-shell h3 {
  font-size: var(--sm-text-xl);
  font-weight: 700;
}

.sm-shell p {
  margin: 0 0 var(--sm-space-4);
  max-width: 68ch;
}

.sm-shell a {
  color: var(--sm-cyan);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.sm-shell a:hover {
  color: var(--sm-ink);
}

.sm-shell :focus-visible {
  outline: none;
  box-shadow: var(--sm-focus);
  border-radius: 6px;
}

.sm-shell .visually-hidden {
  position: absolute !important;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  word-wrap: normal;
}

/* Top bar. */
.sm-topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  align-items: center;
  gap: var(--sm-space-5);
  padding: var(--sm-space-3) max(var(--sm-space-4), calc((100vw - var(--sm-content-width)) / 2));
  border-bottom: 1px solid var(--sm-line);
  background: rgba(8, 21, 48, 0.92);
  backdrop-filter: blur(10px);
}

.sm-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sm-space-2);
  color: var(--sm-ink) !important;
  text-decoration: none;
}

.sm-brand__mark {
  width: 30px;
  height: 30px;
  color: var(--sm-amber);
}

.sm-brand__name {
  font-family: var(--sm-font-display);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.sm-topbar__menu {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: var(--sm-space-4);
}

.sm-nav ul,
.sm-account ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sm-nav li,
.sm-account li {
  margin: 0;
  padding: 0;
}

.sm-nav a,
.sm-account a {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border-radius: var(--sm-radius-pill);
  color: var(--sm-mist);
  font-weight: 600;
  font-size: var(--sm-text-sm);
  text-decoration: none;
}

.sm-nav a:hover,
.sm-account a:hover {
  color: var(--sm-ink);
  background: var(--sm-navy-2);
}

.sm-nav a.is-active,
.sm-nav .menu-item--active-trail > a {
  color: var(--sm-ink-on-light);
  background: var(--sm-ink);
}

.sm-account .sm-account__name {
  color: var(--sm-ink);
}

.sm-topbar__toggle {
  display: none;
  margin-left: auto;
  padding: 0.6rem;
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-pill);
  background: transparent;
  color: var(--sm-ink);
  cursor: pointer;
}

.sm-topbar__toggle-bars,
.sm-topbar__toggle-bars::before,
.sm-topbar__toggle-bars::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.sm-topbar__toggle-bars::before {
  transform: translateY(-6px);
}

.sm-topbar__toggle-bars::after {
  transform: translateY(4px);
}

@media (max-width: 860px) {
  .sm-topbar {
    flex-wrap: wrap;
  }

  .sm-topbar__toggle {
    display: inline-flex;
  }

  .sm-topbar__menu {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: var(--sm-space-3);
  }

  .sm-topbar.is-open .sm-topbar__menu {
    display: flex;
  }

  .sm-nav ul {
    flex-direction: column;
  }
}

/* Main column. */
.sm-main {
  width: 100%;
  max-width: var(--sm-content-width);
  margin: 0 auto;
  padding: var(--sm-space-6) var(--sm-space-4) var(--sm-space-8);
}

.sm-main:focus {
  outline: none;
}

.sm-main > h1:first-of-type,
.sm-main h1.page-title,
.sm-main .page-title {
  margin-bottom: var(--sm-space-5);
}

/* Theme-provided tabs (user profile View / Edit). */
.sm-main nav.tabs ul,
.sm-main ul.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-2);
  margin: 0 0 var(--sm-space-5);
  padding: 0;
  list-style: none;
}

.sm-main ul.tabs li,
.sm-main nav.tabs li {
  margin: 0;
  list-style: none;
}

.sm-main ul.tabs a,
.sm-main nav.tabs a {
  display: inline-block;
  padding: 0.4rem 1rem;
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-pill);
  color: var(--sm-mist);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--sm-text-sm);
  background: transparent;
}

/* Undo theme tab decorations (Olivero underlines and pads its tabs). */
.sm-main .tabs__link::after,
.sm-main .tabs__link::before,
.sm-main .tabs__tab::before,
.sm-main .tabs__tab::after {
  display: none;
}

.sm-main .tabs__link {
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 0;
  line-height: 1.4;
}

.sm-main ul.tabs a.is-active,
.sm-main nav.tabs a.is-active {
  color: var(--sm-ink-on-light);
  background: var(--sm-ink);
  border-color: var(--sm-ink);
}

@media (prefers-reduced-motion: reduce) {
  .sm-shell *,
  .sm-shell *::before,
  .sm-shell *::after {
    transition: none !important;
    animation: none !important;
  }
}

/*
 * Themes wrap page regions in their own layout (Olivero puts a grid on
 * .region). Inside the SM shell the page is laid out by SM, so undo it.
 */
.sm-shell .region {
  display: block;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
}

.sm-shell .region > * {
  grid-column: auto;
}
