/* Kaigara Works：深い海へ降りていくページ。パールの白 → 海の透明な緑 → 夜の海。
   動きは CSS だけ（スクリプトなし）。「動きを減らす」設定のときは止まり、完成した姿を見せる。 */

:root {
  --bg: #f1f5f4;
  --fg: #10252d;
  --muted: #4d6670;
  --line: rgba(16, 37, 45, 0.16);
  --accent: #17606b;

  --glass: #dcebea;
  --deep: #0e2630;

  --rose: #e0689d;
  --violet: #7b6ee0;
  --teal: #22a6a0;

  --serif-jp: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "BIZ UDPMincho", "Noto Serif JP", "Noto Serif CJK JP", "Source Han Serif JP", serif;
  --sans-jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", system-ui, sans-serif;
  --serif-latin: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;

  --gutter: clamp(20px, 5vw, 56px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #091a21;
    --fg: #e6f0ee;
    --muted: #93adb4;
    --line: rgba(230, 240, 238, 0.18);
    --accent: #7fd6cf;

    --glass: #0d2229;
    --deep: #050f14;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans-jp);
  font-size: 16px;
  line-height: 1.9;
}

a { color: var(--accent); }

a:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---- ブランド（全ページ共通） ---- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--serif-latin);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand img { display: block; }

@media (prefers-color-scheme: dark) {
  .brand img { filter: brightness(0) invert(0.93); }
}

/* ---- 法的ページ・404（長い文書） ---- */

.site-header,
main.doc,
.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.site-header { padding-top: 24px; }

/* 404 ページの見出し（トップの .hero.wrap とは別） */
.hero:not(.wrap) { padding: 72px 0 48px; }

