/*
Theme Name: Kurukuru
Theme URI: https://9696.jp/
Description: 視覚支援サービスくるくる（9696.jp）のサービスサイト用テーマ
Version: 1.0.0
Requires at least: 6.3
Requires PHP: 7.4
Text Domain: kurukuru
*/

/* ===== デザイントークン ===== */
:root {
  --c-ink: #231f20;
  --c-sub: #5c5657;
  --c-bg: #ffffff;
  --c-pale: #f7f5f0;
  --c-pill: #efefef;
  --c-control: #6b6566; /* 入力欄の枠（白背景で約5.6:1） */
  /* ブルーナカラー */
  --c-yellow: #ffc80b;
  --c-orange: #f26522;
  --c-blue: #005599;
  --c-green: #247033;
  /* 文字に使う橙はコントラスト確保のため濃いめ */
  --c-orange-text: #b8430c;

  --band: var(--c-yellow); /* 左端の縦帯（JSでセクションごとに切替） */
  --band-w: 12px;

  --font: "Yu Gothic", YuGothic, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  --fs-base: 1.0625rem; /* 17px */
  --fs-h2: clamp(1.75rem, 1.3rem + 1.4vw, 2.25rem);
  --space-sec: clamp(4.5rem, 3rem + 5vw, 8rem);
  --wrap: 1080px;
  --radius: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== ベース ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h, 116px) + 8px); }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.9;
  letter-spacing: 0.04em;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-blue); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 4px solid var(--c-ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 8px var(--c-yellow);
  border-radius: 4px;
}
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link {
  position: fixed; left: 24px; top: -100px; z-index: 100;
  background: var(--c-ink); color: #fff; padding: 0.75em 1.25em;
  border-radius: 8px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* 左端の縦帯（初期は非表示。カスタマイザーで ON にすると body に .has-band が付いて表示） */
.band { display: none; }
.has-band .band {
  display: block;
  position: fixed; inset: 0 auto 0 0; width: var(--band-w); z-index: 40;
  background: var(--band);
  transition: background-color 0.6s var(--ease);
}
.has-band .site { padding-left: var(--band-w); }
.wrap { width: min(100% - 48px, var(--wrap)); margin-inline: auto; }

/* ===== ヘッダー ===== */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #d9d9d9;
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px clamp(16px, 3vw, 40px);
}
.site-branding { margin: 0; line-height: 1; }
.site-branding a { display: inline-block; }
.site-branding img { width: clamp(220px, 28vw, 330px); }
.site-tagline {
  margin: 8px 0 0; font-size: 1rem; color: var(--c-ink); line-height: 1.5; letter-spacing: 0.06em; word-break: auto-phrase;
}

.gnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.gnav a {
  display: block; padding: 0.5em 0.9em; border-radius: 999px;
  color: var(--c-ink); text-decoration: none; font-size: 0.9375rem; font-weight: 700;
  transition: background-color 0.2s;
}
.gnav a:hover { background: var(--c-pill); }
.gnav a[aria-current="true"] { background: var(--c-ink); color: #fff; }

.menu-toggle {
  display: none; width: 52px; height: 52px; border: 0; background: none; cursor: pointer;
  position: relative; color: var(--c-ink);
}
.menu-toggle__bar, .menu-toggle__bar::before, .menu-toggle__bar::after {
  position: absolute; left: 13px; width: 26px; height: 2px; background: currentColor;
  content: ""; transition: transform 0.3s var(--ease), opacity 0.2s;
}
.menu-toggle__bar { top: 25px; }
.menu-toggle__bar::before { left: 0; top: -8px; }
.menu-toggle__bar::after { left: 0; top: 8px; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar::before { transform: translateY(8px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar::after { transform: translateY(-8px) rotate(-45deg); }

/* ===== FV ===== */
.fv {
  position: relative; overflow: hidden;
  padding-block: clamp(2.5rem, 5vw, 4.5rem) clamp(3rem, 6vw, 5rem);
  background:
    radial-gradient(circle, var(--c-yellow) 0 5px, transparent 6px) 0 0 / 120px 120px,
    radial-gradient(circle, rgba(0, 85, 153, 0.18) 0 4px, transparent 5px) 60px 60px / 120px 120px,
    var(--c-bg);
}
.fv::after { /* 中央を白抜きして装飾ドットを周囲だけに見せる */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 38% 48% at 50% 52%, #fff 70%, rgba(255, 255, 255, 0) 100%);
}
.fv__figure { position: relative; z-index: 1; margin: 0 auto; width: min(78vw, 440px); }
.fv__figure img { animation: fv-in 1.2s var(--ease) both; }
@keyframes fv-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* ===== 事業所紹介（FV直下） ===== */
.intro {
  padding-block: clamp(3.5rem, 7vw, 6rem);
  background: var(--c-pale);
  border-top: 6px solid var(--c-yellow);
  text-align: center;
}
.intro__inner { max-width: 46rem; }
.intro__lead {
  margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
  font-size: clamp(1.5rem, 1.05rem + 2.2vw, 2.375rem);
  font-weight: 800; line-height: 1.5; letter-spacing: 0.04em;
  word-break: auto-phrase; /* 対応ブラウザでは文節で改行 */
}
.intro__topic { margin: 0 0 clamp(1.5rem, 3vw, 2.25rem); }
.intro__topic a { /* 講座の告知：黄色の帯ボタン（文字は墨色でコントラスト確保） */
  display: inline-flex; align-items: center; gap: 0.9em;
  padding: 0.75em 1.5em; border-radius: 999px;
  background: var(--c-yellow); color: var(--c-ink); text-decoration: none;
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.125rem); font-weight: 800; line-height: 1.6;
  box-shadow: 0 4px 0 var(--c-ink);
  word-break: auto-phrase;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.intro__topic a:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--c-ink); }
.intro__topic a:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--c-ink); }
.intro__topic-arrow {
  flex: none; width: 8px; height: 8px; border-top: 2px solid; border-right: 2px solid; transform: rotate(45deg);
}
.intro__text {
  margin: 0 0 0.6em;
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  font-weight: 700; line-height: 1.85;
  word-break: auto-phrase;
}
.intro__mark { /* 黄色マーカー（文字は墨色のままでコントラスト確保） */
  background: linear-gradient(transparent 55%, var(--c-yellow) 55%);
  color: inherit; padding-inline: 0.1em;
}
.intro__note {
  display: inline-block; margin: clamp(1.5rem, 3vw, 2rem) 0 0;
  padding: 1.1em 1.6em; border: 2px solid var(--c-blue); border-radius: 16px;
  background: #fff; color: var(--c-ink);
  font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.25rem); font-weight: 700; line-height: 1.8;
  box-shadow: 0 5px 0 var(--c-blue);
  word-break: auto-phrase;
}

/* ===== セクション共通 ===== */
.section { padding-block: var(--space-sec); border-top: 1px solid var(--line, #e6e6e6); }
.section--blue { --accent: var(--c-blue); --line: rgba(0, 85, 153, 0.2); }
.section--orange { --accent: var(--c-orange); --accent-text: var(--c-orange-text); --line: rgba(242, 101, 34, 0.2); }
.section--green { --accent: var(--c-green); --line: rgba(36, 112, 51, 0.2); }
.section--yellow { --accent: var(--c-yellow); --accent-text: var(--c-ink); --line: rgba(255, 200, 11, 0.5); }

.section__grid {
  display: grid; grid-template-columns: minmax(300px, 1fr) 2fr; gap: clamp(2rem, 5vw, 5rem);
}
.section__head { position: relative; }
.section__en {
  display: block; margin-bottom: 0.5rem;
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-text, var(--accent));
}
.section__title {
  margin: 0; font-size: var(--fs-h2); line-height: 1.35; letter-spacing: 0.06em; font-weight: 800;
  word-break: keep-all; overflow-wrap: anywhere; /* 「無料ダウンロー|ド」のような語中改行を防ぐ */
}
.section__title::after {
  content: ""; display: block; width: 48px; height: 6px; margin-top: 1rem;
  border-radius: 3px; background: var(--accent);
}
.section__sub { margin: 1.25rem 0 0; color: var(--c-sub); font-size: 0.9375rem; font-weight: 700; line-height: 1.7; }
.section__lead { margin: 1.5rem 0 0; color: var(--c-sub); font-size: 0.9375rem; }
.section__body { border-left: 1px solid var(--line); padding-left: clamp(1.5rem, 4vw, 3.5rem); min-width: 0; }

/* 準備中表示 */
.coming {
  margin: 0; padding: 2.5rem 2rem; border-radius: var(--radius);
  background: var(--c-pale); text-align: center; font-weight: 700;
}
.coming::before {
  content: ""; display: block; width: 14px; height: 14px; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--accent);
  box-shadow: -26px 0 0 var(--c-yellow), 26px 0 0 var(--c-blue);
}

