:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #edf3f6;
  --ink: #172033;
  --muted: #5f6878;
  --line: #d9e0e8;
  --primary: #174a7c;
  --primary-dark: #123a61;
  --accent: #946817;
  --accent-soft: #f4ead9;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

a {
  color: var(--primary);
}

a:hover {
  color: var(--primary-dark);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem max(1.25rem, calc((100vw - 1120px) / 2));
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 3.25rem;
  height: 2.5rem;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name,
.brand-subtitle {
  display: block;
}

.brand-name {
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
}

.site-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 0.94rem;
}

.site-nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 0.9rem;
}

.site-nav a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--primary);
}

.nav-group {
  position: relative;
}

.nav-group > a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-group > a::after {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
}

.nav-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  display: grid;
  min-width: 11rem;
  padding: 0.85rem 0.4rem 0.4rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.25rem);
  transition: opacity 140ms ease, transform 140ms ease;
}

.nav-submenu::before {
  content: "";
  position: absolute;
  inset: 0 0 0.45rem;
  z-index: -1;
  margin-top: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.nav-group:hover .nav-submenu,
.nav-group:focus-within .nav-submenu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-submenu a {
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.nav-submenu a:hover {
  background: var(--surface-soft);
}

.side-menu-page {
  margin: 0;
  padding: 0.75rem;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.side-menu {
  display: grid;
  gap: 0.35rem;
}

.side-menu a {
  display: block;
  padding: 0.38rem 0.5rem;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.side-menu a:hover {
  background: var(--surface);
  color: var(--primary);
}

.side-menu-section {
  display: grid;
  gap: 0.12rem;
  margin: 0.35rem 0;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.side-menu-section a {
  padding-block: 0.24rem;
  font-size: 0.88rem;
  font-weight: 650;
}

.side-menu-section span {
  color: var(--muted);
  font-size: 0.82rem;
}

main {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 1.5rem;
  align-items: stretch;
  padding: 4.5rem 0 2rem;
}

.hero-content {
  padding: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.35rem, 6vw, 4.5rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-title-en {
  font-size: clamp(2.2rem, 5vw, 3.45rem);
}

.hero-title-en span {
  display: block;
  white-space: nowrap;
}

h2 {
  margin-bottom: 0.8rem;
  font-size: 1.45rem;
  line-height: 1.3;
}

.hero-lead {
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions,
.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.68rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  color: #fff;
  background: var(--primary-dark);
}

.next-meeting,
.panel,
.link-card,
.archive-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.next-meeting {
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.next-meeting h2 {
  font-size: 2.3rem;
}

.next-meeting dl {
  display: grid;
  gap: 0.85rem;
  margin: 1.25rem 0 0;
}

.next-meeting div {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.next-meeting div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

dd {
  margin: 0.1rem 0 0;
  font-weight: 700;
}

.inline-links a {
  font-weight: 800;
}

.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.25rem 0;
}

.panel,
.archive-section {
  padding: 1.5rem;
}

.section-grid .panel {
  display: flex;
  flex-direction: column;
  max-height: 24rem;
  min-height: 24rem;
}

.section-heading h2 {
  margin-bottom: 1rem;
}

.news-list {
  display: grid;
  gap: 0.9rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.section-grid .news-list,
.section-grid .schedule-list {
  min-height: 0;
  padding-right: 0.35rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.news-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.news-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.news-list time {
  color: var(--muted);
  font-weight: 800;
}

.schedule-list {
  display: grid;
  gap: 0.75rem;
}

.schedule-item {
  display: grid;
  gap: 0.15rem;
  padding: 1rem;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  text-decoration: none;
}

.schedule-item time,
.schedule-item span:not(.schedule-name) {
  color: var(--muted);
}

.schedule-name {
  color: var(--primary);
  font-size: 1.15rem;
  font-weight: 900;
}

.schedule-item.is-muted {
  background: var(--accent-soft);
}

.empty-message {
  color: var(--muted);
  font-weight: 700;
}

.link-section,
.archive-section {
  margin: 1.25rem 0;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.link-card {
  display: grid;
  gap: 0.25rem;
  min-height: 6.3rem;
  padding: 1rem;
  color: var(--ink);
  text-decoration: none;
}

.link-card:hover {
  border-color: var(--primary);
}

.link-card span {
  font-weight: 900;
}

.link-card small {
  color: var(--muted);
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
}

.archive-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.archive-list span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.archive-note {
  margin: 1rem 0 0;
  color: var(--muted);
}

.site-footer {
  width: min(1120px, calc(100% - 2rem));
  margin: 2rem auto 0;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin-bottom: 0.25rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.footer-links a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.site-nav-toggle,
.viewer-side-nav-toggle {
  display: none;
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.site-nav-toggle:hover,
.viewer-side-nav-toggle:hover {
  color: var(--primary);
  background: var(--surface-soft);
}

.viewer-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  min-height: 100vh;
  background: var(--bg);
}

.viewer-main {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 1.25rem 0 1rem;
}

.viewer-shell .site-footer {
  margin-top: 0;
}

.viewer-toolbar {
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.06);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb [aria-current="page"] {
  color: var(--muted);
}

.breadcrumb-separator {
  color: var(--line);
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
  min-height: 0;
}

.viewer-layout.has-side-nav {
  grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr);
}

.viewer-side-nav {
  position: sticky;
  top: 6rem;
  display: none;
  flex-direction: column;
  box-sizing: border-box;
  height: 100%;
  max-height: none;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.06);
  overflow: hidden;
}

.viewer-side-nav.is-visible {
  display: flex;
}

.viewer-side-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.viewer-side-nav-title {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
}

.viewer-side-nav-header .viewer-side-nav-title {
  margin: 0;
}

.viewer-side-nav-list {
  flex: 1;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  min-height: 0;
}

.viewer-side-nav-list li + li {
  margin-top: 0.15rem;
}

.viewer-side-nav-list a {
  display: block;
  padding: 0.42rem 0.5rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.35;
  text-decoration: none;
}

.viewer-side-nav-list a:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.viewer-side-nav-list a[aria-current="page"] {
  color: #ffffff;
  background: var(--primary);
  font-weight: 900;
}

.legacy-frame {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.legacy-page-root {
  background: var(--surface) !important;
}

body.legacy-page {
  margin: 0 !important;
  padding: clamp(1rem, 3vw, 2.25rem) !important;
  color: var(--ink) !important;
  background: var(--surface) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 1rem !important;
  line-height: 1.75 !important;
}

body.legacy-page * {
  box-sizing: border-box;
}

body.legacy-page a {
  color: var(--primary) !important;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

body.legacy-page h1,
body.legacy-page h2,
body.legacy-page h3 {
  color: var(--ink) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  letter-spacing: 0 !important;
}

body.legacy-page h1 {
  margin: 0 0 1.25rem !important;
  padding-bottom: 0.65rem;
  border-bottom: 3px solid var(--primary);
  font-size: clamp(1.7rem, 4vw, 2.4rem) !important;
  line-height: 1.25 !important;
}

body.legacy-page h2 {
  margin: 1.2rem 0 0.55rem !important;
  padding-left: 0.7rem;
  border-left: 4px solid var(--accent);
  font-size: 1.35rem !important;
}

body.legacy-page h3 {
  margin: 1.5rem 0 0.6rem !important;
  font-size: 1.1rem !important;
}

body.legacy-page p,
body.legacy-page ul,
body.legacy-page ol,
body.legacy-page dl {
  max-width: 74rem;
}

body.legacy-page table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse !important;
  background: var(--surface) !important;
}

body.legacy-page th,
body.legacy-page td {
  padding: 0.55rem 0.7rem !important;
  border: 1px solid var(--line) !important;
  vertical-align: top !important;
}

body.legacy-page th {
  background: var(--surface-soft) !important;
  color: var(--ink) !important;
}

body.legacy-text-page table {
  width: 100%;
}

body.legacy-text-page a {
  font-weight: 700;
}

body.legacy-text-page {
  max-width: 980px;
  margin: 0 auto !important;
}

.content-section,
.meeting-card {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(20, 46, 66, 0.06);
}

.content-section h2,
.meeting-card h2 {
  margin-top: 0 !important;
}

.meeting-list {
  display: grid;
  gap: 1rem;
}

.meeting-meta {
  display: grid;
  gap: 0.45rem;
  margin: 0.8rem 0 0;
}

.meeting-meta div {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 0.75rem;
}

.meeting-meta dt {
  color: var(--muted);
  font-weight: 700;
}

.meeting-meta dd {
  margin: 0;
}

body.legacy-page img {
  max-width: 100%;
  height: auto;
}

body.legacy-page hr {
  height: 1px;
  border: 0;
  background: var(--line);
}

@media (max-width: 860px) {
  .site-header {
    align-items: center;
    flex-direction: row;
  }

  .site-nav {
    justify-content: flex-end;
  }

  .site-nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .site-nav-list {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 30;
    display: none;
    flex-direction: column;
    align-items: stretch;
    min-width: min(20rem, calc(100vw - 2rem));
    max-height: calc(100vh - 6rem);
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: auto;
  }

  .site-nav.is-open .site-nav-list {
    display: flex;
  }

  .site-nav-list > a,
  .site-nav-list .nav-group > a {
    padding: 0.35rem 0;
  }

  .nav-group {
    display: grid;
    gap: 0.25rem;
  }

  .nav-submenu {
    position: static;
    min-width: 0;
    padding: 0 0 0 0.75rem;
    border: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    max-height: none;
    overflow: visible;
  }

  .nav-submenu::before {
    content: none;
  }

  .nav-submenu a {
    padding: 0.2rem 0;
    color: var(--muted);
  }

  .hero,
  .section-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 2rem;
  }

  .hero-title-en {
    font-size: 2.6rem;
  }

  .link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .archive-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-toolbar {
    display: none;
  }

  .viewer-shell {
    height: auto;
    min-height: 100vh;
  }

  .viewer-main {
    height: auto;
  }

  .viewer-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .viewer-layout.has-side-nav {
    grid-template-columns: 1fr;
  }

  .viewer-side-nav {
    position: static;
    height: min(42vh, 24rem);
    max-height: min(42vh, 24rem);
  }

  .viewer-side-nav-toggle {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
  }

  .viewer-side-nav:not(.is-open) {
    height: auto;
    max-height: none;
  }

  .viewer-side-nav:not(.is-open) .viewer-side-nav-list {
    display: none;
  }

  .legacy-frame {
    height: min(62vh, 34rem);
  }

}

@media (max-width: 560px) {
  main,
  .site-footer,
  .viewer-main {
    width: min(100% - 1rem, 1120px);
  }

  .hero-content,
  .next-meeting,
  .panel,
  .archive-section {
    padding: 1rem;
  }

  .brand-subtitle {
    display: none;
  }

  .hero-title-en {
    font-size: 1.65rem;
    line-height: 1.14;
  }

  .news-list li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .link-grid,
  .archive-list {
    grid-template-columns: 1fr;
  }

  .link-grid {
    gap: 0.55rem;
  }

  .link-card {
    min-height: 0;
    padding: 0.75rem 0.85rem;
  }

  body.legacy-page {
    padding: 1rem !important;
  }
}
