/* KetoSaviour, blog reading kit. Extends site tokens from /style.css :root. */
:root {
  --read-max: 720px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

.blog-body { background: var(--bg-sand); }
.container-narrow { max-width: 820px; margin: 0 auto; padding: 0 22px; }

/* reading progress */
.reading-progress { position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 60; background: transparent; }
.reading-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary-green), var(--accent-gold)); transition: width .1s linear; }

.blog-navbar { position: sticky; top: 0; z-index: 50; }

/* hero */
.article-main { padding: 34px 0 80px; }
.article-hero { text-align: center; margin-bottom: 26px; }
.article-kicker { font-family: var(--font-serif); font-style: italic; color: var(--primary-green); font-size: 1.05rem; margin-bottom: 10px; }
.article-title { font-size: clamp(1.9rem, 5vw, 3.1rem); line-height: 1.12; letter-spacing: -0.02em; }
.article-meta { color: var(--text-muted); font-size: .92rem; margin-top: 12px; }
.article-body { font-size: 1.09rem; line-height: 1.75; color: var(--text-main); }
.article-body p { margin: 0 0 1.15em; }
.article-body h2 { font-size: clamp(1.4rem, 3.4vw, 2rem); margin: 2.1em 0 .5em; line-height: 1.2; letter-spacing: -0.01em; }
.article-body h3 { font-size: 1.28rem; margin: 1.7em 0 .4em; }
.article-body a { color: var(--primary-green); text-decoration: underline; text-underline-offset: 3px; }
.article-body ul, .article-body ol { margin: 0 0 1.2em 1.2em; }
.article-body li { margin-bottom: .45em; }
.article-body blockquote { border-left: 3px solid var(--accent-gold); padding: .3em 0 .3em 1.1em; color: var(--text-muted); font-style: italic; margin: 1.4em 0; }
.article-body hr { border: 0; height: 1px; background: var(--border-light); margin: 2.4em 0; }

/* smart images */
.smart-img { margin: 2em 0; }
.smart-img__frame { border-radius: var(--radius-lg); overflow: hidden; background: linear-gradient(100deg, var(--accent-soft-green), var(--accent-salmon)); box-shadow: var(--shadow-soft); }
.smart-img img { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; opacity: 0; transition: opacity .6s var(--ease-out); }
.smart-img img.is-loaded { opacity: 1; }
.smart-img figcaption { color: var(--text-muted); font-size: .85rem; margin-top: .55em; text-align: center; }
.smart-img--wide { margin-left: calc(50% - 50vw + 22px); margin-right: calc(50% - 50vw + 22px); }

/* pull quote */
.pullquote { margin: 2.2em 0; padding: 1.3em 1.5em; background: var(--accent-soft-green); border-radius: var(--radius-md); border: 0; }
.pullquote p { font-family: var(--font-serif); font-style: italic; font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 1.35; color: var(--primary-green); margin: 0; }

/* stat card */
.stat-card { margin: 2em auto; text-align: center; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 1.6em 1.4em; box-shadow: var(--shadow-soft); }
.stat__value { font-size: clamp(2.2rem, 7vw, 3.4rem); font-weight: 800; color: var(--primary-green); line-height: 1; }
.stat__label { margin-top: .5em; font-weight: 600; }
.stat__sub { color: var(--text-muted); font-size: .9rem; margin-top: .25em; }

/* margin note */
.margin-note { background: var(--accent-salmon); border-radius: var(--radius-md); padding: .9em 1.1em; font-size: .95rem; color: var(--text-main); margin: 1.4em 0; }

