:root {
  --bg: #f3eee6;
  --bg-strong: #e8ddcf;
  --surface: rgba(255, 252, 247, 0.92);
  --surface-strong: #fffaf3;
  --ink: #26150f;
  --muted: #6d5a4d;
  --line: rgba(38, 21, 15, 0.12);
  --accent: #b14a28;
  --accent-soft: rgba(177, 74, 40, 0.12);
  --shadow: 0 24px 60px rgba(60, 39, 26, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --content-width: 1380px;
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(177, 74, 40, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(116, 145, 124, 0.16), transparent 28%),
    linear-gradient(180deg, #f7f1e8 0%, var(--bg) 100%);
}

img {
  display: block;
  width: 100%;
  height: auto;
}

button,
select {
  font: inherit;
}

.page-shell {
  width: min(calc(100% - 2.4rem), var(--content-width));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 2.75rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-lg) + 6px);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 247, 236, 0.94)),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -35% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(177, 74, 40, 0.18), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.77rem;
  font-weight: 700;
}

.hero h1,
.viewer-header h2 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  line-height: 1.03;
  letter-spacing: -0.035em;
}

.hero h1 {
  max-width: none;
  margin: 0 auto;
  font-size: clamp(2.6rem, 5vw, 5.25rem);
  text-wrap: balance;
}

.hero-copy {
  max-width: none;
  margin: 1.3rem auto 0;
  line-height: 1.65;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-authors {
  max-width: none;
  margin: 1rem auto 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink);
}

.hero-meta {
  display: grid;
  gap: 0.25rem;
  margin: 1rem auto 0;
  padding: 1rem 1.1rem;
  max-width: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
}

.hero-meta p {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
}

.hero-meta strong {
  color: var(--ink);
}

.hero-meta a {
  color: var(--accent);
}

.hero-figure {
  margin: 1.5rem auto 0;
  max-width: 1100px;
}

.hero-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 16px 40px rgba(60, 39, 26, 0.1);
}

.hero-linkout {
  margin: 1rem 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.hero-linkout a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.layout {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.control-panel,
.viewer {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 1.45rem;
}

.panel-header h2,
.card-label h3 {
  margin: 0;
}

.panel-header p,
.selection-summary,
.field-label,
.label-kicker {
  color: var(--muted);
}

.panel-header p {
  margin: 0.35rem 0 0;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
}

.field {
  display: grid;
  gap: 0.55rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

select {
  appearance: none;
  min-height: 3rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--ink);
}

.segmented,
.alpha-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.segmented button,
.alpha-toggles button {
  min-height: 2.8rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  cursor: pointer;
  transition:
    background 140ms ease,
    color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.segmented button:hover,
.alpha-toggles button:hover {
  transform: translateY(-1px);
  border-color: rgba(38, 21, 15, 0.26);
}

.segmented button.is-active,
.alpha-toggles button.is-active {
  background: var(--accent);
  color: #fff8f2;
  border-color: transparent;
}

.alpha-toggles button:not(.is-active) {
  background: var(--accent-soft);
}

.viewer {
  padding: 1.5rem;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.25rem;
}

.viewer-header h2 {
  font-size: clamp(2rem, 3.2vw, 3.1rem);
}

.selection-summary {
  max-width: 36ch;
  margin: 0;
  text-align: right;
  line-height: 1.5;
}

.card {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
}

.original-card {
  width: min(100%, 460px);
  margin: 0 auto 1.5rem;
}

.process-section {
  margin: 0 0 1.6rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(250, 244, 236, 0.88)),
    var(--surface-strong);
}

.process-header {
  margin-bottom: 1.15rem;
  text-align: center;
}

.process-header h3 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: clamp(1.55rem, 2.4vw, 2.2rem);
  letter-spacing: -0.03em;
}

.process-flow {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 104px minmax(260px, 1.15fr) 64px minmax(180px, 1fr);
  gap: 0.9rem;
  align-items: center;
}

.process-node {
  min-height: 184px;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
  text-align: center;
  box-shadow: 0 8px 24px rgba(60, 39, 26, 0.06);
}

.process-node-scan {
  min-height: 196px;
}

.process-node h4,
.latent-label h4 {
  margin: 0;
  font-size: 1.08rem;
}

.process-node p {
  margin: 0.7rem 0 0;
  line-height: 1.55;
  color: var(--muted);
  font-size: 0.95rem;
}

.process-icon {
  display: grid;
  place-items: center;
  width: 3.1rem;
  height: 3.1rem;
  margin: 0 auto 0.85rem;
  border-radius: 999px;
  background: rgba(38, 21, 15, 0.08);
  color: var(--accent);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 1.4rem;
  font-weight: 700;
}

.process-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 2rem;
  font-weight: 700;
}

.process-arrow-prediction {
  align-self: center;
  gap: 0.45rem;
  font-size: 1rem;
  min-width: 0;
}

.process-arrow-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
  line-height: 1.15;
}

.process-arrow-line {
  display: block;
  width: 100%;
  border-top: 2px dashed rgba(177, 74, 40, 0.5);
}

