/*
  MotherMend site styles. Plain CSS: no web fonts, no external files, no scripts.

  Colours are the app's tokens from MotherMend/DesignSystem/Colors.swift. Every text pair used here
  is one already checked in docs/brand/COLOR_CONTRAST.md (WCAG 2.1 AA, 4.5:1 or more), in light and
  dark mode. "prefers-contrast: more" switches to the app's Increase Contrast values (7:1 or more).
  If you change a colour, change it in Colors.swift first and re-run the contrast check.
*/

:root {
  color-scheme: light dark;

  --bg: #FBF7F4;             /* mmBackground */
  --surface: #FFFFFF;        /* mmSurface */
  --surface-muted: #F3ECE7;  /* mmSurfaceMuted */
  --text: #2B2321;           /* mmTextPrimary */
  --text-secondary: #6B5E59; /* mmTextSecondary */
  --primary: #A0524B;        /* mmPrimary: links, focus ring */
  --accent: #4F6B5C;         /* mmAccent: "always free" marker */
  --divider: #E6DCD5;        /* mmDivider: decorative lines */
  --danger: #B42318;         /* mmDanger: urgent-care box */

  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 42rem;
  --gutter: 1rem;
  --radius: 0.875rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1716;
    --surface: #26211F;
    --surface-muted: #322B28;
    --text: #F5EFEB;
    --text-secondary: #B9ACA6;
    --primary: #E8A39B;
    --accent: #9DBBA9;
    --divider: #3A322F;
    --danger: #F97066;
  }
}

/* Increase Contrast values from Colors.swift. */
@media (prefers-contrast: more) {
  :root {
    --text: #1F1917;
    --text-secondary: #4F433F;
    --primary: #7E3A34;
    --accent: #3B5446;
    --divider: #9C8B82;
    --danger: #931A12;
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --text: #FFFFFF;
    --text-secondary: #D6CBC5;
    --primary: #F4BDB6;
    --accent: #B8D3C3;
    --divider: #7A6C66;
    --danger: #FFA49D;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem; /* 17px at the default size, like iOS body text; scales with the reader's settings */
  line-height: 1.6;
  overflow-wrap: break-word;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Skip link: hidden until it gets keyboard focus. */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100%;
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--primary);
  border-radius: 0.5rem;
  z-index: 10;
}

.skip-link:focus {
  top: 0.5rem;
}

/* Header and navigation */
.site-header {
  border-bottom: 1px solid var(--divider);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.wordmark {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 0;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  margin: 0 0 0 -0.625rem; /* lines the first link's text up with the wordmark */
  padding: 0;
  list-style: none;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  display: inline-block;
  min-height: 2.75rem; /* 44 px tap target */
  padding: 0.6rem 0.625rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 0.5rem;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-nav a[aria-current="page"] {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-decoration-thickness: 0.15em;
  text-underline-offset: 0.3em;
}

/* Main content */
main {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.75rem;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
}

h2 {
  font-size: 1.4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--divider);
}

h3 {
  font-size: 1.125rem;
}

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

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

li + li {
  margin-top: 0.35rem;
}

.lead {
  font-size: 1.2rem;
  color: var(--text);
}

.meta,
.note {
  color: var(--text-secondary);
}

.meta {
  font-size: 0.95rem;
}

strong {
  font-weight: 650;
}

/* Links are always underlined, so they never rely on colour alone. */
a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 0.15em;
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Settings paths such as Settings › Subscription › Manage subscription */
.path {
  font-weight: 600;
}

/* Cards and call-outs */
.card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin: 0 0 1.25rem;
}

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

.card h2,
.card h3 {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.callout-urgent {
  border-left: 0.375rem solid var(--danger);
}

.callout-urgent .callout-title {
  color: var(--danger);
}

.callout-free {
  border-left: 0.375rem solid var(--accent);
}

.muted-box {
  background: var(--surface-muted);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin: 0 0 1.25rem;
}

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

/* Two short lists side by side on wide screens, stacked on phones. */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1.25rem;
}

@media (min-width: 40rem) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
}

/* Table of contents on the support page */
.toc .toc-title {
  font-size: 1.125rem;
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.toc ul {
  padding-left: 1.2rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--divider);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.site-footer .wrap {
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0;
  list-style: none;
}

.site-footer li + li {
  margin-top: 0;
}

.site-footer a {
  display: inline-block;
  padding: 0.35rem 0;
}

@media print {
  .skip-link,
  .site-nav {
    display: none;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }
}