/* 固定ページから読み込んだ本文（同行援護・くるくる講座・講師派遣・会社情報） */
.section-content { max-width: none; }
.section-content > :first-child { margin-top: 0; }
.section-content h2, .section-content h3 { /* セクション見出しがh2なので、本文の見出しはh3推奨（h2でも同じ見た目） */
  margin: 2.25em 0 0; padding-left: 0.75em; border-left: 6px solid var(--accent);
  font-size: 1.375rem; font-weight: 800; line-height: 1.5;
}
.section-content h4 { margin: 1.75em 0 0; font-size: 1.125rem; font-weight: 800; }
.section-content > h2 + *, .section-content > h3 + *, .section-content > h4 + * { margin-top: 0.75em; }
.section-content ul, .section-content ol { padding-left: 1.5em; }
.section-content li + li { margin-top: 0.4em; }
.section-content li::marker { color: var(--accent-text, var(--accent)); font-weight: 800; }
.section-content img { border-radius: var(--radius); }
.section-content table { width: 100%; border-collapse: collapse; }
.section-content th, .section-content td { padding: 0.8em 1em; border: 1px solid var(--c-control); text-align: left; vertical-align: top; }
.section-content th { background: var(--c-pale); font-weight: 800; }
.section-content .wp-block-table { overflow-x: auto; margin: 0; }
.kurukuru-company td:first-child { width: 7em; background: var(--c-pale); font-weight: 800; white-space: nowrap; }
.section-content .wp-block-button__link {
  background: var(--c-ink); color: #fff; border-radius: 999px; padding: 0.9em 2em; font-weight: 800; text-decoration: none;
}
.section-edit { margin: 1.5rem 0 0; font-size: 0.875rem; }

/* ===== ボタン ===== */
.btn-outline {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 2.5rem;
  min-width: 240px; margin-top: 2rem; padding: 1.1em 1.5em;
  border: 2px solid var(--accent-text, var(--accent, var(--c-ink))); background: #fff; color: var(--c-ink);
  font-weight: 700; text-decoration: none;
  transition: background-color 0.25s, border-color 0.25s;
}
.btn-outline::after {
  content: ""; width: 8px; height: 8px; border-top: 2px solid; border-right: 2px solid;
  transform: rotate(45deg); transition: transform 0.25s var(--ease);
}
.btn-outline:hover { background: var(--c-pale); }
.btn-outline:hover::after { transform: translateX(4px) rotate(45deg); }

/* ===== お知らせ ===== */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { border-bottom: 1px solid var(--line); }
.news-list li:first-child { border-top: 1px solid var(--line); }
.news-item {
  display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 0.5rem 1.25rem;
  padding: 1.4rem 0.5rem; color: var(--c-ink); text-decoration: none;
  transition: background-color 0.2s;
}
a.news-item:hover { background: var(--c-pale); }
a.news-item:hover .news-item__title { text-decoration: underline; }
.news-item__date { font-size: 0.875rem; color: var(--c-sub); font-variant-numeric: tabular-nums; }
.pill {
  display: inline-block; justify-self: start; padding: 0.1em 0.9em; border-radius: 999px;
  background: var(--c-pill); font-size: 0.8125rem; font-weight: 700; color: var(--c-sub); white-space: nowrap;
}
.news-item__title { font-weight: 700; }

