/* Shared top navigation: mouse hover, keyboard and touch disclosure. */
@media (min-width: 1251px) {
  .site-header .header-inner { gap: 24px; }
  .site-header .header-inner > .main-nav { position: static; transform: none; flex: 1; width: auto; min-width: 0; gap: 24px; }
  .site-header .header-inner > .auth-menu { margin-left: 0; flex: none; }
  .site-header .header-inner > .auth-menu + .header-notifications { margin-left: -16px; }
}
.mobile-menu-toggle { display: none; }
.mobile-navigation[hidden] { display: none; }
.site-settings-email { display: inline-block; margin-top: 6px; color: inherit; font-size: 13px; text-decoration: underline; overflow-wrap: anywhere; }
.site-ad { width: min(calc(100% - 32px), 1080px); min-height: 90px; margin: 28px auto; }
/* Six public links need a second row before they crowd the brand and account links. */
@media (max-width: 1250px) {
  html { scroll-padding-top: 132px; }
  .header-inner { min-height: 110px; flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; }
  .brand { order: 1; }
  .auth-menu { order: 2; margin-left: auto; }
  .main-nav { position: static; order: 3; width: 100%; transform: none; justify-content: center; gap: 12px; overflow-x: auto; border-top: 1px solid #e6edf7; }
}
.main-nav { overflow: visible; }
.main-nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: min(840px, calc(100% - 400px)); gap: 10px; align-items: center; }
.main-nav > a { display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0; min-height: 42px; text-align: center; }
@media (max-width: 1250px) { .main-nav { width: 100%; } }
.nav-item { position: relative; width: 100%; flex-shrink: 0; }
.main-nav .nav-item > a { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 42px; padding-inline: 8px; white-space: nowrap; text-align: center; }
.nav-toggle { position: absolute; top: 50%; right: 3px; display: grid; place-items: center; transform: translateY(-50%); width: 22px; height: 32px; border: 0; padding: 0; background: transparent; color: #526177; cursor: pointer; }
.nav-item:has(> a.is-active) > .nav-toggle { color: #fff; }
.nav-toggle:focus-visible { outline: 2px solid #78aef2; border-radius: 4px; }
.nav-dropdown { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 228px; max-height: min(440px, 65dvh); overflow-y: auto; padding: 8px; border: 1px solid #dce5f2; border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(26,64,114,.14); z-index: 40; }
.nav-dropdown[hidden] { display: none; }
.main-nav .nav-dropdown a { display: block; padding: 11px 12px; font-size: 13px; text-align: center; white-space: normal; color: #526177; border-radius: 6px; line-height: 1.5; }
.main-nav .nav-dropdown a:hover, .main-nav .nav-dropdown a:focus-visible { background: #eef5ff; color: #0b63d8; }
@media (max-width: 1050px) {
  .main-nav { overflow: visible; gap: 4px 10px; }
  .nav-item { position: static; display: grid; align-items: center; }
  .main-nav .nav-item > a { grid-area: 1 / 1; width: 100%; }
  .nav-toggle { position: static; grid-area: 1 / 1; justify-self: end; transform: none; width: 22px; height: 36px; }
  .nav-item:has(> a.is-active) > .nav-toggle { color: #526177; }
  .nav-dropdown { top: 100%; left: 50%; right: auto; width: min(320px, calc(100vw - 32px)); transform: translateX(-50%); max-height: 55dvh; }
}
@media (min-width: 641px) and (max-width: 800px) {
  .main-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .main-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .main-nav > a { display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0; min-height: 36px; padding-inline: 2px; text-align: center; }
  .nav-item { min-width: 0; width: 100%; }
  .main-nav .nav-item > a { min-width: 0; min-height: 36px; padding-inline: 2px; text-align: center; }
  .nav-toggle { width: 18px; height: 32px; }
  /* Sidebar categories scroll with the page on phones. */
  .guide-sidebar.persistent-sidebar, .standards-sidebar.persistent-sidebar,
  .category-panel.persistent-sidebar, .tool-sidebar.persistent-sidebar,
  .support-layout > .support-sidebar { position: static; top: auto; max-height: none; overflow: visible; overscroll-behavior: auto; }
  .support-layout { grid-template-columns: minmax(0, 1fr); }
  .support-layout > .support-sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dictionary-layout { grid-template-columns: minmax(0, 1fr); }
  .category-panel, .result-panel { min-width: 0; }
  .category-panel .category-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .category-panel .category-list button { min-width: 0; }
  .term-card { overflow-wrap: anywhere; }
}

@media (max-width: 800px) {
  html { scroll-padding-top: 76px; }
  /* 스크립트가 메뉴를 접이식 영역으로 옮기기 전부터 기존 메뉴를 숨깁니다. */
  .header-inner > .main-nav, .header-inner > .auth-menu { display: none; }
  .header-inner { min-height: 64px; flex-wrap: nowrap; padding-block: 0; gap: 12px; }
  .header-inner > .mobile-menu-toggle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; order: 2; margin-left: auto; width: 44px; height: 44px; flex: none; padding: 10px; border: 1px solid #dce5f2; border-radius: 8px; background: #fff; color: #102c50; cursor: pointer; }
  .mobile-menu-toggle span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 1px; }
  .mobile-menu-toggle:focus-visible { outline: 3px solid #0b63d8; outline-offset: 3px; }
  .has-mobile-menu .mobile-navigation { position: absolute; top: 100%; left: 0; right: 0; max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain; padding: 16px; border: 1px solid #dce5f2; border-radius: 0 0 12px 12px; background: #fff; box-shadow: 0 12px 28px #102c5026; }
  .mobile-navigation .auth-menu { width: 100%; margin: 0 0 12px; justify-content: flex-end; flex-wrap: wrap; }
  .site-header .mobile-navigation .profile-popover { left: auto; right: 0; }
  .mobile-navigation .main-nav { position: static; display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; transform: none; gap: 4px; padding-top: 12px; border-top: 1px solid #e6edf7; }
  .mobile-navigation .main-nav > a, .mobile-navigation .main-nav .nav-item > a { min-height: 44px; justify-content: flex-start; padding: 12px 52px 12px 12px; font-size: 15px; text-align: left; }
  .mobile-navigation .nav-item { position: relative; display: block; }
  .mobile-navigation .nav-toggle { position: absolute; top: 0; right: 0; width: 44px; height: 44px; transform: none; }
  .mobile-navigation .nav-toggle::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
  .mobile-navigation .nav-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
  .mobile-navigation .nav-dropdown { position: static; width: 100%; max-height: none; transform: none; border: 0; border-radius: 6px; box-shadow: none; background: #f5f8fd; }
  .mobile-navigation .main-nav .nav-dropdown a { min-height: 44px; text-align: left; }
}

/* Public headers share one row above the mobile breakpoint. */
@media (min-width: 801px) {
  html { scroll-padding-top: 90px; }
  .site-header .header-inner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: clamp(6px, 1.2vw, 20px); min-height: 76px; padding-block: 0; flex-wrap: nowrap; }
  .site-header .header-inner > .brand { order: 0; }
  .site-header .header-inner > .main-nav { order: 1; position: static; transform: none; width: 100%; min-width: 0; margin: 0; border: 0; padding: 0; gap: 4px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .site-header .header-inner > .auth-menu { order: 2; margin: 0; }
  .site-header .header-inner > .header-notifications { order: 3; margin: 0; }
  .site-header .header-inner > .auth-menu + .header-notifications { margin-left: 0; }
  .site-header .header-inner > .mobile-menu-toggle { display: none; }
  .site-header .main-nav > a, .site-header .main-nav .nav-item > a { padding-inline: 4px; font-size: clamp(12px, 1.1vw, 14px); }
}
@media (min-width: 801px) and (max-width: 1050px) {
  .site-header .brand { gap: 6px; font-size: 17px; }
  .site-header .brand-mark { width: 30px; height: 30px; }
  .site-header .brand small { font-size: 7px; }
}
@media (max-width: 800px) {
  .site-header .header-inner > .brand { order: 0; }
  .site-header .header-inner > .header-notifications { order: 3; margin-left: auto; }
  .site-header .header-inner > .mobile-menu-toggle { order: 4; margin-left: auto; }
  .site-header .header-inner:has(> .header-notifications[data-authenticated="true"]:not([hidden])) > .mobile-menu-toggle { margin-left: 0; }
}

/* Keep the previous document visible until the next page can be painted.
   Native navigation/history and all page-specific initialization stay intact. */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation: none; }
::view-transition-old(root) { display: none; }
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html { scrollbar-gutter: stable; }
@media (min-width: 801px) {
  .site-header .auth-menu { min-width: 144px; min-height: 40px; }
}
