:root {
  --chinsoft-primary: #10604e;
  --chinsoft-accent: #009f40;
  --chinsoft-primary-rgb: 16, 96, 78;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #14181c;
  --bs-tertiary-bg: #1c2126;
}

:root {
    --cs-canvas-line: rgba(16, 96, 78, 0.32); /* Primary brand color semi-transparent */
}

[data-bs-theme="dark"] {
    --cs-canvas-line: rgba(255, 255, 255, 0.32); /* White semi-transparent */
}
html {
  scroll-behavior: smooth;
}

/* Anchor-jump targets (Services page category links, the skip-to-content
   link) need to land below the fixed navbar rather than underneath it. */
#mainContent,
section[id] {
  scroll-margin-top: var(--nav-offset, 64px);
}

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Compensates for the now-fixed navbar so content never starts underneath
   it. site.js keeps --nav-offset in sync with the navbar's actual rendered
   height (which changes on the homepage's grow/shrink and when the mobile
   menu opens/closes). The transition mirrors the navbar's own so page
   content resizes in step with it, not after the fact. Scoped to
   .site-body (the public _Layout.cshtml) — the admin area's
   _AdminLayout.cshtml uses a sidebar, not this fixed navbar, and must not
   get this padding. */
body.site-body {
  padding-top: var(--nav-offset, 64px);
  transition: padding-top 0.35s ease;
}

main {
  flex: 1 0 auto;
  animation: page-fade-in 0.45s ease both;
}

/* Smooth color swaps when the theme toggles, without animating everything. */
body,
.navbar,
.card,
footer.site-footer,
.dropdown-menu,
.btn {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* --- Back to top button ---------------------------------------------------- */
.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1040;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background-color: var(--chinsoft-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, bottom 0.3s ease, background-color 0.2s ease;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background-color: var(--chinsoft-accent);
}

/* Lift the button clear of the cookie banner while it's showing. */
body.cookie-banner-visible .back-to-top {
  bottom: 5.5rem;
}

/* --- Button ripple effect ---------------------------------------------------- */
.btn {
  position: relative;
  overflow: hidden;
}

.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  animation: ripple-effect 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-effect {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* --- App store badges ---------------------------------------------------
   Built from Font Awesome brand icons + text rather than the official
   Google Play / App Store badge artwork, since that artwork carries its
   own brand guidelines this codebase can't guarantee compliance with
   (exact colors, clear-space, no restyling). This still clearly identifies
   each store and links straight to the listing. */
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  border-radius: 0.6rem;
  background-color: #111318;
  color: #ffffff !important;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.store-badge:hover {
  background-color: #000000;
  transform: translateY(-2px);
  color: #ffffff !important;
}

.store-badge i {
  font-size: 1.4rem;
}

.store-badge .store-badge-label {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Skip link (visually-hidden-focusable is a Bootstrap utility; this
   just makes it look intentional once focused) ------------------------- */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2000;
  padding: 0.75rem 1.25rem;
  background-color: var(--chinsoft-primary);
  color: #fff;
  text-decoration: none;
  border-bottom-right-radius: 0.5rem;
}

.skip-link:focus {
  color: #fff;
}

/* --- Brand / navbar ---------------------------------------------------- */
.navbar-brand-logo {
  display: inline-flex;
  align-items: center;
  background: transparent;
  padding: 6px 4px;
}

.navbar-brand-logo .logo-img {
  height: 48px;
  width: auto;
  display: block;
  transition: height 0.35s ease;
}

/* Show only the logo variant matching the active theme; both are
   transparent-background SVGs, no light/dark-mode background box needed. */
.navbar-brand-logo .logo-dark {
  display: none;
}

[data-bs-theme="dark"] .navbar-brand-logo .logo-light {
  display: none;
}

[data-bs-theme="dark"] .navbar-brand-logo .logo-dark {
  display: block;
}

.navbar-brand-logo .footer-logo {
  height: 34px;
}

.navbar {
  transition: padding-block 0.35s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar .nav-link {
  font-weight: 500;
  position: relative;
  white-space: nowrap;
  /* Fluid sizing across the whole "expanded" range (md and up, ~768px to
     ~1300px+) instead of a fixed breakpoint jump -- the nav now stays
     expanded on tablets and every laptop/desktop width, so it needs to
     keep shrinking gracefully all the way down to 768px rather than just
     around one narrow zone. */
  font-size: clamp(0.8rem, 0.62rem + 0.45vw, 1rem);
  padding-left: clamp(0.35rem, 0.05rem + 0.8vw, 0.75rem);
  padding-right: clamp(0.35rem, 0.05rem + 0.8vw, 0.75rem);
}

.nav-link-home i {
  font-size: 1.05rem;
}

.navbar .nav-link::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0;
  height: 2px;
  background-color: var(--chinsoft-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.navbar .nav-link:hover::after,
.navbar .nav-link.active::after {
  transform: scaleX(1);
}

.navbar .nav-link.active {
  color: var(--chinsoft-accent) !important;
  font-weight: 700;
}

/* Homepage-only: navbar starts tall at the top of the page, then shrinks
   once the visitor scrolls (site.js toggles "navbar-scrolled" on <body>).
   Every other page keeps the compact (already-shrunk) size at all times,
   since they never get the "home-navbar-grow" body class. */
body.home-navbar-grow .navbar {
  padding-block: 1.5rem;
}

body.home-navbar-grow .navbar-brand-logo .logo-img {
  height: 76px;
}

body.home-navbar-grow.navbar-scrolled .navbar {
  padding-block: 0.5rem;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.08);
}

body.home-navbar-grow.navbar-scrolled .navbar-brand-logo .logo-img {
  height: 48px;
}

/* Small logo size on narrower viewports, where every pixel of navbar
   height matters more than on desktop; overrides both the regular and
   homepage-grown states so mobile always gets the compact logo. */
@media (max-width: 991.98px) {
  .navbar-brand-logo .logo-img,
  body.home-navbar-grow .navbar-brand-logo .logo-img,
  body.home-navbar-grow.navbar-scrolled .navbar-brand-logo .logo-img {
    height: 36px;
  }
}

.btn-brand {
  background-color: var(--chinsoft-primary);
  border-color: var(--chinsoft-primary);
  color: #fff;
}

.btn-brand:hover,
.btn-brand:focus {
  background-color: var(--chinsoft-accent);
  border-color: var(--chinsoft-accent);
  color: #fff;
}

.text-brand {
  color: var(--chinsoft-primary) !important;
}

[data-bs-theme="dark"] .text-brand {
  color: var(--chinsoft-accent) !important;
}

.bg-brand-soft {
  background-color: rgba(var(--chinsoft-primary-rgb), 0.07);
}

/* --- Buttons: a little lift on hover for a more fluid feel --------------- */
.btn {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

/* --- Hero --------------------------------------------------------------- */
.hero-section {
  padding-block: 4rem;
}

.hero-illustration {
  max-width: 100%;
  height: auto;
  animation: hero-float 6s ease-in-out infinite;
}

.hero-canvas {
  display: block;
  width: 100%;
  max-width: 480px;
  height: 360px;
  margin: 0 auto;
}

@media (max-width: 767.98px) {
  .hero-canvas {
    height: 280px;
  }
}

/* --- Process flowchart canvas (Services page "How We Work") --------------- */
.process-diagram {
  position: relative;
  width: 100%;
}

/* The real diagram is wide and branching (matches the original flowchart),
   so on narrow viewports it scrolls horizontally instead of shrinking to
   the point of being illegible. */
.process-canvas-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.process-canvas {
  display: block;
  margin: 0 auto;
}

/* --- Cards --------------------------------------------------------------- */
.service-card,
.app-card,
.value-card {
  height: 100%;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  border: 1px solid var(--bs-border-color);
}

.service-card:hover,
.app-card:hover,
.value-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.12);
}

.service-icon,
.value-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(var(--chinsoft-primary-rgb), 0.1);
  color: var(--chinsoft-primary);
  font-size: 1.35rem;
  transition: transform 0.25s ease;
}

