:root {
  --ink: #17191e;
  --ink-soft: #363940;
  --paper: #ffffff;
  --fog: #f5f5f4;
  --line: #e7e7e4;
  --line-strong: #c9c9c6;
  --muted: #545862;
  --on-dark: #f5f5f4;
  --on-dark-muted: #c7c8ca;
  --gas-blue: #5fa8ff;
  --gas-purple: #9b7cff;
  --gas-sky: #bfe8ff;
  --radius-card: 14px;
  --radius-panel: 24px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "tnum" 0, "ss01" 0, "zero" 0;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body.drawer-open { overflow: hidden; }
a { color: inherit; text-underline-offset: 0.24em; }
button { font: inherit; }
img { display: block; max-width: 100%; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: -5rem;
  left: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}
.skip-link:focus { top: 1rem; }

.mobile-header, .drawer-backdrop { display: none; }
.app-shell { display: grid; grid-template-columns: 276px minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 36px 28px 28px;
  border-right: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand { display: inline-block; width: 148px; padding: 8px 0; }
.sidebar-title { margin: 30px 0 18px; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.sidebar nav { display: grid; }
.sidebar nav a {
  position: relative;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.3rem;
  align-items: center;
  padding: 0.72rem 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.sidebar nav a::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--ink);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.sidebar nav a:hover::after, .sidebar nav a:focus-visible::after, .sidebar nav a[aria-current="location"]::after { transform: scaleX(1); }
.sidebar nav a[aria-current="location"] { color: var(--ink); }
.sidebar nav span { font-size: 0.7rem; font-weight: 500; color: #737780; }
.sidebar-note { margin: auto 0 0; color: var(--muted); font-size: 0.75rem; }

main { min-width: 0; overflow: hidden; }
.section, .hero { scroll-margin-top: 20px; }
.section-inner { width: min(1240px, calc(100% - 96px)); margin: 0 auto; }
.hero { min-height: 88vh; display: grid; align-items: center; padding: 96px 0 72px; }
.section { padding: 112px 0; border-top: 1px solid var(--line); }
.section--fog { background: var(--fog); }
.section--ink { background: var(--ink); color: var(--on-dark); }
.section-label { margin: 0 0 20px; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; }
.section--ink .section-label { color: var(--on-dark-muted); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.16; }
h1 { margin-bottom: 30px; max-width: 11ch; font-size: clamp(3.4rem, 7.6vw, 7.5rem); font-weight: 850; letter-spacing: -0.075em; }
h1 em {
  font-style: normal;
  color: transparent;
  background: linear-gradient(90deg, var(--gas-blue), var(--gas-purple), var(--gas-sky));
  background-clip: text;
  -webkit-background-clip: text;
}
h2 { margin-bottom: 20px; max-width: 16ch; font-size: clamp(2.25rem, 4.5vw, 4.75rem); font-weight: 820; letter-spacing: -0.055em; }
h3 { font-size: 1.22rem; letter-spacing: -0.02em; }
.hero-copy, .section-lead { max-width: 720px; color: var(--muted); font-size: 1.05rem; }
.section--ink .section-lead { color: var(--on-dark-muted); }
.hero-copy { margin-bottom: 44px; }

.workflow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 920px;
  margin: 0 0 42px;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}
.workflow li { padding: 14px 24px 0 0; }
.workflow span, .workflow b, .workflow small { display: block; }
.workflow span { margin-bottom: 10px; color: var(--muted); font-size: 0.72rem; }
.workflow b { font-size: 0.96rem; }
.workflow small { margin-top: 5px; color: var(--muted); font-size: 0.76rem; }
.primary-action, .secondary-action {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.primary-action:hover, .primary-action:focus-visible { background: var(--paper); color: var(--ink); }

.system-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 50px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.system-flow li { min-height: 230px; padding: 22px 18px; border-right: 1px solid var(--line); }
.system-flow li:last-child { border-right: 0; background: var(--ink); color: var(--paper); }
.system-flow span, .system-flow b, .system-flow small { display: block; }
.system-flow span { margin-bottom: 32px; color: var(--muted); font-size: 0.72rem; }
.system-flow li:last-child span, .system-flow li:last-child small, .system-flow li:last-child p { color: var(--on-dark-muted); }
.system-flow b { margin-bottom: 4px; font-size: 1rem; }
.system-flow small { min-height: 3.4em; color: var(--muted); font-size: 0.66rem; line-height: 1.45; }
.system-flow p { margin: 22px 0 0; color: var(--muted); font-size: 0.78rem; }

.layer-stack { display: grid; gap: 10px; max-width: 920px; margin: 50px auto 0; }
.layer {
  display: grid;
  grid-template-columns: 70px minmax(150px, 0.8fr) 2fr;
  align-items: center;
  min-height: 76px;
  padding: 16px 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--paper);
}
.layer span { color: var(--muted); font-size: 0.72rem; }
.layer b { font-size: 1rem; }
.layer p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.layer--output { min-height: 92px; border-radius: var(--radius-panel); background: var(--ink); color: var(--paper); }
.layer--output span, .layer--output p { color: var(--on-dark-muted); }
.layer--foundation { border: 2px solid var(--ink); background: transparent; filter: grayscale(1); }

.pack-principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 46px; }
.pack-principles article { min-height: 240px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-panel); }
.pack-principles span { display: block; margin-bottom: 52px; color: var(--muted); font-size: 0.72rem; }
.pack-principles h3 { margin-bottom: 14px; font-size: 1.8rem; }
.pack-principles p { margin-bottom: 0; color: var(--muted); font-size: 0.9rem; }
.pack-summary { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-top: 24px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--fog); }
.pack-summary span { color: var(--muted); font-size: 0.72rem; }
.pack-summary p { margin: 5px 0 0; font-size: 0.88rem; font-weight: 650; }

