/* コンピュータリテラシー教材 共通スタイル（build.py が各ページから参照） */
:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --text: #1a2233;
  --text-mute: #5b6577;
  --border: rgba(0, 63, 140, 0.14);
  --primary: #003f8c;
  --brand: #f08300;
  --grad: linear-gradient(135deg, #003f8c 0%, #2a6ec3 55%, #f08300 100%);
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --shadow-hover: 0 2px 4px rgba(16,24,40,.08), 0 16px 40px rgba(0,63,140,.16);
  --accent: #003f8c;
  --accent-d: #6aa9ff;
  --hl: #d6336c;
  --code-bg: #eef2f8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1320;
    --surface: #161d2e;
    --text: #e8ecf5;
    --text-mute: #9aa5bb;
    --border: rgba(255,255,255,0.10);
    --primary: #6aa9ff;
    --brand: #ff9d3f;
    --grad: linear-gradient(135deg, #6aa9ff 0%, #c98aff 50%, #ff9d3f 100%);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.35), 0 16px 40px rgba(0,0,0,.4);
    --hl: #ff8fab;
    --code-bg: #1e2740;
  }
}
body, .unit { --a: var(--accent); }
@media (prefers-color-scheme: dark) { body, .unit { --a: var(--accent-d); } }
* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.85;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
a { color: var(--a); }

/* 上部バー */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 14px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); text-decoration: none; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grad); }
.top-inner .sep { color: var(--text-mute); }
.top-inner a:not(.brand) { color: var(--text-mute); text-decoration: none; font-weight: 600; }
.top-inner a:hover { color: var(--a); }
.spacer { flex: 1; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }
.wrap.with-side { display: grid; grid-template-columns: 1fr; gap: 0 40px; }
@media (min-width: 1000px) { .wrap.with-side { grid-template-columns: 260px minmax(0, 1fr); } }

.eyebrow { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .06em; color: var(--a); }
.crumbs { margin: 28px 0 6px; font-size: 13px; color: var(--text-mute); }
.crumbs a { color: var(--text-mute); text-decoration: none; }
.crumbs a:hover { color: var(--a); }
.crumbs span { margin: 0 4px; }

