/* ============================================================ */
/* CanaGrants public site — shared shell styles (V2 system)      */
/* Ported pixel-for-pixel from the design prototype:             */
/*   src/tokens.css + news.jsx (PUB) + pub-shell.jsx + pub-blocks.jsx */
/* Tokens are the single source of truth — never inline a hex.   */
/* ============================================================ */

:root {
  /* Brand red */
  --cg-red:        #CC1933;
  --cg-red-deep:   #801040;
  --cg-red-ink:    #3D0A14;
  --cg-red-soft:   #FFE8EC;
  --cg-red-tint:   #FFF4F6;
  /* Ink */
  --cg-ink:        #1A1815;
  --cg-ink-2:      #3F3F46;
  --cg-ink-3:      #71717A;
  --cg-ink-4:      #A1A1AA;
  /* Surface */
  --cg-bg:         #FFFFFF;
  --cg-bg-alt:     #FAFAFA;
  --cg-bg-panel:   #F4F4F5;
  --cg-bg-panel-2: #F7F7F8;
  /* Hairlines */
  --cg-rule:        #E4E4E7;
  --cg-rule-strong: #D4D4D8;
  /* Status */
  --cg-green:      #16A34A;
  --cg-green-soft: #E7F8EE;
  --cg-amber:      #D97706;
  --cg-amber-soft: #FDF5E7;
  --cg-blue:       #2563EB;
  --cg-blue-soft:  #EBF2FE;
  /* Type */
  --cg-sans: "Geist", "Inter", -apple-system, system-ui, sans-serif;
  --cg-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
}

/* ── Base ───────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cg-bg); }
body {
  font-family: var(--cg-sans);
  color: var(--cg-ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; }
button { font-family: var(--cg-sans); }
.cg-mono { font-family: var(--cg-mono); font-feature-settings: "tnum" 1, "ss01" 1; }

.cg-container {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

@keyframes cg-pulse { 0% { transform: scale(1); opacity: .6 } 70% { transform: scale(2.4); opacity: 0 } 100% { opacity: 0 } }
.cg-livedot { position: relative; width: 8px; height: 8px; display: inline-block; flex: none; }
.cg-livedot::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--dot, var(--cg-green)); animation: cg-pulse 1.8s ease-out infinite; opacity: .6; }
.cg-livedot::after  { content: ""; position: absolute; inset: 1px; border-radius: 50%; background: var(--dot, var(--cg-green)); }
.cg-livedot--6 { width: 6px; height: 6px; }
.cg-livedot--7 { width: 7px; height: 7px; }

/* ── Header / nav ───────────────────────────────────────────── */
.cg-topbar { height: 3px; background: linear-gradient(90deg, var(--cg-red) 0%, var(--cg-red) 70%, var(--cg-red-deep) 100%); }
.cg-nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cg-rule);
}
.cg-nav__row { height: 88px; display: flex; align-items: center; justify-content: space-between; position: relative; }
.cg-nav__left { display: flex; align-items: center; gap: 40px; }
.cg-nav__logo img { height: 68px; width: auto; }
.cg-nav__menu { display: flex; gap: 4px; font-size: 14px; font-weight: 600; }
.cg-nav__item { position: static; }
.cg-nav__link,
.cg-nav__btn {
  display: flex; align-items: center; gap: 5px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  color: var(--cg-ink); padding: 8px 12px; border-radius: 7px;
  text-decoration: none;
}
.cg-nav__btn svg { transition: transform .15s; }
.cg-nav__item.is-active > .cg-nav__btn,
.cg-nav__item.is-active > .cg-nav__link,
.cg-nav__item.is-open > .cg-nav__btn { color: var(--cg-red); }
.cg-nav__item.is-open > .cg-nav__btn svg { transform: rotate(180deg); }

