/* ————— Ink & Echo — 墨響 ————— */
/* palette: washi #f2ecdd · washi-deep #e7ddc6 · sumi #1c1e20 · usuzumi #8b8f88 · shu #bf3f2a · kin #a98a52 */

:root {
  --paper: #f2ecdd;
  --paper-deep: #e7ddc6;
  --ink: #1c1e20;
  --usuzumi: #8b8f88;
  --shu: #bf3f2a;
  --kin: #a98a52;
  --line: rgba(28, 30, 32, 0.16);
  --serif: "Shippori Mincho", "Times New Roman", serif;
  --sans: "Zen Kaku Gothic New", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overscroll-behavior: none;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  min-height: 100%;
  overflow-x: clip;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 90% at 30% 20%, #f6f1e4 0%, var(--paper) 46%, var(--paper-deep) 100%);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  cursor: none;
}

@media (pointer: coarse) { body { cursor: auto; } }

/* ————— layers ————— */
#ink, #fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#ink { z-index: 1; }
#fx  { z-index: 3; pointer-events: none; mix-blend-mode: multiply; }

.grain {
  position: fixed; inset: 0; z-index: 45;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.55;
  /* background-image set from JS (procedural noise tile) */
}

.vignette {
  position: fixed; inset: 0; z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(130% 110% at 50% 42%, transparent 55%, rgba(74, 66, 48, 0.14) 100%),
    linear-gradient(180deg, rgba(255, 252, 240, 0.20) 0%, transparent 12%);
}

