/* =========================================
   calories-macros.com — Global Stylesheet
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=DM+Serif+Display:ital@0;1&display=swap');

/* --- Tokens --- */
:root {
  --green:       #2D6A4F;
  --green-light: #52B788;
  --green-pale:  #D8F3DC;
  --cream:       #F9F6F0;
  --ink:         #1A1A18;
  --muted:       #6B7280;
  --border:      #E5E7EB;
  --white:       #FFFFFF;
  --accent:      #E76F51;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --max-w: 860px;
  --max-w-wide: 1100px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
}
img { max-width: 100%; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Utility --- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.container--wide { max-width: var(--max-w-wide); margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =========================================
   HEADER / NAV
   ========================================= */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max-w-wide); margin: 0 auto; padding: 0 20px;
  height: 60px;
}
.site-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--green);
  font-weight: 400;
  text-decoration: none;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-logo .logo-icon { font-size: 1.4rem; flex-shrink: 0; }
.site-nav { display: flex; align-items: center; gap: 24px; }
.site-nav a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.site-nav a:hover, .site-nav a.active { color: var(--green); text-decoration: none; }
.lang-toggle {
  display: flex; gap: 6px; margin-left: 12px;
}
.lang-toggle button {
  background: none; border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.8rem; cursor: pointer; color: var(--muted);
  font-family: var(--font-body);
  transition: all 0.2s;
}
.lang-toggle button.active, .lang-toggle button:hover {
  background: var(--green); color: white; border-color: var(--green);
}

/* =========================================
   HERO
   ========================================= */
.hero {
  background: linear-gradient(135deg, var(--green) 0%, #1B4332 100%);
  color: white;
  padding: 72px 20px 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; max-width: 640px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  padding: 4px 14px; border-radius: 20px;
  font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 20px; font-weight: 500;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15;
  margin-bottom: 16px;
  font-weight: 400;
}
.hero h1 em { font-style: italic; color: var(--green-pale); }
.hero p {
  font-size: 1.05rem; opacity: 0.88;
  margin-bottom: 32px; max-width: 480px; margin-left: auto; margin-right: auto;
}
.hero-stats {
  display: flex; justify-content: center; gap: 40px; flex-wrap: wrap;
  margin-bottom: 40px;
}
.hero-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--green-pale);
}
.hero-stat span { font-size: 0.82rem; opacity: 0.75; }
.btn-scroll {
  display: inline-block;
  background: white; color: var(--green);
  padding: 13px 32px; border-radius: 40px;
  font-weight: 600; font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.btn-scroll:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.2); text-decoration: none; }

/* =========================================
   CALCULATOR SECTION
   ========================================= */
.calc-section {
  padding: 64px 20px;
  background: var(--cream);
}
.section-label {
  text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 0.75rem; font-weight: 600;
  color: var(--green); margin-bottom: 10px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 8px;
}
.section-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 40px;
}

.calc-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
  max-width: 680px;
  margin: 0 auto;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 540px) { .calc-grid { grid-template-columns: 1fr; } }

.field label {
  display: block;
  font-size: 0.82rem; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--green-light);
  background: white;
}

.gender-toggle {
  display: flex; gap: 10px;
}
.gender-btn {
  flex: 1; padding: 11px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.2s;
}
.gender-btn.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.btn-calc {
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem; font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  margin-top: 4px;
}
.btn-calc:hover { background: #245741; transform: translateY(-1px); }

/* Results */
.calc-results {
  display: none;
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.calc-results.visible { display: block; }

.results-headline {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--ink);
}

.calories-display {
  text-align: center;
  background: var(--green-pale);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
}
.calories-display .kcal-number {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--green);
  line-height: 1;
}
.calories-display .kcal-label {
  font-size: 0.85rem; color: var(--muted); margin-top: 4px;
}

.macros-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 24px;
}
.macro-item {
  background: var(--cream);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.macro-item .macro-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--ink);
}
.macro-item .macro-name {
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-top: 2px;
}
.macro-item .macro-pct {
  font-size: 0.75rem; color: var(--green); margin-top: 2px;
}