/* Mega panel — spans the nav container, opens via JS (hover/focus) */
.cg-mega {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--cg-bg);
  border-top: 1px solid var(--cg-rule); border-bottom: 1px solid var(--cg-rule);
  box-shadow: 0 28px 60px -32px rgba(0,0,0,0.28);
  z-index: 40;
}
.cg-nav__item.is-open .cg-mega { display: block; }
.cg-mega__inner { display: flex; padding: 28px 48px; }
.cg-mega__overview {
  text-decoration: none; width: 220px; padding-right: 28px; margin-right: 28px;
  border-right: 1px solid var(--cg-rule); display: block;
}
.cg-mega__overview-title { font-size: 14.5px; font-weight: 600; color: var(--cg-ink); margin-bottom: 6px; }
.cg-mega__overview-title .arrow { color: var(--cg-red); }
.cg-mega__overview-hint { font-size: 12.5px; color: var(--cg-ink-3); line-height: 1.5; }
.cg-mega__cols { display: flex; gap: 48px; flex: 1; }
.cg-mega__col { min-width: 170px; }
.cg-mega__col-title {
  font-size: 10.5px; color: var(--cg-ink-3); letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 700; margin-bottom: 14px;
}
.cg-mega__links { display: flex; flex-direction: column; gap: 11px; }
.cg-mega__links a { font-size: 13.5px; color: var(--cg-ink-2); text-decoration: none; font-weight: 500; }
.cg-mega__links a:hover { color: var(--cg-red); }

/* Nav right cluster */
.cg-nav__right { display: flex; align-items: center; gap: 10px; }
.cg-nav__search {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: var(--cg-bg-alt); border: 1px solid var(--cg-rule); border-radius: 7px;
  font-size: 12.5px; color: var(--cg-ink-3); width: 190px;
}
.cg-nav__search-text { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cg-nav__search-kbd {
  font-family: var(--cg-mono); font-size: 10px; color: var(--cg-ink-4);
  padding: 1px 5px; background: var(--cg-bg); border: 1px solid var(--cg-rule); border-radius: 3px;
}
.cg-btn-ghost, .cg-btn-primary {
  padding: 9px 15px; border-radius: 7px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-block;
}
.cg-btn-ghost { background: transparent; color: var(--cg-ink); border: 1px solid var(--cg-rule); }
.cg-btn-primary { background: var(--cg-red); color: #fff; border: 0; box-shadow: 0 1px 0 var(--cg-red-deep); }

/* Language switcher */
.cg-lang { position: relative; }
.cg-lang__btn {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 13px; font-weight: 600; line-height: 1; padding: 8px 10px; border-radius: 7px;
  background: var(--cg-bg-alt); border: 1px solid var(--cg-rule); color: var(--cg-ink);
}
.cg-lang__btn .chev { transition: transform .15s; }
.cg-lang.is-open .cg-lang__btn .chev { transform: rotate(180deg); }
.cg-lang__list {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 150px;
  background: var(--cg-bg); border: 1px solid var(--cg-rule); border-radius: 9px;
  box-shadow: 0 20px 44px -20px rgba(0,0,0,0.28); padding: 5px; z-index: 50;
}
.cg-lang.is-open .cg-lang__list { display: block; }
.cg-lang__opt {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 0; cursor: pointer; font-size: 13.5px; font-weight: 500;
  padding: 8px 10px; border-radius: 6px; text-align: left;
  background: transparent; color: var(--cg-ink);
}
.cg-lang__opt:hover, .cg-lang__opt.is-on { background: var(--cg-bg-alt); }
.cg-lang__opt.is-on { font-weight: 600; }
.cg-lang__opt .tag { font-family: var(--cg-mono); font-size: 11px; color: var(--cg-ink-4); }
.cg-lang__opt.is-on .tag { color: var(--cg-red); }

/* Mobile header + drawer */
.cg-nav__hamburger {
  display: none;
  width: 44px; height: 44px; align-items: center; justify-content: center;
  background: var(--cg-bg-alt); border: 1px solid var(--cg-rule); border-radius: 9px; cursor: pointer;
}
.cg-nav__hamburger .icon-close { display: none; }
.cg-drawer { display: none; }
body.cg-drawer-open { overflow: hidden; }

/* ── Breadcrumb ─────────────────────────────────────────────── */
.cg-crumb { background: var(--cg-bg-alt); border-bottom: 1px solid var(--cg-rule); }
.cg-crumb__row {
  padding-top: 13px; padding-bottom: 13px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--cg-ink-3); flex-wrap: wrap;
}
.cg-crumb__row a { color: var(--cg-ink-3); text-decoration: none; }
.cg-crumb__sep { color: var(--cg-ink-4); }
.cg-crumb__here { color: var(--cg-ink); font-weight: 600; }

/* ── Page hero (grid bg + kicker + H1 + sub) ───────────────── */
.cg-hero {
  position: relative; padding: 60px 0;
  border-bottom: 1px solid var(--cg-rule); overflow: hidden;
}
.cg-hero__grid {
  position: absolute; inset: 0; opacity: 0.5; pointer-events: none;
  background-image:
    linear-gradient(var(--cg-rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--cg-rule) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 80%);
}
.cg-hero__inner { position: relative; }
.cg-hero__kicker {
  font-family: var(--cg-mono); font-size: 11px; color: var(--cg-red);
  margin-bottom: 16px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600;
}
.cg-hero h1 {
  font-weight: 600; font-size: clamp(30px, 6.2vw, 56px); line-height: 1.06;
  letter-spacing: -0.03em; margin: 0; color: var(--cg-ink); max-width: 960px; text-wrap: balance;
}
.cg-hero__sub {
  font-size: clamp(15px, 2.4vw, 18px); line-height: 1.55; color: var(--cg-ink-2);
  margin: 20px 0 0; max-width: 680px;
}

/* ── Numbered section (pattern §05.1) ──────────────────────── */
.cg-section { padding: 88px 0; border-bottom: 1px solid var(--cg-rule); background: var(--cg-bg); }
.cg-section--alt { background: var(--cg-bg-alt); }
.cg-section__head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 32px; gap: 24px; }
.cg-section__head-left { max-width: 720px; }
.cg-section__kicker {
  font-family: var(--cg-mono); font-size: 11px; color: var(--cg-red);
  margin-bottom: 14px; letter-spacing: 0.1em;
  display: flex; align-items: center; gap: 10px;
}
.cg-section__no {
  background: var(--cg-red); color: #fff; padding: 3px 8px; border-radius: 3px;
  font-weight: 700; font-size: 11px; letter-spacing: 0.08em;
  box-shadow: 0 1px 0 var(--cg-red-deep);
}
.cg-section__kicker-label { text-transform: uppercase; font-weight: 600; }
.cg-section__kicker-line { flex: 1; height: 1px; background: var(--cg-rule); min-width: 60px; }
.cg-section__head h2 {
  font-weight: 600; font-size: clamp(24px, 4.5vw, 36px); line-height: 1.1;
  letter-spacing: -0.025em; margin: 0; color: var(--cg-ink); text-wrap: balance;
}
.cg-section__body {
  font-size: 15px; line-height: 1.55; color: var(--cg-ink-2);
  margin: 12px 0 0; max-width: 600px;
}

