/* 「1 つの記事が生まれるまで」（ローカルヒストリアの欄から開くパネル）。
   名古屋市の記事のページを縮小した記事シート（.sheet）を左に留め、右の解説（.step）がスクロールで画面の真ん中に来たら、
   シートの data-step を切り替える（src/client/making.ts）。どの部分を点灯し、どの注釈（.ann）を出すかは data-step で決める。
   スマホ版はシートを画面の幅に縮めて上に留める（sp.css）。 */

.deep {
    padding: 110px 0 120px;
    background: var(--paper-3);
    border-top: 1px solid var(--ink);
}

.deep__head {
    display: grid;
    justify-items: center;
    gap: 18px;
    margin-bottom: 40px;
    text-align: center;
}

.deep__head h3 {
    font-family: var(--mincho);
    font-size: 44px;
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1.5;
}

.deep__head > p:last-child {
    font-family: var(--mincho);
    font-size: 16px;
    line-height: 2.1;
    color: var(--ink-2);
}

.making {
    display: grid;
    grid-template-columns: 716px 1fr;
    gap: 60px;
    width: 1240px;
    margin: 0 auto;
}

.making__stage {
    position: sticky;
    top: max(16px, calc((100vh - 772px) / 2));
    align-self: start;
    display: grid;
    grid-template-columns: 660px 1fr;
    gap: 24px;
    align-items: center;
    height: 772px;
}

.making__dots {
    display: grid;
    gap: 14px;
    justify-items: center;
}

.making__dots li {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 50%;
    font-family: var(--mincho);
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    transition:
        background-color 0.3s,
        color 0.3s,
        border-color 0.3s,
        transform 0.3s;
}

.making__dots li.is-done {
    border-color: var(--ink);
    color: var(--ink);
}

.making__dots li.is-current {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper-3);
    transform: scale(1.15);
}

.making__steps {
    padding: 0 0 20vh;
}

.step {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 92vh;
    opacity: 0.28;
    transition: opacity 0.5s;
}

.step:first-child {
    min-height: 772px;
}

.step.is-current {
    opacity: 1;
}

.step__kicker {
    display: flex;
    align-items: center;
    gap: 18px;
}

.step__kicker b {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    background: var(--ink);
    color: var(--paper-3);
    font-family: var(--mincho);
    font-size: 26px;
    font-weight: 800;
}

.step__kicker i {
    font: italic 500 22px / 1 var(--latin);
    color: var(--blue);
}

.step h4 {
    margin: 26px 0 20px;
    font-family: var(--mincho);
    font-size: 27px;
    font-weight: 800;
    line-height: 1.65;
    letter-spacing: 0.03em;
    text-wrap: balance;
}

.step__body {
    font-size: 15.5px;
    line-height: 2.15;
    color: var(--ink-2);
}

.step dl {
    display: flex;
    gap: 36px;
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--ink);
}

.step dd {
    font: 600 46px / 1 var(--latin);
    white-space: nowrap;
}

.step dd small {
    margin-left: 5px;
    font-family: var(--mincho);
    font-size: 15px;
    font-weight: 700;
    color: var(--blue);
}

.step dt {
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--muted);
}

/* 記事シート（左に固定表示するページの縮小モデル） */
.sheet {
    --sheet-bg: #fffdf8;
    --sheet-ink: #1d1b18;
    --sheet-sub: #6b655a;
    --sheet-line: #e2dac8;

    position: relative;
    width: 660px;
    background: var(--sheet-bg);
    color: var(--sheet-ink);
    box-shadow:
        0 0 0 1px var(--sheet-line),
        0 34px 70px rgb(60 45 20 / 0.2);
    transition:
        background-color 0.7s,
        color 0.7s,
        box-shadow 0.7s;
}

.sheet__chrome {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-bottom: 1px solid var(--sheet-line);
    transition: border-color 0.7s;
}

.sheet__chrome span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sheet-line);
}

.sheet__chrome em {
    margin-left: 10px;
    font: 400 10.5px / 1 var(--mono);
    color: var(--sheet-sub);
}

.sheet__mode {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font: 500 10px / 1 var(--mono);
    letter-spacing: 0.18em;
    color: var(--cyan);
    opacity: 0;
    transition: opacity 0.5s;
}

.sheet__mode i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
    animation: blink 1.2s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.25;
    }
}