/* ===== カード（DL・アプリ） ===== */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.card {
  position: relative; display: flex; align-items: center; gap: 1.5rem;
  padding: 1.5rem 1.75rem; border: 2px solid var(--accent-text, var(--accent)); border-radius: var(--radius);
  background: #fff; color: var(--c-ink); text-decoration: none;
  box-shadow: 0 6px 0 var(--line);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 9px 0 var(--line); }
.card:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--line); }
.card__icon {
  flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: #fff;
}
.section--yellow .card__icon { color: var(--c-ink); }
.card__icon svg { width: 30px; height: 30px; }
.card__text { flex: 1; min-width: 0; }
.card__title { display: block; font-size: 1.125rem; font-weight: 800; line-height: 1.6; }
.card__desc { display: block; margin-top: 0.25rem; font-size: 0.9375rem; line-height: 1.7; }
.card__meta { display: block; margin-top: 0.25rem; font-size: 0.875rem; color: var(--c-sub); }
.card__arrow {
  flex: none; width: 10px; height: 10px; border-top: 2px solid; border-right: 2px solid; transform: rotate(45deg);
}
.card--disabled { background: var(--c-pale); box-shadow: none; }

/* アプリ：説明文とQRコード */
.app-intro { margin-bottom: 1.75rem; }
.app-intro p { margin: 0 0 0.4em; }
.app-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem 2rem; }
.app-row .cards { flex: 1 1 18rem; }
.app-qr { flex: none; margin: 0; text-align: center; }
.app-qr img { display: block; width: 140px; height: 140px; padding: 8px; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; image-rendering: pixelated; }
.app-qr figcaption { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--c-sub); }

/* ===== お問い合わせ（Contact Form 7 整形） ===== */
.contact-note { margin: 0 0 2rem; }
.wpcf7 p { margin: 0 0 1.5rem; }
.wpcf7 label { display: block; font-weight: 700; }
.wpcf7 .required {
  display: inline-block; margin-left: 0.5em; padding: 0 0.6em; border-radius: 4px;
  background: var(--c-orange-text); color: #fff; font-size: 0.75rem; vertical-align: 0.15em;
}
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 input[type="tel"], .wpcf7 textarea, .wpcf7 select {
  width: 100%; margin-top: 0.5rem; padding: 0.9em 1em;
  border: 2px solid var(--c-control); border-radius: 10px; background: #fff;
  font: inherit; color: inherit;
}
.wpcf7 input:focus, .wpcf7 textarea:focus { border-color: var(--c-ink); }
.wpcf7 textarea { min-height: 12em; }
.wpcf7 input[type="submit"] {
  min-width: 240px; padding: 1em 2em; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--c-ink); color: #fff; font: inherit; font-weight: 800; letter-spacing: 0.1em;
  box-shadow: 0 5px 0 var(--c-orange);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.wpcf7 input[type="submit"]:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--c-orange); }