/* ── Final CTA (gradient, pattern §05.7) ───────────────────── */
.cg-cta {
  padding: 96px 0; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--cg-red-ink) 0%, #5A0F1F 60%, var(--cg-red) 100%);
}
.cg-cta__grid {
  position: absolute; inset: 0; opacity: 0.18; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.15) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 80%);
}
.cg-cta__inner { position: relative; text-align: center; max-width: 860px; }
.cg-cta__pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08);
  font-size: 12.5px; color: rgba(255,255,255,0.85); margin-bottom: 26px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.cg-cta h2 {
  font-weight: 600; font-size: clamp(28px, 5.5vw, 50px); line-height: 1.06;
  letter-spacing: -0.03em; margin: 0; color: #fff; text-wrap: balance;
}
.cg-cta__sub {
  font-size: clamp(15px, 2.2vw, 17px); color: rgba(255,255,255,0.78);
  margin: 18px auto 0; max-width: 560px; line-height: 1.55;
}
.cg-cta__actions { display: flex; justify-content: center; gap: 10px; margin-top: 32px; flex-wrap: wrap; }
.cg-cta__primary {
  background: #fff; color: var(--cg-red-ink); border: 0; padding: 13px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block;
}
.cg-cta__secondary {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.4);
  padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none; display: inline-block;
}

