/* ============================================================
   QRコード一括生成 — style.css
   画面表示 + 印刷(@media print)。LPのデザイントークンを使用。
   トークンはUIのみに適用。QR本体には使わない（§6）。
   ============================================================ */

/* ------------------------------------------------------------
   フォント（セルフホスト / 外部CDN不使用・オフライン動作）
   - unicode-range で欧文/和文を分割し、必要なファイルのみ読み込む
   - font-display:swap で読み込み前はシステムフォント表示（=フォールバック維持）
   - ライセンス: いずれも SIL OFL 1.1（fonts/OFL-*.txt, fonts/README.txt 参照）
   欧文レンジ / 和文レンジの定義を変数代わりにコメントで共有:
   LATIN  : U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074,
            U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD
   JP     : U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF,
            U+4E00-9FFF, U+3400-4DBF
   ------------------------------------------------------------ */

/* Shippori Mincho（見出し / 700） */
@font-face{
  font-family:'Shippori Mincho';
  font-style:normal;
  font-weight:700;
  font-display:swap;
  src:url('fonts/shippori-mincho-latin-700.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face{
  font-family:'Shippori Mincho';
  font-style:normal;
  font-weight:700;
  font-display:swap;
  src:url('fonts/shippori-mincho-japanese-700.woff2') format('woff2');
  unicode-range:U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FFF, U+3400-4DBF;
}

/* Zen Kaku Gothic New（本文 / 400・700） */
@font-face{
  font-family:'Zen Kaku Gothic New';
  font-style:normal;
  font-weight:400;
  font-display:swap;
  src:url('fonts/zen-kaku-gothic-new-latin-400.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face{
  font-family:'Zen Kaku Gothic New';
  font-style:normal;
  font-weight:400;
  font-display:swap;
  src:url('fonts/zen-kaku-gothic-new-japanese-400.woff2') format('woff2');
  unicode-range:U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FFF, U+3400-4DBF;
}
@font-face{
  font-family:'Zen Kaku Gothic New';
  font-style:normal;
  font-weight:700;
  font-display:swap;
  src:url('fonts/zen-kaku-gothic-new-latin-700.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face{
  font-family:'Zen Kaku Gothic New';
  font-style:normal;
  font-weight:700;
  font-display:swap;
  src:url('fonts/zen-kaku-gothic-new-japanese-700.woff2') format('woff2');
  unicode-range:U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FFF, U+3400-4DBF;
}

/* Outfit（欧文ラベル・ロゴ / 600） */
@font-face{
  font-family:'Outfit';
  font-style:normal;
  font-weight:600;
  font-display:swap;
  src:url('fonts/outfit-latin-600.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root{
  --navy:#0f2540;   /* 見出し・メインボタン背景 */
  --gold:#c9a449;   /* アクセント（セクションラベルの線など） */
  --paper:#f7f5f0;  /* 背景 */
  --ink:#1a1f28;    /* 本文 */
  --gray:#5a6677;   /* 補足テキスト */
  --line:#dcd6c9;   /* 区切り線・カード枠 */
  --white:#ffffff;

  --radius:6px;
  --shadow:0 1px 3px rgba(15,37,64,.08), 0 6px 18px rgba(15,37,64,.06);

  --font-head:'Shippori Mincho', "Yu Mincho", "游明朝", serif;
  --font-body:'Zen Kaku Gothic New', "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  --font-en:'Outfit', system-ui, sans-serif;
}

*{ box-sizing:border-box; }

html,body{ margin:0; padding:0; }

body{
  font-family:var(--font-body);
  color:var(--ink);
  background:var(--paper);
  line-height:1.7;
  -webkit-font-smoothing:antialiased;
}

/* ---------- ヘッダー ---------- */
.site-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  padding:14px 24px;
  background:var(--navy);
  color:var(--white);
}
.brand{ display:flex; align-items:center; gap:14px; }
.brand-logo{
  font-family:var(--font-en);
  font-weight:600;
  letter-spacing:.12em;
  font-size:1.05rem;
}
.brand-divider{
  width:1px; height:20px;
  background:var(--gold);
  display:inline-block;
}
.brand-tool{
  font-family:var(--font-head);
  font-weight:600;
  font-size:1.1rem;
  margin:0;
}
.back-link{
  color:var(--white);
  text-decoration:none;
  font-size:.9rem;
  opacity:.9;
  border-bottom:1px solid transparent;
  transition:border-color .15s, opacity .15s;
}
.back-link:hover{ opacity:1; border-bottom-color:var(--gold); }

/* ---------- レイアウト ---------- */
.layout{
  max-width:1200px;
  margin:24px auto;
  padding:0 20px;
  display:grid;
  grid-template-columns:minmax(320px, 420px) 1fr;
  gap:24px;
  align-items:start;
}
@media (max-width:860px){
  .layout{ grid-template-columns:1fr; }
}

.panel{
  background:var(--white);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
}
.input-panel{ position:sticky; top:16px; }
@media (max-width:860px){
  .input-panel{ position:static; }
}

/* ---------- セクションラベル ---------- */
.section-label{
  font-family:var(--font-head);
  font-size:1.05rem;
  font-weight:700;
  color:var(--navy);
  margin:0 0 14px;
  padding-left:12px;
  position:relative;
}
.section-label::before{
  content:"";
  position:absolute;
  left:0; top:.15em; bottom:.15em;
  width:3px;
  background:var(--gold);
  border-radius:2px;
}

/* ---------- 入力欄 ---------- */
.field-label{
  display:block;
  font-weight:700;
  font-size:.92rem;
  margin-bottom:4px;
}
.field-help{
  font-size:.8rem;
  color:var(--gray);
  margin:0 0 8px;
}
.field-help code, .privacy-note code{
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:4px;
  padding:1px 5px;
  font-size:.85em;
}
.entries{
  width:100%;
  resize:vertical;
  min-height:160px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  font-family:ui-monospace, "Consolas", monospace;
  font-size:.9rem;
  line-height:1.6;
  color:var(--ink);
  background:#fff;
}
.entries:focus{
  outline:2px solid var(--navy);
  outline-offset:1px;
  border-color:var(--navy);
}

/* ---------- オプション ---------- */
.options{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:12px 16px;
  margin:16px 0 4px;
}
.option{ display:flex; flex-direction:column; gap:5px; }
.option-label{
  font-size:.82rem;
  font-weight:700;
  color:var(--gray);
}
.select, .color{
  width:100%;
  padding:7px 8px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:#fff;
  font-family:inherit;
  font-size:.9rem;
  color:var(--ink);
}
.color{ height:38px; padding:3px; cursor:pointer; }
.select:focus, .color:focus{
  outline:2px solid var(--navy);
  outline-offset:1px;
}

/* セグメントボタン */
.seg{
  display:inline-flex;
  border:1px solid var(--line);
  border-radius:var(--radius);
  overflow:hidden;
}
.seg-btn{
  flex:1;
  border:0;
  background:#fff;
  padding:7px 0;
  font-family:inherit;
  font-size:.9rem;
  color:var(--ink);
  cursor:pointer;
  border-right:1px solid var(--line);
  transition:background .12s, color .12s;
}
.seg-btn:last-child{ border-right:0; }
.seg-btn:hover{ background:var(--paper); }
.seg-btn.is-active{
  background:var(--navy);
  color:var(--white);
}
.seg-btn:focus-visible{
  outline:2px solid var(--gold);
  outline-offset:-2px;
}

/* ---------- 警告 ---------- */
.warn{
  background:#fdf6e3;
  border:1px solid var(--gold);
  border-radius:var(--radius);
  padding:8px 12px;
  font-size:.84rem;
  color:#7a5b00;
  margin:12px 0 0;
}

/* ---------- 操作ボタン ---------- */
.actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:18px 0 8px;
}
.btn{
  font-family:inherit;
  font-size:.92rem;
  font-weight:700;
  padding:10px 18px;
  border-radius:var(--radius);
  border:1px solid var(--navy);
  background:#fff;
  color:var(--navy);
  cursor:pointer;
  transition:background .12s, color .12s, box-shadow .12s;
}
.btn:hover{ background:var(--paper); }
.btn:focus-visible{ outline:2px solid var(--gold); outline-offset:2px; }
.btn-primary{
  background:var(--navy);
  color:var(--white);
}
.btn-primary:hover{ background:#163056; }
.btn-ghost{
  border-color:var(--line);
  color:var(--gray);
}
.btn-ghost:hover{ background:var(--paper); color:var(--ink); }

/* ---------- 情報テキスト ---------- */
.count-info{
  font-size:.85rem;
  color:var(--gray);
  margin:8px 0 0;
  min-height:1.2em;
}
.count-info.has-warn{ color:#a05a00; font-weight:700; }
.privacy-note{
  font-size:.8rem;
  color:var(--gray);
  margin:6px 0 0;
}

/* ---------- プレビュー ---------- */
.preview-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
}
.preview-meta{ font-size:.82rem; color:var(--gray); }
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));
  gap:16px;
  margin-top:8px;
}
.empty-state{
  color:var(--gray);
  font-size:.9rem;
  text-align:center;
  padding:40px 12px;
}

