/* ==========================================================================
   site.css — the page around the app screens: top bar, platform switch,
   scene layout, the settings-style Security and Help panels, footer.
   The page takes the voice of whichever app is showing: Times New Roman for
   Windows, Noto Serif for Android, Plex for numbers.
   ========================================================================== */

html[data-os="windows"] body {
  font-family: var(--f-win);
}

html[data-os="android"] body {
  font-family: var(--f-droid);
}

body {
  font-feature-settings: normal;
  font-size: 1.0625rem;
  background: var(--bg);
}

h1,
h2,
h3 {
  letter-spacing: -0.01em;
}

::selection {
  background: var(--accent);
  color: var(--accent-on);
}

html {
  scrollbar-color: var(--divider) transparent;
}

/* --- Water background (js/water.js) ------------------------------------- */
.water-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: var(--bg-deep);
}

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--hairline);
}

.topbar__in {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Full-width row so the ESL mark sits at the gutter, same as entropicsoftwarelabs.com. */
.topbar__in--full {
  max-width: none;
}

.esl-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  font-size: 17px;
  font-family: "Noto Serif", Georgia, "Times New Roman", Times, "Liberation Serif", serif;
  flex: none;
}

.esl-brand:hover {
  color: var(--text);
  text-decoration: none;
}

.esl-brand__mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: var(--accent-text);
}

.esl-brand__mark svg {
  width: 16px;
  height: 16px;
  display: block;
}

.topbar__divider {
  width: 1px;
  height: 22px;
  background: var(--hairline-strong, var(--hairline));
  flex: none;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.brand__mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.topbar__links {
  display: none;
  gap: 2px;
  margin-left: 2px;
}

.topbar__links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: color-mix(in srgb, var(--text-secondary) 70%, var(--text));
  font-size: 1rem;
  transition: color var(--dur-fast), background-color var(--dur-fast);
}

.topbar__links a:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  text-decoration: none;
}

.topbar__links a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.topbar__links a[aria-current] {
  color: var(--text);
}

.topbar__links a[aria-current]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-text);
}

.osswitch {
  margin-left: auto;
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--divider);
}

/* The sliding thumb: the same half-width outlined block as the Windows
   GlassSwitch, always green here because both choices are "on". */
.osswitch::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 8px;
  border: 1.5px solid var(--accent-text);
  background: var(--accent-muted);
  transition: transform 300ms var(--ease);
}

html[data-os="android"] .osswitch::before {
  transform: translateX(100%);
}

.osswitch button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: color var(--dur-fast);
}

.osswitch button[aria-checked="true"] {
  color: var(--accent-text);
}

.osswitch .ic {
  width: 18px;
  height: 18px;
}

