@import url('./fonts.css');

:root {
  --color-primary: #b91c1c;
  --color-primary-light: #fee2e2;
  --color-secondary: #d97706;
  --color-secondary-light: #fef3c7;
  --color-bg: #faf9f7;
  --color-surface: #ffffff;
  --color-text: #1c1917;
  --color-text-secondary: #57534e;
  --color-text-muted: #78716c;
  --color-border: #e7e5e4;
  --color-link: #0369a1;
  --color-success: #15803d;
  --header-height: 3.5rem;
  --radius-card: 12px;
  --radius-thumb: 8px;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-2xl: 2rem;
  --font-family: 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --shadow-card: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-header: 0 1px 3px rgba(0, 0, 0, 0.08);
  --transition: 150ms cubic-bezier(0, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--color-bg);
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--header-height);
  padding-top: env(safe-area-inset-top);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  z-index: 100;
  box-shadow: var(--shadow-header);
}

.app-header--detail {
  background: var(--color-surface);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  justify-content: flex-start;
  padding-left: var(--space-sm);
  padding-right: var(--space-lg);
}

.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-title {
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header--detail .header-title {
  flex: 1;
  text-align: center;
  margin-right: 2.75rem;
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background var(--transition);
}

.btn-back:active {
  background: var(--color-bg);
}

.btn-back:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* Main */
.app-main {
  padding-top: calc(var(--header-height) + env(safe-area-inset-top));
  padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom));
}

.app-main--detail {
  padding-top: calc(var(--header-height) + env(safe-area-inset-top));
}

/* 首页顶部横幅图 */
.home-hero {
  position: relative;
  margin: var(--space-lg);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #fef2f2;
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.08);
  min-height: 7.5rem;
}

.home-hero__img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 7.5rem;
  object-fit: cover;
}

.home-hero__text {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-lg) 42% var(--space-lg) var(--space-lg);
  pointer-events: none;
}

.home-hero__title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text);
  margin: 0 0 var(--space-sm);
}

.home-hero__desc {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin: 0;
}

@media (max-width: 360px) {
  .home-hero__text {
    padding-right: var(--space-lg);
  }

  .home-hero__title {
    font-size: 1rem;
  }
}

/* Section groups */
.content-group {
  margin-bottom: var(--space-2xl);
  padding: 0 var(--space-lg);
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.section-title::before {
  content: '';
  width: 4px;
  height: 1rem;
  background: var(--color-primary);
  border-radius: 2px;
  flex-shrink: 0;
}

/* 二级栏目 */
.subsection {
  margin-bottom: var(--space-xl);
}

.subsection:last-child {
  margin-bottom: 0;
}

.subsection-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  padding-left: var(--space-xs);
}

.subsection-title::before {
  content: '';
  width: 3px;
  height: 0.875rem;
  background: var(--color-secondary);
  border-radius: 2px;
  flex-shrink: 0;
}

.card-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* 并列双列卡片（参加范围 / 参加形式等） */
.card-list--cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.card-list--cols-2 > li {
  min-width: 0;
}

.card-list--cols-2 .list-card {
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  padding: var(--space-md);
  text-align: center;
  gap: var(--space-sm);
}

.card-list--cols-2 .card-thumb {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto;
}

.card-list--cols-2 .card-body {
  flex: 1;
}

.card-list--cols-2 .card-title {
  font-size: 0.875rem;
  -webkit-line-clamp: 2;
}

.card-list--cols-2 .card-summary {
  font-size: 0.75rem;
  -webkit-line-clamp: 3;
  margin-top: var(--space-xs);
}

.card-list--cols-2 .card-arrow {
  display: none;
}

/* List card */
.list-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 5.5rem;
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.list-card:active {
  transform: scale(0.98);
  background: #fafaf9;
}

.list-card:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