.sheet__page {
    position: relative;
    padding: 18px 30px 20px;
}

.sheet__crumb {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-family: var(--mincho);
    font-size: 11px;
    letter-spacing: 0.1em;
    line-height: 1.6;
    color: var(--sheet-sub);
}

.sheet__crumb b {
    font-size: 13px;
    color: var(--sheet-ink);
}

.sheet__title {
    margin: 4px 0 12px;
    font-family: var(--mincho);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.sheet__illust {
    position: relative;
}

.sheet__illust img {
    width: 100%;
    aspect-ratio: 16 / 8;
    object-fit: cover;
    transition: filter 0.7s;
}

.sheet__body {
    position: relative;
    display: grid;
    gap: 6px;
    margin-top: 12px;
    font-family: var(--mincho);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.85;
}

.sheet__body sup,
.sheet__refs sup {
    font: 500 8px / 1 var(--mono);
    color: var(--blue);
    opacity: 0;
    transition: opacity 0.4s;
}

.src {
    position: relative;
    transition:
        background-color 0.5s,
        color 0.5s;
}

.sheet__lower {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 16px;
    height: 122px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--sheet-line);
    transition: border-color 0.7s;
}

.sheet__timeline {
    display: grid;
    align-content: space-between;
    gap: 4px;
}

.sheet__timeline li {
    position: relative;
    display: grid;
    grid-template-columns: 62px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 2px 0;
    font-size: 11.5px;
    line-height: 1.5;
}

.sheet__timeline time {
    font-family: var(--mincho);
    font-weight: 700;
    color: var(--blue);
}

.sheet__timeline b {
    font-family: var(--mincho);
    font-weight: 700;
}

.sheet__place {
    padding: 2px 9px;
    border: 1px solid var(--sheet-line);
    border-radius: 999px;
    font-size: 10px;
    color: var(--sheet-sub);
    transition:
        border-color 0.5s,
        color 0.5s;
}

.sheet__place::before {
    content: "⌖ ";
}

.sheet__map {
    position: relative;
    border: 1px solid var(--sheet-line);
    background: #f1ecdf;
    transition:
        background-color 0.7s,
        border-color 0.7s;
}

.sheet__map svg {
    width: 100%;
    height: 100%;
}

.sheet__boundary {
    fill: rgb(33 145 188 / 0.08);
    stroke: #b9ae95;
    stroke-width: 1.2;
    transition:
        stroke 0.5s,
        fill 0.5s;
}

.sheet__river {
    fill: none;
    stroke: #a9cfe0;
    stroke-width: 3;
}

.sheet__road {
    fill: none;
    stroke: #dcd3bf;
    stroke-width: 1.5;
}

.sheet__pin circle:first-child {
    fill: rgb(180 66 45 / 0.14);
    stroke: none;
    opacity: 0;
}

.sheet__pin circle:last-child {
    fill: var(--red);
}

.sheet__refs {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 14px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--sheet-line);
    font-size: 9.5px;
    line-height: 1.6;
    color: var(--sheet-sub);
    transition: border-color 0.7s;
}

.sheet__refs b {
    font-family: var(--mincho);
    font-size: 11px;
    color: var(--sheet-ink);
}

.sheet__more {
    color: var(--blue);
}

/* 注釈（各ステップでだけ現れる） */
.ann {
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.5s,
        transform 0.5s;
}

.sheet__heads span {
    position: absolute;
    z-index: 1;
    width: 4.4%;
    height: 9%;
    border: 1.5px solid #5fe3a1;
    box-shadow: 0 0 8px rgb(95 227 161 / 0.7);
    opacity: 0;
    transform: scale(1.6);
    transition:
        opacity 0.4s,
        transform 0.4s;
    transition-delay: var(--d);
}

.sheet__heads span.is-skip {
    border-color: #9fb3c8;
    border-style: dashed;
    box-shadow: none;
}

.sheet__heads i {
    position: absolute;
    left: -1.5px;
    bottom: 100%;
    padding: 2px 4px;
    background: #5fe3a1;
    color: #04121f;
    font:
        500 7.5px / 1 var(--mono),
        "Noto Sans JP",
        sans-serif;
    font-style: normal;
    white-space: nowrap;
}

.sheet__heads span.is-skip i {
    background: #9fb3c8;
}

