/* global React */
// Manual content — phases, steps, checklists, tips
// Bilingual: English + Japanese

const PHASES = [
  {
    id: 'cover',
    numLabel: '00',
    titleJa: 'はじめに',
    titleEn: 'Overview',
    leadJa: 'リソグラフ4色印刷の全工程を、データ作成から仕上げまで6つのフェーズに分けて解説します。本マニュアルは工作室での実機操作にそのまま使える形で構成されています。',
    leadEn: 'This manual walks through the full 4-color Risograph process, from data prep to final drying, in six phases. Designed for use beside the machine.',
    kind: 'cover'
  },
  {
    id: 'phase-1',
    numLabel: '01',
    titleJa: 'データ作成と分版',
    titleEn: 'Data Prep & Color Separation',
    leadJa: 'リソグラフは1色につき1つの版（マスター）を作るため、印刷したい色の数だけグレースケールデータを用意します。',
    leadEn: 'Risograph creates one master per ink color. Prepare a grayscale file for each color you want to print.',
    kind: 'phase1'
  },
  {
    id: 'phase-2',
    numLabel: '02',
    titleJa: '機材セットアップ',
    titleEn: 'Machine Setup',
    leadJa: '1パス目で使う2色のドラムをセットし、用紙を給紙トレイに整えます。明るい色・面積の広い色から先に刷るのが基本です。',
    leadEn: 'Load the first two ink drums and align the paper. Print lighter / broader colors first.',
    kind: 'phase2'
  },
  {
    id: 'phase-3',
    numLabel: '03',
    titleJa: '1パス目：製版・印刷',
    titleEn: 'Pass 1 — Master & Print',
    leadJa: 'PCからデータを送信して製版し、試し刷りで位置合わせ（レジストレーション）してから本番印刷します。',
    leadEn: 'Send data, create the master, register with test sheets, then print the run.',
    kind: 'phase3'
  },
  {
    id: 'phase-4',
    numLabel: '04',
    titleJa: '乾燥（インターバル）',
    titleEn: 'Drying Interval',
    leadJa: 'リソのインク（半水性）は紙に浸透して乾きます。十分に乾燥させてから2パス目に進まないと、ローラー汚れ・裏移りの原因になります。',
    leadEn: "Riso's soy/rice-bran ink dries by absorption. Wait fully before pass 2 to avoid roller smudges and offset.",
    kind: 'phase4'
  },
  {
    id: 'phase-5',
    numLabel: '05',
    titleJa: '2パス目：3・4色目',
    titleEn: 'Pass 2 — Colors 3 & 4',
    leadJa: 'ドラムを入れ替え、乾いた紙を再セット。すでに刷られた1・2色目に対し、3・4色目をピタリと合わせるのが4色印刷の最難関です。',
    leadEn: 'Swap drums, reload the dried sheets, and dial in registration to the existing 1st-pass print. The hardest part.',
    kind: 'phase5'
  },
  {
    id: 'phase-6',
    numLabel: '06',
    titleJa: '最終乾燥と仕上げ',
    titleEn: 'Final Dry & Finishing',
    leadJa: 'すべての印刷が終わったら風通しの良い場所で完全乾燥。必要に応じて裁断機でトンボを切り落として完成です。',
    leadEn: 'Dry fully in a ventilated area. Trim crop marks with a guillotine cutter if needed.',
    kind: 'phase6'
  },
  {
    id: 'tips',
    numLabel: 'A',
    titleJa: 'トラブルシューティング索引',
    titleEn: 'Troubleshooting Index',
    leadJa: '紙詰まり、ローラー汚れ、インクかすれ、版ズレなど、現場でよく出るトラブルへの対処をまとめました。',
    leadEn: 'Common issues and fixes — paper jams, roller smudges, faint print, misregistration.',
    kind: 'tips'
  },
  {
    id: 'glossary',
    numLabel: 'B',
    titleJa: '用語集',
    titleEn: 'Glossary',
    leadJa: 'マニュアル中で使われている専門用語を簡潔に解説します。',
    leadEn: 'Quick reference for terms used in this manual.',
    kind: 'glossary'
  },
];