.card-thumb {
  width: 5rem;
  height: 5rem;
  border-radius: var(--radius-thumb);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-primary-light);
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.card-summary {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-arrow {
  flex-shrink: 0;
  color: #a8a29e;
}

/* Detail page */
.detail-page {
  animation: fadeIn 200ms cubic-bezier(0, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.detail-cover-wrap {
  width: 100%;
  max-height: 13.75rem;
  overflow: hidden;
  background: var(--color-primary-light);
}

.detail-cover {
  width: 100%;
  height: auto;
  max-height: 13.75rem;
  object-fit: cover;
  display: block;
}

.detail-header {
  padding: var(--space-lg) var(--space-lg) 0;
}

.detail-header h1 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.detail-section-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.detail-content {
  padding: var(--space-lg);
  max-width: 480px;
}

.detail-intro {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  padding: var(--space-md);
  background: var(--color-primary-light);
  border-radius: var(--radius-thumb);
  border-left: 4px solid var(--color-primary);
}

.content-block {
  margin-bottom: var(--space-xl);
}

.block-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.block-title::before {
  content: '';
  width: 4px;
  height: 0.875rem;
  background: var(--color-primary);
  border-radius: 2px;
}

.block-text {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
}

.block-list {
  list-style: none;
  padding: 0;
}

.block-list li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.block-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
}

.block-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.block-step-item::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: var(--space-md);
  top: var(--space-md);
  width: 1.5rem;
  height: 1.5rem;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.block-steps li,
.block-steps .block-step-item {
  position: relative;
  padding: var(--space-md) var(--space-md) var(--space-md) 3rem;
  margin-bottom: var(--space-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-thumb);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.block-steps--with-images .block-step-item {
  padding: var(--space-md);
  padding-top: calc(var(--space-md) + 1.75rem);
}

.block-steps--with-images .block-step-item::before {
  top: var(--space-md);
  left: var(--space-md);
}

.step-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
  font-weight: 500;
}

.step-figure {
  margin: var(--space-md) 0 0;
  padding: 0;
  border-radius: var(--radius-thumb);
  overflow: hidden;
  background: #f5f5f4;
  border: 1px solid var(--color-border);
}

.step-image {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  object-fit: contain;
}

/* 流程图整图展示 */
.flow-image-block {
  margin-bottom: 0;
}

.flow-image-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.flow-image-wrap {
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.flow-image-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.flow-image-trigger:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

.flow-image-trigger:active {
  opacity: 0.92;
}

.flow-image {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

/* 流程图灯箱放大 */
.flow-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-lightbox[hidden] {
  display: none;
}

.flow-lightbox-open {
  overflow: hidden;
}

.flow-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.85);
}

.flow-lightbox__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) var(--space-sm) env(safe-area-inset-bottom);
}

.flow-lightbox__close {
  align-self: flex-end;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: var(--space-sm);
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.flow-lightbox__close:active {
  background: rgba(255, 255, 255, 0.25);
}

.flow-lightbox__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
}

.flow-lightbox__img {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius-thumb);
  background: #fff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.detail-page--flow .detail-header {
  padding-bottom: var(--space-sm);
}

.detail-page--flow .detail-intro {
  margin-bottom: var(--space-lg);
}

.list-card--external .card-arrow {
  color: var(--color-link);
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--color-surface);
  border-radius: var(--radius-thumb);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.info-table tr:nth-child(even) {
  background: #fafaf9;
}

.info-table th,
.info-table td {
  padding: var(--space-md);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
}

.info-table tr:last-child th,
.info-table tr:last-child td {
  border-bottom: none;
}

.info-table th {
  width: 38%;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-primary-light);
}

.info-table td {
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-secondary-light);
  border-left: 4px solid var(--color-secondary);
  border-radius: var(--radius-thumb);
}

.contact-row {
  display: flex;
  gap: var(--space-sm);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.contact-label {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.contact-value {
  color: var(--color-text);
  font-weight: 500;
}

.contact-value a {
  color: var(--color-link);
  text-decoration: none;
}

.case-card {
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--space-md);
}

.case-card h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
}

.case-card p {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
}

/* Not found */
.not-found {
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  color: var(--color-text-muted);
}

.not-found a {
  color: var(--color-link);
  margin-top: var(--space-lg);
  display: inline-block;
}

/* Desktop frame */
@media (min-width: 481px) {
  body {
    background: #f5f5f4;
  }
}