.theme-toggle .ic {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

.topbar__cta {
  display: none;
}

@media (min-width: 1200px) {
  .topbar__links {
    display: flex;
  }
}

@media (min-width: 640px) {
  .topbar__cta {
    display: inline-flex;
  }
}

/* Breakpoints measured with Playwright: the row must never overflow or run into
   the right gutter. The ESL name shrinks to the icon, then the OffBridge word goes. */
@media (max-width: 419px), (min-width: 720px) and (max-width: 899px) {
  .esl-brand__rest {
    display: none;
  }
}

/* Below 730px the Windows/Android labels go (icons stay, buttons keep aria-labels). */
@media (max-width: 729px) {
  .osswitch button span {
    display: none;
  }
}

/* Download lives in the second row too, so the top row drops it below 720px. */
@media (max-width: 719px) {
  .topbar__cta {
    display: none;
  }
}

/* The OffBridge word collapses to its icon only where the full ESL name leaves no room. */
@media (max-width: 609px) {
  .brand {
    font-size: 0;
    gap: 0;
  }
}

@media (max-width: 499px) {
  .topbar__in {
    gap: 10px;
  }
  .osswitch button {
    padding: 0 10px;
  }
}

/* 420-469px: the full ESL name is back, so squeeze like the tiniest phones do. */
@media (min-width: 420px) and (max-width: 469px) {
  .topbar__in {
    gap: 6px;
  }
  .topbar__divider {
    display: none;
  }
  .osswitch button {
    padding: 0 6px;
  }
}

@media (max-width: 359px) {
  .topbar__in {
    gap: 6px;
  }
  .topbar__divider {
    display: none;
  }
  .osswitch button {
    padding: 0 6px;
  }
}

/* --- Buttons in the page voice ------------------------------------------ */
.btn {
  font-weight: 700;
  letter-spacing: 0;
  font-size: 1rem;
}

.btn .ic {
  width: 20px;
  height: 20px;
}

.btn--quiet {
  color: var(--text-secondary);
  padding: 0 12px;
}

.btn--quiet:hover {
  color: var(--text);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* --- Scenes: copy beside a live app screen ------------------------------ */
.scene {
  padding-block: clamp(3.5rem, 2.5rem + 3vw, 5.5rem);
}

.scene__grid {
  max-width: 1200px;
  display: grid;
  gap: clamp(2.5rem, 2rem + 3vw, 4.5rem);
  align-items: center;
}

.scene__copy {
  max-width: 34rem;
  min-width: 0;
}

.scene h1 {
  font-size: clamp(2.5rem, 1.4rem + 3vw, 3.6rem);
  line-height: 1.02;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.scene h2 {
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.3rem);
  line-height: 1.06;
  font-weight: 400;
  letter-spacing: -0.015em;
}

.lead {
  margin-top: 20px;
  font-size: clamp(1.1rem, 1rem + 0.35vw, 1.3rem);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 36rem;
}

/* --- Stages: each app screen is drawn at its real dp size inside a .fit
   box and scaled as a whole (js/site.js sets --k), so a narrow column
   shrinks the screen instead of squashing its layout. ------------------- */
.stage {
  display: grid;
  justify-items: center;
  min-width: 0;
}

.stage > .fit--win {
  max-width: 980px;
}

/* The phone never grows taller than the viewport under the header, so its
   bottom buttons are reachable without scrolling past the screen. */
.stage > .fit--droid {
  max-width: clamp(260px, calc((100vh - var(--nav-h) - 48px) * 0.4613), 340px);
  max-width: clamp(260px, calc((100svh - var(--nav-h) - 48px) * 0.4613), 340px);
}

/* Copy and screen sit side by side on desktop, so a demo's controls and
   the screen they drive are on screen together. The landscape window gets
   the wide column; the screen stays pinned while longer copy scrolls. */
@media (min-width: 1000px) {
  .scene__grid {
    align-items: start;
  }
  .scene__grid .stage {
    position: sticky;
    top: calc(var(--nav-h) + 24px);
  }
  html[data-os="windows"] .scene__grid {
    grid-template-columns: minmax(0, 23rem) minmax(0, 1fr);
  }
  html[data-os="windows"] .scene__grid--flip {
    grid-template-columns: minmax(0, 1fr) minmax(0, 23rem);
  }
  html[data-os="windows"] .scene__grid--flip .stage {
    order: -1;
  }
  html[data-os="windows"] .scene h2 {
    font-size: clamp(2rem, 1.2rem + 1.4vw, 2.6rem);
  }
  html[data-os="android"] .scene__grid {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  html[data-os="android"] .scene__grid--flip {
    grid-template-columns: 340px minmax(0, 1fr);
  }
  html[data-os="android"] .scene__grid--flip .stage {
    order: -1;
  }
  html[data-os="android"] .scene__grid--flip .scene__copy {
    justify-self: end;
  }
}

/* --- Hero: the headline, then the desk with both devices ----------------- */
.scene--hero {
  padding-top: clamp(2rem, 1rem + 3vw, 4rem);
  padding-bottom: clamp(3rem, 2rem + 4vw, 6rem);
}

.hero {
  max-width: var(--container-wide);
}

.hero__copy {
  display: grid;
  gap: 28px clamp(2.5rem, 1rem + 4vw, 6rem);
  align-items: start;
}

.scene--hero h1 {
  font-size: clamp(2.75rem, 1.4rem + 4vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.025em;
}

.hero__side .lead {
  margin-top: 0;
}

.hero__main .scene__cta {
  margin-top: 32px;
}

@media (min-width: 1000px) {
  .hero__copy {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  }
  .hero__side {
    padding-top: 10px;
  }
}

/* The try-it line sits between the headline and the desk, ruled off like
   a caption, so the instruction is right above the screens it drives. */
.trycopy {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
}

.trycopy .snips {
  margin-top: 0;
}

.trycopy__note {
  flex-basis: 100%;
}

.trycopy__how {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.5;
}

.trycopy__note {
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--text-tertiary);
  max-width: 34rem;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px 2px;
  border: 1px solid var(--divider);
  border-bottom-width: 2px;
  border-radius: 6px;
  font: 600 0.82em/1.3 var(--f-num);
  text-align: center;
  color: var(--text);
  background: var(--bg);
}

.show-touch {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .show-touch {
    display: inline;
  }
  .hide-touch {
    display: none;
  }
}

.snips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* A snippet reads as quoted text you can lift, not as a button. */
.snip {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: none;
  border: 0;
  padding: 2px 2px 3px;
  cursor: copy;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent-text) 55%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  transition: color var(--dur-fast), text-decoration-color var(--dur-fast);
}

.snip::before {
  content: "\201C";
  color: var(--text-tertiary);
}

.snip::after {
  content: "\201D";
  color: var(--text-tertiary);
}

.snip:hover,
.snip:focus-visible {
  color: var(--accent-text);
  text-decoration-color: currentColor;
}

.snip.is-copied {
  color: var(--accent-text);
}

/* Window and phone stand side by side, never overlapping. Columns are
   sized so the phone is a little taller than the window: window 880x560,
   phone 393x852, so the desk is ~0.51 as tall as it is wide. */
.desk {
  --desk-phone: 24%;
  position: relative;
  margin-top: clamp(4rem, 2.5rem + 3vw, 5.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--desk-phone);
  column-gap: 4%;
  align-items: center;
}

.desk > .fit {
  transition: filter 400ms var(--ease);
}

.desk > .fit > .frame {
  transition: box-shadow 400ms var(--ease);
}

html[data-os="windows"] .desk__phone,
html[data-os="android"] .desk__win {
  filter: brightness(0.8) saturate(0.9);
}

[data-theme="light"] .desk > .fit {
  filter: none;
}

/* Push to PC belongs to the phone: it hangs centred under it, outside both
   devices, so it never sits on the window. */
.pushpc {
  position: absolute;
  z-index: 3;
  top: calc(100% + 16px);
  right: calc(var(--desk-phone) / 2);
  transform: translateX(50%);
  white-space: nowrap;
}

@media (max-width: 759px) {
  .desk {
    --desk-phone: 30%;
    column-gap: 3%;
  }
  .pushpc {
    top: calc(100% + 12px);
    right: 0;
    transform: none;
  }
}

/* The copy in flight. It leaves as plain text, travels sealed, and opens
   on arrival (js/site.js swaps the letters). */
.packet {
  position: fixed;
  z-index: 50;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 300px;
  padding: 8px 14px 8px 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--divider);
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: background-color 200ms, border-color 200ms, color 200ms;
}

.packet span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.packet .ic {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--text-tertiary);
  transition: color 200ms;
}