.ann--illust {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--cyan);
    background: rgb(6 16 34 / 0.86);
    color: #d6ecfa;
    font-size: 10.5px;
    line-height: 1.7;
    transform: translateY(10px);
}

.ann__prompt {
    font-family: var(--mono), "Noto Sans JP", sans-serif;
    font-size: 10px;
    color: #a9d8f2;
}

.ann__prompt b {
    display: block;
    margin-bottom: 2px;
    color: var(--cyan);
    letter-spacing: 0.14em;
}

.ann--illust li::before {
    content: "＋ ";
    color: var(--cyan);
}

.ann--castle {
    position: absolute;
    left: 39%;
    top: 12%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 4px;
    background: var(--cyan);
    color: #04121f;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
}

.ann--castle i {
    position: absolute;
    right: 100%;
    top: 50%;
    width: 9%;
    min-width: 44px;
    border-top: 1px solid var(--cyan);
}

.ann--castle i::before {
    content: "";
    position: absolute;
    left: -42px;
    top: -42px;
    width: 76px;
    height: 84px;
    border: 1px dashed var(--cyan);
}

.ann--ml {
    position: absolute;
    right: 12px;
    top: 12px;
    display: grid;
    gap: 4px;
    width: 226px;
    padding: 11px 13px;
    border: 1px solid #5fe3a1;
    background: rgb(6 16 34 / 0.88);
    color: #d6f5e6;
    font-size: 10px;
    line-height: 1.65;
}

.ann--ml b {
    color: #5fe3a1;
    font-size: 11px;
}

.ann--ml strong {
    font:
        500 11px / 1.4 var(--mono),
        "Noto Sans JP",
        sans-serif;
    color: #fff;
}

.ann--review {
    display: flex;
    gap: 5px;
    margin-top: 2px;
    font-family: "Noto Sans JP", sans-serif;
}

.ann--review li {
    padding: 3px 8px;
    border: 1px solid var(--cyan);
    border-radius: 999px;
    font-size: 9.5px;
    line-height: 1.3;
    color: var(--cyan);
}

.ann--review li::after {
    content: " ✓";
    color: #5fe3a1;
}

.ann--geo {
    position: absolute;
    right: calc(100% + 0px);
    display: none;
}

.sheet__timeline .ann--geo {
    position: static;
    display: block;
    grid-column: 2 / -1;
    margin-top: -4px;
    font:
        500 9px / 1.2 var(--mono),
        "Noto Sans JP",
        sans-serif;
    color: #5fe3a1;
    max-height: 0;
    transition:
        opacity 0.5s,
        max-height 0.5s;
    transition-delay: var(--d);
}

.ann--mapnote {
    position: absolute;
    left: 6px;
    bottom: 6px;
    font:
        500 8.5px / 1 var(--mono),
        "Noto Sans JP",
        sans-serif;
    color: #5fe3a1;
}

.ann--sources {
    position: absolute;
    z-index: 2;
    right: -28px;
    top: 86px;
    width: 220px;
    height: 260px;
}

.ann--sources span {
    position: absolute;
    right: 0;
    top: calc(var(--i) * 46px);
    display: flex;
    align-items: center;
    gap: 9px;
    width: 220px;
    padding: 9px 11px;
    border: 1px solid var(--cyan);
    background: rgb(6 16 34 / 0.94);
    color: #d6ecfa;
    font-size: 10.5px;
    line-height: 1.3;
    box-shadow: 0 10px 24px rgb(0 0 0 / 0.4);
    transform: translateX(40px);
    opacity: 0;
    transition:
        transform 0.5s,
        opacity 0.5s;
    transition-delay: calc(var(--i) * 0.09s);
}

.ann--sources b {
    padding: 2px 5px;
    background: var(--cyan);
    color: #04121f;
    font:
        500 8.5px / 1.2 var(--mono),
        "Noto Sans JP",
        sans-serif;
}

.ann--sources i {
    margin-left: auto;
    font:
        400 8.5px / 1 var(--mono),
        "Noto Sans JP",
        sans-serif;
    font-style: normal;
    color: #5fe3a1;
}

.ann--orch {
    position: absolute;
    right: -30px;
    top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border: 1px solid var(--cyan);
    background: rgb(6 16 34 / 0.94);
    font-size: 10.5px;
    line-height: 1.3;
    color: #d6ecfa;
    box-shadow: 0 10px 24px rgb(0 0 0 / 0.4);
    transform: translateY(-8px);
}