.deck-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 48px; }
.deck-card { display: flex; min-width: 0; flex-direction: column; padding: 14px; border: 1px solid #42444a; border-radius: var(--radius-card); background: #202228; }
.deck-preview { position: relative; aspect-ratio: 16 / 9; margin-bottom: 22px; padding: 18px; overflow: hidden; border-radius: 8px; background: var(--paper); color: var(--ink); }
.deck-preview::before { position: absolute; inset: 0 0 auto; height: 4px; background: var(--gas-blue); content: ""; }
.deck-preview span { display: block; margin-bottom: 22px; font-size: 0.72rem; font-weight: 800; }
.deck-preview i { display: block; width: 78%; height: 5px; margin: 8px 0; background: var(--ink); }
.deck-preview i:nth-of-type(2) { width: 58%; }
.deck-preview i:nth-of-type(3) { width: 38%; background: var(--line-strong); }
.deck-card > div:nth-child(2) { min-height: 142px; }
.deck-card small { color: var(--on-dark-muted); font-size: 0.72rem; }
.deck-card h3 { margin: 7px 0 10px; font-size: 1.04rem; }
.deck-card p { margin: 0; color: var(--on-dark-muted); font-size: 0.78rem; }
.deck-card a { position: relative; margin-top: auto; padding: 14px 0 6px; color: var(--paper); font-size: 0.82rem; font-weight: 700; text-decoration: none; border-top: 1px solid #42444a; }
.deck-card a::after { float: right; content: "→"; }
.deck-card a:hover, .deck-card a:focus-visible { text-decoration: underline; }

.reference-list { margin: 46px 0 0; padding: 0; list-style: none; border-top: 2px solid var(--ink); }
.reference-list li { display: grid; grid-template-columns: 150px 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line-strong); }
.reference-list > li > span { font-size: 0.8rem; font-weight: 750; }
.reference-list a, .reference-list strong { font-size: 0.96rem; font-weight: 750; }
.reference-list p { margin: 5px 0 0; color: var(--muted); font-size: 0.82rem; }
footer { padding: 26px 0; border-top: 1px solid var(--line); }
footer p { margin: 0; color: var(--muted); font-size: 0.76rem; }

:focus-visible { outline: 3px solid var(--gas-blue); outline-offset: 4px; }

@media (max-width: 1120px) {
  .system-flow { grid-template-columns: repeat(3, 1fr); }
  .system-flow li:nth-child(3) { border-right: 0; }
  .system-flow li:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .deck-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .mobile-header {
    position: fixed;
    z-index: 60;
    inset: 0 0 auto;
    height: 64px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .mobile-header img { width: 126px; }
  .drawer-trigger { min-height: 40px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 4px; background: var(--paper); color: var(--ink); font-size: 0.8rem; font-weight: 700; }
  .drawer-backdrop { position: fixed; z-index: 40; inset: 64px 0 0; border: 0; background: rgba(23, 25, 30, 0.48); }
  .drawer-backdrop:not([hidden]) { display: block; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    z-index: 50;
    top: 64px;
    bottom: 0;
    left: 0;
    width: min(86vw, 330px);
    height: auto;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease), visibility 0s linear 0.25s;
  }
  .sidebar.is-open { visibility: visible; pointer-events: auto; transform: translateX(0); transition-delay: 0s; }
  .sidebar .brand { display: none; }
  main { padding-top: 64px; }
  .hero { min-height: calc(100vh - 64px); }
  .section-inner { width: min(100% - 48px, 760px); }
  .section { padding: 82px 0; }
}

@media (max-width: 620px) {
  .section-inner { width: min(100% - 36px, 560px); }
  .hero { padding: 68px 0 52px; }
  .section { padding: 68px 0; }
  h1 { font-size: clamp(3.25rem, 17vw, 5.2rem); }
  h2 { font-size: clamp(2.15rem, 11vw, 3.5rem); }
  .workflow { grid-template-columns: 1fr 1fr; gap: 20px 10px; }
  .workflow li { padding-right: 10px; }
  .system-flow { grid-template-columns: 1fr 1fr; }
  .system-flow li { min-height: 200px; border-bottom: 1px solid var(--line); }
  .system-flow li:nth-child(2n) { border-right: 0; }
  .layer { grid-template-columns: 44px 1fr; gap: 2px 10px; padding: 15px 16px; }
  .layer p { grid-column: 2; }
  .pack-principles { grid-template-columns: 1fr; }
  .pack-principles article { min-height: auto; }
  .pack-principles span { margin-bottom: 24px; }
  .pack-summary { align-items: stretch; flex-direction: column; }
  .secondary-action { width: 100%; }
  .deck-grid { grid-template-columns: 1fr; }
  .deck-card > div:nth-child(2) { min-height: auto; margin-bottom: 24px; }
  .reference-list li { grid-template-columns: 1fr; gap: 8px; }
}

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