@import url("https://fonts.googleapis.com/css2?family=Inter:wght@600;700;800;900&family=Noto+Sans+JP:wght@600;700;800&display=swap");

:root {
  --ink: #151916;
  --paper: #f4f1e8;
  --line: #cdd1c8;
  --muted: #717a73;
  --blue: #5574ff;
  --coral: #ff6f57;
  --lime: #b9ff3d;
  --yellow: #ffd75f;
}

* { box-sizing: border-box; }

html { background: var(--paper); color: var(--ink); }

body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  background:
    radial-gradient(circle at 8% 0, rgba(85, 116, 255, 0.14), transparent 26rem),
    radial-gradient(circle at 100% 10%, rgba(185, 255, 61, 0.16), transparent 24rem),
    var(--paper);
}

button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p, ul, pre { margin: 0; }

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow,
.section-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.eyebrow { margin-bottom: 8px; }

.eyebrow i {
  display: grid;
  grid-auto-flow: column;
  align-items: end;
  gap: 2px;
  width: 18px;
  height: 14px;
}

.eyebrow i::before,
.eyebrow i::after {
  content: "";
  width: 4px;
  background: var(--coral);
  border-radius: 1px;
}

.eyebrow i::before { height: 7px; }
.eyebrow i::after { height: 14px; box-shadow: 6px 0 0 var(--lime); }

h1 {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 0.96;
  font-weight: 900;
  letter-spacing: 0;
}