.packet.is-sealed {
  background: color-mix(in srgb, var(--accent) 16%, var(--card));
  border-color: color-mix(in srgb, var(--accent-text) 60%, transparent);
}

.packet.is-sealed span {
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
  color: var(--accent-text);
  letter-spacing: 0.02em;
}

.packet.is-sealed .ic {
  color: var(--accent-text);
}

.scene__cta {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.scene__meta {
  font-size: 0.95rem;
  color: var(--text-tertiary);
}


/* --- Demo controls ------------------------------------------------------ */
.demo-ctl {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 28px;
}

/* The Send demo's main control: big enough to be the obvious thing to try.
   It pulses while the transfer is moving, which is the moment to press it. */
.dropwifi {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  width: 22rem;
  max-width: 100%;
  min-height: 64px;
  padding: 10px 26px 10px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-on);
  text-align: left;
  box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--accent) 80%, black);
  transition: transform var(--dur-fast) var(--ease), background-color 300ms var(--ease-std),
    box-shadow 300ms var(--ease-std);
  -webkit-tap-highlight-color: transparent;
}
.dropwifi:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--accent) 90%, black);
}
.dropwifi:active {
  transform: scale(var(--press));
}
.dropwifi:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
.dropwifi__ic {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-on) 14%, transparent);
}
.dropwifi__ic .ic {
  width: 24px;
  height: 24px;
}
.dropwifi__txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}
.dropwifi__txt b {
  font-size: 1.12rem;
  font-weight: 700;
}
.dropwifi__txt small {
  font-size: 0.82rem;
  opacity: 0.8;
}
.dropwifi[data-phase="run"]::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--accent);
  animation: dropwifi-ring 1.2s var(--ease-std) infinite;
  pointer-events: none;
}
.dropwifi[data-phase="paused"] {
  background: var(--card);
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--a-errtext);
}
.dropwifi[data-phase="paused"] .dropwifi__ic {
  background: color-mix(in srgb, var(--a-errtext) 14%, transparent);
  color: var(--a-errtext);
}
@keyframes dropwifi-ring {
  from {
    opacity: 0.9;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.12, 1.35);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dropwifi[data-phase="run"]::after {
    animation: none;
    opacity: 0.6;
  }
}

