/* Light and quiet: white and soft-gray bands, one black band for the device,
   type does the work. The accent is the kiosk's light-on orange: bright for
   the mark, deepened for text and buttons so they keep 4.5:1 on white. */
:root {
  --bg: #fff;
  --alt: #f5f5f7;
  --stage: #000;
  --line: #d2d2d7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --on-stage: #f5f5f7;
  --on-stage-2: #a1a1a6;
  --brand: #ff9f0a;
  --accent: #b84a00;
  --accent-hover: #9f3f00;
  --gutter: 16px;
  --max: 1024px;
  --measure: 60ch;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sans:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, 'Helvetica Neue',
    sans-serif;
  --display:
    -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, 'Helvetica Neue',
    sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
  color-scheme: light;
  accent-color: var(--accent);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.47 var(--sans);
  letter-spacing: -0.011em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: rgb(255 159 10 / 30%);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  text-wrap: balance;
}

p,
dd,
li {
  text-wrap: pretty;
}

code {
  font: 0.88em var(--mono);
  letter-spacing: 0;
}

.icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.-filled {
  fill: currentColor;
  stroke: none;
}

/* ---- nav: thin and translucent over the page ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 52px;
  padding: 0 max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
  background: rgb(255 255 255 / 80%);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 rgb(0 0 0 / 8%);
}

.nav > * {
  display: flex;
  align-items: center;
}

.brand {
  gap: 9px;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}

.mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
}

.mark svg {
  width: 15px;
  fill: #fff;
}

.links {
  gap: 28px;
  margin-left: auto;
  font-size: 13px;
}

.links a,
.github {
  color: var(--text);
  opacity: 0.8;
  text-decoration: none;
  transition: opacity 0.2s var(--ease-out);
}

.links a:hover,
.github:hover {
  opacity: 1;
}

.github {
  gap: 6px;
  min-height: 44px;
  font-size: 13px;
}

.github .icon {
  width: 16px;
  height: 16px;
}

/* ---- buttons and links ---- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 980px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  text-decoration: none;
  transition: background 0.2s var(--ease-out);
}

.button:hover {
  background: var(--accent-hover);
}

.more {
  color: var(--accent);
  text-decoration: none;
}

.more:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.more.-chevron::after {
  content: '\00a0›';
}

/* ---- hero ---- */

.hero {
  max-width: 980px;
  margin: 0 auto;
  padding: 104px var(--gutter) 80px;
  text-align: center;
}

h1 {
  font-size: clamp(44px, 7vw, 80px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 34em;
  margin: 24px auto 0;
  color: var(--text-2);
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.38;
  letter-spacing: -0.015em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 32px;
  margin-top: 36px;
}

.hero .more {
  font-size: 19px;
}

.meta {
  margin: 28px 0 0;
  color: var(--text-2);
  font-size: 14px;
}

/* ---- demo: the screen on a black stage ---- */

.demo {
  padding: 96px var(--gutter) 88px;
  background: var(--stage);
  color: var(--on-stage);
  scroll-margin-top: 52px;
}

/* Waveshare's white case around the Touch Display 2. */
.device {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
}

.bezel {
  padding: clamp(10px, 2.6vw, 26px) clamp(12px, 3.2vw, 34px);
  border-radius: clamp(12px, 2.4vw, 28px);
  background: linear-gradient(170deg, #fdfdfe, #e4e4e9);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -2px 3px rgb(0 0 0 / 12%);
}

.screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: clamp(4px, 0.8vw, 8px);
  background: #000;
  box-shadow: 0 0 0 2px #2a2a2c;
}

/* The kiosk at its real 1280x720, scaled to fit (main.js sets --scale). */
.screen iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 720px;
  border: 0;
  transform: scale(var(--scale, 0.5));
  transform-origin: 0 0;
  z-index: 1; /* over the loading text: the kiosk covers it once it draws */
  transition: opacity 0.3s var(--ease-out);
}

.screen.-switching iframe {
  opacity: 0;
}

