:root {
  --bg: #f7fbff;
  --bg-deep: #eaf6ff;
  --surface: rgba(255, 255, 255, 0.90);
  --surface-solid: #ffffff;
  --ink: #10213f;
  --muted: #536982;
  --blue: #0875d1;
  --blue-deep: #064ba8;
  --cyan: #35bffc;
  --teal: #167a68;
  --purple: #7557c8;
  --amber: #8a5b00;
  --red: #874a4a;
  --line: rgba(37, 139, 222, 0.22);
  --soft-line: rgba(31, 109, 173, 0.13);
  --shadow: 0 22px 70px rgba(21, 94, 160, 0.12);
  --shadow-soft: 0 12px 36px rgba(28, 103, 165, 0.08);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --content: 1120px;
  --reading: 790px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html[data-site-lang="en"] [data-copy="ja"],
html[data-site-lang="ja"] [data-copy="en"] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 5%, rgba(70, 185, 255, 0.18), transparent 27rem),
    radial-gradient(circle at 91% 14%, rgba(22, 115, 231, 0.10), transparent 30rem),
    linear-gradient(180deg, #fff 0%, var(--bg) 44%, var(--bg-deep) 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(36, 135, 215, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 135, 215, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

::selection { background: rgba(53, 191, 252, 0.25); }
a {
  color: var(--blue-deep);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--blue); }
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(53, 191, 252, 0.55);
  outline-offset: 4px;
  border-radius: 7px;
}
img, svg { max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.shell { width: min(calc(100% - 40px), var(--content)); margin-inline: auto; }
.math {
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-variant-numeric: lining-nums;
}
.small-note { color: var(--muted); font-size: 0.82rem; }
.email { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }

.skip-link {
  position: fixed;
  left: 12px;
  top: 10px;
  z-index: 1000;
  transform: translateY(-170%);
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--blue);
  border-radius: 8px;
  font-weight: 750;
}
.skip-link:focus { transform: translateY(0); }

/* Header */
.site-header { padding: 23px 0 14px; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; flex: 0 1 auto; }
.brand-mark {
  width: 49px;
  height: 49px;
  object-fit: contain;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(23, 123, 209, 0.10);
}
.brand-text { display: grid; line-height: 1.15; }
.brand-name { font-size: 0.96rem; font-weight: 820; letter-spacing: 0.01em; }
.brand-project { margin-top: 4px; color: #64809a; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }
.header-tools { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
.site-nav ul { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: block;
  padding: 8px 10px;
  border-radius: 999px;
  color: #31516f;
  text-decoration: none;
  font-size: 0.77rem;
  font-weight: 760;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--blue-deep); background: rgba(53, 191, 252, 0.10); }
.lang-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
}
.lang-switch button {
  border: 0;
  border-radius: 999px;
  padding: 6px 9px;
  background: transparent;
  color: #47637d;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
}
.lang-switch button[aria-pressed="true"] { color: #fff; background: var(--blue-deep); }

/* Hero */
.hero { padding: 76px 0 54px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr); gap: 52px; align-items: center; }
.kicker, .section-label {
  margin: 0 0 12px;
  color: var(--blue-deep);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(3.25rem, 6.6vw, 6.05rem); line-height: 0.99; letter-spacing: -0.052em; }