.demo-hint {
  margin-top: 12px;
  font-size: 0.98rem;
  color: var(--text-secondary);
}

.demo-hint b {
  color: var(--text);
}

.facts {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 10px;
  color: var(--text-secondary);
}

.facts b {
  color: var(--text);
  font-weight: 700;
}

.ladder {
  list-style: none;
  margin-top: 28px;
  counter-reset: rung;
  display: grid;
  gap: 0;
}

.ladder li {
  counter-increment: rung;
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}

.ladder li::before {
  content: counter(rung);
  grid-row: span 2;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-muted);
  color: var(--accent-text);
  font: 600 14px/1 var(--f-num);
}

.ladder b {
  font-weight: 700;
}

.ladder span {
  color: var(--text-secondary);
}

/* --- Pairing: the other device's code ----------------------------------- */
.peer {
  margin-top: 28px;
  padding: 20px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1px solid var(--hairline);
}

.peer__label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.peer__label .ic {
  width: 20px;
  height: 20px;
  color: var(--accent-text);
}

.sas--page {
  justify-content: flex-start;
  margin: 14px 0;
}

.sas--page b {
  border-color: var(--accent);
  color: var(--text);
  width: 40px;
  height: 52px;
}

.peer__note {
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.peer__note b {
  color: var(--text);
}

.peer.is-match .sas--page b {
  background: var(--accent-muted);
}

/* Pairing steps: the current one is lit, finished ones get a tick. */
.peer__steps {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.peer__steps li {
  position: relative;
  padding: 8px 12px 8px 40px;
  border-radius: 10px;
  color: var(--text-tertiary);
  transition: color 300ms var(--ease-std), background-color 300ms var(--ease-std);
}
.peer__steps li::before {
  content: attr(data-n);
  position: absolute;
  left: 10px;
  top: 8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font: 600 0.75rem/1 var(--f-num);
}
.peer__steps b {
  color: inherit;
}
.peer__arrow {
  display: inline-block;
  margin-left: 4px;
  color: var(--accent-text);
}
.peer[data-step="1"] li[data-n="1"],
.peer[data-step="2"] li[data-n="2"],
.peer[data-step="3"] li[data-n="3"] {
  color: var(--text);
  background: var(--accent-muted);
}
.peer[data-step="1"] li[data-n="1"]::before,
.peer[data-step="2"] li[data-n="2"]::before,
.peer[data-step="3"] li[data-n="3"]::before {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.peer[data-step="1"] .peer__arrow {
  animation: peer-arrow 1.1s var(--ease-std) infinite alternate;
}
.peer[data-step="2"] li[data-n="1"]::before,
.peer[data-step="3"] li[data-n="1"]::before,
.peer[data-step="3"] li[data-n="2"]::before {
  content: "\2713";
  color: var(--accent-text);
}

/* Short desktop screens: the pairing card tightens so the Accept button stays on screen. */
@media (max-height: 820px) {
  html.is-segmented .peer {
    margin-top: 16px;
    padding: 14px 16px;
  }
  html.is-segmented .sas--page {
    margin: 10px 0;
  }
  html.is-segmented .sas--page b {
    height: 42px;
    width: 36px;
  }
  html.is-segmented .peer__steps {
    gap: 2px;
    margin-bottom: 10px;
    font-size: 0.95rem;
  }
  html.is-segmented .peer__steps li {
    padding: 4px 10px 4px 38px;
    line-height: 1.4;
  }
  html.is-segmented .peer__steps li::before {
    top: 5px;
  }
}
@keyframes peer-arrow {
  to {
    transform: translateX(6px);
  }
}

/* The control a demo wants pressed next pulses. Used inside the app
   screens too, where the frame's scale shrinks the ring with it. */
.nudge {
  position: relative;
  animation: nudge 1.6s var(--ease-std) infinite;
}
@keyframes nudge {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 65%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent);
  }
}
/* "Press Pair" tag above the window's Pair button. */
.pairbtn.nudge::after {
  content: "Press Pair";
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--a-green);
  color: var(--a-onp);
  font: 600 13px/1.2 var(--f-num);
  white-space: nowrap;
  pointer-events: none;
  animation: nudge-tag 1.1s var(--ease-std) infinite alternate;
}
.pairbtn.nudge::before {
  content: "";
  position: absolute;
  right: 28px;
  bottom: calc(100% + 6px);
  border: 6px solid transparent;
  border-top-color: var(--a-green);
  border-bottom: 0;
  pointer-events: none;
  animation: nudge-tag 1.1s var(--ease-std) infinite alternate;
}
@keyframes nudge-tag {
  to {
    transform: translateY(-4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .nudge,
  .pairbtn.nudge::after,
  .pairbtn.nudge::before,
  .peer[data-step="1"] .peer__arrow {
    animation: none;
  }
  .nudge {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent);
  }
}

/* The apps draw this dialog dark in every theme; on the light page it
   reads as a hole, so here it follows the page. */
[data-theme="light"] .pair-modal {
  --a-text: #0f172a;
  --a-text2: #475569;
  background: rgba(15, 23, 42, 0.32);
}
[data-theme="light"] .pair-card {
  background: var(--a-card);
  color: var(--a-text);
  border-color: var(--a-div);
  box-shadow: 0 24px 48px -20px rgba(15, 23, 42, 0.35);
}
[data-theme="light"] .pair-card .pair-title,
[data-theme="light"] .pair-card .sas b,
[data-theme="light"] .pair-card > .ic {
  color: var(--a-text);
}
[data-theme="light"] .pair-card .pair-note {
  color: var(--a-text2);
}

/* --- Security + Help: the app's settings screen, page-sized ------------- */
.settings-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.settings-head .ic {
  width: 40px;
  height: 40px;
  color: var(--accent);
}

.settings-lead {
  margin-bottom: 36px;
}

.settings {
  display: grid;
  gap: 24px;
}

.settings .sgroup + .sgroup {
  margin-top: 0;
}

@media (min-width: 900px) {
  .settings {
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 28px 32px;
  }
}

.sgroup h3,
.sgroup__card {
  font-family: inherit;
}

.sgroup h3 {
  color: var(--accent-text);
}

.sgroup__card {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border-color: var(--hairline);
}

.srow + .srow {
  border-top: 1px solid var(--divider);
}

.srow summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 12px 18px;
  cursor: pointer;
}

