:root {
  --paper: #fbf7ef;
  --paper-soft: #f2f7f4;
  --ink: #26302c;
  --muted: #65726c;
  --line: rgba(38, 48, 44, 0.14);
  --pine: #285a50;
  --sage: #7d9277;
  --rose: #b46f6d;
  --plum: #58485f;
  --brass: #ad7a3f;
  --white: #fffdf9;
  --shadow: 0 22px 70px rgba(28, 37, 34, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper-soft);
  color: var(--ink);
  font-family:
    Inter,
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    Arial,
    sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app {
  min-height: 100vh;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: clamp(22px, 4vh, 44px) 24px;
  isolation: isolate;
}

.hero__image,
.hero__shade {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.hero__image {
  background-image: url("images/reflection-desk.png");
  background-position: center;
  background-size: cover;
}

.hero__shade {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(251, 247, 239, 0.96) 0%, rgba(251, 247, 239, 0.86) 43%, rgba(251, 247, 239, 0.18) 76%),
    linear-gradient(180deg, rgba(40, 90, 80, 0.18) 0%, rgba(180, 111, 109, 0.08) 100%);
}

.hero__content {
  width: min(1120px, 100%);
  min-width: 0;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 570px);
  gap: clamp(18px, 2.7vh, 26px);
}

.intro {
  min-width: 0;
  max-width: 620px;
}

.eyebrow,
.section-kicker,
.index-card__label {
  margin: 0 0 10px;
  color: var(--pine);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: clamp(12px, 2vh, 18px);
  color: #1e2925;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.1rem, 7.5vh, 4.2rem);
  line-height: 0.96;
  font-weight: 500;
  overflow-wrap: break-word;
}

.lead {
  min-width: 0;
  max-width: 550px;
  margin-bottom: 0;
  color: #3c4944;
  font-size: clamp(1rem, 2.15vh, 1.16rem);
  line-height: 1.58;
  overflow-wrap: break-word;
}