/* ————— custom cursor ————— */
#cursor {
  position: fixed; z-index: 50;
  left: 0; top: 0;
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid rgba(28, 30, 32, 0.55);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.12s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
#cursor::after {
  content: ""; position: absolute; inset: 50%;
  width: 3px; height: 3px; margin: -1.5px;
  border-radius: 50%;
  background: rgba(28, 30, 32, 0.7);
}
#cursor.down { transform: scale(0.72); }
@media (pointer: coarse) { #cursor { display: none; } }

/* ————— chrome (UI) ————— */
.masthead, .toolbar, .side-note, .hint, .scrollcue {
  position: fixed; z-index: 10;
}
.sitenav { position: fixed; z-index: 12; }

/* entrance choreography */
.masthead, .sitenav, .toolbar, .side-note, .hint, .scrollcue {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
body.ready .masthead { opacity: 1; transform: none; transition-delay: 0.15s; }
body.ready .side-note { opacity: 1; transform: none; transition-delay: 0.55s; }
body.ready .sitenav  { opacity: 1; transform: none; transition-delay: 0.4s; }
body.ready .toolbar  { opacity: 1; transform: translateX(-50%); transition-delay: 0.65s; }
body.ready .hint     { opacity: 1; transform: none; transition-delay: 1.1s; }
body.ready .scrollcue { opacity: 1; transform: none; transition-delay: 1.35s; }

/* fixed hero chrome retires once the reader scrolls */
body.ready.scrolled .masthead,
body.ready.scrolled .side-note,
body.ready.scrolled .hint,
body.ready.scrolled .scrollcue {
  opacity: 0;
  pointer-events: none;
  transition-delay: 0s;
}
body.ready.scrolled .toolbar {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
  pointer-events: none;
  transition-delay: 0s;
}

.masthead {
  top: clamp(20px, 4vh, 44px);
  left: clamp(20px, 3.5vw, 52px);
  display: flex;
  gap: 18px;
  align-items: flex-start;
  pointer-events: none;
}

.kanji {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(40px, 5.2vw, 64px);
  line-height: 1.04;
  writing-mode: vertical-rl;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.masthead-text { padding-top: 6px; }

.masthead h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 32px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.1;
}
.masthead .amp { color: var(--shu); font-weight: 400; }

.tagline {
  margin-top: 9px;
  font-size: clamp(11px, 1vw, 13px);
  letter-spacing: 0.08em;
  color: rgba(28, 30, 32, 0.62);
  max-width: 240px;
  line-height: 1.6;
}

.side-note {
  right: clamp(16px, 2.4vw, 34px);
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.32em;
  color: rgba(28, 30, 32, 0.38);
  pointer-events: none;
}
body.ready .side-note { transform: translateY(-50%); }

/* ————— sticky nav ————— */
.sitenav {
  top: clamp(14px, 2.6vh, 30px);
  right: clamp(20px, 3.5vw, 52px);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 8px 10px 8px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
}
body.ready .sitenav {
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease;
}
body.scrolled .sitenav {
  background: rgba(246, 241, 228, 0.85);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  border-color: var(--line);
  box-shadow: 0 14px 34px -20px rgba(28, 30, 32, 0.5);
}
.navbrand {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-decoration: none;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
body.scrolled .navbrand { opacity: 1; transform: none; pointer-events: auto; }
.navlinks { display: flex; align-items: center; gap: 20px; }
.navlinks a {
  position: relative;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(28, 30, 32, 0.62);
  text-decoration: none;
  padding: 4px 0;
  transition: color 0.3s ease;
}
.navlinks a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: 0;
  height: 1px;
  background: var(--shu);
  transition: right 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.navlinks a:hover { color: var(--ink); }
.navlinks a:hover::after { right: 0; }
.navlinks a.active { color: var(--ink); }
.navlinks a.active::after { right: 0; }

/* mobile sections menu toggle — desktop hides it */
.navtoggle { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(246, 241, 228, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.pill:hover { border-color: rgba(191, 63, 42, 0.55); background: rgba(246, 241, 228, 0.92); transform: translateY(-1px); }
.pill-arrow { color: var(--shu); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.pill:hover .pill-arrow { transform: translateX(3px); }

.hint {
  left: clamp(20px, 3.5vw, 52px);
  bottom: clamp(18px, 3.4vh, 32px);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: rgba(28, 30, 32, 0.44);
  pointer-events: none;
  transition: opacity 0.9s ease;
}
.hint kbd {
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
  margin: 0 1px;
  background: rgba(246, 241, 228, 0.6);
}
body.ready.touched .hint { opacity: 0; }

/* ————— toolbar ————— */
.toolbar {
  left: 50%;
  bottom: clamp(16px, 3.2vh, 30px);
  transform: translateX(-50%) translateY(10px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(246, 241, 228, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 34px -18px rgba(28, 30, 32, 0.45);
}

.group { display: flex; align-items: center; gap: 4px; }

.sep { width: 1px; height: 22px; background: var(--line); }
.brk { display: none; }

.tool {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.tool:hover { background: rgba(28, 30, 32, 0.06); transform: translateY(-1px); }
.tool:active { transform: scale(0.94); }
.tool.is-active { border-color: rgba(28, 30, 32, 0.4); background: rgba(28, 30, 32, 0.05); }

.dot { border-radius: 50%; background: var(--ink); display: block; }
.d1 { width: 4px; height: 4px; }
.d2 { width: 8px; height: 8px; }
.d3 { width: 14px; height: 14px; }

.swatch { width: 14px; height: 14px; border-radius: 50%; display: block; }
.s-sumi { background: var(--ink); }
.s-usu  { background: var(--usuzumi); }
.s-shu  { background: var(--shu); }

.text-btn {
  padding: 0 14px;
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
#echoBtn.is-active { border-color: rgba(191, 63, 42, 0.5); color: var(--shu); }

.seal-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--shu);
  color: #f6f1e4;
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: 0 8px 20px -10px rgba(191, 63, 42, 0.7);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, background 0.3s ease;
}
.seal-btn:hover { transform: translateY(-1px); background: #ce4630; box-shadow: 0 12px 26px -10px rgba(191, 63, 42, 0.8); }
.seal-btn:active { transform: scale(0.95); }
.seal-mini {
  font-family: var(--serif);
  font-size: 13px;
  border: 1px solid rgba(246, 241, 228, 0.7);
  border-radius: 4px;
  width: 19px; height: 19px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* seal thump animation element */
.seal-ghost {
  position: fixed;
  z-index: 15;
  pointer-events: none;
  transform-origin: center;
  animation: sealThump 0.5s cubic-bezier(0.34, 1.3, 0.5, 1) forwards;
}
@keyframes sealThump {
  0%   { transform: scale(1.7) rotate(-7deg); opacity: 0; }
  60%  { transform: scale(0.97) rotate(-2.5deg); opacity: 1; }
  100% { transform: scale(1) rotate(-3deg); opacity: 1; }
}

/* toast */
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(28, 30, 32, 0.88);
  color: var(--paper);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ————— scroll cue ————— */
.scrollcue {
  right: clamp(20px, 3.5vw, 52px);
  bottom: clamp(18px, 3.4vh, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: rgba(28, 30, 32, 0.55);
}
.scrollcue:hover { color: var(--ink); }
.scrollcue-txt {
  writing-mode: vertical-rl;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}
.scrollcue-line {
  width: 1px;
  height: 46px;
  background: rgba(28, 30, 32, 0.28);
  position: relative;
  overflow: hidden;
}
.scrollcue-line::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: var(--shu);
  transform: translateY(-100%);
  animation: cueDrop 2.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes cueDrop {
  0%       { transform: translateY(-100%); }
  55%, 100%{ transform: translateY(100%); }
}
.scrollcue-dot { display: none; }

/* ————— the scroll (content sheet) ————— */
main {
  position: relative;
  z-index: 6;
  margin-top: 100vh;
  margin-top: 100svh;
  background: var(--paper);
  border-top: 1px solid rgba(28, 30, 32, 0.14);
  box-shadow: 0 -28px 70px -34px rgba(28, 30, 32, 0.45);
  cursor: auto;
}

.sect {
  position: relative;
  padding: clamp(88px, 12vh, 150px) 0;
  scroll-margin-top: 64px;
  overflow: clip;
}
.sect + .sect { border-top: 1px solid rgba(28, 30, 32, 0.09); }
#physics    { background: linear-gradient(180deg, rgba(231, 221, 198, 0.0), rgba(231, 221, 198, 0.5)); }
#philosophy { background: #efe8d5; }
#practice   { background: linear-gradient(180deg, rgba(231, 221, 198, 0.35), rgba(231, 221, 198, 0.0)); }

.inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(22px, 5vw, 64px);
  position: relative;
}
.inner-narrow { max-width: 900px; }

.sect-kanji {
  position: absolute;
  top: clamp(48px, 8vh, 110px);
  right: clamp(8px, 4vw, 70px);
  font-family: var(--serif);
  font-size: clamp(120px, 17vw, 230px);
  line-height: 1;
  color: rgba(28, 30, 32, 0.045);
  writing-mode: vertical-rl;
  pointer-events: none;
  user-select: none;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--shu);
  margin-bottom: 16px;
}
.sect h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 4vw, 50px);
  letter-spacing: 0.04em;
  line-height: 1.14;
}
.lede {
  margin-top: 18px;
  max-width: 58ch;
  color: rgba(28, 30, 32, 0.68);
  font-size: clamp(14px, 1.15vw, 15.5px);
  line-height: 1.85;
}

/* reveal choreography */
.rv { opacity: 0; transform: translateY(26px); }
.rv.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.95s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s),
              transform 0.95s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s);
}
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; } }

/* ————— gallery ————— */
.studies {
  margin-top: clamp(40px, 6vh, 64px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(18px, 2.2vw, 30px) clamp(16px, 2vw, 26px);
}
.study { display: flex; flex-direction: column; gap: 12px; }
.study-frame {
  appearance: none;
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(28, 30, 32, 0.15);
  border-radius: 3px;
  background: #f7f2e5;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 16px 34px -26px rgba(28, 30, 32, 0.55);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.45s ease, border-color 0.3s ease;
}
.study-frame:hover {
  transform: translateY(-5px);
  border-color: rgba(28, 30, 32, 0.28);
  box-shadow: 0 28px 48px -26px rgba(28, 30, 32, 0.6);
}
.study-frame:active { transform: translateY(-2px) scale(0.99); }
.study-frame canvas { display: block; width: 100%; aspect-ratio: 3 / 4; }
.study-hint {
  position: absolute;
  right: 10px; bottom: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(28, 30, 32, 0.48);
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.study-frame:hover .study-hint { opacity: 1; transform: none; }
.study figcaption { display: flex; gap: 10px; align-items: baseline; }
.study-kanji { font-family: var(--serif); color: var(--shu); font-size: 15px; }
.study-cap { display: flex; flex-direction: column; gap: 2px; }
.study-title {
  font-family: var(--serif);
  font-size: 13.5px;
  letter-spacing: 0.05em;
  color: var(--ink);
}
.study-note {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: rgba(28, 30, 32, 0.5);
}
.gallery-foot {
  margin-top: clamp(34px, 5vh, 52px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(28, 30, 32, 0.5);
  text-align: center;
}

/* ————— physics ————— */
.phys-grid {
  margin-top: clamp(40px, 6vh, 64px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 2.4vw, 32px);
}
.phys {
  border: 1px solid rgba(28, 30, 32, 0.15);
  border-radius: 6px;
  background: rgba(247, 242, 229, 0.75);
  overflow: hidden;
  box-shadow: 0 18px 40px -30px rgba(28, 30, 32, 0.5);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.45s ease;
}
.phys:hover { transform: translateY(-4px); box-shadow: 0 26px 52px -30px rgba(28, 30, 32, 0.55); }
.phys-demo { position: relative; background: #f7f2e5; border-bottom: 1px solid rgba(28, 30, 32, 0.1); }
.phys-demo canvas { display: block; width: 100%; aspect-ratio: 16 / 10; }
.phys-live {
  position: absolute;
  top: 10px; right: 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--shu);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.phys-live::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--shu);
  animation: livePulse 2.2s ease-in-out infinite;
}
@keyframes livePulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.phys-body { padding: 22px 24px 24px; }
.phys h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18.5px;
  letter-spacing: 0.03em;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.phys-kanji { color: var(--shu); font-size: 22px; font-weight: 500; }
.phys-body p { margin-top: 11px; font-size: 13.5px; line-height: 1.85; color: rgba(28, 30, 32, 0.74); }
.phys-body p em { font-family: var(--serif); }
.phys-meta {
  font-family: var(--mono) !important;
  font-size: 10px !important;
  letter-spacing: 0.05em;
  color: rgba(28, 30, 32, 0.46) !important;
  border-top: 1px dashed rgba(28, 30, 32, 0.18);
  padding-top: 11px;
  margin-top: 15px !important;
  line-height: 1.7 !important;
}

/* ————— tone scale (five colours of one ink) ————— */
#tones { background: linear-gradient(180deg, rgba(231, 221, 198, 0.5), rgba(231, 221, 198, 0) 36%); }
.tone-scale {
  margin-top: clamp(40px, 6vh, 64px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(14px, 1.8vw, 26px);
}
.tone-card { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.tone-frame canvas { aspect-ratio: 3 / 4.4; }
.tone-card figcaption { display: flex; flex-direction: column; gap: 4px; }
.tone-kanji {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1;
  color: var(--ink);
}
.tone-name {
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.09em;
  color: var(--ink);
}
.tone-note {
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.65;
  letter-spacing: 0.04em;
  color: rgba(28, 30, 32, 0.5);
}
.tone-foot {
  margin-top: clamp(34px, 5vh, 52px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(28, 30, 32, 0.5);
  text-align: center;
}

/* ————— philosophy ————— */
.phi-open {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(26px, 3.4vw, 42px);
  line-height: 1.4;
  margin: clamp(48px, 7vh, 76px) 0 clamp(40px, 6vh, 64px);
}
.phi-open em { font-style: normal; color: var(--shu); }
.phi-block {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: clamp(18px, 4vw, 48px);
  padding: clamp(32px, 5vh, 46px) 0;
  border-top: 1px solid rgba(28, 30, 32, 0.12);
}
.phi-mark { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.phi-kanji {
  font-family: var(--serif);
  font-size: clamp(42px, 5vw, 58px);
  line-height: 1;
  color: rgba(28, 30, 32, 0.85);
}
.phi-romaji {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--shu);
}
.phi-text h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(18px, 2vw, 23px);
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}
.phi-text p {
  color: rgba(28, 30, 32, 0.74);
  font-size: 14.5px;
  line-height: 1.95;
  max-width: 60ch;
}
.phi-text p em { font-family: var(--serif); }
.phi-quote {
  margin: clamp(56px, 9vh, 92px) auto 8px;
  max-width: 34ch;
  text-align: center;
}
.phi-quote p {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(19px, 2.4vw, 28px);
  line-height: 1.65;
  color: var(--ink);
}
.phi-quote-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 26px;
  width: 34px; height: 34px;
  border-radius: 6px;
  background: var(--shu);
  color: #f2ecdd;
  font-family: var(--serif);
  font-size: 15px;
  transform: rotate(-3deg);
  box-shadow: 0 8px 18px -8px rgba(191, 63, 42, 0.6);
}

/* ————— practice ————— */
.prac-grid {
  margin-top: clamp(40px, 6vh, 60px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 44px);
}
.prac-ex {
  border-left: 2px solid rgba(191, 63, 42, 0.4);
  padding: 4px 0 6px 22px;
}
.prac-ex h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin-bottom: 10px;
}
.prac-no { color: var(--shu); font-size: 15px; font-weight: 500; }
.prac-ex p { font-size: 13.5px; line-height: 1.85; color: rgba(28, 30, 32, 0.72); }
.prac-controls {
  margin-top: clamp(36px, 5vh, 54px);
  border: 1px solid rgba(28, 30, 32, 0.15);
  border-radius: 16px;
  background: rgba(247, 242, 229, 0.75);
  padding: 20px 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
}
.prac-keys { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.pk {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(28, 30, 32, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.pk kbd {
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  background: rgba(246, 241, 228, 0.8);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(28, 30, 32, 0.12);
}
.return-pill { background: rgba(246, 241, 228, 0.9); }
.return-pill .pill-arrow { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.return-pill:hover .pill-arrow { transform: translateY(-3px); }

/* ————— footer ————— */
.foot {
  background: #e7ddc6;
  border-top: 1px solid rgba(28, 30, 32, 0.14);
  padding: clamp(48px, 7vh, 80px) 0 42px;
  cursor: auto;
}
.foot-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px 40px;
  align-items: start;
}
.foot-brand { display: flex; align-items: center; gap: 16px; }
.foot-seal {
  width: 46px; height: 46px;
  border-radius: 8px;
  background: var(--shu);
  color: #f2ecdd;
  font-family: var(--serif);
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-3deg);
  box-shadow: 0 8px 18px -8px rgba(191, 63, 42, 0.6);
}
.foot-name { display: flex; flex-direction: column; gap: 3px; }
.foot-name b {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.06em;
}
.foot-name span {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: rgba(28, 30, 32, 0.55);
}
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-top: 12px; }
.foot-links a {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(28, 30, 32, 0.62);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.foot-links a:hover { color: var(--ink); border-bottom-color: rgba(191, 63, 42, 0.5); }
.foot-colophon {
  grid-column: 1 / -1;
  margin-top: 10px;
  border-top: 1px dashed rgba(28, 30, 32, 0.2);
  padding-top: 18px;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.8;
  color: rgba(28, 30, 32, 0.5);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 32px;
}
.foot-colophon span:first-child { max-width: 72ch; }
.foot-date { white-space: nowrap; }

/* ————— responsive ————— */
@media (max-width: 720px) {
  .kanji { font-size: 34px; }
  .masthead { gap: 12px; }
  .masthead h1 { font-size: 19px; }
  .tagline { max-width: 190px; font-size: 11px; }
  .side-note { display: none; }
  .hint { display: none; }
  .toolbar {
    bottom: max(12px, env(safe-area-inset-bottom));
    gap: 6px;
    row-gap: 9px;
    padding: 10px 12px;
    width: min(360px, calc(100vw - 16px));
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 26px;
  }
  .brk { display: block; width: 100%; height: 0; }
  .group { gap: 2px; }
  .tool { min-width: 30px; height: 30px; }
  .sep { height: 18px; margin: 0 2px; }
  .sep:nth-of-type(2) { display: none; }
  .text-btn { padding: 0 8px; font-size: 10px; letter-spacing: 0.12em; }
  .seal-btn { padding: 8px 12px; font-size: 10px; letter-spacing: 0.1em; gap: 5px; }
  .seal-word { display: none; }
  .seal-mini { width: 16px; height: 16px; font-size: 11px; }
  .pill { padding: 8px 13px; font-size: 10px; letter-spacing: 0.16em; }
  .masthead { top: 16px; left: 16px; }

  /* nav becomes a right-edge column: Guide pill, a 目次 toggle, and chips on demand */
  .sitenav {
    top: 16px; right: 14px;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding: 0;
    border: none;
    border-radius: 0;
  }
  body.scrolled .sitenav { background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: none; }
  .navbrand { display: none; }
  .sitenav .pill { order: -2; }
  .navtoggle {
    order: -1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    appearance: none;
    cursor: pointer;
    font-family: var(--serif);
    font-size: 12px;
    letter-spacing: 0.18em;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(246, 241, 228, 0.85);
    color: var(--ink);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 10px 24px -16px rgba(28, 30, 32, 0.5);
    transition: border-color 0.3s ease;
  }
  .navtoggle-arrow {
    color: var(--shu);
    font-size: 11px;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .sitenav.open .navtoggle { border-color: rgba(191, 63, 42, 0.55); }
  .sitenav.open .navtoggle-arrow { transform: rotate(180deg); }
  .navlinks { display: none; flex-direction: column; align-items: flex-end; gap: 7px; }
  .sitenav.open .navlinks { display: flex; }
  .navlinks a {
    font-size: 9.5px;
    letter-spacing: 0.16em;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(246, 241, 228, 0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  .sitenav.open .navlinks a { animation: chipIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .sitenav.open .navlinks a:nth-child(2) { animation-delay: 0.04s; }
  .sitenav.open .navlinks a:nth-child(3) { animation-delay: 0.08s; }
  .sitenav.open .navlinks a:nth-child(4) { animation-delay: 0.12s; }
  .sitenav.open .navlinks a:nth-child(5) { animation-delay: 0.16s; }
  .navlinks a::after { display: none; }
  .navlinks a.active { border-color: rgba(191, 63, 42, 0.55); }

  /* scroll cue → tappable chip above the toolbar */
  .scrollcue { right: 14px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 78px); }
  .scrollcue-txt, .scrollcue-line { display: none; }
  .scrollcue-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(246, 241, 228, 0.85);
    color: var(--shu);
    font-size: 16px;
    box-shadow: 0 10px 24px -14px rgba(28, 30, 32, 0.5);
    animation: cueBob 2.6s ease-in-out infinite;
  }
  @keyframes cueBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
}
@keyframes chipIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* content grids collapse */
@media (max-width: 1080px) {
  .studies { grid-template-columns: repeat(2, 1fr); }
  .phys-grid { grid-template-columns: 1fr; max-width: 560px; }
  .prac-grid { grid-template-columns: 1fr; max-width: 560px; }
}
@media (max-width: 720px) {
  .sect { padding: 72px 0; }
  .sect-kanji { font-size: 120px; top: 40px; right: 4px; }
  .studies { gap: 18px 12px; }
  .study-title { font-size: 12px; }
  .study-note { font-size: 9px; }
  .phi-block { grid-template-columns: 56px 1fr; gap: 16px; }
  .phi-kanji { font-size: 38px; }
  /* the tone scale reads as a descending ladder on small screens */
  .tone-scale { grid-template-columns: 1fr; gap: 18px; }
  .tone-frame canvas { aspect-ratio: 16 / 5.5; }
  .tone-card figcaption {
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
  }
  .tone-note { flex-basis: 100%; }
  .prac-controls { border-radius: 14px; padding: 18px 18px; }
  .foot-inner { grid-template-columns: 1fr; }
  .foot-links { padding-top: 0; }
  .foot-colophon { flex-direction: column; }
}

/* ————— reduced motion ————— */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
