/* Football Family Legacy Tree - Main Stylesheet */
:root {
  --color-primary: #2d5a27;
  --color-primary-light: #4a7c43;
  --color-primary-dark: #1a3d15;
  --color-accent: #f4a261;
  --color-accent-dark: #e76f51;
  --color-bg: #f8f6f3;
  --color-surface: #ffffff;
  --color-text: #2d3436;
  --color-text-secondary: #636e72;
  --color-border: #dfe6e9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Header */
.site-header {
  background: var(--color-primary);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo svg {
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
}

.main-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
  color: white;
  border-bottom-color: var(--color-accent);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: 4rem 0 3rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero .subtitle {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.search-box {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.search-box input {
  flex: 1;
  border: none;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  outline: none;
}

.search-box input::placeholder {
  color: var(--color-text-secondary);
}

.search-btn {
  background: var(--color-accent);
  border: none;
  padding: 0 1.25rem;
  cursor: pointer;
  color: var(--color-text);
  transition: background 0.2s;
}

.search-btn:hover {
  background: var(--color-accent-dark);
  color: white;
}

/* Featured Families */
.featured-families {
  padding: 3rem 0;
}

.featured-families h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--color-primary-dark);
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.family-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
  cursor: pointer;
  border: 1px solid var(--color-border);
}

.family-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-light);
}

.family-card-header {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  color: white;
  padding: 1.25rem;
}

.family-card-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.family-card-header .country {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.family-card-body {
  padding: 1.25rem;
}

.family-tree-mini {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tree-member {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-relation {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.member-era {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  background: var(--color-border);
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
}

.family-stats {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.family-stat {
  text-align: center;
  flex: 1;
}

.family-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

.family-stat-label {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* Player Detail */
.player-detail {
  padding: 2rem 0 4rem;
}

.player-detail[hidden] {
  display: none;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

.back-btn:hover {
  color: var(--color-primary-dark);
}

.detail-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.detail-header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.detail-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  flex-shrink: 0;
}

.detail-info h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.detail-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.meta-tag {
  background: var(--color-bg);
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.detail-tree {
  margin-top: 2rem;
}

.detail-tree h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--color-primary-dark);
}

.tree-visual {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tree-level {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.tree-connector {
  width: 40px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.tree-connector::before {
  content: '';
  width: 2px;
  height: 30px;
  background: var(--color-border);
}

.tree-node {
  flex: 1;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 1rem;
  border-left: 4px solid var(--color-primary);
}

.tree-node.current {
  border-left-color: var(--color-accent);
  background: linear-gradient(90deg, rgba(244,162,97,0.1) 0%, var(--color-bg) 100%);
}

.node-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.node-details {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

.career-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.career-stat {
  text-align: center;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.career-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
}

.career-stat-label {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

/* Stats Overview */
.stats-overview {
  background: var(--color-surface);
  padding: 3rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.stats-overview h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--color-primary-dark);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  text-align: center;
  padding: 1.5rem;
  background: var(--color-bg);
  border-radius: var(--radius-md);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-primary);
  display: block;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-top: 0.5rem;
}

/* How It Works */
.how-it-works {
  padding: 4rem 0;
}

.how-it-works h2 {
  font-size: 1.75rem;
  margin-bottom: 2rem;
  text-align: center;
  color: var(--color-primary-dark);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.info-card {
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.info-icon {
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.info-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.info-card p {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* FAQ Section */
.common-questions {
  padding: 4rem 0;
  background: var(--color-surface);
}

.common-questions h2 {
  font-size: 1.75rem;
  margin-bottom: 2rem;
  text-align: center;
  color: var(--color-primary-dark);
}

.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--color-border);
}

.faq-item summary {
  padding: 1.25rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--color-primary);
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  padding-bottom: 1.25rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* Share Section */
.share-section {
  padding: 3rem 0;
}

.share-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
}

.share-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.share-card p {
  opacity: 0.9;
  margin-bottom: 1.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.share-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.share-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* Footer */
.site-footer {
  background: var(--color-text);
  color: white;
  padding: 2rem 0 1rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  font-weight: 700;
  font-size: 1.1rem;
  display: block;
  margin-bottom: 0.5rem;
}

.footer-brand p {
  opacity: 0.7;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  opacity: 0.6;
}

.footer-bottom a {
  color: white;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-text);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .hero {
    padding: 2.5rem 0 2rem;
  }
  
  .family-grid {
    grid-template-columns: 1fr;
  }
  
  .detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .detail-meta {
    justify-content: center;
  }
  
  .footer-content {
    flex-direction: column;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .filter-bar {
    justify-content: center;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
}


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