.srow summary::-webkit-details-marker {
  display: none;
}

.srow summary:hover {
  background: color-mix(in srgb, var(--text) 4%, transparent);
}

.srow summary:focus-visible {
  outline-offset: -2px;
}

.srow__t {
  flex: 1;
  font-size: 1.08rem;
}

/* Value pill, as on the Windows Settings rows ("System Default") */
.srow__v {
  flex: none;
  font: 500 13px/1 var(--f-num);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  color: var(--accent-text);
  white-space: nowrap;
}

.srow__chev {
  width: 22px;
  height: 22px;
  color: var(--text-tertiary);
  transition: transform var(--dur-med) var(--ease);
}

.srow[open] .srow__chev {
  transform: rotate(180deg);
}

.srow > p {
  padding: 0 18px 16px;
  color: var(--text-secondary);
  max-width: 68ch;
}

.srow > p + p {
  padding-top: 0;
}

/* Android renders its settings as plain list rows: subtitle under the title,
   no value pill border, rounder 20dp groups (the power menu's look). */
html[data-os="android"] .sgroup__card {
  border-radius: 20px;
}

html[data-os="android"] .srow summary {
  flex-wrap: wrap;
  row-gap: 2px;
}

html[data-os="android"] .srow__v {
  order: 3;
  flex-basis: 100%;
  border: 0;
  padding: 0;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.95rem;
}