/* ── Footer ─────────────────────────────────────────────────── */
.cg-footer { padding: 56px 0 32px; background: var(--cg-bg); border-top: 1px solid var(--cg-rule); }
.cg-footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr; gap: 32px; }
.cg-footer__brand img { height: 58px; width: auto; }
.cg-footer__tagline { font-size: 12.5px; color: var(--cg-ink-3); margin: 14px 0 0; max-width: 250px; line-height: 1.55; }
.cg-footer__status { margin-top: 16px; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--cg-ink-3); }
.cg-footer__disclaimer { font-size: 10.5px; color: var(--cg-ink-4); margin: 14px 0 0; max-width: 290px; line-height: 1.55; font-style: italic; }
.cg-footer__col-title {
  font-size: 11px; color: var(--cg-ink-3); letter-spacing: 0.1em;
  text-transform: uppercase; font-weight: 600; margin-bottom: 14px;
}
.cg-footer__links { display: flex; flex-direction: column; gap: 9px; }
.cg-footer__links a { font-size: 13px; color: var(--cg-ink-2); text-decoration: none; }
.cg-footer__bottom {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--cg-rule);
  display: flex; justify-content: space-between; font-size: 11.5px; color: var(--cg-ink-3);
}

/* ── Mobile (<768) ──────────────────────────────────────────── */
@media (max-width: 767px) {
  .cg-nav__row { height: 64px; }
  .cg-nav__logo img { height: 44px; }
  .cg-nav__menu, .cg-nav__right { display: none; }
  .cg-nav__hamburger { display: flex; }
  .cg-nav__hamburger.is-open { background: var(--cg-ink); border-color: var(--cg-ink); }
  .cg-nav__hamburger.is-open .icon-open { display: none; }
  .cg-nav__hamburger.is-open .icon-close { display: block; }

  .cg-drawer {
    position: fixed; inset: 67px 0 0 0; z-index: 29; background: var(--cg-bg);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  body.cg-drawer-open .cg-drawer { display: block; }
  .cg-drawer__inner { padding: 12px 20px 40px; }
  .cg-drawer__search {
    display: flex; align-items: center; gap: 8px; padding: 12px 14px;
    background: var(--cg-bg-alt); border: 1px solid var(--cg-rule); border-radius: 10px;
    font-size: 14px; color: var(--cg-ink-3); margin-bottom: 14px;
  }
  .cg-drawer__item { border-bottom: 1px solid var(--cg-rule); }
  .cg-drawer__toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    background: transparent; border: 0; cursor: pointer;
    font-size: 17px; font-weight: 600; color: var(--cg-ink); padding: 15px 4px;
  }
  .cg-drawer__toggle svg { transition: transform .15s; color: var(--cg-ink-3); }
  .cg-drawer__item.is-open .cg-drawer__toggle svg { transform: rotate(180deg); }
  .cg-drawer__sub { display: none; padding-bottom: 12px; }
  .cg-drawer__item.is-open .cg-drawer__sub { display: block; }
  .cg-drawer__overview { display: block; font-size: 15px; font-weight: 600; color: var(--cg-red); text-decoration: none; padding: 8px 4px 8px 14px; }
  .cg-drawer__group { padding-left: 14px; margin-bottom: 6px; }
  .cg-drawer__group-title {
    font-size: 10.5px; color: var(--cg-ink-3); letter-spacing: 0.08em;
    text-transform: uppercase; font-weight: 700; margin: 10px 0 6px;
  }
  .cg-drawer__group a { display: block; font-size: 15px; color: var(--cg-ink-2); text-decoration: none; padding: 9px 0; }
  .cg-drawer__link {
    display: block; font-size: 17px; font-weight: 600; color: var(--cg-ink);
    text-decoration: none; padding: 15px 4px; border-bottom: 1px solid var(--cg-rule);
  }
  .cg-drawer__link.is-active { color: var(--cg-red); }
  .cg-drawer__actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
  .cg-drawer__actions .cg-btn-primary,
  .cg-drawer__actions .cg-btn-ghost { padding: 14px; font-size: 15px; width: 100%; text-align: center; }
  .cg-drawer__lang { margin-top: 8px; display: flex; justify-content: center; }

  .cg-hero { padding: 36px 0; }
  .cg-hero__kicker { margin-bottom: 12px; }
  .cg-section { padding: 48px 0; }
  .cg-cta { padding: 56px 0; }
  .cg-footer__grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .cg-footer__brand { grid-column: 1 / -1; }
  .cg-footer__bottom { flex-direction: column; gap: 8px; }
}
