/* ACFP Backer Hub — unified responsive shell (Phase B) */
*, *::before, *::after { box-sizing: border-box; }

/* Mobile progress (dots) — hidden on wide screens */
.flow-progress-mobile { display: block; }
.flow-progress-desktop { display: none; }
.flow-header-mobile { display: flex; }
.flow-header-desktop { display: none; }
.flow-footer-mobile { display: block; }
.flow-footer-desktop { display: none; }
.flow-nav--mobile { display: flex; }
.flow-nav--desktop { display: none; }

@media (min-width: 1024px) {
  /* !important so the desktop switch always wins over higher-specificity
     two-class base rules (e.g. inline `.flow-header-mobile.site-header { display:flex }`
     re-declared per page) — otherwise the mobile header leaks on PC (double header). */
  .flow-progress-mobile { display: none !important; }
  .flow-progress-desktop { display: block !important; }
  .flow-header-mobile { display: none !important; }
  .flow-header-desktop { display: block !important; }
  .flow-footer-mobile { display: none !important; }
  .flow-footer-desktop { display: block !important; }
  .flow-nav--mobile { display: none !important; }
  .flow-nav--desktop { display: flex !important; }
}

/* Mobile-first shell */
.flow-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  min-height: 100vh;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.04);
  padding-bottom: 96px;
}

@media (min-width: 768px) and (max-width: 1023px) {
  body.flow-body { padding: 24px 16px; background: #f4f4f6; }
  .flow-shell {
    max-width: 720px;
    border-radius: 20px;
    overflow: hidden;
    min-height: auto;
  }
}

@media (min-width: 1024px) {
  body.flow-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  .flow-shell {
    max-width: none;
    margin: 0;
    box-shadow: none;
    padding-bottom: 0;
    background: transparent;
    min-height: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
  }
}

/* Mobile header (compact) */
.flow-header-mobile.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid #ececef;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Mobile progress dots */
.flow-progress-mobile.progress {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #ececef;
  background: #fff;
}

/* Mobile bottom nav */
.flow-nav--mobile.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid #ececef;
  padding: 14px 20px 20px;
  z-index: 100;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .flow-nav--mobile.bottom-nav { max-width: 720px; }
}

/* Desktop main grid + sidebar (02–05) */
@media (min-width: 1024px) {
  .flow-main-grid.main {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 40px 32px 60px;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
  }
  .flow-main-grid .sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
  }
}

@media (max-width: 1023px) {
  .flow-main-grid.main {
    display: block;
    padding: 24px 20px;
  }
  .flow-main-grid .sidebar {
    position: static;
    margin-top: 24px;
    order: -1;
  }
  .flow-main-grid .flow-content { order: 0; }
}

/* Desktop inline nav */
.flow-nav--desktop.pc-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #ececef;
}

