/* 求人原稿AI — 「帳票（求人票）」をモチーフにした紙とインクの画面。
   外部フォントは読み込まない（外部送信を増やさないため）。 */

:root {
  --paper: #f5efe3;
  --surface: #fffcf5;
  --ink: #1f1b16;
  --ink-soft: #4a4339;
  --muted: #776d60;
  --rule: #d9cdb8;
  --rule-strong: #1f1b16;
  --accent: #c2412b;          /* 朱：要修正・主ボタン */
  --accent-ink: #fffaf2;
  --warn: #9a6512;            /* 黄土：要確認 */
  --warn-bg: #f8ead0;
  --info: #3f6655;            /* 青磁：参考 */
  --info-bg: #e3eee6;
  --error-bg: #f8e1da;
  --focus: #2d5bd7;

  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --font-sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;

  --text-sm: 0.875rem;
  --text-base: clamp(0.95rem, 0.9rem + 0.2vw, 1.0625rem);
  --text-hero: clamp(2rem, 1.2rem + 3.6vw, 3.75rem);
  --space-gutter: clamp(1rem, 0.6rem + 2vw, 2.5rem);
  --radius: 3px;
  --duration: 160ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sheet: 0 1px 0 var(--rule), 0 18px 40px -28px rgba(60, 40, 10, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16130f;
    --surface: #1f1b16;
    --ink: #efe6d6;
    --ink-soft: #d3c8b6;
    --muted: #a99d8b;
    --rule: #3b342b;
    --rule-strong: #efe6d6;
    --accent: #e0664c;
    --accent-ink: #1a0f0a;
    --warn: #e0a84a;
    --warn-bg: #3a2c14;
    --info: #8cc2a7;
    --info-bg: #1c2e25;
    --error-bg: #3d1d16;
    --focus: #8aa8ff;
    --shadow-sheet: 0 1px 0 var(--rule), 0 18px 40px -28px rgba(0, 0, 0, 0.8);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.75;
  /* 紙の目：細い横罫を薄く敷く */
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, color-mix(in srgb, var(--rule) 35%, transparent) 31px 32px);
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- 見出し部 ---- */
.masthead { border-bottom: 2px solid var(--rule-strong); background: var(--paper); }
.masthead__inner {
  max-width: 1240px; margin: 0 auto; padding: 0.9rem var(--space-gutter);
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
}
.brand { margin: 0; font-weight: 700; letter-spacing: 0.04em; }
.brand__mark { font-family: var(--font-mono); font-size: 0.95em; }
.brand__sep { color: var(--muted); margin: 0 0.5em; font-weight: 400; }
.masthead__tag {
  margin: 0; font-size: var(--text-sm); border: 1px solid var(--ink); padding: 0 0.6em; border-radius: var(--radius);
}

main { max-width: 1240px; margin: 0 auto; padding: 0 var(--space-gutter); }

.hero { padding: clamp(2rem, 1rem + 5vw, 4.5rem) 0 1.75rem; max-width: 46rem; }
.hero__kicker { margin: 0 0 0.75rem; color: var(--accent); font-weight: 700; letter-spacing: 0.08em; font-size: var(--text-sm); }
.hero__title {
  margin: 0; font-family: var(--font-serif); font-weight: 600;
  font-size: var(--text-hero); line-height: 1.25; letter-spacing: 0.02em;
}
.hero__lead { margin: 1.25rem 0 0; color: var(--ink-soft); max-width: 40rem; }
.hero__facts {
  list-style: none; padding: 0; margin: 1.25rem 0 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: var(--text-sm); color: var(--muted);
}
.hero__facts li::before { content: "■"; color: var(--accent); margin-right: 0.4em; font-size: 0.7em; vertical-align: 0.15em; }

.notice {
  border: 1px solid var(--rule-strong); border-left: 6px solid var(--accent);
  background: var(--surface); padding: 1rem 1.25rem; margin: 0 0 2rem; font-size: var(--text-sm);
}
.notice p { margin: 0; }
.notice__title { font-weight: 700; margin-bottom: 0.25rem !important; }

/* ---- 作業領域：左が入力票、右が原稿 ---- */
.workspace { display: grid; gap: 2rem; padding-bottom: 4rem; }
@media (min-width: 1024px) {
  .workspace { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: start; }
  .result { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
}

.sheet {
  background: var(--surface); border: 1px solid var(--rule-strong);
  box-shadow: var(--shadow-sheet); padding: 0 clamp(1rem, 0.5rem + 2vw, 2rem) 1.5rem;
}
.sheet__section { border: 0; border-bottom: 1px dashed var(--rule); margin: 0; padding: 1.5rem 0 1.25rem; min-width: 0; }
.sheet__section legend {
  font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600;
  padding: 0; display: flex; align-items: baseline; gap: 0.75rem; float: left; width: 100%; margin-bottom: 1rem;
}
.sheet__section legend + * { clear: both; }
.sheet__no { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); border: 1px solid var(--accent); padding: 0 0.4em; }
.sheet__section--legal { background: linear-gradient(to right, color-mix(in srgb, var(--warn-bg) 55%, transparent), transparent 70%); margin: 0 calc(-1 * clamp(1rem, 0.5rem + 2vw, 2rem)); padding-inline: clamp(1rem, 0.5rem + 2vw, 2rem); }

.grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.field { margin-bottom: 1rem; min-width: 0; }
.field--wide { grid-column: span 2; }
@media (max-width: 520px) { .field--wide { grid-column: auto; } }

label { display: block; font-weight: 600; font-size: var(--text-sm); margin-bottom: 0.3rem; }
.req { color: var(--accent); font-size: 0.75rem; font-weight: 700; margin-left: 0.25em; }
.hint { color: var(--muted); font-size: 0.8rem; margin: 0.35rem 0 0; line-height: 1.6; }

input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 0; border-bottom: 1.5px solid var(--ink-soft); border-radius: 0;
  padding: 0.5rem 0.6rem; transition: border-color var(--duration) var(--ease), background-color var(--duration) var(--ease);
}
input, select { min-height: 2.75rem; }
textarea { resize: vertical; line-height: 1.7; }
input:hover, select:hover, textarea:hover { border-bottom-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-bottom-color: var(--focus); background: var(--surface); box-shadow: 0 2px 0 var(--focus); }
[aria-invalid="true"] { border-bottom-color: var(--accent); background: var(--error-bg); }
.field-error { color: var(--accent); font-size: 0.8rem; margin: 0.3rem 0 0; font-weight: 600; }

