/* ============================================================
   DeepSAIght — Climate Change, ESG & Net Zero Consultancy
   Main Stylesheet (layered on Bootstrap 5)
   ------------------------------------------------------------
   1. Design tokens (light + dark)   5. Cards & widgets
   2. Base & typography              6. Forms, tables, chat
   3. Navigation                     7. Footer & utilities
   4. Hero & sections                8. Animations
   ============================================================ */

/* ---------- 1. DESIGN TOKENS ---------- */
:root {
  --ds-green: #0B6E4F;
  --ds-green-dark: #084C37;
  --ds-emerald: #2ECC71;
  --ds-blue: #1565C0;
  --ds-blue-light: #42A5F5;

  --bg: #F7FAF8;
  --bg-alt: #FFFFFF;
  --bg-raised: #FFFFFF;
  --text: #1E2B26;
  --text-muted: #5A6B64;
  --border: rgba(11, 110, 79, 0.12);
  --glass: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow: 0 8px 30px rgba(11, 110, 79, 0.08);
  --shadow-lg: 0 20px 50px rgba(11, 110, 79, 0.14);
  --hero-overlay: linear-gradient(120deg, rgba(8, 76, 55, .88), rgba(21, 101, 192, .72));
  --gradient-brand: linear-gradient(120deg, var(--ds-green), var(--ds-blue));
  --gradient-accent: linear-gradient(120deg, var(--ds-emerald), var(--ds-blue-light));

  --font-display: 'Poppins', sans-serif;
  --font-head: 'Montserrat', sans-serif;
  --font-body: 'Open Sans', sans-serif;

  --radius: 1.1rem;
  --radius-sm: .6rem;
}

[data-theme="dark"] {
  --bg: #0D1512;
  --bg-alt: #121C18;
  --bg-raised: #17231E;
  --text: #E6EFEA;
  --text-muted: #93A69D;
  --border: rgba(46, 204, 113, 0.14);
  --glass: rgba(23, 35, 30, 0.6);
  --glass-border: rgba(46, 204, 113, 0.18);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --hero-overlay: linear-gradient(120deg, rgba(5, 30, 22, .92), rgba(9, 38, 66, .85));
}

/* ---------- 2. BASE & TYPOGRAPHY ---------- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  transition: background .35s ease, color .35s ease;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; }
h4, h5, h6 { font-family: var(--font-head); font-weight: 600; }
.text-muted { color: var(--text-muted) !important; }
a { color: var(--ds-green); }
[data-theme="dark"] a { color: var(--ds-emerald); }

.eyebrow {
  font-family: var(--font-head); font-size: .78rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ds-emerald); font-weight: 700;
  display: inline-flex; align-items: center; gap: .5rem;
}
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--gradient-accent); border-radius: 2px; }

.section { padding: 5.5rem 0; }
.section-alt { background: var(--bg-alt); }

.gradient-text {
  background: var(--gradient-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--ds-blue-light); outline-offset: 2px;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 2000;
  background: var(--ds-green); color: #fff; padding: .6rem 1rem; border-radius: 0 0 .5rem 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- 3. NAVIGATION ---------- */
.navbar-ds {
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  transition: background .3s ease, box-shadow .3s ease;
}
.navbar-ds.scrolled { box-shadow: var(--shadow); }
.navbar-ds .nav-link {
  font-family: var(--font-head); font-weight: 600; font-size: .85rem;
  color: var(--text); padding: .55rem .65rem !important; border-radius: .5rem;
  transition: color .2s, background .2s;
}
.navbar-ds .nav-link:hover, .navbar-ds .nav-link.active { color: var(--ds-emerald); background: rgba(46, 204, 113, .08); }
.navbar-ds .navbar-toggler { border-color: var(--border); color: var(--text); }
.navbar-brand-ds {
  font-family: var(--font-display); font-weight: 800; font-size: 1.3rem;
  color: var(--text) !important; display: flex; align-items: center; gap: .5rem;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--gradient-brand);
  display: grid; place-items: center; color: #fff; font-size: 1.05rem;
  box-shadow: 0 4px 14px rgba(11,110,79,.35);
}
.brand-sai { color: var(--ds-emerald); }

.theme-toggle {
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--text);
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; transition: transform .3s ease, color .3s;
}
.theme-toggle:hover { transform: rotate(30deg); color: var(--ds-emerald); }

/* ---------- 4. HERO & SECTIONS ---------- */
.hero {
  min-height: 92vh; display: flex; align-items: center;
  position: relative; color: #fff;
  background: var(--hero-overlay), url("../images/hero-landscape.svg") center/cover fixed;
}
.hero h1 { font-size: clamp(2.1rem, 4.5vw, 3.6rem); line-height: 1.15; }
.hero .lead { color: rgba(255,255,255,.85); max-width: 640px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(8px); border-radius: 999px; padding: .45rem 1.1rem;
  font-family: var(--font-head); font-size: .78rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.hero-scroll {
  position: absolute; bottom: 28px; left: 50%;
  color: rgba(255,255,255,.7); animation: floatY 2.4s ease-in-out infinite;
}
@keyframes floatY { 0%,100% { transform: translate(-50%, 0);} 50% { transform: translate(-50%, 10px);} }

.page-head {
  padding: 8.5rem 0 4rem;
  background: var(--hero-overlay), var(--ds-green-dark);
  color: #fff;
}
.page-head .breadcrumb, .page-head .breadcrumb a, .page-head .breadcrumb-item.active { color: rgba(255,255,255,.72); font-size: .85rem; }
.page-head .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.5); }

