/* Layout system: section directory, footer navigation, focus states, team cards.
   Only layout and spacing change here; no existing copy is altered. */

:root {
  --ls-space-1: 4px;
  --ls-space-2: 8px;
  --ls-space-3: 12px;
  --ls-space-4: 16px;
  --ls-space-5: 24px;
  --ls-space-6: 32px;
  --ls-space-7: 48px;
  --ls-space-8: 72px;
  --ls-radius-card: 20px;
  --ls-shadow-1: 0 10px 28px rgba(4, 10, 16, .18);
  --ls-shadow-2: 0 24px 56px rgba(4, 10, 16, .28);
  --ls-line: rgba(142, 190, 210, .16);
}

/* ---------- vertical rhythm ---------- */
@media (min-width: 901px) {
  .section,
  .v2-section {
    padding-top: 104px;
    padding-bottom: 104px;
  }
}

@media (max-width: 900px) {
  .section,
  .v2-section {
    padding-top: 64px;
    padding-bottom: 64px;
  }
}

.section-head,
.v2-head {
  margin-bottom: var(--ls-space-6);
}

.aqw-library-list {
  gap: var(--ls-space-5);
}

/* ---------- keyboard focus ---------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- in-chapter bar ---------- */
.aqw-chapterbar {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 90;
  border-bottom: 1px solid var(--ls-line);
  background: rgba(5, 14, 21, .94);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .26);
}

.aqw-chapterbar[hidden] {
  display: none !important;
}

.aqw-chapterbar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
  height: 46px;
}

.aqw-chapterbar-title {
  flex: 0 0 auto;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cyan);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .02em;
}

.aqw-chapterbar-links {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.aqw-chapterbar-links::-webkit-scrollbar {
  display: none;
}

.aqw-chapterbar-links a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--ls-line);
  border-radius: 999px;
  color: #b8ccd4;
  font-size: 13px;
  white-space: nowrap;
  transition: color .18s, background .18s, border-color .18s;
}

.aqw-chapterbar-links a:hover {
  color: #fff;
  border-color: rgba(73, 226, 205, .5);
  background: rgba(73, 226, 205, .1);
}

.aqw-chapterbar-links a.is-current {
  color: #04121a;
  background: var(--cyan);
  border-color: var(--cyan);
  font-weight: 700;
}

/* Inside a chapter the fixed bar also has to be cleared by anchor jumps. */
.aqw-library-content > section[id] {
  scroll-margin-top: calc(var(--aqw-header-h, 73px) + 58px);
}

@media (max-width: 720px) {
  .aqw-chapterbar-inner {
    height: 40px;
    padding: 0 12px;
    gap: 10px;
  }

  .aqw-chapterbar-title {
    max-width: 36vw;
    font-size: 11.5px;
  }

  .aqw-chapterbar-links a {
    height: 28px;
    padding: 0 10px;
    font-size: 12.5px;
  }

  .aqw-library-content > section[id] {
    scroll-margin-top: calc(var(--aqw-header-h, 66px) + 52px);
  }
}

/* ---------- mobile compaction ----------
   These three blocks are the longest above the library. Most of their height on a
   phone is placeholder padding: min-heights that exist only to equalise desktop
   card rows, and desktop-scale section padding. Collapse both, keep all content. */
@media (max-width: 720px) {
  .app-connect {
    padding-top: 44px;
    padding-bottom: 34px;
  }

  .app-connect .connect-main {
    min-height: 0;
    gap: 22px;
  }

  .app-connect .connect-copy {
    padding-block: 0;
  }

  .app-connect .connect-app-label {
    margin-bottom: 15px;
  }

  .app-connect .connect-preview-picker {
    margin-bottom: 20px;
  }

  .app-connect .connect-platforms {
    margin-bottom: 10px;
  }

  .app-connect .connect-download,
  .app-connect .connect-qr-button {
    min-height: 50px;
  }

  .aqw-story {
    padding-top: 54px;
    padding-bottom: 44px;
  }

  .aqw-story .aqw-story-lead {
    gap: 20px;
  }

  .aqw-story .aqw-story-start {
    padding: 18px 20px 16px;
  }

  .aqw-story .aqw-story-grid > a {
    min-height: 0;
    padding: 17px 18px 14px;
  }

  .aqw-story .aqw-story-actions {
    margin-top: 18px;
  }

  .aqw-paths {
    padding-top: 54px;
    padding-bottom: 44px;
  }

  .aqw-paths .aqw-paths-header {
    margin-bottom: 18px;
  }

  .aqw-paths .aqw-paths-status {
    margin-bottom: 14px;
  }

  .aqw-paths .aqw-paths-grid {
    gap: 10px;
  }

  .aqw-paths .aqw-path-card {
    padding: 18px 16px 14px;
  }

  .aqw-paths .aqw-path-card-top {
    margin-bottom: 16px;
  }

  .aqw-paths .aqw-path-card h3,
  .aqw-paths .aqw-path-card p {
    min-height: 0;
  }

  .aqw-paths .aqw-path-card p {
    margin-bottom: 14px;
  }

  /* Four stacked cards made this the longest block on a phone. Keep every card,
     present them as a swipeable row so the section fits roughly one screen. */
  .aqw-paths .aqw-paths-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .aqw-paths .aqw-paths-grid::-webkit-scrollbar {
    display: none;
  }

  .aqw-paths .aqw-path-card {
    flex: 0 0 82%;
    scroll-snap-align: start;
  }
}

