/* ==========================================================================
   Calorie Calculator — Shared Design System
   Pure CSS. Colors: Red #FF3B3B, White #FFFFFF, Black #0F0F0F
   Scroll-based light→dark theme handled via JS-updated CSS variables.
   ========================================================================== */

:root {
  /* Brand */
  --red: #FF3B3B;
  --red-dark: #d92020;
  --red-light: #ff6b6b;
  --white: #FFFFFF;
  --black: #0F0F0F;

  /* Theme anchors (light) */
  --light-bg: #ffffff;
  --light-surface: #f6f7f9;
  --light-card: #ffffff;
  --light-text: #0F0F0F;
  --light-muted: #5b6068;
  --light-border: #e6e8ec;

  /* Theme anchors (dark) */
  --dark-bg: #0F0F0F;
  --dark-surface: #161616;
  --dark-card: #1c1c1f;
  --dark-text: #f5f5f7;
  --dark-muted: #a0a4ad;
  --dark-border: #2a2a30;

  /* Live theme variables — updated by JS on scroll. Default = light. */
  --bg: var(--light-bg);
  --surface: var(--light-surface);
  --card: var(--light-card);
  --text: var(--light-text);
  --muted: var(--light-muted);
  --border: var(--light-border);

  /* Misc */
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 4px 16px rgba(0,0,0,.06);
  --shadow: 0 12px 40px rgba(0,0,0,.10);
  --shadow-red: 0 12px 40px rgba(255,59,59,.28);
  --maxw: 1200px;
  --t: .35s cubic-bezier(.4,0,.2,1);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--t), color var(--t);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

h1,h2,h3,h4,h5,h6 { line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.6rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
p { color: var(--muted); transition: color var(--t); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
section { padding: 84px 0; position: relative; }
.section-tag {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--red); background: rgba(255,59,59,.10);
  padding: 7px 16px; border-radius: 100px; margin-bottom: 18px;
}
.section-head { text-align: center; max-width: 720px; margin: 0 auto 54px; }
.section-head h2 { margin-bottom: 14px; }
.text-red { color: var(--red); }

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-weight: 700; font-size: .98rem; padding: 14px 28px; border-radius: 100px;
  border: 1.5px solid transparent; transition: transform .25s, box-shadow .25s, background .25s, color .25s;
  font-family: var(--font); white-space: nowrap;
}
.btn-primary { background: var(--red); color: #fff; box-shadow: var(--shadow-red); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 18px 48px rgba(255,59,59,.42); background: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--red); color: var(--red); }
.btn-block { width: 100%; justify-content: center; }

/* ===================== Header ===================== */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--t), border-color var(--t);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--red), #ff7a3c); color: #fff; font-weight: 900;
  box-shadow: 0 6px 18px rgba(255,59,59,.4); flex: none;
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  position: relative; font-weight: 600; font-size: .95rem; padding: 9px 16px; border-radius: 100px;
  color: var(--text); transition: color .2s, background .2s;
}
.nav-links a::after {
  content: ''; position: absolute; left: 16px; right: 16px; bottom: 5px; height: 2px;
  background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .25s;
}
.nav-links a:hover { color: var(--red); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--red); }