.form-status { margin: 1.25rem 0 0; padding: 0.75rem 1rem; background: var(--error-bg); border-left: 4px solid var(--accent); font-size: var(--text-sm); }

.submit-row { padding-top: 1.5rem; }
.consent { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; font-size: var(--text-sm); line-height: 1.6; }
.consent input { width: 1.1rem; height: 1.1rem; margin-top: 0.2rem; flex: none; accent-color: var(--accent); }
.turnstile { margin-top: 1rem; }
.turnstile__widget { min-height: 65px; }
.turnstile__status { margin-top: 0.25rem; }
.turnstile__status--error { color: var(--accent); }
.submit-row__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: flex-end; margin-top: 1rem; }

.button {
  font: inherit; font-weight: 700; letter-spacing: 0.06em; cursor: pointer;
  border-radius: var(--radius); padding: 0.7rem 1.4rem; border: 1.5px solid var(--ink);
  transition: transform var(--duration) var(--ease), background-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.button--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 3px 3px 0 var(--ink); }
.button--primary:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.button--primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.button--ghost { background: transparent; color: var(--ink); }
.button--ghost:hover { background: var(--paper); }
.button[disabled] { opacity: 0.55; cursor: progress; transform: none; }

/* ---- 原稿とチェック結果 ---- */
.result { background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: var(--shadow-sheet); padding: 1.25rem clamp(1rem, 0.5rem + 2vw, 1.75rem) 1.75rem; }
.result__head { display: flex; align-items: center; gap: 0.75rem; border-bottom: 2px solid var(--rule-strong); padding-bottom: 0.5rem; }
.result__title { margin: 0; font-family: var(--font-serif); font-size: 1.5rem; }
.result__empty { color: var(--muted); font-size: var(--text-sm); margin: 1.25rem 0 0; }
.result[aria-busy="true"] .result__empty::after { content: "　作成中…"; color: var(--accent); }

