/* MedBrandify — Exact Design System */
:root {
  --ink: #0F2B46;
  --ink-2: #2B4A66;
  --muted: #566B7D;
  --paper: #F3F7F7;
  --card: #FFFFFF;
  --line: #D3E0E0;
  --grid: #E2ECEC;
  --vital: #0A7C69;
  --vital-2: #08665A;
  --vital-lt: #3FD1B5;
  --amber: #F4B63F;
  --tint: #E9F1F1;
  --wa: #128C4A;
  --wa-hover: #0D7640;
  --leak: #8A3B13;
  --error: #B3261E;

  --f-body: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
  --f-disp: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;

  --r-s: 6px;
  --r-m: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.85;
  font-weight: 500;
  word-spacing: 1px;
  letter-spacing: 0;
  background: var(--paper);
  color: var(--ink);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

h1, h2, h3, h4,
.brand__name,
.result__num,
summary,
.score__head b,
.steps b,
.pledge b {
  font-family: var(--f-disp);
  font-weight: 700;
  font-synthesis: none;
  letter-spacing: 0.15px;
  word-spacing: 2px;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.25;
  color: var(--ink);
}

h2 {
  font-size: clamp(1.55rem, 3.2vw, 2.2rem);
  line-height: 1.4;
  color: var(--ink);
}

h3 {
  font-size: 1.2rem;
  line-height: 1.4;
  color: var(--ink);
}

.lead {
  font-size: 1.15rem;
  color: var(--ink-2);
  max-width: 60ch;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 20px;
}

.narrow {
  max-width: 760px;
}

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 247, 247, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.top__in {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-inline-end: auto;
  color: var(--ink);
}

.brand__mark {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: block;
}

.brand__name {
  font-size: 1.25rem;
  direction: ltr;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand__accent {
  color: #14C8B8;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  padding: 8px 12px;
  border-radius: var(--r-s);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  background: #E1ECEC;
}

.nav a[aria-current="page"] {
  background: #DCEBE8;
  color: var(--vital-2);
}

.menu-toggle {
  display: none;
  padding: 8px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--vital);
  color: #fff;
  border: 2px solid var(--vital);
  border-radius: var(--r-s);
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn:hover {
  background: var(--vital-2);
  border-color: var(--vital-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn--sm {
  padding: 10px 16px;
  font-size: 0.92rem;
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
}

.btn--ghost:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.btn--wa {
  background: var(--wa);
  border-color: var(--wa);
  color: #fff;
}

.btn--wa:hover {
  background: var(--wa-hover);
  border-color: var(--wa-hover);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

/* Hero + Chart Paper + ECG */
.chart {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

.hero {
  position: relative;
  padding-block: clamp(40px, 7vw, 84px) clamp(70px, 9vw, 120px);
  overflow: hidden;
}

.hero__in {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(24px, 5vw, 56px);
  align-items: start;
}

.hero__copy {
  padding-top: 12px;
}

.hero__copy h1 {
  margin-bottom: 18px;
}

.hero__copy .btn {
  padding: 15px 24px;
}

.hero__note {
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--ink-2);
}

.hero__note strong {
  background: var(--amber);
  color: var(--ink);
  padding: 0 6px;
  border-radius: 3px;
  font-weight: 700;
}

.ecg {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  width: 100%;
  height: 64px;
  pointer-events: none;
}

.ecg path {
  fill: none;
  stroke: var(--vital);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1800;
  stroke-dashoffset: 1800;
  animation: ecg 2.4s ease-out 0.3s forwards;
}

@keyframes ecg {
  to {
    stroke-dashoffset: 0;
  }
}

/* Interactive Scorecard */
.score {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: var(--r-m);
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
}

.score__head {
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.score__head b {
  font-size: 1rem;
}

.score__head span {
  color: #B8CAD4;
  font-size: 0.88rem;
}

.score__body {
  padding: 10px 20px 20px;
}

.q {
  border: none;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.q:last-of-type {
  border-bottom: none;
}

.q legend,
.q__label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.6;
}

.seg {
  display: inline-flex;
  align-self: flex-end;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  overflow: hidden;
  background: var(--card);
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg label {
  padding: 5px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.seg label + input + label {
  border-inline-start: 1px solid var(--line);
}

.seg input[value="1"]:checked + label {
  background: var(--vital);
  color: #fff;
}

.seg input[value="0"]:checked + label {
  background: var(--ink-2);
  color: #fff;
}

.score__go {
  width: 100%;
  margin-top: 8px;
}

.score__msg {
  color: var(--error);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 10px;
  display: none;
}

.score__msg.visible {
  display: block;
}

/* Scorecard Result State */
.result {
  padding: 18px 20px 22px;
}

.result__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.result__num {
  font-size: 2rem;
  color: var(--ink);
  line-height: 1;
}

.result__tier {
  background: #E5F3F0;
  color: var(--vital-2);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.86rem;
  font-weight: 700;
}

.result__sum {
  color: var(--ink-2);
  font-size: 0.96rem;
  margin-bottom: 14px;
}

.result__tips {
  list-style: none;
  border-top: 1px solid var(--line);
  margin-bottom: 16px;
}

.result__tips li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink-2);
}

.result__tips b {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

.result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.link {
  color: var(--vital);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Sections */
.sec {
  padding-block: clamp(52px, 8vw, 92px);
}

.sec--tint {
  background: var(--tint);
}

.sec--dark {
  background: var(--ink);
  color: #E8F0F3;
}

.sec--dark h2,
.sec--dark h3 {
  color: #fff;
}

.sec--dark .lead {
  color: #C5D5DC;
}

.sec--dark a:not(.btn) {
  color: var(--vital-lt);
}

.sec--dark .btn:not(.btn--ghost) {
  color: var(--vital-lt);
}

.sec--dark .btn--ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.sec--dark .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
}

.sec__head {
  margin-bottom: 36px;
}

.sec__head h2 {
  margin-bottom: 10px;
}

/* Section 2: 5-Step Patient Journey */
.journey {
  list-style: none;
  counter-reset: jstep;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  border-top: 2px solid var(--ink);
  padding-top: 28px;
}

.journey li {
  counter-increment: jstep;
  position: relative;
}

.journey li::before {
  content: counter(jstep);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--f-disp);
  font-weight: 700;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.journey h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.journey .leak {
  color: var(--leak);
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.journey .fix {
  color: var(--vital);
  font-size: 0.92rem;
  font-weight: 600;
}

/* Split Layout */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

.split h2 {
  margin-bottom: 14px;
}

.split p + p {
  margin-top: 14px;
}

/* Doctor Card */
.founder {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.founder b {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
}

.founder span {
  color: var(--ink-2);
  font-size: 0.92rem;
}

/* Pledge List */
.pledge {
  list-style: none;
  border-top: 2px solid var(--ink);
}

.pledge li {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.pledge b {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.pledge span {
  color: var(--ink-2);
  font-size: 0.95rem;
}

/* What We Build (Ruled Rows) */
.rows {
  border-top: 2px solid var(--ink);
}

.row {
  display: grid;
  grid-template-columns: 0.8fr 1.6fr auto;
  gap: 24px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.row b {
  font-size: 1.08rem;
  color: var(--ink);
}

.row span {
  color: var(--ink-2);
  font-size: 0.96rem;
}

.row a {
  color: var(--vital);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.row a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* How We Start (Dark Steps) */
.steps {
  list-style: none;
  counter-reset: sstep;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.steps li {
  counter-increment: sstep;
  display: grid;
  grid-template-columns: 48px 160px 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.steps li::before {
  content: counter(sstep, arabic-indic);
  font-family: var(--f-disp);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--vital-lt);
}

.steps b {
  color: #fff;
  font-size: 1.02rem;
}

.steps span {
  color: #C5D5DC;
  font-size: 0.95rem;
}

/* Metrics Ruled List */
.ruled {
  list-style: none;
  border-top: 2px solid var(--ink);
}

.ruled li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.ruled b {
  color: var(--ink);
  font-size: 0.98rem;
}

.ruled span {
  color: var(--muted);
  font-size: 0.9rem;
}

/* FAQ (<details>) */
.faq {
  border-top: 2px solid var(--ink);
  margin-top: 28px;
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 1.05rem;
  color: var(--ink);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--vital);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.faq details[open] summary::after {
  content: "−";
}

.faq details p {
  padding-bottom: 18px;
  color: var(--ink-2);
  font-size: 0.96rem;
}

/* Final CTA */
.final-cta {
  text-align: center;
}

.final-cta .lead {
  margin-inline: auto;
}

.final-cta .cta-row {
  justify-content: center;
}

/* Footer */
.foot {
  background: var(--ink);
  color: #C5D5DC;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding: 56px 0 28px;
}

.foot__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 40px;
}

.foot .brand {
  color: #fff;
  margin-bottom: 12px;
}

.foot .brand__name {
  color: #fff;
}

.foot__tag {
  font-size: 0.93rem;
  max-width: 30ch;
}

.foot h4 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 14px;
}

.foot ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
}

.foot a {
  color: #E8F0F3;
}

.foot a:hover {
  color: var(--vital-lt);
}

.foot__base {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.86rem;
}

/* Floating WhatsApp Button */
.wa-float {
  position: fixed;
  inset-inline-start: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--wa);
  color: #fff;
  padding: 12px 16px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: background 0.15s, transform 0.15s;
}

.wa-float:hover {
  background: var(--wa-hover);
  transform: translateY(-2px);
}

/* Modal (for local preview of Free Audit link) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 43, 70, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: var(--r-m);
  box-shadow: 6px 6px 0 var(--ink);
  max-width: 500px;
  width: 100%;
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 1.5rem;
  color: var(--muted);
  line-height: 1;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-family: inherit;
  font-size: 0.95rem;
}

.form-success {
  display: none;
  margin-top: 12px;
  padding: 12px;
  background: #E5F3F0;
  color: var(--vital-2);
  border-radius: var(--r-s);
  font-weight: 700;
  text-align: center;
}

.form-success.visible {
  display: block;
}

/* Responsive */
@media (max-width: 900px) {
  .hero__in,
  .split,
  .foot__grid {
    grid-template-columns: 1fr;
  }

  .journey {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .steps li {
    grid-template-columns: 40px 1fr;
  }

  .steps span {
    grid-column: 2;
  }
}

@media (max-width: 860px) {
  .top .btn--sm {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav {
    display: none;
    position: absolute;
    top: 68px;
    inset-inline: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 20px;
  }

  .nav.open {
    display: flex;
  }
}

@media (max-width: 640px) {
  .journey {
    grid-template-columns: 1fr;
  }

  .wa-float {
    padding: 13px;
  }

  .wa-float span {
    display: none;
  }
}
