/* ==========================================================================
   Kivawell — shared design system
   Used by: home, blog index, articles, legal pages
   ========================================================================== */

:root {
  --ink: #0B1020;
  --ink-2: #161d33;
  --muted: #5b6480;
  --muted-2: #8b93aa;
  --line: rgba(11, 16, 32, .08);
  --bg: #ffffff;
  --bg-soft: #f6f7fc;

  --green: #17c08a;
  --green-ink: #0d8a63;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --blue: #4c9aff;
  --orange: #fb923c;

  --grad-brand: linear-gradient(115deg, #17c08a 0%, #0ea5a3 38%, #6d7cf6 72%, #a855f7 100%);

  --r-sm: 14px;
  --r-md: 22px;
  --r-lg: 32px;
  --r-xl: 42px;

  --shadow-sm: 0 2px 8px rgba(11, 16, 32, .05);
  --shadow-md: 0 18px 44px -20px rgba(11, 16, 32, .28);
  --shadow-lg: 0 50px 90px -40px rgba(11, 16, 32, .45);

  --maxw: 1180px;
  --maxw-read: 720px;
  --pad: clamp(20px, 5vw, 40px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.55; overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: 'Bricolage Grotesque', 'Inter', sans-serif; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
::selection { background: rgba(23, 192, 138, .22); }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
.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; }

/* ===== HEADER ===== */
.header { position: fixed; inset: 0 0 auto 0; z-index: 100; padding: 14px 0; transition: background .3s, box-shadow .3s, padding .3s; }
.header.stuck { background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); box-shadow: 0 1px 0 var(--line), 0 10px 30px -22px rgba(11,16,32,.5); padding: 9px 0; }
.header-in { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

.brand { display: inline-flex; align-items: baseline; gap: 1px; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 25px; letter-spacing: -.05em; }
.brand .b1 { color: var(--ink); }
.brand .b2 { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: 5px; align-self: center; animation: pulse 2.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(23,192,138,.55) } 70% { box-shadow: 0 0 0 9px rgba(23,192,138,0) } 100% { box-shadow: 0 0 0 0 rgba(23,192,138,0) } }

.nav { display: none; gap: 26px; font-size: 14.5px; font-weight: 500; color: var(--muted); }
.nav a { position: relative; padding: 4px 0; transition: color .2s; }
.nav a::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 0; border-radius: 2px; background: var(--grad-brand); transition: width .28s cubic-bezier(.2,.7,.3,1); }
.nav a:hover { color: var(--ink); } .nav a:hover::after, .nav a[aria-current]::after { width: 100%; }
@media (min-width: 940px) { .nav { display: flex; } }

.header-side { display: flex; align-items: center; gap: 10px; }

/* language switch */
.lang { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(11,16,32,.06); font-size: 12.5px; font-weight: 700; }
.lang a { padding: 5px 10px; border-radius: 999px; color: var(--muted); transition: background .2s, color .2s; }
.lang a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 600; font-size: 15px; border: 0; cursor: pointer; padding: 13px 22px; border-radius: 999px; transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .25s, background .25s; white-space: nowrap; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 14px 30px -14px rgba(11,16,32,.85); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { background: rgba(11,16,32,.05); color: var(--ink); }
.btn-ghost:hover { background: rgba(11,16,32,.09); transform: translateY(-2px); }
.btn-brand { background: var(--grad-brand); color: #fff; box-shadow: 0 18px 40px -18px rgba(23,192,138,.9); }
.btn-brand:hover { transform: translateY(-2px); box-shadow: 0 26px 50px -20px rgba(23,192,138,1); }
.btn-lg { padding: 17px 28px; font-size: 16.5px; }
.header .btn { padding: 11px 18px; font-size: 14.5px; }
.btn-short { display: none; }
@media (max-width: 560px) {
  .header-in { gap: 8px; }
  .header .btn { padding: 10px 14px; font-size: 13.5px; }
  .btn-full { display: none; }
  .btn-short { display: inline; }
}
.applemark { width: 15px; height: 17px; margin-top: -2px; flex: none; }
.playmark { width: 16px; height: 17px; flex: none; }
.btn.is-soon { cursor: default; opacity: .75; }
.btn.is-soon:hover { transform: none; }
.cta .btn.is-soon { background: rgba(255,255,255,.1); }

/* ===== SHARED BITS ===== */
.kicker { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--green); margin-bottom: 14px; }
.sec { padding: clamp(56px, 10vw, 100px) 0; position: relative; }
.sec.soft { background: var(--bg-soft); }
.center { text-align: center; }

.rv { opacity: 0; transform: translateY(24px); transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1); }
.rv.in { opacity: 1; transform: none; }
.rv.d1 { transition-delay: .08s } .rv.d2 { transition-delay: .16s } .rv.d3 { transition-delay: .24s } .rv.d4 { transition-delay: .32s }

