/* Sensei Smooth website: "Sumi & Shu"
   Fonts are self-hosted (SIL Open Font License, see assets/fonts/*-LICENSE.txt). */

@font-face {
  font-family: "Dela Gothic One";
  src: url("../fonts/dela-gothic-one-latin-400-normal.woff2") format("woff2");
  font-weight: 100 900; /* single heavy cut: never synthesise a fake bold */
  font-display: swap;
}
@font-face {
  font-family: "Zen Kaku Gothic New";
  src: url("../fonts/zen-kaku-gothic-new-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Zen Kaku Gothic New";
  src: url("../fonts/zen-kaku-gothic-new-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --sumi: #111113;
  --sumi-2: #19191c;
  --sumi-3: #232227;
  --washi: #ede6d6;
  --washi-2: #e3dbc9;
  --ink: #1c1a18;
  --ink-soft: #5b564d;
  --muted: #9a9486;
  --shu: #e4472b;
  --shu-deep: #b9341c;
  --kin: #d6a84e;
  --ai: #79a6d9;
  --matcha: #9db06a;
  --line-dark: rgba(237, 230, 214, 0.12);
  --line-light: rgba(28, 26, 24, 0.14);

  --display: "Dela Gothic One", "Arial Black", sans-serif;
  --text: "Zen Kaku Gothic New", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --cjk: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif CJK JP", "Noto Serif JP", serif;

  --wrap: min(1180px, 100% - 32px);
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--sumi);
  color: var(--washi);
  font: 400 1.0625rem/1.7 var(--text);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

.wrap { width: var(--wrap); margin-inline: auto; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 7.2vw, 6.2rem); line-height: 1.02; }
h2 { font-size: clamp(1.9rem, 4.2vw, 3.3rem); line-height: 1.08; margin-bottom: 1.2rem; }
h3 { font-size: 1.3rem; line-height: 1.2; }
p { margin: 0 0 1rem; }

.shu { color: var(--shu); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.4rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font: 600 0.82rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--kin); outline-offset: 3px; }
.btn-shu { background: var(--shu); color: #fff; }
.btn-shu:hover { background: var(--shu-deep); }
.btn-line { border-color: rgba(237, 230, 214, 0.35); color: var(--washi); }
.btn-line:hover { border-color: var(--washi); }
.btn-ink { background: var(--ink); color: var(--washi); }
.btn-ink:hover { background: #000; }
.btn-small { padding: 0.6rem 0.95rem; }
.icon { width: 1.1em; height: 1.1em; fill: currentColor; flex: none; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  border-bottom: 1px solid transparent;
}
.topbar.is-scrolled {
  background: rgba(17, 17, 19, 0.86);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--line-dark);
}
.topbar-inner { display: flex; align-items: center; gap: 2rem; height: 68px; }
.topbar-logo img { height: 40px; width: auto; }
.topbar-nav { display: flex; gap: 1.6rem; margin-left: auto; }
.topbar-nav a {
  font: 600 0.74rem/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.15s ease;
}
.topbar-nav a:hover { color: var(--washi); }

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative;
  padding-top: 132px;
  overflow: hidden;
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgba(228, 71, 43, 0.14), transparent 70%),
    var(--sumi);
}
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: start; }
.kicker {
  font: 600 0.74rem/1.4 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--kin);
  margin-bottom: 1.4rem;
}
.hero-lead { max-width: 34rem; font-size: 1.15rem; color: #cfc8b8; margin-top: 1.6rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.8rem; }

.hanko {
  margin-top: 0.5rem;
  padding: 0.55rem;
  border: 3px solid var(--shu);
  outline: 1px solid var(--shu);
  outline-offset: 4px;
  border-radius: 6px;
  transform: rotate(-5deg);
  opacity: 0.92;
}
.hanko-kanji {
  display: block;
  writing-mode: vertical-rl;
  font: 700 clamp(2.2rem, 4vw, 3.4rem)/1 var(--cjk);
  color: var(--shu);
  letter-spacing: 0.08em;
}

.blade-stage { position: relative; margin: 3rem 0 0; height: clamp(190px, 26vw, 300px); }
.blade-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.blade-labels {
  position: absolute;
  inset: auto 0 14px;
  width: var(--wrap);
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
.blade-mark {
  position: absolute;
  left: 55%;               /* same position as the blade in main.js */
  top: 0;
  transform: translate(-50%, -140%);
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--shu);
  white-space: nowrap;
  pointer-events: none;
}

/* ------------------------------------------------------------------ bands */
.band { padding: clamp(4.5rem, 10vw, 8rem) 0; position: relative; }
.band-washi { background: var(--washi); color: var(--ink); }
.band-sumi { background: var(--sumi-2); }
.band-washi .intro { color: var(--ink-soft); }
.intro { max-width: 40rem; font-size: 1.1rem; color: #c3bcad; margin-bottom: 2.8rem; }

.with-rail { display: grid; grid-template-columns: 3.2rem 1fr; gap: clamp(1rem, 4vw, 3.5rem); }
/* grid children may shrink below their content (long code lines scroll inside their box) */
.with-rail > *, .source-grid > *, .hero-grid > * { min-width: 0; }
/* Section rail: a small hanko stamp (一 二 三 ...), the label written vertically, a hairline below. */
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  margin: 0.3rem 0 0;
  color: var(--muted);
}
.band-washi .rail { color: var(--ink-soft); }
.rail::after { content: ""; width: 1px; height: 3.5rem; background: currentColor; opacity: 0.6; }
.rail-num {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  background: var(--shu);
  color: var(--washi);
  border-radius: 4px;
  font: 700 1.15rem/1 var(--cjk);
  transform: rotate(-4deg);
}
.rail-text {
  writing-mode: vertical-rl;
  font: 600 0.74rem/1 var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ 一 listen (A/B player) */
.ab {
  background: var(--sumi);
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  padding: clamp(1rem, 2.4vw, 1.6rem);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
/* bypass: the whole player turns grey, so it is obvious the effect is off */
.ab[data-mode="bypass"] { background: #3a3835; border-color: #57534c; }
.ab[data-mode="bypass"] .ab-switch,
.ab[data-mode="bypass"] .ab-progress { background: #4a4741; }
.ab[data-mode="bypass"] .ab-progress-fill { background: #b3ac9d; }
.ab[data-mode="bypass"] .ab-stage::after {
  content: "Bypass";
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  font: 600 0.72rem/1 var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #b3ac9d;
  pointer-events: none;
}
.ab[data-mode="bypass"] .ab-time,
.ab[data-mode="bypass"] .ab-legend { color: #b3ac9d; }
.ab-top { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }

.ab-play {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--shu);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.ab-play:hover { background: var(--shu-deep); transform: scale(1.05); }
.ab-play:focus-visible, .ab-switch button:focus-visible, .ab-progress:focus-visible { outline: 2px solid var(--kin); outline-offset: 3px; }
.ab-icon { width: 24px; height: 24px; fill: currentColor; }
.ab-icon-pause, .ab.is-playing .ab-icon-play { display: none; }
.ab.is-playing .ab-icon-pause { display: block; }
.ab.is-loading .ab-play { opacity: 0.6; cursor: progress; }

/* segmented switch with a sliding thumb */
.ab-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: var(--sumi-3);
  border-radius: 999px;
  isolation: isolate;
}
.ab-switch button {
  position: relative;
  z-index: 1;
  border: 0;
  background: none;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font: 600 0.78rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
}
.ab-switch button[aria-checked="true"] { color: var(--sumi); }
.ab-switch-thumb {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--washi);
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.2, 1), background-color 0.25s ease;
  transform: translateX(100%);
}
.ab[data-mode="bypass"] .ab-switch-thumb { transform: translateX(0); background: #8f897c; }

.ab-time { margin: 0 0 0 auto; font: 400 0.82rem/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }

.ab-stage { position: relative; margin: 1.3rem 0 1rem; height: clamp(170px, 24vw, 260px); }
.ab-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ab-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
  font: 400 0.82rem/1.5 var(--mono);
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.ab.has-started .ab-hint { opacity: 0; }

.ab-progress {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--sumi-3);
  cursor: pointer;
  overflow: hidden;
}
.ab-progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--shu); border-radius: 3px; }

.ab-legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; margin: 1rem 0 0; padding: 0; list-style: none; font: 400 0.74rem/1 var(--mono); color: var(--muted); }
.ab-legend li { display: flex; align-items: center; gap: 0.5rem; }
.ab-swatch { width: 18px; height: 3px; border-radius: 2px; }
.ab-swatch-bypass { background: #8f897c; }
.ab-swatch-sensei { background: var(--washi); }
.ab-swatch-cut { height: 10px; background: rgba(228, 71, 43, 0.55); }

/* ------------------------------------------------------------------ 二 steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.step { border-top: 2px solid var(--ink); padding-top: 1.4rem; }
.step h3 { margin: 1.2rem 0 0.6rem; }
.step p { color: var(--ink-soft); margin: 0; }
.step-num { font: 600 0.8rem/1 var(--mono); color: var(--shu); margin-right: 0.4rem; vertical-align: 0.3em; }
.step-art { width: 100%; max-width: 260px; height: auto; display: block; }
.art-bars rect { fill: rgba(28, 26, 24, 0.22); }
.art-bars .art-hot { fill: var(--shu); }
.art-env { fill: none; stroke: var(--kin); stroke-width: 2; stroke-dasharray: 4 4; }
.art-line { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; }
.art-dot { fill: none; stroke: var(--shu); stroke-width: 2.4; }
.art-slash { stroke: var(--shu); stroke-width: 2.4; stroke-linecap: round; }
.art-shard { fill: var(--shu); opacity: 0.85; }

/* ------------------------------------------------------------------ 二 interface */
.shot { margin: 1.5rem 0 3rem; }
.shot-frame {
  position: relative;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8), 0 0 0 10px rgba(237, 230, 214, 0.03);
}
.pin {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--shu);
  color: #fff;
  font: 600 0.8rem/1 var(--mono);
  box-shadow: 0 0 0 4px rgba(228, 71, 43, 0.28), 0 6px 16px rgba(0, 0, 0, 0.45);
}
.pin-static { position: static; transform: none; width: 24px; height: 24px; font-size: 0.72rem; box-shadow: none; display: inline-grid; margin-right: 0.55rem; vertical-align: -0.3em; }

.legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.6rem 3rem; margin: 0; }
.legend div { border-top: 1px solid var(--line-dark); padding-top: 1rem; }
.legend dt { font-weight: 700; margin-bottom: 0.35rem; }
.legend dd { margin: 0; color: #b6af9f; }

/* ------------------------------------------------------------------ 三 modes */
.mode {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: 2.5rem 0;
  border-top: 1px solid var(--line-light);
}
.mode:first-of-type { border-top: 0; padding-top: 1rem; }
.mode img { border-radius: 6px; box-shadow: 0 30px 60px -28px rgba(17, 17, 19, 0.6); }
.mode-flip img { order: 2; }
.mode-text h3 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: 0.6rem 0 0.8rem; }
.mode-text p { color: var(--ink-soft); }
.tag {
  display: inline-block;
  margin: 0;
  padding: 0.35rem 0.6rem;
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-radius: 3px;
  color: #fff;
}
.mode-text .tag { color: #fff; }
.tag-shu { background: var(--shu); }
.tag-ai { background: #4f7fb6; }
.tag-kin { background: #a87f2c; }

.route {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.4rem;
  padding-bottom: 3.2rem;
  font: 600 0.72rem/1 var(--mono);
  letter-spacing: 0.06em;
}
.route-node { padding: 0.5rem 0.65rem; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--washi); }
.route-node-main { background: var(--ink); color: var(--washi); }
.route-node-ai { border-color: #4f7fb6; color: #2d5a8f; }
.route-arrow { width: 18px; height: 1.5px; background: var(--ink); position: relative; }
.route-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -3.5px;
  border: 4px solid transparent;
  border-left: 6px solid var(--ink);
  border-right: 0;
}
.route-side {
  position: absolute;
  left: 4.7rem;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.route-side::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1.5px;
  height: 1.15rem;
  background: #4f7fb6;
}
.route-side-label { color: #4f7fb6; text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.64rem; }

/* ------------------------------------------------------------------ 四 specs */
.specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 3rem; margin: 0; }
.specs div {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line-dark);
}
.specs dt { font: 600 0.72rem/1.6 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--kin); }
.specs dd { margin: 0; color: #d8d1c1; }
.specs a { color: var(--washi); text-decoration-color: var(--shu); text-underline-offset: 3px; }

/* ------------------------------------------------------------------ 五 source */
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.repo-card {
  display: block;
  text-decoration: none;
  background: var(--sumi);
  color: var(--washi);
  border-radius: 8px;
  padding: 1.6rem;
  box-shadow: 0 30px 60px -25px rgba(17, 17, 19, 0.65);
  transition: transform 0.2s ease;
  border-top: 4px solid var(--shu);
}
.repo-card:hover { transform: translateY(-4px); }
.repo-card-head { display: flex; align-items: center; gap: 0.6rem; font-family: var(--mono); font-size: 0.95rem; }
.repo-card-head .icon { width: 1.4em; height: 1.4em; }
.repo-card-desc { display: block; color: var(--muted); margin: 0.8rem 0 1.2rem; }
.code {
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--sumi-3);
  border-radius: 6px;
  overflow-x: auto;
  font: 400 0.78rem/1.7 var(--mono);
  color: #e9e2d2;
}
.code-dim { color: var(--muted); }