/* Buttons */
.btn-ds-primary {
  background: var(--gradient-brand); border: none; color: #fff;
  font-family: var(--font-head); font-weight: 600;
  padding: .8rem 1.6rem; border-radius: 999px;
  box-shadow: 0 10px 24px rgba(11,110,79,.35);
  transition: transform .25s ease, box-shadow .25s ease;
}
.btn-ds-primary:hover, .btn-ds-primary:focus { transform: translateY(-3px); color: #fff; box-shadow: 0 16px 34px rgba(11,110,79,.45); }
.btn-ds-outline {
  border: 2px solid rgba(255,255,255,.7); color: #fff;
  font-family: var(--font-head); font-weight: 600;
  padding: .72rem 1.5rem; border-radius: 999px; transition: background .25s, transform .25s;
}
.btn-ds-outline:hover { background: rgba(255,255,255,.15); color: #fff; transform: translateY(-3px); }
.btn-ds-ghost {
  border: 2px solid var(--ds-green); color: var(--ds-green);
  font-family: var(--font-head); font-weight: 600;
  padding: .7rem 1.5rem; border-radius: 999px; transition: all .25s;
}
.btn-ds-ghost:hover { background: var(--ds-green); color: #fff; }
[data-theme="dark"] .btn-ds-ghost { border-color: var(--ds-emerald); color: var(--ds-emerald); }
[data-theme="dark"] .btn-ds-ghost:hover { background: var(--ds-emerald); color: #06281D; }

/* ---------- 5. CARDS & WIDGETS ---------- */
.glass-card {
  background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .3s ease, box-shadow .3s ease;
}
.glass-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.card-ds {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s;
  height: 100%;
}
.card-ds:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: rgba(46,204,113,.4); }

.icon-tile {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center; font-size: 1.5rem; color: #fff;
  background: var(--gradient-brand);
  box-shadow: 0 8px 20px rgba(11,110,79,.3);
  flex-shrink: 0;
}
.icon-tile.alt { background: var(--gradient-accent); }
.icon-tile.sm { width: 44px; height: 44px; font-size: 1.15rem; border-radius: 12px; }

.stat-value { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 3vw, 2.7rem); }
.stat-label { font-family: var(--font-head); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }

/* Logo carousel */
.logo-strip { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.logo-track { display: flex; gap: 3.5rem; animation: marquee 28s linear infinite; width: max-content; }
.logo-strip:hover .logo-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.client-logo {
  font-family: var(--font-head); font-weight: 700; font-size: 1.05rem;
  color: var(--text-muted); opacity: .8; white-space: nowrap;
  display: flex; align-items: center; gap: .5rem;
}

/* Timeline */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 3px; background: var(--gradient-brand); border-radius: 3px; }
.timeline-item { position: relative; padding-bottom: 2.2rem; }
.timeline-item::before {
  content: ""; position: absolute; left: -2rem; top: 4px;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--bg); border: 4px solid var(--ds-emerald);
}
.timeline-year { font-family: var(--font-display); font-weight: 800; color: var(--ds-emerald); }

/* Net zero roadmap */
.nz-step { display: flex; gap: 1.2rem; align-items: flex-start; padding: 1.1rem 0; }
.nz-badge {
  min-width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 700;
  font-family: var(--font-head); background: var(--gradient-brand);
}
.nz-progress { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.nz-progress > span { display: block; height: 100%; border-radius: 999px; background: var(--gradient-accent); width: 0; transition: width 1.4s cubic-bezier(.2,.8,.2,1); }

/* Dashboard */
.widget {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem;
  box-shadow: var(--shadow); height: 100%;
}
.widget h6 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.score-ring { position: relative; width: 130px; height: 130px; margin: 0 auto; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.7rem;
}
.kpi-delta.up { color: var(--ds-emerald); } .kpi-delta.down { color: #E74C3C; }
.heatmap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; }
.heatmap span { aspect-ratio: 1; border-radius: 4px; display: block; }
.chart-box { position: relative; height: 260px; }

/* ---------- 6. FORMS / TABLES / CHAT ---------- */
.form-control, .form-select {
  background: var(--bg-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .65rem .9rem;
}
.form-control::placeholder { color: var(--text-muted); opacity: .7; }
.form-control:focus, .form-select:focus {
  background: var(--bg-alt); color: var(--text);
  border-color: var(--ds-emerald); box-shadow: 0 0 0 .2rem rgba(46,204,113,.18);
}
.form-label { font-family: var(--font-head); font-weight: 600; font-size: .85rem; }
.form-check-input:checked { background-color: var(--ds-green); border-color: var(--ds-green); }
.table { color: var(--text); }
.table > :not(caption) > * > * { background: transparent; color: var(--text); border-color: var(--border); }
.table thead th { font-family: var(--font-head); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.table-hover tbody tr:hover > * { background: rgba(46,204,113,.06); }

/* Chatbot */
.chat-fab {
  position: fixed; right: 22px; bottom: 88px; z-index: 1050;
  width: 58px; height: 58px; border-radius: 50%; border: none;
  background: var(--gradient-brand); color: #fff; font-size: 1.4rem;
  box-shadow: 0 12px 30px rgba(11,110,79,.45); transition: transform .25s ease;
}
.chat-fab:hover { transform: scale(1.08); }
.chat-panel {
  position: fixed; right: 22px; bottom: 158px; z-index: 1050;
  width: min(370px, calc(100vw - 44px)); height: 480px;
  display: none; flex-direction: column;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.chat-panel.open { display: flex; animation: popIn .3s ease; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97);} }
.chat-head { background: var(--gradient-brand); color: #fff; padding: .9rem 1.1rem; font-family: var(--font-head); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.chat-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.msg { max-width: 85%; padding: .6rem .9rem; border-radius: 14px; font-size: .88rem; line-height: 1.45; }
.msg.bot { background: var(--bg-alt); border: 1px solid var(--border); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.user { background: var(--ds-green); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); margin-right: 3px; animation: blink 1.2s infinite; }
.typing span:nth-child(2){ animation-delay: .2s; } .typing span:nth-child(3){ animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }
.chat-input { border-top: 1px solid var(--border); padding: .7rem; display: flex; gap: .5rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  border: 1px solid var(--border); background: var(--bg-alt); color: var(--text);
  border-radius: 999px; padding: .25rem .75rem; font-size: .76rem;
  font-family: var(--font-head); font-weight: 600; cursor: pointer; transition: all .2s;
}
.chip:hover { border-color: var(--ds-emerald); color: var(--ds-emerald); }

/* Back to top / toast */
.back-to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 1050;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--ds-green);
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
  box-shadow: var(--shadow);
}
.back-to-top.show { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-4px); color: var(--ds-emerald); }
.ds-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--ds-green-dark); color: #fff;
  padding: .8rem 1.4rem; border-radius: 999px; font-family: var(--font-head); font-weight: 600;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s; z-index: 2000; font-size: .9rem;
}
.ds-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 7. FOOTER & UTILITIES ---------- */
.footer { background: #07271D; color: rgba(255,255,255,.78); padding: 4rem 0 1.5rem; }
[data-theme="dark"] .footer { background: #0A110E; }
.footer h6 { color: #fff; font-family: var(--font-head); letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
.footer a { color: rgba(255,255,255,.72); text-decoration: none; transition: color .2s; }
.footer a:hover { color: var(--ds-emerald); }
.footer ul { list-style: none; padding: 0; }
.footer li { margin-bottom: .5rem; }
.social-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: rgba(255,255,255,.08); color: #fff !important;
  transition: background .25s, transform .25s;
}
.social-icon:hover { background: var(--ds-emerald); transform: translateY(-3px); }

.tag {
  display: inline-block; padding: .3rem .8rem; border-radius: 999px;
  background: rgba(46,204,113,.12); color: var(--ds-green);
  font-family: var(--font-head); font-size: .72rem; font-weight: 700; letter-spacing: .04em;
}
[data-theme="dark"] .tag { color: var(--ds-emerald); }
.tag.blue { background: rgba(21,101,192,.12); color: var(--ds-blue); }
[data-theme="dark"] .tag.blue { color: var(--ds-blue-light); }

.accordion-item { background: var(--bg-raised); border: 1px solid var(--border); }
.accordion-button { background: var(--bg-raised); color: var(--text); font-family: var(--font-head); font-weight: 600; }
.accordion-button:not(.collapsed) { background: rgba(46,204,113,.08); color: var(--ds-green); box-shadow: none; }
[data-theme="dark"] .accordion-button:not(.collapsed) { color: var(--ds-emerald); }
.accordion-body { color: var(--text-muted); }

.loader {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center;
  background: var(--bg); transition: opacity .5s ease, visibility .5s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader .leaf { font-size: 2.6rem; color: var(--ds-emerald); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .6;} 50% { transform: scale(1.18); opacity: 1;} }

/* ---------- 8. ANIMATIONS ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: .12s; } .reveal-delay-2 { transition-delay: .24s; } .reveal-delay-3 { transition-delay: .36s; }

@media (max-width: 767px) {
  .section { padding: 3.5rem 0; }
  .hero { min-height: 84vh; background-attachment: scroll; }
  .chat-panel { bottom: 150px; height: 60vh; }
}
.brand-logo-img {
  height: 48px;
  width: auto;
  display: block;
}
.footer .brand-logo-img {
  height: 56px;
}
@media (max-width: 576px) {
  .brand-logo-img { height: 40px; }
}
