/* Binary Star — landing page (/). Tokens and primitives come from base.css. */

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 50;
  background: var(--gold); color: var(--sky); padding: 10px 14px;
  font-family: var(--font-pixel); font-size: 13px; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--sky); }

/* ---------------------------------------------------------------- header */
.landing-header { max-width: 1200px; padding: 24px; }
.landing-brand { font-size: 20px; }
.landing-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.landing-nav-link {
  color: var(--ink-2); text-decoration: none; font-size: 15px; padding: 0 12px;
  min-height: 44px; display: inline-flex; align-items: center;
}
.landing-nav-link:hover { color: var(--ink); }
.landing-nav-cta {
  font-family: var(--font-pixel); font-size: 14px; text-decoration: none; color: var(--sky);
  background: var(--gold); padding: 0 18px; min-height: 44px; display: inline-flex; align-items: center;
  box-shadow: 4px 4px 0 var(--sky-deep);
}
.landing-nav-cta:hover { color: var(--sky); background: var(--gold-hi); }
.landing-nav-cta:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--sky-deep); }

/* ---------------------------------------------------------------- hero */
.hero {
  max-width: 1200px; margin: 0 auto; padding: 56px 24px 96px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  gap: 64px; align-items: center;
}
.hero-copy { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.hero-title {
  margin: 0; font-family: var(--font-pixel); font-weight: 400; font-size: clamp(32px, 5vw, 68px);
  line-height: 1.05; letter-spacing: -1px; text-wrap: balance;
}
.hero-lede { margin: 0; font-size: 18px; line-height: 1.6; color: var(--ink-2); max-width: 520px; text-wrap: pretty; }

/* ---------------------------------------------------------------- play card */
.play-card {
  background: var(--panel); border: 2px solid var(--line); box-shadow: 8px 8px 0 var(--sky-deep);
  padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 520px;
  scroll-margin-top: 16px;
}
.play-card:focus { outline: none; }
.play-form, .join-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.join-form { gap: 12px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-family: var(--font-pixel); font-size: 12px; letter-spacing: 1px; color: var(--ink-3); padding: 0; }
.hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-3); }

