/* V7 adapts the existing shell; V5 alone owns menu state and transforms. */
:root {
  --header-height: 72px;
  --v7-header-top: 12px;
  --v7-header-width: min(1180px, calc(100% - 48px));
  --v7-header-bottom: calc(var(--header-height) + var(--v7-header-top));
  --v7-chrome-edge: color-mix(in srgb, var(--line) 78%, transparent);
  --v7-chrome-shadow: 0 2px 3px #17151e03, 0 12px 25px -18px #17151e26;
}

html { scroll-padding-top: calc(var(--v7-header-bottom) + 20px); }

.site-header {
  width: var(--v7-header-width);
  height: 72px;
  margin: var(--v7-header-top) auto 0;
  padding: 12px 24px;
  top: var(--v7-header-top);
  gap: 24px;
  border: 1px solid var(--v7-chrome-edge);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 97%, transparent);
  backdrop-filter: none;
  box-shadow: var(--v7-chrome-shadow);
}

.site-header .brand { min-width: 180px; gap: 13px; }
.site-header .brand > img { width: 32px; height: 36px; }
.site-header .brand-room { font-size: 20px; padding-left: 13px; }
.site-header .brand-room > span { font-size: 10px; margin-top: 1px; }
.site-header .desktop-nav { gap: clamp(18px, 2.2vw, 30px); }
.site-header .desktop-nav > :is(a, button) { font-size: 12px; font-weight: 400; }
.site-header .header-actions { gap: 10px; }
.site-header .header-cta {
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 11px;
  gap: 16px;
  white-space: nowrap;
}
.site-header .menu-toggle { width: 44px; height: 44px; border-radius: 10px; }

/* The viewport begins at the topbar edge, so a sliding panel cannot cross the logo. */
.site-header .nav-viewport {
  top: 100%;
  left: -1px;
  right: -1px;
  padding: 0 0 22px;
  max-height: calc(100dvh - var(--v7-header-bottom) - 12px);
  overflow: hidden;
  pointer-events: none;
}
.site-header .nav-viewport.has-open-panel { pointer-events: auto; }
.site-header .nav-viewport .nav-panel {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  padding: 20px 24px 22px;
  max-height: calc(100dvh - var(--v7-header-bottom) - 34px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--v7-chrome-edge);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: var(--panel);
  backdrop-filter: none;
  box-shadow: 0 20px 28px -22px #17151e55;
  opacity: 1;
}
.site-header:has(.nav-panel:not([hidden])) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.site-header .mega-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 18px; }
.site-header .mega-grid > a { min-height: 70px; padding: 13px 10px; gap: 12px; border-radius: 8px; }
.site-header .mega-grid > a > span { font-size: 15px; line-height: 1.45; }
.site-header .mega-grid em { font-size: 11px; line-height: 1.55; margin-top: 3px; }
.site-header .mega-grid small { font-size: 10px; }
.site-header .nav-panel-foot { margin-top: 14px; padding: 15px 10px 0; font-size: 11px; gap: 24px; }
.site-header .nav-studio-intro strong { font-size: 38px; line-height: 1.05; }
.site-header .studio-panel > nav a { min-height: 50px; font-size: 14px; }

