/* ==========================================================================
   Three Win: Tic Tac Toe — Production Privacy Policy Stylesheet
   Design System: Apple Developer / Google Material 3 / Microsoft Docs Inspired
   Features: CSS Variables, Dynamic Light/Dark Mode, Print Styles, WCAG 2.2 AA
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Google Fonts Import (Inter & Outfit)
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

/* --------------------------------------------------------------------------
   2. Design Tokens & CSS Variables (White Theme Only)
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - White Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Brand Accents */
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-glow: rgba(37, 99, 235, 0.15);
  
  --accent-secondary: #0891b2;
  --accent-secondary-light: #ecfeff;

  --success-color: #059669;
  --success-bg: #ecfdf5;
  --warning-color: #d97706;
  --warning-bg: #fffbeb;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.2);

  /* Geometry & Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --header-height: 72px;
  --max-width: 1280px;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', 'Inter', system-ui, sans-serif;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   3. Global Reset & Accessibility Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

/* WCAG 2.2 Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--accent-primary);
  color: var(--text-inverse);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  z-index: 9999;
  transition: top var(--transition-fast);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid var(--accent-secondary);
}

/* Focus Visible Keyboard Navigation Outline */
:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   4. Sticky Header Navigation
   -------------------------------------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-container {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background-color: var(--accent-light);
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.sun-icon { display: none; }
.moon-icon { display: block; }

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   5. Hero Section
   -------------------------------------------------------------------------- */
.hero {
  padding: 3rem 1.5rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem 3rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

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

.hero-main-title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.meta-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.meta-pill.highlight {
  background-color: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

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

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.stat-icon {
  font-size: 1.5rem;
}

.stat-text h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-text p {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   6. Main Content Layout (2-Column Desktop Grid)
   -------------------------------------------------------------------------- */
.main-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  align-items: start;
}

/* Sidebar Table of Contents */
.toc-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
}

.toc-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toc-link {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: all var(--transition-fast);
}

.toc-link:hover {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
}

.toc-link.active {
  background: var(--accent-light);
  color: var(--accent-primary);
  font-weight: 600;
  border-left-color: var(--accent-primary);
}

/* --------------------------------------------------------------------------
   7. Policy Article Content
   -------------------------------------------------------------------------- */
.policy-content {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.policy-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

.policy-section:hover {
  box-shadow: var(--shadow-md);
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;

  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.section-number {
  background: var(--accent-light);
  color: var(--accent-primary);
  font-size: 0.9rem;
  font-weight: 800;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.policy-section p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.7;
}

.policy-section ul {
  margin: 1rem 0 1.25rem 1.5rem;
  color: var(--text-secondary);
}

.policy-section li {
  margin-bottom: 0.5rem;
}

/* Callout Box Styling */
.callout-box {
  background: var(--bg-tertiary);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem;
  margin: 1.25rem 0;
}

.callout-box.success {
  background: var(--success-bg);
  border-left-color: var(--success-color);
}

.callout-box.warning {
  background: var(--warning-bg);
  border-left-color: var(--warning-color);
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-primary);

  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Data Matrix Table */
.table-responsive {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.data-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.status-badge.negative {
  background: var(--success-bg);
  color: var(--success-color);
}

.status-badge.info {
  background: var(--accent-light);
  color: var(--accent-primary);
}

/* Developer Contact Card */
.contact-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-tertiary));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border-color);
}

.contact-info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.contact-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.contact-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}

.copy-btn {
  background: var(--accent-light);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background: var(--accent-primary);
  color: var(--text-inverse);
}

/* --------------------------------------------------------------------------
   8. Back to Top Button
   -------------------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: var(--text-inverse);
  border: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-normal);
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

/* --------------------------------------------------------------------------
   9. Footer
   -------------------------------------------------------------------------- */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 3rem 1.5rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  text-align: center;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.925rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-primary);
}

/* --------------------------------------------------------------------------
   10. Mobile Responsive Layout Rules
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .main-wrapper {
    grid-template-columns: 1fr;
  }

  .toc-sidebar {
    position: static;
    max-height: none;
    margin-bottom: 1.5rem;
  }

  .hero-card {
    padding: 2rem 1.5rem;
  }

  .hero-main-title {
    font-size: 1.75rem;
  }
}

@media (max-width: 640px) {
  .header-container {
    padding: 0 1rem;
  }

  .brand-badge {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .toc-sidebar {
    display: none;
  }

  .toc-sidebar.mobile-expanded {
    display: block;
  }

  .policy-section {
    padding: 1.5rem;
  }

  .back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 42px;
    height: 42px;
  }
}

/* --------------------------------------------------------------------------
   11. Print Stylesheet (@media print)
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }

  .header,
  .toc-sidebar,
  .back-to-top,
  .theme-toggle-btn,
  .mobile-menu-btn,
  .skip-link,
  .copy-btn {
    display: none !important;
  }

  .main-wrapper {
    grid-template-columns: 1fr !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .hero-card,
  .policy-section {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .policy-section {
    page-break-inside: avoid;
    margin-bottom: 2rem;
  }

  a {
    text-decoration: underline;
    color: #000000 !important;
  }
}
