:root {
  color-scheme: dark;
  --ink: #080706;
  --ink-soft: #100e0c;
  --panel: #14110f;
  --bone: #eee7db;
  --bone-dim: #bfb6a8;
  --line: rgba(238, 231, 219, 0.17);
  --gold: #b99758;
  --red: #a6202e;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", Arial, sans-serif;
  font-family: var(--sans);
  font-synthesis: none;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 82% 12%, rgba(166, 32, 46, 0.09), transparent 24rem),
    var(--ink);
  color: var(--bone);
}

button,
textarea,
select,
input {
  font: inherit;
}

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

a {
  color: inherit;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.26;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  text-decoration: none;
  font-size: 0.92rem;
  letter-spacing: 0.18em;
}

.brand b {
  color: var(--gold);
  font-weight: 600;
}

.brand-mark {
  color: var(--red);
  font-size: 0.66rem;
}

nav {
  display: flex;
  gap: 28px;
}

nav a {
  color: var(--bone-dim);
  font-size: 0.73rem;
  letter-spacing: 0.15em;
  text-decoration: none;
}

nav a:hover,
nav a:focus-visible {
  color: var(--bone);
}

main {
  overflow: clip;
}

.hero {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: calc(100vh - 84px);
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(420px, 1.12fr);
  gap: clamp(48px, 8vw, 112px);
  align-items: center;
  padding: 72px 0 88px;
}

.eyebrow,
.step-label,
.section-number {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero h1,
.editorial h2,
.method h2,
.result h2 {
  margin: 22px 0 26px;
  font-family: var(--serif);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.hero h1 {
  max-width: 650px;
  font-size: clamp(3.4rem, 7.8vw, 6.9rem);
}

.hero h1 em {
  color: var(--gold);
  font-weight: 400;
}

.lead {
  max-width: 540px;
  color: var(--bone-dim);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  line-height: 1.7;
}

.formula {
  margin-top: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--bone-dim);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.formula i {
  color: var(--red);
  font-style: normal;
}

.machine {
  position: relative;
  padding: clamp(26px, 4vw, 48px);
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(25, 22, 19, 0.95), rgba(12, 10, 9, 0.98));
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.38);
}

.machine::before {
  content: "";
  position: absolute;
  width: 58px;
  height: 2px;
  top: -1px;
  left: 48px;
  background: var(--red);
}

.machine-head {
  display: flex;
  gap: 20px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.machine h2 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4vw, 2.65rem);
  font-weight: 400;
}

.step-label {
  margin: 0;
}

