﻿/* =========================================
   Base / Variables
========================================= */
:root{
  --bg:#0a0f1e;
  --bg-soft:#0f1530;
  --card:#111938;
  --ink:#e9eefc;
  --ink-muted:#bfc7e6;
  --line:#1e2a5a;

  --brand:#4169e1;      /* primary */
  --accent:#0ea5e9;     /* secondary */
  --ok:#22c55e;
  --warn:#f59e0b;
  --danger:#ef4444;

  --radius:14px;
  --shadow:0 10px 30px rgba(0,0,0,.25);
  --container:1120px;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,
    "Hiragino Kaku Gothic ProN","Hiragino Sans",Meiryo,sans-serif;
  line-height:1.8; font-size:16px;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}

img{max-width:100%; height:auto; border:0}
a{color:var(--brand); text-decoration:none}
a:hover{text-decoration:underline}
.container{max-width:var(--container); margin:0 auto; padding:0 20px}

/* =========================================
   Header / Breadcrumbs
========================================= */
.site-header{background:linear-gradient(180deg,#0f1735 0%,#0a0f1e 100%); border-bottom:1px solid var(--line)}
.header-inner{display:flex; align-items:center; justify-content:space-between; padding:16px 0}
.brand img{display:block}

/* Utility nav */
.utility-nav{display:flex; gap:10px;}

/* Breadcrumbs */
.breadcrumbs{padding:8px 0 16px}
.breadcrumbs ol{display:flex; gap:8px; margin:0; padding:0; list-style:none; color:var(--ink-muted); font-size:14px}
.breadcrumbs a{color:var(--ink-muted)}
.breadcrumbs li::after{content:"?"; margin:0 6px; color:#7580b2}
.breadcrumbs li:last-child::after{content:""; margin:0}

/* =========================================
   Buttons
========================================= */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; padding:12px 16px;
  font-size:15px; font-weight:700; line-height:1.3;
  border-radius:10px; border:1px solid transparent;
  cursor:pointer; text-align:center;
  box-shadow:0 2px 6px rgba(0,0,0,.2);
  transition:opacity .2s, transform .1s, background .2s, color .2s, border-color .2s;
}
.btn:hover{opacity:.95; text-decoration:none; transform:translateY(-1px)}
.btn:active{transform:translateY(1px) scale(.98); opacity:.85}

.btn.primary{background:var(--brand); color:#fff; border-color:var(--brand)}
.btn.secondary{background:#55657a; color:#fff; border-color:#55657a}
.btn.contact{background:var(--accent); color:#fff; border-color:var(--accent)}
.btn.print{background:#1c254f; color:#fff; border-color:#243077}

.btn.block{display:block; width:100%}
.btn.small{min-height:36px; padding:8px 12px; font-size:14px}
.btn-row{display:flex; gap:12px; flex-wrap:wrap; justify-content:center}
.btn-row .btn{flex:1 1 260px}
@media (max-width:720px){ .btn-row .btn{flex:1 1 100%} }

/* =========================================
   Layout
========================================= */
.layout{
  display:grid; gap:24px; padding:28px 0 40px;
  grid-template-columns:minmax(0,1fr) 340px;
}
@media (max-width:980px){ .layout{grid-template-columns:1fr} }

/* =========================================
   Article
========================================= */
.article{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow)}
.article-header{padding:24px 24px 0 24px}
.article-title{
  font-size:clamp(20px,7vw,32px);
  line-height:1.3;
  margin:8px 0 6px;
}
.series{color:#9fb2ff; letter-spacing:.06em; text-transform:uppercase; font-size:13px; margin:0}
.meta{color:var(--ink-muted); font-size:14px; display:flex; gap:8px; align-items:center}

.kv{margin:18px 0 0; background:#0b132d; border-top:1px solid var(--line); overflow:hidden}
.kv img{display:block; width:100%; height:auto; max-width:100%}
.kv figcaption{padding:10px 16px; color:#99a5d3; font-size:13px}

/* Table of contents */
.toc{
  padding:14px 16px; margin:18px 0 24px;
  background:#0e1736; border:1px solid var(--line); border-radius:8px;
}
.toc strong{display:block; font-size:.95rem; font-weight:800; color:#ffffff; margin-bottom:6px}
.toc ol{margin:0; padding:0; list-style:none; display:grid; gap:6px}
.toc li{line-height:1.5}
.toc a{display:block; padding:6px 8px; border-radius:6px; color:#bcd0ff; text-decoration:none; outline:none}
.toc a:hover{background:#162050; color:#ffffff; text-decoration:none}
.toc a.active{background:#243077; color:#fff100; font-weight:700}

/* Lead / Body */
.lead{padding:16px 24px}
.lead p{margin:0; color:#ffffff}
.article section{padding:16px 24px}
.article h2{font-size:22px; line-height:1.4; margin:0 0 8px; padding-top:8px; border-top:1px dashed var(--line)}
.article p{margin:0 0 12px}
.article ul{margin:0 0 12px 20px}

/* CTA inside article */
.cta{padding:8px 24px 24px}
.cta-inner{
  display:flex; flex-direction:column; align-items:center; text-align:center; gap:16px;
  background:#0e1736; border:1px solid var(--line); border-radius:12px; padding:24px
}

/* =========================================
   Sidebar
========================================= */
.sidebar{display:flex; flex-direction:column; gap:16px}
.card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:16px; box-shadow:var(--shadow)}
.banner img{border-radius:10px; display:block}
.note{color:#9fb0e0; font-size:14px}

/* =========================================
   Footer
========================================= */
.site-footer{border-top:1px solid var(--line); background:#0e1530}
.footer-inner{
  display:flex; gap:16px; align-items:center;
  justify-content:space-between; flex-wrap:wrap;
  padding:18px 0;
}
.footer-inner small{color:#aab6e6}

/* =========================================
   Tables / Code / Quotes
========================================= */
table{width:100%; border-collapse:separate; border-spacing:0; border:1px solid var(--line); border-radius:12px; overflow:hidden}
th,td{padding:12px 10px; border-bottom:1px solid var(--line)}
th{background:#0f1d4a; color:#eaf0ff; text-align:left}
pre,code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Courier New",monospace}
pre{background:#0b132d; color:#e6ebff; padding:14px; border:1px solid #1a2b69; border-radius:10px; overflow:auto}
blockquote{margin:0; padding:10px 14px; border-left:3px solid var(--brand); background:#0e1632; color:#d7def7}

/* =========================================
   Forms
========================================= */
.form-card{padding:20px}
.lead-form{margin-top:8px}
.grid2{display:grid; gap:12px; grid-template-columns:repeat(2,minmax(0,1fr))}
@media (max-width:720px){.grid2{grid-template-columns:1fr}}
.lead-form label{display:flex; flex-direction:column; gap:6px; font-weight:600; color:var(--ink)}
.lead-form input,.lead-form select,.lead-form textarea{
  background:#0e1632; border:1px solid var(--line); color:var(--ink);
  border-radius:8px; padding:10px 12px; font-size:15px;
}
.lead-form input:focus,.lead-form select:focus,.lead-form textarea:focus{
  outline:2px solid var(--accent); outline-offset:1px;
}
.checkbox{display:flex; align-items:center; gap:8px; margin-top:8px; font-weight:600}
.small-muted{color:#9fb0e0; font-size:13px; margin:8px 0 0}

/* =========================================
   Light mode fallback
========================================= */
@media (prefers-color-scheme: light) {
  :root{
    --bg:#f6f8ff; --bg-soft:#ffffff; --card:#ffffff;
    --ink:#0b1020; --ink-muted:#4b5567; --line:#e3e7f5;
  }
  body{background:var(--bg); color:var(--ink)}
  .site-header{background:#ffffff}
  .article,.card{box-shadow:0 8px 24px rgba(0,0,0,.06)}
  .toc{background:#f5f7fe; border-color:#e3e7f5}
  .toc strong{color:#0b1020}
  .toc a{color:#0b3ea8}
  .toc a.active{background:#dce7ff; color:#b00020}
  .lead p{color:#0b1020}
}

/* =========================================
   Header/Footer Full-width fix
========================================= */
.site-header > .container,
.site-footer > .container {
  max-width:none;
  width:100%;
  padding-left:max(env(safe-area-inset-left),16px);
  padding-right:max(env(safe-area-inset-right),16px);
}

:is(header.site-header, footer.site-footer) > .container {
  max-width:none!important;
  width:100%!important;
  padding-left:max(env(safe-area-inset-left),16px)!important;
  padding-right:max(env(safe-area-inset-right),16px)!important;
}

/* =========================================
   Responsive Typography & Readability Fix
========================================= */

/* 日本語がどこでも改行されないように戻す */
.article {
  overflow-wrap: normal;
  word-break: normal;
}

/* 見出しサイズを端末幅に応じて調整 */
.article-title {
  font-size: clamp(20px, 7vw, 32px);
  line-height: 1.3;
}

/* 本文の読み幅を上限化して中央寄せ */
.article .article-header,
.article .lead,
.article section,
.article .cta,
.article ul,
.article #refs {
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

/* キービジュアルはカードいっぱいにフィット */
.article .kv { max-width: none; margin-left:auto; margin-right:auto; overflow:hidden; }
.article .kv img { width:100%; height:auto; max-width:100%; }

/* スマホ時の余白最適化 */
@media (max-width: 768px) {
  .article .article-header { padding:20px 16px 0; }
  .article section, .article .lead, .article .cta { padding:14px 16px; }
  .article .article-header,
  .article .lead,
  .article section,
  .article .cta,
  .article ul,
  .article #refs { max-width: none; }
}
/* --- Gridはみ出し対策：Grid子要素の最小幅を明示的に0に --- */
.layout > * { min-width: 0; }          /* これが最重要 */
.article, .sidebar { min-width: 0; }   /* 念のための明示 */