.process-arrow-head {
  font-size: 1.4rem;
  line-height: 1;
}

.scan-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  margin: 0 auto 0.85rem;
}

.scan-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
}

.scan-ring-outer {
  border: 4px solid rgba(38, 21, 15, 0.16);
  border-top-color: rgba(177, 74, 40, 0.72);
  transform: rotate(35deg);
}

.scan-ring-inner {
  inset: 0.35rem;
  border: 4px solid rgba(177, 74, 40, 0.16);
  border-bottom-color: rgba(177, 74, 40, 0.72);
  transform: rotate(-28deg);
}

.scan-core {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.95);
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 700;
}

.process-node-latent {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 230px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 30%, rgba(177, 74, 40, 0.08), transparent 30%),
    radial-gradient(circle at 70% 70%, rgba(116, 145, 124, 0.12), transparent 32%),
    rgba(255, 255, 255, 0.78);
}

.latent-cloud {
  position: absolute;
  inset: 0;
}

.latent-dot {
  position: absolute;
  border-radius: 999px;
  background: rgba(177, 74, 40, 0.55);
  box-shadow: 0 0 20px rgba(177, 74, 40, 0.1);
}

.dot-1 {
  top: 24%;
  left: 28%;
  width: 0.55rem;
  height: 0.55rem;
}

.dot-2 {
  top: 33%;
  left: 62%;
  width: 0.35rem;
  height: 0.35rem;
  background: rgba(116, 145, 124, 0.7);
}

.dot-3 {
  top: 50%;
  left: 48%;
  width: 1rem;
  height: 1rem;
}

.dot-4 {
  top: 58%;
  left: 38%;
  width: 0.55rem;
  height: 0.55rem;
  background: rgba(116, 145, 124, 0.7);
}

.dot-5 {
  top: 64%;
  left: 68%;
  width: 0.8rem;
  height: 0.8rem;
}

.dot-6 {
  top: 20%;
  left: 72%;
  width: 0.6rem;
  height: 0.6rem;
  background: rgba(38, 21, 15, 0.4);
}

.dot-7 {
  top: 73%;
  left: 22%;
  width: 0.45rem;
  height: 0.45rem;
  background: rgba(38, 21, 15, 0.28);
}

.latent-label {
  position: relative;
  z-index: 1;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.9);
  box-shadow: 0 8px 18px rgba(60, 39, 26, 0.08);
  text-align: center;
}

.card-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.8rem;
}

.label-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 800;
}

.image-frame {
  margin: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: calc(var(--radius-sm) + 2px);
  background:
    linear-gradient(135deg, rgba(177, 74, 40, 0.14), rgba(116, 145, 124, 0.14)),
    var(--bg-strong);
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assessor-score {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.comparison-stage {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: start;
}

.alpha-column,
.center-column {
  display: contents;
}

.alpha-column-left .alpha-card {
  transform-origin: right center;
}

.alpha-column-right .alpha-card {
  transform-origin: left center;
}

.alpha-card[data-alpha="-4"],
.alpha-card[data-alpha="4"] {
  background: linear-gradient(180deg, rgba(177, 74, 40, 0.08), rgba(255, 250, 243, 1));
}

.alpha-card[data-alpha="-4"] {
  grid-column: 1;
}

.alpha-card[data-alpha="-2"] {
  grid-column: 2;
}

.alpha-card[data-alpha="0"] {
  grid-column: 3;
  background: linear-gradient(180deg, rgba(116, 145, 124, 0.12), rgba(255, 250, 243, 1));
}

.alpha-card[data-alpha="2"] {
  grid-column: 4;
}

.alpha-card[data-alpha="4"] {
  grid-column: 5;
}

.empty-state {
  padding: 1.1rem;
  border: 1px dashed rgba(38, 21, 15, 0.2);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
}

.empty-state--left {
  grid-column: 1 / 3;
}

.empty-state--center {
  grid-column: 3;
}

.empty-state--right {
  grid-column: 4 / 6;
}

.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;
}

@media (max-width: 1100px) {
  .control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .process-flow {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .process-arrow {
    transform: rotate(90deg);
  }

  .process-arrow-prediction {
    transform: none;
    justify-items: center;
  }

  .process-arrow-prediction .process-arrow-line {
    width: 2px;
    height: 2.75rem;
    border-top: 0;
    border-left: 2px dashed rgba(177, 74, 40, 0.5);
  }

  .process-arrow-prediction .process-arrow-head {
    transform: rotate(90deg);
  }

  .comparison-stage {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .selection-summary {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(calc(100% - 1.2rem), var(--content-width));
    padding-top: 0.6rem;
  }

  .hero,
  .control-panel,
  .viewer {
    padding: 1.1rem;
    border-radius: 22px;
  }

  .hero h1 {
    max-width: 100%;
  }

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

  .viewer-header {
    flex-direction: column;
    align-items: start;
  }

  .process-section {
    padding: 1rem;
  }

  .selection-summary {
    max-width: none;
  }

  .alpha-column,
  .center-column {
    display: contents;
  }
}
