:root {
  --panel: rgba(255, 249, 242, 0.75);
  --ink: #221b18;
  --muted: #63554e;
  --accent: #1f7a5c;
  --accent-2: #df6d2d;
  --accent-3: #1773b0;
  --receive: #1f9d6a;
  --pay: #d65b4a;
  --shadow: 0 20px 60px rgba(58, 91, 80, 0.14);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(91, 221, 157, 0.24), transparent 30%),
    radial-gradient(circle at 86% 14%, rgba(255, 205, 130, 0.35), transparent 28%),
    linear-gradient(180deg, #fff9f2 0%, #eef5ef 44%, #edf4f8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(34, 27, 24, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 27, 24, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
}

.page-shell {
  width: min(1500px, calc(100% - 48px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero { min-height: 100vh; padding: 24px 0 60px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 42px;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(34, 27, 24, 0.08);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.7);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(58, 91, 80, 0.1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  margin-right: auto;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #5bdd9d);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.46), 0 10px 20px rgba(31, 122, 92, 0.18);
}

.nav-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 5px;
  border: 1px solid rgba(34, 27, 24, 0.07);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
}

.nav-pill,
.cta {
  text-decoration: none;
  color: inherit;
}

.nav-pill {
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: 999px;
  background: transparent;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.nav-pill:hover,
.nav-pill:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(31, 122, 92, 0.18);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 22px rgba(58, 91, 80, 0.1);
  outline: none;
}

.back-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border: 2px solid rgba(31, 122, 92, 0.28);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #5bdd9d);
  color: #fffaf3;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(31, 122, 92, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.back-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 14px;
}

.back-icon::before,
.back-icon::after {
  content: "";
  position: absolute;
  left: 1px;
}

.back-icon::before {
  top: 5px;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.back-icon::after {
  top: 2px;
  width: 9px;
  height: 9px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
}

.back-button:hover,
.back-button:focus-visible {
  transform: translateX(-2px) scale(1.04);
  background: linear-gradient(135deg, #166449, var(--accent));
  outline: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 36px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 800;
}

.hero-copy h1,
.section-heading h2 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  letter-spacing: 0;
  line-height: 0.98;
}

.hero-copy h1 {
  font-size: clamp(2.8rem, 5.6vw, 5rem);
  max-width: 10ch;
}

.hero-text {
  margin: 24px 0 0;
  font-size: 1.08rem;
  line-height: 1.75;
  max-width: 62ch;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.cta {
  padding: 14px 20px;
  border-radius: 999px;
  font-weight: 800;
}

.cta.primary {
  background: linear-gradient(135deg, var(--accent), #5bdd9d);
  color: #fffdf9;
  box-shadow: 0 18px 28px rgba(31, 122, 92, 0.2);
}

.cta.secondary {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(34, 27, 24, 0.08);
}

.hero-metrics {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hero-metrics article,
.info-card,
.pattern-card,
.trace-card,
.code-panel,
.compiler-panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow);
}

.hero-metrics article {
  padding: 18px;
  border-radius: 18px;
}

.hero-metrics strong {
  display: block;
  font-size: 1.28rem;
}

.hero-metrics span,
.info-card p,
.pattern-card p,
.trace-card p,
.compiler-note,
.note-list p {
  color: var(--muted);
  line-height: 1.7;
}

.visual-card {
  position: relative;
  overflow: hidden;
  min-height: 570px;
  border-radius: 34px;
  padding: 22px;
  color: #fffaf3;
  background:
    radial-gradient(circle at 12% 12%, rgba(91, 221, 157, 0.18), transparent 26%),
    radial-gradient(circle at 84% 76%, rgba(243, 192, 96, 0.18), transparent 30%),
    rgba(23, 28, 25, 0.96);
  box-shadow: 0 28px 80px rgba(23, 28, 25, 0.28);
}

.visual-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 38%, rgba(255, 255, 255, 0.12) 46%, transparent 54% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 28px);
  transform: translateX(-70%);
  animation: panelSweep 5.2s ease-in-out infinite;
}

.visual-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 250, 243, 0.82);
  margin-bottom: 22px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5bdd9d;
  box-shadow: 0 0 18px rgba(91, 221, 157, 0.85);
}

.split-stage {
  position: relative;
  z-index: 1;
  min-height: 410px;
  display: grid;
  grid-template-columns: 0.78fr 0.72fr 0.9fr 1fr;
  gap: 18px;
  align-items: center;
}

.split-stage::before,
.split-stage::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(91, 221, 157, 0.16), rgba(91, 221, 157, 0.95), rgba(243, 192, 96, 0.2));
  animation: lineFlow 2.6s ease-in-out infinite;
}

.split-stage::before {
  left: 18%;
  width: 25%;
}

.split-stage::after {
  right: 24%;
  width: 34%;
}

