/*
  Phase 2 CSS entry point for the PHP/MySQL conversion.
  This recreates the React site's broad visual language while staying
  dependency-free for shared hosting.
*/

:root {
  --purple-50: #faf5ff;
  --purple-100: #f3e8ff;
  --purple-500: #a855f7;
  --purple-600: #9333ea;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --coral-500: #f97361;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --white: #ffffff;
  --shadow-sm: 0 1px 8px rgba(31, 41, 55, 0.08);
  --shadow-card: 0 10px 28px rgba(31, 41, 55, 0.12);
  --shadow-xl: 0 24px 50px rgba(31, 41, 55, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  color: var(--gray-800);
  line-height: 1.6;
  background: var(--gray-50);
}

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

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  padding: 16px max(24px, calc((100vw - 1280px) / 2 + 24px));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark,
.footer-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  color: var(--white);
  font-weight: 800;
  background: linear-gradient(90deg, var(--purple-500), var(--indigo-500));
}

.brand-mark svg,
.footer-mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.brand-text {
  display: grid;
  line-height: 1.1;
}

.brand-title {
  color: var(--gray-800);
  font-size: 1.5rem;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--purple-500);
  font-size: 0.875rem;
  font-weight: 600;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-nav a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--gray-600);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--purple-600);
  background: var(--purple-50);
}

.hero,
.page-header,
.cta-band {
  position: relative;
  overflow: hidden;
  color: var(--white);
  background: linear-gradient(135deg, var(--purple-500), var(--purple-600), var(--indigo-600));
}

.hero::after,
.page-header::after,
.cta-band::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 60px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z' fill='%23ffffff'%3E%3C/path%3E%3C/svg%3E") no-repeat;
  background-size: cover;
}

.bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.1;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.35) 1px, transparent 0);
  background-size: 20px 20px;
}

.hero-grid {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 80px 0 112px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 48px;
  align-items: center;
}

.hero-copy h1,
.page-header h1 {
  margin: 0 0 24px;
  font-size: clamp(3rem, 6vw, 4.75rem);
  line-height: 1.05;
  font-weight: 800;
}

.hero-copy h1 span {
  color: #fef3c7;
}

.hero-copy p,
.page-header p,
.cta-band p {
  max-width: 680px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.25rem;
}

.hero-media {
  position: relative;
  justify-self: end;
}

.hero-media img {
  width: min(100%, 400px);
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  background: var(--white);
}

.callout-badge {
  position: absolute;
  top: -16px;
  right: -16px;
  display: inline-flex;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--purple-600);
  background: #fde047;
  font-size: 0.875rem;
  font-weight: 800;
  box-shadow: var(--shadow-card);
}

.button,
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 28px;
  border-radius: 999px;
  border: 0;
  color: var(--purple-600);
  background: var(--white);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-card);
}

.pill-button {
  min-height: 40px;
  padding: 0 18px;
  color: var(--white);
  background: linear-gradient(90deg, var(--purple-500), var(--indigo-500));
  font-size: 0.9rem;
}

.page-header {
  padding: 64px 24px 96px;
  text-align: center;
}

.page-header p {
  margin: 0 auto;
}

.section {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0;
}

.white-section {
  background: transparent;
}

.section-title,
.section-heading {
  text-align: center;
}

.section-title,
.section-heading h2 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
}

.section-heading p {
  max-width: 720px;
  margin: 0 auto 36px;
  color: var(--gray-600);
  font-size: 1.05rem;
}

.feature-grid,
.card-grid,
.toolbar-grid {
  display: grid;
  gap: 32px;
}

