/*
 * Shared styles for the Ditto public site.
 *
 * Tokens are copied from the app's `src/index.css` so the two read as one product. They are copied
 * rather than imported because this site deploys separately from the app and has no build step —
 * see `site/README.md` for why it is hosted apart from `dittomatch.app` at all.
 *
 * No fonts are fetched. The display face is whatever serif the reader already has, in the same
 * order the app asks for, so a legal page renders instantly and offline and pulls nothing from a
 * third party — which is a small privacy claim the privacy policy itself makes.
 */

:root {
  --color-cream: #faf7f5;
  --color-ink: #2c2724;
  --color-ink-soft: #6b625c;
  --color-blush: #e8836f;
  --color-blush-deep: #d16a55;
  --color-sage: #7d9c85;

  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --bg: var(--color-cream);
  --bg-raised: #ffffff;
  --fg: var(--color-ink);
  --fg-soft: var(--color-ink-soft);
  --edge: #e4dbd4;

  /*
   * Deliberately darker than the app's `--color-blush-deep` (#d16a55), which is the one token here
   * that is not copied verbatim. On this cream ground that blush measures 3.33:1 against text and
   * 3.56:1 behind the white button label — both under the 4.5:1 that normal-size text needs to pass
   * WCAG AA. It is fine in the app, where it is mostly a large surface rather than a word you have
   * to read. Here it is link text on a legal page, so it is darkened to 5.07:1 and the button to
   * 5.41:1. Dark mode keeps the original blush, which already measures 6.72:1 on #1a1715.
   */
  --accent: #b04a38;
  --cta-bg: #b04a38;
  --cta-bg-hover: #a3452f;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1715;
    --bg-raised: #262220;
    --fg: #f2ece8;
    --fg-soft: #a89e97;
    --edge: #3a3431;
    /* The darkened light-mode accent is far too low-contrast on a dark ground; the original passes. */
    --accent: var(--color-blush);
    --cta-bg: var(--color-blush-deep);
    --cta-bg-hover: #bd5844;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* --- Header ------------------------------------------------------------- */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--edge);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}

.brand img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--fg-soft);
  text-decoration: none;
}

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

.site-nav a[aria-current='page'] {
  color: var(--fg);
  font-weight: 600;
}

/* --- Typography --------------------------------------------------------- */

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 2.75rem 0 0.75rem;
  line-height: 1.25;
}

h3 {
  font-size: 1.05rem;
  margin: 1.75rem 0 0.4rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.35rem;
}

li {
  margin-bottom: 0.4rem;
}

a {
  color: var(--accent);
}

strong {
  font-weight: 650;
}

.lede {
  font-size: 1.1rem;
  color: var(--fg-soft);
  margin-bottom: 1.5rem;
}

.updated {
  font-size: 0.85rem;
  color: var(--fg-soft);
  margin: 0 0 2.5rem;
}

/* --- Blocks ------------------------------------------------------------- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--edge);
  border-radius: 1rem;
  padding: 1.25rem 1.4rem;
  margin: 0 0 1.25rem;
}

.card h3 {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

.note {
  border-left: 3px solid var(--accent);
  padding: 0.15rem 0 0.15rem 1rem;
  margin: 1.5rem 0;
  color: var(--fg-soft);
}

.note > :last-child {
  margin-bottom: 0;
}


/* --- Tables ------------------------------------------------------------- */

/* Wide tables scroll inside their own box rather than making the page scroll sideways. */
.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--edge);
  border-radius: 0.75rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 30rem;
  font-size: 0.92rem;
  background: var(--bg-raised);
}

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

th {
  font-weight: 650;
  background: var(--bg);
}

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

/* --- Landing page ------------------------------------------------------- */

.hero {
  text-align: center;
  padding: 1rem 0 2.5rem;
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero .lede {
  max-width: 32rem;
  margin-inline: auto;
}

.cta {
  display: inline-block;
  background: var(--cta-bg);
  color: #fff;
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  margin-top: 0.5rem;
}

.cta:hover,
.cta:focus-visible {
  background: var(--cta-bg-hover);
}

.steps {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  margin: 1.5rem 0 2rem;
  padding: 0;
  list-style: none;
}

.steps li {
  background: var(--bg-raised);
  border: 1px solid var(--edge);
  border-radius: 1rem;
  padding: 1.1rem 1.25rem;
  margin: 0;
}

.step-n {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.5rem;
}

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

.site-foot {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--edge);
  font-size: 0.85rem;
  color: var(--fg-soft);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-foot a {
  color: var(--fg-soft);
}

/* Respect a reader who has asked for less motion; there is little here, but smooth scroll counts. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
