/* Rhazes platform and mechanism sections
   Section-specific classes use p-/m- prefixes so this file can sit beside the
   main landing page styles without changing its existing visual language. */

.p-section,
.m-theatre {
  position: relative;
  overflow: clip;
}

.p-section {
  background: var(--section, #F6F0E9);
  border-top: 1px solid var(--line, rgb(8 51 51 / 14%));
  color: var(--ink, #083333);
}

.p-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, .62fr);
  align-items: end;
  gap: clamp(2rem, 7vw, 7rem);
}

.p-intro-copy {
  max-width: 38rem;
}

.p-section .eyebrow,
.m-theatre .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: rgb(8 51 51 / 74%);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.p-section .eyebrow::before,
.m-theatre .eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  flex: none;
  background: var(--sand, #DAB697);
}

.p-section .section-heading,
.m-theatre .section-heading {
  margin-top: 22px;
  max-width: 16ch;
  color: var(--ink, #083333);
  font-size: clamp(2.35rem, 5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -.035em;
  line-height: 1.04;
  text-wrap: balance;
}

.p-section .lead,
.m-theatre .lead {
  max-width: 42ch;
  color: rgb(8 51 51 / 74%);
  font-size: 1.125rem;
  line-height: 1.55;
}

.p-grid {
  display: grid;
  grid-template-areas:
    "scribe scribe scribe support support support"
    "coding coding ehr ehr spaces spaces"
    "audits audits audits custom custom custom";
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-top: clamp(3.25rem, 6vw, 4.75rem);
}

.p-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line, rgb(8 51 51 / 14%));
  border-radius: 24px;
  background: var(--surface, #FAF6F2);
  padding: clamp(1.45rem, 2.6vw, 2.15rem);
  color: var(--ink, #083333);
  transition: transform .35s cubic-bezier(.22, 1, .36, 1), box-shadow .35s cubic-bezier(.22, 1, .36, 1), background-color .35s ease;
}

.p-card:hover,
.p-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px -28px rgb(8 51 51 / 32%);
}

.p-lead {
  min-height: 30rem;
}

.p-scribe-card {
  grid-area: scribe;
  border-color: var(--ink, #083333);
  background: var(--ink, #083333);
  color: var(--cream, #F6F0E9);
}

.p-support-card {
  grid-area: support;
}

.p-coding-card {
  grid-area: coding;
}

.p-ehr-card {
  grid-area: ehr;
}

.p-spaces-card {
  grid-area: spaces;
}

.p-audits-card {
  grid-area: audits;
}

.p-custom-card {
  grid-area: custom;
}

.p-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.p-card-icon,
.m-card-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--control, #EFE7DD);
  color: var(--ink, #083333);
}

.p-card-icon svg,
.m-card-icon svg {
  width: 20px;
  height: 20px;
}

.p-scribe-card .p-card-icon {
  background: rgb(246 240 233 / 10%);
  color: var(--cream, #F6F0E9);
}

.p-card h3 {
  margin-top: 1.55rem;
  color: var(--ink, #083333);
  font-size: clamp(1.32rem, 2vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -.018em;
  line-height: 1.14;
}

.p-card p {
  margin-top: .65rem;
  color: rgb(8 51 51 / 74%);
  font-size: .98rem;
  line-height: 1.55;
}

.p-scribe-card h3,
.p-scribe-card p {
  color: var(--cream, #F6F0E9);
}

.p-scribe-card p {
  color: rgb(246 240 233 / 72%);
}

.p-card .p-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 1.25rem;
  color: rgb(8 51 51 / 74%);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.p-card-tag::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--sand, #DAB697);
}

.p-scribe-card .p-card-tag {
  color: rgb(246 240 233 / 72%);
}

.p-scribe-demo {
  display: flex;
  min-height: 14.25rem;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 1.7rem;
  border: 1px solid rgb(246 240 233 / 14%);
  border-radius: 16px;
  background: rgb(252 246 239 / 7%);
  padding: 1rem 1.15rem;
}

.p-scribe-topline,
.p-scribe-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: rgb(246 240 233 / 74%);
  font-size: .7rem;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.p-scribe-status {
  justify-content: flex-start;
  border-top: 1px solid rgb(246 240 233 / 11%);
  padding-top: .75rem;
}

.p-scribe-status .p-live-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--sand, #DAB697);
  box-shadow: 0 0 0 0 rgb(218 182 151 / 50%);
}

.p-waveform {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 3px;
  margin: .85rem 0 .8rem;
}

.p-wave-bar {
  display: block;
  width: 3px;
  min-height: 5px;
  transform: scaleY(.8);
  transform-origin: center;
  border-radius: 99px;
  background: var(--sand, #DAB697);
  opacity: .78;
}

.p-scribe-lines {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.p-scribe-line {
  display: flex;
  min-width: 0;
  min-height: 2.8em;
  gap: .7rem;
  color: rgb(246 240 233 / 88%);
  font-size: .82rem;
  line-height: 1.4;
}

.p-scribe-line .p-role {
  width: 2.2rem;
  flex: none;
  color: rgb(246 240 233 / 74%);
  font-size: .66rem;
  font-weight: 500;
  letter-spacing: .09em;
  padding-top: .11rem;
  text-transform: uppercase;
}

.p-scribe-line .p-copy {
  min-width: 0;
}

.p-scribe-card .p-card-tag::before {
  background: var(--sand, #DAB697);
}

.p-evidence-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  margin-top: 1.5rem;
}

.p-evidence-row,
.p-code-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  min-width: 0;
  border: 1px solid var(--line, rgb(8 51 51 / 14%));
  border-radius: 12px;
  background: var(--surface, #FAF6F2);
  padding: .76rem .9rem;
  color: rgb(8 51 51 / 74%);
  font-size: .82rem;
  line-height: 1.35;
}

.p-evidence-row strong {
  color: var(--ink, #083333);
  font-weight: 500;
}

.p-evidence-source {
  flex: none;
  margin-left: auto;
  border: 1px solid var(--line, rgb(8 51 51 / 14%));
  border-radius: 99px;
  padding: 4px 8px;
  color: rgb(8 51 51 / 74%);
  font-size: .65rem;
  letter-spacing: .04em;
  white-space: nowrap;
}

.p-mini-label {
  display: block;
  color: rgb(8 51 51 / 74%);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.p-code-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  margin-top: 1.35rem;
}

.p-code-row {
  border: 0;
  border-bottom: 1px solid var(--line, rgb(8 51 51 / 14%));
  border-radius: 0;
  background: transparent;
  padding: .85rem 0;
}

.p-code-row:last-child {
  border-bottom: 0;
}

.p-code-system {
  width: 4.7rem;
  flex: none;
  color: var(--ink, #083333);
  font-size: .73rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.p-code-copy {
  min-width: 0;
  color: rgb(8 51 51 / 74%);
}

.p-code-state {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: none;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  border: 1px solid rgb(8 51 51 / 18%);
  border-radius: 50%;
  color: rgb(8 51 51 / 74%);
  font-size: .7rem;
}

.p-ehr-card {
  background: var(--card, #F7F2EA);
}

.p-ehr-chips {
  position: relative;
  display: flex;
  min-height: 11rem;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: .65rem;
  margin-top: 1.4rem;
  padding-left: 1.4rem;
}

.p-ehr-chips::before {
  content: "";
  position: absolute;
  top: 12%;
  bottom: 12%;
  left: .35rem;
  width: 1px;
  transform-origin: top;
  background: var(--sand, #DAB697);
  opacity: .78;
}

.p-ehr-chip {
  position: relative;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: .6rem;
  border: 1px solid var(--line, rgb(8 51 51 / 14%));
  border-radius: 99px;
  background: var(--surface, #FAF6F2);
  padding: .55rem .8rem;
  color: var(--ink, #083333);
  font-size: .78rem;
  font-weight: 500;
}

.p-ehr-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sand, #DAB697);
}

.p-ehr-chip small {
  color: rgb(8 51 51 / 74%);
  font-size: .7rem;
  font-weight: 400;
}

.p-tool-list {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-top: 1.25rem;
}

.p-tool-list span {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: rgb(8 51 51 / 74%);
  font-size: .84rem;
}

.p-tool-list span::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border: 1px solid var(--sand, #DAB697);
  border-radius: 2px;
}

/* Consultation theatre */
.m-theatre {
  background: linear-gradient(180deg, var(--ink, #083333) 0%, #052B2B 100%);
  color: var(--cream, #F6F0E9);
  isolation: isolate;
}

.m-theatre::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: radial-gradient(ellipse 75% 45% at 80% 0%, rgb(218 182 151 / 10%), transparent 64%);
  pointer-events: none;
}

.m-theatre .eyebrow {
  color: rgb(246 240 233 / 74%);
}

.m-theatre .section-heading {
  color: var(--cream, #F6F0E9);
}

.m-theatre .lead {
  color: rgb(246 240 233 / 74%);
}

.m-head {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, .85fr);
  align-items: end;
  gap: clamp(2rem, 7vw, 7rem);
  margin-bottom: clamp(2.6rem, 5vw, 4.5rem);
}

.m-head .section-heading {
  max-width: 17ch;
}

.m-head .lead {
  max-width: 42ch;
}

.m-controls {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1.6rem;
}

.m-controls .button,
.m-controls .button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  line-height: 1;
  min-height: 44px;
  padding: .75rem 1.1rem;
  transition: transform .25s cubic-bezier(.22, 1, .36, 1), background-color .25s ease, border-color .25s ease, color .25s ease;
}

.m-controls .button {
  border: 1px solid var(--cream, #F6F0E9);
  background: var(--cream, #F6F0E9);
  color: var(--ink, #083333);
}

.m-controls .button-secondary {
  border: 1px solid rgb(246 240 233 / 36%);
  background: transparent;
  color: var(--cream, #F6F0E9);
}

.m-controls .button:hover,
.m-controls .button-secondary:hover,
.m-controls .button:focus-visible,
.m-controls .button-secondary:focus-visible {
  transform: translateY(-2px);
}

.m-controls .button-secondary:hover,
.m-controls .button-secondary:focus-visible {
  border-color: rgb(246 240 233 / 72%);
  background: rgb(246 240 233 / 10%);
}

.m-controls .button:focus-visible,
.m-controls .button-secondary:focus-visible {
  outline: 2px solid var(--sand, #DAB697);
  outline-offset: 3px;
}

.m-control-status {
  margin-left: auto;
  color: rgb(246 240 233 / 74%);
  font-size: .78rem;
  letter-spacing: .06em;
  text-align: right;
  text-transform: uppercase;
}

.m-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1rem, 3vw, 2.4rem);
}

.m-panel {
  min-height: 25rem;
  border: 1px solid rgb(246 240 233 / 14%);
  border-radius: 24px;
  background: rgb(252 246 239 / 6%);
  padding: clamp(1.2rem, 2.5vw, 1.9rem);
  backdrop-filter: blur(6px);
}

.m-panel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  border-bottom: 1px solid rgb(246 240 233 / 11%);
  padding-bottom: 1rem;
  color: rgb(246 240 233 / 74%);
  font-size: .72rem;
  letter-spacing: .12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.m-panel-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--sand, #DAB697);
  white-space: nowrap;
}

.m-panel-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sand, #DAB697);
}

.m-lines {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1.35rem;
}

.m-line {
  display: flex;
  gap: .8rem;
  color: rgb(246 240 233 / 92%);
  font-size: .92rem;
  line-height: 1.52;
}

.m-line .m-who {
  width: 2.15rem;
  flex: none;
  color: rgb(246 240 233 / 74%);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .08em;
  padding-top: .18rem;
  text-transform: uppercase;
}

.m-line mark {
  border-radius: 4px;
  background: rgb(218 182 151 / 22%);
  color: var(--cream, #F6F0E9);
  padding: 0 3px;
}

.m-note-block {
  margin-top: 1.35rem;
}

.m-note-block h3 {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--sand, #DAB697);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.m-note-block h3::after {
  content: "";
  height: 1px;
  flex: 1;
  background: rgb(246 240 233 / 11%);
}

.m-note-block p {
  margin: .7rem 0 0;
  color: rgb(246 240 233 / 90%);
  font-size: .9rem;
  line-height: 1.55;
}

.m-note-block .m-note-cite {
  margin-top: .4rem;
}

.m-note-cite {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-top: .4rem;
  border: 1px solid rgb(218 182 151 / 30%);
  border-radius: 10px;
  background: rgb(218 182 151 / 12%);
  padding: .55rem .8rem;
  color: var(--cream, #F6F0E9);
  font-size: .76rem;
  line-height: 1.35;
}

.m-note-cite svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--sand, #DAB697);
}

.m-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(1.8rem, 4vw, 3rem);
  border-top: 1px solid rgb(246 240 233 / 11%);
  padding-top: 1.4rem;
}

.m-rail-step {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: rgb(246 240 233 / 74%);
  font-size: .83rem;
  line-height: 1.4;
  transition: color .25s ease;
}

.m-rail-step .m-number {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(246 240 233 / 22%);
  border-radius: 50%;
  color: rgb(246 240 233 / 74%);
  font-size: .7rem;
  font-weight: 500;
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}

.m-rail-step.is-active {
  color: var(--cream, #F6F0E9);
}

.m-rail-step.is-active .m-number {
  border-color: var(--sand, #DAB697);
  background: var(--sand, #DAB697);
  color: var(--ink, #083333);
}

.m-disclaimer {
  margin-top: 1.25rem;
  color: rgb(246 240 233 / 74%);
  font-size: .75rem;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .p-grid {
    grid-template-areas:
      "scribe scribe"
      "support support"
      "coding ehr"
      "spaces spaces"
      "audits custom";
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .p-lead {
    min-height: 26rem;
  }
}

@media (max-width: 760px) {
  .p-intro,
  .m-head {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .p-intro .lead,
  .m-head .lead {
    max-width: 52ch;
  }

  .m-stage {
    grid-template-columns: 1fr;
  }

  .m-panel {
    min-height: auto;
  }

  .m-rail {
    grid-template-columns: 1fr;
    gap: .75rem;
  }
}

@media (min-width: 1024px) and (max-height: 900px) {
  .m-theatre.section-pad {
    padding-block: 48px;
  }

  .m-head {
    margin-bottom: 32px;
  }

  .m-theatre .section-heading {
    max-width: 22ch;
    font-size: clamp(2rem, 3.2vw, 2.75rem);
  }

  .m-panel {
    min-height: 320px;
    padding: clamp(1rem, 2vw, 1.45rem);
  }

  .m-lines {
    gap: .7rem;
    padding-top: 1rem;
  }

  .m-note-block {
    margin-top: .95rem;
  }

  .m-rail {
    margin-top: 1.5rem;
    padding-top: 1rem;
  }
}

@media (max-width: 620px) {
  .p-scribe-line { min-height: 4.2em; }
  .p-grid {
    grid-template-areas:
      "scribe"
      "support"
      "coding"
      "ehr"
      "spaces"
      "audits"
      "custom";
    grid-template-columns: 1fr;
  }

  .p-lead {
    min-height: 0;
  }

  .m-controls {
    flex-wrap: wrap;
  }

  .m-control-status {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .p-card,
  .m-rail-step,
  .m-rail-step .m-number {
    transition-duration: .001s !important;
  }
}