.hero h1,
.doc h1,
.doc h2 {
  font-family: var(--serif-jp);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.hero:not(.wrap) h1 { margin: 0 0 20px; font-size: clamp(28px, 6vw, 40px); line-height: 1.4; }

.lead { margin: 0; color: var(--muted); font-size: 17px; }

.doc { padding-top: 48px; padding-bottom: 24px; }

.doc h1 { font-size: clamp(24px, 5vw, 32px); margin: 0 0 16px; line-height: 1.5; }

.doc h2 { font-size: 18px; margin: 32px 0 8px; line-height: 1.6; }

.doc p, .doc li { margin: 0 0 8px; }

.doc ul { padding-left: 1.4em; margin: 0 0 8px; }

.doc .facts { margin-top: 24px; }

.draft {
  margin: 0 0 24px;
  padding: 12px 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
}

.updated { margin-top: 32px; color: var(--muted); font-size: 14px; }

.link-list li { margin-bottom: 4px; }

.mail { font-size: 18px; font-weight: 600; }

.site-footer {
  padding-top: 8px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 13px;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-bottom: 12px;
}

.legal-nav a {
  display: inline-block;
  padding: 4px 0;
  color: var(--muted);
}

.legal-nav a:hover { color: var(--accent); }

.button {
  display: inline-block;
  padding: 10px 22px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

/* 名称・事業・状況（法的ページでも使う定義リスト） */

.facts { margin: 0; }

.facts div {
  display: grid;
  grid-template-columns: 5em 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.facts div:first-child { border-top: 0; padding-top: 0; }

.facts dt { color: var(--muted); }

.facts dd { margin: 0; }

.doc .facts div { grid-template-columns: 11em 1fr; }

/* ---- トップページ ---- */

.masthead {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 26px;
}

.status {
  padding: 1px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  white-space: nowrap;
}

.top .hero {
  display: grid;
  gap: 8px clamp(24px, 5vw, 72px);
  align-items: center;
  padding-top: clamp(24px, 6vw, 56px);
  padding-bottom: clamp(88px, 12vw, 140px);
  /* 回った貝殻の角が横スクロールを作らないように */
  overflow-x: clip;
}

.headline { margin: 0 0 28px; }

.headline span { display: block; }

.top .headline {
  font-size: clamp(26px, 8vw, 34px);
  line-height: 1.4;
  letter-spacing: 0.05em;
}

.top .lead { max-width: 29em; text-wrap: balance; line-break: strict; word-break: auto-phrase; }
.top .headline { word-break: auto-phrase; }

/* 貝殻：このページで一番目立たせるもの。あとは静かに */

.shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  justify-self: center;
}

.shell::before {
  content: "";
  position: absolute;
  inset: -4%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(42% 42% at 28% 34%, rgba(224, 104, 157, 0.34), transparent 72%),
    radial-gradient(46% 46% at 72% 40%, rgba(123, 110, 224, 0.30), transparent 72%),
    radial-gradient(50% 50% at 50% 74%, rgba(34, 166, 160, 0.34), transparent 72%);
  filter: blur(26px);
}

.shell-art { display: block; width: 100%; height: auto; overflow: visible; }

.shell-body { opacity: 1; }

/* 線の絵は、中心から外へたどる「見せ幅」のマスクで少しずつ現れる */

/* 海の深さの帯。上の縁は波 */

.band {
  position: relative;
  background: var(--bg);
  color: var(--fg);
}

.band--glass {
  --bg: var(--glass);
}

.band--deep {
  --bg: var(--deep);
  --fg: #e9f2f0;
  --muted: #9db8be;
  --line: rgba(233, 242, 240, 0.2);
  --accent: #8fe3d4;
}

.wave {
  position: absolute;
  left: 0;
  top: 1px;
  width: 100%;
  height: clamp(28px, 5vw, 64px);
  transform: translateY(-100%);
  fill: var(--bg);
  pointer-events: none;
}

.about,
.contact {
  padding-top: clamp(56px, 9vw, 112px);
  padding-bottom: clamp(64px, 10vw, 128px);
}

.about-grid {
  display: grid;
  gap: 24px clamp(24px, 6vw, 96px);
}

.about h2,
.contact h2 {
  margin: 0;
  font-family: var(--serif-jp);
  font-size: clamp(22px, 3.2vw, 30px);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.about .facts div {
  grid-template-columns: 4.5em 1fr;
  gap: 16px;
  padding: 18px 0;
}

.about .facts div:first-child { padding-top: 0; }

.about .facts dd {
  font-family: var(--serif-jp);
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.8;
}

.contact p { margin: 12px 0 0; color: var(--muted); }

.contact .mail {
  margin: 28px 0 0;
  color: var(--fg);
  font-family: var(--serif-latin);
  font-size: clamp(22px, 6.8vw, 58px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

/* メールの文字の下で、真珠色の線が左から伸びる */

.contact .mail a {
  color: inherit;
  text-decoration: none;
  padding-bottom: 6px;
  background:
    linear-gradient(90deg, var(--rose), var(--violet), var(--teal)) no-repeat 0 100% / 0 3px,
    linear-gradient(var(--muted), var(--muted)) no-repeat 0 100% / 100% 1px;
}

.contact .mail a:hover,
.contact .mail a:focus-visible {
  background-size: 100% 3px, 100% 1px;
}

.colophon {
  padding-top: 8px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 13px;
}

.colophon p { margin: 0; }

/* ---- 広い画面：左に言葉、右に貝殻 ---- */

@media (width >= 880px) {
  .top .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .top .headline { font-size: clamp(30px, 3.3vw, 47px); }
  .about-grid { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); align-items: start; }
}

/* ---- 狭い画面：貝殻を先に見せる ---- */

@media (width < 880px) {
  .shell { order: -1; max-width: min(78vw, 380px); justify-self: start; }
  .top .hero-text { padding-top: 8px; }
}

@media (max-width: 480px) {
  .hero:not(.wrap) { padding: 48px 0 32px; }
  .facts div,
  .doc .facts div { grid-template-columns: 1fr; gap: 0; }
  .about .facts div { grid-template-columns: 1fr; gap: 2px; }
}

/* ---- 動き（動きを減らす設定のときは何も動かさない） ---- */

@media (prefers-reduced-motion: no-preference) {
  /* メールの下の線は、いちど引かれると決まった長さまで伸びる */
  .contact .mail a { transition: background-size 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }

  /* 一度だけの演出：貝殻が自分で描かれ、そのあと言葉が水面に浮かぶ */

  .shell-reveal { animation: draw 3.4s cubic-bezier(0.55, 0, 0.25, 1) 0.2s backwards; }

  .shell-body { animation: pearl-in 1.8s ease-out 2.6s backwards; }

  .shell::before { animation: glow-in 2.4s ease-out 0.6s backwards, drift 48s linear 3s 1; }

  .top .headline span { animation: surface 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
  .top .headline span:nth-child(1) { animation-delay: 0.5s; }
  .top .headline span:nth-child(2) { animation-delay: 0.85s; }
  .top .headline span:nth-child(3) { animation-delay: 1.2s; }

  .top .lead { animation: surface 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) 1.7s backwards; }

  /* ページを下へ読み進めると、貝殻がゆっくり回る（対応するブラウザだけ） */
  @supports (animation-timeline: scroll()) {
    .shell-art {
      animation: turn linear both;
      animation-timeline: scroll(root block);
    }
  }
}

@keyframes draw {
  0%   { stroke-dasharray: 1 1; stroke-dashoffset: 1; opacity: 0; }
  4%   { opacity: 1; }
  100% { stroke-dasharray: 1 1; stroke-dashoffset: 0; opacity: 1; }
}

@keyframes pearl-in { from { opacity: 0; } to { opacity: 1; } }

@keyframes glow-in { from { opacity: 0; } to { opacity: 1; } }

@keyframes drift { to { transform: rotate(360deg); } }

@keyframes surface {
  from { opacity: 0; filter: blur(10px); transform: translateY(0.35em); }
  to   { opacity: 1; filter: blur(0); transform: none; }
}

@keyframes turn { to { transform: rotate(-70deg); } }