.service-card:hover .service-icon,
.value-card:hover .value-icon {
  transform: scale(1.1) rotate(-4deg);
}

[data-bs-theme="dark"] .service-icon,
[data-bs-theme="dark"] .value-icon {
  color: var(--chinsoft-accent);
}

.app-card img {
  height: 260px;
  width: auto;
  transition: transform 0.3s ease;
}

.app-card .app-mock {
    height: 260px;
}

.app-card:hover img {
  transform: translateY(-4px) scale(1.02);
}

/* --- Stats strip ---------------------------------------------------------- */
.stat-block {
  text-align: center;
}

.stat-block .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--chinsoft-primary);
  transition: color 0.3s ease;
}

[data-bs-theme="dark"] .stat-block .stat-number {
  color: var(--chinsoft-accent);
}

/* --- Apps sub-nav ---------------------------------------------------------- */
.apps-subnav .nav-link {
  border-radius: 2rem;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.apps-subnav .nav-link:hover {
  transform: translateY(-2px);
}

.apps-subnav .nav-link.active {
  background-color: var(--chinsoft-primary);
  color: #fff !important;
}

/* --- Footer ---------------------------------------------------------------- */
footer.site-footer {
  background-color: var(--bs-tertiary-bg);
  border-top: 1px solid var(--bs-border-color);
}

footer.site-footer a {
  transition: color 0.2s ease, padding-left 0.2s ease;
}

footer.site-footer a:hover {
  color: var(--chinsoft-accent) !important;
  padding-left: 3px;
}

/* --- Cookie consent banner (slides up instead of popping in) ---------------- */
.cookie-consent-banner {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1080;
  background-color: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
  box-shadow: 0 -0.5rem 1.5rem rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.cookie-consent-banner.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* --- Scroll-reveal animation --------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Keyframes -------------------------------------------------------------- */
@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* --- Utility --------------------------------------------------------------- */
.min-vh-60 {
  min-height: 60vh;
}

@media (max-width: 575.98px) {
  .hero-section {
    padding-block: 2.5rem;
    text-align: center;
  }
}

/* Respect reduced-motion preferences: keep the experience calm and static. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  main,
  .hero-illustration,
  .reveal,
  .btn,
  .btn .ripple,
  .service-card,
  .app-card,
  .value-card,
  .apps-subnav .nav-link,
  .navbar,
  .navbar-brand-logo .logo-img,
  .cookie-consent-banner,
  .back-to-top {
    animation: none !important;
    transition: none !important;
  }

  .btn .ripple {
    display: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
/* ============================================
   SHARED BASE
   .phone / .tablet only set custom properties;
   all structural rules live here.
   ============================================ */
.device-frame {
    position: relative;
    container-type: inline-size;
    aspect-ratio: var(--ar);
    border-radius: var(--radius);
    overflow: hidden;
    /* Border thickness — scales with container width, clamped to sane px bounds */
    --frame-border: clamp(var(--border-min), calc(100cqw * var(--border-frac)), var(--border-max));
}

    /* Bezel border + top/bottom sheen — identical structure across variants */
    .device-frame::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 2;
        pointer-events: none;
        border-radius: inherit;
        box-sizing: border-box;
        border: var(--frame-border) solid var(--border-color);
        background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) calc(100cqw * var(--grad-top-frac))), linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) calc(100cqw * var(--grad-bottom-frac)));
    }

    /* Image layer — fully shared; insets by the border so it's never clipped */
    .device-frame img {
        position: absolute;
        inset: var(--frame-border);
        width: calc(100% - (2 * var(--frame-border)));
        height: calc(100% - (2 * var(--frame-border)));
        max-width: none;
        display: block;
        z-index: 1;
        object-fit: cover;
        object-position: top center;
        opacity: 1;
        transition: opacity 0.8s ease-in-out, transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .device-frame[data-slideshow] img {
        opacity: 0;
    }

    .device-frame img.logo {
        object-fit: contain;
        object-position: center;
        padding: 25%;
        box-sizing: border-box;
        background-color: var(--logo-bg-color, #1e1e2f);
    }

    /* ============================================
   PHONE VARIANT — numbers only
   ============================================ */
    .device-frame.phone {
        --ar: 320 / 650;
        --radius: 13.75% / 6.77%; /* (44/320) horiz, (44/650) vert */
        --border-color: #1a1a1a;
        --border-frac: 0.0375; /* 12/320 */
        --border-min: 6px;
        --border-max: 14px;
        --grad-top-frac: 0.125; /* 40/320 */
        --grad-bottom-frac: 0.09375; /* 30/320 */
    }

        .device-frame.phone::after {
            content: "";
            position: absolute;
            inset: 0;
            z-index: 3;
            pointer-events: none;
            background:
            /* Camera punch hole — center pushed to 26/320 from top */
            radial-gradient(circle at 50% calc(100cqw * (26 / 320)), #000 0, #000 calc(100cqw * (7 / 320)), transparent calc(100cqw * (8 / 320)) ),
            /* Home indicator bar — center pushed to 20/320 from bottom */
            linear-gradient(to right, rgba(255,255,255,0.7), rgba(255,255,255,0.7)) no-repeat center calc(100% - calc(100cqw * (20 / 320))) / calc(100cqw * (120 / 320)) calc(100cqw * (4 / 320));
        }

    /* ============================================
   TABLET VARIANT — numbers only
   ============================================ */
    .device-frame.tablet {
        --ar: 640 / 440;
        --radius: 4.375% / 6.36%; /* (28/640) horiz, (28/440) vert */
        --border-color: #1f1f1f;
        --border-frac: 0.025; /* 16/640 */
        --border-min: 6px;
        --border-max: 16px;
        --grad-top-frac: 0.05625; /* 36/640 */
        --grad-bottom-frac: 0.05625; /* 36/640 */
    }

    .device-frame.phone::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 3;
        pointer-events: none;
        background:
        /* Camera punch hole — center pushed to 26/320 from top */
        radial-gradient(circle at 50% calc(100cqw * (26 / 320)), #000 0, #000 calc(100cqw * (7 / 320)), transparent calc(100cqw * (8 / 320)) ),
        /* Home indicator bar — center pushed to 20/320 from bottom */
        linear-gradient(to right, rgba(255,255,255,0.7), rgba(255,255,255,0.7)) no-repeat center calc(100% - calc(100cqw * (20 / 320))) / calc(100cqw * (120 / 320)) calc(100cqw * (4 / 320));
    }

    /* ============================================
   SLIDESHOW TRANSITIONS — fully shared
   ============================================ */
    .device-frame img.slide-left {
        opacity: 0;
        transform: translateX(100%);
    }

    .device-frame img.slide-up {
        opacity: 0;
        transform: translateY(100%);
    }

    .device-frame img.zoom-in {
        opacity: 0;
        transform: scale(0.85);
    }

    .device-frame img.active {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    .device-frame img.slide-left.exiting {
        opacity: 0;
        transform: translateX(-100%);
    }

    .device-frame img.slide-up.exiting {
        opacity: 0;
        transform: translateY(-50%);
    }
