/* Tip Stream — tip-stream.com
   Design tokens derived from the app's ColorTheme (Material Design 3,
   green-primary) and its card/typography conventions. */

:root {
  color-scheme: light dark;

  /* Light palette (app: Color+Theme.swift light hexes) */
  --bg: #f8f9fa;                 /* background */
  --surface: #ffffff;            /* surfaceContainerLowest — cards */
  --surface-high: #edeeef;       /* surfaceContainer */
  --text: #191c1d;               /* onBackground */
  --text-secondary: #3e4a3f;     /* onSurfaceVariant */
  --text-muted: #6e7a6e;         /* outline */
  --accent: #006d36;             /* primary */
  --on-accent: #ffffff;          /* onPrimary */
  --accent-soft: #e4f6ea;        /* tint of primaryContainer for chips */
  --hairline: #e1e3e4;           /* surfaceContainerHighest */
  --badge-bg: #191c1d;
  --badge-fg: #f8f9fa;
  --shadow: 0 1px 2px rgba(25, 28, 29, 0.04), 0 6px 24px rgba(25, 28, 29, 0.06);

  /* App conventions: 20pt cards, 16pt secondary, 12pt rows/chips */
  --radius-card: 20px;
  --radius-secondary: 16px;
  --radius-row: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1112;               /* background (dark) */
    --surface: #171a1c;          /* surfaceContainer (dark) */
    --surface-high: #212527;     /* surfaceContainerHigh (dark) */
    --text: #e1e3e4;             /* onBackground (dark) */
    --text-secondary: #bfc8c0;   /* onSurfaceVariant (dark) */
    --text-muted: #89938a;       /* outline (dark) */
    --accent: #66dd8b;           /* primary (dark) */
    --on-accent: #003919;        /* onPrimary (dark) */
    --accent-soft: #16291c;
    --hairline: #2b3032;         /* surfaceContainerHighest (dark) */
    --badge-bg: #e1e3e4;
    --badge-fg: #0f1112;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 24px rgba(0, 0, 0, 0.25);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem; /* 17px — app body size */
  line-height: 1.65;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px; /* app screen padding */
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px; /* iOS icon curvature at this size */
  display: block;
}

/* ---------- Main / shared ---------- */

main {
  flex: 1;
  padding: 48px 0 80px;
}

h1 {
  font-size: 2.125rem; /* 34px — app .largeTitle */
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.022em;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.375rem; /* 22px — app .title2 */
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.017em;
  margin: 2.4em 0 0.6em;
}

h3 {
  font-size: 1.0625rem; /* 17px — app .headline */
  font-weight: 650;
  margin: 1.8em 0 0.5em;
}

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

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

li {
  margin-bottom: 0.4em;
}

li::marker {
  color: var(--text-muted);
}

.lede {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  margin-bottom: 2rem;
}

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

.hero {
  text-align: center;
  padding-top: 24px;
}

.hero .app-icon {
  width: 120px;
  height: 120px;
  border-radius: 27px; /* iOS squircle approximation */
  box-shadow: var(--shadow);
  display: inline-block;
}

.hero h1 {
  margin-top: 24px;
}

.hero .tagline {
  color: var(--text-secondary);
  font-size: 1.1875rem;
  max-width: 32em;
  margin: 0 auto 2rem;
  text-wrap: balance;
}

.appstore-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  border-radius: var(--radius-row);
  padding: 11px 22px 11px 18px;
  line-height: 1.15;
  text-align: left;
}

.appstore-badge:hover {
  text-decoration: none;
  opacity: 0.85;
}

.appstore-badge svg {
  width: 26px;
  height: 26px;
  flex: none;
  fill: currentColor;
}

.appstore-badge .badge-small {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.appstore-badge .badge-large {
  display: block;
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.page-links {
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
  text-align: left;
}

.page-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-secondary);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  color: var(--text);
}

.page-links a:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.page-links .link-title {
  display: block;
  font-weight: 650;
}

.page-links .link-sub {
  display: block;
  font-size: 0.9375rem; /* 15px — app .subheadline */
  color: var(--text-secondary);
}

.page-links .chevron {
  color: var(--text-muted);
  flex: none;
  font-size: 1.25rem;
}

/* ---------- Legal / article pages ---------- */

article header.doc-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--hairline);
}

.effective-date {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin: 0;
}

article a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}

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

.doc-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ---------- Support page ---------- */

.contact-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 1.5rem 0 0;
}

.contact-card .email {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.contact-card .reply-note {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin: 0.4em 0 0;
}

.faq {
  display: grid;
  gap: 12px;
  margin-top: 1rem;
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-secondary);
  box-shadow: var(--shadow);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  font-weight: 650;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-top: -4px;
}

.faq details[open] summary::after {
  transform: rotate(225deg);
  margin-top: 4px;
}

.faq details > div {
  padding: 0 20px 18px;
  color: var(--text-secondary);
}

.faq details > div p:last-child {
  margin-bottom: 0;
}

kbd.path {
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-high);
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
}

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

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 28px 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.site-footer p {
  margin: 0;
  text-align: center;
}

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

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

@media (max-width: 480px) {
  main {
    padding: 36px 0 64px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .hero .app-icon {
    width: 104px;
    height: 104px;
    border-radius: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
