/* Homepage sections below the buy box. Shared pieces (header, buy box, testimonials,
   footer) stay in shop.css; everything here is scoped to its own section class. */

.hm-section {
  max-width: 1100px;
  margin: 6rem auto 0;
  padding: 0 2rem;
}

.hm-section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.25;
  margin-bottom: 0.6rem;
  max-width: 34ch;
}

.hm-section p { line-height: 1.65; }

.hm-section a { color: var(--accent); text-decoration: none; }
.hm-section a:hover { text-decoration: underline; }

.hm-lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* ── Display modes: the LCD preview is the page's one showpiece ── */
.modes-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.lcd-figure {
  position: sticky;
  top: 2rem;
}

/* The black frame around a real character LCD. It is also the size container, so
   everything inside scales with the panel rather than the browser window. */
.lcd-bezel {
  container-type: inline-size;
  --lcd-bg: #a8c52a;
  --lcd-on: #142005;
  --lcd-off: rgba(20, 32, 5, 0.06);
  --lcd-glow: rgba(168, 197, 42, 0.22);
  background: #000;
  border: 1px solid #1d1d1d;
  border-radius: 12px;
  padding: 7% 5.5%;
  box-shadow: 0 0 70px var(--lcd-glow);
  transition: box-shadow 0.4s;
}

.lcd-bezel[data-colour="blue"] {
  --lcd-bg: #1646c8;
  --lcd-on: #f1f5ff;
  --lcd-off: rgba(255, 255, 255, 0.06);
  --lcd-glow: rgba(22, 70, 200, 0.3);
}

/* 16 × 2 character cells. Units are fractions of the frame's width: the glass is about
   89cqi wide, which leaves cells of roughly 4.6cqi after padding and gaps. */
.lcd-glass {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 1cqi 0.6cqi;
  padding: 4cqi 3cqi;
  background: var(--lcd-bg);
  border-radius: 3px;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.35);
  transition: background 0.4s;
}

.lcd-cell {
  aspect-ratio: 5 / 8;
  background: var(--lcd-off);
  border-radius: 1px;
  color: var(--lcd-on);
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 8cqi;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.4s;
}

.lcd-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.lcd-colours { display: inline-flex; gap: 0.4rem; }

.lcd-colours button {
  font: inherit;
  font-size: 0.8rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}

.lcd-colours button[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--muted);
}

.mode-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.mode-list li {
  border-left: 2px solid var(--border);
  padding: 0.9rem 0 0.9rem 1.25rem;
  transition: border-color 0.2s;
}

.mode-list li:has(.mode-btn[aria-pressed="true"]) { border-left-color: var(--accent); }

.mode-list h3 { font-size: 1.05rem; line-height: 1.35; }

.mode-btn {
  font: inherit;
  font-weight: 650;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.mode-btn:hover,
.mode-btn[aria-pressed="true"] { color: var(--accent); }

.mode-list p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
  max-width: 60ch;
}

.modes-demo {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ── Home Assistant ── */
.ha {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.ha-text p { color: var(--muted); font-size: 0.95rem; max-width: 60ch; }

.ha-entities > div {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.ha-entities > div:last-child { border-bottom: 1px solid var(--border); }
.ha-entities dt { font-weight: 600; }
.ha-entities dd { color: var(--muted); }

/* ── Setup: a real sequence, so the steps are numbered ── */
.setup-steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 1.75rem;
}

.setup-steps li {
  counter-increment: step;
  border-top: 2px solid var(--border);
  padding-top: 1rem;
}

.setup-steps li::before {
  content: counter(step);
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.75rem;
}

.setup-steps h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.setup-steps p { color: var(--muted); font-size: 0.9rem; }

.setup-alt {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ── Specifications and ordering questions, side by side ── */
.details {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 4rem;
  align-items: start;
}

.details h2 { margin-bottom: 1.25rem; }

.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.55;
}

.specs-table th,
.specs-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.specs-table tr:last-child th,
.specs-table tr:last-child td { border-bottom: 1px solid var(--border); }

.specs-table th {
  width: 8.5rem;
  padding-right: 1rem;
  font-weight: 600;
}

.specs-table td { color: var(--muted); }

.faq dt {
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 1.25rem;
}

.faq dt:first-child { margin-top: 0; }

.faq dd {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 0.3rem;
}

/* Keyboard focus on the homepage's own controls. */
.mode-btn:focus-visible,
.lcd-colours button:focus-visible,
.hm-section a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

@media (max-width: 900px) {
  .setup-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .details { grid-template-columns: minmax(0, 1fr); gap: 3.5rem; }
}

@media (max-width: 768px) {
  .hm-section { margin-top: 4.5rem; padding: 0 1rem; }
  .modes-layout,
  .ha { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .lcd-figure { position: static; }
  .ha-entities > div { grid-template-columns: 8rem 1fr; }
}

@media (max-width: 480px) {
  .setup-steps { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .specs-table th { width: 6.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .lcd-bezel, .lcd-glass, .lcd-cell, .mode-list li { transition: none; }
}
