/* =====================================================
   Smart App Builder Homepage — "Commerce Fresh"
   White + SAB brand blue (#2563eb, same scale as apps/frontend/src/index.css), clean e-commerce SaaS look.
   Content classes are consumed by templates/; keep names
   stable or update the templates together with this file.
   ===================================================== */

:root {
  /* palette */
  --color-primary: #2563eb;
  --color-primary-dark: #1d4fd0;
  --color-primary-deep: #1a43a8;
  --color-primary-soft: #bfd3fb;
  --color-primary-tint: #eff4fe;
  --color-ink: #0f172a;
  --color-text: #334155;
  --color-text-light: #64748b;
  --color-border: #e2e8f0;
  --color-bg: #ffffff;
  --color-bg-soft: #f8fafc;
  --color-error: #dc2626;

  /* shape */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);

  /* same family as the dashboard (apps/frontend --font-sans) */
  --font-body: "IBM Plex Sans JP", ui-sans-serif, system-ui, sans-serif;
}

/* ---------- reset & base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--color-primary-dark); text-decoration: none; }
a:hover { opacity: 0.85; }

h1, h2, h3, h4 { color: var(--color-ink); line-height: 1.4; font-weight: 700; }

ul { list-style: none; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.text-center { text-align: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn--cta {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}
.btn--cta:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  opacity: 1;
}

.btn--outline {
  border-color: var(--color-border);
  color: var(--color-ink);
  background: #fff;
}
.btn--outline:hover { border-color: var(--color-primary); color: var(--color-primary-dark); opacity: 1; }

.btn--lg { padding: 16px 40px; font-size: 1.05rem; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35); }
  50% { box-shadow: 0 8px 32px rgba(37, 99, 235, 0.6); }
}
.btn--pulse { animation: pulse 2.4s ease-in-out infinite; }

.btn-group { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- loading overlay ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}
.loading-overlay.is-hidden { opacity: 0; pointer-events: none; }
.loading-overlay__inner { text-align: center; }
.loading-logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-ink);
  margin-bottom: 16px;
}
.loading-bar {
  width: 180px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
  overflow: hidden;
  margin: 0 auto;
}
.loading-bar__fill {
  height: 100%;
  width: 40%;
  border-radius: 2px;
  background: var(--color-primary);
  animation: loading-slide 0.9s ease-in-out infinite;
}
@keyframes loading-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ---------- header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.header__logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.header__logo::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--color-primary);
  display: inline-block;
}
.header__nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
/* :not(.btn) — plain nav links only; without it this outranks .btn--cta's white text */
.header__nav > a:not(.btn) {
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
}
.header__nav > a:not(.btn):hover { color: var(--color-primary-dark); }
.header__nav .btn { padding: 10px 22px; }
.header__toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-ink);
  cursor: pointer;
}

.dropdown { position: relative; }
.dropdown > a { color: var(--color-text); font-weight: 500; font-size: 0.95rem; }
.dropdown__menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px;
  min-width: 180px;
  display: none;
}
.dropdown:hover .dropdown__menu { display: block; }
.dropdown__menu a {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.9rem;
}
.dropdown__menu a:hover { background: var(--color-primary-tint); color: var(--color-primary-deep); }

/* ---------- scroll animations (hooks used by base.html JS) ---------- */
.fade-in-up, .stagger-in { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.scale-in { opacity: 0; transform: scale(0.92); transition: opacity 0.6s ease, transform 0.6s ease; }
.fade-in-up.is-visible, .stagger-in.is-visible { opacity: 1; transform: translateY(0); }
.scale-in.is-visible { opacity: 1; transform: scale(1); }
.stagger-in:nth-child(2) { transition-delay: 0.08s; }
.stagger-in:nth-child(3) { transition-delay: 0.16s; }
.stagger-in:nth-child(4) { transition-delay: 0.24s; }
.stagger-in:nth-child(5) { transition-delay: 0.32s; }
.stagger-in:nth-child(6) { transition-delay: 0.4s; }

@media (prefers-reduced-motion: reduce) {
  .fade-in-up, .stagger-in, .scale-in { opacity: 1; transform: none; transition: none; }
  .btn--pulse { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- screenshot placeholder (site_img fallback) ---------- */
.screenshot-placeholder {
  background: linear-gradient(135deg, var(--color-primary-tint) 0%, var(--color-bg-soft) 100%);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 16px;
  text-align: center;
  color: var(--color-text-light);
  font-size: 13px;
}

/* =====================================================
   HERO — two columns: copy left, screenshot stack right
   ===================================================== */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 85% 10%, rgba(37, 99, 235, 0.1), transparent),
    radial-gradient(ellipse 50% 40% at 10% 90%, rgba(37, 99, 235, 0.06), transparent),
    var(--color-bg);
}
/* subtle dot grid, e-commerce dashboard vibe */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 80%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 80%);
  pointer-events: none;
}