.macro-bars { margin-bottom: 20px; }
.macro-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.macro-bar-row span:first-child { width: 80px; font-size: 0.85rem; color: var(--muted); }
.macro-bar-track { flex: 1; background: var(--border); border-radius: 4px; height: 8px; overflow: hidden; }
.macro-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.bar-protein { background: var(--green-light); }
.bar-carbs   { background: #F4A261; }
.bar-fat     { background: #E76F51; }
.macro-bar-row span:last-child { width: 36px; font-size: 0.82rem; text-align: right; color: var(--ink); }

.result-note {
  font-size: 0.83rem; color: var(--muted);
  background: var(--cream); border-radius: 8px; padding: 12px 16px;
  border-left: 3px solid var(--green-light);
}

/* =========================================
   HOW IT WORKS
   ========================================= */
.how-section {
  background: var(--white);
  padding: 64px 20px;
  border-top: 1px solid var(--border);
}
.steps-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px; margin-top: 40px;
}
.step {
  position: relative;
}
.step-num {
  font-family: var(--font-display);
  font-size: 3.5rem;
  color: var(--green-pale);
  line-height: 1;
  margin-bottom: 12px;
}
.step h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.step p { font-size: 0.88rem; color: var(--muted); line-height: 1.6; }

/* =========================================
   BLOG SECTION
   ========================================= */
.blog-section {
  padding: 64px 20px;
  background: var(--cream);
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 36px;
}
.blog-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.blog-card-body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.blog-tag {
  display: inline-block;
  background: var(--green-pale);
  color: var(--green);
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 3px 10px; border-radius: 20px;
  margin-bottom: 10px;
}
.blog-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.blog-card p { font-size: 0.85rem; color: var(--muted); line-height: 1.6; flex: 1; }
.blog-read-more {
  margin-top: 16px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--green);
  display: flex; align-items: center; gap: 4px;
}

/* =========================================
   FAQ SECTION
   ========================================= */
.faq-section {
  background: var(--white);
  padding: 64px 20px;
  border-top: 1px solid var(--border);
}
.faq-list { margin-top: 36px; max-width: 680px; margin-left: auto; margin-right: auto; }
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-question {
  width: 100%;
  background: none; border: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 0;
  font-family: var(--font-body);
  font-size: 0.97rem; font-weight: 600;
  color: var(--ink); text-align: left;
}
.faq-question::after {
  content: '+'; font-size: 1.4rem; color: var(--green);
  flex-shrink: 0; transition: transform 0.25s;
}
.faq-item.open .faq-question::after { transform: rotate(45deg); }
.faq-answer {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s ease, padding 0.3s;
  font-size: 0.9rem; color: var(--muted); line-height: 1.7;
}
.faq-item.open .faq-answer { max-height: 300px; padding-bottom: 18px; }

/* =========================================
   FOOTER
   ========================================= */
.site-footer {
  background: var(--ink);
  color: rgba(255,255,255,0.6);
  padding: 48px 20px 32px;
  font-size: 0.85rem;
}
.footer-inner {
  max-width: var(--max-w-wide); margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: start;
}
.footer-brand .site-logo { color: rgba(255,255,255,0.9); margin-bottom: 10px; }
.footer-brand p { font-size: 0.82rem; line-height: 1.6; max-width: 300px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; text-align: right; }
.footer-links a { color: rgba(255,255,255,0.55); transition: color 0.2s; }
.footer-links a:hover { color: white; }
.footer-bottom {
  max-width: var(--max-w-wide); margin: 32px auto 0;
  padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem;
}
@media (max-width: 600px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { text-align: left; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}

/* =========================================
   BLOG / ARTICLE PAGES
   ========================================= */
.page-hero {
  background: linear-gradient(135deg, var(--green) 0%, #1B4332 100%);
  color: white;
  padding: 56px 20px 64px;
}
.breadcrumb {
  font-size: 0.8rem; opacity: 0.7; margin-bottom: 16px;
}
.breadcrumb a { color: rgba(255,255,255,0.8); }
.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 400; line-height: 1.2;
  max-width: 680px; margin-bottom: 12px;
}
.page-hero .meta { font-size: 0.85rem; opacity: 0.7; }

.article-body {
  max-width: 720px; margin: 0 auto; padding: 56px 20px;
}
.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 400;
  margin: 44px 0 14px;
  color: var(--ink);
}
.article-body h3 {
  font-size: 1.05rem; font-weight: 600;
  margin: 28px 0 10px;
}
.article-body p { margin-bottom: 18px; color: #374151; }
.article-body ul, .article-body ol {
  margin: 0 0 18px 24px;
}
.article-body li { margin-bottom: 6px; color: #374151; }
.article-body .callout {
  background: var(--green-pale);
  border-left: 4px solid var(--green);
  padding: 16px 20px; border-radius: 0 8px 8px 0;
  margin: 28px 0;
  font-size: 0.92rem;
}
.article-body .callout strong { color: var(--green); }
.article-body table {
  width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 0.9rem;
}
.article-body th {
  background: var(--green); color: white;
  padding: 10px 14px; text-align: left;
}
.article-body td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.article-body tr:nth-child(even) td { background: var(--cream); }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--green); font-size: 0.88rem; font-weight: 500;
  margin-bottom: 8px;
}

