/* NovelFerry V5 shared tokens and one-row site header. */
:root {
  --nf-canvas: #0a141d;
  --nf-surface: #122531;
  --nf-raised: #172e3c;
  --nf-teal: #54bdc7;
  --nf-teal-deep: #164754;
  --nf-gold: #e6bb7d;
  --nf-text: #f4f2ed;
  --nf-text-muted: #b9c8ce;
  --nf-border: #31515d;
  --nf-content-width: 1236px;
  --nf-focus: #f2c781;
}

.header.nf-site-header {
  position: relative;
  z-index: 40;
  width: 100%;
  min-width: 0;
  color: var(--nf-text);
  background: var(--nf-canvas);
  border-bottom: 1px solid var(--nf-border);
  box-sizing: border-box;
}
.nf-site-header .topBar,
.nf-site-header > .mainNav { display: none !important; }
.nf-site-header .topMain {
  height: auto;
  min-height: 72px;
  padding: 0;
  overflow: visible;
  background: var(--nf-canvas);
  box-sizing: border-box;
}
.nf-site-header .topMain > .box_center {
  display: grid;
  grid-template-columns: auto auto minmax(190px, 1fr) auto;
  grid-template-areas: "brand nav search menu";
  align-items: center;
  gap: clamp(12px, 1.7vw, 26px);
  width: min(var(--nf-content-width), calc(100% - 40px));
  min-width: 0;
  min-height: 72px;
  margin: 0 auto;
  box-sizing: border-box;
}
.nf-site-header .topMain .logo {
  grid-area: brand;
  display: inline-flex;
  float: none;
  width: auto;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  color: var(--nf-gold);
  text-decoration: none;
}
.nf-site-header .brand-mark {
  display: block;
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nf-site-header .brand-name {
  color: var(--nf-text);
  font: 700 20px/1 Georgia, Charter, "Times New Roman", serif;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.nf-site-header .searchBar {
  grid-area: search;
  float: none;
  width: auto;
  min-width: 0;
  max-width: none;
  margin: 0;
}
.nf-site-header .searchBar .search {
  display: flex;
  width: 100%;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--nf-border);
  border-radius: 11px;
  background: var(--nf-surface);
  box-sizing: border-box;
}
.nf-site-header .searchBar .s_int {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  height: 40px;
  padding: 0 13px;
  border: 0;
  background: transparent !important;
  color: var(--nf-text) !important;
  font: inherit;
  font-size: 14px;
  box-sizing: border-box;
}
.nf-site-header .searchBar .s_int::placeholder { color: var(--nf-text-muted); opacity: 1; }
.nf-site-header .searchBar .search_btn {
  display: inline-flex;
  flex: 0 0 44px;
  width: 44px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-left: 1px solid var(--nf-border);
  border-radius: 0;
  background: var(--nf-teal-deep) !important;
  color: var(--nf-text) !important;
  cursor: pointer;
}
.nf-site-header .searchBar .search_btn:hover { background: #1d5c68; }
.nf-site-header .search_btn svg,
.nf-site-header .nf-mobile-search-toggle svg,
.nf-site-header .mobile-menu-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nf-site-header .nf-menu-content { display: contents; }
.nf-site-header .nf-primary-nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.3vw, 20px);
  white-space: nowrap;
}
.nf-site-header .nf-primary-nav a,
.nf-site-header .nf-account-links a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  color: var(--nf-text-muted);
  font-size: 13px;
  text-decoration: none;
}
.nf-site-header .nf-primary-nav a:hover,
.nf-site-header .nf-primary-nav a.is-active,
.nf-site-header .nf-account-links a:hover { color: var(--nf-text); }
.nf-site-header .nf-primary-nav a.is-active { box-shadow: inset 0 -2px var(--nf-gold); }
.nf-site-header .nf-account-links {
  grid-area: menu;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  white-space: nowrap;
}
.nf-site-header .topMain #headerUserInfo {
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  width: auto !important;
  margin: 0 !important;
  overflow: visible !important;
  white-space: nowrap !important;
}
.nf-site-header .nf-account-links .sj_link { color: var(--nf-text); }
.nf-site-header .nf-account-links .nf-register-link {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--nf-gold);
  border-radius: 9px;
  color: var(--nf-gold);
}
.nf-site-header .nf-current-language { color: var(--nf-text-muted); font-size: 12px; }
.nf-site-header .mobile-menu-toggle,
.nf-site-header .nf-mobile-search-toggle { display: none; }
.nf-site-header a:focus-visible,
.nf-site-header button:focus-visible,
.nf-site-header input:focus-visible {
  outline: 3px solid var(--nf-focus);
  outline-offset: 3px;
  z-index: 1;
}