/* ---------- footer directory ---------- */
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 0;
}

.footer-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--ls-space-3);
  color: var(--muted);
  transition: color .18s;
}

.footer-nav a + a::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: 1px;
  height: 14px;
  transform: translateY(-50%);
  background: var(--ls-line);
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--text);
}

@media (max-width: 720px) {
  .footer-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 var(--ls-space-4);
  }

  .footer-nav a {
    padding: 0;
  }

  .footer-nav a + a::before {
    display: none;
  }
}

/* ---------- section directory (drawer) ---------- */
.aqw-toc-trigger {
  position: fixed;
  z-index: 96;
  inset-inline-start: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 16px 0 13px;
  border: 1px solid rgba(73, 226, 205, .34);
  border-radius: 999px;
  background: rgba(7, 19, 28, .92);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  backdrop-filter: blur(10px);
  box-shadow: var(--ls-shadow-1);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}

.aqw-toc-trigger:hover {
  border-color: rgba(73, 226, 205, .7);
  background: rgba(12, 32, 44, .96);
  transform: translateY(-2px);
}

.aqw-toc-icon {
  display: grid;
  gap: 3px;
  width: 15px;
}

.aqw-toc-icon i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--cyan);
}

.aqw-toc-icon i:nth-child(2) {
  width: 72%;
}

.aqw-toc-icon i:nth-child(3) {
  width: 46%;
}

.aqw-toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 94;
  background: rgba(2, 7, 11, .62);
  backdrop-filter: blur(3px);
}

.aqw-toc {
  position: fixed;
  z-index: 95;
  inset-block: 0;
  inset-inline-end: 0;
  display: flex;
  flex-direction: column;
  width: min(400px, 92vw);
  border-inline-start: 1px solid var(--ls-line);
  background: linear-gradient(180deg, #07131c, #050e15);
  box-shadow: -24px 0 60px rgba(0, 0, 0, .45);
}

/* Author display rules beat the UA [hidden] rule; keep the drawer genuinely closed. */
.aqw-toc[hidden],
.aqw-toc-backdrop[hidden] {
  display: none !important;
}

.aqw-toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ls-space-4);
  padding: 18px 20px;
  border-bottom: 1px solid var(--ls-line);
}

.aqw-toc-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: .01em;
}

.aqw-toc-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--ls-line);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.aqw-toc-close:hover {
  color: var(--text);
  border-color: rgba(73, 226, 205, .5);
}

.aqw-toc-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--ls-space-4) var(--ls-space-4) var(--ls-space-6);
  overscroll-behavior: contain;
}

.aqw-toc-group + .aqw-toc-group {
  margin-top: var(--ls-space-5);
  padding-top: var(--ls-space-5);
  border-top: 1px solid var(--ls-line);
}

.aqw-toc-group-title {
  margin: 0 0 var(--ls-space-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--cyan);
}

.aqw-toc-list {
  display: grid;
  gap: 2px;
}

.aqw-toc-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  color: #cfe0e6;
  font-size: 14px;
  line-height: 1.45;
}

.aqw-toc-list a:hover {
  background: rgba(73, 226, 205, .1);
  color: #fff;
}

.aqw-toc-list a.is-current {
  background: rgba(73, 226, 205, .16);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--cyan);
}

.aqw-toc-chapter {
  border-radius: 12px;
}

.aqw-toc-chapter + .aqw-toc-chapter {
  margin-top: 2px;
}

.aqw-toc-chapter > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 10px;
  color: #e8f2f5;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.aqw-toc-chapter > summary::-webkit-details-marker {
  display: none;
}

.aqw-toc-chapter > summary::after {
  content: "+";
  font-weight: 400;
  color: var(--muted);
}

.aqw-toc-chapter[open] > summary::after {
  content: "\2212";
}

.aqw-toc-chapter > summary:hover {
  background: rgba(73, 226, 205, .08);
}

.aqw-toc-chapter .aqw-toc-list {
  padding-inline-start: var(--ls-space-3);
  margin-bottom: 4px;
}

.aqw-toc-chapter .aqw-toc-list a {
  color: #a9c1ca;
  font-size: 13.5px;
}

.aqw-toc-foot {
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ls-line);
}

.aqw-toc-top {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--ls-line);
  border-radius: 12px;
  background: rgba(73, 226, 205, .08);
  color: #d7e9ee;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.aqw-toc-top:hover {
  background: rgba(73, 226, 205, .16);
  color: #fff;
}

