/* ==========================================================
   依頼者ごとの装飾
   style.css の後に読み込まれ、同じセレクタなら、こちらが勝つ。
   テンプレート側も setup-site も、このファイルは触らない。依頼者ごとの見た目の作り込みは、すべてここに書く
   (Claude Code に「こうしたい」と頼めば、ここに書く。setup-site は brief.md だけを入力にするので、ここは触らない)
   (style.css を直接変えると、テンプレートの修正を取り込むときに衝突するため)。
   配色・フォント・角丸は、ここではなく brief.md の「デザイン方針」で変える(文字の読みやすさの検査を通すため)。
   ========================================================== */

/* 琥夜: 「秘密探偵社の調査ファイル」
   モチーフはキービジュアルから拾った4つ。
     方眼紙(背景)/ 紺とベージュのチェック柄(節の区切り・フッター)/
     白いステッカーの縁(キービジュアル・カード)/ 依頼書の紙(事件簿)
   黄色は宝石とボタンの差し色。文字には読めないので、装飾と濃い地の上の文字にだけ使う */

:root {
  /* 装飾用の色。衣装の紺・ケープのベージュ・宝石の黄。
     文字に使う組み合わせ(白・黄・淡い青 / 濃紺)は、コントラスト比 6.9 以上を確認済み */
  --navy-deep: #26395a;
  --beige: #cdbb98;
  --gold: #f2c230;
  --on-navy-muted: #d5dceb;
  --paper-line: rgba(52, 80, 122, .07);
  /* ケープのチェック柄。ベージュの地に、紺の太線と白の細線を縦横に重ねる */
  --plaid:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(38, 57, 90, .55) 22px 26px, transparent 26px 34px, rgba(255, 255, 255, .5) 34px 35px, transparent 35px 48px),
    /* 横線の間隔は、帯(高さ 22px)の中に1本以上入るよう、縦線より細かくする */
    repeating-linear-gradient(0deg, transparent 0 6px, rgba(38, 57, 90, .45) 6px 9px, transparent 9px 13px, rgba(255, 255, 255, .5) 13px 14px, transparent 14px 18px),
    var(--beige);
}

/* ---------- 下地: 方眼紙と、ぼかした虫眼鏡のレンズ ---------- */

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 88% 14%, transparent 0 150px, rgba(52, 80, 122, .13) 151px 168px, transparent 169px),
    linear-gradient(var(--paper-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-line) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
  background-attachment: fixed, scroll, scroll;
  overflow-x: hidden;
}

/* ---------- メニュー ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px max(16px, calc((100% - var(--maxw)) / 2));
  background: rgba(248, 246, 240, .82);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--accent);
}
.brand {
  font-weight: 800; font-size: 1.15rem; letter-spacing: .08em;
  color: var(--accent); text-decoration: none;
}
#siteNav { display: flex; gap: 4px 20px; flex-wrap: wrap; }
#siteNav a {
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem;
  padding: 4px 2px; border-bottom: 3px solid transparent;
}
#siteNav a:active { border-bottom-color: var(--gold); }
@media (hover: hover) {
  #siteNav a:hover { border-bottom-color: var(--gold); }
}

/* 狭い画面: ハンバーガーを三本線に、開いたメニューは紺の札にする */
.nav-toggle {
  width: 44px; height: 44px; padding: 0;
  background: var(--accent); border: 2px solid #fff; border-radius: 999px;
  box-shadow: 0 0 0 2px var(--accent);
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; position: relative;
}
.nav-toggle-bar::before, .nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }
@media (max-width: 720px) {
  .js #siteNav {
    flex-direction: column; gap: 0;
    padding: 8px 16px 16px;
    background: var(--navy-deep);
    border-bottom: 6px solid var(--gold);
  }
  .js #siteNav a { color: #fff; padding: 12px 4px; border-bottom: 1px solid rgba(255, 255, 255, .15); }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 720px) {
  .js #siteNav { transform: translateY(-8px); transition: opacity .2s, visibility .2s, transform .25s ease; }
  .js .topbar.is-open #siteNav { transform: none; }
}

