/* StitchWitch — Braun-style hardware (warm greys, a device, one signal colour) set in
   Lyndsay's type system: tight Inter, an italic Playfair turn of phrase, Inconsolata
   for labels and keys. A visible grid frames the page; a little film grain over all. */

:root {
  --paper: #ecebe7;
  --panel: #f6f5f2;
  --ink: #1c1c1b;
  --ink-soft: #55534f;
  --mute: #8d8a84;
  --line: #d3d0c9;
  --body: #232322;
  --body-edge: #3a3a38;
  --signal: #e8572a;
  --radius: 14px;
  --font: "Inter", system-ui, sans-serif;
  --font-label: "Inconsolata", ui-monospace, monospace;
  --font-accent: "Playfair Display", Georgia, serif;
  --heading-weight: 500;
  --heading-tracking: -0.045em;
  --wrap: 1120px;
  --popup-w: 210px;
  --gutter: 40px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  line-height: 1.06;
}

h1 {
  font-size: clamp(2.9rem, 6vw, 5.2rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(2rem, 3.6vw, 3rem);
  letter-spacing: -0.04em;
}

h3 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* The italic turn of phrase: once, in the hero, where the film plays. */
h1 em {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* The visible grid: two hairlines in the margins either side of the content, a gutter
   clear of it so nothing touches them. On narrow screens they sit off the edges. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  --grid-x: calc(min(var(--wrap), 100vw - 48px) / 2 + var(--gutter));
  background:
    linear-gradient(var(--line), var(--line)) calc(50% - var(--grid-x)) 0 / 1px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) calc(50% + var(--grid-x)) 0 / 1px 100% no-repeat;
}

/* Film grain, barely there. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main,
.bar,
.foot {
  position: relative;
  z-index: 1;
}

p {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

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

/* Short card copy reads best as even lines. */
.step p,
.column p,
.use p,
.stat__text {
  text-wrap: balance;
}

a {
  color: inherit;
}

.wrap {
  width: min(var(--wrap), 100% - 48px);
  margin-inline: auto;
}

.label,
.step__num,
.spec dt,
.counter,
.device__badge {
  font-family: var(--font-label);
}

.label {
  margin-bottom: 18px;
  color: var(--mute);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.label--light {
  color: #9b9891;
}

/* Buttons: a flat black key with a signal-coloured pip, like a camera's run switch. */
.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 0;
  background: var(--ink);
  color: var(--panel);
  font-family: var(--font-label);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease;
}

.button::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 0;
  background: var(--signal);
}

.button:hover {
  background: #000;
}

.button:active {
  transform: translateY(1px);
}

.button--small {
  padding: 9px 16px;
  font-size: 0.85rem;
}

.button--light {
  background: var(--panel);
  color: var(--ink);
}

.button--light:hover {
  background: #fff;
}

.link {
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}

.link:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* Top bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--signal);
}

.bar__nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.9rem;
}

.bar__nav a:not(.button) {
  color: var(--ink-soft);
  text-decoration: none;
}

.bar__nav a:not(.button):hover {
  color: var(--ink);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 64px;
  align-items: center;
  padding: 96px 0 72px;
}

.lede {
  max-width: 30em;
  margin-top: 24px;
  color: var(--ink-soft);
  font-size: 1.12rem;
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 36px;
}

/* The device */
.device {
  margin: 0;
  padding: 14px;
  border-radius: 22px;
  background: var(--body);
  box-shadow:
    inset 0 1px 0 var(--body-edge),
    0 30px 60px -30px rgb(0 0 0 / 0.45),
    0 10px 20px -10px rgb(0 0 0 / 0.25);
}

.device__window {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 10px;
  background: #d9dcd8;
}

