/* My Health Genie site. The logo's blues keyed on the app's button blue; black text on white; no
   dark mode. */
:root {
  --navy-900: #1F3865;
  --navy-800: #284572;
  --navy-700: #395B89;
  --navy-600: #4C70A1;
  --navy-500: #5F8CC3;
  --text: #000000;
  --background: #FFFFFF;
  --rule: #4C70A1;
  /* The key colour: the app's button blue, the primary that ColorScheme.fromSeed derives from
     healthGenieBlue (#154B80) in mobile/lib/core/theme.dart. White text on it is 6.46:1. */
  --app-blue: #3A608F;

  /* Layout, after Material 3's: a wide frame for the header and footer, a reading-width column for
     text, and margins and section spacing that grow with the window (close to today's sizes on phones). */
  --frame: 76rem;
  --measure: 44rem;
  --gutter: clamp(1rem, 0.25rem + 3vw, 3.5rem);
  --space-page: clamp(1.5rem, 0.5rem + 3vw, 4.5rem);
  --space-section: clamp(2.25rem, 1.5rem + 2vw, 4rem);
  --space-block: clamp(1rem, 0.75rem + 0.75vw, 1.75rem);
}

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

/* Text, spacing, the column and the logo are sized in rem, so this scales them with the window:
   100% up to a 1280px-wide window, rising to 125% at 2560px, so large monitors aren't a thin
   strip. Borders and outlines stay in px. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: clamp(100%, 75% + 0.3125vw, 125%);
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

a {
  color: var(--navy-800);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--navy-900);
}

a:focus-visible {
  outline: 3px solid var(--navy-500);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--background);
  padding: 0.5rem 0.75rem;
  z-index: 1;
}

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

/* Text keeps a reading width inside the wider frame, lined up under the logo. Capping each child
   (rather than wrapping them) keeps block margins collapsing as usual. */
main.wrap > * {
  max-width: var(--measure);
}

/* Header */
.site-header {
  border-bottom: 2px solid var(--navy-900);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: clamp(0.75rem, 0.5rem + 0.75vw, 1.5rem);
}

.brand {
  display: inline-block;
  line-height: 0;
}

.brand img {
  width: 6.875rem;
  height: auto;
}

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

.site-nav a {
  font-weight: 600;
  text-decoration: none;
  color: var(--navy-900);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
}

/* Main content */
main.wrap {
  padding-top: var(--space-page);
  padding-bottom: calc(var(--space-page) * 1.5);
}

h1,
h2,
h3 {
  color: var(--navy-900);
  line-height: 1.25;
}

h1 {
  font-size: clamp(2rem, 1.6rem + 1.2vw, 2.75rem);
  margin: 0 0 var(--space-block);
}

h2 {
  font-size: 1.375rem;
  margin: var(--space-section) 0 0.75rem;
  padding-top: var(--space-block);
  border-top: 1px solid var(--rule);
}

h3 {
  font-size: 1.125rem;
  margin: calc(var(--space-block) * 1.25) 0 0.5rem;
}

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

li {
  margin-bottom: 0.35rem;
}

.lede {
  font-size: clamp(1.25rem, 1.15rem + 0.35vw, 1.5rem);
  line-height: 1.5;
  margin-bottom: var(--space-block);
}

.meta {
  color: var(--navy-800);
  font-size: 0.9375rem;
}

.notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--navy-600);
}

.contents {
  padding: 0.75rem 1rem 0.5rem;
  border: 1px solid var(--rule);
  margin-bottom: var(--space-block);
}

/* A long document with a contents list (the privacy policy and the terms). On wide screens the list becomes a
   sticky contents column beside the text, as on m3.material.io; below 64rem it stays inline. */
@media (min-width: 64rem) {
  main.doc {
    display: grid;
    grid-template-columns: minmax(0, var(--measure)) minmax(12rem, 18rem);
    grid-template-areas: "intro contents" "body contents";
    grid-template-rows: auto 1fr;
    justify-content: space-between;
    column-gap: clamp(2.5rem, 4vw, 6rem);
  }

  main.doc > .doc-intro {
    grid-area: intro;
  }

  main.doc > .doc-body {
    grid-area: body;
  }

  main.doc > .contents {
    grid-area: contents;
    align-self: start;
    position: sticky;
    top: var(--space-block);
    max-height: calc(100vh - 2 * var(--space-block));
    overflow-y: auto;
    margin: 0;
    border: 0;
    border-left: 2px solid var(--rule);
    padding: 0 0 0 1.25rem;
    font-size: 0.9375rem;
  }

  main.doc > .contents li {
    margin-bottom: 0.5rem;
  }

  main.doc > .doc-body > h2:first-child {
    margin-top: 0;
  }
}

.contents h2 {
  border: 0;
  margin: 0 0 0.5rem;
  padding: 0;
  font-size: 1.125rem;
}

/* The landing page isn't reading text, so everything but its paragraphs spans the frame and the
   features sit in cards; the paragraphs keep the --measure reading width. */
main.landing > :not(p) {
  max-width: none;
}

.features,
.store-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-block);
  list-style: none;
  padding: 0;
}

.features li,
.store-links li {
  margin: 0;
  padding: var(--space-block);
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
}

.features strong {
  color: var(--navy-900);
}

/* Tables collapse to stacked rows on narrow screens, so nothing scrolls sideways at 320px. */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

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

th {
  color: var(--navy-900);
}

@media (max-width: 36rem) {
  table.stack thead {
    position: absolute;
    left: -9999px;
  }

  table.stack tr {
    display: block;
    border-bottom: 2px solid var(--navy-900);
    padding: 0.5rem 0;
  }

  table.stack td {
    display: block;
    border: 0;
    padding: 0.25rem 0;
  }

  table.stack td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--navy-900);
  }
}

dt {
  font-weight: 700;
  color: var(--navy-900);
  margin-top: 1rem;
}

dd {
  margin: 0.25rem 0 0;
}

/* Footer */
.site-footer {
  border-top: 2px solid var(--navy-900);
  padding: var(--space-block) 0 calc(var(--space-block) * 2);
  font-size: 0.9375rem;
}

.site-footer p {
  margin: 0 0 0.5rem;
}

.site-footer ul {
  margin-top: 0.75rem;
}
