@font-face {
  font-family: "IBM Plex Sans KR";
  src: url("/assets/fonts/IBMPlexSansKR-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: optional;
}
@font-face {
  font-family: "IBM Plex Sans KR";
  src: url("/assets/fonts/IBMPlexSansKR-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: optional;
}
@font-face {
  font-family: "IBM Plex Sans KR";
  src: url("/assets/fonts/IBMPlexSansKR-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: optional;
}

.wrap { width: min(calc(100% - 80px), 1280px); margin-inline: auto; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--rule); }
.masthead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-height: 76px; gap: clamp(16px, 2.25vw, 32px); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; color: var(--green); }
.brand-mark { position: relative; flex: 0 0 34px; height: 42px; border: 1px solid var(--gold); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: currentColor; }
.brand-mark::before { width: 1px; height: 22px; inset: 9px auto auto calc(50% - .5px); }
.brand-mark::after { width: 13px; height: 1px; inset: 16px auto auto calc(50% - 6.5px); }
.brand strong { display: block; font: 700 clamp(1.1rem, 1.52vw, 1.35rem)/1.2 var(--sans); letter-spacing: -.035em; white-space: nowrap; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; line-height: 1.2; }
.header-controls { display: flex; gap: 6px; align-items: center; }
.site-header .theme-toggle, .site-header .menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: transparent;
  color: var(--green);
  font: 700 .79rem/1.4 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}
.site-header .theme-toggle:hover, .site-header .menu-toggle:hover, .site-header .menu-toggle[aria-expanded="true"] { background: var(--active, var(--green-soft)); }
.site-header :focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.nav-items { display: flex; align-items: stretch; justify-content: flex-end; gap: clamp(10px, 1.35vw, 24px); }
.nav-items a { display: grid; place-items: center; min-height: 44px; border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap; font-size: clamp(.82rem, 1.07vw, .97rem); font-weight: 600; }
.nav-items a:is(:hover, [aria-current]) { color: var(--green); border-bottom-color: var(--gold); text-decoration: none; }
#open-menu { display: none; }

@media (max-width: 1100px) {
  .wrap { width: calc(100% - 48px); }
  .masthead { grid-template-columns: minmax(0, 1fr) auto; min-height: 68px; gap: 0 12px; }
  .header-controls { grid-column: 2; grid-row: 1; }
  #open-menu { display: inline-flex; }
  .site-nav:not(.is-open) { display: none; }
  .nav-items { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px; border-top: 1px solid var(--rule); padding-block: 5px 10px; }
  .nav-items a { place-items: center start; white-space: normal; word-break: keep-all; }
}

@media (max-width: 710px) {
  .wrap { width: calc(100% - 32px); }
  .masthead { min-height: 62px; column-gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { height: 38px; flex-basis: 29px; }
  .brand-mark::before { top: 7px; }
  .brand-mark::after { top: 14px; }
  .brand strong { font-size: clamp(.98rem, 3.9vw, 1.18rem); }
  .nav-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-header .theme-toggle, .site-header .menu-toggle { padding-inline: 8px; font-size: .75rem; }
}

@media (max-width: 480px) {
  .brand small { display: none; }
}

/* MERCURY3 scripture search shortcut */
.nav-items a.mercury-nav-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  box-sizing: border-box;
  width: 40px;
  min-width: 40px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 3px;
  color: var(--green);
}
.nav-items a.mercury-nav-search svg { display: block; width: 20px; height: 20px; max-width: 20px; max-height: 20px; flex: 0 0 20px; }
.nav-items a.mercury-nav-search:hover { background: var(--active, var(--green-soft)); border-bottom-color: var(--gold); }
@media (max-width: 1100px) {
  .nav-items a.mercury-nav-search { justify-self: start; margin-block: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mercury-nav-search .mercury-glint { display: none; }
}