.payer-card,
.split-router,
.share-card,
.ledger-card {
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 24px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.16);
}

.payer-card {
  min-height: 150px;
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 8px;
  animation: floatSoft 3.4s ease-in-out infinite;
}

.payer-card span,
.ledger-card span {
  color: rgba(255, 250, 243, 0.66);
  font-weight: 800;
}

.payer-card strong {
  font-size: 2rem;
}

.payer-card small {
  width: max-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(91, 221, 157, 0.18);
  color: #caffdf;
  font-weight: 900;
}

.split-router {
  min-height: 150px;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 900;
  overflow: hidden;
}

.split-router span {
  display: block;
  position: relative;
  z-index: 2;
}

.split-router small {
  position: relative;
  z-index: 2;
  display: inline-flex;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 250, 243, 0.74);
  font-weight: 800;
}

.router-pulse {
  position: absolute;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid rgba(91, 221, 157, 0.58);
  animation: pulseRing 1.8s ease-out infinite;
}

.share-card,
.ledger-card {
  min-height: 260px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.share-card span,
.ledger-row {
  position: relative;
}

.share-card > span,
.ledger-card > span {
  color: rgba(255, 250, 243, 0.66);
  font-weight: 800;
}

.share-row,
.ledger-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.share-row {
  background: rgba(214, 91, 74, 0.13);
  border: 1px solid rgba(214, 91, 74, 0.16);
}

.ledger-row::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(91, 221, 157, 0.16), transparent);
  transform: translateX(-100%);
}

.visual-card.is-updating .ledger-row::after {
  animation: dataSweep 720ms ease;
}

.share-row em,
.ledger-row em {
  font-style: normal;
  color: rgba(255, 250, 243, 0.76);
}

.share-row strong {
  color: #ffc6ba;
}

.ledger-row strong {
  font-size: 1.05rem;
}

.event-strip {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.event-pill {
  padding: 12px;
  border-radius: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 250, 243, 0.7);
  font-weight: 800;
  transition: background 200ms ease, color 200ms ease, transform 200ms ease;
}

.event-pill.active {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(91, 221, 157, 0.95), rgba(31, 122, 92, 0.92));
  color: #fffaf3;
}

.section { padding: 72px 0; }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 26px;
}

.section-heading h2 {
  font-size: clamp(2.1rem, 4vw, 3.8rem);
  max-width: 820px;
}

.logic-grid,
.trace-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.trace-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.info-card,
.trace-card {
  border-radius: var(--radius);
  padding: 24px;
  border-top: 5px solid var(--accent-2);
}

.accent-blue { border-top-color: var(--accent-3); }
.accent-green { border-top-color: var(--accent); }

.card-number,
.trace-card strong {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(31, 122, 92, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 900;
  margin-bottom: 16px;
}

.info-card h3,
.trace-card h3,
.pattern-card h3,
.code-panel h3,
.compiler-panel h3 {
  margin: 0 0 10px;
  font-size: 1.32rem;
}

.pattern-stack {
  display: grid;
  gap: 18px;
}

.pattern-card {
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 24px;
  align-items: start;
}

.pattern-tag {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

pre {
  position: relative;
  margin: 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(23, 28, 25, 0.96);
  color: #fff7ee;
  overflow-x: auto;
}

.snippet-expand-button {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #fffaf3;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

code {
  font-family: "Courier New", monospace;
  font-size: 0.92em;
  line-height: 1.55;
}

.compiler-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.code-panel,
.compiler-panel {
  border-radius: var(--radius);
  padding: 24px;
}

.code-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.code-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.copy-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--accent), #5bdd9d);
  color: #fffaf3;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(31, 122, 92, 0.18);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 1px solid rgba(34, 27, 24, 0.1);
  box-shadow: none;
}

.code-textarea {
  width: 100%;
  min-height: 760px;
  resize: vertical;
  border-radius: 20px;
  border: 1px solid rgba(34, 27, 24, 0.12);
  background: rgba(23, 28, 25, 0.96);
  color: #fff7ee;
  padding: 18px;
  line-height: 1.55;
  font-size: 0.92rem;
  font-family: "Courier New", monospace;
}

.note-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.notes-title {
  margin-top: 24px;
}

.compiler-frame {
  width: 100%;
  min-height: 520px;
  margin-top: 14px;
  border: 1px solid rgba(34, 27, 24, 0.1);
  border-radius: 20px;
  background: #fff;
}

.note-list p {
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(34, 27, 24, 0.06);
}

.interview-notes {
  padding-bottom: 96px;
}

.notes-heading {
  display: block;
  text-align: left;
}

.notes-heading h2 {
  max-width: 820px;
}

.notes-panel {
  border: 1px solid rgba(34, 27, 24, 0.08);
  border-radius: var(--radius);
  padding: 28px;
  background: rgba(255, 252, 247, 0.78);
  box-shadow: var(--shadow);
}

.notes-single-card {
  display: grid;
  gap: 24px;
}

.notes-section {
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(34, 27, 24, 0.08);
}

.notes-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.notes-diagram-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(320px, 1.18fr);
  gap: 22px;
  align-items: start;
}

