/* =========================================================
 * ARCHEHIGH Template Layout
 * Page rhythm, containers, and reusable layout primitives.
 * ========================================================= */

body {
  background: var(--ah-gray-100);
}

.ah-site-shell,
.ah-site-shell * {
  box-sizing: border-box;
}

.ah-site-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
  background: var(--ah-gray-100);
}

.ah-mobile-header,
.ah-sidebar-backdrop {
  display: none;
}

.ah-site-sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  height: calc(100vh - 36px);
  min-width: 0;
}

.ah-sidebar-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 30px 20px 22px;
  border: 1px solid var(--ah-line);
  border-radius: var(--ah-radius-lg);
  background: var(--ah-white);
}

.ah-sidebar-brand {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--ah-black);
  text-align: center;
  text-decoration: none;
}

.ah-sidebar-brand img {
  width: 58px;
  height: auto;
}

.ah-sidebar-brand strong {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1.25;
}

.ah-sidebar-nav {
  display: grid;
  flex: 1 1 auto;
  gap: 10px;
  align-content: start;
  min-height: 0;
  margin-top: 28px;
  overflow-y: auto;
  padding-right: 4px;
  padding-top: 28px;
  border-top: 1px solid var(--ah-line);
  scrollbar-width: thin;
}

.ah-sidebar-nav a {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "icon label";
  gap: 3px 14px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border-radius: var(--ah-radius-md);
  color: var(--ah-black);
  text-decoration: none;
  transition:
    background 0.22s var(--ah-ease),
    color 0.22s var(--ah-ease);
}

.ah-sidebar-nav a:hover,
.ah-sidebar-nav a:focus,
.ah-sidebar-nav a.is-active {
  background: var(--ah-black);
  color: var(--ah-white);
}

.ah-sidebar-nav .material-symbols-outlined {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ah-line);
  border-radius: var(--ah-radius-sm);
  background: var(--ah-gray-100);
  font-size: 23px;
  transition:
    background 0.22s var(--ah-ease),
    border-color 0.22s var(--ah-ease),
    color 0.22s var(--ah-ease);
}

.ah-sidebar-nav a:hover .material-symbols-outlined,
.ah-sidebar-nav a:focus .material-symbols-outlined,
.ah-sidebar-nav a.is-active .material-symbols-outlined {
  border-color: var(--ah-orange);
  background: var(--ah-orange);
  color: var(--ah-black);
}

.ah-sidebar-nav strong {
  grid-area: title;
  min-width: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1.18;
}

.ah-sidebar-nav small {
  grid-area: label;
  color: var(--ah-gray-500);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-transform: uppercase;
  transition: color 0.22s var(--ah-ease);
}

.ah-sidebar-nav a:hover small,
.ah-sidebar-nav a:focus small,
.ah-sidebar-nav a.is-active small {
  color: rgba(255, 255, 255, 0.68);
}

.ah-sidebar-foot {
  flex: 0 0 auto;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--ah-line);
}

.ah-sidebar-foot span,
.ah-sidebar-foot strong {
  display: block;
}

