/* Slot Machines, Chance and the Appeal of the Next Spin — editorial article */

.essay-page {
  --paper: #fbfaf7;
  --ink: #1c1a17;
  --ink-soft: #4a453e;
  --rule: #e4dfd6;
  --panel: #f3efe7;
  --accent: #a3232a;
  --charcoal: #2b2a28;
  --measure: 740px;
  --gutter: 20px;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-head: "Newsreader", Georgia, "Times New Roman", serif;
}

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


.essay-page {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

.essay-page img { max-width: 100%; }

.essay-page { padding: 56px var(--gutter) 112px; }

.essay {
  max-width: var(--measure);
  margin: 0 auto;
}

/* Headings */

.essay__header { margin-bottom: 56px; }

.essay__title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.3rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.essay__section + .essay__section,
.essay__section + .demo { margin-top: 64px; }

.essay h2 {
  margin: 0 0 20px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.95rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.essay p { margin: 0 0 1.25em; }
.essay p:last-child { margin-bottom: 0; }

.essay__section--airy p { margin-bottom: 1.6em; }
.essay__section--airy p:last-child { margin-bottom: 0; }

/* Credit stake example */

.stake-panel {
  margin-top: 32px;
  max-width: 380px;
  padding: 20px 24px;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

.essay .stake-panel__label {
  margin: 0 0 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stake-panel__rows { margin: 0; }

.stake-panel__rows div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}

.stake-panel__rows dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.stake-panel__rows .stake-panel__total {
  border-bottom: 0;
  border-top: 1px solid var(--ink-soft);
  margin-top: 2px;
  font-weight: 600;
}

/* Jackpot cards */

.jackpot-cards {
  display: grid;
  gap: 20px;
  margin-top: 32px;
}

.jackpot-card {
  padding: 20px 22px 24px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.jackpot-card img {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  margin: 0 auto 14px;
}

.essay .jackpot-card__title {
  margin: 0 0 4px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.3;
}

.essay .jackpot-card__text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

@media (min-width: 600px) {
  .jackpot-cards { grid-template-columns: 1fr 1fr; }
}

/* Strategy section: machine beside the text on wider screens */

.essay__split-figure {
  margin: 36px auto 0;
  max-width: 260px;
}

.essay__split-figure img {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 760px) {
  .essay__split {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) 220px;
    gap: 44px;
    align-items: start;
  }
  .essay__split-figure { margin: 8px 0 0; max-width: none; }
}

/* Editorial figure */

.essay__figure { margin: 40px 0; }

.essay__figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.essay__figure figcaption {
  margin-top: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink-soft);
}

/* Demo machine */

.demo {
  display: grid;
  gap: 28px;
  padding: 28px 20px;
  background: var(--panel);
  border-radius: 8px;
}

.demo__machine {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.demo__cabinet {
  display: block;
  width: 100%;
  height: auto;
}

/* Overlay positions match the reel window and lever in cabinet.svg (viewBox 480 x 880) */
.demo__reels {
  position: absolute;
  left: 16.25%;
  top: 32.955%;
  width: 59.167%;
  height: 14.318%;
  display: flex;
  justify-content: space-between;
  background: #1e1d1b;
}

.demo__reels::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--accent);
  pointer-events: none;
}

.demo__reel {
  position: relative;
  width: 30.986%;
  height: 100%;
  overflow: hidden;
  background: #fbf7ec;
}

.demo__reel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(26, 23, 20, 0.7) 0%, rgba(26, 23, 20, 0.12) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(26, 23, 20, 0.12) 75%, rgba(26, 23, 20, 0.7) 100%);
  pointer-events: none;
}

.demo__strip {
  will-change: transform;
}

.demo__strip.is-fading { animation: demo-fade 200ms ease-out; }

@keyframes demo-fade {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

.demo__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  padding-bottom: calc(100% * 42 / 88);
  position: relative;
}

.demo__cell img {
  position: absolute;
  top: 4.8%;
  left: 50%;
  width: 43%;
  height: auto;
  transform: translateX(-50%);
}

.demo__lever {
  position: absolute;
  left: 93.333%;
  top: 22.727%;
  width: max(44px, 11%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 200ms ease;
}

.demo__lever:hover:not(:disabled) { box-shadow: 0 0 0 3px rgba(163, 35, 42, 0.35); }
.demo__lever:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.demo__lever:disabled { cursor: progress; }

.essay .demo__label {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

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

.demo__display {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: var(--charcoal);
  border-radius: 4px;
  color: #f3ecdc;
}

.demo__display-label {
  font-size: 0.75rem;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: #cfc6b4;
}

.demo__display-value {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.25rem;
  line-height: 1.3;
  color: #ff8a7e;
  font-variant-numeric: tabular-nums;
}

.demo__buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.demo__button {
  flex: 1;
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid var(--charcoal);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease;
}

.demo__button:hover:not(:disabled) { background: #ece6da; }

.demo__button--spin {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.demo__button--spin:hover:not(:disabled) { background: #861c22; }

.demo__button:focus-visible {
  outline: 3px solid var(--charcoal);
  outline-offset: 2px;
}

.demo__button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.demo__status {
  margin-top: 16px;
  min-height: 3.4em;
}

.essay .demo__centre,
.essay .demo__message {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.essay .demo__message { font-weight: 600; }

.demo__paytable {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.demo__paytable caption {
  text-align: left;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.1rem;
  padding-bottom: 6px;
}

.demo__paytable th,
.demo__paytable td {
  padding: 7px 0;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

.demo__paytable th {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.demo__paytable th:last-child,
.demo__paytable td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.essay .demo__note {
  margin: 12px 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

@media (min-width: 700px) {
  .demo {
    grid-template-columns: 280px 1fr;
    gap: 36px;
    padding: 32px;
    align-items: start;
  }
}

/* Desktop type scale */

@media (min-width: 768px) {
  .essay-page { font-size: 18px; }
  .essay-page { padding-top: 88px; }
  .essay__header { margin-bottom: 64px; }
  .essay__section + .essay__section,
  .essay__section + .demo { margin-top: 80px; }
  .essay__figure { margin: 48px 0; }
}
