/* 121 こつぶ電子 — K02 雑誌の格子（可愛い系・青）
   大小の枠を12列の格子に組む。枠ごとに色の面（.is-*）が同じ名前の変数を全部上書きする。
   色と書体は共通の13変数だけ。動きは「tiny!」の中の写真が流れる1つだけ */
:root {
  --c-bg: #f3f8ff;
  --c-bg-alt: #ffffff;
  --c-text: #374151;
  --c-sub: #4b5563;
  --c-line: #1d3557;
  --c-accent: #1f66d1;
  --c-accent-text: #1f5fa8;
  --c-on-accent: #ffffff;
  --c-2: #9fd0ff;
  --c-3: #ffd84d;
  --font-ja: "M PLUS Rounded 1c", sans-serif;
  --font-head: "Kiwi Maru", "M PLUS Rounded 1c", serif;
  --font-en: "Nunito", "M PLUS Rounded 1c", sans-serif;
  --radius: 28px;
  --gap: 16px;
  --header-h: 64px;
}
/* 枠の色の面。5つの変数を全部そろえて上書きする */
.is-white  { --c-bg: #ffffff; --c-bg-alt: #e3f1ff; --c-text: #374151; --c-sub: #4b5563; --c-line: #1d3557; --c-accent-text: #1f5fa8; }
.is-pale   { --c-bg: #e3f1ff; --c-bg-alt: #ffffff; --c-text: #374151; --c-sub: #4b5563; --c-line: #1d3557; --c-accent-text: #1f5fa8; }
.is-sky    { --c-bg: #9fd0ff; --c-bg-alt: #ffffff; --c-text: #1d2a3d; --c-sub: #2b3a50; --c-line: #1d3557; --c-accent-text: #123f7a; }
.is-yellow { --c-bg: #ffd84d; --c-bg-alt: #ffffff; --c-text: #2a2f3a; --c-sub: #3a4150; --c-line: #1d3557; --c-accent-text: #1d3557; }
.is-blue   { --c-bg: #1f66d1; --c-bg-alt: #e3f1ff; --c-text: #ffffff; --c-sub: #e3f1ff; --c-line: #ffffff; --c-accent: #ffd84d; --c-accent-text: #ffd84d; --c-on-accent: #1d3557; }
.is-navy   { --c-bg: #1d3557; --c-bg-alt: #2c5088; --c-text: #ffffff; --c-sub: #d6e6fa; --c-line: #9fd0ff; --c-accent: #ffd84d; --c-accent-text: #ffd84d; --c-on-accent: #1d3557; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font-family: var(--font-ja); font-size: 16px; line-height: 1.85; overflow-x: hidden; }
figure { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, dd, li { word-break: auto-phrase; overflow-wrap: anywhere; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ul, ol { padding: 0; list-style: none; }
.fz { font-family: var(--font-ja); }

/* イラストの色（枠の色の面に合わせて変わる） */
.st { stroke: var(--c-line); }
.fk { fill: var(--c-line); }
.fs { fill: var(--c-2); }
.fy { fill: var(--c-3); }
.fw { fill: var(--c-bg-alt); }

/* ===== ヘッダー ===== */
.header { position: sticky; top: 0; z-index: 30; background: var(--c-bg); color: var(--c-text); border-bottom: 2px solid var(--c-line); }
.header__inner { height: var(--header-h); padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; }
.logo { min-height: 44px; display: flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; flex: none; font-family: var(--font-head); font-size: 20px; color: var(--c-line); }
.logo__chip { width: 44px; height: 33px; flex: none; }
.gnav { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 24px; background: var(--c-accent); color: var(--c-on-accent); border: 2px solid var(--c-line); border-radius: 999px; box-shadow: 0 4px 0 var(--c-line); font-weight: 700; text-decoration: none; white-space: nowrap; flex: none; }
.btn--lg { min-height: 56px; padding: 0 32px; font-size: 17px; }
.btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--c-line); }
.header__btn { display: none; }
.spmenu { flex: none; }
.spmenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.spmenu summary::-webkit-details-marker { display: none; }
.spmenu__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spmenu__bar, .spmenu__bar::before, .spmenu__bar::after { display: block; width: 24px; height: 3px; border-radius: 2px; background: currentColor; position: relative; }
.spmenu__bar::before, .spmenu__bar::after { content: ""; position: absolute; left: 0; }
.spmenu__bar::before { top: -8px; } .spmenu__bar::after { top: 8px; }
.spmenu[open] .spmenu__bar { background: transparent; }
.spmenu[open] .spmenu__bar::before { top: 0; transform: rotate(45deg); }
.spmenu[open] .spmenu__bar::after { top: 0; transform: rotate(-45deg); }
.spmenu__nav { position: absolute; right: 12px; top: 100%; width: min(calc(100% - 24px), 380px); background: var(--c-bg-alt); border: 2px solid var(--c-line); border-radius: 20px; padding: 6px 22px 14px; display: flex; flex-direction: column; box-shadow: 0 6px 0 var(--c-line); }
.spmenu__nav a { display: flex; align-items: center; min-height: 52px; text-decoration: none; font-weight: 700; border-bottom: 2px dotted var(--c-line); }
.spmenu__nav a:last-child { border-bottom: 0; }

/* ===== 格子 ===== */
.mag { display: grid; grid-template-columns: 1fr; gap: var(--gap); padding: var(--gap); max-width: 1600px; margin: 0 auto; }
.fr { grid-column: 1 / -1; min-width: 0; position: relative; background: var(--c-bg); color: var(--c-text); border: 2px solid var(--c-line); border-radius: var(--radius); padding: 28px 24px; overflow: hidden; }
.fr p + p, .fr p + .nums { margin-top: 12px; }
.en { font-family: var(--font-en); font-weight: 800; font-size: 16px; letter-spacing: .06em; color: var(--c-accent-text); margin-bottom: 8px; }
.title { font-family: var(--font-head); font-weight: 500; font-size: clamp(28px, 7.6vw, 40px); line-height: 1.35; color: var(--c-line); margin-bottom: 14px; }
.fr h3 { font-family: var(--font-head); font-weight: 500; font-size: 20px; line-height: 1.45; color: var(--c-line); margin-bottom: 6px; }
.fr p { color: var(--c-sub); }
.is-white p, .is-pale p { color: var(--c-sub); }
.fr--head { background: none; border: 0; padding: 20px 4px 0; border-radius: 0; font-family: var(--font-head); font-weight: 500; font-size: clamp(26px, 7vw, 36px); line-height: 1.35; color: var(--c-line); overflow: visible; }
.fr--head::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--c-accent); margin-right: 10px; vertical-align: middle; }

/* 波の縁（F03） */
.wave { position: absolute; left: 0; width: 100%; height: 36px; pointer-events: none; }
.wave path { fill: var(--c-bg-alt); }
.wave--bottom { bottom: -1px; }
.wave--top { top: -1px; }

/* ===== メインビジュアル ===== */
.fr--hero { padding: 0; }
.hero__photo { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 78% 50%; }
.hero__copy { padding: 22px 24px 40px; background: var(--c-bg); }
.fr--hero h1 { font-family: var(--font-head); font-weight: 500; font-size: clamp(34px, 9.6vw, 56px); line-height: 1.3; color: var(--c-line); margin: 4px 0 14px; }
.hero__lead { margin-bottom: 22px; color: var(--c-text); }
.fr--hero .wave { display: none; }

/* ===== 点の枠 ===== */
.big { font-family: var(--font-en); font-weight: 900; line-height: 1; margin-bottom: 8px; color: var(--c-line); }
.big b { font-size: clamp(72px, 14vw, 120px); font-weight: 900; }
.big .fz { font-size: .7em; }
.big small { font-family: var(--font-head); font-size: 24px; margin-left: 6px; font-weight: 500; }
.fr--p1 p.big, .fr--p2 p.big, .fr--p3 p.big { color: var(--c-line); }

/* ===== tiny!（E01）===== */
.fr--tiny { display: grid; place-items: center; padding: 8px 12px; min-height: 220px; --flow: .5; }
.tiny__word { font-family: var(--font-en); font-weight: 900; font-size: min(36vw, 280px); line-height: 1.05; letter-spacing: -.02em; color: var(--c-accent-text); margin: 0; text-align: center; background: url(images/film.webp) calc(var(--flow) * 100%) 50% / 260% auto no-repeat; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .tiny__word { -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
}

/* ===== 部品 ===== */
.fr--partshead p { color: var(--c-sub); }
.part__icon { width: 100%; max-width: 170px; height: auto; margin-bottom: 10px; }
.fr--chip, .fr--cap, .fr--led, .fr--conn, .fr--sensor { display: grid; grid-template-columns: 110px 1fr; column-gap: 16px; align-items: center; }
.fr--chip .part__icon, .fr--cap .part__icon, .fr--led .part__icon, .fr--conn .part__icon, .fr--sensor .part__icon { grid-row: 1 / 3; margin: 0; }
.fr--chip p, .fr--cap p, .fr--led p, .fr--conn p, .fr--sensor p { margin-top: 0; }

/* ===== 工場 ===== */
.fr--factphoto { padding: 0; min-height: 240px; }
.fr--factphoto img { width: 100%; height: 100%; min-height: 240px; object-fit: cover; }
.nums { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
.nums div { background: var(--c-bg-alt); border: 2px solid var(--c-line); border-radius: 20px; padding: 12px 10px; text-align: center; }
.nums div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: left; }
.nums dt { font-size: 15px; color: var(--c-sub); font-weight: 700; }
.nums dd { color: var(--c-line); }
.nums b { font-family: var(--font-en); font-weight: 900; font-size: 30px; line-height: 1.2; }
.nums small { font-size: 15px; }

/* ===== 使われている所 ===== */
.fr--use1 { padding: 0; min-height: 260px; }
.fr--use1 img { width: 100%; height: 100%; min-height: 260px; object-fit: cover; }
.use__cap { position: absolute; left: 14px; right: 14px; bottom: 14px; background: var(--c-bg); border: 2px solid var(--c-line); border-radius: 20px; padding: 12px 18px; }
.use__cap h3 { color: var(--c-text); }
.fr--use1 .use__cap p { color: var(--c-sub); }

/* ===== 流れ ===== */
.no { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--c-line); color: var(--c-bg); font-family: var(--font-en); font-weight: 900; font-size: 28px; margin-bottom: 12px; }

/* ===== 相談 ===== */
.fr--contact { padding: 64px 24px 40px; display: grid; gap: 20px; }
.contact__chip { width: 120px; height: 90px; }
.contact__body .btn { margin: 22px 0 0; white-space: normal; text-align: center; }
.contact__tel { margin-top: 18px; }
.contact__tel a { font-family: var(--font-en); font-weight: 800; font-size: 18px; }
.fr--contact p { color: var(--c-sub); }

/* 写真の枠は余白なし（PCの .fr の余白より強く） */
.mag .fr--hero, .mag .fr--factphoto, .mag .fr--use1 { padding: 0; }

/* ===== フッター ===== */
.footer { padding: 28px 20px 36px; text-align: center; color: var(--c-text); }
.footer__logo { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-head); font-size: 18px; color: var(--c-line); }
.footer p { color: var(--c-sub); }
.footer__fiction { margin-top: 6px; }

/* ===== タブレット（6列） ===== */
@media (min-width: 768px) {
  .nums { grid-template-columns: repeat(3, 1fr); }
  .nums div { display: block; text-align: center; }
  .header__inner { padding: 0 32px; }
  .header__btn { display: inline-flex; }
  .mag { grid-template-columns: repeat(6, 1fr); padding: 24px; --gap: 20px; }
  .fr--p1, .fr--p2, .fr--chip, .fr--cap, .fr--led, .fr--conn, .fr--use2, .fr--use3, .fr--s1, .fr--s2, .fr--s3, .fr--s4 { grid-column: span 3; }
  .fr--p3 { grid-column: 1 / -1; }
  .fr--chip, .fr--cap, .fr--led, .fr--conn, .fr--sensor { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
  .fr--sensor { grid-column: 1 / -1; }
  .part__icon { max-width: 200px; margin: 0 0 14px !important; }
  .fr--hero { display: grid; min-height: 520px; }
  .hero__photo { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
  .hero__copy { position: relative; align-self: end; margin: 24px; max-width: 560px; border: 2px solid var(--c-line); border-radius: 24px; padding: 24px 28px 28px; background: var(--c-bg-alt); }
  .hero__copy .en { color: var(--c-accent-text); }
  .fr--hero .wave { display: none; }
}

/* ===== PC（12列の雑誌の格子） ===== */
@media (min-width: 1080px) {
  .gnav { display: flex; gap: 4px; margin-left: auto; margin-right: 16px; }
  .gnav a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; text-decoration: none; font-weight: 700; }
  .gnav a:hover { background: var(--c-bg-alt); }
  .spmenu { display: none; }
  .mag { grid-template-columns: repeat(12, 1fr); grid-auto-rows: minmax(84px, auto); padding: 28px 32px 36px; --gap: 18px; }
  .fr { padding: 32px 32px; }
  /* grid-area: 開始行 / 開始列 / 終了行 / 終了列 */
  .fr--hero  { grid-area: 1 / 1 / 7 / 13; min-height: 0; }
  .fr--about { grid-area: 7 / 1 / 11 / 6; }
  .fr--p1    { grid-area: 7 / 6 / 9 / 9; }
  .fr--p2    { grid-area: 7 / 9 / 9 / 13; }
  .fr--p3    { grid-area: 9 / 6 / 11 / 13; }
  .fr--tiny  { grid-area: 11 / 1 / 16 / 9; }
  .fr--tinytext { grid-area: 11 / 9 / 16 / 13; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
  .fr--partshead { grid-area: 16 / 1 / 19 / 5; display: flex; flex-direction: column; justify-content: center; }
  .fr--chip  { grid-area: 16 / 5 / 19 / 9; }
  .fr--cap   { grid-area: 16 / 9 / 19 / 13; }
  .fr--led   { grid-area: 19 / 1 / 22 / 5; }
  .fr--conn  { grid-area: 19 / 5 / 22 / 9; }
  .fr--sensor{ grid-area: 19 / 9 / 22 / 13; }
  .fr--factphoto { grid-area: 22 / 1 / 27 / 7; }
  .fr--facttext  { grid-area: 22 / 7 / 27 / 13; display: flex; flex-direction: column; justify-content: center; }
  .fr--usehead   { grid-area: 27 / 1 / 28 / 13; }
  .fr--use1  { grid-area: 28 / 1 / 32 / 7; }
  .fr--use2  { grid-area: 28 / 7 / 30 / 13; }
  .fr--use3  { grid-area: 30 / 7 / 32 / 13; }
  .fr--flowhead { grid-area: 32 / 1 / 33 / 13; }
  .fr--s1 { grid-area: 33 / 1 / 36 / 4; } .fr--s2 { grid-area: 33 / 4 / 36 / 7; } .fr--s3 { grid-area: 33 / 7 / 36 / 10; } .fr--s4 { grid-area: 33 / 10 / 36 / 13; }
  .fr--contact { grid-area: 36 / 1 / 40 / 13; grid-template-columns: 200px 1fr; align-items: center; column-gap: 40px; padding: 72px 56px 48px; }
  .contact__chip { width: 200px; height: 150px; }

  .fr--hero .hero__copy { position: absolute; left: 36px; top: 36px; bottom: 56px; width: min(46%, 560px); margin: 0; padding: 32px 36px; align-self: auto; display: flex; flex-direction: column; justify-content: center; background: color-mix(in srgb, var(--c-bg-alt) 92%, transparent); }
  .fr--hero h1 { font-size: clamp(44px, 4.2vw, 64px); }
  .hero__lead { font-size: 17px; }
  .fr--hero .wave { display: block; height: 44px; }
  .fr--factphoto .wave { display: block; }
  .title { font-size: clamp(30px, 2.8vw, 42px); }
  .fr--about .title { font-size: clamp(34px, 3.4vw, 52px); }
  .fr--tiny { min-height: 0; }
  .fr--use2, .fr--use3 { display: flex; flex-direction: column; justify-content: center; }
  .fr--p1, .fr--p2, .fr--p3 { display: flex; flex-direction: column; justify-content: center; }
  .fr--p3 { flex-direction: column; }
  .fr--about { display: flex; flex-direction: column; justify-content: center; }
  .fr--head { font-size: clamp(30px, 2.6vw, 40px); padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
}