/* ---------- 表紙: キービジュアルと名前 ---------- */

.hero {
  display: grid; gap: 28px; justify-items: center;
  max-width: var(--maxw); margin: 0 auto; padding: 28px 16px 56px;
}
@media (min-width: 861px) {
  .hero { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: center; gap: 56px; padding-top: 48px; }
}

/* ステッカーのように白い縁で切り抜き、後ろにチェック柄の紙を斜めに敷く */
.hero-visual {
  position: relative; isolation: isolate;
  width: min(100% - 32px, 440px); margin: 0; /* 32px は、後ろの紙が右へはみ出す分 */
}
.hero-visual::before {
  /* 下端は、めくるボタンの上で止める(ボタンが柄に重なって見にくくなるため) */
  content: ""; position: absolute; inset: 22px -20px 44px 26px; z-index: -1;
  background: var(--plaid); border-radius: var(--radius);
  transform: rotate(4deg);
}
/* 後ろの紙に、次に出るキービジュアルを見せる。今の枚数は、めくるボタンのドット(aria-current)から読む。
   Why not JS で書かない: 部品の JS はテンプレートの共通部分で、依頼者ごとに変えないため。
   画像の並びは assets/data/key-visual.js と同じ順で、ここに直接書く(キービジュアルを増減したら、ここも直す) */
.hero-visual:has(.kv-dot:nth-child(1)[aria-current="true"]) { --kv-next: url("assets/images/key-visual/koyo-02-festival.webp"); --kv-anim: kv-next-a; }
.hero-visual:has(.kv-dot:nth-child(2)[aria-current="true"]) { --kv-next: url("assets/images/key-visual/koyo-03-iriam.webp"); --kv-anim: kv-next-b; }
.hero-visual:has(.kv-dot:nth-child(3)[aria-current="true"]) { --kv-next: url("assets/images/key-visual/koyo-04-retro.webp"); --kv-anim: kv-next-a; }
.hero-visual:has(.kv-dot:nth-child(4)[aria-current="true"]) { --kv-next: url("assets/images/key-visual.webp"); --kv-anim: kv-next-b; }
/* 次の画像がある間は、チェック柄の紙の上に、その画像を重ねる(柄は縁に残る) */
.hero-visual:has(.kv-dot[aria-current="true"])::before {
  background: var(--kv-next) center / cover no-repeat, var(--plaid);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .85);
  filter: saturate(.85);
}
/* 切り替わるたびに、後ろから滑り込む。同じ名前の動きは再生し直されないので、
   1枚ごとに a と b を交互に使い、名前が変わることで毎回動かす(a と b の中身は同じ) */
@media (prefers-reduced-motion: no-preference) {
  .hero-visual:has(.kv-dot[aria-current="true"])::before { animation: var(--kv-anim) .6s cubic-bezier(.2, .7, .3, 1); }
}
@keyframes kv-next-a { from { opacity: 0; transform: translate(-18px, -12px) rotate(-2deg); } to { opacity: 1; transform: rotate(4deg); } }
@keyframes kv-next-b { from { opacity: 0; transform: translate(-18px, -12px) rotate(-2deg); } to { opacity: 1; transform: rotate(4deg); } }

.hero-visual .kv {
  border: 6px solid #fff; border-radius: var(--radius);
  box-shadow: 0 0 0 2px var(--accent), 0 12px 28px rgba(38, 57, 90, .22);
  transform: rotate(-1.5deg);
}

.kv-controls { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 22px; }
.kv-nav {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; cursor: pointer;
  color: #fff; background: var(--accent); border: 2px solid #fff; border-radius: 999px;
  box-shadow: 0 0 0 2px var(--accent); font-size: 1.3rem; line-height: 1;
}
.kv-toggle { font-size: .8rem; }
.kv-nav:active { background: var(--navy-deep); }
.kv-dots { display: flex; gap: 8px; }
.kv-dot {
  width: 12px; height: 12px; padding: 0; cursor: pointer;
  background: #fff; border: 2px solid var(--accent); border-radius: 999px;
}
.kv-dot[aria-current="true"] { background: var(--gold); }
@media (hover: hover) {
  .kv-nav:hover { background: var(--accent-hover); }
}

