/* =========================================================
   CodeGrameen design system: shared by every page.
   Page-specific styles live in their own file (e.g. home.css).
   Sections: 1 tokens, 2 base + layout, 3 components, 4 animations, 5 responsive
   ========================================================= */

/* =========================================================
   1. TOKENS
   ========================================================= */
:root {
  /* Brand colors */
  --navy: #2C485E;
  --navy-dark: #1f3345;
  --accent: #64c786; /* logo green */
  /* Variants for contrast: navy text on --accent-strong, --accent-ink as text on light, --accent-soft as text on dark */
  --accent-strong: #64c786;
  --accent-ink: #1e7a46;
  --accent-soft: #8fe0a9;
  --accent-tint: #e3f6ea;
  --accent-rgb: 100, 199, 134;
  --light: #f8f9fa;
  --text: #212529;
  --muted: #5b6770;
  --line: #e3e8ec;
  --white: #ffffff;
  --good: #0f7d3c;
  --bad: #b3261e;

  /* Radii */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(31, 51, 69, .08);
  --shadow: 0 12px 32px rgba(31, 51, 69, .12);
  --shadow-lg: 0 24px 60px rgba(31, 51, 69, .22);

  --ease: cubic-bezier(.22, .8, .26, 1);
  --nav-h: 72px;
  --container: 1180px;
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* =========================================================
   2. BASE + LAYOUT
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--white);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button, input, textarea { font-family: inherit; }
ul { margin: 0; padding: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 3px; border-radius: 6px; }
.on-dark :focus-visible { outline-color: var(--accent-soft); }

.container { width: min(100% - 40px, var(--container)); margin-inline: auto; }
.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;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--navy-dark); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

.section { padding: 96px 0; position: relative; scroll-margin-top: -28px; }
.section-light { background: var(--light); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 44px; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-ink); margin-bottom: 12px;
}
.on-dark .eyebrow { color: var(--accent-soft); }
h2.title, .section-head h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem); line-height: 1.2; font-weight: 700; color: var(--navy-dark);
}
.section-sub { margin-top: 14px; color: var(--muted); font-size: 1.05rem; }
.fine-print { text-align: center; font-size: .85rem; color: var(--muted); margin-top: 22px; }

/* =========================================================
   3. COMPONENTS
   ========================================================= */

/* ---- Buttons ---- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .8rem 1.5rem; border-radius: var(--radius-pill);
  font-weight: 600; font-size: .95rem; line-height: 1.3; text-decoration: none; text-align: center;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .25s, background-color .25s, color .25s, border-color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { cursor: not-allowed; opacity: .85; transform: none; }
.btn-lg { padding: 1rem 1.9rem; font-size: 1.05rem; }
.btn-primary { background: var(--accent-strong); color: var(--navy-dark); box-shadow: 0 8px 22px rgba(var(--accent-rgb), .4); }
.btn-primary:hover { background: #7ad596; box-shadow: 0 12px 28px rgba(var(--accent-rgb), .5); }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy); background: #fff; }
.btn i.fa-arrow-right { transition: transform .25s var(--ease); }
.btn:hover i.fa-arrow-right { transform: translateX(4px); }
.ripple {
  position: absolute; border-radius: 50%; background: currentColor; opacity: .25;
  transform: scale(0); pointer-events: none; animation: ripple .6s linear forwards;
}

/* ---- CTA strip (end of each major section) ---- */
.cta-strip {
  margin-top: 56px; padding: 26px 30px; border-radius: var(--radius-lg);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 28px;
  background: linear-gradient(120deg, var(--navy-dark), var(--navy)); color: #fff; box-shadow: var(--shadow);
}
.cta-strip strong { display: block; font-size: 1.15rem; font-weight: 600; }
.cta-strip span { color: rgba(255, 255, 255, .8); font-size: .95rem; }