/* Compact tablet navigation (the search stays visible). */
@media (min-width: 768px) and (max-width: 1099px) {
  .nf-site-header .topMain > .box_center {
    grid-template-columns: auto minmax(180px, 1fr) 44px;
    grid-template-areas: "brand search toggle";
    width: calc(100% - 32px);
    gap: 14px;
  }
  .nf-site-header .mobile-menu-toggle {
    grid-area: toggle;
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--nf-border);
    border-radius: 10px;
    background: var(--nf-surface);
    color: var(--nf-text);
    cursor: pointer;
  }
  .nf-site-header .nf-menu-content {
    position: absolute;
    top: 100%;
    right: 16px;
    z-index: 50;
    display: none;
    width: min(360px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid var(--nf-border);
    border-radius: 0 0 14px 14px;
    background: var(--nf-surface);
    box-shadow: 0 16px 34px #0008;
    box-sizing: border-box;
  }
  .nf-site-header.nf-mobile-menu-open .nf-menu-content { display: flex; flex-direction: column; gap: 8px; }
  .nf-site-header .nf-primary-nav,
  .nf-site-header .nf-account-links { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
  .nf-site-header .nf-primary-nav a,
  .nf-site-header .nf-account-links a { min-height: 44px; padding: 0 12px; }
  .nf-site-header .nf-account-links { border-top: 1px solid var(--nf-border); padding-top: 8px; }
  .nf-site-header .nf-account-links .nf-register-link { justify-content: center; }
  .nf-site-header .nf-current-language { padding: 8px 12px; }
}

/* Mobile: compact brand/search/menu row and an explicit, operable drawer. */
@media (max-width: 767px) {
  .nf-site-header .topMain > .box_center {
    position: relative;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    grid-template-areas: "brand searchToggle menuToggle";
    grid-template-columns: minmax(0, 1fr) 44px 44px !important;
    grid-template-areas: "brand searchToggle menuToggle" !important;
    gap: 8px;
    width: calc(100% - 24px);
    min-height: 60px;
    padding: 0 !important;
  }
  .nf-site-header .topMain .logo { min-height: 48px; }
  .nf-site-header .brand-mark { width: 30px; height: 30px; }
  .nf-site-header .brand-name { font-size: 18px; }
  .nf-site-header .nf-mobile-search-toggle,
  .nf-site-header .mobile-menu-toggle {
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--nf-border);
    border-radius: 10px;
    background: var(--nf-surface);
    color: var(--nf-text);
    cursor: pointer;
  }
  .nf-site-header .nf-mobile-search-toggle,
  .nf-site-header .mobile-menu-toggle {
    background: var(--nf-surface) !important;
    color: var(--nf-text) !important;
  }
  .nf-site-header .nf-mobile-search-toggle { grid-area: searchToggle; }
  .nf-site-header .mobile-menu-toggle { grid-area: menuToggle; }
  .nf-site-header .searchBar {
    display: none !important;
    position: absolute !important;
    top: calc(100% - 1px) !important;
    right: 0 !important;
    left: 0 !important;
    z-index: 60 !important;
    grid-area: 2 / 1 / 3 / 4 !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 8px !important;
    border: 1px solid var(--nf-border);
    border-radius: 0 0 12px 12px;
    background: var(--nf-surface);
    box-sizing: border-box;
  }
  .nf-site-header .searchBar .search { width: 100% !important; }
  .nf-site-header .searchBar .s_int { display: block !important; flex: 1 1 auto; width: auto; }
  .nf-site-header.nf-mobile-search-open .searchBar { display: block !important; }
  .nf-site-header .nf-menu-content {
    position: absolute;
    top: 100%;
    right: -12px;
    left: -12px;
    z-index: 50;
    display: none;
    padding: 10px 12px 14px;
    border-top: 1px solid var(--nf-border);
    border-bottom: 1px solid var(--nf-border);
    background: var(--nf-surface);
    box-shadow: 0 16px 34px #0008;
    box-sizing: border-box;
  }
  .nf-site-header.nf-mobile-menu-open .nf-menu-content { display: flex; flex-direction: column; gap: 8px; }
  .nf-site-header .nf-primary-nav,
  .nf-site-header .nf-account-links { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
  .nf-site-header .nf-primary-nav a,
  .nf-site-header .nf-account-links a { min-height: 44px; padding: 0 12px; }
  .nf-site-header .nf-account-links { border-top: 1px solid var(--nf-border); padding-top: 8px; }
  .nf-site-header .nf-account-links .nf-register-link { justify-content: center; }
  .nf-site-header .nf-current-language { padding: 8px 12px; }
  .nf-reader-header .topMain > .box_center { min-height: 52px; }
  .nf-reader-header .topMain .logo { min-height: 44px; }
}

@media (max-width: 767px) {
  body.experience-detail .header.nf-site-header .topMain,
  body.experience-toc .header.nf-site-header .topMain,
  body.experience-reader .header.nf-site-header .topMain,
  body.experience-catalog .header.nf-site-header .topMain {
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
  }
  body.experience-detail .header.nf-site-header .topMain > .box_center,
  body.experience-toc .header.nf-site-header .topMain > .box_center,
  body.experience-reader .header.nf-site-header .topMain > .box_center,
  body.experience-catalog .header.nf-site-header .topMain > .box_center {
    display: grid !important;
    grid-template: "brand searchToggle menuToggle" 60px / minmax(0, 1fr) 44px 44px !important;
    width: calc(100% - 24px) !important;
    min-height: 60px !important;
    height: auto !important;
    padding: 0 !important;
  }
  body.experience-detail .header.nf-site-header .topMain .logo,
  body.experience-toc .header.nf-site-header .topMain .logo,
  body.experience-reader .header.nf-site-header .topMain .logo,
  body.experience-catalog .header.nf-site-header .topMain .logo {
    flex: 0 1 auto !important;
    width: auto !important;
  }
  body.experience-detail .header.nf-site-header .topMain .nf-mobile-search-toggle,
  body.experience-toc .header.nf-site-header .topMain .nf-mobile-search-toggle,
  body.experience-reader .header.nf-site-header .topMain .nf-mobile-search-toggle,
  body.experience-catalog .header.nf-site-header .topMain .nf-mobile-search-toggle { grid-area: searchToggle !important; }
  body.experience-detail .header.nf-site-header .topMain .mobile-menu-toggle,
  body.experience-toc .header.nf-site-header .topMain .mobile-menu-toggle,
  body.experience-reader .header.nf-site-header .topMain .mobile-menu-toggle,
  body.experience-catalog .header.nf-site-header .topMain .mobile-menu-toggle { grid-area: menuToggle !important; }
  body.experience-detail .header.nf-site-header .topMain .searchBar,
  body.experience-toc .header.nf-site-header .topMain .searchBar,
  body.experience-reader .header.nf-site-header .topMain .searchBar,
  body.experience-catalog .header.nf-site-header .topMain .searchBar {
    display: none !important;
    position: absolute !important;
    top: calc(100% - 1px) !important;
    right: 12px !important;
    left: 12px !important;
    z-index: 60 !important;
    grid-area: auto !important;
    flex: none !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 8px !important;
  }
  body.experience-detail .header.nf-site-header.nf-mobile-search-open .topMain .searchBar,
  body.experience-toc .header.nf-site-header.nf-mobile-search-open .topMain .searchBar,
  body.experience-reader .header.nf-site-header.nf-mobile-search-open .topMain .searchBar,
  body.experience-catalog .header.nf-site-header.nf-mobile-search-open .topMain .searchBar { display: block !important; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-site-header *, .nf-site-header *::before, .nf-site-header *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* Legacy page-family styles are still loaded on some routes; keep the shared header authoritative. */
@media (max-width: 767px) {
  body .header.nf-site-header .topMain { min-height: 0 !important; padding: 0 !important; }
  body .header.nf-site-header .topMain > .box_center {
    display: grid !important;
    grid-template: "brand searchToggle menuToggle" 60px / minmax(0, 1fr) 44px 44px !important;
    align-items: center !important;
    gap: 0 8px !important;
    width: calc(100% - 24px) !important;
    height: auto !important;
    min-height: 60px !important;
    padding: 0 !important;
  }
  body .header.nf-site-header .topMain .logo { grid-area: brand !important; width: auto !important; height: auto !important; min-height: 48px !important; margin: 0 !important; padding: 0 !important; }
  body .header.nf-site-header .brand-mark { display: block !important; flex: 0 0 30px !important; width: 30px !important; height: 30px !important; }
  body .header.nf-site-header .nf-mobile-search-toggle { grid-area: searchToggle !important; display: inline-flex !important; }
  body .header.nf-site-header .mobile-menu-toggle { grid-area: menuToggle !important; display: inline-flex !important; }
  body .header.nf-site-header .nf-mobile-search-toggle,
  body .header.nf-site-header .mobile-menu-toggle { width: 44px !important; min-width: 44px !important; height: 44px !important; min-height: 44px !important; margin: 0 !important; padding: 0 !important; border: 1px solid var(--nf-border) !important; border-radius: 10px !important; background: var(--nf-surface) !important; color: var(--nf-text) !important; }
  body .header.nf-site-header .searchBar { display: none !important; position: absolute !important; top: calc(100% - 1px) !important; right: 12px !important; left: 12px !important; z-index: 60 !important; grid-area: auto !important; width: auto !important; max-width: none !important; min-width: 0 !important; height: auto !important; margin: 0 !important; padding: 8px !important; border: 1px solid var(--nf-border) !important; border-radius: 0 0 12px 12px !important; background: var(--nf-surface) !important; box-sizing: border-box !important; }
  body .header.nf-site-header.nf-mobile-search-open .searchBar { display: block !important; }
  body .header.nf-site-header .searchBar .search { display: flex !important; width: 100% !important; }
  body .header.nf-site-header .searchBar .s_int { display: block !important; flex: 1 1 auto !important; width: auto !important; min-width: 0 !important; }
  body .header.nf-site-header .searchBar .search_btn { display: inline-flex !important; flex: 0 0 44px !important; width: 44px !important; }
}

/* Keep brand contrast above the legacy .header .logo color rules. */
.header.nf-site-header .topMain a.logo{color:var(--nf-gold)!important}.header.nf-site-header .topMain a.logo .brand-name{color:var(--nf-text)!important}

:root{--nf-header:#0a141d}.header.nf-site-header,.header.nf-site-header .topMain{background:var(--nf-header)!important}

.header.nf-site-header .nf-header-signout{display:inline-flex;align-items:center;min-height:44px;padding:0 4px;border:0;background:transparent;color:var(--nf-text-muted);font:inherit;white-space:nowrap;cursor:pointer}.header.nf-site-header .nf-header-signout:hover{color:var(--nf-text)}.header.nf-site-header .nf-header-signout:focus-visible{outline:2px solid var(--nf-gold);outline-offset:2px}

/* Consistent keyboard focus on every public route, including native disclosures. */
body :is(a,button,input,select,textarea,summary):focus-visible{outline:2px solid var(--nf-focus,#f2c781)!important;outline-offset:3px}