.hero-text { text-align: center; }
@media (min-width: 861px) { .hero-text { text-align: left; } }

/* 見出しの上の英字。虫眼鏡(円 + 柄)を CSS で描いて添える */
.hero-agency {
  position: relative; display: inline-block; margin: 0 0 8px; padding-left: 26px;
  font-size: .78rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.hero-agency::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 12px; height: 12px; margin-top: -9px;
  border: 3px solid var(--accent); border-radius: 50%; background: var(--gold);
}
.hero-agency::after {
  content: ""; position: absolute; left: 13px; top: 50%; width: 3px; height: 9px; margin-top: 2px;
  background: var(--accent); border-radius: 2px; transform: rotate(-45deg);
}

@media (max-width: 480px) {
  .hero-agency { font-size: .68rem; letter-spacing: .1em; }
}

.hero-name {
  margin: 0; line-height: 1.1;
  font-size: clamp(40px, 12vw, 72px); font-weight: 800; letter-spacing: .04em; color: var(--accent);
}
.hero-name-en {
  display: block; margin-top: 10px;
  font-size: .9rem; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: var(--ink);
}
/* 黄色の蛍光ペンで線を引いたように */
.hero-catch {
  display: inline-block; margin: 18px 0 0; padding: 0 4px;
  font-size: 1.15rem; font-weight: 700;
  background: linear-gradient(transparent 58%, rgba(242, 194, 48, .7) 58% 92%, transparent 92%);
}
/* 受付の挨拶: 事件簿と同じ罫線の紙を、少し傾けた吹き出しにする */
.hero-greeting {
  position: relative; max-width: 26em; margin: 22px auto 0; padding: 14px 20px;
  font-weight: 700; line-height: 1.9; text-align: left;
  background-color: #fffdf6;
  background-image: linear-gradient(transparent 0 calc(1.9em - 1px), rgba(52, 80, 122, .14) calc(1.9em - 1px) 1.9em);
  background-size: 100% 1.9em; background-position: 0 14px;
  border: 2px solid var(--accent); border-radius: var(--radius);
  box-shadow: 4px 5px 0 rgba(38, 57, 90, .14);
  transform: rotate(-1deg);
}
/* 吹き出しの尻尾(上の名前を指す) */
.hero-greeting::before {
  content: ""; position: absolute; top: -9px; left: 32px; width: 14px; height: 14px;
  background: #fffdf6; border-left: 2px solid var(--accent); border-top: 2px solid var(--accent);
  transform: rotate(45deg);
}
@media (min-width: 861px) { .hero-greeting { margin-left: 0; } }

.hero-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  list-style: none; margin: 28px 0 0; padding: 0;
}
@media (min-width: 861px) { .hero-links { justify-content: flex-start; } }

/* ---------- ボタン(表紙のリンク・コピー) ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 22px; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none;
  color: var(--accent); background: #fff; border: 2px solid var(--accent);
  box-shadow: 3px 3px 0 var(--accent);
}
.btn-primary { color: #fff; background: var(--accent); box-shadow: 3px 3px 0 var(--gold); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--accent); }
@media (hover: hover) {
  .btn:hover { background: var(--accent-soft); }
  .btn-primary:hover { background: var(--accent-hover); }
}

/* 押して「コピーしました」に変わっても、幅が変わらないように、見えない文言で幅を取っておく */
.copy-btn {
  display: inline-grid; justify-items: center; white-space: nowrap;
  padding: 4px 14px; font-size: .85rem; box-shadow: 2px 2px 0 var(--accent);
}
.copy-label,
.copy-btn::after { grid-area: 1 / 1; }
.copy-btn::after { content: "コピーしました"; visibility: hidden; }