.text-input {
  font-family: var(--font-lcd); font-size: 26px; color: var(--ink); background: var(--sky);
  border: 2px solid var(--line); padding: 8px 12px; min-height: 48px; width: 100%; min-width: 0;
  text-transform: uppercase; border-radius: 0;
}
.text-input::placeholder { color: var(--ink-4); }
.text-input:hover { border-color: var(--ink-4); }
.text-input:focus { border-color: var(--gold); }
.text-input[aria-invalid="true"] { border-color: var(--red); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pair-fieldset { display: flex; flex-direction: column; gap: 12px; }
.pair-fieldset legend { margin-bottom: 4px; }
.pair-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pair-btn {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 10px 12px;
  background: var(--sky); border: 2px solid var(--line); cursor: pointer; min-height: 44px;
}
.pair-btn:hover { border-color: var(--ink-4); }
.pair-btn[aria-pressed="true"] { background: var(--panel-hi); border-color: var(--gold); box-shadow: 4px 4px 0 var(--sky-deep); }
.pair-art { display: flex; align-items: center; gap: 6px; }
.pair-dash { width: 10px; height: 2px; background: repeating-linear-gradient(90deg, var(--gold) 0 3px, transparent 3px 5px); }
.pair-name { font-family: var(--font-pixel); font-size: 11px; color: var(--ink-2); }
.pair-btn[aria-pressed="true"] .pair-name { color: var(--ink); }

.halves {
  display: flex; align-items: center; gap: 12px; background: var(--sky); border: 2px solid var(--line);
  padding: 6px 6px 6px 12px;
}
.halves-names { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.half { display: flex; align-items: center; gap: 8px; }
.half strong { color: var(--ink); font-weight: 600; }
.swap-btn {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; font-family: var(--font-pixel); font-size: 11px;
  color: var(--ink); background: transparent; border: 2px solid var(--line); padding: 0 12px; min-height: 44px; cursor: pointer;
}
.swap-btn:hover { border-color: var(--ink-3); }
.swap-btn:active { transform: translateY(2px); }

.create-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.difficulty-fieldset { flex: 1 1 220px; }
.tester-note { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; border: 2px dashed var(--gold); padding: 12px 14px; }
.tester-note p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.tester-note strong { color: var(--gold); font-weight: 600; }
.tester-leave { font: inherit; font-size: 12px; color: var(--ink-3); background: none; border: 0; padding: 4px 0; text-decoration: underline; cursor: pointer; }
.tester-leave:hover { color: var(--ink); }
.difficulty-fieldset legend { margin-bottom: 8px; }
.difficulty-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.level-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  min-height: 58px; padding: 6px 4px; cursor: pointer; color: var(--ink-2); background: var(--sky); border: 2px solid var(--line);
}
.level-btn:hover { border-color: var(--ink-4); }
.level-btn[aria-pressed="true"] { color: var(--gold); background: var(--panel-hi); border-color: var(--gold); }
.level-name { font-family: var(--font-pixel); font-size: 11px; letter-spacing: 1px; }
.pips { display: flex; gap: 3px; }
.pip { display: block; width: 6px; height: 6px; background: var(--line); }
.pip.on { background: var(--ink-3); }
.level-btn[aria-pressed="true"] .pip.on { background: var(--gold); }

.create-btn {
  flex: 1 1 200px; font-family: var(--font-pixel); font-size: 18px; color: var(--sky); background: var(--gold);
  border: 0; padding: 0 20px; min-height: 58px; box-shadow: 5px 5px 0 var(--sky-deep); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.create-btn:hover { background: var(--gold-hi); }
.create-btn:active { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--sky-deep); }
.create-btn[disabled], .join-btn[disabled] { opacity: .55; cursor: progress; transform: none; }

.form-error {
  margin: 0; font-size: 14px; line-height: 1.5; color: var(--red-soft);
  display: flex; gap: 8px; align-items: baseline;
}
.form-error:empty { display: none; }
.form-error::before { content: '✕'; font-family: var(--font-pixel); font-size: 11px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.divider span { flex: 1; height: 2px; background: var(--line); }

.join-row { display: flex; flex-wrap: wrap; gap: 10px; }
.code-input { flex: 1 1 180px; width: auto; letter-spacing: 3px; min-height: 52px; }
.join-btn {
  flex: 0 0 auto; font-family: var(--font-pixel); font-size: 15px; color: var(--ink); background: transparent;
  border: 2px solid var(--ink); padding: 12px 22px; min-height: 52px; cursor: pointer;
}
.join-btn:hover { background: rgba(237, 234, 255, .06); }
.join-btn:active { transform: translateY(2px); }
.join-note { margin-top: -2px; }

.rejoin { margin: -6px 0 0; font-size: 14px; }
.rejoin a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  font-family: var(--font-pixel); font-size: 12px; letter-spacing: 1px;
}
.rejoin-code { font-family: var(--font-lcd); font-size: 22px; letter-spacing: 2px; }

/* ---------------------------------------------------------------- demo boards */
.demo { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 24px; min-width: 0; }
/* Boards stacked in one centred column; the "Link" cable is a dashed gold bracket on the right that runs
   from the middle of the top handheld to the middle of the bottom one. Sizes derive from --cell. */
.demo-boards {
  --cell: 24px;
  --bezel-h: calc(var(--cell) * 9 + 16px + 28px);  /* 9 cells + LCD padding + bezel padding */
  --cap-h: 26px;                                    /* caption gap (10) + caption line (16) */
  --stack-gap: 20px;
  --link-w: 60px;
  display: flex; align-items: flex-start; justify-content: center;
  padding-left: var(--link-w);                      /* balances the link so the boards stay centred */
  max-width: 100%;
}
.demo-stack { display: flex; flex-direction: column; gap: var(--stack-gap); }
.demo-side { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.demo-bezel { background: var(--bezel); padding: 14px; box-shadow: 0 6px 0 var(--sky-deep); }
.demo-bezel-a { border-radius: 10px 10px 28px 10px; }
.demo-bezel-b { border-radius: 10px 10px 10px 28px; }
.demo-lcd { background: var(--lcd); padding: 8px; display: grid; grid-template-columns: repeat(9, var(--cell)); grid-auto-rows: var(--cell); }
.demo-caption { font-family: var(--font-pixel); font-size: 12px; line-height: 16px; letter-spacing: 1px; color: var(--ink-2); }

.demo-link {
  --spine-x: 36px;                                  /* centre of the vertical cable, from the board edge */
  position: relative; flex: 0 0 var(--link-w); width: var(--link-w);
  margin-top: calc(var(--bezel-h) / 2 - 5px);
  height: calc(var(--bezel-h) + var(--cap-h) + var(--stack-gap) + 10px);
}
.demo-link .plug { position: absolute; left: 0; width: 12px; height: 10px; background: var(--pad-ink); }
.demo-link .plug-top { top: 0; }
.demo-link .plug-bottom { bottom: 0; }
.demo-link .arm {
  position: absolute; left: 12px; width: calc(var(--spine-x) - 12px + 2px); height: 4px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 6px, transparent 6px 10px);
}
.demo-link .arm-top { top: 3px; }
.demo-link .arm-bottom { bottom: 3px; }
.demo-link .spine {
  position: absolute; left: calc(var(--spine-x) - 2px); top: 3px; bottom: 3px; width: 4px;
  background: repeating-linear-gradient(var(--gold) 0 6px, transparent 6px 10px);
}
.demo-link .link-label {
  position: absolute; left: var(--spine-x); top: 50%; transform: translate(-50%, -50%);
  background: var(--sky); padding: 6px 2px;
  font-family: var(--font-pixel); font-size: 11px; line-height: 1; color: var(--gold); letter-spacing: 1px;
}
.demo-figcaption { font-family: var(--font-lcd); font-size: 22px; color: var(--ink-3); text-align: center; max-width: 440px; }
.demo-figcaption .blink { color: var(--gold); }

/* LCD cells with region borders (thick where the region changes). */
.lcell {
  display: flex; align-items: center; justify-content: center;
  border-top: 1px solid var(--lcd-line); border-left: 1px solid var(--lcd-line);
}
.lcell.t { border-top: 3px solid var(--lcd-ink); }
.lcell.l { border-left: 3px solid var(--lcd-ink); }
.lcell.r { border-right: 3px solid var(--lcd-ink); }
.lcell.b { border-bottom: 3px solid var(--lcd-ink); }

/* ---------------------------------------------------------------- how */
.how { background: var(--panel); border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.how-inner { max-width: 1200px; margin: 0 auto; padding: 88px 24px; display: flex; flex-direction: column; gap: 48px; }
.section-title { margin: 0; font-family: var(--font-pixel); font-weight: 400; font-size: clamp(26px, 3.4vw, 44px); line-height: 1.1; text-wrap: balance; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 24px; }
.step { background: var(--sky); border: 2px solid var(--line); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.step-num { font-family: var(--font-pixel); font-size: 40px; color: var(--gold); line-height: 1; }
.step h3 { margin: 0; font-family: var(--font-pixel); font-weight: 400; font-size: 20px; }
.step p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-2); }

/* ---------------------------------------------------------------- rules */
.rules {
  max-width: 1200px; margin: 0 auto; padding: 96px 24px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 56px; align-items: start;
}
.rules-intro { display: flex; flex-direction: column; gap: 24px; }
.neighbours-row { display: flex; align-items: center; gap: 20px; }
.neighbours-row p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-3); max-width: 260px; }
.neighbours {
  flex: 0 0 auto; background: var(--lcd); padding: 6px; display: grid; grid-template-columns: repeat(3, 34px); grid-auto-rows: 34px;
  box-shadow: 6px 6px 0 var(--sky-deep);
}
.neighbours > div { border: 1px solid var(--lcd-line); display: flex; align-items: center; justify-content: center; }
.rules-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; border-top: 2px solid var(--line); }
.rules-list li { display: flex; gap: 20px; align-items: baseline; padding: 20px 0; border-bottom: 2px solid var(--line); font-size: 18px; line-height: 1.5; }
.rule-num { font-family: var(--font-pixel); color: var(--gold); font-size: 14px; flex: 0 0 32px; }