.screen:fullscreen {
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--on-stage-2);
  font-size: 14px;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.screen.-ready .loading {
  opacity: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  margin-top: 48px;
}

.segmented {
  display: flex;
  padding: 3px;
  border-radius: 980px;
  background: #1d1d1f;
}

.segmented button,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 980px;
  background: none;
  color: var(--on-stage-2);
  font: 400 14px var(--sans);
  cursor: pointer;
  transition:
    background 0.2s var(--ease-out),
    color 0.2s var(--ease-out);
}

.segmented button:hover,
.chip:hover {
  color: var(--on-stage);
}

.segmented button[aria-checked='true'] {
  background: #48484a;
  color: #fff;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.chip .icon {
  width: 16px;
  height: 16px;
}

.chip.-ring {
  color: var(--brand);
}

.hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  max-width: 860px;
  margin: 32px auto 0;
  padding: 0;
  color: var(--on-stage-2);
  font-size: 14px;
  list-style: none;
}

.hints b {
  color: var(--on-stage);
  font-weight: 600;
}

.note {
  margin: 12px 0 0;
  color: var(--on-stage-2);
  font-size: 14px;
  text-align: center;
}

/* ---- sections: full-width bands, content held to --max ---- */

.section {
  padding: 120px max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
  scroll-margin-top: 0;
}

.section.-alt {
  background: var(--alt);
}

.intro {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.intro.-left {
  margin: 0;
  text-align: left;
}

h2 {
  font-size: clamp(34px, 4.8vw, 56px);
  line-height: 1.07;
  letter-spacing: -0.03em;
}

.intro p {
  max-width: var(--measure);
  margin: 18px auto 0;
  color: var(--text-2);
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.4;
}

.intro.-left p {
  margin-left: 0;
}

/* Features: icon, title, a line of text. Space groups them, not boxes. */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 56px 48px;
  margin: 80px 0 0;
}

.features dt {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.features dt .icon {
  display: block;
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  color: var(--accent);
  stroke-width: 1.75;
}

.features dd {
  margin: 8px 0 0;
  color: var(--text-2);
}

.features code,
.after code,
.intro code,
.part-text code {
  color: var(--text);
}

/* ---- how it works ---- */

.flow {
  display: grid;
  grid-template-columns: 1fr auto 1.15fr auto 1fr;
  align-items: stretch;
  margin: 72px 0 0;
  padding: 0;
  list-style: none;
}

.node {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px;
  border-radius: 18px;
  background: var(--bg);
}

.node-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.node.-main .node-title {
  color: var(--accent);
}

.node-text {
  color: var(--text-2);
  font-size: 15px;
}

.link {
  position: relative;
  align-self: center;
  width: 120px;
  height: 1px;
  margin: 0 8px;
  background: var(--text-2);
}

.link::after {
  position: absolute;
  top: -4px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-top: 1px solid var(--text-2);
  border-right: 1px solid var(--text-2);
  transform: rotate(45deg);
  content: '';
}

.link span {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: max-content;
  max-width: 120px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  transform: translateX(-50%);
}

/* ---- gallery ---- */

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 24px;
  margin-top: 72px;
}

.gallery figure {
  margin: 0;
}

.gallery img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  outline: 1px solid rgb(0 0 0 / 8%);
  outline-offset: -1px;
}

.gallery figcaption {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

/* ---- clip: the kiosk filmed on a real wall ---- */

.clip {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 72px;
  border-radius: 14px;
  background: var(--stage);
}

/* ---- config ---- */

.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 64px;
  align-items: center;
}

.code {
  margin: 0;
  padding: 26px 28px;
  overflow-x: auto;
  border-radius: 18px;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.7 var(--mono);
  letter-spacing: 0;
}

.code code {
  font: inherit;
  color: inherit;
}

.code .k {
  color: var(--accent);
}

.code .c {
  color: var(--text-2);
}

/* ---- parts: a spec list with hairlines ---- */

.parts {
  max-width: 900px;
  margin: 64px auto 0;
  padding: 0;
  list-style: none;
}

