/* Switch to Copeel — what the page adds to discover.css: the hero's import
   picture, the table side by side, the three steps for each app
   and the questions. Same tokens, same motion hooks ([data-reveal]). */

.switch .d-title + .s-intro,
.s-intro {
  max-width: 46ch;
  margin: 20px auto 0;
  color: var(--ink-secondary);
  font-size: var(--text-lead);
  line-height: 1.4;
  letter-spacing: -0.012em;
  text-align: center;
  text-wrap: pretty;
}

.switch .d-heading .d-title {
  max-width: 18ch;
}

/* The segmented control of iOS, for the table's rival and the steps' app. */
/* Equal segments, each as wide as the longest name, as in iOS: a grid
   of 1fr columns in a box as wide as its content. */
.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 3px;
  border-radius: 999px;
  background: var(--fill);
}

.segmented button {
  min-width: 0;
  text-align: center;
  padding: 9px 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.25s var(--ease-apple),
    box-shadow 0.25s var(--ease-apple);
}

.segmented button[aria-selected="true"] {
  background: var(--bg);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.08),
    0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

.segmented button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

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

.s-hero {
  padding-bottom: clamp(24px, 4vw, 48px);
}

.s-hero::before {
  inset: 0;
}

.s-hero::after {
  display: none;
}

.s-hero-link {
  margin: 20px 0 0;
  font-size: 17px;
}

.s-hero-link a,
.how-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-ink);
  font-weight: 500;
  text-decoration: none;
}

.s-hero-link a:hover,
.how-more:hover {
  text-decoration: underline;
}

.s-hero-link svg,
.how-more svg {
  width: 14px;
  height: 14px;
}

.s-hero-flow {
  max-width: 1040px;
  margin: clamp(48px, 7vw, 80px) auto 0;
}

/* The three apps flow into Copeel, and what they held comes out. On phones
   it runs downwards; from 860 px, across. */
.flow {
  display: grid;
  justify-items: center;
}

.flow-sources,
.flow-kept {
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-sources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 420px;
}

.flow-source {
  padding: 16px 10px;
  border-radius: 18px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-align: center;
  animation: rise 0.8s var(--ease-apple) both;
  animation-delay: calc(0.6s + var(--i) * 0.12s);
}

.flow-wires {
  width: 100%;
  max-width: 300px;
  height: 64px;
}

.flow-wires.flow-out {
  height: 36px;
}

.flow-wires svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.wires-h {
  display: none !important;
}

.wire {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 14 10;
  opacity: 0.55;
  animation: wire-flow 1.4s linear infinite;
}

/* Drawn from Copeel outwards: running backwards, towards it. */
.wire-in {
  animation-name: wire-flow-in;
}

@keyframes wire-flow {
  to {
    stroke-dashoffset: -24;
  }
}

@keyframes wire-flow-in {
  to {
    stroke-dashoffset: 24;
  }
}

.flow-app {
  position: relative;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: 26px;
  background: var(--bg);
  box-shadow:
    0 18px 44px rgba(0, 122, 255, 0.22),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  animation: rise 0.8s var(--ease-apple) both;
  animation-delay: 1s;
}

.flow-app::before {
  content: "";
  position: absolute;
  inset: -10px;
  z-index: -1;
  border-radius: 34px;
  border: 2px solid rgba(0, 122, 255, 0.25);
  animation: app-pulse 2.8s var(--ease-apple) infinite;
  animation-delay: 1.6s;
  opacity: 0;
}

@keyframes app-pulse {
  0% {
    opacity: 0.9;
    scale: 0.92;
  }
  100% {
    opacity: 0;
    scale: 1.25;
  }
}

.flow-app img {
  width: 46px;
  height: auto;
}

.flow-kept {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 420px;
}

.flow-kept li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px 9px 10px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: var(--shadow-card);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  animation: rise 0.7s var(--ease-apple) both;
  animation-delay: calc(1.4s + var(--i) * 0.1s);
}

.flow-kept i {
  display: block;
  width: 18px;
  height: 18px;
  color: var(--green);
}

.flow-kept svg {
  display: block;
  width: 100%;
  height: 100%;
}

@media (min-width: 860px) {
  .flow {
    grid-template-columns: 200px 1fr 112px 64px 220px;
    align-items: center;
  }

  .flow-sources {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: start;
  }

  .flow-source {
    padding: 22px 20px;
    font-size: 18px;
  }

  .flow-wires,
  .flow-wires.flow-out {
    max-width: none;
    height: 240px;
  }

  .flow-wires.flow-out {
    height: 120px;
  }

  .wires-h {
    display: block !important;
  }

  .wires-v {
    display: none !important;
  }

  .flow-kept {
    flex-direction: column;
    align-items: flex-start;
    justify-self: start;
  }
}

