/*
  Detour — public site.
  One stylesheet, no build step, no external requests. Colours mirror the app's
  dark Material theme (ui/theme/Color.kt) so the site and the app read as one
  product.
*/

:root {
  --brand: #2d6be4;
  --brand-soft: #9cc0ff;
  --accent: #ff6b35;

  --bg: #0f1216;
  --surface: #171b21;
  --surface-2: #1c2027;
  --border: #2b313a;
  --text: #e8ebf0;
  --text-dim: #aeb5c0;
  --text-faint: #8b93a0;

  --maxw: 46rem;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfcff;
    --surface: #ffffff;
    --surface-2: #f2f4f9;
    --border: #d9dee8;
    --text: #14171c;
    --text-dim: #454b56;
    --text-faint: #5f6774;
    --brand: #1c53c4;
    --brand-soft: #1c53c4;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* Clears the sticky header when a table-of-contents link jumps to a section. */
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Visible only to screen readers until focused — the skip link. */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 10;
  border-radius: 0 0 var(--radius) 0;
}
.skip:focus {
  left: 0;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.brand svg {
  width: 22px;
  height: 22px;
  display: block;
}

.site-nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--brand);
}

/* ---------- generic content ---------- */

main {
  padding: 2.5rem 0 4rem;
}

h1 {
  font-size: clamp(1.85rem, 5vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.6rem;
  padding-top: 0.25rem;
}

h3 {
  font-size: 1.02rem;
  margin: 1.6rem 0 0.4rem;
  color: var(--text);
}

p,
li {
  color: var(--text-dim);
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
}

li {
  margin-bottom: 0.4rem;
}

a {
  color: var(--brand-soft);
}

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

strong {
  color: var(--text);
  font-weight: 620;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.87em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.35em;
}

/* ---------- home ---------- */

/* Padding-block only: the shorthand would wipe out .wrap's horizontal padding,
   since both classes sit on the same element. */
.hero {
  padding-top: 3.5rem;
  padding-bottom: 1rem;
}

.hero .tagline {
  font-size: clamp(1.05rem, 3.2vw, 1.25rem);
  color: var(--text-dim);
  max-width: 34rem;
  margin-bottom: 1.75rem;
}

.mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.mark svg {
  width: 40px;
  height: 40px;
}

.mark span {
  font-size: 1.6rem;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0;
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.steps .n {
  flex: 0 0 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--brand-soft);
  font-size: 0.82rem;
  font-weight: 650;
  display: grid;
  place-items: center;
  margin-top: 0.1rem;
}

.steps .t {
  color: var(--text);
  font-weight: 600;
  display: block;
}

.steps .d {
  display: block;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.linkrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.linkrow a {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.94rem;
}

.linkrow a:hover {
  border-color: var(--brand);
}

/* ---------- legal pages ---------- */

.doc-meta {
  color: var(--text-faint);
  font-size: 0.92rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 0 0 1.5rem;
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.toc h2 {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 0;
}

.toc ol {
  margin: 0;
  padding-left: 1.15rem;
  columns: 2;
  column-gap: 1.5rem;
}

.toc li {
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  break-inside: avoid;
}

@media (max-width: 560px) {
  .toc ol {
    columns: 1;
  }
}

/* Secondary line inside a table cell. */
.sub {
  color: var(--text-faint);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.94rem;
}

th,
td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-dim);
}

th {
  color: var(--text);
  font-weight: 620;
  background: var(--surface-2);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/*
  On a phone a four-column table is a sideways-scrolling chore, and these tables
  carry the most important part of the policy. Below 640px each row becomes a
  card and every cell is labelled from the column it came from — the labels live
  here rather than as data-attributes so the markup stays a plain table.
*/
@media (max-width: 640px) {
  .table-scroll {
    overflow-x: visible;
    border: 0;
    border-radius: 0;
  }

  table {
    min-width: 0;
    display: block;
  }

  thead {
    /* Visually hidden, still read by assistive technology. */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  tbody,
  tr,
  td {
    display: block;
    width: auto;
  }

  tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0;
    margin-bottom: 0.75rem;
  }

  td {
    border-bottom: 0;
    padding: 0.45rem 1rem;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    margin-bottom: 0.1rem;
  }

  .t-providers td:nth-child(1)::before { content: "Service"; }
  .t-providers td:nth-child(2)::before { content: "Used for"; }
  .t-providers td:nth-child(3)::before { content: "What is sent"; }
  .t-providers td:nth-child(4)::before { content: "Policy"; }

  .t-retention td:nth-child(1)::before { content: "What"; }
  .t-retention td:nth-child(2)::before { content: "Where it lives"; }
  .t-retention td:nth-child(3)::before { content: "How long"; }

  .t-permissions td:nth-child(1)::before { content: "Permission"; }
  .t-permissions td:nth-child(2)::before { content: "Why Detour asks"; }
}

/* ---------- contact ---------- */

.contact-line {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 3rem;
  font-size: 0.92rem;
  color: var(--text-faint);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: space-between;
  align-items: center;
}

.site-footer nav {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
}

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

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}