/* inline cta */
.inline-cta { margin: 2.4em 0; padding: 1.7em; background: var(--primary-green); color: #fff; border-radius: var(--radius-lg); text-align: center; }
.inline-cta h3 { color: #fff; margin: 0 0 .35em; font-size: 1.35rem; }
.inline-cta p { color: rgba(255,255,255,.88); margin: 0 0 1em; }
.cta-form { display: flex; gap: .5em; max-width: 460px; margin: 0 auto; flex-wrap: wrap; justify-content: center; }
.cta-form input { flex: 1 1 220px; min-width: 0; padding: .8em 1em; border-radius: 999px; border: 0; font-size: 1rem; }
.cta-form button { flex: 0 0 auto; padding: .8em 1.5em; border-radius: 999px; border: 0; background: var(--accent-gold); color: var(--text-main); font-weight: 700; cursor: pointer; }

/* divider */
.section-divider { display: flex; justify-content: center; margin: 2.6em 0; }
.section-divider span { display: block; width: 0; height: 3px; border-radius: 3px; background: var(--primary-green); transition: width 1s var(--ease-out); }
.section-divider.is-in span { width: 68px; }

/* toc */
.toc { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 1.1em 1.3em; margin: 1.8em 0; }
.toc__title { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .6em; }
.toc ol { margin: 0 0 0 1.1em; }
.toc li { margin-bottom: .3em; }
.toc a { color: var(--primary-green); text-decoration: none; }
.toc a.is-active { font-weight: 700; text-decoration: underline; }

/* footer */
.article-footer { margin-top: 3em; }
.article-disclaimer { font-size: .85rem; color: var(--text-muted); background: var(--accent-soft-green); border-radius: var(--radius-md); padding: 1em 1.2em; }
.back-link { display: inline-block; margin-top: 1.2em; color: var(--primary-green); font-weight: 600; text-decoration: none; }

/* hub */
.blog-hub { padding: 40px 22px 80px; }
.hub-hero { text-align: center; margin-bottom: 34px; }
.hub-hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.hub-sub { color: var(--text-muted); margin-top: .6em; }
.post-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
.post-card { display: block; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow-soft); transition: transform .3s var(--ease-out); }
.post-card:hover { transform: translateY(-4px); }
.card-thumb { height: 180px; background-size: cover; background-position: center; }
.card-thumb--empty { background: linear-gradient(100deg, var(--accent-soft-green), var(--accent-salmon)); }
.card-body { padding: 1.2em 1.3em 1.4em; }
.card-body h2 { font-size: 1.2rem; margin-bottom: .4em; }
.card-body p { color: var(--text-muted); font-size: .95rem; }
.card-more { display: inline-block; margin-top: .7em; color: var(--primary-green); font-weight: 700; }

/* reveal animation */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
[data-reveal].is-in { opacity: 1; transform: none; }

@media (min-width: 700px) {
  .post-grid { grid-template-columns: 1fr 1fr; }
  .smart-img--inset { float: right; width: 45%; margin: 0 0 1em 1.6em; }
}

/* youtube facade */
.yt-embed { margin: 2em 0; }
.yt-embed__facade { position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer; border-radius: var(--radius-lg); overflow: hidden; background: #000; }
.yt-embed__facade img { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; opacity: .82; transition: opacity .3s var(--ease-out); }
.yt-embed__facade:hover img { opacity: 1; }
.yt-embed__play { position: absolute; top: 50%; left: 50%; width: 68px; height: 48px; transform: translate(-50%,-50%); background: var(--accent-gold); border-radius: 12px; }
.yt-embed__play::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-40%,-50%); border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent var(--text-main); }
.yt-embed__frame { position: relative; }
.yt-embed__frame iframe { display: block; width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius-lg); }
.yt-embed figcaption { color: var(--text-muted); font-size: .85rem; margin-top: .55em; text-align: center; }

/* scroll mascot (desktop side-margin) */
.mascot { position: fixed; top: 0; right: clamp(6px, 3.5vw, 60px); z-index: 40; pointer-events: none; will-change: transform; filter: drop-shadow(0 14px 22px rgba(0,0,0,.14)); }
.mascot__svg { display: block; }
/* easter-egg affordance: real control, keyboard reachable, 44px minimum touch */
.mascot--live { pointer-events: auto; cursor: pointer; opacity: .82; border-radius: 14px;
  transition: opacity .18s ease, transform .18s ease; }
.mascot--live:hover { opacity: 1; }
.mascot--live:focus-visible { outline: 2px solid var(--primary-green, #205E44); outline-offset: 4px; opacity: 1; }
@media (max-width: 1099px) {
  .mascot { right: max(10px, env(safe-area-inset-right)); }
  .mascot__svg { width: 52px; height: 64px; }
}
.egg-toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 90;
  background: #205E44; color: #fff; font-family: inherit; font-size: .92rem; line-height: 1.4;
  padding: 12px 18px; border-radius: 999px; box-shadow: 0 12px 30px rgba(0,0,0,.22);
  max-width: min(92vw, 460px); text-align: center; transition: opacity .22s ease, transform .22s ease; }
.egg-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .smart-img img { opacity: 1 !important; }
  .section-divider span { width: 68px !important; transition: none !important; }
  .reading-progress span { transition: none !important; }
  .mascot { top: 52vh !important; }
}

/* related reading (auto) */
.related { margin-top: 3em; }
.related-head { font-size: 1.3rem; margin-bottom: .8em; }
.related-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .related-grid { grid-template-columns: 1fr 1fr; } }
.related-card { display: block; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 1em 1.1em; text-decoration: none; color: inherit; box-shadow: var(--shadow-soft); transition: transform .3s var(--ease-out); }
.related-card:hover { transform: translateY(-3px); }
.related-title { display: block; font-weight: 700; line-height: 1.25; }
.related-desc { display: block; color: var(--text-muted); font-size: .88rem; margin-top: .35em; }