/* QRカード */
.qr-card{
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:#fff;
  padding:14px 12px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  text-align:center;
}
.qr-card .qr-canvas{
  display:block;
  max-width:100%;
  height:auto;
  image-rendering:pixelated;
}
.qr-card .qr-label{
  font-size:.82rem;
  color:var(--ink);
  word-break:break-all;
  line-height:1.4;
}
.qr-card .qr-label.is-top{ order:-1; }
.qr-card .dl-btn{
  font-size:.78rem;
  font-weight:700;
  color:var(--navy);
  background:none;
  border:1px solid var(--line);
  border-radius:4px;
  padding:4px 10px;
  cursor:pointer;
}
.qr-card .dl-btn:hover{ background:var(--paper); }
.qr-card .dl-btn:focus-visible{ outline:2px solid var(--gold); outline-offset:1px; }

/* レスポンシブ：スマホ */
@media (max-width:380px){
  .options{ grid-template-columns:1fr; }
  .actions .btn{ flex:1 1 auto; }
  .grid{ grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---------- フッター ---------- */
.site-footer{
  max-width:1200px;
  margin:8px auto 28px;
  padding:16px 20px 0;
  border-top:1px solid var(--line);
  color:var(--gray);
  font-size:.82rem;
  text-align:center;
}
.site-footer p{ margin:4px 0; }

/* ============================================================
   印刷用（@media print）
   A4・グリッド整列。UI/操作パネルは非表示。カードはページ境界で割れない。
   ============================================================ */
@media print{
  @page{ size:A4; margin:12mm; }

  body{ background:#fff; }
  .site-header,
  .site-footer,
  .input-panel,
  .preview-head,
  .empty-state,
  .qr-card .dl-btn{
    display:none !important;
  }

  .layout{
    display:block;
    margin:0;
    padding:0;
    max-width:none;
  }
  .preview-panel{
    border:0;
    box-shadow:none;
    padding:0;
  }

  /* 列数は app.js が --print-cols を設定 */
  .grid{
    display:grid;
    grid-template-columns:repeat(var(--print-cols, 3), 1fr);
    gap:8mm;
    margin:0;
  }
  .qr-card{
    break-inside:avoid;
    page-break-inside:avoid;
    border:1px solid #bbb;
    box-shadow:none;
    padding:8px;
  }
  .qr-card .qr-label{ color:#000; }
}
