/* Shared by Materials Home, Student and Teacher (including signed-in views).
   Keep geometry independent of language, active tab and account controls. */
html { scrollbar-gutter: stable; }
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }

:is(.yjh-header.is-materials-only, .portal-header) {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  grid-template-rows: 68px 36px;
  align-items: center;
  gap: 0 24px;
  width: min(calc(100% - 48px), 1160px);
  min-height: 116px;
  margin: 0 auto;
  padding: 12px 0 0;
  font-family: Arial, "Hiragino Sans", "Yu Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}
:is(.yjh-header.is-materials-only, .portal-header) :is(.yjh-brand, .portal-brand) {
  display: inline-flex;
  grid-area: 1 / 1;
  width: fit-content;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
:is(.yjh-header.is-materials-only, .portal-header) :is(.yjh-brand > span, .portal-brand-mark) {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #FFFFFF;
  background: #3D6FBE;
  border-radius: 12px;
  font: 800 26px/1 Arial, sans-serif;
}
:is(.yjh-header.is-materials-only, .portal-header) :is(.yjh-brand, .portal-brand) strong {
  display: block;
  color: #1F416F;
  font: 800 15px/20px Arial, sans-serif;
  letter-spacing: .15em;
}
:is(.yjh-header.is-materials-only, .portal-header) :is(.yjh-brand, .portal-brand) small {
  display: block;
  margin-top: 3px;
  color: #526174;
  font: 700 10px/14px Arial, sans-serif;
  letter-spacing: .1em;
}
:is(.yjh-header.is-materials-only, .portal-header) :is(.yjh-site-nav, .portal-navigation) {
  display: grid;
  grid-area: 1 / 2;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 4px;
  background: #E8EBEF;
  border: 1px solid #D7DEE8;
  border-radius: 13px;
}
:is(.yjh-header.is-materials-only, .portal-header) nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 54px;
  margin: 0;
  padding: 7px 6px;
  border-radius: 9px;
  color: #1F416F;
  font: 700 14px/20px Arial, "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: none;
}
:is(.yjh-header.is-materials-only, .portal-header) nav .yjh-en {
  display: block;
  margin: 0;
  color: inherit;
  font: 500 12px/16px Arial, sans-serif;
  letter-spacing: 0;
}
:is(.yjh-header.is-materials-only, .portal-header) nav a:hover { background: #FFFFFF; }
:is(.yjh-header.is-materials-only, .portal-header) nav a[aria-current="page"] {
  color: #FFFFFF;
  background: #3D6FBE;
  box-shadow: none;
}
.portal-header .portal-header-actions {
  grid-area: 2 / 2;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  min-height: 36px;
  color: #526174;
  font: 600 12px/18px Arial, "Hiragino Sans", sans-serif;
}
.portal-header .portal-header-actions button {
  min-height: 36px;
  padding: 6px 0;
  font: inherit;
  color: #1F416F;
  text-decoration: underline;
  text-underline-offset: 3px;
}
:is(.yjh-header.is-materials-only, .portal-header) :is(a, button):focus-visible {
  outline: 3px solid #78AEFF;
  outline-offset: 3px;
}

@media (max-width: 720px) {
  :is(.yjh-header.is-materials-only, .portal-header) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 48px 64px;
    gap: 12px 8px;
    width: calc(100% - 28px);
    min-height: 156px;
    padding: 16px 0;
  }
  :is(.yjh-header.is-materials-only, .portal-header) :is(.yjh-site-nav, .portal-navigation) {
    grid-area: 2 / 1 / 3 / -1;
    order: initial;
  }
  .portal-header .portal-header-actions {
    grid-area: 1 / 2;
    gap: 10px;
    font-size: 12px;
  }
  .portal-header .portal-header-actions button { min-height: 44px; }
  .portal-header .portal-header-actions > span { display: inline; }
}
@media (max-width: 380px) {
  :is(.yjh-header.is-materials-only, .portal-header) :is(.yjh-brand, .portal-brand) { gap: 8px; }
  :is(.yjh-header.is-materials-only, .portal-header) :is(.yjh-brand, .portal-brand) strong { font-size: 13px; }
  .portal-header .portal-header-actions { gap: 7px; font-size: 11px; }
}