h1 { margin: 6px 0 18px; font-size: clamp(26px, 4.4vw, 38px); line-height: 1.3; letter-spacing: .01em; }
.hub h1, .hero h1 { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.u-ppxp .hero h1, .u-www .hero h1, .u-long .hero h1 { background: none; color: var(--a); }

/* 本文ページ */
.page { min-width: 0; max-width: 860px; }
.side { position: sticky; top: 64px; align-self: start; margin-top: 28px; font-size: 14px; }
.side details { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.side summary { font-weight: 800; cursor: pointer; color: var(--a); }
.side ol { list-style: none; margin: 8px 0 0; padding: 0; }
.side ol ol { margin: 2px 0 6px 12px; border-left: 2px solid var(--border); padding-left: 8px; }
.side a { display: block; padding: 3px 6px; border-radius: 6px; color: var(--text); text-decoration: none; line-height: 1.5; }
.side a:hover { background: color-mix(in srgb, var(--a) 10%, transparent); }
.side a[aria-current="page"] { background: color-mix(in srgb, var(--a) 16%, transparent); color: var(--a); font-weight: 700; }
.side .lab { display: inline-block; min-width: 3.6em; font-size: 12px; font-weight: 800; color: var(--a); }
@media (max-width: 999px) {
  .side { position: static; margin-top: 16px; }
  .side details:not([open]) { padding-bottom: 12px; }
}

.toc, .chips {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; margin: 0 0 24px; font-size: 14px;
}
.toc-h { display: block; font-size: 12px; font-weight: 800; color: var(--text-mute); margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 1.4em; columns: 2 220px; column-gap: 24px; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips .toc-h { margin: 0 6px 0 0; }
.chips a {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 999px; border: 1px solid var(--border); text-decoration: none; font-weight: 700; font-size: 13px;
}
.chips a:hover { background: var(--a); color: #fff; border-color: transparent; }

.content {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px clamp(16px, 4vw, 40px); box-shadow: var(--shadow);
}
.content > :first-child { margin-top: 0; }
.content h2 {
  font-size: 22px; line-height: 1.4; margin: 40px 0 14px; padding-left: 12px;
  border-left: 5px solid var(--a);
}
.content h3 { font-size: 18px; margin: 28px 0 10px; }
.content h3.task { color: var(--hl); display: flex; align-items: center; gap: 8px; }
.content h3.task::before { content: "✎"; }
.content p { margin: 0 0 14px; }
.content ul, .content ol { padding-left: 1.5em; margin: 0 0 14px; }
.content li { margin: 2px 0; }
.content blockquote {
  margin: 6px 0 12px; padding: 8px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--a) 6%, transparent); border-left: 3px solid color-mix(in srgb, var(--a) 50%, transparent);
}
.content pre, .content code, .content tt, .content xmp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px;
}
.content pre, .content xmp {
  display: block; background: var(--code-bg); border-radius: 10px; padding: 12px 14px; overflow-x: auto; white-space: pre;
}
.content code, .content tt { background: var(--code-bg); border-radius: 4px; padding: 0 4px; }
.content .center { text-align: center; }
.content strong.hl { color: var(--hl); }
.content hr { border: 0; border-top: 1px dashed var(--border); margin: 28px 0; }

.step { display: flex; align-items: center; gap: 12px; margin: 34px 0 14px; scroll-margin-top: 72px; }
.step::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.step-no {
  font-size: 12px; font-weight: 800; letter-spacing: .08em; color: #fff;
  background: var(--a); border-radius: 999px; padding: 3px 12px;
}
.content > .step:first-child { margin-top: 0; }

/* 画像 */
.content img { max-width: 100%; height: auto; vertical-align: middle; }
.content img.fig {
  display: block; margin: 12px auto 18px; border-radius: 8px;
  border: 1px solid var(--border); box-shadow: var(--shadow); background: #fff; cursor: zoom-in;
}
.content a > img.fig { cursor: zoom-in; }
.content img.ico { margin: 0 2px; }

/* 表 */
.table-wrap { overflow-x: auto; margin: 10px 0 18px; }
.table-wrap table { border-collapse: collapse; margin: 0 auto; }
table.bordered th, table.bordered td { border: 1px solid var(--border); padding: 6px 10px; }
table.bordered th { background: color-mix(in srgb, var(--a) 10%, transparent); }
table.plain td, table.plain th { padding: 4px 10px; }
table.layout td { padding: 4px; vertical-align: top; }

/* 前後 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.pager a {
  display: block; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); text-decoration: none; color: var(--text); font-weight: 700; box-shadow: var(--shadow);
}
.pager a:hover { border-color: var(--a); color: var(--a); }
.pager a span { display: block; font-size: 12px; color: var(--text-mute); font-weight: 600; }
.pager .next { text-align: right; grid-column: 2; }

/* 目次ページ・入口 */
.hero { padding: 8px 0 24px; max-width: 760px; }
.hero .crumbs { margin-top: 36px; }
.hub .hero { padding-top: 40px; }
.lead { color: var(--text-mute); margin: 0; }
.sessions, .units { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 760px) { .sessions, .units { grid-template-columns: repeat(2, 1fr); } }
.session, .unit {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.session:hover, .unit:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.session { padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--a); }
.session h2, .unit h2 { margin: 0; font-size: 20px; line-height: 1.4; }
.session h2 a, .unit h2 a { color: var(--text); text-decoration: none; }
.session h2 a:hover, .unit h2 a:hover { color: var(--a); }
.session .sum { margin: 0; color: var(--text-mute); font-size: 14px; }
.sub { margin: 4px 0 6px; padding-left: 1.4em; font-size: 14px; }
.sub a { text-decoration: none; }
.sub a:hover { text-decoration: underline; }
.unit .sub { list-style: none; padding: 0; }
.unit .sub .lab { display: inline-block; min-width: 3.6em; font-size: 12px; font-weight: 800; color: var(--a); }
.btn {
  margin-top: auto; align-self: flex-start; display: inline-block; padding: 8px 18px; border-radius: 999px;
  background: var(--a); color: #fff !important; font-weight: 700; font-size: 14px; text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.unit { overflow: hidden; display: flex; flex-direction: column; }
.unit .cover { display: block; aspect-ratio: 16 / 10; border-bottom: 4px solid var(--a); background: var(--bg); }
.unit .cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.unit .body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.unit .body > p:not(.eyebrow) { margin: 0; color: var(--text-mute); font-size: 14px; }
.extras, .archive {
  margin-top: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 22px;
}
.extras h2, .archive h2 { margin: 0 0 6px; font-size: 16px; }
.extras ul { margin: 0; padding-left: 1.3em; }
.archive { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.archive img { width: 200px; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }
.archive div { flex: 1; min-width: 220px; }
.archive p { margin: 0 0 4px; color: var(--text-mute); font-size: 14px; }

.foot { max-width: 1200px; margin: 0 auto; padding: 8px 16px 40px; text-align: center; color: var(--text-mute); font-size: 13px; }
.foot p { margin: 4px 0; }
.foot a { color: var(--text-mute); }

/* 拡大表示 */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 22, .86);
  display: none; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
@media (prefers-color-scheme: dark) {
  .step-no, .btn, .chips a:hover { color: #0b1220 !important; }
}

/* ---- Java プログラミング ---- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 4px 0 20px; max-width: 760px; }
.facts div { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.facts b { display: block; font-size: 28px; line-height: 1.1; color: var(--a); }
.facts span { font-size: 13px; color: var(--text-mute); }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } }
.biblio { display: grid; grid-template-columns: 6em 1fr; gap: 4px 12px; margin: 0 0 18px; max-width: 760px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px; }
.biblio dt { font-weight: 800; color: var(--text-mute); }
.biblio dd { margin: 0; }
.note { max-width: 860px; font-size: 14px; background: color-mix(in srgb, var(--a) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--a) 30%, transparent);
  border-radius: 14px; padding: 14px 18px; margin: 0 0 8px; }
.note code, .run code { background: var(--code-bg); border-radius: 4px; padding: 0 4px; font-size: 13px; }
.term { margin-top: 28px; }
.term > h2 { font-size: 20px; margin: 0 0 10px; padding-left: 12px; border-left: 5px solid var(--a); }
.sched { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.sched > li { display: grid; grid-template-columns: 4.5em 1fr; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); }
.sched > li:first-child { border-top: 0; }
.sched .date { font-weight: 800; color: var(--a); font-size: 14px; padding-top: 2px; }
.sched .ttl { font-weight: 700; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sched .ttl a { color: var(--text); text-decoration: none; }
.sched .ttl a:hover { color: var(--a); text-decoration: underline; }
.sched ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 13px; }
.sched ul li a { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; }
.sched ul li a:hover { border-color: var(--a); }
.nolink { color: var(--text-mute); font-weight: 600; }
.nolink small { font-weight: 400; margin-left: 4px; }
.badge { font-size: 12px; font-weight: 800; color: #fff; background: var(--a); border-radius: 999px; padding: 1px 10px; }
.run-dot { color: var(--a); font-size: 11px; margin-left: -2px; }
.side .nolink { display: block; padding: 3px 6px; color: var(--text-mute); }
.runflag { margin: -6px 0 16px; font-size: 14px; font-weight: 700; }
.runflag a { text-decoration: none; }
.run { margin-top: 36px; padding-top: 4px; }
.run-h { margin-top: 0 !important; }
.run-note { font-size: 14px; color: var(--text-mute); }
.run-stage { margin: 8px 0; }
.run-src { margin-top: 12px; }
.run-src summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.run-src pre { max-height: 420px; overflow: auto; }
@media (prefers-color-scheme: dark) { .badge { color: #0b1220; } }
