:root {
  --bg: #060c16;
  --bg-2: #0a1422;
  --bg-3: #0f1c2e;
  --grid: rgba(125, 175, 215, .055);
  --grid-major: rgba(125, 175, 215, .11);
  --line: rgba(150, 190, 225, .22);
  --line-strong: rgba(160, 205, 235, .45);
  --ink: #e6edf3;
  --ink-2: #a3b3c3;
  --ink-3: #6a7d90;
  --blue: #9bc9db;
  --blue-deep: #4f9dc4;
  --green: #5fae76;
  --paper: #eef2f5;
  --header-h: 64px;
  --ease: cubic-bezier(.76, 0, .24, 1);
  --sans: "Noto Sans JP", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: .02em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before, .page.doc {
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.page.doc {
  background-color: var(--bg);
  background-position: 0 calc(-1 * var(--header-h));
}
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 1px solid var(--blue); outline-offset: 3px; }
.mono { font-family: var(--mono); letter-spacing: .06em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== header ===== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  background: rgba(6, 12, 22, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; text-decoration: none; flex: none; }
.brand svg { width: 176px; height: 48px; display: block; }
.brand-name { font-size: 11px; color: var(--ink-3); margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--line); line-height: 1.4; }

.nav { display: flex; align-items: stretch; height: 100%; margin-left: auto; }
.nav-item { position: relative; display: flex; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 16px;
  font: 500 13px/1 var(--sans);
  letter-spacing: .06em;
  color: var(--ink-2);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  position: relative;
}
.nav-link:hover, .nav-link[aria-expanded="true"], .nav-link.is-current { color: var(--ink); }
.nav-link.is-current::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: -1px;
  height: 2px;
  background: var(--blue);
}
.nav-link svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.nav-panel {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  min-width: 300px;
  padding: 10px 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-top-color: var(--blue);
  display: none;
}
.nav-item.is-open .nav-panel { display: block; }
.nav-panel a {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: baseline;
  padding: 9px 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.nav-panel a:hover, .nav-panel a:focus-visible { color: var(--ink); background: var(--bg-3); }
.nav-panel .mono { font-size: 10px; color: var(--ink-3); }

.header-meta { font: 11px/1.3 var(--mono); color: var(--ink-3); text-align: right; flex: none; letter-spacing: .08em; }
.header-meta b { display: block; color: var(--ink-2); font-weight: 500; }

.menu-button { display: none; margin-left: auto; width: 44px; height: 44px; background: none; border: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.menu-button svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.5; fill: none; }

/* ===== view / transition ===== */
.view { position: fixed; inset: var(--header-h) 0 0 0; }
.page { position: absolute; inset: 0; }
.page:not(.is-active):not(.is-leaving) { display: none; }
.page.is-active { z-index: 1; }
.draft-frame { position: fixed; top: var(--header-h); left: 0; width: 100vw; height: calc(100vh - var(--header-h)); pointer-events: none; z-index: 30; }
.draft-frame line { stroke: var(--blue); stroke-width: 1; vector-effect: non-scaling-stroke; }

@media (max-width: 900px) {
  .site-header { padding: 0 16px; gap: 12px; }
  .brand svg { width: 150px; height: 41px; }
  .brand-name, .header-meta { display: none; }
  .menu-button { display: grid; place-items: center; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    height: auto;
    max-height: calc(100vh - var(--header-h));
    overflow: auto;
    flex-direction: column;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav-item { flex-direction: column; }
  .nav-link { height: 52px; padding: 0 20px; border-top: 1px solid var(--line); }
  .nav-link.is-current::after { left: 0; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
  .nav-panel { position: static; display: block; border: 0; padding: 0 0 8px; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