.notes-panel h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.notes-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

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

.notes-caution {
  padding: 18px;
  border: 1px solid rgba(223, 109, 45, 0.24);
  border-radius: 18px;
  border-color: rgba(223, 109, 45, 0.24);
  background: rgba(255, 245, 235, 0.84);
}

.notes-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.75;
}

.notes-list li + li {
  margin-top: 8px;
}

.quote-line {
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  font-weight: 700;
  color: var(--ink) !important;
}

.flow-diagram {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.flow-node {
  position: relative;
  padding: 13px 16px;
  border: 1px solid rgba(31, 122, 92, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(58, 91, 80, 0.08);
}

.flow-node.success {
  background: linear-gradient(135deg, rgba(31, 122, 92, 0.12), rgba(91, 221, 157, 0.2));
  border-color: rgba(31, 122, 92, 0.32);
}

.flow-arrow {
  width: 2px;
  height: 18px;
  margin: -2px auto;
  background: linear-gradient(180deg, var(--accent), rgba(31, 122, 92, 0.2));
  position: relative;
}

.flow-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateX(-50%) rotate(45deg);
}

.uml-diagram {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(23, 115, 176, 0.14);
  background: rgba(255, 255, 255, 0.58);
  overflow-x: auto;
}

.uml-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 560px;
}

.uml-row.top {
  align-items: stretch;
}

.uml-box {
  min-width: 128px;
  padding: 11px 13px;
  border: 1px solid rgba(34, 27, 24, 0.12);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.86);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 10px 22px rgba(58, 91, 80, 0.06);
}

.uml-box.interface {
  border-color: rgba(23, 115, 176, 0.28);
  background: rgba(237, 248, 255, 0.84);
}

.uml-box.class-box {
  border-color: rgba(31, 122, 92, 0.22);
}

.uml-link {
  min-width: 72px;
  min-height: 28px;
  position: relative;
  display: grid;
  place-items: center;
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: transparent;
}

.uml-link::before {
  content: "";
  position: absolute;
  inset: auto 0;
  height: 2px;
  background: currentColor;
}

.uml-link.isa {
  color: var(--accent-3);
}

.uml-link.hasa {
  color: var(--accent-2);
}

.uml-branch,
.uml-stack {
  display: grid;
  gap: 8px;
}

.uml-branch {
  grid-template-columns: auto auto auto auto;
  align-items: center;
}

.code-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  grid-template-rows: auto 1fr;
  background: rgba(18, 22, 20, 0.98);
  padding: 18px;
}

.code-modal.open { display: grid; }

.modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: #fffaf3;
  padding-bottom: 14px;
}

.modal-code {
  width: 100%;
  min-height: 0;
  resize: none;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #101512;
  color: #f5fff9;
  padding: 22px;
  line-height: 1.58;
  font-size: 1rem;
  font-family: "Courier New", monospace;
}

body.modal-open { overflow: hidden; }

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

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

@keyframes panelSweep {
  0%, 35% { transform: translateX(-70%); }
  70%, 100% { transform: translateX(70%); }
}

@keyframes pulseRing {
  from { transform: scale(0.45); opacity: 0.9; }
  to { transform: scale(1.8); opacity: 0; }
}

@keyframes lineFlow {
  0%, 100% { opacity: 0.42; transform: scaleX(0.88); }
  50% { opacity: 1; transform: scaleX(1); }
}

@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes dataSweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (max-width: 980px) {
  .hero-grid,
  .logic-grid,
  .trace-grid,
  .pattern-card,
  .compiler-layout,
  .notes-diagram-grid {
    grid-template-columns: 1fr;
  }

  .hero { min-height: auto; }

  .visual-card { min-height: auto; }

  .split-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .split-stage::before,
  .split-stage::after {
    display: none;
  }

  .payer-card,
  .split-router,
  .share-card,
  .ledger-card {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .page-shell { width: min(100% - 18px, 1500px); }

  .topbar {
    gap: 14px;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 34px;
    border-radius: 24px;
    padding: 14px;
  }

  .nav-group {
    width: 100%;
    justify-content: flex-start;
    border-radius: 20px;
  }

  .hero-copy h1 { font-size: 2.5rem; }
  .hero-metrics { grid-template-columns: 1fr; }
  .event-strip { grid-template-columns: 1fr; }
  .section { padding: 54px 0; }
  .code-panel-header { flex-direction: column; }
  .code-actions { justify-content: flex-start; }
  .code-textarea { min-height: 560px; }
  .notes-panel { padding: 20px; }
  .uml-diagram { padding: 14px; }
}