.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  padding: 88px 0 96px;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-primary-tint);
  color: var(--color-primary-deep);
  border: 1px solid var(--color-primary-soft);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  margin-bottom: 20px;
}

.hero__title {
  font-size: 2.6rem;
  letter-spacing: 0.01em;
  margin-bottom: 20px;
}
.hero__title span {
  color: var(--color-primary-dark);
  background: linear-gradient(transparent 68%, var(--color-primary-soft) 68%);
  padding: 0 2px;
}

.hero__subtitle {
  font-size: 1.05rem;
  color: var(--color-text-light);
  margin-bottom: 32px;
  max-width: 34em;
}

/* screenshot stack: dashboard big, phone overlapping bottom-right */
.hero__visual { position: relative; }
.shot-web {
  width: 100%;
  height: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  background: #fff;
}
div.shot-web { padding: 110px 24px; } /* placeholder box */
.shot-phone {
  position: absolute;
  right: -8px;
  bottom: -32px;
  width: 31%;
  height: auto;
  border-radius: 22px;
  border: 5px solid #fff;
  box-shadow: var(--shadow-lg);
  background: #fff;
}
div.shot-phone { padding: 52px 6px; font-size: 11px; } /* placeholder box */

/* single-image override (HeroContent.hero_image) */
.hero__image img { width: 100%; height: auto; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }

/* =====================================================
   CHIP BAND — feature titles as anchor chips
   ===================================================== */
.chip-band {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-soft);
}
.chip-band .container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  justify-content: center;
  padding-top: 18px;
  padding-bottom: 18px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}
.chip::before { content: "✓"; color: var(--color-primary); font-weight: 700; }
.chip:hover { border-color: var(--color-primary); opacity: 1; }

/* =====================================================
   SECTION SCAFFOLD
   ===================================================== */
.section { padding: 80px 0; }
.section h2 { font-size: 1.9rem; margin-bottom: 16px; }

/* =====================================================
   PAIN POINTS — ✗ cards, 2×2
   ===================================================== */
.pain-points { padding: 88px 0 72px; }
.pain-points h2 { font-size: 1.9rem; text-align: center; margin-bottom: 44px; }

.pain-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 880px;
  margin: 0 auto;
}
.pain-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--color-border);
  border-left: 4px solid #f87171;
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  color: var(--color-ink);
}
.pain-card::before {
  content: "✕";
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.pain-points__arrow {
  text-align: center;
  font-size: 1.6rem;
  color: var(--color-primary);
  margin-top: 36px;
}

/* =====================================================
   SOLUTION — intro two-col + horizontal scroll features
   ===================================================== */
.solution-intro {
  background: linear-gradient(180deg, var(--color-primary-tint) 0%, var(--color-bg) 45%);
  padding: 88px 0 72px;
}

.solution-head {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 56px;
  align-items: center;
  margin-bottom: 56px;
}
.solution-head h2 { font-size: 2rem; margin-bottom: 18px; }
.solution-head .solution-lead { color: var(--color-text-light); margin-bottom: 26px; }

.feature-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: var(--color-ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 1.5rem;
  font-weight: 700;
}
.feature-pill .feature-count__label { font-size: 0.9rem; font-weight: 500; color: #cbd5e1; }

.solution-head__visual .solution-img,
.solution-head__visual div.solution-img {
  width: 100%;
  max-width: 300px; /* phone-aspect screenshot — don't let it dominate the row */
  margin: 0 auto;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.solution-head__visual div.solution-img { padding: 90px 20px; } /* placeholder */

/* horizontal scroller */
.features-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(272px, 320px);
  gap: 20px;
  overflow-x: auto;
  padding: 8px 4px 24px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary-soft) transparent;
}
.features-scroller::-webkit-scrollbar { height: 8px; }
.features-scroller::-webkit-scrollbar-thumb { background: var(--color-primary-soft); border-radius: 4px; }

.feature-card {
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.feature-card__media { background: var(--color-bg-soft); border-bottom: 1px solid var(--color-border); }
.feature-card__media .feature-card__image { width: 100%; height: 170px; object-fit: cover; object-position: top; }
.feature-card__media .screenshot-placeholder { border: none; border-radius: 0; padding: 66px 12px; }

.feature-card__body { padding: 20px 22px 24px; }
.feature-card__number {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--color-primary-dark);
  margin-bottom: 6px;
}
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { font-size: 0.9rem; color: var(--color-text-light); }

.features-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

/* =====================================================
   HOW IT WORKS — big numbers 01–04
   ===================================================== */
.how-it-works { background: var(--color-bg-soft); padding: 88px 0; }
.how-it-works h2 { text-align: center; font-size: 1.9rem; margin-bottom: 48px; }

.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.step-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-sm);
}
.step-card__num {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.35;
  margin-bottom: 12px;
}
.step-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.step-card p { font-size: 0.88rem; color: var(--color-text-light); }

