:root {
  --color-primary: #002B78;
  --color-primary-dark: #001d54;
  --color-accent: #3B9BE1;
  --color-accent-light: #eef7fe;
  --color-text-main: #0a192f;
  --color-text-muted: rgba(0, 43, 120, 0.72);
  --border-subtle: rgba(0, 43, 120, 0.08);
  --shadow-sm: 0 4px 12px rgba(0, 43, 120, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 43, 120, 0.08);
  --shadow-lg: 0 16px 32px rgba(0, 43, 120, 0.12);
  --header-h: 4.5rem;
  --mobile-tab-h: 4.25rem;
  --font-display: "Noto Serif JP", "Noto Serif SC", Georgia, serif;
  --page-max: 1536px;
  --content-max: 1300px;
  --section-pad-x: clamp(1.5rem, 5vw, 4rem);
  --chrome-link-gap: 2rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.75rem);
}

html, body {
  margin: 0;
  padding: 0;
  background-color: #f8fafc;
  color: var(--color-text-main);
}

.page-frame {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  position: relative;
}

.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  width: 100%;
  margin: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.site-header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--section-pad-x);
  box-sizing: border-box;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--color-primary);
  flex-shrink: 0;
  z-index: 1;
  margin-right: auto;
}

.header-logo {
  display: block;
  height: 2.5rem;
  width: auto;
}

.header-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.header-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: calc(var(--chrome-link-gap) * 2 + 0.65em);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 26rem);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(0, 43, 120, 0.8);
}

.header-nav a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.header-nav a:hover,
.header-nav a.is-active {
  color: var(--color-accent);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  z-index: 1;
  margin-left: auto;
}

@media (min-width: 768px) {
  .header-nav {
    display: flex;
  }
}

@media (max-width: 767px) {
  :root {
    --header-h: 3.75rem;
  }

  .site-header {
    background: rgba(255, 255, 255, 0.94);
  }

  .site-header-inner {
    padding: 0 1rem;
  }

  .header-brand {
    gap: 0.55rem;
    min-width: 0;
  }

  .header-logo {
    height: 2.1rem;
  }

  .header-brand-name {
    font-size: 0.9rem;
    letter-spacing: 0.04em;
  }

  .header-tools {
    gap: 0.45rem;
  }

  .lang-dropdown-btn {
    min-height: 2.4rem;
    padding: 0.45rem 0.65rem;
    gap: 0.3rem;
  }

  .lang-dropdown-btn #lang-current-label {
    font-size: 12px;
  }

  .lang-dropdown-btn > svg:last-child {
    display: none;
  }
}

.lang-dropdown {
  position: relative;
}

.lang-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-dropdown-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: #fff;
}

.lang-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 9rem;
  padding: 0.4rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  display: none;
  z-index: 60;
}

.lang-dropdown.is-open .lang-dropdown-menu {
  display: block;
}

.lang-dropdown-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lang-dropdown-menu button:hover:not(:disabled) {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.lang-dropdown-menu button[aria-current="true"] {
  background: rgba(0, 43, 120, 0.06);
  font-weight: 700;
}

.lang-dropdown-menu button:disabled {
  cursor: default;
  opacity: 0.45;
}

.lang-dropdown-menu .check {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--color-accent);
  opacity: 0;
}

.lang-dropdown-menu button[aria-current="true"] .check {
  opacity: 1;
}

.nav-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff !important;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 43, 120, 0.2);
}

.nav-contact-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 43, 120, 0.3);
}

.nav-contact-btn svg {
  width: 0.9rem;
  height: 0.9rem;
}

.nav-contact-btn-mobile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.2rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff !important;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.site-footer {
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: var(--color-text-muted);
  padding: 1.75rem 0 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--section-pad-x);
  box-sizing: border-box;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--color-primary);
}

.footer-logo {
  display: block;
  height: 2.25rem;
  width: auto;
}

.footer-brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.footer-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  width: max-content;
  max-width: 100%;
}

.footer-nav li {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.footer-nav li:not(:last-child)::after {
  content: '｜';
  margin: 0 0.55rem;
  color: rgba(0, 43, 120, 0.22);
  font-weight: 400;
  pointer-events: none;
}

.footer-nav a {
  color: rgba(0, 43, 120, 0.8);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--color-accent);
}

.footer-copy {
  width: 100%;
  max-width: var(--page-max);
  margin: 1.25rem auto 0;
  padding: 0 var(--section-pad-x);
  box-sizing: border-box;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: rgba(0, 43, 120, 0.45);
}

.footer-powered {
  width: 100%;
  max-width: var(--page-max);
  margin: 0.5rem auto 0;
  padding: 0 var(--section-pad-x);
  box-sizing: border-box;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.footer-powered a {
  color: rgba(0, 43, 120, 0.4);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-powered a:hover {
  color: var(--color-accent);
}

@media (min-width: 768px) {
  .site-footer {
    padding: 3.5rem 0 3rem;
  }

  .footer-inner {
    gap: 1.85rem;
    padding: 0 clamp(2.5rem, 6vw, 5.5rem);
  }

  .footer-copy,
  .footer-powered {
    padding: 0 clamp(2.5rem, 6vw, 5.5rem);
  }

  .footer-copy {
    margin-top: 1.85rem;
  }

  .footer-powered {
    margin-top: 0.75rem;
  }

  /* Match header-nav type; spacing slightly looser than header */
  .footer-nav {
    gap: calc(var(--chrome-link-gap) * 2.5 + 1em);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(0, 43, 120, 0.8);
  }

  .footer-nav a {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
  }

  .footer-nav li {
    position: relative;
  }

  .footer-nav li:not(:last-child)::after {
    position: absolute;
    top: 50%;
    left: calc(100% + (var(--chrome-link-gap) * 2.5 + 1em) / 2);
    margin: 0;
    transform: translate(-50%, -50%);
  }
}

.mobile-tabbar {
  display: none;
}

@media (max-width: 767px) {
  body {
    padding-bottom: calc(var(--mobile-tab-h) + env(safe-area-inset-bottom, 0px));
  }

  .site-footer {
    padding-bottom: 1.25rem;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    height: calc(var(--mobile-tab-h) + env(safe-area-inset-bottom, 0px));
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -8px 24px rgba(0, 43, 120, 0.08);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
  }

  .mobile-tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.25rem 0.2rem;
    color: rgba(0, 43, 120, 0.55);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-align: center;
    transition: color 0.2s ease;
  }

  .mobile-tabbar a svg {
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
  }

  .mobile-tabbar a span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-tabbar a.is-active,
  .mobile-tabbar a:hover {
    color: var(--color-primary);
  }

  .mobile-tabbar a.is-active {
    color: var(--color-accent);
  }
}

@media (max-width: 900px) {
  .footer-logo {
    height: 2rem;
  }

  .footer-nav li:not(:last-child)::after {
    margin: 0 0.4rem;
  }

  .footer-nav a {
    font-size: 15px;
    letter-spacing: 0.02em;
  }

  .footer-copy {
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .header-brand-name {
    display: none;
  }

  .footer-brand-name {
    display: none;
  }

  .footer-nav li:not(:last-child)::after {
    margin: 0 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