#menu-dialog {
  top: var(--v7-header-bottom);
  width: var(--v7-header-width);
  max-width: var(--v7-header-width);
  margin-inline: auto;
  max-height: calc(100dvh - var(--v7-header-bottom) - 12px);
  border-color: var(--v7-chrome-edge);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  opacity: 1;
}
#menu-dialog::backdrop {
  background: linear-gradient(to bottom, transparent 0 var(--v7-header-bottom), #17151e24 var(--v7-header-bottom) 100%);
  backdrop-filter: none;
}
.mobile-menu-sheet {
  padding: 22px 24px;
  max-height: calc(100dvh - var(--v7-header-bottom) - 14px);
  overscroll-behavior: contain;
}
body:has(#menu-dialog[open]) .site-header { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

/* Nine direction links stay in one shallow, readable directory. */
.site-footer.compact-footer {
  padding: 30px var(--v7-gutter, 48px) 18px;
  background: transparent;
  border-top: 1px solid var(--v7-chrome-edge);
}
.compact-footer .footer-top,
.compact-footer .footer-bottom { max-width: var(--v7-content, 1440px); margin-inline: auto; }
.compact-footer .footer-top { grid-template-columns: minmax(190px, 1fr) minmax(0, 2fr); gap: 44px; }
.compact-footer .footer-brand { gap: 16px; align-items: center; min-height: 48px; }
.compact-footer .footer-brand .footer-logo { width: 32px; height: 36px; }
.compact-footer .footer-brand > span { font-size: 15px; font-weight: 400; line-height: 1.3; letter-spacing: -.035em; }
.compact-footer .footer-top > nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
.compact-footer .footer-top > nav > a { min-height: 36px; font-size: 11px; line-height: 1.4; border-radius: 4px; }
.compact-footer .footer-bottom { margin-top: 22px; padding-top: 12px; min-height: 44px; font-size: 10px; gap: 16px; }
.compact-footer .footer-bottom > span { font-size: 10px; }
.compact-footer .footer-bottom nav { gap: 2px 20px; }
.compact-footer .footer-bottom :is(a, button) { font-size: 10px; min-height: 36px; border-radius: 4px; }

/* Wide margins receive native, static material planes. Narrow layouts pay no cost. */
.atmosphere,
.atmosphere-plane::before,
.atmosphere-plane::after { display: none; }

@media (min-width: 1601px) {
  .atmosphere {
    display: block;
    position: fixed;
    inset: 0;
    height: auto;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    --v7-margin-space: calc((100vw - 1440px) / 2);
    --v7-margin-object: clamp(44px, calc(var(--v7-margin-space) * .62), 156px);
  }
  .atmosphere .atmosphere-plane { inset: 0; background: none !important; opacity: 1 !important; }
  .atmosphere-plane::before,
  .atmosphere-plane::after {
    display: block;
    content: "";
    position: absolute;
    pointer-events: none;
    width: var(--v7-margin-object);
    animation: none;
    transition: none;
    border: 1px solid color-mix(in srgb, var(--line) 56%, transparent);
    background: linear-gradient(140deg, color-mix(in srgb, var(--panel) 50%, transparent), color-mix(in srgb, var(--soft) 28%, transparent));
    box-shadow: 0 2px 4px #17151e03, 8px 18px 24px -16px #17151e18;
  }
  .atmosphere-plane::before {
    left: calc((var(--v7-margin-space) - var(--v7-margin-object)) / 2);
    right: auto;
    top: 32vh;
    bottom: auto;
    height: calc(var(--v7-margin-object) * 1.25);
    border-radius: 8px;
    rotate: -13deg;
  }
  .atmosphere-plane::after {
    right: calc((var(--v7-margin-space) - var(--v7-margin-object)) / 2);
    left: auto;
    top: 65vh;
    bottom: auto;
    height: calc(var(--v7-margin-object) * .78);
    border-radius: 8px;
    rotate: 16deg;
    background: linear-gradient(145deg, color-mix(in srgb, var(--panel) 66%, transparent) 0 47%, color-mix(in srgb, var(--soft) 35%, transparent) 48% 100%);
    transform: skewY(-6deg) !important;
  }
}

@media (max-width: 1100px) {
  :root { --v7-header-width: calc(100% - 24px); }
  .site-header { padding-inline: 20px; }
}

@media (max-width: 760px) {
  .compact-footer .footer-top { grid-template-columns: 1fr; gap: 18px; }
  .compact-footer .footer-bottom { align-items: flex-start; }
  .compact-footer .footer-bottom nav { gap: 2px 16px; }
}

@media (max-width: 600px) {
  :root { --header-height: 68px; }
  .site-header { height: 68px; padding: 11px 14px; gap: 12px; border-radius: 12px; }
  .site-header .brand { min-width: 0; gap: 10px; }
  .site-header .brand > img { width: 28px; height: 32px; }
  .site-header .brand-room { font-size: 18px; padding-left: 10px; }
  .site-header .brand-room > span { font-size: 10px; }
  .site-header .header-actions { gap: 8px; }
  #menu-dialog { border-radius: 0 0 12px 12px; }
  .mobile-menu-sheet { padding: 20px 18px; }
  .mobile-menu-sheet .menu-list > a { min-height: 53px; font-size: 17px; }
  .site-footer.compact-footer { padding: 26px 20px 16px; }
  .compact-footer .footer-top > nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
  .compact-footer .footer-top > nav > a { min-height: 40px; font-size: 11px; }
  .compact-footer .footer-bottom { display: block; margin-top: 18px; }
  .compact-footer .footer-bottom > span { display: block; margin-bottom: 6px; font-size: 10px; }
  .compact-footer .footer-bottom nav { gap: 0 16px; }
  .compact-footer .footer-bottom :is(a, button) { min-height: 40px; font-size: 10px; }
}

html[data-theme=dark] { --v7-chrome-shadow: 0 2px 4px #00000008, 0 12px 25px -18px #00000060; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .atmosphere-plane::before,
  .atmosphere-plane::after { animation: none; transition: none; }
}

@media print { .site-header, .site-footer, .atmosphere { display: none; } }