.feature-grid,
.card-grid.thirds {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-grid.halves,
.toolbar-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.milestone-grid {
  gap: 36px;
}

.feature {
  text-align: center;
}

.feature-icon {
  width: 64px;
  height: 64px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 999px;
  color: var(--white);
  font-weight: 800;
}

.feature-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.feature-icon.green {
  background: linear-gradient(90deg, #4ade80, #22c55e);
}

.feature-icon.blue {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.feature-icon.red {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.age-button-grid,
.age-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.age-bubble {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--gray-600);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.age-bubble span {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border-radius: 999px;
  color: var(--white);
  font-weight: 800;
  box-shadow: var(--shadow-card);
}

.age-color-0 span { background: linear-gradient(135deg, #f472b6, #db2777); }
.age-color-1 span { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.age-color-2 span { background: linear-gradient(135deg, #4ade80, #16a34a); }
.age-color-3 span { background: linear-gradient(135deg, #fb923c, #ea580c); }
.age-color-4 span { background: linear-gradient(135deg, #c084fc, #9333ea); }
.age-color-5 span { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.age-color-6 span { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.age-color-7 span { background: linear-gradient(135deg, #22d3ee, #0891b2); }

.age-nav {
  margin: 32px 0 48px;
}

.age-nav a {
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--white);
  background: var(--purple-500);
  font-weight: 700;
  text-decoration: none;
}

.list-block {
  margin-bottom: 64px;
}

.search-placeholder,
.newsletter-mini,
.data-source-note {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  color: var(--gray-500);
  background: var(--white);
}

.data-source-note {
  min-height: 44px;
  margin: 0 0 20px;
  border-color: #fef3c7;
  color: #92400e;
  background: #fffbeb;
}

.toolbar-grid {
  margin-bottom: 48px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--gray-100);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.product-card {
  border-radius: 28px;
}

.card-image {
  position: relative;
  height: 192px;
  background: var(--gray-50);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--white);
  background: var(--purple-500);
  font-size: 0.875rem;
  font-weight: 700;
}

.card-body {
  padding: 24px;
}

.card h3 {
  margin: 10px 0 12px;
  font-size: 1.2rem;
  line-height: 1.25;
}

.card p {
  margin: 0 0 18px;
  color: var(--gray-600);
  font-size: 0.95rem;
}

.article-card img,
.milestone-card img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  background: var(--gray-100);
}

.milestone-card {
  overflow: hidden;
  border: 2px solid var(--gray-100);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.milestone-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

.milestone-card .card-image-link {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--gray-100);
}

.milestone-card img {
  height: 100%;
  transition: transform 0.3s ease;
}

.milestone-card:hover img {
  transform: scale(1.04);
}

.card-image-link,
.card-title-link {
  color: inherit;
  text-decoration: none;
}

.card-title-link:hover,
.card-image-link:hover + .card-body .card-title-link {
  color: var(--purple-600);
}

.milestone-card h3 {
  color: var(--purple-600);
  font-size: clamp(1.8rem, 3vw, 2rem);
  font-weight: 800;
  text-align: center;
  margin: 6px 0 20px;
}

.milestone-card .card-body {
  padding: 30px;
  text-align: center;
}

.milestone-card p {
  font-size: 0.98rem;
  line-height: 1.7;
  margin-bottom: 22px;
}

.meta,
.muted {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.stars {
  display: flex;
  align-items: center;
  gap: 2px;
  color: #facc15;
  font-size: 1rem;
}

.star-empty {
  color: var(--gray-300);
}

.rating-number {
  margin-left: 8px;
  color: var(--gray-600);
  font-size: 0.875rem;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-actions strong {
  color: var(--purple-600);
  font-size: 1.5rem;
}

.text-link {
  color: var(--purple-600);
  font-weight: 700;
  text-decoration: none;
}

.empty-card {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 32px;
  border: 1px dashed var(--gray-300);
  border-radius: 16px;
  color: var(--gray-500);
  text-align: center;
  background: var(--white);
}

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

.compact-cta {
  padding: 64px 0 96px;
}

.compact-cta h2 {
  margin: 0 0 12px;
  font-size: 2.25rem;
}

.compact-cta p {
  margin: 0 auto 28px;
}

.info-note {
  background: linear-gradient(135deg, #eff6ff, #ecfeff);
}

.info-note .section {
  max-width: 900px;
  text-align: center;
}

.sitemap-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.sitemap-list a {
  padding: 18px 20px;
  border-radius: 10px;
  color: var(--purple-600);
  background: var(--white);
  border: 1px solid var(--gray-200);
  font-weight: 700;
  text-decoration: none;
}

.breadcrumb {
  margin-bottom: 24px;
  color: var(--gray-500);
  font-size: 0.95rem;
}

.breadcrumb a {
  color: var(--purple-600);
  text-decoration: none;
}

.section.compact {
  min-height: 60vh;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 48px;
  padding: 48px max(24px, calc((100vw - 1280px) / 2 + 24px));
  color: var(--white);
  background: var(--gray-800);
}

.footer-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.footer-title strong,
.newsletter h2 {
  display: block;
  font-size: 1.25rem;
}

.footer-title span,
.site-footer p,
.newsletter p,
.newsletter small {
  color: var(--gray-300);
}

.site-footer a {
  color: #c084fc;
  font-weight: 700;
  text-decoration: none;
}

.newsletter {
  display: grid;
  gap: 12px;
}

.newsletter h2,
.newsletter p {
  margin: 0;
}

.newsletter input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--gray-600);
  border-radius: 10px;
  color: var(--white);
  background: var(--gray-700);
}

.newsletter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.newsletter-row input {
  border-radius: 10px 0 0 10px;
}

.newsletter-row button {
  min-width: 72px;
  border: 0;
  border-radius: 0 10px 10px 0;
  color: var(--white);
  background: var(--purple-500);
  font-weight: 700;
}

.form-message {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 700;
}

.form-message.success {
  color: #dcfce7;
  background: #15803d;
}

.form-message.error {
  color: #fee2e2;
  background: #b91c1c;
}

.detail-slug {
  color: var(--gray-600);
}

.article-detail {
  max-width: 1000px;
}

.detail-hero {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.content-body {
  overflow: hidden;
  padding: 24px 0;
}

.content-body img {
  max-width: 100%;
}

.milestone-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.milestone-sections .card {
  padding: 24px;
}

.milestone-sections h2 {
  margin-top: 0;
  color: var(--purple-600);
}

.milestone-hero {
  background: linear-gradient(135deg, #2563eb, #0891b2);
}

.milestone-hero-inner {
  width: min(960px, calc(100% - 48px));
  margin: 0 auto;
}

.hero-back-link {
  display: inline-flex;
  margin-bottom: 24px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  text-decoration: none;
}

.milestone-hero-title {
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
}

.milestone-hero-title h1,
.milestone-hero-title p {
  margin: 0;
}

.milestone-hero-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.16);
}

.milestone-hero-icon svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.milestone-detail-page {
  max-width: 960px;
}

.milestone-about,
.milestone-note-card {
  margin-bottom: 40px;
  padding: 32px;
  border: 1px solid #bae6fd;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff, #ecfeff);
}

.milestone-about h2,
.milestone-note-card h2 {
  margin-top: 0;
}

.milestone-section-card {
  border: 1px solid var(--gray-200);
}

.milestone-section-card ul {
  margin: 0;
  padding-left: 22px;
}

.milestone-section-card li + li {
  margin-top: 8px;
}

.widget-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--gray-100);
}

.widget-card {
  width: min(100%, 360px);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  color: var(--white);
  background: linear-gradient(90deg, var(--purple-500), var(--indigo-500));
  font-size: 0.8rem;
}

.widget-header strong {
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--purple-600);
  background: var(--white);
}

.widget-card > img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: var(--gray-50);
}

.widget-body {
  padding: 16px;
}

.widget-body h1 {
  margin: 10px 0;
  font-size: 1rem;
}

@media (max-width: 980px) {
  .site-header,
  .site-footer,
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    display: grid;
  }

  .site-nav {
    flex-wrap: wrap;
  }

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

  .hero-media {
    justify-self: center;
  }

  .feature-grid,
  .card-grid.thirds,
  .card-grid.halves,
  .toolbar-grid,
  .milestone-sections {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header,
  .site-footer,
  .section,
  .hero-grid {
    width: auto;
  }

  .site-header,
  .site-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .brand-title {
    font-size: 1.25rem;
  }

  .site-nav a {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.9rem;
  }

  .hero-grid {
    padding-top: 56px;
  }

  .sitemap-list {
    grid-template-columns: 1fr;
  }

  .card-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