/* Side by side ------------------------------------------------------------- */

.s-compare,
.s-how,
.s-faq {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(96px, 14vw, 160px) 20px 0;
}

.compare {
  max-width: 1000px;
  margin: clamp(40px, 6vw, 64px) auto 0;
}

.compare-picker {
  margin-bottom: 20px;
}

.compare-card {
  padding: 12px clamp(12px, 3vw, 32px) 20px;
  border-radius: 32px;
  background: var(--bg-alt);
}

.compare table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.compare thead th {
  padding: 22px 8px 18px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-align: center;
}

.compare thead th span {
  display: inline-block;
}

.compare .c-col {
  width: 13%;
  text-align: center;
}

/* Copeel's column is lifted out, a white band from the top to the bottom. */
.compare .c-copeel {
  background: var(--bg);
}

.compare thead .c-copeel {
  border-radius: 20px 20px 0 0;
  color: var(--brand-ink);
}

.compare tbody tr:last-child .c-copeel {
  border-radius: 0 0 20px 20px;
}

.compare tbody th,
.compare tbody td {
  padding: 18px 8px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.compare tbody td.c-copeel {
  border-top-color: rgba(0, 0, 0, 0.05);
}

.compare tbody th {
  padding-inline: 4px 16px;
  text-align: start;
  font-weight: 400;
}

.c-feature {
  display: block;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.c-note {
  display: block;
  margin-top: 3px;
  color: var(--ink-secondary);
  font-size: 14px;
  line-height: 1.35;
}

.c-mark {
  display: inline-block;
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

.c-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.c-yes .c-mark {
  color: var(--green);
}

.c-copeel.c-yes .c-mark {
  color: var(--brand);
}

.c-no .c-mark {
  color: #c7c7cc;
}

.c-partial .c-mark {
  color: var(--orange);
}

.c-unknown .c-mark {
  color: var(--ink-tertiary);
}

.c-ref {
  margin-left: 1px;
  color: var(--ink-secondary);
  font-size: 0.75em;
  font-weight: 600;
}

/* The price row: words in place of marks. */
.c-price {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.c-copeel.c-price {
  color: var(--brand-ink);
}

.compare-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 24px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-secondary);
  font-size: 14px;
}

.compare-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.compare-legend .c-mark {
  width: 18px;
  height: 18px;
}

.compare-footnote + .compare-source,
.compare-footnote + .compare-footnote {
  margin-top: 6px;
}

/* Small print in the secondary grey: 4.5:1 or more, where the tertiary one
   reads at 3.6:1. */
.compare-source {
  max-width: 70ch;
  margin: 16px auto 0;
  color: var(--ink-secondary);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  text-wrap: pretty;
}

/* On phones: Copeel and one other app, picked above the table. */
@media (max-width: 759px) {
  .compare[data-pick-current="tessie"] [data-rival]:not([data-rival="tessie"]),
  .compare[data-pick-current="tessiepro"] [data-rival]:not([data-rival="tessiepro"]),
  .compare[data-pick-current="teslafi"] [data-rival]:not([data-rival="teslafi"]),
  .compare[data-pick-current="teslamate"] [data-rival]:not([data-rival="teslamate"]) {
    display: none;
  }

  .compare .c-col {
    width: 64px;
    padding-inline: 4px;
  }

  .compare-card {
    padding-inline: 10px;
  }

  .compare tbody th {
    padding-inline: 6px 10px;
  }

  .c-feature {
    font-size: 16px;
  }

  .c-note {
    font-size: 13px;
  }

  .compare thead th {
    font-size: 15px;
  }
}

@media (min-width: 760px) {
  .compare-picker {
    display: none;
  }
}

@media (max-width: 759px) {
  .compare-picker button {
    padding-inline: 12px;
    font-size: 14px;
  }
}

/* How to switch ----------------------------------------------------------- */

.how {
  max-width: 1000px;
  margin: clamp(40px, 6vw, 64px) auto 0;
}

.how-tabs {
  margin-bottom: 20px;
}

.how-card {
  padding: clamp(28px, 5vw, 56px);
}

.how-panel[hidden] {
  display: none;
}

.how-panel:not([hidden]) {
  animation: rise 0.5s var(--ease-apple) both;
}

.how-steps {
  display: grid;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-steps li {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 16px;
}

.step-n {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.how-steps h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  align-self: center;
}

.how-steps p {
  margin: 6px 0 0;
  color: var(--ink-secondary);
  font-size: 16px;
  line-height: 1.45;
  text-wrap: pretty;
}

.how-more {
  margin-top: 32px;
  font-size: 17px;
}

@media (min-width: 860px) {
  .how-steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }

  /* Side by side, each step from the top: numbers, titles and texts on
     the same lines whatever the length of the others. */
  .how-steps li {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .how-steps h3 {
    align-self: start;
  }

  .step-n {
    grid-row: auto;
    margin-bottom: 20px;
  }
}

/* Questions ---------------------------------------------------------------- */

.faq {
  max-width: 820px;
  margin: clamp(40px, 6vw, 64px) auto 0;
  border-bottom: 1px solid var(--line);
}

.faq-item {
  border-top: 1px solid var(--line);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
  list-style: none;
  cursor: pointer;
}

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

.faq-item summary h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1rem + 0.4vw, 1.3125rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.018em;
}

.faq-item summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 6px;
}

.faq-plus {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--ink-secondary);
  transition: rotate 0.35s var(--ease-apple);
}