.ah-sidebar-foot span {
  color: var(--ah-gray-500);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ah-sidebar-foot strong {
  margin-top: 6px;
  color: var(--ah-black);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.ah-site-content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.ah-site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  min-height: 56px;
  padding: 14px 22px;
  background: var(--ah-black);
  color: var(--ah-white);
}

.ah-quickbar {
  position: sticky;
  z-index: 40;
  top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid var(--ah-line);
  border-radius: var(--ah-radius-lg);
  background: rgba(255, 255, 255, 0.32);
  color: var(--ah-black);
  backdrop-filter: blur(7px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
}

.ah-quickbar strong,
.ah-site-footer strong,
.ah-site-footer span {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ah-quickbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.ah-quickbar a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--ah-black);
  border-radius: var(--ah-radius-full);
  background: var(--ah-white);
  color: var(--ah-black);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.ah-quickbar a:hover,
.ah-quickbar a:focus,
.ah-quickbar a.is-active {
  background: var(--ah-black);
  color: var(--ah-white);
}

.ah-quickbar a .material-symbols-outlined {
  font-size: 16px;
}

.ah-site-footer {
  min-height: 64px;
}

.ah-scroll-top,
.ah-scroll-top:hover,
.ah-scroll-top:focus,
.ah-scroll-top:active {
  appearance: none;
  -webkit-appearance: none;
  position: fixed;
  z-index: 58;
  right: 30px;
  bottom: 30px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  flex: 0 0 52px;
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #111111;
  color: var(--ah-white);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.18);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  overflow: hidden;
  outline-offset: 4px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
}

.ah-scroll-top {
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.22s var(--ah-ease),
    background 0.22s var(--ah-ease),
    color 0.22s var(--ah-ease),
    box-shadow 0.22s var(--ah-ease);
}

.ah-scroll-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ah-scroll-top:hover,
.ah-scroll-top:focus,
.ah-scroll-top:active,
.ah-scroll-top.is-visible:hover,
.ah-scroll-top.is-visible:focus,
.ah-scroll-top.is-visible:active {
  opacity: 1;
}

.ah-scroll-top svg {
  display: block;
  width: 22px;
  height: 22px;
  overflow: visible;
}

.ah-scroll-top path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.nav-open .ah-scroll-top,
body.nav-closing .ah-scroll-top {
  opacity: 0;
  pointer-events: none;
}

.ah-section,
.ah-section * {
  box-sizing: border-box;
}

.ah-section {
  position: relative;
  width: 100%;
  padding: var(--ah-space-xl) 0;
  color: var(--ah-black);
  background: var(--ah-white);
  font-family: inherit;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.ah-full-bleed {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.ah-container {
  width: min(var(--ah-max), calc(100% - 40px));
  margin: 0 auto;
}

.ah-muted {
  color: var(--ah-gray-500);
}

.ah-line {
  width: 100%;
  height: 1px;
  background: var(--ah-line);
}

@media (max-width: 760px) {
  body.nav-open {
    overflow: hidden;
  }

  .ah-site-shell {
    gap: 12px;
    padding: 76px 12px 104px;
  }

  .ah-mobile-header {
    position: fixed;
    z-index: 60;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 10px 14px;
    border: 1px solid var(--ah-line);
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .ah-mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--ah-black);
    text-decoration: none;
  }

  .ah-mobile-brand img {
    width: 30px;
    height: auto;
  }

  .ah-mobile-brand strong {
    min-width: 0;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.1;
  }

  .ah-mobile-menu-toggle {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--ah-line);
    border-radius: var(--ah-radius-sm);
    background: var(--ah-white);
    color: var(--ah-black);
    cursor: pointer;
  }

  .ah-mobile-menu-toggle .material-symbols-outlined {
    font-size: 24px;
  }

  .ah-sidebar-backdrop {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: block;
    background: rgba(5, 5, 5, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s var(--ah-ease);
  }

  body.nav-open .ah-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .ah-site-sidebar {
    position: fixed;
    z-index: 80;
    top: 12px;
    bottom: 12px;
    left: 12px;
    width: min(320px, 88%);
    min-height: 0;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.28s var(--ah-ease);
  }

  body.nav-open .ah-site-sidebar {
    transform: translateX(0);
  }

  .ah-sidebar-card {
    height: 100%;
    min-height: 0;
    overflow: auto;
    padding: 24px 20px 20px;
  }

  .ah-sidebar-nav {
    flex: 0 0 auto;
    grid-template-columns: 1fr;
    overflow: visible;
    padding-right: 0;
  }

  .ah-quickbar,
  .ah-site-footer {
    display: grid;
    justify-content: stretch;
  }

  .ah-quickbar {
    position: fixed;
    z-index: 55;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
    min-height: calc(72px + env(safe-area-inset-bottom));
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--ah-line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.94);
    color: var(--ah-black);
    box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .ah-quickbar > strong {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .ah-quickbar nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    justify-content: stretch;
  }

  .ah-quickbar a {
    display: grid;
    justify-items: center;
    gap: 4px;
    min-height: 48px;
    padding: 6px 4px;
    border: 0;
    border-radius: var(--ah-radius-sm);
    color: var(--ah-black);
    font-size: 10px;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
  }

  .ah-quickbar a:hover,
  .ah-quickbar a:focus,
  .ah-quickbar a.is-active {
    background: var(--ah-black);
    color: var(--ah-white);
  }

  .ah-quickbar a .material-symbols-outlined {
    font-size: 22px;
  }

  .ah-site-footer {
    margin-bottom: 0;
  }

  .ah-scroll-top {
    right: 18px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    flex-basis: 52px;
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    height: 52px;
    min-height: 52px;
    max-height: 52px;
  }

  .ah-section {
    padding: 56px 0;
  }

  .ah-container {
    width: calc(100% - 32px);
  }
}

@media (max-width: 1040px) {
  .ah-site-shell {
    grid-template-columns: 1fr;
  }

  .ah-site-sidebar {
    position: static;
    height: auto;
    min-height: auto;
  }

  .ah-sidebar-card {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .ah-sidebar-brand {
    justify-items: start;
    grid-template-columns: 42px minmax(0, 1fr);
    text-align: left;
  }

  .ah-sidebar-brand img {
    width: 42px;
  }

  .ah-sidebar-nav {
    flex: 0 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 760px) {
  .ah-site-sidebar {
    position: fixed;
    min-height: 0;
  }

  .ah-sidebar-nav {
    grid-template-columns: 1fr;
  }
}