/* products mentioned box (in-article, end, above disclaimer) */
.products-mentioned { margin: 2.4em 0 1.4em; padding: 1.1em 1.25em; background: var(--bg-card); border: 1px solid var(--border-light); border-left: 3px solid #205E44; border-radius: var(--radius-md); box-shadow: var(--shadow-soft); }
.products-mentioned .pm-title { font-size: 1rem; margin: 0 0 .6em; letter-spacing: .01em; }
.products-mentioned .pm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6em; }
.products-mentioned .pm-list li { margin: 0; line-height: 1.4; }
.products-mentioned .pm-list a { font-weight: 600; }
.products-mentioned .pm-why { display: block; color: var(--text-muted); font-size: .86rem; }
.products-mentioned .pm-note { margin: .8em 0 0; color: var(--text-muted); font-size: .78rem; }

/* ---- Mega-menu (shared header) ---- */
.nav-menu--mega { gap: 8px; }
.mega { position: relative; }
.mega__trigger { display:inline-flex; align-items:center; gap:6px; background:transparent; border:0; cursor:pointer; color:var(--text-muted); font-weight:500; font-size:.95rem; padding:8px 4px; font-family:inherit; }
.mega__trigger:hover, .mega__trigger[aria-expanded="true"], .mega__trigger.is-current { color:var(--primary-green); }
.mega__chev { width:7px; height:7px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg) translateY(-1px); transition:transform .2s; }
.mega__trigger[aria-expanded="true"] .mega__chev { transform:rotate(-135deg) translateY(-1px); }
.mega__panel { position:absolute; top:calc(100% + 10px); left:50%; transform:translateX(-50%); min-width:300px; background:var(--bg-card); border:1px solid var(--border-light); border-radius:var(--radius-md); box-shadow:0 12px 32px rgba(0,0,0,.12); padding:16px 18px; z-index:120; display:flex; gap:24px; }
.mega__panel[hidden]{display:none;}
.mega__col{min-width:200px;}
.mega__head{margin:0 0 8px; font-size:.72rem; letter-spacing:.06em; text-transform:uppercase; color:var(--text-muted); font-weight:700;}
.mega__col a{display:block; padding:7px 0; color:var(--text-main); text-decoration:none; font-size:.92rem; font-weight:500;}
.mega__col a:hover{color:var(--primary-green);}
.nav-link{text-decoration:none;color:var(--text-muted);font-weight:500;font-size:.95rem;}
.nav-link:hover{color:var(--primary-green);}
.nav-link--btn{background:none;border:0;cursor:pointer;font-family:inherit;padding:8px 4px;font-size:.95rem;}
.m-group{border-bottom:1px solid var(--border-light);}
.m-trigger{width:100%;display:flex;justify-content:space-between;align-items:center;background:none;border:0;padding:14px 0;font:inherit;font-weight:600;color:var(--text-main);cursor:pointer;}
.m-panel{padding:0 0 10px;}
.m-panel[hidden]{display:none;}
.m-panel a{display:block;padding:9px 0;color:var(--text-muted);text-decoration:none;}
.m-panel a:hover{color:var(--primary-green);}
@media (max-width:860px){ .mega{display:none;} }

.m-head{display:flex;align-items:center;justify-content:space-between;gap:10px;}
.m-head .m-trigger{flex:1;width:auto;text-align:left;}
.m-viewall{font-size:.74rem;letter-spacing:.05em;text-transform:uppercase;color:var(--primary-green);text-decoration:none;font-weight:700;white-space:nowrap;padding:6px 0;}
.m-viewall:hover{text-decoration:underline;}

/* mobile accordion indicator: 👇 closed / 👆 open (replaces the bar chevron) + smaller view-all */
.m-head .mega__chev{display:none !important;}
.m-chev{font-size:.95rem;line-height:1;margin-left:6px;}
.m-trigger[aria-expanded="false"] .m-chev::before{content:"\1F447";}
.m-trigger[aria-expanded="true"] .m-chev::before{content:"\1F446";}
.m-viewall{font-size:.5rem;}

/* keep the 👇/👆 inline right after the label (no wrap) */
.m-head .m-trigger{flex:0 0 auto;white-space:nowrap;}
.m-chev{display:inline-block;}

/* VIEW ALL must be half the label size — beats the .mobile-menu a rule (specificity 0,2,0 > 0,1,1) */
.mobile-menu .m-head .m-viewall{font-size:.5rem;font-weight:700;}
