/**
 * css/stitch-design-system.css
 * Document No: Phase-STITCH-UI-03-EXEC (Extended for Phase 3)
 * StitchMCP Design System (Komorebi Academic Theme)
 * Strict Prefix Rules: All CSS variables use --stitch-* and classes use .stitch-*
 * 80% Material Base + <20% Controlled Glassmorphism
 */

:root {
  /* === Stitch Primary Design Tokens (正式定義: --stitch-*) === */
  --stitch-color-primary: #1a365d;
  --stitch-color-primary-dark: #002045;
  --stitch-color-primary-light: #e8f0fe;
  --stitch-color-secondary: #006a63;
  --stitch-color-secondary-light: #e0f2f1;
  --stitch-color-accent: #f97316;
  --stitch-color-accent-hover: #ea580c;

  /* --- Surface & Background --- */
  --stitch-color-surface: #f7fafc;
  --stitch-color-surface-card: #ffffff;
  --stitch-color-text-main: #181c1e;   /* WCAG AAA Contrast against white: 15.6:1 */
  --stitch-color-text-sub: #43474e;    /* WCAG AA Contrast against white: 7.2:1 */
  --stitch-color-border: #e0e3e5;

  /* --- Spacing Scale --- */
  --stitch-spacing-base: 4px;
  --stitch-spacing-xs: 8px;
  --stitch-spacing-sm: 16px;
  --stitch-spacing-md: 24px;
  --stitch-spacing-lg: 40px;
  --stitch-spacing-xl: 64px;

  /* --- Border Radius Scale --- */
  --stitch-radius-sm: 4px;
  --stitch-radius-md: 8px;
  --stitch-radius-lg: 16px;
  --stitch-radius-xl: 24px;
  --stitch-radius-full: 9999px;

  /* --- Elevation & Shadows (80% Material Base) --- */
  --stitch-shadow-sm: 0 1px 3px rgba(0, 32, 69, 0.08);
  --stitch-shadow-md: 0 4px 14px rgba(0, 32, 69, 0.10);
  --stitch-shadow-lg: 0 10px 25px rgba(0, 32, 69, 0.14);

  /* --- Controlled Glassmorphism (<20% Area, High Contrast) --- */
  --stitch-glass-bg: rgba(255, 255, 255, 0.92);
  --stitch-glass-border: rgba(255, 255, 255, 0.7);
  --stitch-glass-shadow: 0 8px 32px 0 rgba(0, 32, 69, 0.1);
  --stitch-glass-blur: blur(12px);

  /* --- Typography Scale --- */
  --stitch-font-family: 'Noto Sans JP', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --stitch-font-size-xs: 0.75rem;   /* 12px */
  --stitch-font-size-sm: 0.875rem;  /* 14px */
  --stitch-font-size-base: 1rem;    /* 16px */
  --stitch-font-size-lg: 1.125rem;  /* 18px */
  --stitch-font-size-xl: 1.25rem;   /* 20px */
  --stitch-font-size-2xl: 1.5rem;   /* 24px */
  --stitch-font-size-3xl: 2rem;     /* 32px */
}
/* ===================================================
   Phase-STITCH-UI-EXPAND-01: Component Organized CSS
   =================================================== */