.profile-form {
  width: min(520px, 100%);
  min-width: 0;
  display: grid;
  gap: clamp(10px, 1.8vh, 14px);
  padding: clamp(16px, 2.5vh, 22px);
  border: 1px solid rgba(255, 253, 249, 0.72);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.field {
  display: grid;
  gap: 8px;
}

.field label,
.fieldset legend {
  color: #34413d;
  font-size: 0.94rem;
  font-weight: 750;
}

.field input[type="text"] {
  width: 100%;
  min-height: clamp(44px, 6.3vh, 52px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 0 15px;
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.field-hint {
  margin-top: -3px;
  color: #73807a;
  font-size: 0.82rem;
  line-height: 1.35;
}

.field input:focus {
  border-color: rgba(40, 90, 80, 0.62);
  box-shadow: 0 0 0 4px rgba(40, 90, 80, 0.12);
}

.fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(242, 247, 244, 0.8);
}

.segments label {
  min-width: 0;
  cursor: pointer;
}

.segments input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.segments span {
  min-height: clamp(38px, 5.3vh, 42px);
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #50605a;
  font-size: 0.92rem;
  font-weight: 750;
  text-align: center;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.segments input:checked + span {
  background: var(--pine);
  color: var(--white);
  box-shadow: 0 10px 22px rgba(40, 90, 80, 0.24);
}

.segments input:focus-visible + span {
  outline: 3px solid rgba(180, 111, 109, 0.35);
  outline-offset: 2px;
}

.form-error {
  min-height: 20px;
  margin: -2px 0 0;
  color: #934b4b;
  font-size: 0.92rem;
  line-height: 1.4;
}

.primary-button,
.secondary-button {
  min-height: clamp(48px, 6.6vh, 54px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 8px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  font-weight: 850;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.primary-button {
  width: 100%;
  background: var(--plum);
  color: var(--white);
  box-shadow: 0 18px 36px rgba(88, 72, 95, 0.24);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.74;
  transform: none;
}

.primary-button:focus-visible,
.secondary-button:focus-visible {
  outline: 4px solid rgba(180, 111, 109, 0.32);
  outline-offset: 3px;
}

.button-arrow,
.secondary-button span:last-child {
  font-size: 1.3rem;
  line-height: 1;
}

.calculation {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(251, 247, 239, 0.72);
  color: var(--ink);
  transform: scale(0.985);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backdrop-filter: blur(16px);
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    visibility 220ms ease;
}

.calculation.is-visible {
  transform: scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.calculation__inner {
  width: min(680px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border: 1px solid rgba(255, 253, 249, 0.72);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.88);
  box-shadow: var(--shadow);
}

.calculation .eyebrow {
  color: var(--pine);
}

.calculation h2 {
  margin-bottom: 10px;
  font-size: 2rem;
  line-height: 1.12;
}

.calculation p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.calculation__visual {
  position: relative;
  min-height: 164px;
  display: grid;
  place-items: center;
}

.number-stream {
  position: absolute;
  inset: 0;
}

.number-stream span {
  position: absolute;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(40, 90, 80, 0.18);
  border-radius: 50%;
  background: rgba(40, 90, 80, 0.08);
  color: var(--pine);
  font-weight: 850;
  animation: drift 2100ms ease-in-out infinite;
}

.pulse-grid {
  width: 132px;
  height: 132px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pulse-grid span {
  border: 1px solid rgba(40, 90, 80, 0.14);
  border-radius: 8px;
  background: rgba(40, 90, 80, 0.06);
  animation: cellPulse 1200ms ease-in-out infinite;
}

.pulse-grid span:nth-child(2n) {
  animation-delay: 160ms;
}

.pulse-grid span:nth-child(3n) {
  animation-delay: 320ms;
}

.progress {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(40, 90, 80, 0.12);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b8cbc3, #d7b077, #d89490);
  transition: width 360ms ease;
}

.results {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 72px;
}

.section-heading {
  max-width: 740px;
  margin-bottom: 28px;
}

.section-heading h2,
.recommendations h2,
.masterclass h2 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.5rem;
  line-height: 1.1;
  font-weight: 500;
}

.section-heading p,
.panel-heading p,
.index-card p,
.result-sections p,
.recommendations li,
.masterclass p,
.disclaimer,
.triangle-notes p {
  color: var(--muted);
  line-height: 1.65;
}

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

.matrix-panel,
.triangle-panel,
.index-card,
.result-sections article,
.reading-panel,
.node-card,
.recommendations,
.masterclass {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.76);
  box-shadow: 0 16px 44px rgba(28, 37, 34, 0.08);
}

.matrix-panel,
.triangle-panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-heading h3 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.panel-heading p {
  max-width: 270px;
  margin-bottom: 0;
  font-size: 0.92rem;
  text-align: right;
}

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

.matrix-cell {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.matrix-cell__digits {
  color: var(--plum);
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 900;
  word-break: break-word;
}

.matrix-cell__empty {
  color: #9aa59f;
  font-size: 0.9rem;
  font-weight: 800;
}

.matrix-cell__label {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.triangle-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.triangle-wrap svg {
  width: 100%;
  max-height: 330px;
}

.triangle-line {
  fill: rgba(125, 146, 119, 0.08);
  stroke: rgba(40, 90, 80, 0.32);
  stroke-width: 2;
}

.triangle-flow {
  fill: none;
  stroke: var(--rose);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 9 12;
  animation: flow 1800ms linear infinite;
}

.vertex circle {
  fill: var(--white);
  stroke-width: 3;
}

.vertex-base circle {
  stroke: var(--pine);
}

.vertex-pressure circle {
  stroke: var(--rose);
}

.vertex-recovery circle {
  stroke: var(--sage);
}

.vertex-number {
  fill: var(--ink);
  font-size: 28px;
  font-weight: 900;
  text-anchor: middle;
}

.triangle-notes {
  display: grid;
  gap: 10px;
}

.triangle-notes p {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid rgba(40, 90, 80, 0.24);
  font-size: 0.94rem;
}

.triangle-notes .triangle-lead {
  padding: 14px 16px;
  border: 1px solid rgba(40, 90, 80, 0.12);
  border-left: 3px solid var(--rose);
  border-radius: 8px;
  background: rgba(242, 247, 244, 0.72);
  color: #465650;
}

.indices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.index-card {
  padding: 22px;
}

.index-card__value {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.index-card__value strong {
  display: block;
  color: var(--plum);
  font-size: 2.35rem;
  line-height: 1.15;
}

.index-card__value span {
  color: #465650;
  font-size: 1.1rem;
  font-weight: 850;
  line-height: 1.2;
}

.meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(180, 111, 109, 0.14);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7d9277, #d7b077, #b46f6d);
  transition: width 700ms ease;
}

.meter--green {
  background: rgba(40, 90, 80, 0.13);
}

.meter--green span {
  background: linear-gradient(90deg, #b46f6d, #d7b077, #285a50);
}

.index-card p {
  margin: 14px 0 0;
}

.result-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.result-sections article {
  padding: 22px;
}

.result-sections h3 {
  margin-bottom: 10px;
  font-size: 1.2rem;
  line-height: 1.25;
}

.section-kicker {
  display: block;
  margin-bottom: 12px;
  color: var(--rose);
}

.reading-panel {
  margin-top: 18px;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 26px;
}

.reading-panel h2 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.25rem;
  line-height: 1.1;
  font-weight: 500;
}

.reading-panel__intro p,
.node-card p {
  color: var(--muted);
  line-height: 1.65;
}

.reading-panel__intro p:last-child,
.node-card p:last-child {
  margin-bottom: 0;
}

.node-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.node-card {
  padding: 18px;
  background: rgba(255, 253, 249, 0.72);
  box-shadow: none;
}

.node-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.02rem;
}

.node-card span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(40, 90, 80, 0.1);
  color: var(--pine);
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.25;
}

.recommendations {
  margin-top: 18px;
  padding: 28px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
}

.recommendations ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recommendations li {
  position: relative;
  min-height: 50px;
  padding: 14px 16px 14px 44px;
  border: 1px solid rgba(40, 90, 80, 0.12);
  border-radius: 8px;
  background: rgba(242, 247, 244, 0.7);
}

.recommendations li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 20px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pine);
  box-shadow: 0 0 0 5px rgba(40, 90, 80, 0.1);
}

.masterclass {
  margin-top: 18px;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 26px;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(40, 90, 80, 0.94), rgba(88, 72, 95, 0.92)),
    var(--pine);
}

.masterclass .eyebrow,
.masterclass h2,
.masterclass p {
  color: var(--white);
}

.masterclass p {
  max-width: 720px;
  margin-bottom: 0;
  opacity: 0.9;
}

.secondary-button {
  padding: 0 20px;
  background: var(--white);
  color: var(--pine);
  white-space: nowrap;
}

.disclaimer {
  max-width: 920px;
  margin: 24px auto 0;
  color: #6f7a75;
  font-size: 0.92rem;
  text-align: center;
}

@keyframes drift {
  0% {
    transform: translateY(8px) scale(0.94);
    opacity: 0.42;
  }
  50% {
    transform: translateY(-8px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(8px) scale(0.94);
    opacity: 0.42;
  }
}

@keyframes cellPulse {
  0%,
  100% {
    background: rgba(40, 90, 80, 0.06);
    transform: scale(1);
  }
  50% {
    background: rgba(215, 176, 119, 0.28);
    transform: scale(0.95);
  }
}

@keyframes flow {
  to {
    stroke-dashoffset: -42;
  }
}

@media (max-width: 900px) {
  .hero {
    min-height: 100vh;
    min-height: 100svh;
    align-items: start;
    padding: 34px 18px 40px;
  }

  .hero__image {
    background-position: 67% center;
  }

  .hero__shade {
    background:
      linear-gradient(180deg, rgba(251, 247, 239, 0.98) 0%, rgba(251, 247, 239, 0.9) 58%, rgba(251, 247, 239, 0.42) 100%),
      linear-gradient(180deg, rgba(40, 90, 80, 0.2), rgba(180, 111, 109, 0.1));
  }

  .hero__content {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
  }

  h1 {
    font-size: clamp(2.7rem, 12vw, 3.4rem);
  }

  .lead {
    font-size: 1.05rem;
  }

  .profile-form {
    width: 100%;
    max-width: 100%;
    padding: 18px;
  }

  .calculation__inner,
  .results {
    width: min(100% - 32px, 720px);
  }

  .calculation__inner {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px;
  }

  .calculation__visual {
    min-height: 130px;
  }

  .visual-grid,
  .indices,
  .result-sections,
  .reading-panel,
  .recommendations,
  .masterclass {
    grid-template-columns: 1fr;
  }

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

  .panel-heading {
    display: grid;
  }

  .panel-heading p {
    max-width: none;
    text-align: left;
  }

  .secondary-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .intro,
  .lead,
  .profile-form {
    width: min(340px, calc(100vw - 36px));
    max-width: calc(100vw - 36px);
  }

  h1 {
    font-size: clamp(2.35rem, 11vw, 2.8rem);
  }

  .section-heading h2,
  .recommendations h2,
  .masterclass h2 {
    font-size: 2rem;
  }

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

  .matrix-cell {
    min-height: 92px;
  }

  .recommendations,
  .reading-panel,
  .masterclass,
  .matrix-panel,
  .triangle-panel,
  .index-card,
  .node-card,
  .result-sections article {
    padding: 18px;
  }
}

@media (max-width: 560px) and (max-height: 760px) {
  .hero {
    padding-top: 22px;
    padding-bottom: 24px;
  }

  .hero__content {
    gap: 14px;
  }

  h1 {
    font-size: clamp(2.08rem, 10vw, 2.5rem);
    margin-bottom: 10px;
  }

  .lead {
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .profile-form {
    gap: 9px;
    padding: 14px;
  }

  .field input[type="text"] {
    min-height: 42px;
  }

  .segments span {
    min-height: 38px;
    font-size: 0.84rem;
  }

  .primary-button {
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