/* ---------- 節: 見出しと、チェック柄の区切り ---------- */

.sec {
  max-width: 920px; margin: 0 auto; padding: 72px 16px 24px;
  scroll-margin-top: 64px;
  position: relative;
}
/* 節の境目に、ケープのチェック柄の帯を引く(画面の端から端まで) */
.sec::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 100vw; height: 22px;
  transform: translateX(-50%);
  background: var(--plaid);
  border-block: 2px solid var(--accent);
}

.sec-title {
  margin: 0 0 32px; line-height: 1.2;
  font-size: clamp(30px, 8vw, 44px); font-weight: 800; letter-spacing: .02em; color: var(--ink);
}
.sec-title::after {
  /* 探偵の虫眼鏡(黄色のレンズ・紺の縁と柄)。表紙の英字の脇と同じ形。文字の大きさに合わせて伸び縮みする
     Why not var() で色を書かない: 背景画像の SVG の中では変数が効かないため、--gold と --accent の値を直接書く */
  content: ""; display: inline-block; width: .7em; height: .7em; margin-left: .3em; vertical-align: -.02em;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='9.5' cy='9.5' r='6.5' fill='%23f2c230' stroke='%2334507a' stroke-width='3'/%3E%3Cpath d='M14.5 14.5 21 21' stroke='%2334507a' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E");
}
.sec-en {
  display: block; margin-bottom: 8px;
  font-size: .8rem; font-weight: 700; letter-spacing: .2em; color: var(--muted);
}
.sec-en .num { color: var(--accent); }

/* ---------- FILE.01 プロフィール: ステッカーのカード ---------- */

@media (min-width: 769px) {
  .facts { grid-template-columns: repeat(3, 1fr); gap: 22px; }
}
.fact {
  padding: 16px 18px; background: var(--surface);
  border: 2px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 0 0 5px #fff, 5px 7px 0 5px rgba(38, 57, 90, .14);
}
.fact dt {
  margin-bottom: 4px;
  font-size: .75rem; font-weight: 700; letter-spacing: .18em; color: var(--muted);
}
.fact dd { font-size: 1.15rem; font-weight: 700; }
.fact dd small { display: block; font-size: .85rem; font-weight: 400; color: var(--muted); }
.fact dd a { color: var(--accent); }
.copy-text { font-weight: 700; }
.copy-text-large { font-size: 2rem; line-height: 1.2; }
/* ハッシュタグ(searchLink)は、押すと X の検索が開く。下線で押せることを示す
   (Why not 虫眼鏡の絵文字を添えない: 疑似要素の文字もリンク名として読み上げられるため) */
.tag-link {
  color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px;
  text-underline-offset: 4px; text-decoration-color: var(--gold);
}
.tag-link:active { background: var(--accent-soft); }
@media (hover: hover) {
  .tag-link:hover { background: var(--accent-soft); }
}

/* おすすめ動画: リンクの下に、ステッカーの縁の付いた画面として置く */
.videos { margin-top: 40px; }
.videos-label {
  display: inline-block; margin: 0 0 12px; padding: 2px 14px; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: .75rem; font-weight: 800; letter-spacing: .25em;
}
.yt-lite {
  overflow: hidden; background: var(--surface);
  border: 2px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 0 0 5px #fff, 5px 7px 0 5px rgba(38, 57, 90, .14);
}
.yt-lite figcaption { padding: 12px 18px; font-weight: 700; }
.yt-lite figcaption a { color: var(--accent); }

/* ---------- FILE.03 配信時間: 探偵社の営業時間の札 ---------- */