body.aqw-toc-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .aqw-toc-trigger {
    inset-inline-start: 12px;
    bottom: 82px;
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  /* Icon-only on phones: a full-width label would sit on top of body text. */
  .aqw-toc-trigger-label {
    display: none;
  }

  .aqw-toc {
    width: 100%;
    border-inline-start: 0;
  }
}

/* The mobile action bar owns the bottom edge; keep the trigger clear of it. */
@media (max-width: 720px) and (hover: none) {
  .aqw-toc-trigger {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

/* ---------- team ---------- */
.aqw-team .team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ls-space-5);
  align-items: stretch;
}

.aqw-team .team-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ls-line);
  border-radius: var(--ls-radius-card);
  background: linear-gradient(160deg, #0a1b25, #06131c 70%);
  box-shadow: var(--ls-shadow-1);
  overflow: hidden;
  transition: transform .24s, box-shadow .24s, border-color .24s;
}

.aqw-team .team-card:hover {
  transform: translateY(-4px);
  border-color: rgba(73, 226, 205, .34);
  box-shadow: var(--ls-shadow-2);
}

.aqw-team .team-portrait {
  position: relative;
  aspect-ratio: 3 / 4;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(73, 226, 205, .18), transparent 60%),
    linear-gradient(150deg, #0d2531, #071621);
  overflow: hidden;
}

.aqw-team .team-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.aqw-team .team-monogram {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(48px, 8vw, 76px);
  font-weight: 900;
  letter-spacing: -.04em;
  color: rgba(245, 249, 251, .82);
  text-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}

/* The monogram is a placeholder painted over the media area. Never hide the <img>
   itself: a display:none lazy image never loads, so the load event that reveals the
   photograph would never fire. */
.aqw-team .team-card.has-photo .team-monogram {
  display: none;
}

.aqw-team .team-event[hidden],
.aqw-team .team-jump[hidden] {
  display: none;
}

.aqw-team .team-body {
  display: flex;
  flex-direction: column;
  gap: var(--ls-space-3);
  padding: var(--ls-space-5);
}

.aqw-team .team-name {
  margin: 0;
  font-size: clamp(21px, 2vw, 26px);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.aqw-team .team-role {
  margin: 0;
  color: var(--cyan);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
}

.aqw-team .team-creds {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--ls-line);
  padding-top: var(--ls-space-3);
}

.aqw-team .team-creds li {
  position: relative;
  padding-inline-start: 16px;
  color: #b9ccd4;
  font-size: 14px;
  line-height: 1.55;
}

.aqw-team .team-creds li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: .62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.aqw-team .team-jump {
  align-self: flex-start;
  margin-top: var(--ls-space-1);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(73, 226, 205, .34);
  border-radius: 999px;
  color: #d9eef1;
  font-size: 13px;
  font-weight: 700;
}

.aqw-team .team-jump:hover {
  background: rgba(73, 226, 205, .14);
  color: #fff;
}

.aqw-team .team-event {
  margin-top: var(--ls-space-6);
  padding-top: var(--ls-space-5);
  border-top: 1px solid var(--ls-line);
}

.aqw-team .team-event-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--ls-space-2) var(--ls-space-4);
  margin-bottom: var(--ls-space-4);
}

.aqw-team .team-event-head h3 {
  margin: 0;
  font-size: clamp(18px, 1.8vw, 22px);
}

.aqw-team .team-event-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.aqw-team .team-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--ls-space-3);
}

.aqw-team .team-gallery figure {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--ls-line);
  background: #06121a;
}

.aqw-team .team-gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.aqw-team .team-gallery figcaption {
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

@media (min-width: 1025px) {
  .aqw-team .team-card {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    align-items: stretch;
  }

  .aqw-team .team-portrait {
    aspect-ratio: auto;
    height: 100%;
    min-height: 300px;
  }
}

@media (max-width: 1024px) {
  .aqw-team .team-grid {
    grid-template-columns: 1fr;
  }

  .aqw-team .team-portrait {
    aspect-ratio: 16 / 10;
  }
}

.aqw-team .team-groups {
  display: grid;
  gap: var(--ls-space-5);
}

.aqw-team .team-event-group {
  min-width: 0;
}

.aqw-team .team-event-label {
  margin: 0 0 var(--ls-space-3);
  color: var(--cyan);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.aqw-team .team-gallery-portrait {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.aqw-team .team-gallery-portrait img {
  aspect-ratio: 4 / 3;
}

.aqw-team .team-gallery-wide {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.aqw-team .team-gallery-wide img {
  aspect-ratio: 16 / 9;
}

@media (max-width: 720px) {
  .aqw-team .team-gallery {
    display: flex;
    gap: var(--ls-space-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
  }

  .aqw-team .team-gallery figure {
    flex: 0 0 78%;
    scroll-snap-align: start;
  }

  .aqw-team .team-gallery-portrait figure {
    flex-basis: 78%;
  }
}