.environment-badge {
  border: 1px solid rgba(185, 151, 88, 0.45);
  padding: 5px 8px;
  color: var(--gold);
  font-size: 0.64rem;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

form > label,
.mode-switch legend {
  display: block;
  margin-bottom: 9px;
  color: var(--bone-dim);
  font-size: 0.83rem;
  letter-spacing: 0.04em;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 126px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: rgba(0, 0, 0, 0.18);
  color: var(--bone);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.6;
}

textarea::placeholder {
  color: #746d64;
}

textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible,
input:focus-visible + span {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.question-foot {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 8px;
  color: #817970;
  font-size: 0.72rem;
}

.question-foot span:last-child {
  white-space: nowrap;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  border: 0;
}

.mode-switch legend {
  grid-column: 1 / -1;
}

.mode-switch label {
  position: relative;
  cursor: pointer;
}

.mode-switch input {
  position: absolute;
  opacity: 0;
}

.mode-switch label span {
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 15px;
  border: 1px solid var(--line);
  color: var(--bone-dim);
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.mode-switch label:hover span,
.mode-switch input:checked + span {
  border-color: rgba(185, 151, 88, 0.64);
  background: rgba(185, 151, 88, 0.07);
  color: var(--bone);
}

.mode-switch b {
  font-size: 0.75rem;
  letter-spacing: 0.09em;
}

.mode-switch small {
  color: #8f877d;
  font-size: 0.72rem;
  line-height: 1.35;
}

.physical-inputs {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.physical-inputs > p {
  margin: 0 0 14px;
  color: var(--bone-dim);
  font-size: 0.78rem;
}

.physical-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tile-input {
  min-width: 0;
}

.tile-input > span {
  display: block;
  margin-bottom: 6px;
  color: #8f877d;
  font-size: 0.67rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tile-selects {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tile-selects select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 9px 5px;
  background: #0d0b0a;
  color: var(--bone);
  text-align: center;
}

.status {
  min-height: 24px;
  margin: 18px 0 8px;
  color: var(--gold);
  font-size: 0.8rem;
}

.status.error {
  color: #dd7c84;
}

.actions {
  display: grid;
  gap: 12px;
}

.primary-action,
.secondary-action {
  border: 1px solid var(--gold);
  border-radius: 0;
  background: var(--bone);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.primary-action {
  width: 100%;
  min-height: 54px;
}

.primary-action:hover:not(:disabled),
.secondary-action:hover {
  background: var(--gold);
  transform: translateY(-1px);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.52;
}

.text-action {
  border: 0;
  background: transparent;
  color: var(--bone-dim);
  cursor: pointer;
  font-size: 0.69rem;
  letter-spacing: 0.11em;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.result {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 120px 0;
  border-top: 1px solid var(--line);
}

.result-intro {
  max-width: 780px;
}

.result h2,
.editorial h2,
.method h2 {
  font-size: clamp(2.8rem, 6vw, 5.5rem);
}

blockquote {
  margin: 0;
  color: var(--bone-dim);
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.7;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 68px 0 74px;
}

.tile-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(20, 17, 15, 0.62);
}

.domino {
  width: 62px;
  height: 112px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  border-radius: 7px;
  background: var(--bone);
  color: var(--ink);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.domino-half {
  position: relative;
  border-bottom: 1px solid rgba(8, 7, 6, 0.42);
}

.domino-half:last-child {
  border-bottom: 0;
}

.pip {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
}

.pips-1 .pip:nth-child(1) { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.pips-2 .pip:nth-child(1) { right: 12px; top: 11px; }
.pips-2 .pip:nth-child(2) { left: 12px; bottom: 11px; }
.pips-3 .pip:nth-child(1) { right: 12px; top: 11px; }
.pips-3 .pip:nth-child(2) { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.pips-3 .pip:nth-child(3) { left: 12px; bottom: 11px; }
.pips-4 .pip:nth-child(1), .pips-5 .pip:nth-child(1), .pips-6 .pip:nth-child(1) { left: 12px; top: 10px; }
.pips-4 .pip:nth-child(2), .pips-5 .pip:nth-child(2), .pips-6 .pip:nth-child(2) { right: 12px; top: 10px; }
.pips-4 .pip:nth-child(3), .pips-5 .pip:nth-child(3) { left: 12px; bottom: 10px; }
.pips-4 .pip:nth-child(4), .pips-5 .pip:nth-child(4) { right: 12px; bottom: 10px; }
.pips-5 .pip:nth-child(5) { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.pips-6 .pip:nth-child(3) { left: 12px; top: 50%; transform: translateY(-50%); }
.pips-6 .pip:nth-child(4) { right: 12px; top: 50%; transform: translateY(-50%); }
.pips-6 .pip:nth-child(5) { left: 12px; bottom: 10px; }
.pips-6 .pip:nth-child(6) { right: 12px; bottom: 10px; }

.tile-copy small {
  color: var(--gold);
  font-size: 0.67rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tile-copy h3 {
  margin: 7px 0 3px;
  font-family: var(--serif);
  font-size: 1.14rem;
  font-weight: 400;
}

.tile-copy .notation {
  margin: 0 0 10px;
  color: var(--bone-dim);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.tile-copy p:last-child {
  margin: 0;
  color: #a69d91;
  font-size: 0.85rem;
  line-height: 1.55;
}

.reading-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}

.reading-grid article {
  min-height: 290px;
  padding: 42px 42px 42px 0;
  border-bottom: 1px solid var(--line);
}

.reading-grid article:nth-child(2) {
  padding-left: 42px;
  border-left: 1px solid var(--line);
}

.reading-grid .synthesis {
  grid-column: 1 / -1;
  max-width: none;
  padding-right: 20%;
}

.reading-grid h3 {
  margin: 9px 0 20px;
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 400;
}

.reading-grid p,
#special-elements {
  color: var(--bone-dim);
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.75;
}

#special-elements p {
  margin: 0 0 14px;
}

.direction-text {
  color: var(--bone) !important;
}

.reading-disclaimer {
  max-width: 760px;
  margin: 32px 0;
  color: #817970;
  font-size: 0.78rem;
}

.secondary-action {
  min-height: 48px;
  padding: 0 28px;
  background: transparent;
  color: var(--bone);
}

.editorial,
.method,
footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 120px 0;
  border-top: 1px solid var(--line);
}

.editorial-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(36px, 8vw, 110px);
}

.editorial-columns p {
  margin: 0;
  color: var(--bone-dim);
  font-family: var(--serif);
  font-size: clamp(1.08rem, 2vw, 1.36rem);
  line-height: 1.75;
}

.editorial-columns strong {
  color: var(--gold);
  font-weight: 400;
}

.method {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(48px, 9vw, 124px);
}

.method h2 {
  max-width: 520px;
}

.method ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.method li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 18px;
  align-items: baseline;
  padding: 23px 0;
  border-bottom: 1px solid var(--line);
}

.method li span {
  color: var(--red);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.method li p {
  margin: 0;
  color: var(--bone-dim);
  font-family: var(--serif);
  font-size: 1.08rem;
}

.method li b {
  color: var(--bone);
  font-weight: 400;
}

.digital-physical {
  grid-column: 1 / -1;
  margin: 24px 0 0;
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
}

footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  padding-top: 46px;
  padding-bottom: 58px;
  color: #756e66;
  font-size: 0.72rem;
  line-height: 1.65;
}

footer p {
  margin: 0;
}

footer p:first-child {
  color: var(--bone-dim);
  letter-spacing: 0.1em;
}

[hidden] {
  display: none !important;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 62px;
  }

  .hero-copy {
    max-width: 760px;
  }

  .machine {
    max-width: 720px;
  }

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

  .tile-card {
    max-width: 680px;
  }

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

  .digital-physical {
    grid-column: 1;
  }

  footer {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 660px) {
  .site-header,
  .hero,
  .result,
  .editorial,
  .method,
  footer {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    min-height: 72px;
  }

  nav {
    display: none;
  }

  .hero {
    min-height: 0;
    padding: 46px 0 68px;
    gap: 48px;
  }

  .hero h1 {
    font-size: clamp(3rem, 15vw, 4.8rem);
  }

  .machine {
    padding: 25px 20px 24px;
  }

  .machine::before {
    left: 20px;
  }

  .mode-switch {
    grid-template-columns: 1fr;
  }

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

  .question-foot span:first-child {
    display: none;
  }

  .result,
  .editorial,
  .method {
    padding: 84px 0;
  }

  .tiles {
    margin: 46px 0 56px;
  }

  .tile-card {
    gap: 18px;
    padding: 18px;
  }

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

  .reading-grid article,
  .reading-grid article:nth-child(2),
  .reading-grid .synthesis {
    grid-column: 1;
    min-height: 0;
    padding: 36px 0;
    border-left: 0;
  }

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

  footer {
    grid-template-columns: 1fr;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