.wpcf7 .wpcf7-not-valid-tip { color: #b3261e; font-weight: 700; }
.wpcf7 form .wpcf7-response-output { margin: 1.5rem 0 0; padding: 1em; border-radius: 10px; }

/* ===== 投稿（一覧・詳細・固定ページ） ===== */
.page-main { padding-block: clamp(3rem, 6vw, 5rem) var(--space-sec); }
.page-title { margin: 0 0 2.5rem; font-size: var(--fs-h2); line-height: 1.4; font-weight: 800; }
.entry-meta { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.entry-content { max-width: 46em; }
.entry-content > * + * { margin-top: 1.5em; }
.pagination { margin-top: 3rem; }
.pagination .nav-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pagination .page-numbers {
  display: grid; place-items: center; min-width: 48px; height: 48px; padding: 0 0.5em;
  border: 2px solid var(--c-control); border-radius: 999px; color: var(--c-ink); text-decoration: none;
}
.pagination .current { background: var(--c-ink); color: #fff; border-color: var(--c-ink); }

/* ===== フッター ===== */
.site-footer { background: var(--c-ink); color: #fff; padding-block: 4rem 2rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 2rem; }
.site-footer__logo { background: #fff; padding: 14px 18px; border-radius: 12px; }
.site-footer__logo img { width: 240px; }
.site-footer small { display: block; margin-top: 3rem; font-size: 0.8125rem; opacity: 0.8; text-align: center; }
.to-top {
  display: inline-flex; align-items: center; gap: 0.75em; color: #fff; font-weight: 700; text-decoration: none;
}
.to-top::before {
  content: ""; width: 8px; height: 8px; border-top: 2px solid; border-left: 2px solid; transform: rotate(45deg) translate(2px, 2px);
}

/* ===== スクロール表示演出 ===== */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
/* main.js が3秒以内に動かなければ演出をやめて全表示（JS読込失敗時の保険） */
.js-timeout:not(.js-ready) .reveal { opacity: 1; transform: none; }

/* ===== レスポンシブ ===== */
@media (max-width: 900px) {
  .gnav { width: 100%; }
  .site-header__inner { flex-wrap: wrap; }
  /* JS有効時のみハンバーガー化（JS無効なら通常のリンク列のまま） */
  .js .site-header__inner { flex-wrap: nowrap; }
  .js .menu-toggle { display: block; }
  .js .gnav {
    width: auto;
    position: absolute; top: 100%; left: 0; right: 0;
    max-height: calc(100dvh - var(--header-h, 88px)); overflow: auto;
    background: #fff; border-bottom: 1px solid #d9d9d9;
    padding: 1rem 24px 2rem;
  }
  .gnav[hidden] { display: none !important; }
  /* JS初期化前に一瞬メニューが開いて見えるのを防ぐ */
  .js:not(.js-ready) .gnav { display: none; }
  /* JSが動かなかった場合は通常のリンク列に戻す */
  .js-timeout:not(.js-ready) .site-header__inner { flex-wrap: wrap; }
  .js-timeout:not(.js-ready) .menu-toggle { display: none; }
  .js-timeout:not(.js-ready) .gnav { display: block; position: static; width: 100%; max-height: none; padding: 0; border: 0; }
  .gnav ul { flex-direction: column; gap: 0; }
  .gnav a { border-radius: 0; padding: 1em 0.5em; border-bottom: 1px solid #eee; font-size: 1.0625rem; }
  .section__grid { grid-template-columns: 1fr; }
  .section__body { border-left: 0; padding-left: 0; }
}
@media (min-width: 901px) {
  .gnav[hidden] { display: block !important; } /* PCでは常に表示 */
}
/* 小さめのPC幅ではナビを詰める */
@media (min-width: 901px) and (max-width: 1180px) {
  .site-header__inner { gap: 16px; }
  .site-branding img { width: 240px; }
  .gnav ul { flex-wrap: nowrap; gap: 2px; }
  .gnav a { padding: 0.5em 0.6em; font-size: 0.875rem; white-space: nowrap; }
}
/* 8項目が1行に収まらない幅（〜1399px）では 4項目×2段に並べる */
@media (min-width: 901px) and (max-width: 1399px) {
  .gnav ul { display: grid; grid-template-columns: repeat(4, auto); gap: 2px 4px; justify-content: end; }
  .gnav a { white-space: nowrap; }
}
/* PC幅（ロゴ330px固定）ではロゴ下の一文をロゴと同じ幅にそろえる（20文字 → 330px ÷ 20） */
@media (min-width: 1181px) {
  .site-tagline { font-size: 16.5px; letter-spacing: 0; white-space: nowrap; }
}
@media (max-width: 560px) {
  .site-header__inner { gap: 8px; }
  .site-branding img { width: min(280px, calc(100vw - 92px)); }
  :root { --band-w: 8px; }
  /* ロゴ下の一文は1行に収める（ロゴ欄の幅 ÷ 20文字強で文字サイズを決め、最大15px） */
  .site-tagline { font-size: min(0.9375rem, calc((100vw - 92px) / 20.5)); letter-spacing: 0; }
  .news-item { grid-template-columns: auto 1fr; }
  .news-item__title { grid-column: 1 / -1; }
  .card { padding: 1.25rem; gap: 1rem; }
  .card__icon { width: 52px; height: 52px; }
  .btn-outline { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