.steps-link { text-align: center; margin-top: 36px; font-weight: 500; }

/* =====================================================
   TRUST
   ===================================================== */
.trust-section { padding: 88px 0; text-align: center; }
.trust-section h2 { font-size: 1.7rem; max-width: 720px; margin: 0 auto 16px; }
.trust-section .subtitle { color: var(--color-text-light); max-width: 640px; margin: 0 auto; }
.trust-section__award { margin-bottom: 24px; }
.trust-section__award .trust-award-img { max-height: 96px; width: auto; margin: 0 auto; }
.trust-section__image { max-width: 640px; margin: 32px auto 0; }
.trust-section__image img { border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.trust-section__body { max-width: 640px; margin: 24px auto 0; text-align: left; }

/* =====================================================
   CTA BANNER — emerald
   ===================================================== */
.cta-banner {
  background: linear-gradient(135deg, var(--color-primary-deep) 0%, var(--color-primary) 100%);
  padding: 80px 0;
  text-align: center;
  color: #fff;
}
.cta-banner h2 { color: #fff; font-size: 1.9rem; margin-bottom: 12px; }
.cta-banner .subtitle { color: rgba(255, 255, 255, 0.85); margin-bottom: 32px; }
.cta-banner .btn--cta {
  background: #fff;
  color: var(--color-primary-deep);
  box-shadow: 0 8px 24px rgba(26, 67, 168, 0.4);
}
.cta-banner .btn--cta:hover { background: var(--color-primary-tint); }

/* =====================================================
   INNER PAGES (contact / legal)
   ===================================================== */
.page-header {
  background: linear-gradient(180deg, var(--color-primary-tint) 0%, var(--color-bg) 100%);
  padding: 64px 0 48px;
  text-align: center;
}
.page-header h1 { font-size: 2rem; }
.page-header .subtitle { color: var(--color-text-light); margin-top: 10px; }

.section h2 { margin-top: 32px; }
.section h2:first-child { margin-top: 0; }
.section p { margin-bottom: 16px; }

/* contact form */
.contact-form { max-width: 640px; margin: 0 auto; }
.form-group { margin-bottom: 22px; }
.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-ink);
  margin-bottom: 8px;
}
.required { color: var(--color-error); }

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-group textarea { min-height: 140px; resize: vertical; }

.radio-group { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  margin-bottom: 0;
}
.radio-group label:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
  color: var(--color-primary-deep);
}
.radio-group input { accent-color: var(--color-primary); }

.form-message {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-weight: 500;
}
.form-message--success {
  background: var(--color-primary-tint);
  border: 1px solid var(--color-primary-soft);
  color: var(--color-primary-deep);
}
.form-message--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--color-error);
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
  background: var(--color-ink);
  color: #cbd5e1;
  padding: 56px 0 28px;
}
.footer__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 40px;
}
.footer__col h4 {
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.footer__col a {
  display: block;
  color: #94a3b8;
  font-size: 0.88rem;
  padding: 4px 0;
}
.footer__col a:hover { color: #93b4f8; opacity: 1; } /* primary-300 — readable on the dark footer */
.footer__bottom {
  border-top: 1px solid #1e293b;
  padding-top: 22px;
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 960px) {
  .hero__grid { grid-template-columns: 1fr; gap: 48px; padding: 56px 0 72px; }
  .hero__title { font-size: 2.1rem; }
  .solution-head { grid-template-columns: 1fr; gap: 36px; }
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .header__toggle { display: block; }
  .header__nav {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 12px 24px 20px;
    box-shadow: var(--shadow-md);
  }
  .header__nav.is-open { display: flex; }
  .header__nav > a, .header__nav .dropdown { padding: 10px 0; }
  .header__nav .btn { margin-top: 10px; text-align: center; }

  .hero__title { font-size: 1.8rem; }
  .pain-grid { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .section, .pain-points, .solution-intro, .how-it-works, .trust-section, .cta-banner { padding-top: 56px; padding-bottom: 56px; }
  .footer__grid { grid-template-columns: 1fr; gap: 24px; }
}
