/* iKontent hub — brand: near-black #0D0D0D, cream #F4F1EA, red #D9291C (from logo) */
:root {
  --ink: #141414;
  --paper: #f4f1ea;
  --surface: #ffffff;
  --muted: #5c564c;
  --line: #141414;
  --line-soft: #d8d2c4;
  --accent: #c62f1f;
  --accent-bright: #d9291c;
  --accent-on: #ffffff;
  --black: #0d0d0d;
  --cream: #f4f1ea;
  --cream-muted: #b9b2a4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic",
    "Noto Sans JP", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.75;
  font-size: 16px;
}

/* ---------- site header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--black);
  border-bottom: 1px solid #2a2a2a;
}
.site-header-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: inline-flex; line-height: 0; }
.brand img { height: 30px; width: auto; display: block; }
.site-nav { display: flex; gap: 1.4rem; flex-shrink: 0; }
.site-nav a {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--accent-bright); }

.section-intro { color: var(--muted); margin: -0.5rem 0 1.25rem; max-width: 40em; }
/* フォームのあるページは、固定表示のチャット起動ボタンに末尾が隠れないよう下余白を取る */
main.bottom-pad { padding-bottom: 6.5rem; }
.back-link { margin: 0 0 2.5rem; }
.back-link a { color: var(--accent); font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 1px; }
.back-link a:hover { background: var(--accent); color: var(--accent-on); }

/* ---------- hero ---------- */
.hero {
  background: var(--black);
  color: var(--cream);
  padding: 3.5rem 1.25rem 3rem;
}
.hero-inner { max-width: 880px; margin: 0 auto; }
.hero-title .keep { display: inline-block; white-space: nowrap; }
.hero-title {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.01em;
}
/* 2カラム時は見出しを少し小さくし、「を、」だけの行ができないようにする（基本ルールより後ろに置くこと） */
@media (min-width: 760px) {
  .hero-title { font-size: clamp(1.9rem, 3.4vw, 2.5rem); }
}
/* ヒーローの行動ボタン */
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; animation: fade-up 0.7s ease 0.48s both; }
.hero-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.25rem;
  font-weight: 700;
  text-decoration: none;
}
.hero-actions .btn-main { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.hero-actions .btn-main:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.hero-actions .btn-sub { background: transparent; border: 1px solid var(--cream); color: var(--cream); }
.hero-actions .btn-sub:hover { background: rgba(244, 241, 234, 0.12); }
@media (max-width: 640px) {
  .hero-actions { flex-direction: column; }
  .hero-actions a { width: 100%; }
}
.hero-sub { margin: 0 0 0.75rem; font-size: 1.05rem; max-width: 34em; }
.hero-meta { margin: 0; color: var(--cream-muted); font-size: 0.9rem; max-width: 34em; }
.hero-meta::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  background: var(--accent-bright);
  margin-right: 0.55em;
}

/* ---------- layout / sections ---------- */
main { max-width: 880px; margin: 0 auto; padding: 0 1.25rem; }
section { padding: 3rem 0 0.5rem; }

h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--line);
  letter-spacing: 0.01em;
}
h2::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--accent-bright);
  margin-right: 0.5em;
}
h3 { font-size: 1.1rem; font-weight: 700; }

/* ---------- works cards ---------- */
.cards { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
@media (min-width: 640px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .card:nth-child(odd) { border-right: 1px solid var(--line-soft); padding-right: 1.25rem; }
  .card:nth-child(even) { padding-left: 1.25rem; }
  /* 奇数枚のときは最後の1枚を横幅いっぱいにして、右半分の空きを作らない */
  .card:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: none; padding-right: 0; }
}
.card { padding: 1.25rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.card-thumb { display: block; width: 110px; height: auto; margin: 0 0 0.75rem; }
.card-example {
  border: 1px solid var(--line-soft);
  padding: 0.7rem 0.85rem;
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}
.card-example p { margin: 0 0 0.4rem; font-size: 0.85rem; }
.card-example p:last-child { margin-bottom: 0; }
.card-example .ex-label {
  display: inline-block;
  font-weight: 700;
  color: var(--accent);
  margin-right: 0.5em;
}
.card h3 { margin: 0 0 0.4rem; }
.card p { margin: 0 0 0.6rem; font-size: 0.95rem; }
.card a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 1px;
}
.card a:hover { background: var(--accent); color: var(--accent-on); }
.pending {
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px solid var(--line-soft);
  padding: 0.1rem 0.5rem;
  display: inline-block;
}