/* ---- Page header (blog, case studies, about, contact) ---- */
.page-hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(160deg, var(--navy-dark), var(--navy)); padding: 72px 0 64px; }
.page-hero::before { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; top: -220px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--accent-rgb), .26), transparent 65%); pointer-events: none; }
.page-hero .container { position: relative; }
.page-hero h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.15; font-weight: 700; letter-spacing: -.01em; margin-bottom: 14px; }
.page-hero .lead { color: rgba(255, 255, 255, .85); font-weight: 300; font-size: clamp(1rem, 1.8vw, 1.2rem); max-width: 720px; margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px 10px; list-style: none; font-size: .88rem; color: rgba(255, 255, 255, .7); margin-bottom: 16px; }
.crumbs a { text-decoration: none; color: rgba(255, 255, 255, .85); }
.crumbs a:hover { color: var(--accent-soft); }
.crumbs li + li::before { content: "/"; margin-right: 10px; opacity: .5; }

/* ---- Text link with arrow ---- */
.case-link { margin-top: auto; align-self: flex-start; font-weight: 600; color: var(--accent-ink); text-decoration: none; }
.case-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.case-link i { margin-left: 6px; transition: transform .25s var(--ease); }
.case-link:hover i { transform: translateX(4px); }

/* ---- FAQ (home and service pages) ---- */
.faq-list { max-width: 820px; margin: 0 auto; display: grid; gap: 12px; }
.faq { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: box-shadow .3s, border-color .3s; }
.faq[open] { border-color: rgba(44, 72, 94, .35); box-shadow: var(--shadow); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-radius: var(--radius); }
.faq summary::-webkit-details-marker { display: none; }
.faq-q { font-size: 1rem; font-weight: 600; color: var(--navy-dark); margin: 0; }
.faq summary i { color: var(--navy); flex: none; transition: transform .35s var(--ease); }
.faq[open] summary i { transform: rotate(180deg); }
.faq-a { padding: 0 22px 20px; color: var(--muted); }
.faq[open] .faq-a { animation: fadeUp .4s var(--ease); }

/* ---- Result tiles (homepage proof and case studies) ---- */
.case-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.case-metric { background: var(--light); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; }
.case-metric strong { display: block; font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1.2; }
.case-metric span { display: block; font-size: .78rem; color: var(--muted); line-height: 1.3; }
.case-metric strong span { display: inline; font-size: inherit; color: inherit; }

