/* Contemporary, Jay Digital palette, Instrument Sans, pill controls, dark first.
   Tokens match the extension popup (docs/DESIGN.md). */

@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/InstrumentSans.ttf") format("truetype");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: block;
}

:root {
  --font: "Instrument Sans", system-ui, sans-serif;

  --t-press: 170ms;
  --t-hover: 210ms;
  --t-fade: 200ms;
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-move: cubic-bezier(0.76, 0, 0.24, 1);
  --entrance: 2;

  --radius-field: 10px;
  --radius-panel: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --space-9: 120px;

  --gutter: clamp(20px, 5vw, 56px);
  --column: 1120px;
  --bar: 96px;
}

:root[data-theme="dark"] {
  --bg: #1a1614;
  --surface: #241e28;
  --surface-2: #2e2636;
  --ink: #f5f1e8;
  --ink-2: #c9c4b8;
  --ink-3: #99948a;
  --line: rgb(245 241 232 / 0.14);
  --accent: #6a1b9a;
  --accent-hover: #7d24b0;
  --on-accent: #f5f1e8;
  --tint: rgb(245 241 232 / 0.1);
  --glow: rgb(245 241 232 / 0.22);
  --bar-bg: rgb(26 22 20 / 0.72);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f1e8;
  --surface: #fbf9f4;
  --surface-2: #ece6d8;
  --ink: #1a1614;
  --ink-2: #4a433b;
  --ink-3: #6a6258;
  --line: rgb(26 22 20 / 0.14);
  --accent: #6a1b9a;
  --accent-hover: #7d24b0;
  --on-accent: #f5f1e8;
  --tint: rgb(26 22 20 / 0.08);
  --glow: rgb(245 241 232 / 0.22);
  --bar-bg: rgb(245 241 232 / 0.72);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  font-synthesis: none;
  overflow-x: clip;
  scroll-behavior: smooth;
  scroll-padding-top: var(--bar);
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-fade) var(--ease-out), color var(--t-fade) var(--ease-out);
}

h1,
h2,
p,
ol {
  margin: 0;
}

[hidden] {
  display: none !important;
}

ol {
  padding: 0;
  list-style: none;
}

/* ---------- Brand marks: the real files, drawn in one color through a mask ---------- */

.mark {
  display: block;
  background-color: var(--ink);
  -webkit-mask: var(--src) no-repeat left center / contain;
  mask: var(--src) no-repeat left center / contain;
  transition: background-color var(--t-fade) var(--ease-out);
}

.wordmark {
  --src: url("brand/jd-wordmark.svg");
  width: 168px;
  aspect-ratio: 444.69 / 96.62;
}

.heart {
  --src: url("brand/jd-heart-white.svg");
  width: 17px;
  height: 32px;
  flex: none;
}

/* ---------- Bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--bar);
  padding: 0 var(--gutter);
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
  transition: background-color var(--t-fade) var(--ease-out);
}

.bar .wordmark {
  flex: none;
}

/* ---------- Switch ---------- */

.switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 9999px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.switch-option {
  min-height: 36px;
  padding: 0 var(--space-4);
  border: 0;
  border-radius: 9999px;
  background-color: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--t-hover) var(--ease-out), color var(--t-fade) var(--ease-out);
}

.switch-option[aria-pressed="true"] {
  background-color: var(--surface-2);
  color: var(--ink);
}

/* ---------- Pills ---------- */

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-6);
  border: 0;
  border-radius: 9999px;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) var(--ease-out),
    color var(--t-fade) var(--ease-out), opacity var(--t-fade) var(--ease-out);
}

.pill-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.pill-secondary {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.pill-small {
  min-height: 36px;
  padding: 0 var(--space-4);
  font-size: 14px;
}

.pill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 70%);
  opacity: 0;
  transition: opacity var(--t-hover) var(--ease-out);
}

.pill[aria-disabled="true"] {
  cursor: default;
  opacity: 0.55;
}

.pill:active:not([aria-disabled="true"]) {
  transform: scale(0.98);
}

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

/* Keyboard focus wears a quiet wash inside the shape; nothing draws a ring. */
a:focus-visible,
button:focus-visible,
input:focus-visible + .box {
  outline: none;
}

.pill:focus-visible,
.switch-option:focus-visible,
.choice:focus-visible {
  background-image: linear-gradient(var(--tint), var(--tint));
}

.pill-primary:focus-visible {
  background-color: var(--accent-hover);
}

.wordmark:focus-visible {
  background-color: var(--ink-2);
}

@media (hover: hover) and (pointer: fine) {
  .pill:hover:not([aria-disabled="true"]) {
    transform: scale(1.03);
  }
  .pill:hover:not([aria-disabled="true"])::before {
    opacity: 1;
  }
  .pill-primary:hover:not([aria-disabled="true"]) {
    background-color: var(--accent-hover);
  }
  .switch-option:hover:not([aria-pressed="true"]),
  .choice:hover:not([aria-pressed="true"]) {
    background-color: var(--tint);
    color: var(--ink);
  }
  .wordmark:hover {
    background-color: var(--ink-2);
  }
}

/* ---------- Layout ---------- */

main {
  width: 100%;
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.footer {
  width: min(var(--column), 100% - var(--gutter) * 2);
  margin: 0 auto;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  gap: var(--space-8) var(--space-7);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: var(--space-8) 0 var(--space-9);
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-5);
}

