/* The FV navigation, shared by every public detail page. */
.unified-header {
  position: sticky;
  top: 0;
  z-index: 300;
  width: 100%;
  background: #fff;
  box-shadow: 0 1px 0 #e9eaf3, 0 6px 24px rgb(28 34 79 / 5%);
  color: #172448;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.unified-header *,
.unified-header *::before,
.unified-header *::after {
  box-sizing: border-box;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: normal;
}

.unified-header__inner {
  display: flex;
  align-items: center;
  gap: clamp(24px, 2.4vw, 48px);
  min-height: 92px;
  padding: 16px clamp(24px, 3vw, 60px);
}

.unified-header a {
  text-decoration: none;
}

.unified-header__brand {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: #172448;
  font-family: Arial, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: clamp(24px, 1.8vw, 32px);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.unified-header__brand img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.unified-header__brand span,
.unified-header__nav a,
.unified-header__button span {
  font: inherit;
}

.unified-header__panel {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(24px, 2.4vw, 48px);
  min-width: 0;
}

.unified-header__nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.1vw, 24px);
  margin-inline: auto;
  font-size: clamp(14px, 1vw, 18px);
  font-weight: 800;
  white-space: nowrap;
}

.unified-header__nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: inherit;
  transition: color 0.2s;
}

.unified-header__nav a:hover,
.unified-header__nav a[aria-current="page"] {
  color: #5145ed;
}

.unified-header__nav a[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: 1px;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.unified-header__actions {
  display: flex;
  flex-shrink: 0;
  gap: 12px;
}

.unified-header__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px clamp(14px, 1.3vw, 26px);
  border: 1px solid #dcd9ff;
  border-radius: 10px;
  font-size: clamp(14px, 1.05vw, 18px);
  font-weight: 800;
  line-height: 1.5;
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s;
}

.unified-header__button svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.unified-header__button--download {
  border: 0;
  background: #fff;
  color: #5749f2;
  box-shadow: inset 0 0 0 1px #dcd9ff;
}

.unified-header__button--download:hover {
  background: #f4f2ff;
}

.unified-header__button--primary {
  border-color: #5b4df3;
  background: #5b4df3;
  color: #fff;
  box-shadow: 0 5px 15px rgb(82 68 224 / 12%);
}

.unified-header__button--primary:hover {
  background: #483ad9;
}

.unified-header :is(a, button):focus-visible {
  outline: 3px solid #7971fb;
  outline-offset: 4px;
}

.unified-header__toggle {
  display: none;
}

/* These older pages previously reserved space for a fixed header. */
.unified-header-page :is(.comparison-page .course-fv, .assessment-fv, .news-topic-hero) {
  margin-top: 0;
}

/* One 1850px design scale for the FV and every detail-page desktop header. */
@media (min-width: 1280px) {
  .fv-header,
  .unified-header {
    --header-unit: min(1px, calc(100vw / 1850));
    --header-text: max(var(--header-unit), 0.8px);
    font-family: "Noto Sans JP", system-ui, sans-serif;
    line-height: 1.5;
  }

  .fv-header,
  .unified-header__inner {
    display: flex;
    align-items: center;
    height: calc(92 * var(--header-unit));
    min-height: 0;
    gap: calc(40 * var(--header-unit));
    padding: 0;
  }

  .fv-header {
    margin-right: calc(-17 * var(--header-unit));
  }

  .unified-header__inner {
    margin-left: calc(70 * var(--header-unit));
    margin-right: calc(53 * var(--header-unit));
  }

  .unified-header__panel {
    display: contents;
  }

  .fv-brand,
  .unified-header__brand {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    gap: calc(12 * var(--header-unit));
    font-family: inherit;
    font-size: calc(32 * var(--header-text));
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.01em;
  }

  .fv-brand img,
  .unified-header__brand img {
    width: calc(50 * var(--header-unit));
    height: calc(50 * var(--header-unit));
  }

  .fv-nav,
  .unified-header__nav {
    display: flex;
    gap: calc(18 * var(--header-unit));
    margin: 0 auto;
    font-size: clamp(16px, 1.05vw, 18px);
    font-weight: 700;
  }

  .unified-header__nav a {
    display: block;
    min-height: 0;
  }

  .unified-header__nav a[aria-current="page"]::after {
    bottom: -8px;
  }

  .fv-header__actions,
  .unified-header__actions {
    display: flex;
    flex: 0 1 auto;
    gap: calc(14 * var(--header-unit));
    margin-left: auto;
  }

  .fv-btn,
  .unified-header__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(8 * var(--header-unit));
    height: calc(50 * var(--header-unit));
    min-height: 44px;
    padding: 0 calc(26 * var(--header-unit));
    border-radius: calc(10 * var(--header-unit));
    font-size: clamp(15px, .95vw, 17px);
    font-weight: 800;
    line-height: 1.5;
  }

  .fv-btn svg,
  .unified-header__button svg {
    width: calc(20 * var(--header-unit));
    height: calc(20 * var(--header-unit));
  }

  .fv-btn--light,
  .unified-header__button--download {
    min-width: calc(216 * var(--header-unit));
  }

  .fv-btn--primary,
  .unified-header__button--primary {
    min-width: calc(218 * var(--header-unit));
  }
}

@media (max-width: 1279px) {
  .unified-header__inner {
    height: 80px;
    min-height: 80px;
    justify-content: space-between;
    padding: 0 24px;
  }

  .unified-header__brand {
    gap: 8px;
    font-size: 25px;
  }

  .unified-header__brand img {
    width: 34px;
    height: 34px;
  }

  .unified-header__toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #e6e4fa;
    border-radius: 10px;
    background: #f7f6ff;
    color: #5145ed;
    cursor: pointer;
  }

  .unified-header__toggle span {
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.2s, opacity 0.2s;
  }

  .unified-header__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .unified-header__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .unified-header__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .unified-header__panel {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 24px 28px;
    border-top: 1px solid #eeedf7;
    background: #fff;
    box-shadow: 0 16px 24px rgb(28 34 79 / 12%);
  }

  .unified-header[data-menu-open="true"] .unified-header__panel {
    display: block;
  }

  .unified-header__nav {
    display: grid;
    max-width: 620px;
    gap: 0;
    margin: 0 auto 24px;
    font-size: 18px;
  }

  .unified-header__nav a {
    min-height: 54px;
    padding: 12px 4px;
    border-bottom: 1px solid #eeedf7;
  }

  .unified-header__nav a[aria-current="page"]::after {
    content: none;
  }

  .unified-header__actions {
    max-width: 620px;
    margin: 0 auto;
  }

  .unified-header__button {
    flex: 1;
    min-height: 54px;
    font-size: 17px;
  }
}

@media (max-width: 767px) {
  .unified-header__inner {
    height: 60px;
    min-height: 60px;
    padding: 0 8px 0 16px;
  }

  .unified-header__brand {
    gap: 8px;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 18px;
    letter-spacing: 0.01em;
  }

  .unified-header__brand img {
    width: 32px;
    height: 32px;
  }

  .unified-header__brand span {
    letter-spacing: inherit;
  }

  .unified-header__toggle {
    margin-right: -8px;
  }

  .unified-header__panel {
    max-height: calc(100dvh - 60px);
    padding: 10px 20px max(24px, env(safe-area-inset-bottom));
  }

  .unified-header__actions {
    flex-direction: column;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .unified-header * {
    transition: none;
  }
}
