/* ==========================================================================
   Home (/) — 「一本の糸で、商売まわりを結ぶ」
   ========================================================================== */

/* ---------- hero ---------- */
.hero { position: relative; padding-top: calc(var(--header-h) + clamp(48px, 7vw, 104px)); overflow: hidden; }
.hero .ruled { top: var(--header-h); height: 760px; }
.hero-copy { position: relative; z-index: 2; }
.hero h1 { max-width: none; }
.hero-actions .ticks { flex-direction: column; gap: 6px; }
.hero-knot { position: relative; }
.hero-knot svg {
  position: absolute; left: -.08em; bottom: -.3em; width: 5.9em; height: .62em; overflow: visible; pointer-events: none;
}
.hero-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 64px; align-items: end;
  margin-top: clamp(28px, 3.4vw, 48px);
}
.hero-row .lead { max-width: 31em; }
.hero-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.hero-actions .btns { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 900px) {
  .hero-row { grid-template-columns: 1fr; }
}

/* 製品の舞台: 画面・スマホ・通知を奥行きで重ねる */
.hero-stage {
  position: relative; z-index: 1;
  margin-top: clamp(56px, 7vw, 96px);
  perspective: 2000px;
  padding-bottom: clamp(60px, 8vw, 120px);
}
.stage-inner {
  position: relative; max-width: 1180px; margin-inline: auto;
  transform-origin: 50% 0;
  transform: rotateX(calc((1 - var(--p, 1)) * 16deg)) scale(calc(.93 + var(--p, 1) * .07));
  will-change: transform;
}
.stage-inner .window { position: relative; z-index: 1; }
.stage-floor {
  position: absolute; left: 6%; right: 6%; bottom: 0; height: 60%;
  background: radial-gradient(ellipse at 50% 100%, rgba(15, 122, 95, .10), transparent 70%);
  pointer-events: none;
}
.hero-phone {
  position: absolute; z-index: 3; right: -3%; bottom: -12%;
  transform: translateY(calc((1 - var(--p, 1)) * 90px)) rotate(2deg);
  width: 218px;
}
/* 朱の手書きメモ（編集者の赤ペン） */
.hero-note { position: absolute; z-index: 4; }
.hero-note.n1 { left: -1.5%; top: -62px; }
.hero-note.n2 { right: 1%; top: -58px; flex-direction: row; transform: rotate(2deg); }
.hero-note.n2 .ink { margin-top: 14px; }
.hero-toast {
  position: absolute; z-index: 3; right: -3%; top: 12%;
  transform: translateY(calc((1 - var(--p, 1)) * -50px));
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px;
  padding: 12px 18px 12px 12px; box-shadow: var(--shadow-soft);
  font-size: .8rem; line-height: 1.5;
}
.hero-toast .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--thread-tint); color: var(--thread); display: grid; place-items: center; }
.hero-toast .ico svg { width: 17px; height: 17px; }
.hero-toast b { display: block; font-size: .84rem; }
.hero-toast span { color: var(--ink-3); }
@media (max-width: 980px) {
  .hero-phone { width: 180px; right: 0; bottom: -12%; }
  .hero-toast { right: 0; top: 8%; }
}
@media (max-width: 720px) {
  .hero-stage { perspective: none; margin-inline: calc(var(--gutter) * -1); padding-inline: 0; overflow: hidden; }
  .stage-inner { transform: none; padding-left: var(--gutter); }
  /* スマホで見ている人には、スマホ版Knottleを主役に。パソコン画面は奥へ下げる */
  .stage-inner { padding-top: 8px; }
  .stage-inner .window { width: 760px; max-width: none; zoom: .5; opacity: .92; }
  .hero-phone { left: auto; right: 12px; bottom: -64px; width: 184px; padding: 8px; border-radius: 30px; transform: rotate(3deg); }
  .hero-phone .phone-screen { border-radius: 23px; }
  .hero-phone .m-home { zoom: .86; min-height: 0; }
  .hero-phone .m-act:last-of-type { display: none; }
  .hero-stage { padding-bottom: 110px; }
  .hero-toast, .hero-note { display: none; }
}

