/* ==========================================================
   宗教・文化対応カレンダー — JOL Design System 踏襲
   tokens: JOL UI (orange #ff6b1a / Noto Sans JP + DM Sans)
   育成就労シミュレーターと同一トークン
   ========================================================== */
:root {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --border: #e8e8f0;
  --border-2: #dde6ef;
  --primary: #ff6b1a;
  --primary-btn: #ff7020;
  --primary-soft: #ffece2;
  --primary-soft-border: rgba(255, 107, 26, 0.22);
  --ok: #00db6b;
  --ok-soft: #e5f9ed;
  --danger: #f6182f;
  --danger-soft: #ffe9e9;
  --danger-border: #ff3a43;
  --warn: #f59e0b;
  --warn-soft: #fff5e6;
  --info: #2f6df6;
  --info-soft: #eaf1ff;
  --text: #1b1b1b;
  --text-dark: #1a1a2e;
  --text-muted: #8a8a99;
  --text-soft: #5b5b6b;
  --track: rgba(0, 0, 0, 0.07);
  --orange-shadow: 0 6px 20px 0 rgba(255, 107, 26, 0.3);
  --card-shadow: 0 2px 14px rgba(20, 20, 50, 0.05);

  --font-ja: "Noto Sans JP", sans-serif;
  --font-en: "DM Sans", "Noto Sans JP", sans-serif;

  --r-card: 16px;
  --r-option: 12px;
  --r-badge: 8px;
  --r-button: 9px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ja);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
.en { font-family: var(--font-en); }

.app {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
  background: var(--bg);
  position: relative;
  z-index: 1;
}

/* PC: 左右をブランド背景 + JOLウォーターマークで埋める */
@media (min-width: 1040px) {
  body {
    background: url("assets/bg-desktop.jpg") center top / cover no-repeat fixed #ff6b1a;
  }
  .app {
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.18);
    border-radius: 0;
  }
  body::before, body::after {
    content: "";
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(180px, 34vw - 260px, 520px);
    aspect-ratio: 599 / 220;
    background: url("assets/watermark.svg") center / contain no-repeat;
    z-index: 0;
    pointer-events: none;
  }
  body::before { left: 2vw; }
  body::after { right: 2vw; }
}

/* ---------- ヘッダー ---------- */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  margin-bottom: 20px;
}
.header-logo { height: 22px; width: auto; }
.header-basis {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.4;
}
.header-basis b { color: var(--primary); font-weight: 700; }

/* ---------- hero ---------- */
.screen { display: flex; flex-direction: column; flex: 1; animation: fadeIn 0.35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--primary);
  text-transform: uppercase;
}
.h1 { font-size: 24px; font-weight: 700; line-height: 1.4; margin: 8px 0 12px; color: var(--text-dark); }
.h1 .accent { color: var(--primary); }
.lead { font-size: 14px; line-height: 1.85; color: var(--text-soft); }
.lead b { color: var(--text); font-weight: 700; }

/* ---------- 直近ハイライト (F-05) ---------- */
.upcoming {
  background: linear-gradient(135deg, #ff8a3d 0%, var(--primary) 100%);
  color: #fff;
  border-radius: var(--r-card);
  padding: 18px 18px 16px;
  box-shadow: var(--orange-shadow);
  margin: 20px 0 8px;
}
.upcoming .uc-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
}
.upcoming .uc-head .uc-ico { font-size: 15px; }
.upcoming .uc-list { display: flex; flex-direction: column; gap: 8px; }
.uc-item {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--r-option);
  padding: 10px 12px;
  backdrop-filter: blur(4px);
}
.uc-item .uc-when {
  flex: 0 0 auto; text-align: center; min-width: 52px;
  font-family: var(--font-en); font-weight: 700; line-height: 1.15;
}
.uc-item .uc-when .uc-d { font-size: 17px; }
.uc-item .uc-when .uc-m { font-size: 10px; opacity: 0.9; }
.uc-item .uc-body { flex: 1; min-width: 0; }
.uc-item .uc-name { font-size: 13.5px; font-weight: 700; line-height: 1.4; }
.uc-item .uc-meta { font-size: 11px; opacity: 0.92; margin-top: 1px; }
.uc-item .uc-cd {
  flex: 0 0 auto; font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, 0.24); border-radius: 999px; padding: 3px 10px;
}
.upcoming .uc-empty { font-size: 12.5px; opacity: 0.92; line-height: 1.7; }