/* ===== Layout Components ===== */
.stitch-section { padding: 72px 0 !important; }
.stitch-section--light { background: #f8fafc !important; }
.stitch-section--white { background: #ffffff !important; }
.stitch-section--teal-tint { background: linear-gradient(180deg, #f0faf6 0%, #ffffff 100%) !important; }
.stitch-section--bordered { border-bottom: 1px solid var(--stitch-color-border) !important; }
@media (max-width: 768px) { .stitch-section { padding: 52px 0 !important; } }

/* ===== Section Header Components ===== */
.stitch-section-header { text-align: center !important; margin-bottom: 40px !important; }
.stitch-section-header h2 { font-size: 1.85rem !important; font-weight: 800 !important; color: var(--stitch-color-text-main) !important; margin: 0 0 10px !important; line-height: 1.35 !important; }
.stitch-section-header p { font-size: 0.95rem !important; color: var(--stitch-color-text-sub) !important; margin: 0 !important; line-height: 1.7 !important; }
@media (max-width: 768px) { .stitch-section-header h2 { font-size: 1.45rem !important; } }

.stitch-badge-pill { display: inline-flex !important; align-items: center !important; padding: 5px 15px !important; border-radius: var(--stitch-radius-full) !important; font-size: 0.78rem !important; font-weight: 800 !important; margin-bottom: 12px !important; letter-spacing: 0.01em !important; }
.stitch-badge-pill--teal { background: rgba(29, 158, 117, 0.1) !important; color: #1D9E75 !important; }
.stitch-badge-pill--blue { background: rgba(59, 130, 246, 0.1) !important; color: #3b82f6 !important; }
.stitch-badge-pill--purple { background: rgba(124, 58, 237, 0.1) !important; color: #7c3aed !important; }
.stitch-badge-pill--green { background: rgba(16, 185, 129, 0.1) !important; color: #10b981 !important; }

/* ===== Card Components ===== */
.stitch-story-card { background: var(--stitch-color-surface-card) !important; border-radius: var(--stitch-radius-lg) !important; border: 1.5px solid var(--stitch-color-border) !important; box-shadow: var(--stitch-shadow-sm) !important; overflow: hidden !important; transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease !important; display: flex !important; flex-direction: column !important; padding: 20px !important; }
.stitch-story-card:hover { transform: translateY(-4px) !important; box-shadow: var(--stitch-shadow-md) !important; border-color: var(--stitch-color-secondary) !important; }

.stitch-feature-card { background: var(--stitch-color-surface) !important; border: 1.5px solid var(--stitch-color-border) !important; border-radius: var(--stitch-radius-lg) !important; padding: 22px 14px !important; text-align: center !important; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important; }
.stitch-feature-card:hover { transform: translateY(-3px) !important; border-color: var(--stitch-color-secondary) !important; box-shadow: 0 6px 20px rgba(0, 106, 99, 0.08) !important; }

.stitch-chart-card { background: var(--stitch-color-surface-card) !important; border-radius: var(--stitch-radius-lg) !important; border: 1px solid var(--stitch-color-border) !important; box-shadow: var(--stitch-shadow-sm) !important; padding: 24px !important; box-sizing: border-box !important; }
.stitch-chart-card--blue-tint { background: #e6f4ff !important; border: 1.5px solid #c4e4ff !important; }

/* ===== Timeline/Step Components ===== */
.stitch-roadmap-step { background: rgba(248, 250, 252, 0.95) !important; border: 1.5px solid var(--stitch-color-border) !important; border-radius: var(--stitch-radius-lg) !important; padding: 24px 16px !important; text-align: center !important; box-shadow: var(--stitch-shadow-sm) !important; transition: transform 0.25s ease, box-shadow 0.25s ease !important; }
.stitch-roadmap-step:hover { transform: translateY(-2px) !important; box-shadow: var(--stitch-shadow-md) !important; }
.stitch-roadmap-step--highlight { border-color: #8b5cf6 !important; background: rgba(245, 243, 255, 0.97) !important; box-shadow: 0 10px 24px rgba(139, 92, 246, 0.12) !important; }

/* ===== Table Components ===== */
.stitch-comparison-wrapper { overflow-x: auto !important; background: var(--stitch-color-surface-card) !important; border-radius: var(--stitch-radius-lg) !important; border: 1px solid var(--stitch-color-border) !important; box-shadow: var(--stitch-shadow-sm) !important; }
.stitch-comparison-table { width: 100% !important; border-collapse: collapse !important; text-align: left !important; min-width: 500px !important; }
.stitch-comparison-table thead tr { background: #f1f5f9 !important; border-bottom: 2px solid var(--stitch-color-border) !important; }
.stitch-comparison-table thead th { padding: 18px !important; font-weight: 800 !important; color: var(--stitch-color-text-main) !important; }
.stitch-comparison-table thead th.stitch-col--highlight { color: #7c3aed !important; background: #f5f3ff !important; }
.stitch-comparison-table tbody tr { border-bottom: 1px solid #f1f5f9 !important; }
.stitch-comparison-table tbody td { padding: 16px !important; color: var(--stitch-color-text-sub) !important; vertical-align: top !important; }
.stitch-comparison-table tbody td.stitch-col--label { font-weight: 800 !important; color: #334155 !important; background: #f8fafc !important; }
.stitch-comparison-table tbody td.stitch-col--highlight { background: #faf5ff !important; font-weight: 700 !important; }

/* ===== Search/Interactive Components ===== */
.stitch-search-panel { max-width: 900px !important; margin: -60px auto 40px !important; background: var(--stitch-color-surface-card) !important; border-radius: var(--stitch-radius-lg) !important; box-shadow: var(--stitch-shadow-lg) !important; position: relative !important; z-index: 10 !important; padding: 32px !important; border: 1.5px solid var(--stitch-color-border) !important; }
.stitch-search-category-card { display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; padding: 20px 10px !important; background: #f8fafc !important; border-radius: var(--stitch-radius-md) !important; text-decoration: none !important; border: 1.5px solid var(--stitch-color-border) !important; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important; color: #334155 !important; }
.stitch-search-category-card:hover { transform: translateY(-3px) !important; box-shadow: 0 6px 16px rgba(0, 106, 99, 0.1) !important; border-color: var(--stitch-color-secondary) !important; }
.stitch-search-category-card:focus-visible { outline: 3px solid var(--stitch-color-secondary) !important; outline-offset: 2px !important; }

.stitch-trust-carousel-card { background: var(--stitch-color-surface-card) !important; border: 1.5px solid var(--stitch-color-border) !important; border-radius: var(--stitch-radius-lg) !important; padding: 16px !important; text-align: center !important; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important; }
.stitch-trust-carousel-card:hover { transform: translateY(-3px) !important; box-shadow: var(--stitch-shadow-md) !important; border-color: var(--stitch-color-secondary) !important; }

.stitch-future-card { background: linear-gradient(135deg, #1d9e75 0%, #085041 100%) !important; color: #ffffff !important; border-radius: var(--stitch-radius-xl) !important; padding: 48px 24px !important; text-align: center !important; box-shadow: var(--stitch-shadow-lg) !important; }



/* --- Accessibility & Focus Ring Enhancements --- */
:focus-visible {
  outline: 3px solid var(--stitch-color-secondary) !important;
  outline-offset: 2px !important;
}

/* --- Stitch Phase 1 & 2 Base Classes --- */

.stitch-header {
  background: var(--stitch-glass-bg) !important;
  backdrop-filter: var(--stitch-glass-blur) !important;
  -webkit-backdrop-filter: var(--stitch-glass-blur) !important;
  border-bottom: 1px solid var(--stitch-color-border) !important;
  box-shadow: var(--stitch-shadow-sm) !important;
  position: sticky;
  top: 0;
  z-index: 100;
}

.stitch-hero-card {
  background: #ffffff !important;
  color: var(--stitch-color-text-main, #1e293b) !important;
  border: 1px solid var(--stitch-color-border, #e2e8f0) !important;
  border-radius: var(--stitch-radius-xl) !important;
  box-shadow: var(--stitch-shadow-lg) !important;
  padding: var(--stitch-spacing-lg) var(--stitch-spacing-md) !important;
  position: relative;
  overflow: hidden;
}

.stitch-hero-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(29, 158, 117, 0.05) 0%, rgba(0,0,0,0) 70%);
  pointer-events: none;
}

.stitch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 24px;
  border-radius: var(--stitch-radius-md);
  font-family: var(--stitch-font-family);
  font-size: var(--stitch-font-size-base);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stitch-btn-accent {
  background: var(--stitch-color-accent) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.35) !important;
}

.stitch-btn-accent:hover {
  background: var(--stitch-color-accent-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 107, 53, 0.45) !important;
}

.stitch-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: var(--stitch-radius-full);
  font-size: var(--stitch-font-size-xs);
  font-weight: 600;
  background: var(--stitch-color-primary-light);
  color: var(--stitch-color-primary);
}

.stitch-badge-teal {
  background: var(--stitch-color-secondary-light) !important;
  color: var(--stitch-color-secondary) !important;
}

.stitch-footer {
  background: var(--stitch-color-primary-dark) !important;
  color: #e2e8f0 !important;
  border-top: 1px solid rgba(255,255,255,0.12) !important;
  padding: var(--stitch-spacing-xl) 0 var(--stitch-spacing-md) 0 !important;
}

.stitch-footer a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  color: #e2e8f0;
  text-decoration: none;
  transition: color 0.2s ease;
}

/* --- Stitch Phase 3 Modifiers & New Components --- */

/* Base Card Component */
.stitch-card {
  background: var(--stitch-color-surface-card) !important;
  border-radius: var(--stitch-radius-lg) !important;
  border: 1px solid var(--stitch-color-border) !important;
  box-shadow: var(--stitch-shadow-sm) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.stitch-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--stitch-shadow-md) !important;
}

/* Modifier Classes (BEM-style) */
.stitch-card--premium {
  border: 2px solid #f59e0b !important;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.15) !important;
  background: linear-gradient(180deg, #fffdfa 0%, #ffffff 100%) !important;
}

.stitch-card--featured {
  border: 2px solid var(--stitch-color-secondary) !important;
  box-shadow: 0 8px 24px rgba(0, 106, 99, 0.12) !important;
}

.stitch-card--lead {
  border-color: #22c55e !important;
}

.stitch-card--disabled {
  opacity: 0.75 !important;
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

/* .stitch-breadcrumb: Breadcrumbs navigation */
.stitch-breadcrumb {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: var(--stitch-spacing-xs) !important;
  font-size: var(--stitch-font-size-sm) !important;
  color: var(--stitch-color-text-sub) !important;
  margin-bottom: var(--stitch-spacing-md) !important;
}

.stitch-breadcrumb a {
  color: var(--stitch-color-primary) !important;
  text-decoration: none !important;
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
}

.stitch-breadcrumb a:hover {
  text-decoration: underline !important;
}

.stitch-breadcrumb [aria-current="page"] {
  font-weight: 700 !important;
  color: var(--stitch-color-text-main) !important;
}

/* .stitch-gallery: Photo Gallery Component */
.stitch-gallery {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: var(--stitch-spacing-sm) !important;
  margin-bottom: var(--stitch-spacing-lg) !important;
}

.stitch-gallery img {
  width: 100% !important;
  height: 160px !important;
  object-fit: cover !important;
  border-radius: var(--stitch-radius-md) !important;
  border: 1px solid var(--stitch-color-border) !important;
  transition: transform 0.2s ease !important;
}

.stitch-gallery img:hover {
  transform: scale(1.02) !important;
}

/* .stitch-info-table: Basic Info Table Component */
.stitch-info-table {
  width: 100% !important;
  border-collapse: collapse !important;
  background: var(--stitch-color-surface-card) !important;
  border-radius: var(--stitch-radius-lg) !important;
  overflow: hidden !important;
  box-shadow: var(--stitch-shadow-sm) !important;
  margin-bottom: var(--stitch-spacing-lg) !important;
}

.stitch-info-table th,
.stitch-info-table td {
  padding: 14px 18px !important;
  border-bottom: 1px solid var(--stitch-color-border) !important;
  font-size: var(--stitch-font-size-base) !important;
  text-align: left !important;
}

.stitch-info-table th {
  background: var(--stitch-color-primary-light) !important;
  color: var(--stitch-color-primary) !important;
  font-weight: 700 !important;
  width: 30% !important;
}

.stitch-info-table td {
  color: var(--stitch-color-text-main) !important;
}

/* .stitch-cta-panel: Main Action Panel */
.stitch-cta-panel {
  background: linear-gradient(135deg, #1a365d 0%, #006a63 100%) !important;
  color: #ffffff !important;
  border-radius: var(--stitch-radius-xl) !important;
  padding: var(--stitch-spacing-lg) var(--stitch-spacing-md) !important;
  box-shadow: var(--stitch-shadow-lg) !important;
  text-align: center !important;
  margin-top: var(--stitch-spacing-xl) !important;
  margin-bottom: var(--stitch-spacing-xl) !important;
}

/* .stitch-floating-cta: Mobile Sticky Action Bar */
.stitch-floating-cta {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: var(--stitch-glass-bg) !important;
  backdrop-filter: var(--stitch-glass-blur) !important;
  -webkit-backdrop-filter: var(--stitch-glass-blur) !important;
  border-top: 1px solid var(--stitch-color-border) !important;
  padding: 10px 16px !important;
  box-shadow: 0 -4px 16px rgba(0, 32, 69, 0.12) !important;
  z-index: 900 !important;
  display: flex !important;
  gap: 10px !important;
  justify-content: center !important;
}

/* ===== Unified Components (index16) ===== */
.stitch-unified-card {
  background: var(--stitch-color-surface-card) !important;
  border-radius: var(--stitch-radius-lg) !important; /* 12px (0.75rem) */
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}
.stitch-unified-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.stitch-subtle-link {
  color: #4b5563 !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  transition: color 0.2s ease !important;
}
.stitch-subtle-link:hover {
  color: var(--stitch-color-accent) !important;
  text-decoration: underline !important;
}

.stitch-reassurance-text {
  font-size: 0.85rem !important;
  color: #6b7280 !important;
  font-weight: normal !important;
  margin-top: 6px !important;
  display: block !important;
  text-align: center !important;
}

/* ===== QA Spacing & Responsive Fixes ===== */

/* QA①: Hero CTA gap adjustments
   - button→補助テキスト: 10px (spec: 8-12px)
   - 補助テキスト→LINEリンク: 16px (spec: 16px+)
   - ラップ全体の上下余白を確保 */
.banner-cta-wrap {
  padding-top: 16px !important;
  padding-bottom: 16px !important;
}
.banner-cta-wrap .stitch-reassurance-text {
  margin-top: 10px !important;
}
.banner-cta-wrap .stitch-subtle-link {
  margin-top: 16px !important;
}

/* QA③: Trust section reassurance text
   - section-header内の共感文をリードより一段小さくして自然に読ませる */
.enrollment-trend-section .stitch-section-header .stitch-reassurance-text {
  font-size: 0.82rem !important;
  color: #6b7280 !important;
  margin-top: 12px !important;
  padding-top: 10px !important;
  border-top: 1px solid #f1f5f9 !important;
}

/* QA②: Final CTA — mobile vertical stack
   768px以上: 横並び維持 / 767px以下: 縦並び */
.cta-section .cta-btn-group {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: nowrap;
  max-width: 580px;
  margin: 0 auto;
}
@media (max-width: 767px) {
  .cta-section .cta-btn-group {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 16px !important;
    max-width: 320px !important;
  }
  .cta-section .cta-btn-group > div {
    width: 100% !important;
    min-width: unset !important;
  }
}
