:root {
  --bg: #131312;
  --bg-2: #171612;
  --panel: #ede6d8;
  --panel-dark: #1e1b16;
  --ink: #f7f1e7;
  --muted: #b8ad9d;
  --muted-dark: #5f574a;
  --gold: #ffc107;
  --cyan: #00d9ee;
  /* Mangal Tech studio identity — techy electric azure.
     Constant on every page (logo mark, studio ambient). */
  --studio: #1ec9e8;
  --studio-strong: #4bd8f2;
  --studio-ink: #04222b;
  --studio-rgb: 30, 201, 232;
  /* Semantic accent — defaults to the studio colour.
     App pages and homepage chapters override these.
     All values verified >= 4.5:1 against their surfaces. */
  --accent: var(--studio);
  --accent-rgb: var(--studio-rgb);
  --accent-ink: var(--studio-ink);
  --accent-btn: var(--studio);
  --accent-btn-hover: var(--studio-strong);
  --font-mono: "Cascadia Code", "Segoe UI Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Per-app accent themes (applied via a body class on each app page).
   Button colours differ from text accents where contrast demands it. */
body.theme-gold {
  --accent: #ffc107;
  --accent-rgb: 255, 193, 7;
  --accent-ink: #111111;
  --accent-btn: #ffc107;
  --accent-btn-hover: #ffce3a;
}

body.theme-cista {
  --accent: #5fbb56;
  --accent-rgb: 95, 187, 86;
  --accent-ink: #0c2110;
  --accent-btn: #5fbb56;
  --accent-btn-hover: #6ecb63;
}

body.theme-vishal {
  --accent: #ff3300;
  --accent-rgb: 255, 51, 0;
  --accent-ink: #ffffff;
  /* white text needs a deeper red: #d92b00 = 4.89:1, hover #c62800 = 5.67:1 */
  --accent-btn: #d92b00;
  --accent-btn-hover: #c62800;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(var(--accent-rgb), 0.1), transparent 30rem),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 10;
  background: var(--studio);
  color: var(--studio-ink);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 16px;
}

/* Containers: .site-shell wraps whole app pages; .shell is the inner
   container for the full-bleed homepage bands. */
.site-shell,
.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  backdrop-filter: blur(18px);
  background: rgba(19, 19, 18, 0.6);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1160px, calc(100% - 32px));
}

.brand-mark,
.site-nav,
.hero-actions,
.site-footer {
  display: flex;
  align-items: center;
}

.brand-mark {
  gap: 12px;
  text-decoration: none;
}

.brand-symbol {
  display: block;
  width: 33px;
  height: 38px;
  flex-shrink: 0;
  transition: transform 180ms ease;
}

.brand-mark:hover .brand-symbol,
.brand-mark:focus-visible .brand-symbol {
  transform: translateY(-2px);
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark strong {
  font-size: 15px;
}

.brand-mark small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.site-nav {
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(19, 19, 18, 0.72);
}

.site-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

/* ---------- Type system ---------- */

.kicker,
.status-line {
  margin: 0 0 14px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(44px, 6.5vw, 78px);
  line-height: 0.94;
  letter-spacing: -0.015em;
}

.hero-text {
  max-width: 560px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.58;
}

.hero-actions {
  gap: 12px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  font-weight: 700;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease;
}

.button.primary {
  background: var(--accent-btn);
  color: var(--accent-ink);
}

.button.secondary {
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ink);
}

.button:focus-visible {
  outline: 2px solid var(--studio);
  outline-offset: 3px;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--accent-btn-hover);
}

.button.secondary:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.05);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* ---------- Studio statement (home hero) ---------- */

.studio-statement {
  position: relative;
  padding: 96px 0 88px;
  background:
    radial-gradient(circle at 82% 18%, rgba(var(--studio-rgb), 0.12), transparent 26rem),
    radial-gradient(circle at 8% 90%, rgba(255, 193, 7, 0.05), transparent 20rem);
}

.studio-statement h1 {
  max-width: none;
  font-size: clamp(56px, 9.5vw, 124px);
  line-height: 0.92;
  margin-bottom: 26px;
}

.studio-statement .hl {
  text-decoration: underline;
  text-decoration-color: var(--studio);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.13em;
}

.spectrum {
  display: flex;
  height: 4px;
  margin-top: 48px;
  border-radius: 2px;
  overflow: hidden;
}

.spectrum span {
  flex: 1;
}