/* ---------------------------------------------------------------- CTA + footer */
.cta-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px 96px; }
.cta {
  background: var(--gold); color: var(--sky); padding: 48px 40px; box-shadow: 10px 10px 0 var(--sky-deep);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
}
.cta-copy { display: flex; flex-direction: column; gap: 8px; }
.cta h2 { margin: 0; font-family: var(--font-pixel); font-weight: 400; font-size: clamp(24px, 3vw, 38px); line-height: 1.1; }
.cta p { margin: 0; font-size: 17px; color: var(--shell-ink); }
.cta-btn {
  font-family: var(--font-pixel); font-size: 17px; color: var(--gold); background: var(--sky); text-decoration: none;
  padding: 0 24px; min-height: 56px; display: inline-flex; align-items: center; box-shadow: 5px 5px 0 #8A6A12;
}
.cta-btn:hover { color: var(--gold-hi); }
.cta-btn:active { transform: translate(2px, 2px); box-shadow: 3px 3px 0 #8A6A12; }
.cta-btn:focus-visible { outline-color: var(--sky); }

.landing-footer { border-top: 2px solid var(--line); }
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 32px 24px; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 16px; font-size: 14px; color: var(--ink-3);
}
.footer-brand { font-family: var(--font-pixel); color: var(--ink); }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 640px) {
  .landing-header { padding: 14px 16px; gap: 8px 16px; }
  .landing-nav { gap: 4px; }
  .landing-nav-link { padding: 0 8px; font-size: 14px; }
  .hero { padding: 24px 16px 64px; gap: 48px; }
  .hero-copy { gap: 22px; }
  .hero-lede { font-size: 16px; }
  .play-card { padding: 16px; box-shadow: 6px 6px 0 var(--sky-deep); }
  .how-inner { padding: 56px 16px; gap: 32px; }
  .step { padding: 22px; }
  .rules { padding: 64px 16px; gap: 40px; }
  .rules-list li { font-size: 16px; gap: 14px; }
  .cta-wrap { padding: 0 16px 64px; }
  .cta { padding: 32px 22px; box-shadow: 6px 6px 0 var(--sky-deep); }
  .footer-inner { padding: 24px 16px; }
}
@media (max-width: 480px) {
  .pair-list { grid-template-columns: 1fr; gap: 8px; }
  .pair-btn { flex-direction: row; justify-content: space-between; padding: 10px 14px; }
  .halves { flex-wrap: wrap; }
  .landing-brand { font-size: 17px; }
}
/* Phones: drop the balancing spacer and shrink the cells so column + link fit without horizontal scroll
   (20px cells: 224px handheld + 60px link = 284px; 18px cells: 266px). */
@media (max-width: 420px) {
  .demo-boards { --cell: 20px; padding-left: 0; }
  .demo-lcd .lcell svg[viewBox="0 0 9 7"] { width: 14px; height: 11px; }
  .demo-lcd .lcell svg[viewBox="0 0 5 5"] { width: 8px; height: 8px; }
}
@media (max-width: 340px) {
  .demo-boards { --cell: 18px; }
}
