/* BlauLoop — the site.
 *
 * The palette is lifted from lib/app/theme/app_colors.dart rather than picked
 * again by eye, so the page and the app are recognisably the same product.
 *
 * Nothing here loads anything: no web font, no icon set, no analytics. That is
 * the same rule supabase/templates/ follows, and for a page about a health app
 * it is worth more than a typeface. */

:root {
  color-scheme: light;

  --brand: #00a3e0;
  --navy: #1b365d;
  --mint: #2ec4b6;
  --alert: #ff6b35;

  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #edf2f6;
  --text: var(--navy);
  --text-dim: #55616f;
  --primary: #0078a5;
  --on-primary: #ffffff;
  --primary-container: #dcf0f9;
  --on-primary-container: #00506e;
  --outline: #dce3ea;
  --healthy: #1e8c82;

  --radius: 14px;
  --measure: 68ch;
  --shadow: 0 1px 2px rgb(27 54 93 / 8%), 0 8px 24px rgb(27 54 93 / 6%);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #121824;
    --surface: #1a2333;
    --surface-2: #222d40;
    --text: #e8eef7;
    --text-dim: #a9b7c9;
    --primary: #00a3e0;
    --on-primary: #06212e;
    --primary-container: #00405a;
    --on-primary-container: #8fdcf7;
    --outline: #2a3547;
    --healthy: #2ec4b6;

    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

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

/* The two languages both live in the DOM; one of them is hidden. The choice is
 * stamped on <html> by assets/boot.js before the body paints, so nothing
 * flashes. */
html[data-lang="es"] [lang="en"],
html[data-lang="en"] [lang="es"] {
  display: none;
}

img {
  max-width: 100%;
  height: auto;
}

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

a:hover {
  color: var(--on-primary-container);
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem);
}

h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1em;
  max-width: var(--measure);
  text-wrap: pretty;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

.wrap {
  width: min(100% - 2.5rem, 1080px);
  margin-inline: auto;
}

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

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

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
  flex-wrap: wrap;
}

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

/* The mark is transparent and carries no white — only the blue-to-mint
 * gradient — so it sits directly on the page in either theme and wants no
 * tile behind it. The lockup below is the opposite case: its letters are
 * white, so it always gets navy under it. */
.brand .mark {
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem 1.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* The language switch is two buttons rather than a select, so the state is
 * visible without opening anything. */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--outline);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  min-height: 36px;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}

/* --- Sections ----------------------------------------------------------- */

section {
  padding: clamp(3rem, 8vw, 5.5rem) 0;
}

section + section {
  border-top: 1px solid var(--outline);
}

.hero {
  padding-top: clamp(2.5rem, 7vw, 4.5rem);
  border: 0;
}

.hero .tagline {
  font-size: clamp(1.15rem, 1rem + 0.8vw, 1.45rem);
  color: var(--text-dim);
  max-width: 46ch;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-primary-container);
  background: var(--primary-container);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.lede {
  font-size: 1.05rem;
}

.muted {
  color: var(--text-dim);
}

.small {
  font-size: 0.9rem;
}

/* --- Buttons ------------------------------------------------------------ */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: var(--primary);
  color: var(--on-primary);
}

.btn:hover {
  color: var(--on-primary);
  filter: brightness(1.08);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--outline);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--primary);
  filter: none;
}

/* A link with nothing to point at yet is rendered as a disabled button rather
 * than as a dead link. assets/config.js turns it on the moment there is a URL
 * to give it. */
.btn[aria-disabled="true"] {
  background: var(--surface-2);
  color: var(--text-dim);
  border-color: var(--outline);
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
}

/* --- Cards -------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.97rem;
}

.card svg {
  flex: none;
  color: var(--primary);
}

/* --- The boundary panel -------------------------------------------------
 * Deliberately the loudest thing on the page after the hero. An app about a
 * chronic condition that is vague about what it refuses to do is the one kind
 * of vagueness that costs somebody something. */

.boundary {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-left: 5px solid var(--alert);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.boundary ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--text-dim);
  max-width: var(--measure);
}

.boundary li {
  margin-bottom: 0.3rem;
}

.boundary p:last-child {
  margin-bottom: 0;
}

/* --- Download ----------------------------------------------------------- */

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
  align-items: start;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  max-width: var(--measure);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.6rem;
  margin-bottom: 0.85rem;
  color: var(--text-dim);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.85rem;
  height: 1.85rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-size: 0.85rem;
  font-weight: 700;
}

/* --- Long-form pages (privacy, support) --------------------------------- */

.prose h2 {
  margin-top: 2.5rem;
}

.prose ul {
  max-width: var(--measure);
  color: var(--text-dim);
  padding-left: 1.2rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose code {
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

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

.site-footer {
  border-top: 1px solid var(--outline);
  padding: 2.5rem 0 3.5rem;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.footer-logo {
  display: block;
  width: 168px;
  height: auto;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.page-logo {
  display: block;
  width: min(220px, 60vw);
  height: auto;
  border-radius: 14px;
  margin-bottom: 2rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.25rem;
}

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

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

.site-footer p {
  max-width: var(--measure);
  margin-bottom: 0.5rem;
}

/* The password reset page, and the only form on this site.
 *
 * Kept here rather than in a <style> block because `_headers` sets
 * `style-src 'self'` with no `unsafe-inline` — an inline style attribute is
 * silently dropped, which is a bad way to discover a layout. */
.page-title {
  margin-top: 2rem;
}

.form {
  margin: 2rem 0 0;
  max-width: 34ch;
}

.field {
  display: block;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.field input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 10px;
}

.field input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* One box for every outcome, so the page cannot contradict itself. The tone
 * is carried by a left rule as well as a colour: a colour alone is not a
 * status, which is the rule the app holds itself to as well. */
.notice {
  margin: 1.5rem 0 0;
  padding: 0.9rem 1.1rem;
  max-width: var(--measure);
  border-left: 4px solid var(--outline);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}

.notice--problem {
  border-left-color: var(--alert);
}

.notice--good {
  border-left-color: var(--healthy);
}