/* ------------------------------------------------------------------ footer */
.footer { background: var(--sumi); border-top: 1px solid var(--line-dark); padding: 2.6rem 0; }
.footer-inner { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem 2rem; align-items: center; }
.footer-brand { display: flex; align-items: center; gap: 0.9rem; }
.footer-brand p { margin: 0; line-height: 1.35; color: var(--muted); font-size: 0.9rem; }
.footer-brand strong { color: var(--washi); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.4rem; justify-content: flex-end; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.footer-nav a:hover { color: var(--washi); }
.footer-note { grid-column: 1 / -1; margin: 0; font-size: 0.75rem; color: #6d685e; }

/* ------------------------------------------------------------------ legal pages */
.legal { padding: 140px 0 6rem; background: var(--washi); color: var(--ink); min-height: 80vh; }
.legal .wrap { max-width: 46rem; }
.legal h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: 2rem; }
.legal h2 { font-family: var(--text); font-weight: 700; font-size: 1.05rem; letter-spacing: 0; margin: 2rem 0 0.4rem; }
.legal p { color: var(--ink-soft); }
.legal a { color: var(--shu-deep); }

/* ------------------------------------------------------------------ reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .repo-card { transition: none; }
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .topbar-nav { display: none; }
  .topbar-inner { justify-content: space-between; }
  .steps { grid-template-columns: 1fr; gap: 2.2rem; }
  .legend, .specs, .source-grid { grid-template-columns: 1fr; }
  .mode, .mode-flip { grid-template-columns: 1fr; }
  .mode-flip img { order: 0; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-nav { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .hero { padding-top: 104px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hanko { position: absolute; right: 16px; top: 88px; transform: rotate(-5deg) scale(0.7); transform-origin: top right; }
  .kicker { padding-right: 4.8rem; }
  .ab-top { gap: 0.9rem; }
  .ab-play { width: 50px; height: 50px; }
  .ab-switch { flex: 1; }
  .ab-switch button { padding: 0.65rem 0.6rem; font-size: 0.7rem; letter-spacing: 0.06em; }
  .ab-time { width: 100%; margin: 0; text-align: right; }
  .with-rail { grid-template-columns: 1fr; }
  .rail { flex-direction: row; justify-content: flex-start; }
  .rail::after { width: auto; height: 1px; flex: 1; }
  .rail-text { writing-mode: horizontal-tb; }
  .specs div { grid-template-columns: 1fr; gap: 0.25rem; }
  .pin { width: 22px; height: 22px; font-size: 0.66rem; box-shadow: 0 0 0 3px rgba(228, 71, 43, 0.28); }
}