/* ---------- tool ---------- */
.tool-desc { max-width: 40em; }
.tool-note { color: var(--muted); font-size: 0.88rem; max-width: 40em; }
label { display: block; font-weight: 700; margin: 1.25rem 0 0.4rem; font-size: 0.95rem; }
textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  align-items: center;
  margin: 1rem 0 0.25rem;
}
.options label { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 400; margin: 0; }
.options input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent-bright); }
.options select {
  font: inherit;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0 0.5rem; }
button {
  font: inherit;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
button:hover { background: var(--ink); color: var(--paper); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
/* 「サンプルで試す」は初めての人の最初の一歩なので、通常ボタンより目立たせる */
#btn-sample { border-color: var(--accent); color: var(--accent); font-weight: 700; }
#btn-sample:hover { background: var(--accent); color: var(--accent-on); }
button.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stats { color: var(--muted); font-size: 0.88rem; min-height: 1.2em; margin: 0.35rem 0 0; }

/* ---------- CTA ---------- */
.cta {
  margin: 2.5rem 0 3rem;
  background: var(--black);
  color: var(--cream);
  padding: 1.75rem 1.5rem;
}
.cta h3 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.cta h3::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  background: var(--accent-bright);
  margin-right: 0.55em;
}
.cta p { margin: 0 0 0.75rem; max-width: 38em; }
.cta .pending { color: var(--cream-muted); border-color: #3a3a3a; }

/* ---------- footer ---------- */
.site-footer {
  background: var(--black);
  color: var(--cream-muted);
  padding: 2.5rem 1.25rem 3rem;
  margin-top: 1rem;
  font-size: 0.88rem;
}
.site-footer-inner { max-width: 880px; margin: 0 auto; }
.footer-logo { display: block; width: 200px; height: auto; margin-bottom: 1rem; }

/* ---------- dark mode ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f0ece2;
    --paper: #131311;
    --surface: #1d1d1a;
    --muted: #a39c8d;
    --line: #e8e2d2;
    --line-soft: #3a382f;
    --accent: #ff7a6b;
  }
  button:hover { color: #131311; }
  button.primary { background: #c62f1f; border-color: #c62f1f; color: #fff; }
  button.primary:hover { background: #f0ece2; border-color: #f0ece2; color: #131311; }
  .card a:hover { color: #131311; }
  #btn-sample:hover { color: #131311; }
  /* ダークではページ背景と同化しないよう、CTAを一段明るく＋枠線で区切る */
  .cta { background: #1e1c19; border: 1px solid #3d3a33; }
}

/* ---------- motion ---------- */
html { scroll-behavior: smooth; }

.scroll-progress {
  position: absolute;
  left: 0; bottom: -1px;
  width: 100%; height: 2px;
  background: var(--accent-bright);
  transform: scaleX(0);
  transform-origin: left;
}
.site-header { position: sticky; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.hero-title { animation: fade-up 0.7s ease both; }
.hero-sub { animation: fade-up 0.7s ease 0.24s both; }
.hero-meta { animation: fade-up 0.7s ease 0.36s both; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

.card { transition: background 0.25s ease; }
.card:hover { background: rgba(217, 41, 28, 0.05); }
.card a { transition: background 0.2s ease, color 0.2s ease; }
button { transition: background 0.2s ease, color 0.2s ease, transform 0.08s ease; }
button:active { transform: scale(0.97); }

@keyframes flash-outline {
  0% { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
  100% { outline: 2px solid transparent; outline-offset: 1px; }
}
textarea.flash { animation: flash-outline 0.9s ease; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- croco spot (hero) ---------- */
@media (min-width: 760px) {
  .hero-inner { display: flex; align-items: center; gap: 2.5rem; }
  .hero-text { flex: 1 1 auto; min-width: 0; }
}
.croco-spot {
  margin: 2rem 0 0;
  text-align: center;
  flex: 0 0 auto;
}
@media (min-width: 760px) { .croco-spot { margin: 0; } }
.croco-spot img {
  width: min(240px, 62vw);
  height: min(300px, 78vw);
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
  animation: fade-up 0.7s ease 0.2s both, croco-bob 3.2s ease-in-out 1s infinite;
}
.croco-spot figcaption {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--cream-muted);
  letter-spacing: 0.08em;
}
@keyframes croco-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
@media (prefers-reduced-motion: reduce) {
  .croco-spot img { animation: none; }
}

/* ハニーポット欄は人間に見せない（画面外に置く） */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- request form ---------- */
#request-form input[type="text"], #request-form select {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
}
#request-form input[type="text"]:focus, #request-form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- chat の位置・大きさの設定（初期値。画面上でドラッグしても変えられ、そちらがブラウザに保存される） ----------
   左右を入れ替えたいときは、--chat-right と --chat-left の値を入れ替える（片方は auto のまま）。 */
:root {
  --chat-right: 0.9rem;                    /* 右端からの距離 */
  --chat-left: auto;                       /* 左端からの距離 */
  --chat-bottom: 0.7rem;                   /* 下端からの距離（起動ボタン） */
  --chat-launcher-size: 52px;              /* 起動ボタンのクロコ君の幅 */
  --chat-panel-width: min(92vw, 360px);    /* チャット画面の幅 */
  --chat-panel-height: min(62vh, 520px);   /* チャット画面の高さ */
  --chat-panel-bottom: 6.9rem;             /* チャット画面の下端（起動ボタンの上に来る値） */
}

/* ---------- chat ---------- */
.chat-launcher {
  position: fixed;
  right: var(--chat-right); left: var(--chat-left); bottom: var(--chat-bottom);
  z-index: 40;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  cursor: pointer;
}
.chat-launcher:hover { background: transparent; }
.chat-launcher.is-hidden { display: none; }
.chat-launcher img {
  width: var(--chat-launcher-size);
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}
.chat-launcher-label {
  background: var(--black);
  color: var(--cream);
  border: 1px solid var(--cream);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.14rem 0.55rem;
  letter-spacing: 0.05em;
}
.chat-launcher:hover .chat-launcher-label { background: var(--accent-bright); border-color: var(--accent-bright); color: #fff; }
.chat-head-img { width: 26px; height: auto; margin-right: 0.5rem; }
.chat-launcher { touch-action: none; cursor: grab; }
.chat-launcher:active { cursor: grabbing; }
.chat-head { justify-content: flex-start; cursor: move; touch-action: none; }
.chat-reset {
  align-self: flex-end;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: underline;
  padding: 0.2rem 0.6rem 0.5rem;
  cursor: pointer;
}
.chat-reset:hover { background: transparent; color: var(--accent); }
.chat-resize {
  position: absolute;
  right: 2px; bottom: 2px;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  touch-action: none;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  opacity: 0.65;
}
.chat-head .chat-close { margin-left: auto; }
.chat-panel {
  position: fixed;
  right: var(--chat-right); left: var(--chat-left); bottom: var(--chat-panel-bottom);
  z-index: 40;
  width: var(--chat-panel-width);
  height: var(--chat-panel-height);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}
.chat-panel[hidden] { display: none; }
.chat-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--black); color: var(--cream);
  padding: 0.55rem 0.9rem;
}
.chat-title { font-weight: 700; font-size: 0.92rem; }
.chat-close {
  background: transparent; border: none; color: var(--cream);
  font-size: 1.2rem; padding: 0 0.3rem; line-height: 1;
}
.chat-close:hover { background: transparent; color: var(--accent-bright); }
.chat-log { flex: 1; overflow-y: auto; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.55rem; }
.chat-row { display: flex; }
.chat-row.user { justify-content: flex-end; }
.chat-bubble {
  max-width: 85%;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.6;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-row.user .chat-bubble { background: var(--black); color: var(--cream); border-color: var(--black); }
.chat-link { color: var(--accent); font-weight: 700; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 0.8rem 0.6rem; }
.chat-chip {
  font-size: 0.8rem; font-weight: 400;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  background: transparent;
}
.chat-chip:hover { background: var(--ink); color: var(--paper); }
.chat-form { display: flex; gap: 0.5rem; padding: 0 0.8rem 0.5rem; }
.chat-input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 0.9rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface); color: var(--ink);
}
.chat-send { padding: 0.5rem 1rem; }
.chat-note { font-size: 0.72rem; color: var(--muted); padding: 0 0.8rem 0.7rem; margin: 0; }

.cta-link {
  color: var(--cream);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid var(--accent-bright);
  padding-bottom: 1px;
}
.cta-link:hover { background: var(--accent-bright); color: #fff; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  /* iOSで入力時に自動ズームしないよう、入力欄は16pxにする */
  textarea, .chat-input, #request-form input[type="text"], #request-form select, .options select {
    font-size: 16px;
  }
}
@media (max-width: 480px) {
  .brand img { height: 24px; }
  .site-nav { gap: 0.7rem; }
  .site-nav a { font-size: 0.8rem; }
  .site-header-inner { padding: 0.55rem 0.9rem; }
  .hero { padding: 2.5rem 1rem 2.25rem; }
  .hero-title { font-size: 1.6rem; }
  main { padding: 0 1rem; }
  section { padding: 2.25rem 0 0.5rem; }
  .cta { padding: 1.4rem 1.1rem; }
  :root { --chat-right: 0.6rem; --chat-panel-bottom: 6.6rem; }
}