html[data-os="android"] .srow__chev {
  order: 2;
}

@media (max-width: 520px) {
  .srow summary {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .srow__v {
    order: 3;
    flex-basis: 100%;
    border: 0;
    padding: 0;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.95rem;
  }
  .srow__chev {
    order: 2;
  }
}

/* Security as a route: phone, four numbered steps, computer. A lock packet
   runs the wire and each step's marker lights as it passes (8s loop, steps
   offset by --k). Under 1000px the route turns vertical and the packet is
   dropped. A band below lists what the app doesn't have. */
.sec__head {
  max-width: 46rem;
  margin-bottom: 40px;
}
.sec__head .lead {
  margin: 16px 0 0;
}

.sec__track {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
}
.sec__dev {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 84px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}
.sec__devic {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--hairline-strong);
  color: var(--text);
}
.sec__devic .ic {
  width: 22px;
  height: 22px;
}
.sec__flow {
  position: relative;
}

.sec__wire {
  position: absolute;
  top: 21px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--hairline-strong);
  z-index: 0;
}
.sec__wire::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: left;
  animation: sec-fill 8s linear infinite;
}
.sec__packet {
  position: absolute;
  top: 50%;
  left: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent);
  transform: translate(-50%, -50%);
  z-index: 2;
  animation: sec-travel 8s linear infinite;
}
.sec__packet .ic {
  width: 15px;
  height: 15px;
}
@keyframes sec-fill {
  0% {
    transform: scaleX(0);
    opacity: 1;
  }
  75% {
    transform: scaleX(1);
    opacity: 1;
  }
  90%,
  100% {
    transform: scaleX(1);
    opacity: 0;
  }
}
@keyframes sec-travel {
  0% {
    left: 0;
    opacity: 0;
  }
  4% {
    opacity: 1;
  }
  75% {
    left: 100%;
    opacity: 1;
  }
  85%,
  100% {
    left: 100%;
    opacity: 0;
  }
}

.sec__steps {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: clamp(14px, 1.6vw, 28px);
  margin: 0;
  padding: 0 14px;
  list-style: none;
}
.sec__step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.sec__n {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  border-radius: 50%;
  font: 600 1rem/1 var(--f-num);
  font-variant-numeric: tabular-nums;
  background: var(--card);
  color: var(--text-secondary);
  box-shadow: 0 0 0 1px var(--hairline-strong);
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: outline-color 200ms var(--ease-std);
  animation: sec-hit 8s linear infinite;
  animation-delay: calc(0.75s + var(--k) * 1.5s);
}
@keyframes sec-hit {
  0% {
    background: var(--accent);
    color: var(--accent-on);
    transform: scale(1.14);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent);
  }
  20%,
  100% {
    background: var(--card);
    color: var(--text-secondary);
    transform: scale(1);
    box-shadow: 0 0 0 1px var(--hairline-strong);
  }
}
.sec__step:hover .sec__n,
.sec__step:focus-within .sec__n {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.sec__step h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.sec__step .sec__v {
  margin: 6px 0 12px;
  font-size: clamp(1.35rem, 0.9rem + 1vw, 1.9rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
}
.sec__step p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.sec__step .sec__more {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
  font-size: 0.88rem;
  color: var(--text-tertiary);
}

.sec__none {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: clamp(32px, 4vw, 52px);
  padding-top: 22px;
  border-top: 1px solid var(--divider);
}
.sec__none-h {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.sec__none ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sec__none li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline-strong);
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text) 35%, transparent);
}
.sec__none li .ic {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}
.sec__note {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-tertiary);
}

