/* The Android app's own look (CodeDroid-app ui/theme): warm paper and ink, a serif for the
   display type, the system sans for everything else. The pinwheel is the only colour. */
:root {
  --paper: #f5f4ee;
  --ink: #2b2a27;
  --ink-soft: #5f5d56;
  --ink-muted: #7c7a73;
  --on-ink: #f5f4ee;
  --error: #c0392b;
  --card: #fbfaf6;
  --line: color-mix(in srgb, var(--ink) 11%, transparent);
  --shadow: 0 1px 2px rgb(43 42 39 / 0.04), 0 10px 28px -14px rgb(43 42 39 / 0.18);
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1a18;
    --ink: #edece6;
    --ink-soft: #b9b8b0;
    --ink-muted: #9b9a93;
    --on-ink: #1a1a18;
    --error: #e5766b;
    --card: #222220;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -16px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* One rhythm: 40px between groups, 16px inside a group, 12px inside the brand. */
.page, .brand, section, .heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.page { gap: 40px; width: 100%; max-width: 568px; padding: 48px 24px; }
.page-wide { max-width: 820px; }
.brand { gap: 12px; }
section { gap: 16px; }
#download { width: 100%; }
.heading { gap: 4px; }

h1, h2 {
  font: 500 2rem/1.1 var(--serif);
  font-optical-sizing: auto;
  letter-spacing: -0.015em;
}
h2 { font-size: 1.375rem; letter-spacing: -0.01em; }
.lede { color: var(--ink-soft); font-size: 1.0625rem; text-wrap: balance; }
/* The logo and name lead to the main site. */
.home { display: flex; flex-direction: column; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.home:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; border-radius: 8px; }
.more {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  text-decoration: underline transparent;
  text-underline-offset: 3px;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}
.more:hover { color: var(--ink); text-decoration-color: currentColor; }
.more:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
section p { max-width: 340px; color: var(--ink-soft); text-wrap: pretty; }

/* The way to the other method: a quiet text link, out of the main path. */
.link {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font: 400 0.8125rem/1.4 var(--sans);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link:hover { color: var(--ink); }
.link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
/* Copies a command: a small pill inside its box. */
.copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font: 500 0.8125rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
/* Just the icon. The label is read out, and after a click shows above it as "Copied", without
   moving anything. */
.copy { position: relative; min-height: 30px; padding: 0 8px; }
.copy span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.copy.said span {
  bottom: calc(100% + 6px);
  right: 50%;
  width: auto;
  height: auto;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.75rem;
  clip-path: none;
  transform: translateX(50%);
}
.copy:hover { border-color: color-mix(in srgb, var(--ink) 24%, transparent); color: var(--ink); }
.copy:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.copy svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Black on white whatever the theme: phone cameras read that reliably. */
.qr { width: 136px; }
.qr svg { display: block; width: 100%; height: auto; border-radius: 8px; }

/* Download: the app's primary button, ink on paper. */
.button {
  display: grid;
  place-items: center;
  width: 300px;
  max-width: 100%;
  height: 40px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font: 500 0.9375rem/1 var(--sans);
  text-decoration: none;
}
button.button { border: 0; cursor: pointer; }
.button:hover { opacity: 0.88; }
.button:disabled { opacity: 0.5; cursor: progress; }
.button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.meta, .notice, footer { color: var(--ink-muted); }
.meta { font-size: 0.8125rem; }
.meta span { white-space: nowrap; }
.meta .version { display: block; }
footer { font-size: 0.75rem; }

/* ---------------------------------------------------------------- delete-account page
   The /delete-account flow: one <section> per state, shown one at a time. Sections reuse the
   page's section layout (centred column, 16px gaps); only show/hide and a few parts are new. */
.da-screen { display: none; width: 100%; }
.da-screen[data-show] { display: flex; }
.da-screen p { max-width: 360px; }
.fine { max-width: 360px; color: var(--ink-muted); font-size: 0.8125rem; line-height: 1.5; }
.da-error { color: var(--error); font-size: 0.8125rem; }
.button.danger { background: var(--error); color: #fff; }

.acct {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 360px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); text-align: left;
}
.acct .av {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  font: 600 14px/1 var(--sans); color: var(--ink);
}
.acct .em { font-size: 0.875rem; }
.acct .mu { font-size: 0.75rem; color: var(--ink-muted); }

.dl {
  width: 100%; max-width: 360px; padding: 12px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 7%, transparent); text-align: left;
}
.dl h3 { font: 600 0.75rem/1 var(--sans); letter-spacing: 0.06em; color: var(--error); margin-bottom: 8px; }
.dl ul { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 0.875rem; line-height: 1.7; }

.da-spin {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--ink); animation: da-sp 1s linear infinite;
}
@keyframes da-sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .da-spin { animation: none; } }
.da-mark { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; }
.da-ok { background: color-mix(in srgb, #2f9e5e 16%, transparent); }
.da-ok svg { width: 26px; height: 26px; fill: none; stroke: #2f9e5e; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.da-err { background: color-mix(in srgb, var(--error) 14%, transparent); color: var(--error); font: 600 24px/1 var(--serif); }

/* The download page footer now carries the account-deletion link. */
footer { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.foot-link { color: var(--ink-muted); font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 3px; }
.foot-link:hover { color: var(--ink); }
.foot-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

/* The two ways in, by intent, as cards that turn over to what each takes: side by side on a
   wide screen, stacked on a narrow one. Both faces share one grid cell, so a card is as tall as
   its taller face and the pair as tall as the taller card. */
.cards { display: grid; gap: 16px; width: 100%; }
@media (min-width: 760px) { .cards { grid-template-columns: 1fr 1fr; } }
/* The whole card is one target, flipping or not: the hand never drops to an arrow mid-turn. */
.card { display: grid; min-width: 0; perspective: 1400px; touch-action: manipulation; cursor: pointer; }
.card-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 560ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.card:not(.flipped) .card-back, .card.flipped .card-front { pointer-events: none; }
.card-face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 252px;
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: center;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.card-front { justify-content: center; gap: 14px; font: inherit; cursor: inherit; }
.card-back { gap: 14px; transform: rotateY(180deg); cursor: auto; }
.card-back:focus { outline: none; }
.card-front:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.card-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.card-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card-title { font: 500 1.375rem/1.2 var(--serif); letter-spacing: -0.01em; white-space: nowrap; }
.card-back p { max-width: 380px; }
.nowrap { white-space: nowrap; }
/* Turning over is decoration: without motion the faces trade places in a fade. */
@media (prefers-reduced-motion: reduce) {
  .card-inner, .card.flipped .card-inner { transform: none; transition: none; }
  .card-face { transition: opacity 160ms ease; }
  .card-back { transform: none; opacity: 0; }
  .card.flipped .card-back { opacity: 1; }
  .card.flipped .card-front { opacity: 0; }
}

/* What the device shows (index.html's head script): no script, a computer's page. */
.on-android, .on-ios { display: none; }
[data-device="android"] .on-android { display: grid; }
[data-device="ios"] .on-ios { display: block; }
[data-device="android"] .not-phone, [data-device="ios"] .not-phone { display: none; }
[data-device="android"] #app-card { order: -1; }

.command {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  width: 100%; padding: 8px 8px 8px 14px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}
.command code { font: 0.75rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); overflow-wrap: break-word; text-align: left; }
/* Too narrow for the command and the button side by side, the button drops under it. */
.command code { flex: 1 1 14em; min-width: 0; }
.command .copy { flex: none; margin-left: auto; }
/* The coding agent's command is the page's main one: larger than any other code. */
.command-lg { padding: 10px 10px 10px 16px; border-radius: 12px; }
.command-lg code { font-size: 1rem; }
@media (max-width: 480px) {
  .command-lg { padding-left: 14px; }
}

.qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr figcaption { color: var(--ink-soft); white-space: nowrap; }
.button-lg { width: 100%; max-width: 340px; height: 52px; font-size: 1.0625rem; }
.adb { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.adb p { color: var(--ink-muted); font-size: 0.8125rem; }

/* A question mark that explains a term on hover or focus; Escape hides it (app.js). The tooltip
   is centred over the whole sentence, so it never sticks out past a phone's edge. */
.has-tip { position: relative; }
.tip { display: inline-block; margin-left: 4px; vertical-align: 1px; }
.tip-button {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
  border-radius: 50%;
  background: none;
  color: var(--ink-muted);
  font: 600 0.6875rem/1 var(--sans);
  cursor: help;
}
.tip-button:hover { color: var(--ink); border-color: var(--ink); }
.tip-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 1;
  width: max-content;
  max-width: min(280px, 100%);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.8125rem;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  /* Lingers a moment once the pointer leaves, so it can move up onto the tooltip. */
  transition: opacity 120ms ease 250ms, transform 120ms ease 250ms, visibility 0s 370ms;
}
.tip:is(:hover, :focus-within):not([data-dismissed]) .tip-text {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
@media (prefers-reduced-motion: reduce) { .tip-text { transition: none; } }