// Checklists per phase (id stable for localStorage persistence)
const CHECKLISTS = {
  'phase-1': [
    {id:'p1-c1', ja:'4色ぶんレイヤー分けし、各色をグレースケール化した', en:'Split into 4 layers, each converted to grayscale'},
    {id:'p1-c2', ja:'隣接する色は0.1〜0.5mmトラッピングを設定した', en:'Trapping (0.1–0.5mm) applied at adjacent boundaries'},
    {id:'p1-c3', ja:'解像度を300〜600dpiに設定した', en:'Resolution set to 300–600 dpi'},
    {id:'p1-c4', ja:'各色を「01_Yellow.pdf」など命名規則で書き出した', en:'Files exported with naming like 01_Yellow.pdf'},
  ],
  'phase-2': [
    {id:'p2-c1', ja:'1色目（明るい/広い色）のドラムをセットした', en:'First (lighter / broader) drum installed'},
    {id:'p2-c2', ja:'2色目のドラムをセットした', en:'Second drum installed'},
    {id:'p2-c3', ja:'用紙を給紙トレイにセットし用紙ガイドを合わせた', en:'Paper loaded; feed guides aligned'},
    {id:'p2-c4', ja:'排紙トレイのガイドを用紙サイズに合わせた', en:'Output tray guides set to paper size'},
  ],
  'phase-3': [
    {id:'p3-c1', ja:'1色目・2色目データを送信し製版した', en:'Sent data; masters created for both drums'},
    {id:'p3-c2', ja:'試し刷りで天地・左右の位置を合わせた', en:'Test print — top/bottom and left/right registered'},
    {id:'p3-c3', ja:'最終枚数より20〜30%多めに本刷りした', en:'Printed run with 20–30% surplus'},
  ],
  'phase-4': [
    {id:'p4-c1', ja:'印刷物を平らに広げ風通しの良い場所に置いた', en:'Sheets laid flat in a ventilated area'},
    {id:'p4-c2', ja:'触ってインクが移らないことを確認した', en:'Verified ink does not transfer when touched'},
  ],
  'phase-5': [
    {id:'p5-c1', ja:'1・2色目のドラムを取り外し、3・4色目に交換した', en:'Drums swapped to 3rd / 4th colors'},
    {id:'p5-c2', ja:'乾燥した紙の表裏・天地を確認して給紙した', en:'Reloaded sheets — front/back and orientation verified'},
    {id:'p5-c3', ja:'3・4色目データを送信し製版した', en:'Sent data; pass-2 masters created'},
    {id:'p5-c4', ja:'試し刷りで1・2色目との位置合わせを微調整した', en:'Fine-tuned registration against pass-1 layers'},
    {id:'p5-c5', ja:'残り枚数を本印刷した', en:'Printed remaining sheets'},
  ],
  'phase-6': [
    {id:'p6-c1', ja:'印刷物を完全に乾燥させた', en:'Sheets fully dried'},
    {id:'p6-c2', ja:'必要に応じて裁断機でトンボを切り落とした', en:'Trim marks cut off with guillotine'},
    {id:'p6-c3', ja:'保管場所に湿気がないことを確認した', en:'Confirmed storage area is dry'},
  ],
};