.parts li {
  display: grid;
  grid-template-columns: 15rem 1fr auto;
  gap: 8px 32px;
  align-items: baseline;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.parts li:last-child {
  border-bottom: 1px solid var(--line);
}

.part-name {
  font-weight: 600;
}

.part-text {
  color: var(--text-2);
}

.part-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.part-link {
  color: var(--accent);
  font-size: 15px;
  text-decoration: none;
}

.part-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.part-link::after {
  content: '\00a0↗';
}

.used {
  max-width: 900px;
  margin: 16px auto 0;
  color: var(--text-2);
  font-size: 14px;
}

.used a {
  color: inherit;
  text-underline-offset: 3px;
}

.after {
  max-width: var(--measure);
  margin: 36px auto 0;
  color: var(--text-2);
  text-align: center;
}

/* ---- install ---- */

.tabs {
  display: flex;
  width: fit-content;
  margin: 48px auto 0;
  padding: 3px;
  border-radius: 980px;
  background: #e8e8ed;
}

.tabs button {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 980px;
  background: none;
  color: var(--text-2);
  font: 400 14px var(--sans);
  cursor: pointer;
  transition:
    background 0.2s var(--ease-out),
    color 0.2s var(--ease-out);
}

.tabs button:hover {
  color: var(--text);
}

.tabs button[aria-selected='true'] {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}

.install {
  max-width: 680px;
  margin: 40px auto 0;
}

.badge-line {
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: 14px;
  text-align: center;
}

.badge {
  margin-right: 6px;
  padding: 3px 10px;
  border-radius: 980px;
  background: #fff1dc;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.steps {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  counter-reset: step;
  list-style: none;
}

.steps li {
  position: relative;
  padding: 18px 20px 18px 60px;
  border-radius: 18px;
  background: var(--bg);
  counter-increment: step;
}

.steps li::before {
  position: absolute;
  top: 16px;
  left: 20px;
  display: grid;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  content: counter(step);
  font-size: 13px;
  font-weight: 600;
  place-items: center;
}

.steps .button {
  display: flex;
  width: fit-content;
  margin-top: 12px;
}

.steps code {
  color: var(--text);
}

.install .after {
  margin-top: 28px;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
  color: var(--text-2);
  font: 13px var(--mono);
}

.copy {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 980px;
  background: #e8e8ed;
  color: var(--text);
  font: 400 13px var(--sans);
  cursor: pointer;
  transition: background 0.2s var(--ease-out);
}

.copy:hover {
  background: #dcdce1;
}

#install .actions {
  margin-top: 44px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 20px max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter))) 40px;
  background: var(--alt);
  color: var(--text-2);
  font-size: 12px;
}

.footer::before {
  flex-basis: 100%;
  height: 1px;
  margin-bottom: 12px;
  background: var(--line);
  content: '';
}

/* ---- smaller screens ---- */

@media (max-width: 960px) {
  .features,
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .links {
    display: none;
  }

  .github {
    margin-left: auto;
  }

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

  .link {
    width: 1px;
    height: 56px;
    margin: 0 0 0 28px;
  }

  .link::after {
    top: auto;
    right: -4px;
    bottom: -1px;
    transform: rotate(135deg);
  }

  .link span {
    top: 50%;
    bottom: auto;
    left: 16px;
    max-width: none;
    text-align: left;
    transform: translateY(-50%);
  }

  .split {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .parts li {
    grid-template-columns: 1fr auto;
  }

  .part-text {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .part-links {
    grid-column: 1 / -1;
    grid-row: 3;
    align-items: flex-start;
  }

  .section {
    padding-block: 88px;
  }
}

@media (max-width: 560px) {
  .hero {
    padding-top: 64px;
    padding-bottom: 56px;
  }

  .demo {
    padding-top: 48px;
    padding-bottom: 56px;
  }

  .features,
  .gallery {
    grid-template-columns: 1fr;
  }

  .segmented button {
    padding: 0 12px;
    font-size: 13px;
  }
}

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

  * {
    transition: none !important;
  }
}