.sp-gold { background: var(--gold); }
.sp-cista { background: #5fbb56; }
.sp-vishal { background: #ff3300; }

.product-index {
  list-style: none;
  margin: 0;
  padding: 0;
}

.product-index li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.ix-gold { --row-rgb: 255, 193, 7; }
.ix-cista { --row-rgb: 95, 187, 86; }
.ix-vishal { --row-rgb: 255, 51, 0; }

.product-index a {
  display: grid;
  grid-template-columns: 56px 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px 6px;
  text-decoration: none;
  transition: background 160ms ease, padding-left 160ms ease;
}

.product-index a:hover,
.product-index a:focus-visible {
  background: rgba(var(--row-rgb), 0.07);
  padding-left: 14px;
}

.ix-no {
  font-family: var(--font-mono);
  font-size: 13px;
  color: rgb(var(--row-rgb));
}

.ix-tile {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  object-fit: cover;
  transition: border-color 160ms ease;
}

.product-index a:hover .ix-tile,
.product-index a:focus-visible .ix-tile {
  border-color: rgba(var(--row-rgb), 0.55);
}

.product-index strong {
  font-size: clamp(24px, 3.4vw, 40px);
  letter-spacing: -0.01em;
}

.product-index em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.creed {
  margin: 34px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Chapters ---------- */

.chapter {
  padding: 104px 0;
}

.chapter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.chapter-head .kicker {
  margin: 0;
}

.ch-no {
  display: inline-block;
  margin-right: 14px;
  padding-right: 14px;
  border-right: 1px solid currentColor;
}

.chapter-tile {
  width: clamp(76px, 9vw, 132px);
  height: clamp(76px, 9vw, 132px);
  border-radius: clamp(18px, 2.2vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  object-fit: cover;
  box-shadow: var(--shadow-soft);
}

.chapter-title {
  margin-bottom: 18px;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.95;
  letter-spacing: -0.015em;
}

.chapter-lede {
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.58;
}

.chapter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 38px;
}

/* --- 01 Gold Master: ledger / rate-board motif --- */

.chapter-gold {
  --accent: var(--gold);
  --accent-rgb: 255, 193, 7;
  --accent-ink: #111111;
  --accent-btn: var(--gold);
  --accent-btn-hover: #ffce3a;
  background:
    radial-gradient(circle at 85% 10%, rgba(255, 193, 7, 0.1), transparent 26rem),
    linear-gradient(180deg, #17130c, #131312);
  border-top: 1px solid rgba(255, 193, 7, 0.22);
}

.rate-board {
  margin-top: 40px;
  border: 1px solid rgba(255, 193, 7, 0.28);
  border-radius: var(--radius-md);
  background: #221b10;
  font-family: var(--font-mono);
  overflow: hidden;
}

.board-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.6fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
}

.board-row + .board-row {
  border-top: 1px dashed rgba(255, 193, 7, 0.22);
}

.b-label {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.b-mask {
  font-size: clamp(17px, 2.4vw, 24px);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.b-src,
.b-sync {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
}

.sync-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 2.2s ease-in-out infinite;
}

.board-note {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ledger {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
}

.ledger li {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 18px;
  padding: 14px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 160ms ease, padding-left 160ms ease;
}

.ledger li:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ledger li:hover {
  background: rgba(255, 193, 7, 0.05);
  padding-left: 12px;
}

.lg-key {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.lg-val {
  color: var(--muted);
  line-height: 1.5;
}

/* --- 02 Cista Medicorp: clinical white reference motif --- */

.chapter-cista {
  /* on-white text colours, contrast-verified:
     #2f7a29 = 5.33:1, #006e99 = 5.69:1, #3d453c = 9.93:1 */
  --accent: #2f7a29;
  --accent-rgb: 95, 187, 86;
  --accent-ink: #0c2110;
  --accent-btn: #5fbb56;
  --accent-btn-hover: #54ab4b;
  background: #ffffff;
  color: #17231a;
  color-scheme: light;
}

.chapter-cista .kicker {
  color: #2f7a29;
}

.chapter-cista .chapter-lede {
  color: #3d453c;
}

.chapter-cista .chapter-title {
  color: #17231a;
}

.chapter-logo {
  width: min(38vw, 250px);
  height: auto;
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.ref-card {
  padding: 20px;
  border: 1px solid #d8e3d6;
  border-top: 3px solid #5fbb56;
  border-radius: 4px;
  background: #fbfdfb;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.ref-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(23, 35, 26, 0.1);
}

.ref-card:nth-child(even) {
  border-top-color: #00b0f0;
}

.ref-card h3 {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2f7a29;
}

.ref-card:nth-child(even) h3 {
  color: #006e99;
}

.ref-card p {
  margin: 0;
  color: #3d453c;
  font-size: 15px;
  line-height: 1.55;
}

.chapter-cista .button:focus-visible {
  outline-color: #006e99;
}

/* --- 03 Vishal Rewards: token / stamp motif --- */

.chapter-vishal {
  --accent: #ff3300;
  --accent-rgb: 255, 51, 0;
  --accent-ink: #ffffff;
  --accent-btn: #d92b00;
  --accent-btn-hover: #c62800;
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 51, 0, 0.1), transparent 24rem),
    linear-gradient(180deg, #1a1210, #131312);
  border-top: 1px solid rgba(255, 51, 0, 0.28);
}

.token-board {
  display: flex;
  align-items: center;
  gap: 34px;
  flex-wrap: wrap;
  margin-top: 40px;
}

.points-stamp {
  display: grid;
  place-content: center;
  gap: 4px;
  width: 172px;
  height: 172px;
  border: 2px dashed rgba(255, 51, 0, 0.65);
  border-radius: 50%;
  text-align: center;
  background: rgba(255, 51, 0, 0.06);
  transform: rotate(-4deg);
}

.stamp-count {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  color: #ff3300;
  font-variant-numeric: tabular-nums;
}

.stamp-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  max-width: 120px;
  margin: 0 auto;
}

.token-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  max-width: 420px;
}

.token-chips li {
  padding: 10px 16px;
  border: 1px solid rgba(255, 51, 0, 0.5);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: rgba(255, 51, 0, 0.07);
  transition: background 160ms ease, border-color 160ms ease;
}

.token-chips li:hover {
  background: rgba(255, 51, 0, 0.15);
  border-color: rgba(255, 51, 0, 0.85);
}

/* ---------- Readiness band ---------- */

.readiness-band {
  background: var(--panel);
  color: #17130f;
}

.readiness-panel {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 40px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 72px;
}

.readiness-panel .status-line {
  color: #0a6478;
}

.readiness-panel h2 {
  max-width: 620px;
  margin-bottom: 16px;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1;
}

.readiness-panel p {
  color: var(--muted-dark);
  line-height: 1.58;
}

.readiness-list {
  margin: 0;
  display: grid;
  gap: 12px;
}

.readiness-list div {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(16, 16, 14, 0.07);
  transition: background 160ms ease;
}

.readiness-list div:hover {
  background: rgba(16, 16, 14, 0.12);
}

.readiness-list a {
  color: inherit;
  transition: color 160ms ease;
}

.readiness-list a:hover,
.readiness-list a:focus-visible {
  color: #0a6478;
}

.readiness-list dt {
  color: var(--muted-dark);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.readiness-list dd {
  margin: 6px 0 0;
  font-weight: 700;
}

/* ---------- Footer ---------- */

.site-footer {
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 26px 0 42px;
  color: var(--muted);
  font-size: 14px;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  width: min(1160px, calc(100% - 32px));
}

.site-footer a {
  text-decoration: none;
  transition: color 160ms ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- App subpages (unchanged structure) ---------- */

.page-hero {
  padding: 72px 0 46px;
}

.page-hero h1 {
  max-width: 760px;
}

.app-page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 38px;
  align-items: center;
}

.app-logo-panel {
  margin: 0;
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  background: rgba(30, 27, 22, 0.76);
  overflow: hidden;
}

.app-logo-panel img {
  max-width: min(78%, 240px);
  max-height: 180px;
  border-radius: var(--radius-sm);
}

.cista-logo-panel {
  background: #ffffff;
  padding: 22px;
}

.cista-logo-panel img {
  width: 100%;
  max-width: 320px;
  height: auto;
  max-height: 150px;
  object-fit: contain;
}

.vishal-logo-panel {
  background: linear-gradient(145deg, rgba(255, 51, 0, 0.14), #14120f);
}

.gold-logo-panel {
  background: linear-gradient(145deg, rgba(255, 193, 7, 0.18), #14120f);
}

.content-panel {
  margin: 0 0 72px;
  padding: 30px;
  border-radius: var(--radius-lg);
  background: rgba(237, 230, 216, 0.96);
  color: #181511;
}

.content-panel h2,
.content-panel h3 {
  color: #181511;
}

.content-panel p,
.content-panel li {
  color: #4f473d;
  line-height: 1.65;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.content-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(16, 16, 14, 0.06);
  border-left: 3px solid rgba(var(--accent-rgb), 0.6);
  transition: border-color 160ms ease;
}

.content-card:hover {
  border-left-color: rgb(var(--accent-rgb));
}

/* ---------- Motion ---------- */

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 520ms ease, transform 520ms ease;
}

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

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .site-header,
  .header-row {
    align-items: flex-start;
    gap: 14px;
    flex-direction: column;
  }

  .site-nav {
    max-width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .readiness-panel,
  .app-page-hero {
    grid-template-columns: 1fr;
  }

  .studio-statement {
    padding: 64px 0 64px;
  }

  .chapter {
    padding: 76px 0;
  }

  .product-index a {
    grid-template-columns: 40px 48px minmax(0, 1fr);
  }

  .product-index em {
    grid-column: 3;
  }

  .ix-tile {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .site-shell,
  .shell {
    width: min(100% - 22px, 1160px);
  }

  h1 {
    font-size: 45px;
  }

  .studio-statement h1 {
    font-size: clamp(44px, 13vw, 56px);
  }

  .chapter-title {
    font-size: clamp(38px, 11vw, 48px);
  }

  .board-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .ledger li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .token-board {
    justify-content: center;
  }

  .readiness-panel,
  .content-panel {
    padding-left: 0;
    padding-right: 0;
  }

  .content-panel {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
