/* =====================================================
   common.css — 学習塾ソートアップ 共通スタイル
   CSS Variables / Reset / Base / Utility / Animations
   ===================================================== */

/* ===== CSS Variables ===== */
:root {
  --primary: #1e3a5f;
  --primary-light: #2a5280;
  --secondary: #4a90d9;
  --secondary-light: #7cb8f0;
  --accent: #f0a050;
  --accent-hover: #e08a30;
  --line: #06c755;
  --bg-white: #fafcff;
  --bg-alt: #f0f5fb;
  --text: #2c3e50;
  --text-light: #4d6578;
  --shadow: 0 4px 24px rgba(30,58,95,.05);
  --shadow-hover: 0 8px 32px rgba(30,58,95,.12);
  --radius: 20px;
  --radius-sm: 12px;
  --radius-full: 9999px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: "Noto Sans JP", "Hiragino Sans", Meiryo, sans-serif;
  color: var(--text);
  line-height: 2.0;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background: var(--bg-white);
  position: relative;
  touch-action: manipulation;
}
[id] {
  scroll-margin-top: 80px;
}
img {
  max-width: 100%;
  height: auto;
}
a {
  transition: color .3s ease;
}

/* ===== Utility ===== */
.inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px;
}
.section-label {
  text-align: center;
  font-family: "Noto Sans JP", sans-serif;
  color: #1e5a9a;
  font-weight: 600;
  font-size: .72em;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.section-title {
  text-align: center;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 1.8em;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 14px;
  line-height: 1.45;
  text-wrap: balance;
}
.section-sub {
  text-align: center;
  color: var(--text-light);
  font-size: .9em;
  margin-bottom: 50px;
  line-height: 1.9;
}

/* ===== Scroll animations ===== */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
.fade-in-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
}
.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}
.fade-in-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
}
.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ===== Hero fade-in override (above the fold) ===== */
.hero .fade-in,
.hero .fade-in-left,
.hero .fade-in-right,
.hero + * .fade-in {
  opacity: 1;
  transform: none;
}

/* ===== Wave dividers ===== */
.wave-divider {
  position: relative;
  overflow: hidden;
  line-height: 0;
  margin-top: -1px;
}
.wave-divider svg {
  display: block;
  width: 100%;
  height: 60px;
}
.wave-divider.flip svg {
  transform: rotate(180deg);
}

@keyframes morphWave1 {
  0%, 100% { d: path("M0,30 C200,10 400,50 600,30 C800,10 1000,50 1200,30 L1200,60 L0,60 Z"); }
  50% { d: path("M0,30 C200,50 400,10 600,30 C800,50 1000,10 1200,30 L1200,60 L0,60 Z"); }
}
@keyframes morphWave2 {
  0%, 100% { d: path("M0,25 C150,45 350,5 600,25 C850,45 1050,5 1200,25 L1200,60 L0,60 Z"); }
  50% { d: path("M0,35 C150,5 350,45 600,35 C850,5 1050,45 1200,35 L1200,60 L0,60 Z"); }
}
@keyframes morphWave3 {
  0%, 100% { d: path("M0,20 C300,40 600,0 900,20 C1050,30 1150,10 1200,20 L1200,60 L0,60 Z"); }
  50% { d: path("M0,40 C300,0 600,40 900,40 C1050,10 1150,30 1200,40 L1200,60 L0,60 Z"); }
}

/* ===== Back to top ===== */
.back-to-top {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(74,144,217,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .3s, visibility .3s, transform .3s, background-color .3s;
  z-index: 100;
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--primary);
  transform: translateY(-3px);
}

/* ===== Mobile Fixed CTA ===== */
.floating-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: #fff;
  box-shadow: 0 -2px 16px rgba(0,0,0,.1);
  padding: 10px 16px;
  display: none;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.floating-inner {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}
.fc-tel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--secondary);
  color: #fff;
  padding: 12px 8px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 700;
  font-size: .82em;
  white-space: nowrap;
}
.fc-line {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--line);
  color: #fff;
  padding: 12px 8px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 700;
  font-size: .82em;
  white-space: nowrap;
}
.fc-trial {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  padding: 12px 8px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 700;
  font-size: .82em;
  white-space: nowrap;
}

/* ===== Accessibility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.sp-only {
  display: none;
}
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  z-index: 9999;
  transition: top .2s;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}
:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===== 404 Error Page ===== */
.error-page {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}
.error-page__inner { max-width: 560px; }
.error-page__code {
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 6em;
  font-weight: 800;
  color: var(--secondary);
  opacity: .18;
  line-height: 1;
  margin-bottom: 0;
}
.error-page h1 {
  font-family: "Zen Maru Gothic", sans-serif;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.5em;
  margin-bottom: 16px;
}
.error-page p {
  font-size: .92em;
  color: var(--text-light);
  line-height: 1.9;
  margin-bottom: 32px;
}
.error-page__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}
.error-page__links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: .88em;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, color .2s;
}
.error-page__links a.primary {
  background: var(--secondary);
  color: #fff;
}
.error-page__links a.secondary {
  background: transparent;
  border: 1px solid rgba(74,144,217,.25);
  color: var(--secondary);
}
.error-page__links a:hover { opacity: .85; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sp-only { display: inline; }
  .floating-cta { display: block; }
  footer { padding-bottom: 80px; }
  .section-title { font-size: 1.45em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto !important; }
  .fade-in, .fade-in-left, .fade-in-right {
    opacity: 1 !important;
    transform: none !important;
  }
}