/* ===== MASCOT ===== */
.kiva { width: 120px; height: auto; display: block; }
.kiva-peek { position: absolute; right: 4%; bottom: -18px; width: 86px; opacity: .95; pointer-events: none; }

/* ===== BLOG: HERO ===== */
.blog-hero { position: relative; padding: 128px 0 40px; overflow: hidden; }
.blog-hero .aurora { position: absolute; inset: -30% -10% auto -10%; height: 640px; z-index: -1; filter: blur(70px); opacity: .45; pointer-events: none; }
.blog-hero .blob { position: absolute; border-radius: 50%; }
.blog-hero .b1 { width: 40vw; height: 40vw; min-width: 280px; min-height: 280px; left: -6%; top: 0; background: radial-gradient(circle at 30% 30%, #6ee7b7, transparent 65%); }
.blog-hero .b2 { width: 36vw; height: 36vw; min-width: 260px; min-height: 260px; right: -4%; top: -10%; background: radial-gradient(circle at 60% 40%, #c4b5fd, transparent 62%); }
.blog-hero h1 { font-size: clamp(34px, 8vw, 60px); }
.blog-hero p { margin-top: 16px; color: var(--muted); font-size: clamp(15.5px, 4vw, 18.5px); max-width: 58ch; }

/* ===== BLOG: FILTERS ===== */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 28px 0 6px; }
.filters button { font: inherit; font-size: 13.5px; font-weight: 600; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; transition: all .22s; }
.filters button:hover { color: var(--ink); border-color: rgba(11,16,32,.18); }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ===== BLOG: CARDS ===== */
.posts { display: grid; gap: 18px; margin-top: 26px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .posts { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .posts { grid-template-columns: repeat(3, 1fr); } }

.post-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s; }
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.post-card .thumb { aspect-ratio: 16 / 9; position: relative; overflow: hidden; display: grid; place-items: center; }
.post-card .thumb svg { width: 100%; height: 100%; display: block; }
.post-card .body { padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card h3 { font-size: 19px; line-height: 1.2; }
.post-card p { font-size: 14.5px; color: var(--muted); }
.post-meta { margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted-2); }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; }
.tag.nutrition { background: rgba(23,192,138,.13); color: var(--green-ink); }
.tag.fitness { background: rgba(139,92,246,.13); color: #6d3fd4; }
.tag.cycle { background: rgba(236,72,153,.12); color: #c02a70; }
.tag.sleep { background: rgba(76,154,255,.13); color: #2b6fd0; }
.tag.stress { background: rgba(251,146,60,.15); color: #b4571a; }
.tag.habits { background: rgba(11,16,32,.06); color: var(--ink-2); }

/* ===== ARTICLE ===== */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--grad-brand); z-index: 200; transition: width .1s linear; }

.crumbs { font-size: 13px; color: var(--muted-2); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--green); }

.article-head { padding: 120px 0 8px; }
.article-head h1 { font-size: clamp(31px, 6.6vw, 50px); margin: 16px 0 0; }
.article-head .sub { margin-top: 16px; font-size: clamp(16px, 4vw, 19px); color: var(--muted); max-width: 62ch; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.byline .who { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink-2); }
.byline .who img { width: 34px; height: 34px; }
.byline .dotsep { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-2); }

.hero-art { margin: 30px 0 6px; border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft); }
.hero-art svg { display: block; width: 100%; height: auto; }

.layout { display: grid; gap: 40px; align-items: start; padding-bottom: 40px; }
@media (min-width: 1040px) { .layout { grid-template-columns: minmax(0,1fr) 260px; gap: 56px; } }

/* prose */
.prose { max-width: var(--maxw-read); font-size: 17px; color: #223; }
.prose > * + * { margin-top: 22px; }
.prose h2 { font-size: clamp(25px, 5vw, 32px); margin-top: 46px; scroll-margin-top: 100px; }
.prose h3 { font-size: clamp(19px, 4vw, 22px); margin-top: 32px; scroll-margin-top: 100px; }
.prose p { line-height: 1.72; color: #2b3348; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose a:not(.btn) { color: var(--green-ink); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(23,192,138,.35); text-underline-offset: 3px; }
.prose a:not(.btn):hover { text-decoration-color: var(--green); }
.prose ul, .prose ol { padding-left: 22px; display: grid; gap: 10px; }
.prose li { line-height: 1.65; color: #2b3348; }
.prose li::marker { color: var(--green); }
.prose blockquote { border-left: 3px solid var(--green); padding: 4px 0 4px 20px; color: var(--ink-2); font-size: 18px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 700; background: var(--bg-soft); white-space: nowrap; }

.callout { border-radius: var(--r-md); padding: 20px 22px; border: 1px solid var(--line); background: var(--bg-soft); font-size: 15.5px; }
.callout h4 { font-size: 16px; margin-bottom: 8px; }
.callout.tip { background: linear-gradient(150deg, rgba(23,192,138,.1), rgba(23,192,138,.03)); border-color: rgba(23,192,138,.28); }
.callout.warn { background: linear-gradient(150deg, rgba(251,146,60,.12), rgba(251,146,60,.04)); border-color: rgba(251,146,60,.3); }
.callout.kiva { display: flex; gap: 14px; align-items: flex-start; }
.callout.kiva img { width: 58px; flex: none; margin-top: -4px; }

/* in-article app widget */
.widget { border-radius: var(--r-lg); padding: 20px; background: linear-gradient(160deg, #ffffff, #f7fbfa); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.widget-head .t { font-family: 'Bricolage Grotesque', sans-serif; font-size: 17px; letter-spacing: -.03em; }
.chip { font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: rgba(11,16,32,.05); color: var(--ink-2); }
.chip.g { background: rgba(23,192,138,.13); color: var(--green-ink); }
.chip.k { background: rgba(236,72,153,.12); color: #c02a70; }
.bars { display: grid; gap: 9px; }
.bars .row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bars .row .lbl { width: 74px; color: var(--muted); }
.bars .row .track { flex: 1; height: 8px; border-radius: 99px; background: rgba(11,16,32,.07); overflow: hidden; }
.bars .row .track i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--grad-brand); transition: width 1.4s cubic-bezier(.2,.7,.3,1); }
.in .bars .row .track i { width: var(--w, 50%); }
.bars .row .num { font-weight: 700; font-size: 12.5px; min-width: 42px; text-align: right; }

/* TOC */
.toc { position: sticky; top: 96px; font-size: 14px; display: none; }
@media (min-width: 1040px) { .toc { display: block; } }
.toc h4 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 12px; }
.toc a { display: block; padding: 7px 0 7px 14px; border-left: 2px solid var(--line); color: var(--muted); transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--green-ink); border-color: var(--green); font-weight: 600; }
.toc .cta-box { margin-top: 24px; padding: 18px; border-radius: var(--r-md); background: linear-gradient(150deg, #0b1020, #1d2544); color: #fff; }
.toc .cta-box p { font-size: 13px; color: rgba(255,255,255,.7); margin: 6px 0 14px; }
.toc .cta-box .btn { width: 100%; font-size: 14px; padding: 11px 16px; }

/* related */
.related { border-top: 1px solid var(--line); padding-top: 40px; margin-top: 20px; }
.related h2 { font-size: 26px; margin-bottom: 20px; }

/* disclaimer */
.med-note { margin-top: 40px; padding: 20px 22px; border-radius: var(--r-md); background: var(--bg-soft); border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.med-note strong { color: var(--ink-2); }

/* ===== CTA + FOOTER ===== */
.cta { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: clamp(38px, 8vw, 70px) var(--pad); background: linear-gradient(150deg, #0b1020 0%, #16203f 55%, #241a45 100%); color: #fff; text-align: center; }
.cta .glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; filter: blur(90px); opacity: .4; }
.cta .g1 { background: #17c08a; top: -220px; left: -120px; }
.cta .g2 { background: #8b5cf6; bottom: -260px; right: -140px; }
.cta h2, .cta p, .cta .cta-row, .cta .fine { position: relative; }
.cta h2 { font-size: clamp(28px, 6vw, 44px); }
.cta p { color: rgba(255,255,255,.7); margin: 16px auto 0; max-width: 52ch; font-size: clamp(15px, 4vw, 17.5px); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 28px; }
.cta .btn-ghost { background: rgba(255,255,255,.12); color: #fff; }
.cta .btn-ghost:hover { background: rgba(255,255,255,.2); }
.cta .fine { margin-top: 18px; font-size: 12.5px; color: rgba(255,255,255,.5); }

footer { padding: 58px 0 40px; border-top: 1px solid var(--line); margin-top: 60px; }
.foot-grid { display: grid; gap: 32px; }
@media (min-width: 780px) { .foot-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.foot-grid > div > p { color: var(--muted); font-size: 14.5px; margin-top: 12px; max-width: 40ch; }
.fcol h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted-2); margin-bottom: 12px; font-weight: 700; }
.fcol a { display: block; padding: 6px 0; font-size: 14.5px; color: var(--ink-2); transition: color .2s, transform .2s; }
.fcol a:hover { color: var(--green); transform: translateX(3px); }
.legal { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; font-size: 13px; color: var(--muted-2); }
.disclaimer { margin-top: 18px; font-size: 12.5px; color: var(--muted-2); line-height: 1.6; max-width: 72ch; }

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