.lead {
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.lead strong { color: var(--ink); }

.support-chip {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  font-size: 11px;
  font-weight: 900;
}

.support-chip[data-state="ok"] { color: #1d6b4f; background: #e8f8d8; border-color: #b9ff3d; }
.support-chip[data-state="fallback"] { color: #8a3b1f; background: #ffe5dc; border-color: var(--coral); }

.explain,
.gallery {
  border: 1px solid var(--line);
  border-radius: 25px;
  background: rgba(255, 253, 246, 0.92);
  box-shadow: 0 22px 48px rgba(21, 25, 22, 0.1);
}

.explain {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
}

.explain-copy { padding: 28px 28px 24px; }
.explain-copy h2 {
  margin: 8px 0 16px;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.2;
}

.points {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.points strong, .points code { color: var(--ink); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }

.formulas { display: grid; gap: 8px; margin-top: 18px; }
.formulas pre,
.demo-card pre {
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: #e7ece8;
  font: 600 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}

.inspect-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-left: 1px solid var(--line);
  background: #151916;
  color: #ececec;
}

.inspect-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 0;
}

.inspect-bar p { font-size: 12px; font-weight: 800; }

.stepper {
  display: grid;
  grid-template-columns: 36px 36px 36px;
  align-items: center;
  border: 1px solid #3a3d39;
  border-radius: 11px;
  overflow: hidden;
}

.stepper button,
.stepper output {
  display: grid;
  place-items: center;
  min-height: 36px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.stepper output { font-size: 13px; border-inline: 1px solid #3a3d39; }
.stepper button:hover { background: #2a2d28; }

.inspect-stage {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 220px;
  padding: 18px 18px 8px;
  counter-reset: item;
}

.inspect-tile {
  display: grid;
  flex: 1;
  place-items: end center;
  min-width: 0;
  height: calc(var(--i, sibling-index()) * 16px + 44px);
  padding-bottom: 10px;
  border-radius: 12px 12px 6px 6px;
  background: hsl(calc(360deg * var(--i, sibling-index()) / var(--n, sibling-count())) 72% 58%);
  color: #151916;
  font-size: 12px;
  font-weight: 900;
  counter-increment: item;
}

.inspect-tile::before { content: counter(item); }
.inspect-note {
  padding: 0 18px 16px;
  color: #9aa198;
  font-size: 11px;
  line-height: 1.5;
}

.inspect-note code { color: #e7ece8; }

.gallery { margin-top: 16px; padding: 24px 20px 20px; }
.gallery-head h2 {
  margin-top: 8px;
  margin-bottom: 18px;
  font-size: clamp(22px, 2.4vw, 30px);
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.demo-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffdf8;
}

.demo-card header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 12px 14px 10px;
}

.demo-card header p {
  grid-column: 1;
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.demo-card h3 { font-size: 15px; line-height: 1.2; }

.demo-stage {
  position: relative;
  overflow: hidden;
  min-height: 168px;
  margin: 0 12px;
  border-radius: 14px;
  background: #151916;
}

.demo-stage:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.demo-card pre { margin: 10px 12px 12px; }

.stagger,
.focus-row,
.equal,
.stairs,
.avatars,
.rainbow {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  padding: 22px 16px;
}

.stagger i,
.wave i,
.stairs i,
.rainbow i,
.fan i {
  display: block;
  border-radius: 8px;
}

.stagger i {
  width: 28px;
  height: 28px;
  background: var(--lime);
  opacity: 0.28;
  translate: 0 16px;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1), translate 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc((var(--n, sibling-count()) - var(--i, sibling-index())) * 50ms);
}

.stagger i:nth-child(odd) { background: var(--blue); }
.stagger i:nth-child(3n) { background: var(--coral); }
.stagger:is(:hover, :focus-within) i {
  opacity: 1;
  translate: 0 0;
  transition-delay: calc((var(--i, sibling-index()) - 1) * 80ms);
}

.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
}

@property --t {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0deg;
}

@keyframes spin-t { to { --t: 360deg; } }

.wave i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  translate: 0 0;
  transition: translate 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc((var(--n, sibling-count()) - var(--i, sibling-index())) * 30ms);
}

.wave i:nth-child(3n) { background: var(--blue); }
.wave i:nth-child(3n+2) { background: var(--coral); }
.wave:is(:hover, :focus-within) { animation: spin-t 2.2s linear infinite; }
.wave:is(:hover, :focus-within) i {
  /* --t が毎フレーム変わるので transition を残すと、delay の分だけ後列が追従できない */
  transition: none;
  translate: 0 calc(sin((var(--i, sibling-index()) - 1) * 28deg + var(--t, 0deg)) * 22px);
}

.focus-row { align-items: center; gap: 10px; }
.focus-row b,
.avatars b,
.equal b,
.notify b {
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
}

.focus-row b {
  width: 42px;
  height: 42px;
  color: #151916;
  background: #fff;
  scale: 1;
  transition: scale 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc((var(--n, sibling-count()) - var(--i, sibling-index())) * 40ms);
}

.focus-row:is(:hover, :focus-within) b {
  scale: 1.12;
  background: var(--lime);
  transition-delay: calc((var(--i, sibling-index()) - 1) * 70ms);
}

.equal { align-items: stretch; gap: 4px; padding: 28px 14px; }
.equal b {
  flex: 0 0 calc(100% / var(--n, sibling-count()) - 3.2px);
  min-height: 64px;
  color: #151916;
  background: var(--lime);
  transform: scaleY(0.28);
  transform-origin: bottom;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc((var(--n, sibling-count()) - var(--i, sibling-index())) * 40ms);
}

.equal b:nth-child(even) { background: var(--blue); color: #fff; }
.equal b:nth-child(3) { background: var(--coral); color: #fff; }
.equal:is(:hover, :focus-within) b {
  transform: scaleY(1);
  transition-delay: calc((var(--i, sibling-index()) - 1) * 50ms);
}

.stairs { align-items: end; gap: 6px; }
.stairs i {
  width: 22px;
  height: 14px;
  background: var(--lime);
  transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc((var(--n, sibling-count()) - var(--i, sibling-index())) * 30ms);
}

.stairs i:nth-child(odd) { background: var(--blue); }
.stairs i:nth-child(3n) { background: var(--coral); }
.stairs:is(:hover, :focus-within) i {
  height: calc(var(--i, sibling-index()) * 14px);
  transition-delay: calc((var(--i, sibling-index()) - 1) * 40ms);
}

.avatars { display: block; }
.avatars b {
  position: absolute;
  top: calc(50% - 23px);
  left: 28px;
  width: 46px;
  height: 46px;
  color: #151916;
  background: var(--yellow);
  border: 3px solid #151916;
  border-radius: 50%;
  translate: calc((var(--i, sibling-index()) - 1) * 18px);
  z-index: calc(var(--n, sibling-count()) - var(--i, sibling-index()) + 1);
  transition: translate 0.4s cubic-bezier(0.22, 1, 0.36, 1), scale 0.22s ease;
}

.avatars b:nth-child(2) { background: var(--lime); }
.avatars b:nth-child(3) { background: var(--blue); color: #fff; }
.avatars b:nth-child(4) { background: var(--coral); color: #fff; }
.avatars b:nth-child(5) { background: #7ad0ff; }
.avatars:is(:hover, :focus-within) b {
  translate: calc((var(--i, sibling-index()) - 1) * 34px);
}
.avatars b:hover {
  scale: 1.12;
  z-index: 8;
}

.rainbow {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 18px 16px;
}

.rainbow i {
  height: 12px;
  width: 28%;
  border-radius: 999px;
  background: hsl(calc(360deg * var(--i, sibling-index()) / var(--n, sibling-count())) 72% 58%);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc((var(--n, sibling-count()) - var(--i, sibling-index())) * 30ms);
}

.rainbow:is(:hover, :focus-within) i {
  width: calc(40% + (60% * (var(--i, sibling-index()) / var(--n, sibling-count()))));
  transition-delay: calc((var(--i, sibling-index()) - 1) * 40ms);
}

.notify { display: block; }

.notify b {
  position: absolute;
  top: 36px;
  left: 24px;
  width: min(220px, calc(100% - 48px));
  min-height: 34px;
  padding: 0 12px;
  color: #151916;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  z-index: var(--i, sibling-index());
  translate: 0 calc((var(--i, sibling-index()) - 1) * 8px);
  scale: calc(1 - (var(--i, sibling-index()) - 1) * 0.045);
  transition: translate 0.45s cubic-bezier(0.22, 1, 0.36, 1), scale 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc((var(--n, sibling-count()) - var(--i, sibling-index())) * 40ms);
}

.notify b:nth-child(odd) { background: var(--lime); }
.notify:is(:hover, :focus-within) b {
  translate: 0 calc((var(--i, sibling-index()) - 1) * 38px);
  scale: 1;
  transition-delay: calc((var(--i, sibling-index()) - 1) * 50ms);
}

.fan { --fan: 18px; }
.fan:is(:hover, :focus-within) { --fan: 92px; }

.fan i {
  position: absolute;
  top: calc(50% - 11px);
  left: calc(50% - 11px);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--lime);
  transform: rotate(calc(180deg * ((var(--i, sibling-index()) - 1) / (var(--n, sibling-count()) - 1)) - 90deg)) translateY(calc(var(--fan) * -1));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc((var(--n, sibling-count()) - var(--i, sibling-index())) * 30ms);
}

.fan:is(:hover, :focus-within) i {
  transition-delay: calc((var(--i, sibling-index()) - 1) * 40ms);
}

.fan i:nth-child(odd) { background: var(--blue); }
.fan i:nth-child(3n) { background: var(--coral); }
.fan i:nth-child(4) { background: var(--yellow); }

.fan::after {
  position: absolute;
  inset: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 6px #2a2d28;
  content: "";
  translate: -50% -50%;
}

@media (max-width: 900px) {
  .explain { grid-template-columns: 1fr; }
  .inspect-shell { border-left: 0; border-top: 1px solid var(--line); }
  .demo-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .page { width: calc(100% - 20px); padding-top: 18px; }
  .hero { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 40px; }
  .demo-grid { grid-template-columns: 1fr; }
  .inspect-stage { min-height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .stagger i,
  .wave i,
  .focus-row b,
  .equal b,
  .stairs i,
  .avatars b,
  .rainbow i,
  .notify b,
  .fan i { transition: none; }
  .wave:is(:hover, :focus-within) { animation: none; }
}