/* ---- Forms (plan form, contact form) ---- */
.form-card { background: #fff; color: var(--text); border-radius: var(--radius-lg); padding: 34px; box-shadow: var(--shadow-lg); }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .92rem; color: var(--navy-dark); margin-bottom: 6px; }
.field label .req { color: var(--bad); }
.field input, .field textarea {
  width: 100%; padding: 13px 16px; font-size: 1rem; color: var(--text); background: #fff;
  border: 2px solid var(--line); border-radius: var(--radius-sm); outline: 0; resize: vertical;
  transition: border-color .25s, box-shadow .25s;
}
.field input:focus, .field textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .3); }
.field.has-error input, .field.has-error textarea { border-color: var(--bad); }
.field .error { color: var(--bad); font-size: .85rem; margin-top: 6px; min-height: 0; display: none; }
.field.has-error .error { display: block; animation: fadeUp .3s var(--ease); }
.field.shake { animation: shake .45s; }
.submit-btn { width: 100%; }
.submit-btn .spinner { display: none; width: 18px; height: 18px; border: 3px solid rgba(31, 51, 69, .25); border-top-color: var(--navy-dark); border-radius: 50%; animation: spin .8s linear infinite; }
.submit-btn.is-loading .spinner { display: inline-block; }
.submit-btn.is-loading .arrow { display: none; }
.form-status { margin-top: 12px; font-size: .9rem; color: var(--bad); }
.form-note { margin-top: 12px; text-align: center; font-size: .82rem; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.success { text-align: center; padding: 20px 0; }
.success:focus { outline: none; }
.success svg { width: 96px; height: 96px; margin: 0 auto 16px; display: block; }
.success .ring { fill: none; stroke: var(--good); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .7s ease forwards; }
.success .tick { fill: none; stroke: var(--good); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s ease .6s forwards; }
.success h3 { font-size: 1.5rem; color: var(--navy-dark); margin-bottom: 8px; }
.success p { color: var(--muted); margin-bottom: 20px; }

/* ---- Header / navbar ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: saturate(1.4) blur(8px); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid transparent;
  transition: box-shadow .3s, background-color .3s, border-color .3s;
}
.site-header.scrolled { background: rgba(255, 255, 255, .93); box-shadow: 0 6px 24px rgba(31, 51, 69, .12); border-color: var(--line); }
.nav-inner { height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 700; color: var(--navy); text-decoration: none; letter-spacing: -.01em; }
.brand b { font-weight: 700; }
.brand span { color: var(--accent-ink); }
.brand-mark { width: 34px; height: 34px; flex: none; transition: transform .6s var(--ease); }
.brand:hover .brand-mark { transform: rotate(60deg); }
.brand-mark .m-fill { fill: var(--accent); }
.brand-mark .m-line { fill: none; stroke: var(--navy); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.nav-menu { display: flex; align-items: center; gap: 30px; }
.nav-menu ul { display: flex; gap: 26px; list-style: none; }
.nav-menu li a {
  position: relative; text-decoration: none; font-weight: 500; font-size: .95rem; color: var(--navy); padding: 6px 0;
}
.nav-menu li a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.nav-menu li a:hover::after, .nav-menu li a[aria-current="page"]::after { transform: scaleX(1); }
.nav-cta { padding: .65rem 1.2rem; font-size: .88rem; }
.nav-toggle {
  display: none; width: 44px; height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; cursor: pointer; align-items: center; justify-content: center;
}
.bars { width: 20px; height: 14px; position: relative; display: block; }
.bars span { position: absolute; left: 0; width: 100%; height: 2px; background: var(--navy); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s, top .3s var(--ease); }
.bars span:nth-child(1) { top: 0; }
.bars span:nth-child(2) { top: 6px; }
.bars span:nth-child(3) { top: 12px; }
.nav-toggle[aria-expanded="true"] .bars span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bars span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* ---- Footer ---- */
.site-footer { background: #162735; color: rgba(255, 255, 255, .8); padding: 64px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; }
.site-footer .brand { color: #fff; display: inline-flex; margin-bottom: 14px; }
.site-footer .brand span { color: var(--accent-soft); }
.site-footer .brand-mark .m-line { stroke: #162735; }
.site-footer h3 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.site-footer ul { list-style: none; display: grid; gap: 10px; }
.site-footer a { text-decoration: none; transition: color .2s; }
.site-footer a:hover { color: var(--accent-soft); }
.site-footer p { font-size: .95rem; }
.footer-bottom { margin-top: 44px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: .85rem; color: rgba(255, 255, 255, .6); }

/* ---- Floating buttons ---- */
.float-btn {
  position: fixed; bottom: 20px; z-index: 80; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 1.4rem; color: #fff; text-decoration: none; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(20px) scale(.8);
  transition: opacity .35s, transform .35s var(--ease), visibility .35s, background-color .25s;
}
.float-btn.show { opacity: 1; visibility: visible; transform: none; }
.float-btn:hover { transform: translateY(-4px) scale(1.05); }
.float-wa { left: 20px; background: var(--good); }
.float-top { right: 20px; background: var(--navy); }

/* =========================================================
   4. ANIMATIONS
   ========================================================= */
.js .reveal { opacity: 0; }
.js .reveal.in { opacity: 1; animation: revealUp .75s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 90ms); }

@keyframes revealUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* =========================================================
   5. RESPONSIVE
   ========================================================= */
@media (max-width: 1040px) {
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 16px;
    background: #fff; padding: 12px 20px 22px; box-shadow: 0 16px 30px rgba(31, 51, 69, .15);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .3s, transform .3s var(--ease), visibility .3s;
  }
  .nav-menu.open { opacity: 1; visibility: visible; transform: none; }
  .nav-menu ul { flex-direction: column; gap: 0; }
  .nav-menu li a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav-menu li a::after { display: none; }
  .nav-cta { padding: .85rem 1.2rem; font-size: .95rem; }
}
@media (max-width: 720px) {
  .section { padding: 72px 0; }
  .page-hero { padding: 52px 0 48px; }
  .form-card { padding: 26px 22px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 520px) {
  .cta-strip { padding: 22px; }
  .cta-strip .btn { width: 100%; }
}

/* Reduced motion: keep layout and state changes, drop non-essential motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