.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.hamburger span { width: 24px; height: 2.5px; background: var(--text); border-radius: 3px; transition: .3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ===================== Hero ===================== */
.hero { padding: 70px 0 90px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero h1 { margin-bottom: 20px; }
.hero h1 .text-red { display: inline; }
.hero .lead { font-size: 1.1rem; max-width: 540px; margin-bottom: 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 34px; }
.feature-badges { display: flex; flex-wrap: wrap; gap: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600;
  padding: 8px 15px; border-radius: 100px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); transition: background var(--t), border-color var(--t), transform .2s;
}
.badge:hover { transform: translateY(-2px); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* 3D Cuboid */
.hero-art { display: grid; place-items: center; perspective: 1100px; min-height: 380px; }
.scene { width: 220px; height: 220px; position: relative; transform-style: preserve-3d;
  animation: float 6s ease-in-out infinite; }
.cube { width: 100%; height: 100%; position: relative; transform-style: preserve-3d;
  animation: spin 14s linear infinite; transform: rotateX(-20deg) rotateY(35deg); }
.cube .face {
  position: absolute; width: 220px; height: 220px; border-radius: 22px; opacity: .92;
  background: linear-gradient(145deg, #ff3b3b, #ff5fa2 35%, #8b5cff 65%, #2f7bff);
  box-shadow: inset 0 0 60px rgba(255,255,255,.35), 0 0 50px rgba(139,92,255,.45);
  border: 1px solid rgba(255,255,255,.25);
}
.cube .face::after {
  content:''; position:absolute; inset:0; border-radius:22px;
  background: linear-gradient(120deg, rgba(255,255,255,.55), transparent 45%);
}
.face.front  { transform: translateZ(110px); }
.face.back   { transform: rotateY(180deg) translateZ(110px); background: linear-gradient(145deg,#ff7a3c,#ff3b3b 40%,#8b5cff); }
.face.right  { transform: rotateY(90deg) translateZ(110px); background: linear-gradient(145deg,#ff5fa2,#8b5cff 60%,#2f7bff); }
.face.left   { transform: rotateY(-90deg) translateZ(110px); background: linear-gradient(145deg,#2f7bff,#8b5cff 50%,#ff3b3b); }
.face.top    { transform: rotateX(90deg) translateZ(110px); background: linear-gradient(145deg,#ff9a3c,#ff5fa2 50%,#8b5cff); }
.face.bottom { transform: rotateX(-90deg) translateZ(110px); background: linear-gradient(145deg,#8b5cff,#2f7bff); }
.hero-glow { position: absolute; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,59,59,.35), rgba(139,92,255,.18) 45%, transparent 70%);
  filter: blur(20px); z-index: -1; animation: pulse 5s ease-in-out infinite; }

@keyframes spin { from { transform: rotateX(-20deg) rotateY(0deg); } to { transform: rotateX(-20deg) rotateY(360deg); } }
@keyframes float { 0%,100% { transform: translateY(-16px); } 50% { transform: translateY(16px); } }
@keyframes pulse { 0%,100% { transform: scale(.95); opacity:.8; } 50% { transform: scale(1.08); opacity:1; } }

/* ===================== Calculator ===================== */
.calc-wrap { max-width: 980px; margin: 0 auto; }
.calc-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 24px;
  padding: 38px; box-shadow: var(--shadow); transition: background var(--t), border-color var(--t);
}
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-weight: 700; font-size: .9rem; }
.field input, .field select {
  font-family: var(--font); font-size: 1rem; padding: 13px 15px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg); color: var(--text);
  transition: border-color .2s, box-shadow .2s, background var(--t), color var(--t);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px rgba(255,59,59,.15); }
.calc-actions { display: flex; gap: 14px; margin-top: 26px; }

.results { margin-top: 34px; display: none; }
.results.show { display: block; animation: fadeUp .5s ease; }
.results-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.result-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; text-align: center; position: relative; overflow: hidden;
  transition: transform .3s, box-shadow .3s, background var(--t), border-color var(--t);
}
.result-card::before { content:''; position:absolute; inset:0 0 auto 0; height:4px; background: var(--red); transform: scaleX(0); transition: transform .3s; }
.result-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.result-card:hover::before { transform: scaleX(1); }
.result-card .label { font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.result-card .value { font-size: 2rem; font-weight: 900; color: var(--red); margin: 6px 0 2px; }
.result-card .unit { font-size: .8rem; color: var(--muted); }
.result-note { margin-top: 22px; padding: 18px 20px; background: var(--surface); border-left: 3px solid var(--red);
  border-radius: 10px; font-size: .92rem; transition: background var(--t); }
.result-note strong { color: var(--text); }

/* ===================== Feature cards ===================== */
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px; transition: transform .3s, box-shadow .3s, border-color .3s, background var(--t);
  position: relative;
}
.feature-card::after {
  content:''; position:absolute; inset:0; border-radius: var(--radius); padding:1px;
  background: linear-gradient(135deg, var(--red), #8b5cff); opacity:0; transition: opacity .3s;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events:none;
}
.feature-card:hover { transform: translateY(-8px); box-shadow: var(--shadow); }
.feature-card:hover::after { opacity:1; }
.feature-icon {
  width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem;
  background: rgba(255,59,59,.12); color: var(--red); margin-bottom: 18px;
}
.feature-card h3 { margin-bottom: 10px; }

/* ===================== Stats ===================== */
.stats { background: var(--surface); transition: background var(--t); }
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 24px; text-align: center; }
.stat .num { font-size: clamp(2.2rem,5vw,3.2rem); font-weight: 900;
  background: linear-gradient(135deg, var(--red), #ff7a3c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { font-weight: 600; color: var(--muted); margin-top: 4px; }

/* ===================== Testimonials ===================== */
.test-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.test-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px;
  transition: transform .3s, box-shadow .3s, background var(--t);
}
.test-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.test-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; color:#fff; font-weight: 800; flex:none; }
.test-head .who strong { display: block; }
.test-head .who span { font-size: .85rem; color: var(--muted); }
.stars { color: #ffb400; letter-spacing: 2px; margin-bottom: 10px; }
.test-card p { font-size: .95rem; }

/* ===================== FAQ ===================== */
.faq-list { max-width: 820px; margin: 0 auto; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 14px;
  background: var(--card); overflow: hidden; transition: background var(--t), border-color var(--t); }
.faq-q { width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font-family: var(--font); font-weight: 700; font-size: 1.02rem; color: var(--text);
  padding: 20px 22px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.faq-q .ico { color: var(--red); font-size: 1.4rem; transition: transform .3s; flex: none; }
.faq-item.open .faq-q .ico { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.faq-a p { padding: 0 22px 20px; font-size: .95rem; }

/* ===================== CTA band ===================== */
.cta-band { text-align: center; }
.cta-box {
  position: relative; overflow: hidden; border-radius: 28px; padding: 70px 30px;
  background: linear-gradient(135deg, #ff3b3b, #d92020 55%, #8b1f1f);
  color: #fff; box-shadow: var(--shadow-red);
}
.cta-box h2 { color: #fff; margin-bottom: 14px; }
.cta-box p { color: rgba(255,255,255,.9); max-width: 560px; margin: 0 auto 28px; }
.cta-box .btn-primary { background: #fff; color: var(--red); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.cta-box .btn-primary:hover { background: #0F0F0F; color: #fff; }
.float-el { position: absolute; border-radius: 50%; background: rgba(255,255,255,.14); animation: float 7s ease-in-out infinite; }
.float-el.a { width: 120px; height: 120px; top: -30px; left: 8%; }
.float-el.b { width: 80px; height: 80px; bottom: -20px; right: 12%; animation-delay: 1.5s; }
.float-el.c { width: 160px; height: 160px; bottom: -60px; left: 40%; animation-delay: 3s; }

/* ===================== Article / SEO content ===================== */
.article { max-width: 860px; margin: 0 auto; }
.article h2 { margin: 0 0 16px; }
.article h3 { margin: 28px 0 10px; }
.article p { margin-bottom: 16px; }
.article ul.bullets { margin: 0 0 18px; padding-left: 4px; }
.article ul.bullets li { position: relative; padding-left: 28px; margin-bottom: 10px; color: var(--muted); }
.article ul.bullets li::before { content:'✓'; position:absolute; left:0; color: var(--red); font-weight: 800; }
.article .block { margin-bottom: 46px; }

/* ===================== Footer ===================== */
.site-footer { background: var(--dark-bg); color: var(--dark-muted); padding: 64px 0 26px; position: relative; }
.site-footer::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background: linear-gradient(90deg, var(--red), #8b5cff, #2f7bff); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 44px; }
.site-footer .brand { color: #fff; margin-bottom: 16px; }
.footer-about p { color: #9a9da6; font-size: .92rem; margin-bottom: 18px; max-width: 320px; }
.socials { display: flex; gap: 12px; }
.socials a { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: #1c1c1f; color: #cfd2d8; border: 1px solid #2a2a30; transition: transform .25s, background .25s, color .25s, box-shadow .25s; }
.socials a:hover { transform: translateY(-4px) scale(1.08); color: #fff; }
.socials a.fb:hover { background:#1877F2; box-shadow:0 8px 22px rgba(24,119,242,.5); }
.socials a.ig:hover { background:#E4405F; box-shadow:0 8px 22px rgba(228,64,95,.5); }
.socials a.tw:hover { background:#000; box-shadow:0 8px 22px rgba(0,0,0,.6); }
.socials a.li:hover { background:#0A66C2; box-shadow:0 8px 22px rgba(10,102,194,.5); }
.footer-col h4 { color: #fff; font-size: 1rem; margin-bottom: 18px; }
.footer-col a { display: inline-block; color: #9a9da6; font-size: .93rem; padding: 6px 0; position: relative; transition: color .2s, padding .2s; }
.footer-col a::after { content:''; position:absolute; left:0; bottom:4px; width:0; height:1.5px; background: var(--red); transition: width .25s; }
.footer-col a:hover { color: #fff; padding-left: 6px; }
.footer-col a:hover::after { width: 16px; }
.footer-bottom { border-top: 1px solid #2a2a30; padding-top: 22px; text-align: center; font-size: .88rem; color: #777b84; }
.footer-bottom a { color: #b9bcc3; }
.footer-bottom a:hover { color: var(--red); }

/* ===================== Contact form ===================== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.contact-form { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow-sm); transition: background var(--t), border-color var(--t); }
.info-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; transition: background var(--t); }
.info-card .feature-icon { margin-bottom: 12px; }
.form-note { margin-top: 16px; font-size: .9rem; display: none; color: var(--red); font-weight: 600; }
.form-note.show { display: block; }

/* ===================== Scroll reveal ===================== */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@keyframes fadeUp { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform:none; } }

/* ===================== Page hero (sub pages) ===================== */
.page-hero { padding: 70px 0 50px; text-align: center; }
.page-hero p { max-width: 640px; margin: 14px auto 0; font-size: 1.05rem; }

/* ===================== Responsive ===================== */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero .lead { margin-left:auto; margin-right:auto; }
  .hero-cta, .feature-badges { justify-content: center; }
  .hero-art { order: -1; min-height: 320px; }
  .cards-grid, .test-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .results-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}
@media (max-width: 760px) {
  .nav-links {
    position: fixed; inset: 72px 0 auto 0; flex-direction: column; gap: 0; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 10px 18px 22px;
    transform: translateY(-130%); transition: transform .35s ease; box-shadow: var(--shadow);
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 14px 8px; border-radius: 10px; }
  .nav-links a::after { display: none; }
  .hamburger { display: flex; }
  section { padding: 60px 0; }
  .calc-grid { grid-template-columns: 1fr; }
  .calc-actions { flex-direction: column; }
}
@media (max-width: 560px) {
  .cards-grid, .test-grid, .stats-grid, .results-grid, .footer-grid { grid-template-columns: 1fr; }
  .calc-card { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .cube, .scene, .hero-glow, .float-el { animation: none !important; }
}