.faq-item[open] .faq-plus {
  rotate: 45deg;
}

.faq-answer p {
  max-width: 64ch;
  margin: 0;
  padding: 0 40px 24px 0;
  color: var(--ink-secondary);
  font-size: 17px;
  line-height: 1.5;
  text-wrap: pretty;
}

.faq-answer a {
  color: var(--brand-ink);
}

.faq-item[open] .faq-answer {
  animation: rise 0.45s var(--ease-apple) both;
}

/* Notes -------------------------------------------------------------------- */

.s-notes {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px 48px;
}

.s-notes p {
  max-width: 80ch;
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-secondary);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .flow-source,
  .flow-app,
  .flow-kept li,
  .how-panel:not([hidden]),
  .faq-item[open] .faq-answer {
    animation: none;
  }

  .wire,
  .flow-app::before {
    animation: none;
  }
}

/* Copeel Intelligence, as a wide tile at the head of "More than a logbook":
   the dark tile of the Discover page, at the size of the lock screen's. The
   stage has a fixed height, so the phone, sized by its room, is never cut. */
.s-ai {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #050608;
  color: #f5f5f7;
}

.s-ai .intel-copy {
  max-width: none;
  margin: 0;
}

.s-ai .intel-dots {
  justify-content: flex-start;
}

.s-ai .intel-stage {
  height: 540px;
}

@media (max-width: 639px) {
  .s-ai .intel-copy > p:not(.eyebrow):not(.intel-dots) {
    display: block;
  }

  .s-ai .intel-stage {
    height: 500px;
  }
}

@media (min-width: 900px) {
  .s-ai .intel-stage {
    height: 600px;
    place-items: center;
  }

  .s-ai .intel-glow {
    bottom: 50%;
    translate: -50% 50%;
  }
}

/* Achievements and Sentry: two features the app has, in its own colours.
   Tier colours are the app's (AchievementBronze, Silver, Gold, Diamond). */
.switch {
  --tier-bronze: #b06e3c;
  --tier-silver: #8a95a1;
  --tier-gold: #d09b1a;
  --tier-gold-ink: #946200; /* the eyebrow's: 4.7:1 on the tile's grey */
  --tier-diamond: #3ea6d1;
}

.bento-ach .bento-visual,
.bento-app .bento-sentry,
.switch .bento-app .bento-key {
  margin-top: auto;
  padding-top: 32px;
}

.ach {
  display: grid;
  gap: 12px;
  width: min(380px, 100%);
  margin: 0 auto;
}

.ach-mini {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.55), transparent 55%),
    var(--tier);
  color: #fff;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.35),
    0 8px 18px -8px var(--tier);
}

.ach-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ach-row li {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  color: var(--ink-secondary);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}

.ach-mini {
  width: 64px;
  height: 64px;
}

.ach-mini svg {
  width: 30px;
  height: 30px;
}

/* Sentry's alert, slimmer than on Discover: without the car's name. */
.switch .s-notif-sub {
  display: none;
}

/* The key, lighter than on Discover: the buttons and their toast, without
   the "Active on this iPhone" card. */
.switch .k-status {
  display: none;
}

/* No toast on this page: the buttons show the command on their own. */
.switch .k-toast-slot {
  display: none;
}

/* The key's buttons on the line of the medals beside them: the room their
   names take (a gap and two lines of 12 px) is left under the buttons.
   Only side by side: on phones the tiles are stacked. */
@media (min-width: 760px) {
  .switch .bento-app .bento-key {
    padding-bottom: calc(10px + 2 * 1.2 * 12px);
  }
}

/* The hero's title: smaller than Discover's, since the import picture
   comes under it, and one sentence a line. */
.s-hero h1 {
  max-width: none;
  font-size: clamp(2.5rem, 1.6rem + 3.4vw, 4rem);
}

.s-hero h1 .s-line {
  display: block;
}

/* The end: the badge, then a plain line for the versions to come. */
.switch .d-closing .s-cta {
  margin-top: 32px;
}

.switch .d-closing .s-other {
  margin-top: 16px;
  font-size: 17px;
  text-wrap: balance;
}