/* Blog index */
.blog-header { padding: 56px 20px 0; }
.blog-listing { padding: 40px 20px 64px; }

/* About / Static pages */
.static-body {
  max-width: 720px; margin: 0 auto; padding: 56px 20px 80px;
}
.static-body h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 400; margin-bottom: 8px;
}
.static-body .intro { color: var(--muted); font-size: 1rem; margin-bottom: 40px; }
.static-body h2 {
  font-size: 1.15rem; font-weight: 600; margin: 36px 0 12px;
}
.static-body p, .static-body li { color: #374151; line-height: 1.75; margin-bottom: 14px; }
.static-body ul { margin-left: 24px; }

/* Contact form */
.contact-form { max-width: 520px; }
.contact-form .field { margin-bottom: 18px; }
.contact-form textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--cream);
  resize: vertical; min-height: 130px;
  color: var(--ink);
}
.contact-form textarea:focus {
  outline: none; border-color: var(--green-light); background: white;
}
.btn-submit {
  background: var(--green); color: white;
  border: none; border-radius: 8px;
  padding: 13px 32px; font-size: 1rem; font-weight: 600;
  font-family: var(--font-body); cursor: pointer;
  transition: background 0.2s;
}
.btn-submit:hover { background: #245741; }

/* =========================================
   MOBILE NAV
   ========================================= */
.hamburger {
  display: none; background: none; border: none; cursor: pointer; padding: 8px;
  flex-direction: column; justify-content: center; align-items: center; gap: 0;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--ink); margin: 4px 0; border-radius: 2px;
  transition: all 0.3s; flex-shrink: 0;
}

/* Lang toggle always visible in header on mobile */
.header-lang {
  display: none;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.header-lang button {
  background: none; border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.8rem; cursor: pointer; color: var(--muted);
  font-family: var(--font-body);
  transition: all 0.2s;
}
.header-lang button.active, .header-lang button:hover {
  background: var(--green); color: white; border-color: var(--green);
}

@media (max-width: 680px) {
  .hamburger { display: flex !important; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; min-width: 32px; gap: 0; }
  .header-lang { display: flex; flex-shrink: 0; gap: 4px; }
  .header-lang button { padding: 2px 7px; font-size: 0.72rem; }
  .site-logo { font-size: 1rem; }
  .site-logo .logo-icon { font-size: 1.1rem; }
  /* Hide lang toggle inside nav on mobile */
  .site-nav .lang-toggle { display: none; }
  .site-nav {
    display: none;
    position: fixed; inset: 60px 0 0 0;
    background: white; flex-direction: column;
    padding: 32px 24px; gap: 16px; z-index: 99;
    border-top: 1px solid var(--border);
  }
  .site-nav.open { display: flex; }
  .site-nav a { font-size: 1.1rem; }
}
@media (max-width: 360px) {
  .site-logo .logo-icon { display: none; }
  .site-logo { font-size: 0.9rem; }
}

/* =========================================
   AD PLACEHOLDER STYLES (AdSense-ready)
   ========================================= */
.ad-slot {
  background: var(--cream);
  border: 1px dashed var(--border);
  border-radius: 8px;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  margin: 32px 0;
  overflow: hidden;
}
.ad-slot--leaderboard { min-height: 90px; }
.ad-slot--rectangle { min-height: 250px; max-width: 300px; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 600px) {
  .calc-card { padding: 24px 18px; }
  .macros-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .macro-item { padding: 12px 8px; }
  .macro-item .macro-value { font-size: 1.3rem; }
  .hero { padding: 48px 20px 56px; }
  .hero-stats { gap: 24px; }
  .steps-grid { grid-template-columns: 1fr 1fr; }
}