/* Pledge summary (shared) */
.summary-card {
  background: #fff;
  border: 1px solid #ececef;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.summary-card__head {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-weight: 700;
  color: #8e8e93;
  padding-bottom: 14px;
  border-bottom: 1px solid #ececef;
  margin-bottom: 16px;
}
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  gap: 8px;
}
.summary-item + .summary-item { border-top: 1px solid #f4f4f6; }
.summary-item__name {
  font-size: 13px;
  color: #1a1a1a;
  font-weight: 500;
  line-height: 1.4;
  flex: 1;
}
.summary-item__qty {
  font-size: 12px;
  color: #8e8e93;
  font-variant-numeric: tabular-nums;
}
.summary-card__hint {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #ececef;
  font-size: 12px;
  color: #8e8e93;
  line-height: 1.5;
}

/* Mobile-only / desktop-only blocks */
.flow-only-mobile { display: block; }
.flow-only-desktop { display: none; }
@media (min-width: 1024px) {
  .flow-only-mobile { display: none !important; }
  .flow-only-desktop { display: block; }
}

/* Desktop site header */
@media (min-width: 1024px) {
  .flow-header-desktop.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid #ececef;
  }
  .site-header__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .flow-header-desktop .site-header__logo { width: 40px; height: 40px; }
  .flow-header-desktop .site-header__name { font-size: 22px; }
  .site-nav { display: flex; align-items: center; gap: 24px; }
  .site-nav__link {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .site-nav__link:hover { color: #D64545; }
  .site-nav__icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: #545458;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .site-nav__login {
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
  }
}

/* Desktop progress bar */
.flow-progress-desktop.progress-bar {
  background: #fff;
  border-bottom: 1px solid #ececef;
  padding: 20px 32px;
}
.progress-bar__inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.progress-bar .step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.progress-bar .step-item__circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ececef;
  color: #8e8e93;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.progress-bar .step-item--current .step-item__circle {
  background: linear-gradient(135deg, #D64545 0%, #B83838 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(214, 69, 69, 0.3);
}
.progress-bar .step-item--done .step-item__circle {
  background: #1a1a1a;
  color: #fff;
}
.progress-bar .step-item__label {
  font-size: 13px;
  font-weight: 500;
  color: #8e8e93;
  white-space: nowrap;
}
.progress-bar .step-item--current .step-item__label,
.progress-bar .step-item--done .step-item__label {
  color: #1a1a1a;
  font-weight: 700;
}
.progress-bar .step-item__line {
  flex: 1;
  height: 2px;
  background: #ececef;
  min-width: 24px;
  margin: 0 4px;
}
.progress-bar .step-item__line--done { background: #1a1a1a; }

/* Project mini (desktop flow steps) */
.flow-project-mini.project-mini {
  background: #fff;
  border-bottom: 1px solid #ececef;
  padding: 16px 32px;
}
.project-mini__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.project-mini__img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.project-mini__img--text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #f5f5f7;
  line-height: 1.2;
  background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
}
/* R3: 著者の img{display:block} が UA の [hidden]{display:none} を上書きするため、
   hero img(空box)と fallback の両方を hidden 時に確実に消す(全サーベイ頁の黒box/空box二重を解消)。 */
.project-mini__img--text[hidden],
[data-survey-brand="hero-fallback"][hidden],
[data-survey-brand="hero-img"][hidden] {
  display: none !important;
}
.project-mini__name { font-size: 16px; font-weight: 600; color: #1a1a1a; }
.project-mini__creator { font-size: 12px; color: #8e8e93; }

/* Single unified nav: fixed bottom mobile, inline desktop */
.flow-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}
.flow-nav.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid #ececef;
  padding: 14px 20px 20px;
}
@media (min-width: 768px) and (max-width: 1023px) {
  .flow-nav.bottom-nav { max-width: 720px; }
}
@media (min-width: 1024px) {
  .flow-nav.bottom-nav {
    position: static;
    transform: none;
    left: auto;
    max-width: none;
    width: 100%;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: 1px solid #ececef;
    margin-top: 24px;
    padding: 24px 0 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .flow-nav .flow-nav__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
  }
  .flow-nav .bottom-nav__cta,
  .flow-nav .pc-nav__next {
    width: auto;
    margin-bottom: 0;
  }
  .flow-nav .bottom-nav__back,
  .flow-nav .pc-nav__back {
    width: auto;
    padding: 8px 0;
  }
  .flow-nav .bottom-nav__total { display: none; }
  .flow-nav .flow-nav__pay-slot { display: none; }
}

/* Mobile / desktop total panels — single ID set lives in sidebar */
.flow-total-mobile { display: none !important; }
.flow-sidebar-totals { display: block; }
@media (max-width: 1023px) {
  .flow-sidebar-totals.summary-card--dark {
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
  }
}

/* Desktop footer grid */
@media (min-width: 1024px) {
  .flow-footer-desktop.site-footer {
    background: #111827;
    color: #fff;
    padding: 48px 32px;
    margin-top: 60px;
  }
  .footer-inner { max-width: 1280px; margin: 0 auto; }
  .footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 32px;
  }
  .footer-bottom {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #1F2937;
    text-align: center;
    font-size: 14px;
    color: #9CA3AF;
  }
}

/* Complete page: receipt grid on desktop */
@media (min-width: 1024px) {
  .flow-complete-grid.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 1080px;
    margin: 0 auto 32px;
    width: 100%;
  }
  .flow-complete-main.main {
    flex: 1;
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
    padding: 56px 48px 80px;
  }
}