.hours {
  list-style: none; margin: 0; padding: 26px 22px 22px;
  background: var(--navy-deep); color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 0 0 5px #fff, 0 0 0 7px var(--accent), 0 14px 28px rgba(38, 57, 90, .25);
  position: relative;
}
/* 札の上の「OPEN」の吊り下げ札 */
.hours::before {
  content: "OPEN"; position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  padding: 2px 16px; border-radius: 6px;
  background: var(--gold); color: var(--ink);
  font-size: .8rem; font-weight: 800; letter-spacing: .25em;
}
.hours-item {
  display: flex; align-items: baseline; gap: 12px; padding: 10px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .28);
}
.hours-item:last-child { border-bottom: 0; }
.hours-label { font-weight: 700; color: var(--gold); white-space: nowrap; }
.hours-time {
  margin-left: auto; font-size: clamp(1.2rem, 5vw, 1.6rem); font-weight: 800; letter-spacing: .04em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------- FILE.04 事件簿: 罫線の入った依頼書 ---------- */

.casefile {
  position: relative; padding: 34px 22px 26px;
  background-color: #fffdf6;
  border: 2px solid var(--accent); border-radius: 4px var(--radius) var(--radius) var(--radius);
  box-shadow: 6px 8px 0 rgba(38, 57, 90, .14);
  transform: rotate(-.6deg);
}
/* 紙を留めるクリップ(左上のタブ) */
.casefile::before {
  content: "MEMORY"; position: absolute; top: -16px; left: 18px;
  padding: 2px 14px; border-radius: 6px 6px 0 0;
  background: var(--accent); color: #fff;
  font-size: .75rem; font-weight: 800; letter-spacing: .25em;
}
.history { list-style: none; margin: 0; padding: 0; }
/* 罫線は各行の下端に引く。
   Why not 紙の背景に一定間隔で描かない: スマホ幅では行が2段になって高さが変わり、背景の線とずれるため */
.history li {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid rgba(52, 80, 122, .14);
}
.history time,
.history li > span:first-child {
  position: relative; padding-left: 22px;
  font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* 行頭は、虫眼鏡のレンズ */
.history time::before,
.history li > span:first-child::before {
  content: ""; position: absolute; left: 0; top: .35em; width: 10px; height: 10px;
  border: 2px solid var(--accent); border-radius: 50%; background: var(--gold);
}
.history-text { font-weight: 700; }
@media (max-width: 480px) {
  .history li { grid-template-columns: 1fr; gap: 0; }
  .history-text { padding-left: 22px; }
}

/* ---------- FILE.02 リンク ---------- */

.link-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px;
  list-style: none; margin: 0; padding: 0;
}
.link-list a {
  display: flex; flex-direction: column; justify-content: center; min-height: 72px; padding: 14px 44px 14px 20px;
  position: relative; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 0 0 5px #fff, 5px 7px 0 5px rgba(38, 57, 90, .14);
}
.link-list a::after {
  content: "›"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 1.6rem; font-weight: 700; color: var(--accent);
}
.link-name { font-size: 1.1rem; font-weight: 800; color: var(--accent); }
.link-sub { font-size: .85rem; color: var(--muted); }
.link-list a:active { background: var(--accent-soft); }
@media (hover: hover) {
  .link-list a:hover { background: var(--accent-soft); }
}

/* ---------- フッター: チェック柄の帯の下に、紺の地 ---------- */

.footer {
  position: relative; margin-top: 88px; padding: 58px 16px 40px; text-align: center;
  background: var(--navy-deep); color: var(--on-navy-muted);
  font-size: .85rem;
}
/* border-image はグラデーションを1枚しか受け付けないので、チェック柄は疑似要素で敷く */
.footer::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 22px;
  background: var(--plaid);
  border-bottom: 2px solid var(--gold);
}
.footer p { margin: 4px 0; }
.footer a { color: #fff; }
.footer .copy { margin-top: 16px; color: #fff; letter-spacing: .08em; }

/* ---------- スクロールで現れる演出 ---------- */
/* 傾けた要素は、現れた後も傾きを残す(style.css の .in は transform: none にするため) */
.js .casefile.reveal.in { transform: rotate(-.6deg); }
@media (prefers-reduced-motion: reduce) {
  .js .casefile.reveal { transform: rotate(-.6deg); }
}