h2, h3 { text-wrap: balance; }
.hero-lead { max-width: 760px; margin: 25px 0 0; color: #385777; font-size: 1.08rem; }
.hero-lead strong { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 29px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 780;
  font-size: 0.86rem;
}
.button-primary { color: #fff; background: linear-gradient(135deg, var(--blue-deep), var(--blue)); box-shadow: 0 10px 25px rgba(8, 117, 209, 0.22); }
.button-primary:hover { color: #fff; filter: brightness(1.04); }
.button-secondary { color: var(--blue-deep); background: #fff; border: 1px solid var(--line); }
.hero-card {
  position: relative;
  padding: 28px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.98), rgba(247, 252, 255, 0.86));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-card::after { content: ""; position: absolute; width: 230px; height: 230px; right: -90px; bottom: -120px; border-radius: 50%; background: rgba(53, 191, 252, 0.08); }
.hero-logo { display: block; width: 210px; margin: 0 auto 8px; }
.hero-card h2 { position: relative; margin: 4px 0 7px; font-size: 1.18rem; }
.hero-card p { position: relative; margin: 0; color: var(--muted); font-size: 0.89rem; }
.pill-row { position: relative; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.pill { padding: 4px 8px; border: 1px solid rgba(34, 133, 212, 0.18); border-radius: 999px; color: #285877; background: #eef9ff; font-size: 0.68rem; font-weight: 760; }

/* Sections and cards */
.section { padding: 62px 0; }
.section-tight { padding: 32px 0 46px; }
.section-head { max-width: 850px; margin-bottom: 25px; }
.section-head h2 { margin: 0; font-size: clamp(2rem, 4.4vw, 3.55rem); line-height: 1.08; letter-spacing: -0.035em; }
.section-intro { margin: 14px 0 0; color: var(--muted); max-width: 780px; }
.door-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.door-card {
  position: relative;
  display: flex;
  min-height: 255px;
  flex-direction: column;
  padding: 23px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.door-card:hover { color: var(--ink); transform: translateY(-4px); border-color: rgba(8, 117, 209, 0.34); box-shadow: 0 18px 48px rgba(28, 103, 165, 0.13); }
.door-icon { display: grid; place-items: center; width: 39px; height: 39px; margin-bottom: 30px; border-radius: 13px; color: var(--blue-deep); background: #e4f5ff; font-weight: 850; }
.door-card h3 { margin: 0; font-size: 1.08rem; line-height: 1.35; }
.door-card p { margin: 10px 0 18px; color: var(--muted); font-size: 0.87rem; }
.door-card small { margin-top: auto; color: var(--blue-deep); font-weight: 800; }
.loop-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 34px;
  align-items: center;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(232, 247, 255, 0.80));
  box-shadow: var(--shadow);
}
.loop-copy h2 { margin: 0; font-size: clamp(1.75rem, 3.4vw, 2.85rem); line-height: 1.12; letter-spacing: -0.03em; }
.loop-copy > p:not(.section-label) { color: var(--muted); }
.step-list { counter-reset: working-step; margin: 20px 0 0; padding: 0; list-style: none; }
.step-list li { counter-increment: working-step; position: relative; padding: 9px 0 9px 44px; color: #35516d; }
.step-list li::before { content: counter(working-step); position: absolute; left: 0; top: 7px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: #fff; background: var(--blue-deep); font-size: 0.75rem; font-weight: 850; }
.callout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.math-box {
  padding: 23px 24px;
  border: 1px solid rgba(53, 191, 252, 0.28);
  border-left: 5px solid var(--cyan);
  border-radius: 0 18px 18px 0;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
}
.math-box.remark { border-color: rgba(117, 87, 200, 0.23); border-left-color: var(--purple); background: rgba(250, 248, 255, 0.91); }
.math-box.warning { border-color: rgba(138, 91, 0, 0.24); border-left-color: #d39a27; background: #fffaf0; }
.math-box-label { margin-bottom: 7px; color: var(--blue-deep); font-family: "Cambria Math", Georgia, serif; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.05em; }
.math-box.remark .math-box-label { color: #6545b0; }
.math-box h3 { margin: 0; font-size: 1.1rem; }
.math-box p { margin: 10px 0 0; color: #405d77; font-size: 0.91rem; }
.feature-card {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
  gap: 28px;
  align-items: center;
  overflow: hidden;
  padding: 26px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}
.feature-card > img { width: 100%; border-radius: 18px; background: #081f42; }
.feature-copy h2 { margin: 4px 0 10px; font-size: clamp(1.6rem, 3.2vw, 2.55rem); line-height: 1.12; }
.feature-copy p { color: var(--muted); }
.meta-line { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.meta-chip { padding: 4px 8px; border: 1px solid var(--soft-line); border-radius: 999px; color: #315c78; background: #f2fbff; font-size: 0.72rem; font-weight: 760; }
.status-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--teal); font-size: 0.76rem; font-weight: 850; }
.status-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #27a78f; box-shadow: 0 0 0 4px rgba(39, 167, 143, 0.12); }

/* Subpages */
.subpage-hero { padding: 55px 0 29px; }
.breadcrumbs { margin-bottom: 20px; color: var(--muted); font-size: 0.82rem; }
.breadcrumbs a { color: var(--muted); }
.subpage-title { font-size: clamp(2.65rem, 5.8vw, 5.05rem); line-height: 1.02; overflow-wrap: anywhere; }
.page-lead { max-width: 820px; margin-top: 20px; color: #3a5878; font-size: 1.08rem; }
.content-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 42px; align-items: start; }
.toc { position: sticky; top: 20px; padding: 18px; background: rgba(255, 255, 255, 0.80); border: 1px solid var(--soft-line); border-radius: 16px; }
.toc h2 { margin: 0 0 10px; font-size: 0.8rem; letter-spacing: 0.09em; text-transform: uppercase; }
.toc ul { margin: 0; padding: 0; list-style: none; }
.toc li + li { margin-top: 4px; }
.toc a { display: block; padding: 5px 7px; color: var(--muted); text-decoration: none; border-radius: 7px; font-size: 0.8rem; line-height: 1.45; }
.toc a:hover { color: var(--blue-deep); background: rgba(53, 191, 252, 0.08); }
.prose-section { padding: 31px 0; border-top: 1px solid var(--soft-line); }
.prose-section:first-child { border-top: 0; padding-top: 0; }
.prose-section h2 { margin: 0 0 14px; font-size: clamp(1.45rem, 3vw, 2.25rem); }
.prose-section h3 { margin: 28px 0 10px; font-size: 1.13rem; }
.prose-section p, .prose-section li { color: #38536f; }
.big-opening { color: #263f5c !important; font-size: 1.15rem; line-height: 1.82; }
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--soft-line); border-radius: 15px; background: rgba(255, 255, 255, 0.82); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 12px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--soft-line); }
tr:first-child th, tr:first-child td { border-top: 0; }
th { width: 29%; color: #31516f; background: rgba(235, 247, 255, 0.60); font-weight: 750; }
td { color: #425c75; }

/* Start page */
.quick-route { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; counter-reset: quick; }
.quick-step { counter-increment: quick; position: relative; min-height: 205px; padding: 54px 21px 21px; background: rgba(255, 255, 255, 0.86); border: 1px solid var(--soft-line); border-radius: 18px; box-shadow: var(--shadow-soft); }
.quick-step::before { content: counter(quick, decimal-leading-zero); position: absolute; left: 20px; top: 17px; color: var(--blue-deep); font-family: "Cambria Math", Georgia, serif; font-weight: 850; }
.quick-step h3 { margin: 0; font-size: 1rem; line-height: 1.42; }
.quick-step p { margin: 9px 0 0; color: var(--muted); font-size: 0.87rem; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 27px 0; }
.photo-card { margin: 0; overflow: hidden; background: rgba(255, 255, 255, 0.86); border: 1px solid var(--soft-line); border-radius: 18px; box-shadow: var(--shadow-soft); }
.photo-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e7f3fb; }
.photo-card figcaption { padding: 13px 15px 15px; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.timeline { position: relative; margin: 24px 0; padding-left: 31px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--blue), rgba(53, 191, 252, 0.2)); }
.timeline-item { position: relative; padding: 0 0 28px 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -27px; top: 0.55em; width: 13px; height: 13px; border: 3px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px rgba(8, 117, 209, 0.24); }
.timeline-item h3 { margin: 0; font-size: 1.07rem; }
.timeline-item p { margin: 7px 0 0; color: var(--muted); }
.software-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.software-card { padding: 21px; background: rgba(255, 255, 255, 0.84); border: 1px solid var(--soft-line); border-radius: 17px; }
.software-card h3 { margin: 0 0 7px; font-size: 1.02rem; }
.software-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.details-stack { display: grid; gap: 12px; margin-top: 18px; }
details { border: 1px solid var(--soft-line); border-radius: 14px; background: rgba(255, 255, 255, 0.76); }
summary { cursor: pointer; padding: 15px 18px; color: #254b6d; font-weight: 790; }
summary::marker { color: var(--blue); }
.details-body { padding: 0 18px 17px; color: var(--muted); }
.details-body p:first-child { margin-top: 0; }
.code-prompt { margin: 16px 0; padding: 17px 19px; overflow-x: auto; color: #173f63; background: #f4faff; border: 1px solid var(--soft-line); border-radius: 14px; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; white-space: pre-wrap; }
.purpose { color: var(--teal); font-weight: 820; }

/* Gallery and visualization */
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.gallery-card { overflow: hidden; background: rgba(255, 255, 255, 0.88); border: 1px solid var(--soft-line); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.gallery-card > img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #082348; }
.gallery-card-body { padding: 22px; }
.gallery-card h2, .gallery-card h3 { margin: 4px 0 9px; }
.gallery-card p { color: var(--muted); }
.gallery-card.primary { grid-column: span 2; display: grid; grid-template-columns: minmax(310px, 0.9fr) minmax(0, 1.1fr); align-items: center; }
.gallery-card.primary > img { height: 100%; aspect-ratio: auto; }
.legend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin: 17px 0; }
.legend-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; padding: 13px; background: rgba(255, 255, 255, 0.72); border: 1px solid var(--soft-line); border-radius: 12px; }
.legend-item strong { display: block; }
.legend-item p { margin: 3px 0 0; font-size: 0.82rem; }
.swatch { display: block; width: 18px; height: 18px; margin-top: 4px; border-radius: 50%; border: 1px solid rgba(16, 33, 63, 0.17); }
.swatch.white { background: #fff; box-shadow: inset 0 0 0 1px #7797aa; }
.swatch.purple { background: #9667e7; }
.swatch.rainbow { background: conic-gradient(#ef5350, #f4c542, #4cc9a2, #4a8de3, #9b5de5, #ef5350); }
.swatch.critical { background: #ff6b4a; box-shadow: 0 0 0 4px rgba(255, 107, 74, 0.13); }

/* People and references */
.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.person-card { padding: 23px; background: rgba(255, 255, 255, 0.86); border: 1px solid var(--soft-line); border-radius: 18px; box-shadow: var(--shadow-soft); }
.person-card.primary { border-color: rgba(8, 117, 209, 0.27); background: linear-gradient(145deg, #fff, #eef9ff); }
.person-monogram { display: grid; place-items: center; width: 51px; height: 51px; margin-bottom: 16px; border-radius: 16px; color: #fff; background: linear-gradient(145deg, var(--blue-deep), var(--blue)); font-weight: 850; }
.person-card h2, .person-card h3 { margin: 0; }
.person-role { margin: 6px 0 9px; color: var(--blue-deep); font-size: 0.78rem; font-weight: 820; letter-spacing: 0.04em; text-transform: uppercase; }
.person-card p { color: var(--muted); }
.contact-card { margin-top: 20px; padding: 27px; color: #fff; background: linear-gradient(135deg, #063f83, #0875d1); border-radius: var(--radius-xl); box-shadow: 0 20px 58px rgba(6, 75, 168, 0.20); }
.contact-card h2 { margin: 0; }
.contact-card p { color: rgba(255, 255, 255, 0.88); }
.contact-card .email { display: inline-block; margin-top: 4px; padding: 8px 11px; color: #fff; background: rgba(255, 255, 255, 0.13); border: 1px solid rgba(255, 255, 255, 0.27); border-radius: 10px; }
.source-list { display: grid; gap: 10px; margin: 18px 0; padding: 0; list-style: none; }
.source-list li { display: grid; grid-template-columns: minmax(180px, 0.36fr) minmax(0, 0.64fr); gap: 16px; padding: 14px 16px; background: rgba(255, 255, 255, 0.75); border: 1px solid var(--soft-line); border-radius: 13px; }
.source-list span { color: var(--muted); font-size: 0.84rem; }
.version-badge { display: inline-block; padding: 4px 8px; border-radius: 999px; color: var(--blue-deep); background: #e6f7ff; font-size: 0.72rem; font-weight: 800; }

/* Footer */
.site-footer { margin-top: 60px; padding: 38px 0 52px; border-top: 1px solid var(--soft-line); background: rgba(237, 248, 255, 0.58); }
.footer-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 36px; }
.footer-title { margin: 0; font-weight: 820; }
.footer-copy, .footer-small { color: var(--muted); }
.footer-copy { margin: 8px 0 0; font-size: 0.86rem; }
.footer-small { margin: 15px 0 0; font-size: 0.74rem; line-height: 1.65; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: start; gap: 8px 15px; }
.footer-links a { font-size: 0.82rem; }
.version { margin-top: 22px; color: #536982; font-size: 0.75rem; }

@media (max-width: 1040px) {
  .header-row { align-items: flex-start; }
  .header-tools { align-items: flex-end; flex-direction: column-reverse; gap: 8px; }
  .site-nav ul { max-width: 560px; }
  .door-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .door-card { min-height: 225px; }
}
@media (max-width: 920px) {
  .hero-grid, .loop-panel, .feature-card { grid-template-columns: 1fr; }
  .hero-card { max-width: 540px; }
  .content-layout { grid-template-columns: 1fr; }
  .toc { position: static; order: -1; }
  .quick-route { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-card.primary { grid-template-columns: 1fr; }
  .gallery-card.primary > img { aspect-ratio: 16 / 9; }
}
@media (max-width: 760px) {
  .shell { width: min(calc(100% - 26px), var(--content)); }
  .site-header { padding-top: 17px; }
  .header-row { display: block; }
  .header-tools { margin-top: 14px; align-items: stretch; flex-direction: column-reverse; }
  .site-nav { overflow-x: auto; padding-bottom: 4px; }
  .site-nav ul { flex-wrap: nowrap; justify-content: flex-start; width: max-content; max-width: none; }
  .lang-switch { align-self: flex-end; }
  .hero { padding-top: 43px; }
  h1 { font-size: clamp(2.62rem, 13.5vw, 4.25rem); }
  .subpage-title { font-size: clamp(2.45rem, 12vw, 4rem); }
  .callout-grid, .photo-grid, .software-grid, .people-grid, .gallery-grid, .legend-grid { grid-template-columns: 1fr; }
  .gallery-card.primary { grid-column: auto; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .source-list li { grid-template-columns: 1fr; gap: 5px; }
  th { width: 38%; }
}
@media (max-width: 560px) {
  .brand-project { display: none; }
  .door-grid, .quick-route { grid-template-columns: 1fr; }
  .door-card { min-height: 205px; }
  .hero-card, .loop-panel, .feature-card { padding: 21px; }
  .hero-logo { width: 170px; }
  .photo-card img { aspect-ratio: 16 / 11; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* v0.3.2: related-work bridge and beginner page map */
.precedent-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 24px;
  align-items: stretch;
  padding: 30px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(237, 249, 255, 0.88));
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}
.precedent-copy h2 { margin: 0 0 13px; font-size: clamp(1.65rem, 3.4vw, 2.7rem); line-height: 1.12; }
.precedent-copy p { color: #405d77; }
.precedent-links { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.precedent-links .button { padding: 9px 13px; font-size: 0.78rem; }
.precedent-aim { height: 100%; }

.section-head.compact { margin-bottom: 18px; }
.section-head.compact h2 { font-size: clamp(1.65rem, 3.6vw, 2.75rem); }
.start-map-panel {
  padding: 28px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}
.start-map { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.start-map a {
  display: grid;
  align-content: start;
  min-height: 145px;
  padding: 16px;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(145deg, #fff, #f2faff);
  border: 1px solid var(--soft-line);
  border-radius: 15px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.start-map a:hover { transform: translateY(-2px); border-color: var(--line); box-shadow: var(--shadow-soft); }
.start-map-number { color: var(--blue-deep); font-family: "Cambria Math", Georgia, serif; font-size: 0.79rem; font-weight: 850; }
.start-map strong { margin-top: 7px; font-size: 0.92rem; line-height: 1.38; }
.start-map small { margin-top: 8px; color: var(--muted); font-size: 0.73rem; line-height: 1.5; }
.acknowledgement-box { border-left-color: var(--teal); background: rgba(244, 253, 250, 0.91); }
.acknowledgement-box .math-box-label { color: var(--teal); }

@media (max-width: 1040px) {
  .start-map { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .precedent-panel { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .precedent-panel, .start-map-panel { padding: 21px; }
  .start-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .start-map { grid-template-columns: 1fr; }
  .start-map a { min-height: 0; }
  .precedent-links .button { width: 100%; justify-content: center; }
}

/* v0.3.2 header polish: keep the desktop navigation on one line and avoid a clipped mobile item. */
.site-nav ul { flex-wrap: nowrap; }
.lang-switch button { white-space: nowrap; }
.brand-project {
  max-width: 430px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 760px) {
  .site-nav { overflow: visible; }
  .site-nav ul {
    flex-wrap: wrap;
    width: auto;
    max-width: none;
    row-gap: 3px;
  }
}
@media (max-width: 1040px) {
  .brand-project { display: none; }
}

/* v0.4.0: four-step beginner route, centrally generated content and project nickname */
.welcome-panel {
  padding: 32px;
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(235,248,255,.9));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.welcome-panel h2 { margin: 0; max-width: 900px; font-size: clamp(1.75rem, 3.8vw, 3rem); line-height: 1.12; letter-spacing: -.03em; }
.welcome-panel > p:not(.section-label) { max-width: 900px; color: #3d5b77; }
.four-step-map { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; margin-top: 24px; }
.four-step-map a { display: grid; min-height: 112px; align-content: start; padding: 16px; color: var(--ink); text-decoration: none; background: rgba(255,255,255,.88); border: 1px solid var(--soft-line); border-radius: 16px; transition: transform .16s ease,border-color .16s ease,box-shadow .16s ease; }
.four-step-map a:hover { color: var(--ink); transform: translateY(-2px); border-color: var(--line); box-shadow: var(--shadow-soft); }
.four-step-map a > span { color: var(--blue-deep); font-family: "Cambria Math", Georgia, serif; font-size: .78rem; font-weight: 850; }
.four-step-map strong { margin-top: 8px; font-size: .93rem; line-height: 1.4; }

.step-section { scroll-margin-top: 18px; }
.step-heading { display: grid; grid-template-columns: 78px minmax(0,1fr); gap: 18px; align-items: start; margin-bottom: 18px; }
.step-number { display: grid; place-items: center; min-height: 66px; padding: 10px; color: #fff; background: linear-gradient(145deg,var(--blue-deep),var(--blue)); border-radius: 19px; box-shadow: 0 12px 28px rgba(8,117,209,.19); font-family: "Cambria Math", Georgia, serif; font-weight: 850; }
.step-heading h2 { margin: 0; font-size: clamp(2rem,4.4vw,3.55rem); line-height: 1.08; letter-spacing: -.035em; }
.reason-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin: 26px 0; }
.reason-card { position: relative; padding: 23px 23px 23px 68px; background: rgba(255,255,255,.86); border: 1px solid var(--soft-line); border-radius: 18px; box-shadow: var(--shadow-soft); }
.reason-index { position: absolute; left: 20px; top: 21px; display: grid; place-items: center; width: 31px; height: 31px; color: #fff; background: var(--blue-deep); border-radius: 10px; font-weight: 850; }
.reason-card h3 { margin: 0; font-size: 1.08rem; }
.reason-card p { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }

.account-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 25px 0; }
.account-card { position: relative; padding: 50px 21px 22px; background: rgba(255,255,255,.88); border: 1px solid var(--soft-line); border-radius: 18px; box-shadow: var(--shadow-soft); }
.account-index { position: absolute; left: 20px; top: 17px; color: var(--blue-deep); font-family: "Cambria Math",Georgia,serif; font-weight: 850; }
.account-card h3 { margin: 0; font-size: 1.04rem; }
.account-card p { color: var(--muted); font-size: .88rem; }
.account-card a { font-size: .82rem; font-weight: 800; }

.setup-list { counter-reset: setup-task; display: grid; gap: 11px; margin: 26px 0; padding: 0; list-style: none; }
.setup-task { counter-increment: setup-task; display: grid; grid-template-columns: 46px minmax(0,1fr); gap: 13px; align-items: start; padding: 17px 18px; background: rgba(255,255,255,.84); border: 1px solid var(--soft-line); border-radius: 15px; }
.setup-task::before { content: counter(setup-task,decimal-leading-zero); display: grid; place-items: center; width: 36px; height: 36px; color: var(--blue-deep); background: #e7f7ff; border-radius: 11px; font-family: "Cambria Math",Georgia,serif; font-size: .78rem; font-weight: 850; }
.setup-task strong { color: #203f5f; }
.setup-task p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }
.optional-detour { padding: 20px; background: rgba(247,253,251,.9); border: 1px solid rgba(22,122,104,.18); border-radius: 18px; }
.mini-warning { margin-top: 12px; padding: 11px 13px; color: #4b5361; background: rgba(255,255,255,.78); border: 1px solid var(--soft-line); border-radius: 12px; font-size: .83rem; }
.tip-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 28px 0; }
.tip-card { padding: 20px; background: rgba(255,255,255,.85); border: 1px solid var(--soft-line); border-radius: 17px; box-shadow: var(--shadow-soft); }
.tip-card h3 { margin: 0; font-size: 1.04rem; }
.tip-card p { margin: 8px 0 0; color: var(--muted); font-size: .88rem; }
.completion-panel { margin-top: 30px; padding: 30px; background: linear-gradient(135deg,#063f83,#0875d1); border-radius: var(--radius-xl); box-shadow: 0 20px 58px rgba(6,75,168,.2); color: #fff; }
.completion-panel .section-label { color: #bfeaff; }
.completion-panel h2 { margin: 0; max-width: 930px; font-size: clamp(1.65rem,3.6vw,2.9rem); line-height: 1.13; }
.completion-panel p { max-width: 900px; color: rgba(255,255,255,.88); }
.completion-panel .button-primary { color: var(--blue-deep); background: #fff; box-shadow: none; }

.notation-box { border-left-color: var(--teal); background: linear-gradient(145deg,rgba(247,254,252,.96),rgba(239,249,255,.94)); }
.notation-box .math-box-label { color: var(--teal); }
.notation-line { line-height: 1.55; }
.gallery-card-mark { display: grid; min-height: 260px; place-items: center; align-content: center; gap: 19px; padding: 32px; overflow: hidden; text-align: center; background: radial-gradient(circle at 50% 35%,rgba(255,255,255,.96),rgba(225,244,255,.9)); }
.gallery-card-mark > .math { position: relative; z-index: 2; padding: 8px 12px; color: #153b63; background: rgba(255,255,255,.78); border: 1px solid rgba(28,112,185,.15); border-radius: 999px; font-size: clamp(1rem,2.2vw,1.35rem); font-weight: 700; }
.gallery-card-mark small { position: relative; z-index: 2; color: #58718a; font-size: .7rem; }
.slice-family-mark { position: relative; background: linear-gradient(145deg,#e9f8ff,#fff7f7); }
.slice-lines { position: relative; z-index: 1; display: block; width: min(92%,520px); height: 105px; border-radius: 50%; background:
  radial-gradient(ellipse at 22% 45%,transparent 0 17%,rgba(58,120,223,.8) 18% 19%,transparent 20% 100%),
  radial-gradient(ellipse at 50% 57%,transparent 0 20%,rgba(255,255,255,.95) 21% 23%,transparent 24% 100%),
  radial-gradient(ellipse at 78% 45%,transparent 0 17%,rgba(222,74,92,.78) 18% 19%,transparent 20% 100%),
  linear-gradient(90deg,#387adf,#6f8ce2,#b66db9,#df5366);
  mask: repeating-linear-gradient(0deg,#000 0 3px,transparent 3px 9px);
  filter: drop-shadow(0 8px 12px rgba(36,100,171,.18));
}
.gallery-card.primary > .gallery-card-mark { height: 100%; min-height: 330px; }

.people-table table { min-width: 820px; }
.people-table th:first-child { width: 22%; }
.people-table th:nth-child(2) { width: 25%; }
.people-table td { vertical-align: top; }
.contact-card .contact-link { color: #fff; font-weight: 800; }

.development-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin: 18px 0; align-items: stretch; }
.development-card { padding: 20px; background: rgba(255,255,255,.82); border: 1px solid var(--soft-line); border-radius: 17px; }
.development-date { color: var(--blue-deep); font-family: "Cambria Math",Georgia,serif; font-size: .78rem; font-weight: 850; }
.development-card h3 { margin: 8px 0 0; }
.development-card p { margin-bottom: 0; }
.case-visual { min-height: 280px; border: 1px solid var(--soft-line); border-radius: 18px; }

@media (max-width: 920px) {
  .four-step-map { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .account-grid { grid-template-columns: 1fr; }
  .people-table table { min-width: 720px; }
}
@media (max-width: 760px) {
  .welcome-panel,.completion-panel { padding: 22px; }
  .step-heading { grid-template-columns: 1fr; gap: 12px; }
  .step-number { min-height: 0; width: max-content; padding: 8px 13px; border-radius: 999px; }
  .reason-grid,.tip-grid,.development-grid { grid-template-columns: 1fr; }
  .reason-card { padding-left: 61px; }
  .gallery-card.primary > .gallery-card-mark { min-height: 255px; }
}
@media (max-width: 560px) {
  .four-step-map { grid-template-columns: 1fr; }
  .four-step-map a { min-height: 0; }
  .setup-task { grid-template-columns: 38px minmax(0,1fr); padding: 15px; }
  .setup-task::before { width: 31px; height: 31px; }
  .gallery-card-mark { min-height: 230px; padding: 22px; }
}
.setup-link { display: inline-block; margin-top: 7px; font-size: .78rem; font-weight: 800; }

/* v0.4.1: project-based visualization pages and the slice-family feature */
.feature-card figure { margin: 0; overflow: hidden; border: 1px solid var(--soft-line); border-radius: 18px; background: #081f42; }
.feature-card figure img { display: block; width: 100%; height: auto; }
.feature-card figure figcaption { padding: 11px 14px 13px; color: #4f6a83; background: rgba(255,255,255,.96); font-size: .76rem; line-height: 1.5; }
.math-display { margin: 18px 0; padding: 16px 20px; text-align: center; background: rgba(242,251,255,.86); border: 1px solid var(--soft-line); border-radius: 14px; font-size: clamp(1.08rem,2.4vw,1.38rem); }
@media (max-width: 760px) {
  .feature-card figure { width: 100%; }
}

/* Visualization cards: stack image and text safely on narrow screens. */
@media (max-width: 920px) {
  .gallery-card.primary {
    display: block;
  }

  .gallery-card.primary > img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
  }
}

/* 2026-09-06: compact mobile header, visible language controls, Notes link.
   Only the header changes; existing content and gallery fixes stay untouched. */
.site-header .menu-toggle { display: none; }
.site-header .language-full { display: none; }
.site-header .header-tools > .site-nav { order: 1; }
.site-header .header-tools > .lang-switch { order: 2; }
.site-header .brand { min-width: 0; }
.site-header .brand-text { min-width: 0; }
.site-header .brand-mark { flex-shrink: 0; }

/* Allow the extra link to wrap at intermediate desktop/tablet widths. */
@media (min-width: 761px) and (max-width: 1100px) {
  .site-header .site-nav ul { flex-wrap: wrap; width: auto; }
}
@media (max-width: 760px) {
  .site-header { padding: 10px 0 8px; }
  .site-header .brand { display: none; }
  .site-header .header-row { display: block; }
  .site-header .header-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 0;
    align-items: center;
    width: 100%;
  }
  .site-header .lang-switch {
    grid-column: 1; grid-row: 1;
    justify-self: start; align-self: center;
    width: max-content; max-width: 100%;
  }
  .site-header .language-short { display: none; }
  .site-header .language-full { display: inline; }
  .site-header .lang-switch button {
    min-height: 44px; padding: 6px 12px; font-size: 0.875rem;
  }
  .site-header.nav-ready .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    grid-column: 2; grid-row: 1;
    min-height: 48px; padding: 7px 13px;
    border: 1px solid var(--line); border-radius: 14px;
    background: rgba(255, 255, 255, .90); color: var(--blue-deep);
    font-size: .875rem; font-weight: 760; cursor: pointer;
  }
  .site-header .menu-close-label { display: none; }
  .site-header .menu-toggle[aria-expanded="true"] .menu-open-label { display: none; }
  .site-header .menu-toggle[aria-expanded="true"] .menu-close-label { display: inline; }
  .site-header .site-nav {
    grid-column: 1 / -1; grid-row: 2;
    overflow: visible; width: 100%; padding: 8px 0 2px;
    border-top: 1px solid var(--soft-line);
  }
  .site-header.nav-ready:not([data-menu-open]) .site-nav { display: none; }
  .site-header .site-nav ul {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px; width: 100%; max-width: none;
  }
  .site-header .site-nav a {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 10px 8px;
    border: 1px solid var(--soft-line); border-radius: 12px;
    background: rgba(255, 255, 255, .88);
    text-align: center; white-space: normal; line-height: 1.5; font-size: .85rem;
  }
  .site-header .site-nav a:hover,
  .site-header .site-nav a[aria-current="page"] {
    background: rgba(53, 191, 252, .12); border-color: var(--line);
  }
}


/* 2026-09-06 nav2: fail-safe for the responsive menu.
   The button is hidden in HTML and JavaScript reveals it only on small screens. */
.site-header .menu-toggle[hidden] {
  display: none !important;
}