@media (max-width: 999px) {
  .sec__track {
    display: block;
  }
  .sec__dev {
    flex-direction: row;
    width: auto;
    gap: 12px;
    margin: 8px 0;
    text-align: left;
  }
  .sec__wire {
    top: 0;
    bottom: 0;
    left: 21px;
    right: auto;
    width: 2px;
    height: auto;
  }
  .sec__wire::after {
    display: none;
  }
  .sec__packet {
    display: none;
  }
  .sec__steps {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
    padding: 12px 0;
  }
  .sec__step {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 16px;
    align-items: start;
  }
  .sec__step > * {
    grid-column: 2;
  }
  .sec__step > .sec__n {
    grid-column: 1;
    grid-row: 1 / span 5;
    margin: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sec__packet {
    display: none;
  }
  .sec__wire::after,
  .sec__n {
    animation: none;
  }
}

.scene--help .settings-head {
  margin-bottom: 28px;
}

.helplist .srow summary {
  min-height: 64px;
}

/* --- Footer ------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--hairline);
  padding: 32px 0 40px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.footer__links a {
  color: var(--text-secondary);
}

.footer__note {
  width: 100%;
  color: var(--text-tertiary);
  font-size: 0.95rem;
}

/* --- Switching platform: the window becomes the phone ------------------- */
::view-transition-group(*) {
  animation-duration: 560ms;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: 320ms;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 260ms;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
  .desk > .fit,
  .desk > .fit > .frame,
  .osswitch::before {
    transition: none;
  }
}

/* Neutral elevation instead of a green halo */
.btn--primary,
.btn--primary:hover {
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] .dl-card.is-highlight {
  box-shadow: 0 0 0 1px var(--accent) inset, 0 22px 50px -24px rgba(15, 23, 42, 0.18);
}

.nobr {
  white-space: nowrap;
}

/* Below the desktop nav breakpoint the section links ride in a second,
   scrollable row so phones keep navigation and a Download link. */
.topbar__sub {
  border-top: 1px solid var(--hairline);
}

.topbar__subin {
  display: flex;
  gap: clamp(12px, 3vw, 20px);
  height: 40px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.topbar__subin::-webkit-scrollbar {
  display: none;
}

.topbar__subin a {
  color: color-mix(in srgb, var(--text-secondary) 70%, var(--text));
  font-size: clamp(.85rem, .8rem + .3vw, .95rem);
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.topbar__subin a:hover {
  color: var(--text);
}

.topbar__subin a[aria-current] {
  color: var(--text);
  text-decoration-line: underline;
  text-decoration-color: var(--accent-text);
}

.topbar__subin a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 4px;
}

.topbar__subin a[href="#download"] {
  color: var(--accent-text);
  font-weight: 700;
}

@media (max-width: 1199px) {
  html {
    scroll-padding-top: calc(var(--nav-h) + 56px);
  }
}

@media (min-width: 1200px) {
  .topbar__sub {
    display: none;
  }
}

/* --- Segmented scrolling (desktop, js/segments.js) ----------------------- */
/* Each scene fills at least one screen, so a settled segment never shows the
   next one's top edge. */
html.is-segmented main .scene {
  min-height: calc(100vh - var(--nav-h) - 16px);
  min-height: calc(100svh - var(--nav-h) - 16px);
}

.seg-pull {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 12px;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.seg-pull.is-up {
  bottom: auto;
  top: calc(var(--nav-h) + 16px);
  transform: translate(-50%, -12px);
}
.seg-pull.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.seg-pull__track {
  width: 160px;
  height: 3px;
  border-radius: 999px;
  background: var(--divider);
  overflow: hidden;
}
.seg-pull__fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.08s linear;
}
@media (prefers-reduced-motion: reduce) {
  .seg-pull,
  .seg-pull__fill {
    transition: none;
  }
}

/* --- One screen per segment (desktop) ---------------------------------
   Sections drop the long-scroll padding and centre in their screen. */
html.is-segmented main .scene {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(1.25rem, 0.5rem + 2vh, 2.5rem);
}

/* Hero: copy on the left, the desk on the right, sized by the screen's
   height so both devices stay fully in view. */
html.is-segmented .hero {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 25rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 0.5rem + 2.5vw, 3rem);
  align-items: center;
}
html.is-segmented .hero__copy {
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}
html.is-segmented .scene--hero h1 {
  font-size: clamp(2.4rem, 1.1rem + 2.6vw, 3.6rem);
}
html.is-segmented .hero__main .scene__cta {
  margin-top: 22px;
}
html.is-segmented .hero__side {
  padding-top: 0;
}
html.is-segmented .hero__side .lead {
  font-size: 1.05rem;
}
html.is-segmented .trycopy {
  margin-top: 14px;
  padding-top: 12px;
}
html.is-segmented .desk {
  width: 100%;
  margin: 0;
  justify-self: end;
  /* the phone column sets the height: ~0.51 of the desk width */
  max-width: calc((100vh - var(--nav-h) - 16px - 5rem) / 0.51);
  max-width: calc((100svh - var(--nav-h) - 16px - 5rem) / 0.51);
}

/* --- Story: Send, Pair, Off-grid around one pinned stage (desktop) -------
   js/segments.js moves the three scenes into .story and their app screens
   into one sticky pane; the screen for the scene in view is the one shown. */
html.is-segmented .story {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
  gap: clamp(2.5rem, 2rem + 3vw, 4.5rem);
}
html.is-segmented[data-os="android"] .story {
  grid-template-columns: minmax(0, 1fr) 340px;
}
html.is-segmented .story__copy {
  min-width: 0;
}
html.is-segmented .story .scene__grid {
  display: block;
  width: 100%;
  max-width: none;
  padding-inline: 0;
}
html.is-segmented .story .scene__copy {
  justify-self: start;
}
html.is-segmented .story__stage {
  position: relative;
  min-width: 0;
}
html.is-segmented .story__pin {
  position: sticky;
  overflow-anchor: none;
  top: calc(var(--nav-h) + 16px);
  height: calc(100vh - var(--nav-h) - 32px);
  height: calc(100svh - var(--nav-h) - 32px);
  display: grid;
  align-items: center;
}
html.is-segmented .story__pin > .stage {
  grid-area: 1 / 1;
  width: 100%;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
html.is-segmented .story__pin > .stage.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
/* The window is sized by the pane's height too, so it is always fully in view. */
html.is-segmented .story__pin > .stage > .fit--win {
  width: 100%;
  max-width: min(980px, calc((100vh - var(--nav-h) - 48px) * 1.4667));
  max-width: min(980px, calc((100svh - var(--nav-h) - 48px) * 1.4667));
}

/* --- Rail: chapters orbiting an invisible half ring (desktop) ---------
   Nothing round is drawn. The ring's centre sits off the left edge and
   each section's number and name ride its right half, --step apart.
   js/segments.js sets --at and the ring turns until the section in view
   reaches 3 o'clock, nearest the page, where it is shaded and largest.
   --d is each row's distance in steps from there. */
.seg-rail {
  --orbit: 200px;
  --step: 22deg;
  position: fixed;
  left: -60px;
  top: 50%;
  z-index: 30;
  width: 0;
  height: 0;
}
.seg-rail ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Each row sits at its own angle minus the ring's turn, then turns back by
   the same amount so it reads level. */
.seg-rail li {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform: rotate(calc((var(--i) - var(--at, 0)) * var(--step))) translateX(var(--orbit))
    rotate(calc((var(--at, 0) - var(--i)) * var(--step)));
  opacity: clamp(0, min(1.15 - var(--d, 0) * 0.2, 4 - var(--d, 0)), 1);
  transition: transform 800ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 500ms var(--ease-std);
}
.seg-rail a {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  transform: translate(-14px, -50%) scale(calc(1 - min(var(--d, 0), 3) * 0.08));
  transform-origin: 14px 50%;
  transition: color 280ms var(--ease-std), background-color 360ms var(--ease-std),
    box-shadow 360ms var(--ease-std), font-size 360ms var(--ease), padding 360ms var(--ease),
    transform 800ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.seg-rail a:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.seg-rail a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.seg-rail__n {
  font: 500 1.1rem/1 var(--f-num);
  font-variant-numeric: tabular-nums;
  transition: font-size 360ms var(--ease), color 280ms var(--ease-std);
}
.seg-rail__t {
  transition: font-weight 200ms var(--ease-std);
}
.seg-rail a[aria-current] {
  padding: 12px 18px;
  font-size: 1.15rem;
  color: var(--text);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 0 0 1px var(--hairline-strong), 0 14px 30px -18px rgba(0, 0, 0, 0.55);
}
.seg-rail a[aria-current] .seg-rail__n {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-text);
}
.seg-rail a[aria-current] .seg-rail__t {
  font-weight: 600;
}
/* Keep page content clear of the rail where the side margins are thin. */
@media (max-width: 1879px) {
  html.is-segmented main {
    padding-left: 300px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html.is-segmented .story__pin > .stage,
  .seg-rail li,
  .seg-rail a {
    transition: none;
  }
}
