/* ========================================
   NutriSage - Shared Stylesheet
   ======================================== */

/* --- CSS Variables (aligned with app AppColors) --- */
:root {
  --card-background: #1B2A4A;
  --container-background: #152238;
  --screen-highlight: #2A3A6E;
  --screen-background-main: #0B1426;

  --primary: #4E56C1;
  --primary-hover: #3F47B0;
  --secondary: #8B92E8;
  --bg: var(--screen-background-main);
  --card: var(--card-background);
  --surface: var(--container-background);
  --text: #FFFFFF;
  --muted: #A0AEC0;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-btn: 12px;
  --nav-height: 72px;
  --container: 1100px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: 0.25s ease;
}

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

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

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, var(--screen-highlight) 0%, transparent 55%),
    var(--screen-background-main);
  background-color: var(--screen-background-main);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 1rem;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --- Typography --- */
h1 {
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  color: var(--muted);
  font-size: 1.0625rem;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
}

/* --- Navigation --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 20, 38, 0.88);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  transition: opacity var(--transition);
}

.nav-brand:hover,
.nav-brand:focus-visible {
  opacity: 0.85;
}

.nav-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.nav-brand-name {
  height: 28px;
  width: auto;
}

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

.nav-links a {
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  background: rgba(78, 86, 193, 0.15);
}

.nav-links a[aria-current="page"] {
  color: var(--secondary);
  font-weight: 600;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text);
  transition: background var(--transition);
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: rgba(78, 86, 193, 0.15);
}

.nav-toggle-icon {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  position: relative;
  border-radius: 2px;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.nav-toggle-icon::before {
  top: -6px;
}

.nav-toggle-icon::after {
  top: 6px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition), color var(--transition);
  text-align: center;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(78, 86, 193, 0.4);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(78, 86, 193, 0.45);
}

.btn-secondary {
  background: var(--surface);
  color: var(--secondary);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
}

/* --- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

/* --- Hero --- */
.hero {
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--secondary);
  background: rgba(78, 86, 193, 0.2);
  border-radius: 999px;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.hero h1 {
  margin-bottom: 0.75rem;
}

.hero-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}

.hero-logo-icon {
  width: 112px;
  height: 112px;
  border-radius: 28px;
  object-fit: cover;
}

.hero-logo-name {
  height: clamp(40px, 8vw, 64px);
  width: auto;
}

.hero-title-accent {
  color: var(--primary);
}

.hero-tagline {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 500;
  color: var(--secondary);
  margin-bottom: 1.25rem;
}

.hero-desc {
  max-width: 560px;
  margin: 0 auto 2.25rem;
  font-size: 1.125rem;
  line-height: 1.7;
}

.hero-page {
  padding: 4rem 0 3rem;
  text-align: center;
}

.hero-page h1 {
  margin-bottom: 1rem;
}

.hero-page p {
  max-width: 520px;
  margin: 0 auto;
  font-size: 1.125rem;
}

/* --- Features --- */
.features {
  padding: 2rem 0 5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.feature-card {
  text-align: left;
}

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 1.25rem;
  color: var(--secondary);
}

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

.feature-card h3 {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.feature-card p {
  font-size: 0.975rem;
  line-height: 1.65;
}

/* --- CTA --- */
.cta {
  padding: 0 0 5rem;
}

.cta-card {
  text-align: center;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--card-background) 0%, var(--container-background) 100%);
  border: 1px solid rgba(78, 86, 193, 0.25);
}

.cta-card:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.cta-card h2 {
  margin-bottom: 0.75rem;
}

.cta-card p {
  margin-bottom: 1.75rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Support Page --- */
.support-section {
  padding: 0 0 3rem;
}

.support-card {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

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

.support-card p {
  margin-bottom: 1.75rem;
}

/* --- FAQ --- */
.faq {
  padding: 1rem 0 5rem;
}

.faq-header {
  text-align: center;
  margin-bottom: 2rem;
}

.faq-header h2 {
  margin-bottom: 0.5rem;
}

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.faq-item:hover {
  box-shadow: var(--shadow-hover);
}

.faq-item[open] {
  border-color: rgba(78, 86, 193, 0.45);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.faq-item summary::after {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23A0AEC0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  transition: transform var(--transition);
}

.faq-item[open] summary::after {
  transform: rotate(180deg);
}

.faq-item summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: var(--radius);
}

.faq-answer {
  padding: 0 1.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.975rem;
  line-height: 1.7;
  border-top: 1px solid transparent;
}

.faq-item[open] .faq-answer {
  border-top-color: var(--border);
  padding-top: 1rem;
  margin-top: 0;
}

/* --- Privacy Page --- */
.privacy-section {
  padding: 0 0 5rem;
}

.notice-card {
  max-width: 560px;
  margin: 0 auto 2rem;
  text-align: center;
  padding: 3rem 2rem;
}

.notice-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 14px;
  color: var(--secondary);
}

.notice-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notice-card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.notice-card p {
  margin-bottom: 0.75rem;
}

.notice-card p:last-of-type {
  margin-bottom: 0;
}

.privacy-meta {
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted);
}

.privacy-meta strong {
  color: var(--text);
  font-weight: 600;
}

/* --- Footer --- */
.site-footer {
  background: var(--container-background);
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity var(--transition);
}

.footer-brand:hover,
.footer-brand:focus-visible {
  opacity: 0.85;
}

.footer-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.footer-brand-name {
  height: 22px;
  width: auto;
}

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

.footer-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--transition);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--primary);
}

.footer-copy {
  width: 100%;
  margin-top: 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
}

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

/* --- Responsive --- */
@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto;
  }
}

@media (max-width: 700px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--container-background);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem 1rem;
    box-shadow: var(--shadow);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    padding: 0.875rem 1rem;
  }

  .hero {
    padding: 3.5rem 0 3rem;
  }

  .hero-page {
    padding: 3rem 0 2.5rem;
  }

  .btn-group {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

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