/* 自由研究（labs.allfesta.com）共通。値は DESIGN.md の表からのみ取る。正本: labs-renewal/02-design/DESIGN.md */
:root {
  --accent: #8c6917; --accent-hover: #725513; --gold: #e7b540; --on-accent: #ffffff;
  --bg: #ffffff; --panel: #f6f7f9; --tint: #f2f4f7;
  --ink: #131825; --dim: #5a6172; --line: #d0d4dd; --edge: #6a7181;
  --font-display: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --container: 1200px; --gutter: 24px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #e7b540; --accent-hover: #f0c966; --on-accent: #131825;
    --bg: #0e121b; --panel: #171c26; --tint: #232834;
    --ink: #eaecf0; --dim: #a0a5b1; --line: #383e4d; --edge: #6a7181;
  }
}
:root[data-theme="dark"] {
  --accent: #e7b540; --accent-hover: #f0c966; --on-accent: #131825;
  --bg: #0e121b; --panel: #171c26; --tint: #232834;
  --ink: #eaecf0; --dim: #a0a5b1; --line: #383e4d; --edge: #6a7181;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.9; letter-spacing: 0.04em;
  font-feature-settings: "palt" 0; line-break: strict; word-break: normal; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }   /* ボタンは親の文字色を引き継がない。ダークで既定の黒が沈んでいた（R030）*/
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.num { font-family: var(--font-body); font-weight: 700; }
.ph { display: inline-block; }
.display { font-family: var(--font-display); font-weight: 800; font-feature-settings: "palt" 1; text-wrap: balance; }

/* header */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header .wrap { height: 72px; display: flex; align-items: center; gap: 20px; }
/* 名乗り「allfesta の自由研究」を1つの塊に。ロゴの下端に「の」と「自由研究」の足元をそろえる。区切り線は引かない */
.brand { display: flex; align-items: flex-end; gap: 0; text-decoration: none; color: var(--ink); min-height: 44px; padding-bottom: 8px; }
.brand .logo { height: 28px; width: auto; display: block; }
.brand-no { font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1; color: var(--dim); margin: 0 3px 2px 7px; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 23px; line-height: 1; letter-spacing: 0.04em; margin-bottom: -1px; font-feature-settings: "palt" 1; }
.brand:hover .brand-name { color: var(--accent); }
.brand-lg .logo { height: 40px; }
.brand-lg .brand-no { font-size: 18px; margin: 0 4px 3px 10px; }
.brand-lg .brand-name { font-size: 34px; }
.nav { margin-left: auto; display: flex; gap: 32px; align-items: center; }
.nav a { white-space: nowrap; flex: none; text-decoration: none; font-size: 15px; font-weight: 700; letter-spacing: 0.08em; min-height: 44px; display: flex; align-items: center; border-bottom: 2px solid transparent; }
.nav a[aria-current] { border-bottom-color: var(--accent); }
.nav a:hover { color: var(--accent); }
.nav .out { font-weight: 400; color: var(--dim); }

/* 共通部品 */
.label { font-size: 14px; font-weight: 700; letter-spacing: 0.12em; line-height: 1.4; }
.label .no { color: var(--accent); }
.new { display: inline-block; background: var(--gold); color: #131825; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; padding: 3px 8px; line-height: 1.4; }
.meta { font-size: 14px; line-height: 1.6; letter-spacing: 0.06em; color: var(--dim); }
.thumb { aspect-ratio: 1200 / 630; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; position: relative; }
.thumb b { font-size: clamp(32px, 6vw, 88px); font-weight: 700; color: var(--line); letter-spacing: -0.02em; }
.thumb i { position: absolute; left: 12px; bottom: 8px; font-style: normal; font-size: 12px; color: var(--dim); letter-spacing: 0.1em; }
.more { font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 2px; min-height: 44px; display: inline-flex; align-items: center; }
.more:hover { color: var(--accent); }
.biblio { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border-top: 1px solid var(--ink); }
.r-note { margin-top: 12px; font-size: 14px; color: var(--dim); line-height: 1.7; }
.biblio div { padding: 14px 16px 0 0; }
.biblio dt { font-size: 14px; font-weight: 700; letter-spacing: 0.1em; color: var(--dim); line-height: 1.4; }
.biblio dd { font-size: 15px; line-height: 1.6; margin-top: 6px; }
a.card { text-decoration: none; display: block; }
a.card:hover .t { text-decoration: underline 2px var(--accent); text-underline-offset: 4px; }
a.card:hover .thumb { border-color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 読み込み時に1回だけ段ごとにずらす */
.rise { animation: rise 400ms ease-out both; }
.rise:nth-child(2) { animation-delay: 60ms; } .rise:nth-child(3) { animation-delay: 120ms; }
.rise:nth-child(4) { animation-delay: 180ms; } .rise:nth-child(5) { animation-delay: 240ms; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }


/* footer（トップ・レポート共通） */
.site-footer { margin-top: 128px; border-top: 1px solid var(--line); padding: 48px 0 64px; }
.site-footer .wrap { display: grid; grid-template-columns: 4fr 8fr; gap: var(--gutter); align-items: start; }
.site-footer .logo { width: auto; color: var(--ink); }
.site-footer p { font-size: 14px; color: var(--dim); margin-top: 12px; line-height: 1.6; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: flex-end; }
.site-footer li a { text-decoration: none; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
.site-footer li a:hover { color: var(--accent); }

/* ---------- タブレット・スマートフォン（DESIGN.md v3） ---------- */
@media (max-width: 1023px) {
  .nav { gap: 20px; }
  .site-footer .wrap { grid-template-columns: 1fr; }
  .site-footer ul { justify-content: flex-start; }
}
@media (max-width: 767px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  /* ヘッダーは2段。1段目（ロゴ）だけ追従し、ナビの段は流す */
  .site-header { position: static; }
  .site-header .wrap { height: auto; flex-wrap: wrap; gap: 0; padding-top: 10px; }
  .brand .logo { height: 24px; }
  .brand-no { font-size: 13px; margin: 0 2px 2px 6px; }
  .brand-name { font-size: 20px; }
  .nav { margin-left: 0; width: 100%; gap: 24px; border-top: 1px solid var(--line); margin-top: 8px; }
  .nav .out { display: none; }   /* allfesta.com への導線は SP ではフッターだけ */
  .label .rp { display: none; }   /* 目録の「REPORT」を落とし、番号・年月を1行に収める */
  .biblio { grid-template-columns: 1fr 1fr; }
  .biblio div { padding-bottom: 12px; }
  .site-footer { margin-top: 80px; padding: 40px 0 48px; }
  .site-footer ul { gap: 0 24px; }
}