.ann--orch b {
    color: var(--cyan);
}

.ann--orch span {
    padding-left: 10px;
    border-left: 1px solid rgb(111 214 255 / 0.4);
}

.sheet__stamp {
    position: absolute;
    right: 34px;
    top: 86px;
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    border: 3px solid var(--red);
    border-radius: 50%;
    background: rgb(255 253 248 / 0.82);
    color: var(--red);
    font-family: var(--mincho);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0.1em;
    opacity: 0;
    transform: rotate(-14deg) scale(1.8);
    transition:
        opacity 0.3s,
        transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.sheet__stamp span {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border: 1px solid var(--red);
    border-radius: 50%;
}

.ann--loop {
    position: absolute;
    left: 30px;
    right: 30px;
    bottom: 96px;
    display: grid;
    gap: 6px;
    padding: 14px 18px;
    border-left: 4px solid var(--red);
    background: #fff9d6;
    box-shadow: 0 14px 30px rgb(60 45 20 / 0.22);
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--ink);
    transform: translateY(12px);
}

.ann--loop b {
    display: inline-block;
    min-width: 86px;
    font-family: var(--mincho);
    color: var(--red);
}

/* 裏側表示（ステップ 1〜5）: ページ全体を青写真にし、対象の部分だけを点灯する。 */
.sheet:is([data-step="1"], [data-step="2"], [data-step="3"], [data-step="4"], [data-step="5"]) {
    --sheet-bg: #0a1730;
    --sheet-ink: rgb(150 195 235 / 0.4);
    --sheet-sub: rgb(150 195 235 / 0.34);
    --sheet-line: rgb(111 214 255 / 0.28);

    background-image:
        linear-gradient(rgb(111 214 255 / 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgb(111 214 255 / 0.07) 1px, transparent 1px);
    background-size: 22px 22px;
    box-shadow:
        0 0 0 1px rgb(111 214 255 / 0.5),
        0 34px 80px rgb(10 23 48 / 0.5);
}

.sheet:is([data-step="1"], [data-step="2"], [data-step="3"], [data-step="4"], [data-step="5"]) .sheet__mode {
    opacity: 1;
}

.sheet:is([data-step="1"], [data-step="2"], [data-step="3"], [data-step="4"], [data-step="5"]) .sheet__illust img {
    filter: grayscale(1) brightness(0.42) contrast(1.3) sepia(0.6) hue-rotate(175deg) saturate(2.2);
}

.sheet:is([data-step="1"], [data-step="2"], [data-step="3"], [data-step="4"], [data-step="5"])
    :is(.sheet__timeline time, .sheet__more) {
    color: var(--sheet-ink);
}

.sheet:is([data-step="1"], [data-step="2"], [data-step="3"], [data-step="4"], [data-step="5"]) .sheet__map {
    background: transparent;
}

.sheet:is([data-step="1"], [data-step="2"], [data-step="3"], [data-step="4"], [data-step="5"])
    :is(.sheet__road, .sheet__river) {
    stroke: rgb(111 214 255 / 0.2);
}

.sheet:is([data-step="1"], [data-step="2"], [data-step="3"], [data-step="4"], [data-step="5"]) .sheet__boundary {
    stroke: rgb(111 214 255 / 0.4);
    fill: none;
}

.sheet:is([data-step="1"], [data-step="2"], [data-step="3"], [data-step="4"], [data-step="5"])
    .sheet__pin
    circle:last-child {
    fill: rgb(111 214 255 / 0.5);
}

/* 1. 調査: 本文の各文に出典番号、参考文献を点灯、資料カードが差し込まれる */
.sheet[data-step="1"] :is(.sheet__body sup, .sheet__refs sup) {
    opacity: 1;
    color: var(--cyan);
}

.sheet[data-step="1"] .src {
    color: #cfe6f7;
    background: linear-gradient(transparent 88%, rgb(111 214 255 / 0.7) 88%);
}

.sheet[data-step="1"] .sheet__refs {
    color: #e6f4fd;
    --sheet-ink: var(--cyan);
}

.sheet[data-step="1"] .sheet__more {
    color: var(--cyan);
}

.sheet[data-step="1"] .ann--sources {
    opacity: 1;
}

.sheet[data-step="1"] .ann--sources span {
    opacity: 1;
    transform: translateX(calc(var(--i) * -7px));
}

/* 2. 設計・執筆: 見出しと本文を点灯 */
.sheet[data-step="2"] :is(.sheet__title, .sheet__body, .sheet__crumb b) {
    color: #f2f8fd;
}

.sheet[data-step="2"] .sheet__title {
    text-shadow: 0 0 18px rgb(111 214 255 / 0.6);
}

.sheet[data-step="2"] .ann--orch {
    opacity: 1;
    transform: none;
}

/* 3. 位置情報: 年表と地図を点灯 */
.sheet[data-step="3"] .sheet__timeline {
    color: #f2f8fd;
}

.sheet[data-step="3"] .sheet__timeline time {
    color: var(--cyan);
}

.sheet[data-step="3"] .sheet__place {
    border-color: var(--cyan);
    color: var(--cyan);
}

.sheet[data-step="3"] .sheet__timeline .ann--geo {
    opacity: 1;
    max-height: 16px;
}

.sheet[data-step="3"] .sheet__map {
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgb(111 214 255 / 0.3);
}

.sheet[data-step="3"] .sheet__boundary {
    stroke: var(--cyan);
    stroke-dasharray: 4 3;
    fill: rgb(111 214 255 / 0.08);
}

.sheet[data-step="3"] .sheet__pin circle:last-child {
    fill: #5fe3a1;
}

.sheet[data-step="3"] .sheet__pin circle:first-child {
    fill: none;
    stroke: #5fe3a1;
    opacity: 1;
    animation: ping 1.8s var(--d) infinite;
    transform-box: fill-box;
    transform-origin: center;
}

@keyframes ping {
    from {
        transform: scale(0.3);
        opacity: 1;
    }
    to {
        transform: scale(1.3);
        opacity: 0;
    }
}

.sheet[data-step="3"] .ann--mapnote {
    opacity: 1;
}

/* 4. 挿し絵: 絵を点灯し、プロンプトと手本を重ねる */
.sheet:is([data-step="4"], [data-step="5"]) .sheet__illust img {
    filter: none;
}

.sheet:is([data-step="4"], [data-step="5"]) .sheet__illust {
    box-shadow:
        0 0 0 1px var(--cyan),
        0 0 30px rgb(111 214 255 / 0.35);
}

.sheet[data-step="4"] :is(.ann--illust, .ann--castle) {
    opacity: 1;
    transform: none;
}

/* 5. レビュー: 頭部の検出枠、観点チップ、査読で直した文 */
.sheet[data-step="5"] .sheet__heads span {
    opacity: 1;
    transform: none;
}

.sheet[data-step="5"] :is(.ann--ml, .ann--review) {
    opacity: 1;
}

.sheet[data-step="5"] .sheet__body {
    color: #dcecf8;
}

.sheet[data-step="5"] .src--fixed {
    background: rgb(255 244 95 / 0.9);
    color: #1d1b18;
}

.src--fixed {
    position: static;
}

.src--fixed::before {
    content: attr(data-note);
    position: absolute;
    right: 0;
    bottom: calc(100% - 2px);
    padding: 3px 8px;
    background: var(--yellow);
    color: #1d1b18;
    font:
        700 9px / 1.3 "Noto Sans JP",
        sans-serif;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s;
}

.sheet[data-step="5"] .src--fixed::before {
    opacity: 1;
}

/* 6. 人の確認: 紙に戻り、確認印と改善メモ */
.sheet[data-step="6"] .sheet__stamp {
    opacity: 1;
    transform: rotate(-14deg);
}

.sheet[data-step="6"] .ann--loop {
    opacity: 1;
    transform: none;
}

.deep__cta {
    display: grid;
    justify-items: center;
    gap: 24px;
    width: 1160px;
    margin: 40px auto 0;
    padding: 64px 40px;
    border: 1px solid var(--ink);
    background: var(--paper);
    text-align: center;
}

.deep__cta > p:not(.heading__en) {
    font-family: var(--mincho);
    font-size: 17px;
    line-height: 2.1;
    color: var(--ink-2);
}

.deep__cta b {
    font-size: 23px;
    font-weight: 800;
    color: var(--ink);
}

.deep__cta > div {
    display: flex;
    align-items: center;
    gap: 36px;
    margin-top: 8px;
}