/* ---- dashboard mock（実アプリのダッシュボード構成に準拠） ---- */
.app { display: grid; grid-template-columns: 196px 1fr; min-height: 470px; font-size: 13px; line-height: 1.5; color: #1f2937; }
.app-side { border-right: 1px solid #ebe8e1; background: #faf9f6; padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.app-tenant { display: flex; align-items: center; gap: 8px; padding: 4px 8px 14px; font-weight: 700; font-size: 13px; }
.app-tenant img { width: 22px; height: 22px; object-fit: cover; object-position: 100% 50%; }
.app-search { margin: 0 4px 10px; border: 1px solid #e7e4dc; background: #fff; border-radius: 7px; padding: 6px 8px; font-size: 11px; color: #9ca3af; display: flex; justify-content: space-between; }
.app-nav { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; color: #4b5563; font-size: 12.5px; }
.app-nav svg { width: 15px; height: 15px; flex-shrink: 0; }
.app-nav.on { background: #fff; color: #111827; font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.app-main { padding: 22px 26px; min-width: 0; }
.app-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; color: #111827; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { border-radius: 10px; padding: 12px 14px; border: 1px solid rgba(0, 0, 0, .05); }
.kpi p { font-size: 11px; font-weight: 700; color: #374151; }
.kpi b { display: block; font-size: 22px; font-weight: 800; letter-spacing: .01em; margin-top: 2px; }
.kpi b small { font-size: 11px; color: #6b7280; font-weight: 500; margin-left: 3px; }
.kpi.k1 { background: #eef4fd; } .kpi.k1 b { color: #2563eb; }
.kpi.k2 { background: #f7f2fc; } .kpi.k2 b { color: #7e3fce; }
.kpi.k3, .kpi.k4 { background: #eaf7f0; } .kpi.k3 b, .kpi.k4 b { color: #0e8a5f; }
.app-sub { font-size: 12.5px; font-weight: 700; margin: 18px 0 6px; padding-bottom: 6px; border-bottom: 1px solid #ebe8e1; }
.acts li { display: flex; gap: 10px; padding: 7px 0; }
.acts svg { width: 13px; height: 13px; color: #9ca3af; margin-top: 3px; flex-shrink: 0; }
.acts p { font-size: 12px; color: #111827; }
.acts span { display: block; font-size: 10.5px; color: #9ca3af; }

/* ---- phone（モバイルのホーム） ---- */
.m-home { padding: 36px 14px 0; min-height: 400px; font-size: 11px; line-height: 1.5; color: #111827; background: #f8f7f3; }
.m-title { font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.m-card { background: #fff; border: 1px solid #ebe8e1; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.m-card b { font-size: 11.5px; display: block; margin-bottom: 4px; }
.m-card li { color: #4b5563; padding: 2px 0; display: flex; gap: 6px; align-items: center; }
.m-card li i { width: 10px; height: 10px; border: 1.3px solid #c5c1b6; border-radius: 3px; flex-shrink: 0; }
.m-card li.done { text-decoration: line-through; color: #9ca3af; }
.m-card li.done i { background: var(--thread); border-color: var(--thread); }
.m-label { font-size: 9.5px; font-weight: 700; color: #6b7280; letter-spacing: .06em; margin: 12px 0 6px; }
.m-act { background: #fff; border: 1px solid #ebe8e1; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
.m-act span { display: block; color: #9ca3af; font-size: 9.5px; }
.m-nav { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid #ebe8e1; background: #fff; padding: 8px 4px 14px; margin: 10px -14px 0; }
.m-nav span { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9px; color: #9ca3af; }
.m-nav span.on { color: var(--thread); font-weight: 700; }
.m-nav svg { width: 15px; height: 15px; }

/* ---------- 01 ある一日（課題） ----------
   時間帯で地の色が変わる4場面。線画はスクロール量（--p）で描かれる。
   朱＝困りごと、紺＝線、夜の場面だけ紙色の線に反転。 */
.day {
  /* 読み進めるほど、紙色から夕暮れの色味へわずかに移る */
  background: color-mix(in oklab, var(--paper) calc(100% - var(--p, 0) * 55%), #eadfd3);
}
.day-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px 64px; align-items: end; }
.day-head .kicker { grid-column: 1 / -1; margin-bottom: 0; }
.day-head .lead { max-width: 30em; }

.clock { margin-top: clamp(56px, 7vw, 96px); }
.clock-track { position: relative; height: 2px; background: var(--rule); border-radius: 2px; }
.clock-fill { position: absolute; inset: 0; background: linear-gradient(90deg, #d9a441, var(--shu) 60%, var(--ink)); transform-origin: left; transform: scaleX(var(--p, 0)); border-radius: 2px; }
.clock-dot {
  position: absolute; top: 50%; left: calc(var(--p, 0) * 100%); width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--shu); box-shadow: 0 0 0 5px var(--shu-soft);
}
.clock-hours { display: flex; justify-content: space-between; margin-top: 12px; font-family: var(--mono); font-size: .72rem; color: var(--ink-3); letter-spacing: .06em; }

.scenes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.scene {
  --bg: #f6efdf; --line: var(--ink); --hot: var(--shu); --tint: rgba(217, 164, 65, .22); --tx: var(--ink); --tx2: var(--ink-2);
  position: relative; background: var(--bg); color: var(--tx); border-radius: 20px; padding: 22px 22px 26px;
  display: flex; flex-direction: column;
}
.scene-noon  { --bg: #f7f0de; --tint: rgba(217, 164, 65, .24); }
.scene-dusk  { --bg: #f1dfd0; --tint: rgba(185, 71, 31, .12); transform: translateY(28px); }
.scene-night { --bg: #1d2542; --line: #efe8da; --hot: var(--shu-night); --tint: rgba(239, 232, 218, .1); --tx: #f3efe6; --tx2: rgba(243, 239, 230, .72); }
.scene-month {
  --bg: #fbfaf6; --tint: rgba(27, 36, 64, .06); transform: translateY(28px);
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(27, 36, 64, .07) 27px 28px);
  border: 1px solid var(--rule-soft);
}
.scene-art { aspect-ratio: 240 / 150; margin: 0 -6px 18px; }
.sketch { width: 100%; height: 100%; overflow: visible; }
.sketch .sk { fill: none; stroke: var(--line); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - min(1, var(--p, 1) * 1.25)); }
.sketch .sk.hot { stroke: var(--hot); stroke-width: 2.2; stroke-dashoffset: calc(1 - max(0, min(1, var(--p, 1) * 1.6 - .6))); }
.sketch .sk.moon { stroke: #e9c27a; stroke-width: 2; }
.sketch .fill { fill: var(--tint); stroke: none; opacity: var(--p, 1); }
.scene-time { display: flex; align-items: baseline; gap: 10px; font-size: .8rem; font-weight: 700; color: var(--hot); letter-spacing: .04em; }
.scene-time time { font-family: var(--mono); font-size: .9rem; }
.scene-time span::before { content: "— "; }
.scene h3 { font-size: clamp(1.02rem, .96rem + .3vw, 1.16rem); font-weight: 700; line-height: 1.55; margin: 8px 0 10px; }
.scene p:last-child { font-size: .88rem; color: var(--tx2); line-height: 1.85; }

.day-tail {
  margin-top: clamp(72px, 9vw, 128px); max-width: 27em;
  /* スマホでも「この『つなぎ直す』仕事です。」（14字）が1行に収まる大きさまで下げる */
  font-size: clamp(1.25rem, .6rem + 3.1vw, 2.9rem);
  font-family: var(--serif); font-weight: 800; line-height: 1.6; font-feature-settings: "palt" 1;
}
.day-tail .strike-thread { color: var(--ink-3); }

@media (max-width: 1100px) {
  .scenes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .scene-dusk, .scene-month { transform: none; }
  .scene:nth-child(even) { transform: translateY(32px); }
}
@media (max-width: 760px) {
  .day-head { grid-template-columns: 1fr; }
  .clock { display: none; }
  /* スマホは横にめくる */
  .scenes {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px;
    margin-inline: calc(var(--gutter) * -1); padding: 8px var(--gutter) 20px; scrollbar-width: none;
  }
  .scenes::-webkit-scrollbar { display: none; }
  .scene, .scene:nth-child(even) { flex: 0 0 82%; scroll-snap-align: center; transform: none; }
}

/* ---------- ほどいて、結ぶ（固定スクロール） ----------
   home.js が区間の進み具合 --t（0→1）を渡す。
   0〜.3: 朱の絡まった線でつながった道具 / .3〜.75: 緑の糸へ寄って並ぶ / .75〜1: 結び目と言葉が現れる */
.knot { background: var(--paper); }
.knot-track { height: 260vh; position: relative; }
.knot-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; padding-top: calc(var(--header-h) + clamp(28px, 5vh, 64px)); padding-bottom: 24px; overflow: hidden; }
.knot-copy .kicker { margin-bottom: 14px; }
.knot-say {
  position: relative; font-family: var(--serif); font-weight: 800; font-feature-settings: "palt" 1;
  font-size: clamp(1.8rem, 1rem + 3vw, 3.4rem); line-height: 1.3; min-height: 1.3em;
}
.knot-say span { display: block; transition: opacity .5s, transform .6s var(--ease-out); }
.knot-say .say-b { position: absolute; left: 0; top: 0; opacity: 0; transform: translateY(.4em); color: var(--thread-2); }
.knot.is-tied .say-a { opacity: 0; transform: translateY(-.4em); }
.knot.is-tied .say-b { opacity: 1; transform: none; }
.knot-wrap { flex: 1; min-height: 0; display: flex; }
.knot-stage { position: relative; flex: 1; container-type: size; margin-top: 12px; }
.knot-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.knot-lines path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }
.knot-lines .tangle { stroke: var(--shu); stroke-width: 1.8; opacity: calc(1 - var(--t2, 0) * 1.4); stroke-dashoffset: calc(var(--t2, 0) * -1); }
.knot-lines .thread { stroke: var(--thread); stroke-width: 3; stroke-dashoffset: calc(1 - var(--t2, 0)); }
.knot-lines .thread.v { display: none; }

.tool {
  /* 行き先（--tx/--ty）は画面幅で切り替える。インライン指定の --x1 等は上書きできないので別名にする */
  --tx: var(--x1); --ty: var(--y1);
  --x: calc(var(--x0) + (var(--tx) - var(--x0)) * var(--e, 0));
  --y: calc(var(--y0) + (var(--ty) - var(--y0)) * var(--e, 0));
  position: absolute; left: 0; top: 0;
  transform: translate(calc(var(--x) * 1cqw - 50%), calc(var(--y) * 1cqh - 50%)) rotate(calc((1 - var(--e, 0)) * var(--r, -4deg)));
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px; font-size: .88rem; font-weight: 700;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid color-mix(in oklab, var(--shu) calc(100% - var(--e, 0) * 100%), var(--thread));
  box-shadow: 0 10px 24px -16px rgba(27, 36, 64, .5);
  will-change: transform;
}
.tool:nth-child(odd) { --r: 5deg; }
.tool { z-index: 2; }
.tool.hi { z-index: 1; }
/* 結び終えたら、道具から結び目へ細い糸を垂らす */
.tool::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 1.5px; margin-left: -.75px;
  height: calc((59 - var(--y1)) * 1cqh - 24px); background: var(--thread);
  transform-origin: top; transform: scaleY(var(--t3, 0));
}
.tool i { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in oklab, var(--shu) calc(100% - var(--e, 0) * 100%), var(--thread)); }
.stops li {
  position: absolute; left: 0; top: 0; transform: translate(calc(var(--sx) * 1cqw - 50%), calc(59cqh - 7px));
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: .92rem; font-weight: 700; color: var(--ink); opacity: var(--t3, 0);
}
.stops li::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--thread);
  box-shadow: 0 0 0 calc(var(--t3, 0) * 6px) var(--thread-glow);
}
.stops li:first-child::before, .stops li:last-child::before { background: var(--thread); }

@media (max-width: 760px) {
  .knot-track { height: 200vh; }
  .knot-lines .thread.h { display: none; }
  .knot-lines .thread.v { display: inline; }
  .tool { --tx: var(--mx1); --ty: var(--my1); font-size: .76rem; padding: 6px 10px; }
  .tool::after { display: none; }
  .stops li { flex-direction: row; gap: 8px; font-size: .78rem; transform: translate(calc(18cqw - 7px), calc(var(--sy) * 1cqh - 50%)); }
}
/* 動きを減らす設定: 固定スクロールをやめ、結び終えた状態だけを見せる */
@media (prefers-reduced-motion: reduce) {
  .knot-track { height: auto; }
  .knot-sticky { position: static; height: auto; min-height: 640px; }
  .knot-stage { min-height: 420px; }
  .knot .say-a { display: none; }
  .knot .say-b { position: static; opacity: 1; transform: none; }
  .tool { --e: 1; }
  .knot-lines .tangle { display: none; }
  .knot-lines .thread { stroke-dashoffset: 0; }
  .stops li { opacity: 1; }
}

/* ---------- flow（機能） ---------- */
.flow-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.flow-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 5vw, 88px); margin-top: clamp(64px, 8vw, 120px); }
.flow-index { position: sticky; top: calc(var(--header-h) + 48px); align-self: start; display: grid; grid-template-columns: 2px 1fr; gap: 0 20px; }
.flow-rail { position: relative; background: var(--rule); border-radius: 2px; }
.flow-rail i { position: absolute; left: 0; right: 0; top: 0; height: 100%; background: var(--thread); transform-origin: top; transform: scaleY(var(--p, 0)); border-radius: 2px; }
.flow-index ol { display: flex; flex-direction: column; gap: 4px; }
.flow-index a { display: block; padding: 12px 0; color: var(--ink-3); transition: color .3s; line-height: 1.5; }
.flow-index a span { display: block; font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; }
.flow-index a b { font-size: .95rem; font-weight: 700; }
.flow-index a:hover, .flow-index a[aria-current="true"] { color: var(--ink); }
.flow-index a[aria-current="true"] span { color: var(--thread); }

.chapters { display: flex; flex-direction: column; gap: clamp(96px, 12vw, 180px); }
.chapter-visual {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  padding: clamp(24px, 4vw, 56px);
  min-height: 380px; display: grid; place-items: center;
}
.chapter-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(var(--rule) 1px, transparent 1px); background-size: 22px 22px; opacity: .6;
}
.chapter-visual > * { position: relative; }
.chapter-text { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px clamp(28px, 4vw, 64px); margin-top: 36px; }
.chapter-no { font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; color: var(--thread); margin-bottom: 10px; }
.chapter-text p { color: var(--ink-2); max-width: 32em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chips li { font-size: .78rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); color: var(--ink-2); }
@media (max-width: 1000px) {
  .flow-body { grid-template-columns: 1fr; }
  .flow-index { display: none; }
}
@media (max-width: 760px) {
  .chapter-text { grid-template-columns: 1fr; }
  .chapter-visual { min-height: 0; padding: 20px; }
  .doc-steps { gap: 4px; font-size: .72rem; }
  .doc-steps span { padding: 4px 9px; }
}

/* chapter 01: 案件詳細 */
.deal-card { width: min(100%, 560px); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-ui); border: 1px solid var(--rule-soft); padding: 22px 24px; font-size: 13px; line-height: 1.6; }
.deal-card .dc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.deal-card .dc-head b { font-size: 16px; display: block; }
.deal-card .dc-head span { color: var(--ink-3); font-size: 12px; }
.deal-card .dc-amt { font-weight: 800; font-size: 16px; white-space: nowrap; }
.stages { display: grid; grid-template-columns: repeat(4, 1fr); margin: 20px 0 6px; position: relative; }
.stages::before { content: ""; position: absolute; left: 12.5%; right: 12.5%; top: 8px; height: 2px; background: var(--rule); }
.stages::after { content: ""; position: absolute; left: 12.5%; width: 25%; top: 8px; height: 2px; background: var(--thread); transform-origin: left; transform: scaleX(0); transition: transform .9s var(--ease-io); }
.stages span { position: relative; text-align: center; font-size: 11.5px; padding-top: 22px; color: var(--ink-3); transition: color .4s; }
.stages span::before { content: ""; position: absolute; top: 2px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rule); z-index: 1; transition: background .4s, border-color .4s, box-shadow .4s; }
/* ループ: 既定＝見積中 / .is-on＝受注に進み、活動に1行増える */
.stages .s1 { color: var(--ink); font-weight: 700; }
.stages .s1::before { border-color: var(--thread); box-shadow: 0 0 0 4px var(--thread-glow); }
.is-on .stages::after { transform: scaleX(1); }
.is-on .stages .s1::before { background: var(--thread); box-shadow: none; }
.is-on .stages .s2 { color: var(--ink); font-weight: 700; }
.is-on .stages .s2::before { border-color: var(--thread); box-shadow: 0 0 0 4px var(--thread-glow); transition-delay: .7s; }
.tl .tl-new { display: grid; max-height: 0; opacity: 0; overflow: hidden; padding: 0; transition: max-height .5s var(--ease-out) .8s, opacity .4s .8s, padding .5s .8s; }
.is-on .tl .tl-new { max-height: 40px; opacity: 1; padding: 5px 0; }
.tl .tl-new span { background: linear-gradient(90deg, var(--thread-tint), transparent); border-radius: 4px; }

/* ループ: 見積 v1 → v2（諸経費の行が入り、合計が変わる） */
.quote-stack .v2, .doc-steps .v2 { display: none; }
.quote-stack.is-on .v1, .quote-stack.is-on ~ .doc-steps .v1 { display: none; }
.quote-stack.is-on .v2, .quote-stack.is-on ~ .doc-steps .v2 { display: inline; }
.qd-sum b { font-weight: inherit; }
.qd-ver .v1 { background: var(--ink); border-color: var(--ink); color: #fff; }
.quote-stack.is-on .qd-ver .v1 { display: inline; background: none; border-color: var(--rule); color: var(--ink-3); }
.quote-stack.is-on .qd-ver .v2 { display: inline; background: var(--ink); border-color: var(--ink); color: #fff; }
.qd-ver .v2 { display: inline; }
.qd-table tr.add { display: none; }
.quote-stack.is-on .qd-table tr.add { display: table-row; animation: rowin .7s var(--ease-out) .25s both; }
.quote-stack.is-on .qd-table tr.add td { background: rgba(15, 122, 95, .08); }
@keyframes rowin { from { opacity: 0; } to { opacity: 1; } }
.quote-stack.is-on .quote-doc { animation: swap .7s var(--ease-out); }
@keyframes swap { 0% { transform: translate(14px, -10px) rotate(1.5deg); opacity: .4; } 100% { transform: none; opacity: 1; } }
.quote-stack.is-on .total { color: var(--thread-2); }

/* ループ: 撮った写真が「現場写真」フォルダに入る */
.drive { position: relative; }
.fly {
  position: absolute; right: 22px; top: 54px; display: inline-flex; align-items: center; gap: 6px; opacity: 0;
  font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 8px; background: #fff; color: var(--ink);
  box-shadow: 0 12px 24px -12px rgba(27, 36, 64, .5); border: 1px solid var(--rule); pointer-events: none;
}
.fly svg { width: 14px; height: 14px; color: #2f6fb5; }
.drive.is-on .fly { animation: fly 1.8s var(--ease-io) forwards; }
@keyframes fly {
  0% { opacity: 0; transform: translate(0, -10px) scale(.9); }
  20% { opacity: 1; transform: translate(0, 0) scale(1); }
  75% { opacity: 1; transform: translate(-190px, 124px) scale(.7); }
  100% { opacity: 0; transform: translate(-200px, 128px) scale(.5); }
}
.trow .plus { margin-left: 8px; font-size: 10px; font-weight: 700; color: #fff; background: var(--thread); border-radius: 999px; padding: 0 6px; opacity: 0; }
.drive.is-on .trow .plus { animation: pop 2.4s ease forwards; }
@keyframes pop { 0%, 60% { opacity: 0; transform: scale(.4); } 72% { opacity: 1; transform: scale(1.15); } 100% { opacity: 1; transform: scale(1); } }

/* ループ: スマホで撮影 → 保存の通知 */
.m-capture .m-toast { opacity: 0; transform: translateY(8px); }
.m-capture.is-on .m-toast { animation: toast 2.6s var(--ease-out) forwards .5s; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 15%, 85% { opacity: 1; transform: none; } 100% { opacity: 1; transform: none; } }
.m-capture.is-on .m-big div:first-child { animation: shutter .5s ease; }
@keyframes shutter { 0% { filter: none; } 30% { filter: brightness(1.6); transform: scale(.96); } 100% { filter: none; transform: none; } }
.dc-sec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule-soft); }
.dc-sec > p { font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: .06em; margin-bottom: 8px; }
.tl li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; padding: 5px 0; font-size: 12.5px; }
.tl time { font-family: var(--mono); font-size: 11px; color: var(--ink-3); padding-top: 1px; }
.tl .who { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 0 6px; margin-right: 6px; background: var(--paper-2); color: var(--ink-2); }
.tl .who.ai { background: var(--thread-tint); color: var(--thread-2); }
.task-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; padding: 3px 0; }
.task-row i { width: 14px; height: 14px; border: 1.5px solid #c5c1b6; border-radius: 4px; flex-shrink: 0; }
.task-row em { margin-left: auto; font-style: normal; font-size: 11px; color: #b4552d; font-weight: 700; }

/* chapter 02: 見積書 */
.quote-stack { position: relative; width: min(100%, 520px); }
.quote-ghost { position: absolute; inset: 0; background: var(--surface); border-radius: 6px; border: 1px solid var(--rule); }
.quote-ghost.g1 { transform: translate(18px, -14px) rotate(2.5deg); opacity: .55; }
.quote-ghost.g2 { transform: translate(9px, -7px) rotate(1.2deg); opacity: .8; }
.quote-doc { position: relative; background: #fff; border-radius: 6px; box-shadow: var(--shadow-ui); padding: 26px 28px 24px; font-size: 12px; line-height: 1.6; color: #1f2937; }
.qd-top { display: flex; justify-content: space-between; align-items: flex-start; }
.qd-title { font-family: var(--serif); font-weight: 800; font-size: 20px; letter-spacing: .3em; }
.qd-ver { display: flex; gap: 4px; }
.qd-ver span { font-family: var(--mono); font-size: 10.5px; padding: 2px 7px; border-radius: 4px; border: 1px solid var(--rule); color: var(--ink-3); }
.qd-ver span.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.qd-to { margin-top: 14px; display: flex; justify-content: space-between; gap: 16px; font-size: 11px; color: #4b5563; }
.qd-to b { font-size: 13px; color: #111827; border-bottom: 1px solid #111827; padding-bottom: 2px; display: inline-block; }
.qd-to .issuer { text-align: right; padding-right: 58px; }
.qd-table { width: 100%; margin-top: 16px; font-size: 11.5px; }
.qd-table th { text-align: left; font-weight: 700; font-size: 10.5px; color: #6b7280; border-bottom: 1px solid #111827; padding: 4px 0; }
.qd-table td { padding: 6px 0; border-bottom: 1px solid #eee; }
.qd-table td:last-child, .qd-table th:last-child { text-align: right; }
.qd-sum { margin-top: 10px; margin-left: auto; width: 60%; font-size: 11.5px; }
.qd-sum div { display: flex; justify-content: space-between; padding: 2px 0; }
.qd-sum .total { border-top: 1.5px solid #111827; margin-top: 4px; padding-top: 6px; font-weight: 800; font-size: 14px; }
.qd-bank { margin-top: 14px; padding-top: 10px; border-top: 1px dashed #d8d4ca; font-size: 10.5px; color: #6b7280; }
.qd-seal { position: absolute; right: 26px; top: 66px; width: 46px; height: 46px; border: 2px solid rgba(15, 122, 95, .65); color: rgba(15, 122, 95, .8); border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 800; font-size: 12px; transform: rotate(-12deg); }
.doc-steps { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 26px; flex-wrap: wrap; font-size: .8rem; font-weight: 700; }
.doc-steps span { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-3); }
.doc-steps span.on { background: var(--thread); border-color: var(--thread); color: #fff; }
.doc-steps svg { width: 14px; height: 14px; color: var(--ink-3); }

/* chapter 03: Drive ツリー */
.drive { width: min(100%, 520px); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-ui); border: 1px solid var(--rule-soft); overflow: hidden; }
.drive-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--rule-soft); font-size: 12px; color: var(--ink-3); }
.drive-bar b { color: var(--ink); }
.drive-bar svg { width: 12px; height: 12px; }
.tree { padding: 10px 8px 14px; font-size: 13px; }
.tree ul { padding-left: 20px; }
.tree > ul { padding-left: 0; }
.trow {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 6px 10px; border-radius: 7px; line-height: 1.4;
}
button.trow:hover { background: var(--paper-2); }
.trow .chev { width: 14px; height: 14px; color: var(--ink-3); transition: transform .25s var(--ease-out); flex-shrink: 0; }
.trow[aria-expanded="true"] .chev { transform: rotate(90deg); }
.trow .spacer { width: 14px; flex-shrink: 0; }
.trow .fi { width: 16px; height: 16px; flex-shrink: 0; }
.trow .fi.folder { color: #c49a3a; }
.trow .fi.pdf { color: #c2462f; }
.trow .fi.img { color: #2f6fb5; }
.trow .fi.aud { color: var(--thread); }
.tree ul[hidden] { display: none; }
.drive-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--rule-soft); background: var(--thread-tint); color: var(--thread-2); font-size: 12px; font-weight: 700; }
.drive-foot svg { width: 14px; height: 14px; }

/* chapter 04: 現場 */
.site-visual { display: flex; align-items: center; gap: clamp(20px, 4vw, 56px); flex-wrap: wrap; justify-content: center; }
.m-capture { padding: 36px 14px 0; min-height: 420px; font-size: 11px; line-height: 1.5; color: #111827; background: #f8f7f3; display: flex; flex-direction: column; }
.m-capture .m-nav { margin-top: auto; }
.m-step { display: flex; justify-content: space-between; align-items: center; background: #fff; border: 1px solid #ebe8e1; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.m-step span { color: #9ca3af; font-size: 9.5px; display: block; }
.m-step b { font-size: 11.5px; }
.m-step svg { width: 14px; height: 14px; color: var(--thread); }
.m-big { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.m-big div { background: var(--thread); color: #fff; border-radius: 12px; padding: 16px 8px; text-align: center; font-weight: 700; font-size: 11px; }
.m-big div:last-child { background: #fff; color: var(--thread-2); border: 1.5px solid var(--thread); }
.m-big svg { width: 20px; height: 20px; margin: 0 auto 6px; }
.m-toast { margin-top: 14px; background: #11182b; color: #fff; border-radius: 10px; padding: 8px 10px; font-size: 10px; display: flex; gap: 6px; align-items: center; }
.m-toast svg { width: 12px; height: 12px; color: var(--thread-night); flex-shrink: 0; }
.site-notes { display: flex; flex-direction: column; gap: 12px; max-width: 260px; }
.site-note { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; font-size: .84rem; line-height: 1.5; }
.site-note .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--thread-tint); color: var(--thread); display: grid; place-items: center; }
.site-note .ico svg { width: 18px; height: 18px; }
.site-note span { display: block; color: var(--ink-3); font-size: .76rem; }
@media (max-width: 560px) { .site-notes { max-width: none; width: 100%; } }

/* ---------- principles（設計思想） ---------- */
/* 縦書きの見出しを左に立て、右に3つの決めごとを行で並べる（他の章と組みを変える） */
.principles-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(40px, 8vw, 140px); align-items: start; }
.principles-title { position: sticky; top: calc(var(--header-h) + 40px); display: flex; flex-direction: column; gap: 26px; }
.principles-title .kicker { margin: 0; }
.tate {
  writing-mode: vertical-rl; font-family: var(--serif); font-weight: 800; font-feature-settings: "palt" 1;
  font-size: clamp(1.9rem, 1.1rem + 1.8vw, 2.7rem); line-height: 1.6; letter-spacing: .08em;
}
.tate .nb { white-space: nowrap; }
.principles-title .tate { align-self: flex-start; margin-left: 4px; }
.principles-body .lead { max-width: 34em; }
.principles { margin-top: clamp(40px, 5vw, 64px); border-top: 1px solid var(--rule); }
.principle { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 6px 28px; padding: clamp(28px, 3.4vw, 44px) 0; border-bottom: 1px solid var(--rule); }
/* 漢数字は印章の枠に入れて「数字」として読ませる */
.principle .num {
  font-family: var(--serif); font-weight: 800; font-size: 1.7rem; line-height: 1; color: var(--thread);
  width: 58px; height: 58px; display: grid; place-items: center; grid-row: span 2;
  border: 1.5px solid currentColor; border-radius: 8px; rotate: -3deg;
}
.principle h3 { font-family: var(--serif); font-weight: 800; font-size: clamp(1.3rem, 1.1rem + .6vw, 1.6rem); line-height: 1.5; }
.principle p { color: var(--ink-2); font-size: .95rem; max-width: 32em; }
@media (max-width: 860px) {
  .principles-grid { grid-template-columns: 1fr; }
  .principles-title { position: static; }
  .tate { writing-mode: horizontal-tb; letter-spacing: .01em; font-size: clamp(1.85rem, 1.05rem + 2.9vw, 3.35rem); line-height: 1.34; max-height: none; }
  .tate .nb { white-space: normal; }
  .principles-title .tate { align-self: stretch; margin-left: 0; }
  .principle { grid-template-columns: 3.4rem 1fr; gap: 0 18px; }
  .principle .num { width: 48px; height: 48px; font-size: 1.4rem; }
}

/* ---------- AI ---------- */
.ai { overflow: hidden; }
.ai-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(40px, 5vw, 80px); align-items: center; }
.ai-plus { display: table; font-size: .8rem; font-weight: 700; color: var(--on-night-2); border: 1px solid var(--rule-night); border-radius: 999px; padding: 4px 14px; margin-bottom: 18px; }
.ai-points { margin-top: 30px; border-top: 1px solid var(--rule-night); }
.ai-points li { display: grid; grid-template-columns: 22px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--rule-night); color: var(--on-night); font-size: .95rem; }
.ai-points svg { width: 18px; height: 18px; color: var(--thread-night); margin-top: 5px; }
.ai-cta { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin-top: 36px; }
.ai-cta .link-arrow { color: var(--on-night); }
.ai-chat-wrap { position: relative; }
.ai-chat-wrap::before {
  content: ""; position: absolute; inset: -12% -20%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(79, 191, 152, .14), transparent 70%);
}
.ai-chat-wrap .chat { position: relative; }
.ai-chat-cap { margin-top: 14px; font-size: .76rem; color: var(--on-night-3); }

.audit { margin-top: clamp(96px, 11vw, 160px); border-top: 1px solid var(--rule-night); padding-top: clamp(48px, 6vw, 80px); display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); }
.audit h3 { font-family: var(--serif); font-weight: 800; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.3rem); line-height: 1.45; margin-bottom: 18px; }
.audit-log { position: relative; }
.audit-log::before { content: ""; position: absolute; left: 11px; top: 10px; bottom: 10px; width: 1.5px; background: var(--rule-night); }
.audit-log li { position: relative; display: grid; grid-template-columns: 24px 60px 1fr; gap: 14px; padding: 12px 0; align-items: baseline; }
.audit-log li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; margin-left: 7px; background: var(--on-night-3); position: relative; top: -1px; }
.audit-log li.ai::before { background: var(--thread-night); box-shadow: 0 0 0 4px rgba(79, 191, 152, .18); }
.audit-log time { font-family: var(--mono); font-size: .78rem; color: var(--on-night-3); }
.audit-log p { font-size: .93rem; color: var(--on-night); }
.audit-log .who { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 4px; margin-right: 8px; background: rgba(236, 238, 243, .1); color: var(--on-night-2); }
.audit-log li.ai .who { background: rgba(79, 191, 152, .16); color: var(--thread-night); }
@media (max-width: 900px) {
  .ai-grid, .audit { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .audit-log li { grid-template-columns: 24px 1fr; }
  .audit-log time { grid-column: 2; }
  .audit-log p { grid-column: 2; }
}

/* ---------- pricing ---------- */
.pricing-head { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px 64px; align-items: end; }
.plans { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); margin-top: clamp(48px, 6vw, 80px); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--rule); background: var(--surface); }
.plan { padding: clamp(28px, 4vw, 56px); display: flex; flex-direction: column; }
.plan-free { position: relative; }
.plan-free::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--thread); }
.plan-pro { background: var(--ink); color: var(--on-night); }
.plan-name { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; font-size: 1rem; }
.plan-flag { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--thread-tint); color: var(--thread-2); }
.plan-pro .plan-flag { background: rgba(214, 175, 98, .16); color: #e0bd78; }
.plan-price { font-family: var(--serif); font-weight: 800; font-size: clamp(3rem, 2rem + 3vw, 4.6rem); line-height: 1.1; margin-top: 22px; letter-spacing: -.01em; display: flex; align-items: baseline; flex-wrap: wrap; }
.plan-price .ink-seal { align-self: center; margin-left: 22px; }
.plan-price small { font-family: var(--sans); font-size: .95rem; font-weight: 500; color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }
.plan-pro .plan-price small { color: var(--on-night-3); }
.plan-note { margin-top: 10px; font-size: .9rem; color: var(--ink-2); max-width: 30em; }
.plan-pro .plan-note { color: var(--on-night-2); }
.plan-list { margin: 28px 0 36px; border-top: 1px solid var(--rule); flex: 1; }
.plan-pro .plan-list { border-color: var(--rule-night); }
.plan-list li { display: grid; grid-template-columns: 20px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule-soft); font-size: .93rem; }
.plan-pro .plan-list li { border-color: var(--rule-night); }
.plan-list svg { width: 16px; height: 16px; color: var(--thread); margin-top: 6px; }
.plan-pro .plan-list svg { color: #e0bd78; }
.plan-list .soon { font-size: .72rem; font-weight: 700; color: var(--on-night-3); margin-left: 6px; }
.plan .btn { align-self: flex-start; }
.pricing-foot { margin-top: 22px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
@media (max-width: 860px) {
  .pricing-head, .plans { grid-template-columns: 1fr; }
}

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.faq-side { position: sticky; top: calc(var(--header-h) + 40px); }
.faq-side .body { margin-top: 20px; font-size: .95rem; }
.faq-side .link-arrow { margin-top: 18px; }
.faq-note { display: flex; margin: 30px 0 0 6px; }
@media (max-width: 900px) { .faq-grid { grid-template-columns: 1fr; } .faq-side { position: static; } }

/* ---------- final CTA ---------- */
.final { position: relative; overflow: hidden; }
.final-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 40px; align-items: center; }
.final h2 { font-size: clamp(2.1rem, 1.1rem + 3.4vw, 4.3rem); }
.final .lead { margin-top: 26px; }
.final .btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.final-grid { position: relative; }
/* 締めのロゴ: 筆先が一筆で描き、朱の「結」の印を押す（home.js） */
.final-logo { position: relative; justify-self: end; width: 100%; max-width: 300px; aspect-ratio: 480 / 497; margin-right: 6%; }
.final-logo svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.final-logo .ln { fill: none; stroke-width: 27; stroke-linecap: round; stroke-linejoin: round; }
.final-logo .ln.g { stroke: #0e755b; }
.final-logo .ln.n { stroke: #1b2441; }
/* 交差の上下を本物に合わせる一片（緑の腕が紺の上を通る） */
.final-logo .ln.patch { stroke-linecap: butt; stroke-dasharray: 0 .036 .14 2; }
.final-logo .pen { fill: var(--ink); }
/* JS が描く前は隠しておく（JS なし・動きを減らす設定では、最初から完成形のまま） */
.js .final-logo.is-ready .ln { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .final-logo.is-ready .ln.patch { opacity: 0; stroke-dasharray: 0 .036 .14 2; stroke-dashoffset: 0; }
@media (max-width: 860px) {
  .final-grid { grid-template-columns: 1fr; }
  .final-logo { max-width: 170px; justify-self: start; order: -1; margin: 0 0 8px; }
}
/* 機能見出しは左の狭い段に入る。2行（改行位置は <br>）に収まるよう、中間の幅では文字を少し小さくする */
@media (min-width: 761px) and (max-width: 1280px) {
  .chapter-text .h2-sm { font-size: clamp(1.4rem, .5rem + 2vw, 2.1rem); }
}