/* ---------- コントロールパネル ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
  box-shadow: var(--card-shadow);
  margin: 16px 0;
}
.panel-title {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.04em; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.panel-title::before { content: ""; width: 3px; height: 13px; background: var(--primary); border-radius: 2px; }

.country-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
@media (min-width: 520px) { .country-grid { grid-template-columns: repeat(4, 1fr); } }
.c-chip {
  position: relative; border: 1.5px solid var(--border); border-radius: var(--r-option);
  background: var(--surface); padding: 11px 8px; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--text);
  transition: all 0.15s ease; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.c-chip .flag { font-size: 20px; line-height: 1; }
.c-chip.checked { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.c-chip:active { transform: scale(0.97); }

.panel-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mini-btn {
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-soft); font-size: 11.5px; font-weight: 600;
  border-radius: var(--r-badge); padding: 7px 12px;
}
.mini-btn:hover { border-color: var(--primary); color: var(--primary); }

/* year toggle */
.year-toggle {
  display: flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-button); padding: 4px; gap: 4px; margin-top: 14px;
}
.year-toggle button {
  flex: 1; border: none; background: none; border-radius: 7px;
  padding: 9px 0; font-family: var(--font-en); font-weight: 700; font-size: 14px;
  color: var(--text-muted); transition: all 0.15s ease;
}
.year-toggle button.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(255,107,26,0.3); }
.year-toggle button .yt-sub { display: block; font-family: var(--font-ja); font-size: 9.5px; font-weight: 500; opacity: 0.85; }

