/* 服日和 — 紙・机・罫線・ボタン・タブ・シート（DESIGN.md 4 節） */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--desk); color: var(--ink);
  font-family: var(--f-gothic); font-size: 15px; line-height: 1.7; font-weight: 400;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  font-feature-settings: "palt" 0;
  line-break: strict; word-break: auto-phrase; text-wrap: pretty;
}
h1, h2, h3, h4, .mincho { font-feature-settings: "palt" 1; text-wrap: balance; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 0; }
a { color: inherit; }
button, a, select, input, label, [data-tap] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, [data-tap] { -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; } /* 赤はペンの書き込みだけ。押せる所の印は墨 */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 紙のざらつき（feTurbulence） */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
html[data-theme="dark"] body::after { mix-blend-mode: screen; filter: invert(1); }

/* 机の上の誌面 */
.desk { min-height: 100vh; display: flex; justify-content: center; }
.issue {
  position: relative; width: 100%; max-width: var(--col); min-height: 100vh; background: var(--paper);
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
.issue > main { position: relative; overflow-x: clip; }

/* トンボ（PC 幅で机の上に見える） */
.trim { display: none; }
@media (min-width: 600px) {
  .desk { padding: 40px 0 0; }
  .issue { min-height: calc(100vh - 40px); box-shadow: 0 1px 0 rgba(0,0,0,.04); }
  .trim { display: block; position: absolute; inset: -22px; pointer-events: none; z-index: 1; }
  .trim i { position: absolute; width: 22px; height: 22px; }
  .trim i::before, .trim i::after { content: ""; position: absolute; background: var(--ink); opacity: .7; }
  .trim i::before { width: 16px; height: 1px; }
  .trim i::after { width: 1px; height: 16px; }
  .trim i:nth-child(1) { left: 0; top: 0; } .trim i:nth-child(1)::before { left: 0; top: 22px; } .trim i:nth-child(1)::after { left: 22px; top: 0; }
  .trim i:nth-child(2) { right: 0; top: 0; } .trim i:nth-child(2)::before { right: 0; top: 22px; } .trim i:nth-child(2)::after { right: 22px; top: 0; }
  .trim i:nth-child(3) { left: 0; bottom: 0; } .trim i:nth-child(3)::before { left: 0; bottom: 22px; } .trim i:nth-child(3)::after { left: 22px; bottom: 0; }
  .trim i:nth-child(4) { right: 0; bottom: 0; } .trim i:nth-child(4)::before { right: 0; bottom: 22px; } .trim i:nth-child(4)::after { right: 22px; bottom: 0; }
  /* 机の上の注記 */
  .desk-note { position: fixed; left: 28px; bottom: 26px; font: 500 10px/1.6 var(--f-bodoni); letter-spacing: .22em; color: var(--ink-2); text-transform: uppercase; writing-mode: vertical-rl; }
}
.desk-note { display: none; }
@media (min-width: 900px) { .desk-note { display: block; } }

/* 字の部品 */
.en { font-family: var(--f-bodoni); text-transform: uppercase; letter-spacing: .18em; font-weight: 400; }
/* Bodoni Moda は既定で数字がそろう（lining）。lining-nums を指定すると、太い字の「4」の縦棒が消える版に替わるので指定しない */
.num { font-family: var(--f-bodoni); font-variant-numeric: normal; }
.hand { font-family: var(--f-hand); color: var(--red); display: inline-block; line-height: 1.25; }
.note { font-size: 12px; line-height: 1.6; color: var(--ink-2); }
.mincho { font-family: var(--f-mincho); }
/* 文節の塊（この中では折らない） */
.bs { display: inline-block; }
.cl-t, .toc-sum, .cap-t, .ci-name, .lw-reason, .d-h1, .d-h2, .d-deck, .nt-h, .swap-name, .fr-name { text-wrap: balance; }

/* 子持ち罫（太 3px＋細 1px）の節の頭 */
.rule-head { margin: 0; padding: 7px 0 0; border-top: 3px solid var(--rule); position: relative; display: flex; align-items: baseline; gap: 12px; }
.rule-head::before { content: ""; position: absolute; left: 0; right: 0; top: 2px; border-top: 1px solid var(--rule); }
.rule-head .en { font-size: 11px; letter-spacing: .26em; }
.rule-head .ja { font: 800 17px/1.25 var(--f-mincho); }
.rule-head .folio-r { margin-left: auto; font: 400 11px var(--f-bodoni); letter-spacing: .14em; color: var(--ink-2); }
.hr { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* ノンブル（ページの終わり） */
.pg-folio { display: flex; justify-content: space-between; align-items: baseline; margin-top: 24px; padding-top: 6px; border-top: 1px solid var(--ink); }
.pg-folio .en { font-size: 10px; letter-spacing: .3em; }
.pg-folio .num { font-size: 13px; letter-spacing: .08em; }

/* ボタン */
.btn-main {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px;
  background: var(--ink); color: var(--paper); font: 800 16px/1 var(--f-mincho); letter-spacing: .08em; position: relative;
}
.btn-main .en { font-size: 10px; letter-spacing: .24em; opacity: .7; }
.btn-sub {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px;
  border: 1px solid var(--ink); font: 500 15px/1 var(--f-gothic);
}
.link-arrow { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font: 500 14px var(--f-gothic); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.btn-main:active, .btn-sub:active { transform: translateY(1px); }

/* 選ぶ（字だけ・赤ペンの下線） */
.pick { display: flex; flex-wrap: wrap; gap: 2px 18px; align-items: center; }
.pick button, .pick a { position: relative; min-height: 44px; padding: 0 2px; font: 500 15px var(--f-gothic); color: var(--ink-2); text-decoration: none; }
.pick [aria-pressed="true"], .pick [aria-current="page"] { color: var(--ink); font-weight: 700; }
.uline { position: absolute; left: -4px; right: -4px; bottom: 6px; height: 9px; width: calc(100% + 8px); overflow: visible; pointer-events: none; }
.uline path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .38s ease-out forwards; }

/* 赤ペンの丸 */
.rcircle { position: absolute; pointer-events: none; overflow: visible; }
.rcircle path { fill: none; stroke: var(--red); stroke-width: 2.6; stroke-linecap: round; opacity: 0; }
.rcircle.go path { opacity: 1; animation: draw .6s cubic-bezier(.5,.1,.3,1) forwards; animation-delay: inherit; }
.rcircle.pencil path { stroke-width: 2; opacity: .9; filter: url(#pencil); }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* 暖かさ ■■■□□ */
.warmth { display: inline-flex; gap: 3px; vertical-align: middle; }
.warmth i { width: 9px; height: 9px; border: 1px solid var(--ink); }
.warmth i.on { background: var(--ink); }

/* 服の切り抜き・スケッチ・仮の表示 */
.cut { position: relative; }
.cut img { position: relative; width: 100%; height: auto; filter: drop-shadow(0 7px 12px rgba(40, 30, 15, .12)) drop-shadow(0 1px 1px rgba(40, 30, 15, .1)); }
/* 夜の号：濃い色の服が沈まないよう、輪郭にごく薄い明るい影だけ（にじみは敷かない） */
html[data-theme="dark"] .cut img { filter: drop-shadow(0 0 1px rgba(255, 246, 228, .55)) drop-shadow(0 0 6px rgba(255, 246, 228, .12)) var(--photo-filter); }
.ph {
  display: flex; align-items: center; justify-content: center; text-align: center; width: 100%; aspect-ratio: 1 / 1.1;
  border: 1px solid var(--ink); padding: 8px; font: 500 11px/1.45 var(--f-mincho); color: var(--ink-2); background: transparent;
  position: relative;
}
.ph::before, .ph::after { content: ""; position: absolute; width: 7px; height: 7px; border-color: var(--ink); border-style: solid; }
.ph::before { left: -5px; top: -5px; border-width: 0 1px 1px 0; }
.ph::after { right: -5px; bottom: -5px; border-width: 1px 0 0 1px; }
.ph small { display: block; font: 400 9px var(--f-bodoni); letter-spacing: .16em; margin-top: 4px; text-transform: uppercase; }

.sk { position: relative; display: block; }
.sk .wash {
  position: absolute; inset: 6% 4% 4% 8%; background: var(--spot); opacity: .55;
  -webkit-mask: var(--wash) center / contain no-repeat; mask: var(--wash) center / contain no-repeat;
}
html[data-theme="dark"] .sk .wash { opacity: .5; }
.sk img { position: relative; width: 100%; height: auto; filter: var(--line-filter); }
.sk.ph-sk { aspect-ratio: 1 / 1.1; }

/* 下のタブ */
.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: var(--col); z-index: 40;
  background: var(--paper); border-top: 1px solid var(--ink); display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: var(--tabs-h);
  text-decoration: none; color: var(--ink-2); font: 500 12px/1.2 var(--f-gothic);
}
.tabs a b { font: 400 17px/1 var(--f-bodoni); color: var(--ink); letter-spacing: .04em; margin-bottom: 3px; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs a .uline { left: 22%; right: 22%; width: 56%; bottom: 7px; }

/* シート（下から出る紙） */
.scrim { position: fixed; inset: 0; background: rgba(20, 17, 12, .38); z-index: 60; opacity: 0; transition: opacity .25s; }
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; left: 50%; bottom: 0; width: 100%; max-width: var(--col); max-height: 86vh; overflow-y: auto; overscroll-behavior: contain; z-index: 61;
  background: var(--paper); border-top: 3px solid var(--ink); padding: 0 18px calc(28px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 102%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
}
.sheet::before { content: ""; position: absolute; left: 0; right: 0; top: 2px; border-top: 1px solid var(--ink); }
.sheet.on { transform: translate(-50%, 0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; }
.sheet-head .en { font-size: 11px; letter-spacing: .26em; }
.sheet-close { min-height: 44px; min-width: 44px; padding: 0 2px; font: 500 14px var(--f-gothic); }
.sheet h3 { margin: 4px 0 14px; font: 800 24px/1.25 var(--f-mincho); }

/* 知らせの一行（下から出る細い帯） */
.flash {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px); z-index: 70;
  width: calc(min(100vw, var(--col)) - 32px); padding: 12px 14px; background: var(--ink); color: var(--paper); font: 500 14px/1.5 var(--f-gothic);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.flash.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.flash a { color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}

/* まとめ撮りのコマ（ベタ焼きから切った四角の写真。焼いた紙の白い縁・細い墨の縁・縁の刻み） */
.fcut { position: relative; display: block; box-sizing: border-box; height: 100%; max-width: 100%; aspect-ratio: 1; padding: 4px; background: #F7F3EA; border: 1px solid #1B1A18; box-shadow: 1px 2px 3px var(--shadow-obj); }
.fcut img { display: block; width: 100%; height: 100%; object-fit: contain; background: #E9E4D8; } /* コマは切らずに全部見せる（縦長・横長のコマは焼いた紙の地が残る） */
.fc-no { position: absolute; right: 5px; bottom: 5px; padding: 0 3px; background: #1B1A18; color: #F7F3EA; font-size: 9.5px; letter-spacing: .08em; line-height: 1.4; }
html[data-theme="dark"] .fcut { border-color: #6B665C; }
html[data-theme="dark"] .fcut img { filter: var(--photo-filter); }
