/* ============================================================================
   Layout
   ============================================================================ */

main.container {
  margin-bottom: 2rem;
  padding: 2.5rem var(--space-container);
}

/* Fixed navbar sits on top, the sidebar version shifts the body */
body {
  padding-top: var(--navbar-height);
}

/* Skip link, hidden until focused */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1001;
  background: var(--clr-surface);
  color: var(--clr-accent);
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

/* Navbar: top bar up to 960px (responsive.css), sidebar above */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--clr-header);
  color: var(--clr-header-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.navbar-inner {
  width: 100%;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  min-height: var(--navbar-height);
}

.navbar-brand {
  min-width: 0;
  flex-shrink: 1;
}
.navbar-brand a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--clr-header-text);
  text-decoration: none;
  min-width: 0;
}
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--clr-surface);
  padding: 0.1875rem;
}
.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}
.logo-name {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--clr-header-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
  justify-content: flex-end;
}

.nav-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Log out is a POST button styled as a link */
.navbar-menu a,
.navbar-menu .nav-button {
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-md);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition);
}

.navbar-menu .nav-button {
  width: 100%;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.navbar-menu a:hover,
.navbar-menu .nav-button:hover {
  color: var(--clr-header-text);
}

.navbar-menu a[aria-current="page"] {
  color: var(--clr-header-text);
  font-weight: 600;
}

/* Cap long names. .logo-name gets the same. */
.navbar-menu .nav-user {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  line-height: 1.4;
}

/* Hamburger, hidden on desktop */
.navbar-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 0.3125rem;
  margin-left: auto;
  width: var(--height-control);
  height: var(--height-control);
  padding: 0.375rem;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.navbar-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.85);
  transition:
    transform var(--transition),
    opacity var(--transition);
}

.navbar-hamburger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.navbar-hamburger.is-open span:nth-child(2) {
  opacity: 0;
}
.navbar-hamburger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Desktop: left sidebar, and the body shifts over by its width */
@media (min-width: 961px) {
  body {
    padding-top: 0;
    padding-left: var(--sidebar-width);
  }

  .navbar {
    right: auto;
    bottom: 0;
    width: var(--sidebar-width);
    overflow-y: auto;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.25);
  }

  .navbar-inner {
    flex-direction: column;
    align-items: stretch;
    min-height: 100%;
    padding: 1.25rem 1rem;
    gap: 1.75rem;
  }

  .navbar-menu {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
  }

  .nav-section {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }

  /* Account links sit at the foot of the sidebar */
  .nav-section-account {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .navbar-menu a,
  .navbar-menu .nav-button {
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius);
    line-height: 1.4;
  }

  .navbar-menu a:hover,
  .navbar-menu .nav-button:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .navbar-menu a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.14);
  }

  /* The display name may take the column's width, ellipsized */
  .navbar-menu .nav-user {
    max-width: none;
  }
}

/* Page Header: the h1 with the page's actions at the far end */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: var(--text-3xl);
}

/* A line under the title (the dashboard greeting) */
.page-header h1 + p {
  margin-top: 0.25rem;
}

/* A sentence or two under the page header, before the content */
.page-lead {
  max-width: 75ch;
  margin: 0 0 1.25rem;
}

/* Less room below when a strip of tiles follows (the admin pages) */
.page-header--tight {
  margin-bottom: 1rem;
}

.page-header-actions {
  display: flex;
  gap: 0.5rem;
}

/* A section heading with room for controls at the far end */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Section headings. h2 is bigger than h3, both micro-caps. */
.form-section > h2,
.profile-section > h2,
.detail-section > h2,
.card-heading-row > h2,
.section-header > h2 {
  font-size: var(--text-md);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-text);
}

/* Profile and event-detail cards underline their headings too */
.profile-section > h2,
.detail-section > h2 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--clr-border);
}

/* Card heading with a chip, the row carries the underline */
.card-heading-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--clr-border);
}

@media (max-width: 480px) {
  .navbar-inner {
    padding: 0 1rem;
  }
  .logo-name {
    font-size: var(--text-md);
    letter-spacing: 0;
  }
}