/* ---------- 月別タイムライン ---------- */
.cal-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 22px 2px 12px;
}
.cal-meta .cm-title { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.cal-meta .cm-count { font-size: 11.5px; color: var(--text-muted); }
.cal-meta .cm-count b { color: var(--primary); font-family: var(--font-en); }

.months { display: flex; flex-direction: column; gap: 4px; }
.month-block { display: flex; gap: 12px; }
.month-rail {
  flex: 0 0 auto; width: 44px; text-align: center; position: relative;
}
.month-rail .mr-num {
  font-family: var(--font-en); font-size: 20px; font-weight: 700; color: var(--text-dark); line-height: 1;
}
.month-rail .mr-lbl { font-size: 9px; color: var(--text-muted); letter-spacing: 0.06em; }
.month-rail::after {
  content: ""; position: absolute; left: 50%; top: 30px; bottom: -4px;
  width: 2px; background: var(--border); transform: translateX(-50%);
}
.month-block:last-child .month-rail::after { display: none; }
.month-block.empty .month-rail .mr-num { color: #c9c9d4; }

.month-events { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; }
.month-events.is-empty { padding-bottom: 10px; }
.month-empty { font-size: 11.5px; color: var(--text-muted); padding: 6px 0; }

/* event card */
.ev-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-option); box-shadow: var(--card-shadow);
  overflow: hidden; transition: border-color 0.15s ease;
}
.ev-card.open { border-color: var(--primary-soft-border); }
.ev-head {
  display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px;
  width: 100%; text-align: left; background: none; border: none;
}
.ev-flags { flex: 0 0 auto; font-size: 15px; line-height: 1.3; letter-spacing: -2px; padding-top: 1px; }
.ev-main { flex: 1; min-width: 0; }
.ev-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-name { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.4; }
.ev-date { font-family: var(--font-en); font-size: 12px; font-weight: 700; color: var(--text-soft); margin-top: 3px; }
.ev-date .ev-status {
  font-family: var(--font-ja); font-size: 9.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 5px; margin-left: 6px; vertical-align: 1px;
}
.ev-status.plan { background: var(--warn-soft); color: #c67c00; }
.ev-status.fixed { background: var(--ok-soft); color: #0a9b53; }
.ev-badges { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; padding-top: 2px; }
.ev-impact { font-size: 12px; letter-spacing: 1px; }
.ev-impact .on { color: var(--primary); }
.ev-impact .off { color: var(--track); }
.ev-toggle {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; flex: 0 0 auto;
}
.ev-toggle::after {
  content: ""; width: 7px; height: 7px; border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted); transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s var(--ease-out);
}
.ev-card.open .ev-toggle::after { transform: translateY(1px) rotate(-135deg); }

.ev-type-tag {
  font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-badge);
  background: var(--track); color: var(--text-soft);
}
.ev-type-tag.t-islam { background: #efe9ff; color: #6b3fd4; }
.ev-type-tag.t-lunar { background: var(--info-soft); color: var(--info); }
.ev-type-tag.t-move { background: var(--warn-soft); color: #c67c00; }
.ev-type-tag.t-fixed { background: var(--ok-soft); color: #0a9b53; }

/* detail (F-03) */
.ev-detail {
  display: none; padding: 0 14px 14px; border-top: 1px solid var(--border);
  margin-top: -1px;
}
.ev-card.open .ev-detail { display: block; animation: fadeIn 0.25s ease both; }
.ev-summary { font-size: 12.5px; line-height: 1.75; color: var(--text-soft); padding: 12px 0 4px; }
.ev-tips { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ev-tip {
  border-radius: var(--r-option); padding: 11px 13px;
  display: flex; gap: 10px; align-items: flex-start;
}
.ev-tip .tip-ico { flex: 0 0 auto; font-size: 15px; line-height: 1.3; }
.ev-tip .tip-b { flex: 1; }
.ev-tip .tip-t { font-size: 11.5px; font-weight: 700; margin-bottom: 3px; }
.ev-tip .tip-x { font-size: 12px; line-height: 1.7; }
.ev-tip.shift { background: var(--info-soft); }
.ev-tip.shift .tip-t { color: var(--info); }
.ev-tip.shift .tip-x { color: #33518f; }
.ev-tip.safety { background: var(--warn-soft); }
.ev-tip.safety .tip-t { color: #c67c00; }
.ev-tip.safety .tip-x { color: #855c17; }
.ev-source {
  font-size: 10px; color: var(--text-muted); line-height: 1.6; margin-top: 10px;
  padding-top: 8px; border-top: 1px dashed var(--border);
}
.ev-source b { color: var(--text-soft); font-weight: 700; }

/* empty state */
.cal-empty {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
  font-size: 13px; line-height: 1.8;
}
.cal-empty .ce-ico { font-size: 34px; margin-bottom: 8px; }

/* legend */
.legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 16px 2px 0;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.legend span { font-size: 10.5px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.legend .lg { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }

/* ---------- ゲート / CTA ---------- */
.gate {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 22px; margin-top: 20px; box-shadow: var(--card-shadow);
}
.gate .g-eyebrow {
  font-family: var(--font-en); font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--primary); text-transform: uppercase;
}
.gate h3 { font-size: 17px; font-weight: 700; color: var(--text-dark); margin: 5px 0 6px; }
.gate .g-lead { font-size: 12.5px; color: var(--text-soft); line-height: 1.7; margin-bottom: 14px; }
.gate .g-perks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.g-perk { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.6; color: var(--text-soft); }
.g-perk .pk {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.g-perk b { color: var(--text); font-weight: 700; }

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--text-dark); display: flex; align-items: center; gap: 8px; }
.req { font-size: 9.5px; font-weight: 700; color: #fff; background: var(--primary); border-radius: 4px; padding: 1px 6px; }
.opt { font-size: 9.5px; font-weight: 700; color: var(--text-muted); background: var(--track); border-radius: 4px; padding: 1px 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input, .select {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: var(--r-option);
  background: var(--surface); font-size: 15px; color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none; appearance: none;
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.select { padding-right: 40px; }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field.error .input, .field.error .select { border-color: var(--danger); }
.field-err { font-size: 11px; color: var(--danger); font-weight: 500; display: none; }
.field.error .field-err { display: block; }

.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; color: var(--text-soft); line-height: 1.6; margin: 4px 0 2px; }
.consent input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); flex: 0 0 auto; }
.consent a { color: var(--primary); text-decoration: underline; }

.btn-primary {
  display: block; width: 100%; min-height: 54px; border: none;
  border-radius: var(--r-button); background: var(--primary-btn); color: #fff;
  font-weight: 700; font-size: 16px; box-shadow: var(--orange-shadow); margin-top: 4px;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-primary:active { transform: scale(0.985); filter: brightness(0.96); }
.btn-primary:disabled { opacity: 0.5; box-shadow: none; cursor: default; }
.btn-primary .btn-sub { display: block; font-size: 11px; font-weight: 400; opacity: 0.9; font-family: var(--font-en); margin-top: 2px; }

.btn-secondary {
  display: block; width: 100%; min-height: 50px;
  border: 1.5px solid var(--primary); border-radius: var(--r-button);
  background: #fff; color: var(--primary); font-weight: 700; font-size: 15px;
  transition: transform 0.15s ease;
}
.btn-secondary:active { transform: scale(0.985); }

/* unlocked / thanks */
.unlocked {
  background: var(--ok-soft); border: 1px solid #a6ecc6; border-radius: var(--r-card);
  padding: 20px; margin-top: 20px; text-align: center;
}
.unlocked .u-ico { font-size: 30px; }
.unlocked h3 { font-size: 16px; font-weight: 700; color: #0a7c44; margin: 6px 0 5px; }
.unlocked p { font-size: 12.5px; color: var(--text-soft); line-height: 1.7; margin-bottom: 14px; }
.unlocked .u-actions { display: flex; flex-direction: column; gap: 9px; }

/* download row (locked look) */
.dl-row { display: flex; gap: 8px; margin-top: 14px; }
.dl-chip {
  flex: 1; border: 1px dashed var(--border-2); border-radius: var(--r-option);
  background: var(--surface-2); padding: 12px 8px; text-align: center;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.dl-chip .dl-ico { font-size: 18px; }
.dl-chip .dl-lock { font-size: 9px; opacity: 0.7; }

/* ---------- CTA ---------- */
.cta-card {
  background: linear-gradient(135deg, #fff 0%, var(--primary-soft) 100%);
  border: 1px solid var(--primary-soft-border); border-radius: var(--r-card);
  padding: 22px; margin-top: 16px; text-align: center;
}
.cta-card h3 { font-size: 16px; font-weight: 700; color: var(--text-dark); margin-bottom: 6px; }
.cta-card p { font-size: 12.5px; color: var(--text-soft); line-height: 1.7; margin-bottom: 16px; }

/* ---------- disclaimer / footer ---------- */
.disclaimer {
  font-size: 10.5px; line-height: 1.7; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 14px; margin-top: 24px;
}
.disclaimer b { color: var(--text-soft); }
.disclaimer p + p { margin-top: 7px; }
.logo-footer { margin-top: 22px; padding-top: 8px; display: flex; justify-content: center; }
.logo-footer img { height: 24px; width: auto; opacity: 0.85; }

/* ---------- print (PDF出力 F-11) ---------- */
@media print {
  @page { size: A4; margin: 12mm 10mm; }
  body { background: #fff !important; }
  body::before, body::after { display: none !important; }
  .app { box-shadow: none !important; max-width: none; padding: 0; }
  .no-print { display: none !important; }
  .ev-card, .panel, .upcoming, .gate, .cta-card { box-shadow: none !important; }
  .ev-detail { display: block !important; }
  .ev-toggle { display: none !important; }
  .ev-card { break-inside: avoid; border: 1px solid #ccc; }
  .month-block { break-inside: avoid; }
  .upcoming, .ev-tip, .ev-status, .ev-type-tag, .ev-impact .on {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