h1 {
  font-size: clamp(44px, 9vw, 96px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.lead {
  max-width: 34ch;
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.4;
  color: var(--ink-2);
  text-wrap: pretty;
}

.sequence {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 44ch;
  counter-reset: step;
  padding-top: var(--space-2);
}

.sequence li {
  position: relative;
  padding-left: var(--space-7);
  color: var(--ink-2);
  counter-increment: step;
  text-wrap: pretty;
}

.sequence li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.hero-text .pill {
  margin-top: var(--space-3);
}

.device-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  width: 380px;
  max-width: 100%;
  margin: 0;
  will-change: transform;
}

.device-caption {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.device-caption img {
  flex: none;
  border-radius: 6px;
}

.device {
  position: relative;
  width: 380px;
  max-width: 100%;
  aspect-ratio: 380 / 337;
  border-radius: var(--radius-panel);
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
}

.shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

:root[data-theme="dark"] .shot-light,
:root[data-theme="light"] .shot-dark {
  visibility: hidden;
}

/* ---------- Install ---------- */

.install-section {
  display: grid;
  gap: var(--space-7);
  grid-template-columns: minmax(0, 1fr);
  padding: 0 0 var(--space-9);
}

.install-intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
}

h2 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.install-intro p {
  max-width: 34ch;
  color: var(--ink-2);
  text-wrap: pretty;
}

.install {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.label {
  margin-bottom: var(--space-3);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.choice {
  min-height: 44px;
  padding: 0 var(--space-5);
  border: 0;
  border-radius: 9999px;
  background-color: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--t-hover) var(--ease-out), color var(--t-fade) var(--ease-out);
}

.choice[aria-pressed="true"] {
  background-color: var(--surface-2);
  color: var(--ink);
}

/* Agreement: a soft 6 px checkbox beside a sentence. */
.agree {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 52ch;
  color: var(--ink);
  cursor: pointer;
}

.agree input {
  position: absolute;
  opacity: 0;
  width: 24px;
  height: 24px;
  margin: 0;
  cursor: pointer;
}

.box {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px var(--ink-3);
  color: var(--on-accent);
  transition: background-color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out);
}

.box svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--t-fade) var(--ease-out), transform var(--t-press) var(--ease-out);
}

.agree input:checked + .box {
  background-color: var(--accent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.agree input:checked + .box svg {
  opacity: 1;
  transform: scale(1);
}

.agree input:focus-visible + .box {
  background-image: linear-gradient(var(--tint), var(--tint));
}

.get {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}

.hint {
  min-height: 1.55em;
  font-size: 14px;
  color: var(--ink-2);
}

/* A real sequence, so it is numbered. */
.steps {
  display: flex;
  flex-direction: column;
  counter-reset: step;
  border-top: 1px solid var(--line);
}

.steps li {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  min-height: 64px;
  padding: var(--space-4) 0 var(--space-4) var(--space-7);
  border-bottom: 1px solid var(--line);
  counter-increment: step;
  text-wrap: pretty;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: var(--space-4);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.steps .note {
  flex-basis: 100%;
  font-size: 14px;
  color: var(--ink-2);
}

.address {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 100%;
}

.address code {
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-field);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.copy {
  min-width: 72px;
}

.unavailable {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.unavailable h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.unavailable p {
  color: var(--ink-2);
  max-width: 52ch;
  text-wrap: pretty;
}

/* ---------- Intended use ---------- */

.intended {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: minmax(0, 1fr);
  padding: var(--space-8) 0 var(--space-9);
  border-top: 1px solid var(--line);
}

.intended-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 56ch;
  color: var(--ink-2);
  font-size: 19px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* ---------- Footer ---------- */

.footer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-5) var(--space-4);
  align-items: start;
  padding-top: var(--space-7);
  padding-bottom: var(--space-8);
  border-top: 1px solid var(--line);
}

.fine {
  max-width: 64ch;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.sign-off {
  grid-column: 1 / -1;
  width: 200px;
  aspect-ratio: 444.69 / 96.62;
}

/* ---------- Motion: the scene builds itself, then the page holds still ---------- */

.js [data-enter] {
  animation: enter calc(700ms * var(--entrance)) var(--ease-move) both;
  animation-delay: calc(var(--i, 0) * 90ms * var(--entrance));
}

@keyframes enter {
  from {
    opacity: 0;
    filter: blur(6px);
    transform: translate3d(0, 24px, 0);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

.js [data-reveal] {
  opacity: 0;
  filter: blur(6px);
  transform: translate3d(0, 24px, 0);
  transition: opacity 700ms var(--ease-move), filter 700ms var(--ease-move), transform 700ms var(--ease-move);
}

.js [data-reveal].in {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

/* ---------- Wider screens ---------- */

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
  .device-wrap {
    justify-self: end;
  }
  .install-section {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    align-items: start;
  }
  .install-intro {
    position: sticky;
    top: calc(var(--bar) + var(--space-6));
  }
  .intended {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }
}

@media (max-width: 560px) {
  :root {
    --bar: 72px;
  }
  .wordmark {
    width: 128px;
  }
  .switch-option {
    padding: 0 var(--space-3);
  }
  .pill {
    width: 100%;
  }
  .pill-small {
    width: auto;
  }
  .get {
    align-items: stretch;
  }
}

/* The smallest phones: the wordmark stays at the brand's 96 px minimum and the switch tightens. */
@media (max-width: 380px) {
  .bar {
    gap: var(--space-3);
  }
  .wordmark {
    width: 96px;
  }
  .switch-option {
    padding: 0 var(--space-2);
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js [data-enter],
  .js [data-reveal] {
    animation: none;
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }
  .pill,
  .pill:hover:not([aria-disabled="true"]),
  .pill:active:not([aria-disabled="true"]) {
    transform: none;
  }
  .pill::before {
    display: none;
  }
  .device-wrap {
    will-change: auto;
  }
}
