/* ==========================================================================
   What2Eat AI - Legal & Policy Documentation Stylesheet
   Modern, Ultra-Responsive, Mobile-First Food Tech Aesthetics
   ========================================================================== */

:root {
  --primary: #FF5722;
  --primary-hover: #E64A19;
  --primary-light: #FFEDE6;
  --primary-glow: rgba(255, 87, 34, 0.22);
  --accent: #FFA000;
  --bg-gradient: linear-gradient(135deg, #FFF9F6 0%, #F8FAFC 50%, #F1F5F9 100%);
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --surface-glass: rgba(255, 255, 255, 0.92);
  --text-main: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: rgba(226, 232, 240, 0.7);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 10px 30px -5px rgba(255, 87, 34, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-main);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}

/* ── Top Navigation Bar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
  width: 100%;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px var(--primary-glow);
  flex-shrink: 0;
}

.brand-img-icon,
.brand-link img {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  border-radius: 8px !important;
  object-fit: cover !important;
  box-shadow: 0 2px 8px var(--primary-glow);
  flex-shrink: 0 !important;
  display: inline-block !important;
  vertical-align: middle;
}

.brand-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  margin-left: 0.35rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.nav-item {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
}

/* ── Hero Header ────────────────────────────────────────────────────────── */
.hero-header {
  padding: 2.75rem 1.25rem 2rem;
  text-align: center;
  background: radial-gradient(circle at 50% 15%, rgba(255, 87, 34, 0.09) 0%, transparent 65%);
  border-bottom: 1px solid var(--border-light);
  width: 100%;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.hero-pill .dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(1.85rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 0.65rem;
  line-height: 1.2;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  max-width: 680px;
  margin: 0 auto 1.25rem;
  line-height: 1.6;
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ── Content Layout ─────────────────────────────────────────────────────── */
.doc-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 2rem;
  flex: 1;
}

/* ── Table of Contents (Desktop Sidebar & Mobile Accordion) ──────────────── */
.sidebar {
  position: sticky;
  top: 80px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.toc-link {
  display: block;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.86rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--primary);
  background: var(--primary-light);
  transform: translateX(3px);
}

/* ── Mobile TOC Dropdown ────────────────────────────────────────────────── */
.mobile-toc {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.15rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.mobile-toc summary {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}

.mobile-toc summary::-webkit-details-marker {
  display: none;
}

.mobile-toc[open] summary {
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.mobile-toc .toc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem;
}

/* ── Document Body ──────────────────────────────────────────────────────── */
.doc-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.75rem;
  box-shadow: var(--shadow-md);
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.doc-section {
  margin-bottom: 2.75rem;
  scroll-margin-top: 90px;
}

.section-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 0.45rem;
}

.doc-section h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 3.5vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  line-height: 1.3;
}

.doc-section h3 {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 2.5vw, 1.25rem);
  font-weight: 700;
  color: var(--text-main);
  margin: 1.35rem 0 0.5rem;
}

.doc-section p {
  color: var(--text-secondary);
  margin-bottom: 0.9rem;
  font-size: 0.98rem;
}

.doc-section ul, .doc-section ol {
  margin: 0.65rem 0 1.15rem 1.25rem;
  color: var(--text-secondary);
}

.doc-section li {
  margin-bottom: 0.45rem;
  padding-left: 0.2rem;
  font-size: 0.96rem;
}

.doc-section strong {
  color: var(--text-main);
}

/* ── Callout Box Designs ────────────────────────────────────────────────── */
.callout {
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-md);
  margin: 1.35rem 0;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.callout-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.callout-content {
  flex: 1;
  min-width: 0;
}

.callout-content strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.callout-content p {
  margin-bottom: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.callout-info {
  background: #EFF6FF;
  border-left: 4px solid #3B82F6;
  color: #1E40AF;
}
.callout-info strong { color: #1E3A8A; }
.callout-info p { color: #1E40AF; }

.callout-warning {
  background: #FFFBEB;
  border-left: 4px solid #F59E0B;
  color: #92400E;
}
.callout-warning strong { color: #78350F; }
.callout-warning p { color: #92400E; }

.callout-danger {
  background: #FEF2F2;
  border-left: 4px solid #EF4444;
  color: #991B1B;
}
.callout-danger strong { color: #7F1D1D; }
.callout-danger p { color: #991B1B; }

.callout-success {
  background: #F0FDF4;
  border-left: 4px solid #10B981;
  color: #166534;
}
.callout-success strong { color: #14532D; }
.callout-success p { color: #166534; }

/* ── Interactive Hub Cards (Index Page) ─────────────────────────────────── */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0;
}

.hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.85rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.hub-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 87, 34, 0.4);
}

.hub-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.hub-card:hover::before {
  opacity: 1;
}

.hub-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1.15rem;
  flex-shrink: 0;
}

.hub-card h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.hub-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  flex: 1;
  margin-bottom: 1.35rem;
  line-height: 1.55;
}

.hub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: all 0.2s ease;
  width: 100%;
}

.hub-btn:hover {
  transform: scale(1.01);
  box-shadow: 0 6px 16px var(--primary-glow);
}

/* ── Contact Section Box ────────────────────────────────────────────────── */
.contact-box {
  background: linear-gradient(135deg, #FFF6F2 0%, #FFFFFF 100%);
  border: 1px solid rgba(255, 87, 34, 0.25);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.contact-info {
  flex: 1;
  min-width: 220px;
}

.contact-info h4 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.contact-info p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
  overflow-wrap: break-word;
  word-break: break-all;
}

.contact-email-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.contact-email-btn:hover {
  background: var(--primary);
  color: #FFFFFF;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.25rem 1.25rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
  width: 100%;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.footer-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 600;
  transition: color 0.2s ease;
  font-size: 0.9rem;
}

.footer-link:hover {
  color: var(--primary);
}

/* ── Floating Action Buttons (Back to top / Print) ──────────────────────── */
.floating-actions {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 999;
}

.fab-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.fab-btn:hover {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* ── Responsive Mobile Media Queries ────────────────────────────────────── */
@media (max-width: 992px) {
  .doc-wrapper {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem 3.5rem;
  }
  .sidebar {
    display: none; /* Replaced by mobile-toc accordion */
  }
  .mobile-toc {
    display: block;
  }
  .doc-article {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-md);
  }
}

@media (max-width: 640px) {
  .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
  }
  .brand-link {
    justify-content: center;
    font-size: 1.15rem;
  }
  .nav-links {
    justify-content: center;
    width: 100%;
    gap: 0.35rem;
  }
  .nav-item {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
  .hero-header {
    padding: 1.75rem 1rem 1.5rem;
  }
  .hero-meta {
    flex-direction: column;
    gap: 0.35rem;
  }
  .hero-meta span:nth-child(2),
  .hero-meta span:nth-child(4) {
    display: none;
  }
  .doc-wrapper {
    padding: 1rem 0.75rem 3rem;
  }
  .doc-article {
    padding: 1.35rem 0.95rem;
    border-radius: 12px;
  }
  .doc-section {
    margin-bottom: 2rem;
  }
  .callout {
    padding: 0.95rem 1rem;
    gap: 0.65rem;
    flex-direction: column;
  }
  .contact-box {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 1.25rem 1rem;
  }
  .contact-email-btn {
    width: 100%;
  }
  .floating-actions {
    bottom: 15px;
    right: 15px;
  }
  .fab-btn {
    width: 38px;
    height: 38px;
  }
}