.badge { font-size: 0.75rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: var(--radius); }
.badge--mock { background: var(--info-bg); color: var(--info); border: 1px solid currentColor; }

.ai-label {
  margin: 1rem 0 0.75rem; font-size: var(--text-sm); font-weight: 700;
  padding: 0.5rem 0.75rem; border: 1px dashed var(--accent); color: var(--accent);
}
.truncated { margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; background: var(--warn-bg); color: var(--warn); font-size: var(--text-sm); font-weight: 600; }

.draft {
  font-family: var(--font-sans); font-size: 0.95rem; line-height: 1.85;
  background: var(--paper); border: 1px solid var(--rule); border-bottom-width: 1.5px; min-height: 18rem;
}
.result__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 0.75rem; }
.copy-status { font-size: var(--text-sm); color: var(--info); }
.remaining { margin-left: auto; font-size: 0.8rem; color: var(--muted); }

.checks__title { font-family: var(--font-serif); font-size: 1.15rem; margin: 2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--rule); }
.checks { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.check {
  display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem;
  padding: 0.7rem 0.85rem; border-left: 4px solid; background: var(--paper); font-size: var(--text-sm); line-height: 1.6;
}
.check--error { border-color: var(--accent); background: var(--error-bg); }
.check--warning { border-color: var(--warn); background: var(--warn-bg); }
.check--info { border-color: var(--info); background: var(--info-bg); }
.check__label {
  grid-row: span 3; align-self: start; font-weight: 700; font-size: 0.75rem; white-space: nowrap;
  border: 1.5px solid currentColor; border-radius: 50%; width: 3.2rem; height: 3.2rem;
  display: grid; place-items: center; transform: rotate(-8deg); /* 判子 */
}
.check--error .check__label { color: var(--accent); }
.check--warning .check__label { color: var(--warn); }
.check--info .check__label { color: var(--info); }
.check__message { margin: 0; }
.check__match { margin: 0; font-weight: 700; }
.check__meta { margin: 0; color: var(--muted); font-size: 0.75rem; }
.checks__none { font-size: var(--text-sm); color: var(--info); margin: 1rem 0 0; }

/* ---- 足元 ---- */
.footer { border-top: 2px solid var(--rule-strong); padding: 1.5rem var(--space-gutter) 2.5rem; font-size: var(--text-sm); color: var(--ink-soft); max-width: 1240px; margin: 0 auto; }
.footer p { margin: 0.25rem 0; }
.footer__links { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; padding: 0; margin: 0 0 0.75rem; }
.footer__note { color: var(--muted); font-size: 0.8rem; }

/* ---- 規約などの文書ページ ---- */
.doc { max-width: 46rem; margin: 0 auto; padding: 2.5rem var(--space-gutter) 4rem; }
.doc h1 { font-family: var(--font-serif); font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); line-height: 1.35; margin: 0 0 0.5rem; }
.doc h2 { font-family: var(--font-serif); font-size: 1.2rem; margin: 2.25rem 0 0.5rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--rule); }
/* 日本語は1文字ごとに折り返せるため、1列目に幅を与えないと1〜2文字幅まで縮む。狭い画面では表の中だけ横に動かす */
.doc table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: var(--text-sm); line-height: 1.7; margin-top: 0.75rem; background: var(--surface); }
.doc th, .doc td { border: 1px solid var(--rule); padding: 0.6rem 0.75rem; text-align: left; vertical-align: top; }
.doc th { background: var(--paper); white-space: nowrap; }
.doc td:first-child { width: 9.5em; font-weight: 600; }
.doc .table-wrap { overflow-x: auto; }
.doc ol, .doc ul { padding-left: 1.4rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .button--primary:hover, .button--primary:active { transform: none; }
}