.pano {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Twice as wide as the window; drifting by half loops seamlessly, like looking around. */
.pano__strip {
  width: 200%;
  height: 100%;
  animation: look-around 40s linear infinite;
}

@keyframes look-around {
  to {
    transform: translateX(-50%);
  }
}

.demo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.demo-canvas:active {
  cursor: grabbing;
}

.device__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgb(28 28 27 / 0.75);
  color: var(--panel);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

/* Pop-ups: small cards with a pointer, a nod to pop-up video. */
.popups {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.popup {
  position: absolute;
  display: flex;
  gap: 10px;
  align-items: center;
  width: var(--popup-w);
  padding: 8px;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 24px -12px rgb(0 0 0 / 0.4);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.popup::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 22px;
  width: 12px;
  height: 12px;
  background: var(--panel);
  transform: rotate(45deg);
  border-radius: 2px;
}

.popup.is-on {
  opacity: 1;
  transform: none;
}

.popup__thumb {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
}

.popup__text {
  display: grid;
  gap: 2px;
  font-size: 0.78rem;
  line-height: 1.3;
}

.popup__time {
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

.popup__title {
  font-weight: 500;
}

.device__controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 16px 6px 4px;
}

.counter {
  display: grid;
  gap: 2px;
  padding: 7px 12px;
  border-radius: 8px;
  background: #121211;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.6);
}

.counter__label {
  color: #77746e;
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.counter__value {
  min-width: 8.4ch;
  color: var(--panel);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.track {
  position: relative;
  height: 34px;
}

.track__ticks {
  position: absolute;
  inset: 12px 0 auto;
  height: 10px;
  background: repeating-linear-gradient(to right, #6b6a66 0 1px, transparent 1px 12px);
  opacity: 0.7;
}

.track__markers {
  position: absolute;
  inset: 0;
}

.track__marker {
  position: absolute;
  top: 26px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: #8f8c86;
  transition: background 0.3s ease;
}

.track__marker.is-past {
  background: var(--signal);
}

.track__head {
  position: absolute;
  top: 4px;
  bottom: 10px;
  left: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--signal);
}

.knobs {
  display: flex;
  gap: 10px;
}

.knob {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a4a47, #222220 70%);
  box-shadow:
    inset 0 1px 0 #5a5a56,
    0 2px 3px rgb(0 0 0 / 0.5);
}

.knob--signal {
  background: radial-gradient(circle at 35% 30%, #f07a52, var(--signal) 70%);
  box-shadow:
    inset 0 1px 0 #f59a7a,
    0 2px 3px rgb(0 0 0 / 0.5);
}

/* At a glance: three numbers, read like a camera's display. */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 28px 24px 28px 0;
}

.stat + .stat {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.stat__num {
  color: var(--signal);
  font-family: var(--font-label);
  font-size: 3rem;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat__text {
  max-width: 13em;
  color: var(--ink-soft);
  line-height: 1.35;
}

/* Sections */
.section {
  padding: 112px 0 0;
}

.section__head {
  max-width: 40rem;
  margin-bottom: 48px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}

.step {
  padding: 28px 28px 0 0;
}

.step + .step {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.step__num {
  display: block;
  margin-bottom: 40px;
  color: var(--signal);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.step p,
.column p,
.split__body > p {
  margin-top: 12px;
  color: var(--ink-soft);
}

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

.section--split .section__head {
  margin-bottom: 0;
}

.density {
  position: relative;
  margin-top: 40px;
  padding: 24px 20px 40px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.density__bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
}

.density__bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: #c5c2bb;
}

.density__bar.is-peak {
  background: var(--ink);
}

.density__labels {
  position: absolute;
  inset: auto 20px 12px;
  height: 18px;
}

.density__labels span {
  position: absolute;
  transform: translateX(-50%);
  color: var(--ink-soft);
  font-size: 0.75rem;
  white-space: nowrap;
}

.density__labels span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--signal);
  vertical-align: 1px;
}

/* Dark feature panel (found moments). */
.bestbits {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 64px;
  align-items: center;
  padding: 48px;
  border-radius: 22px;
  background: var(--body);
  color: var(--panel);
}

.bestbits .label {
  color: #9b9891;
}

.bestbits__copy p:not(.label) {
  margin-top: 16px;
  color: #b4b1aa;
}

/* Found moments: a stylised 360 frame with pins on spots and photos drifting down. */
.finds-scene {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(#5d6a72 0%, #a7aeaa 46%, #5f7a4e 47%, #3e5634 100%);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.6);
}

.finds-scene__horizon {
  position: absolute;
  inset: 34% 0 auto;
  height: 16%;
  background: radial-gradient(60% 100% at 30% 100%, #47554a 0 60%, transparent 61%),
    radial-gradient(50% 90% at 75% 100%, #3f4c43 0 60%, transparent 61%);
}

.finds-pin {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 4px;
  transform: translate(-50%, -100%);
  font-family: var(--font-label);
  font-size: 0.7rem;
}

.finds-pin__note {
  max-width: 160px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgb(20 20 19 / 0.85);
  color: #f2f0eb;
  font-family: var(--font);
  font-size: 0.75rem;
  line-height: 1.3;
}

.finds-pin__name {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgb(20 20 19 / 0.7);
  color: #f2f0eb;
}

.finds-pin__head {
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  background: var(--signal);
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.5);
  transform: rotate(-45deg);
}

.finds-scene__rain {
  position: absolute;
  inset: 0 5% 0 auto;
  width: 15%;
}

.finds-scene__rain span {
  position: absolute;
  top: var(--y);
  left: 0;
  width: 100%;
  aspect-ratio: 1;
  border: 3px solid #f6f5f2;
  border-radius: 4px;
  background: linear-gradient(160deg, #c9b9a6, #7d8f78);
  box-shadow: 0 6px 14px rgb(0 0 0 / 0.35);
  transform: rotate(var(--r));
}

.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--ink);
}

/* Spec plate: like the printed table on the back of a Braun manual. */
.spec {
  margin: 0;
  border-top: 1px solid var(--ink);
}

.spec div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.spec dt {
  color: var(--mute);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-top: 3px;
}

.spec dd {
  margin: 0;
}

/* Other use cases: a four-up grid of plates. */
.uses {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}

.use {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 24px 0 0;
}

.use + .use {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.use p {
  flex: 1;
  color: var(--ink-soft);
}

.use .link {
  align-self: flex-start;
}

/* Access */
.access {
  margin-top: 128px;
  background: var(--body);
  color: var(--panel);
}

.access__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 48px;
  padding: 96px 0;
}

.access h2 {
  max-width: 16em;
}

.access__lede {
  max-width: 34em;
  margin-top: 20px;
  color: #b4b1aa;
}

.foot {
  display: flex;
  justify-content: space-between;
  padding: 28px 0 40px;
  color: var(--mute);
  font-size: 0.85rem;
}

/* Small screens */
@media (max-width: 880px) {
  .hero,
  .section--split,
  .bestbits {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .bestbits {
    padding: 32px 24px;
  }

  .finds-pin__note {
    display: none;
  }

  .hero {
    padding-top: 56px;
  }

  .steps,
  .columns,
  .stats {
    grid-template-columns: 1fr;
  }

  .uses {
    grid-template-columns: 1fr 1fr;
    row-gap: 32px;
  }

  .use:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .stat,
  .stat + .stat {
    padding: 18px 0;
    border-left: 0;
  }

  .stat + .stat {
    border-top: 1px solid var(--line);
  }

  .step,
  .step + .step {
    padding: 24px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .step__num {
    margin-bottom: 16px;
  }

  .spec div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

  .bar__nav a:not(.button) {
    display: none;
  }

  :root {
    --popup-w: 180px;
  }

  .hero__actions {
    flex-wrap: wrap;
    gap: 16px 24px;
  }
}

@media (max-width: 560px) {
  .uses {
    grid-template-columns: 1fr;
  }

  .use,
  .use + .use {
    padding: 20px 0 0;
    border-left: 0;
  }
}

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

  .pano__strip {
    animation: none;
  }

  .popup {
    transition: none;
  }
}