// Tips — also referenced inline in phases
const TIPS = [
  {id:'t1', num:'01', ja:{t:'紙詰まり', d:'電源を切り、ローラー周辺の紙を「給紙方向と同じ向きに」ゆっくり引き抜く。逆方向に引くとローラーを傷める。'}, en:{t:'Paper jam', d:"Power off. Pull paper out in the feed direction — never against the roller's rotation."}},
  {id:'t2', num:'02', ja:{t:'ローラー汚れ', d:'前回のインクが付着したら、無水アルコールを染み込ませたウエスで軽く拭き取る。圧着ローラー＋給紙ローラーの両方を確認。'}, en:{t:'Roller smudge', d:'Wipe pressure & feed rollers with a lint-free cloth + isopropyl alcohol.'}},
  {id:'t3', num:'03', ja:{t:'インクかすれ', d:'長時間使っていなかった場合、ドラムの空回し（テストプリント数枚）でインクを行き渡らせる。'}, en:{t:'Faint / streaky print', d:'Run blank test sheets to redistribute ink if drum has been idle.'}},
  {id:'t4', num:'04', ja:{t:'版ズレ', d:'微小なズレはタッチパネルの天地・左右調整で補正。斜行の場合は給紙トレイの角度ダイヤルで補正する。'}, en:{t:'Misregistration', d:'Use top/bottom & left/right offsets on the panel. For skew, adjust the feed-tray angle dial.'}},
  {id:'t5', num:'05', ja:{t:'裏移り', d:'印刷物を重ね置きすると下の紙のインクが上に移ることがある。間紙を挟むか乾燥時間を十分とる。'}, en:{t:'Set-off / offsetting', d:'Stacking wet sheets causes ink transfer. Slip-sheet between prints or wait longer.'}},
  {id:'t6', num:'06', ja:{t:'マスター切れ', d:'本体上部のマスターロール残量を点検。残り少なければ新しいロールに交換。', }, en:{t:'Master out', d:'Check the master roll above the drum bay. Replace if low.'}},
  {id:'t7', num:'07', ja:{t:'インク残量', d:'ドラム横のインクボトルを確認。減っていれば同色カートリッジに交換。', }, en:{t:'Ink low', d:'Inspect the cartridge in the drum housing; swap for a fresh same-color tube.'}},
  {id:'t8', num:'08', ja:{t:'蛍光色の発色低下', d:'蛍光ピンク・蛍光イエローは紫外線で退色しやすい。完成後は遮光保管が望ましい。'}, en:{t:'Fluorescent fading', d:'Fluorescent pink/yellow fade under UV — store finished prints in the dark.'}},
];

// Glossary
const GLOSSARY = [
  {ja:'分版（ぶんぱん）', en:'Color Separation',
    d:'1枚の絵を印刷する色ごとに分けて、それぞれ独立したグレースケール画像にする工程。',
    dEn:'Splitting an artwork into one independent grayscale image per ink color, ready to expose as separate masters.'},
  {ja:'製版（せいはん）', en:'Mastering',
    d:'リソグラフが内部で作成する印刷用マスター。1色1版。',
    dEn:'The thermal stencil the Risograph cuts internally and wraps around the drum — one master per ink color.'},
  {ja:'ドラム', en:'Print Drum',
    d:'インクを保持する円筒部品。リソでは色ごとに専用ドラムがある。',
    dEn:'The removable cylinder that holds ink and the master. Each ink color has its own dedicated drum.'},
  {ja:'パス', en:'Pass',
    d:'紙が印刷機を1回通過すること。本マニュアルでは2パスで4色印刷。',
    dEn:'A single trip of the paper through the machine. This manual prints 4 colors over 2 passes (2 colors per pass).'},
  {ja:'レジストレーション', en:'Registration',
    d:'各色版の位置合わせ。タッチパネルの天地/左右補正で調整する。',
    dEn:'Aligning each color layer so they land precisely on top of each other. Tuned via the panel\'s vertical / horizontal offsets.'},
  {ja:'トラッピング', en:'Trapping',
    d:'隣接する色を0.1〜0.5mm重ねること。版ズレによる白抜けを防ぐ。',
    dEn:'Overlapping adjacent colors by 0.1–0.5mm so misregistration doesn\'t reveal a white gap of paper between them.'},
  {ja:'網点（あみてん）', en:'Halftone',
    d:'濃淡を点の大小・密度で表現する手法。リソではドライバ側で自動処理されるが、データ側で先に処理することもできる。',
    dEn:'Representing tone with dot size or density. The Riso driver halftones automatically, but pre-processing in your art tool gives more control.'},
  {ja:'裏移り', en:'Set-off',
    d:'乾燥不十分な印刷物を重ねた際に下の紙のインクが上の紙の裏に移る現象。',
    dEn:'Wet ink transferring from the front of one sheet to the back of the sheet stacked on top of it. Solved by drying time and slip-sheets.'},
];

window.PHASES = PHASES;
window.CHECKLISTS = CHECKLISTS;
window.TIPS = TIPS;
window.GLOSSARY = GLOSSARY;
