/* ==========================================================================
   Endó — web theme
   Mirrors Theme.swift: rose/coral gradient, plum + amber blobs, Liquid Glass
   cards at 26pt radius, SF Pro Rounded Black headings. Light scheme only,
   matching the app's .preferredColorScheme(.light).
   ========================================================================== */

/* Nunito — rounded-terminal fallback for non-Apple browsers, where ui-rounded
   does not resolve to SF Pro Rounded. Self-hosted: no third-party requests. */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/assets/nunito-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/assets/nunito-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Theme.swift palette */
  --rose:   #f04a78;
  --coral:  #fa7385;
  --plum:   #8c549e;
  --amber:  #faa85c;
  --mint:   #61bf9e;
  --blush:  #fcdbdb;

  --ink:      #34222a;
  --ink-soft: #7c6670;
  --cream:    #fff7f5;
  --border:   rgba(240, 74, 120, 0.16);

  /* Theme.cornerRadius = 26 */
  --radius:      26px;
  --radius-sm:   16px;
  --maxw:        740px;

  /* SF Pro Rounded on Apple platforms via ui-rounded; Nunito elsewhere. */
  --font: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system,
          BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.62;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Gradient backdrop — BackgroundGradient in Theme.swift
   -------------------------------------------------------------------------- */

.gradient {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    rgba(240, 74, 120, 0.95) 0%,
    rgba(250, 115, 133, 0.88) 42%,
    rgba(248, 146, 160, 1) 74%,
    #fcdbdb 100%
  );
  color: #fff;
  isolation: isolate;
}

/* plum blob, top trailing */
.gradient::before,
.gradient::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: -1;
}
.gradient::before {
  width: 320px; height: 320px;
  background: rgba(140, 84, 158, 0.35);
  top: -120px; right: -120px;
}
/* amber blob, bottom leading */
.gradient::after {
  width: 280px; height: 280px;
  background: rgba(250, 168, 92, 0.40);
  bottom: -120px; left: -100px;
}

/* --------------------------------------------------------------------------
   Header — glass over the gradient
   -------------------------------------------------------------------------- */

header.site {
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
}

nav.site a {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 700;
  margin-left: 20px;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
nav.site a:first-child { margin-left: 0; }
nav.site a:hover { color: #fff; }
nav.site a[aria-current="page"] { color: #fff; border-bottom-color: rgba(255,255,255,0.75); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero { padding: 34px 0 78px; text-align: center; }

#sloth {
  width: min(240px, 52vw);
  height: min(240px, 52vw);
  margin: 0 auto 4px;
  filter: drop-shadow(0 18px 34px rgba(90, 20, 45, 0.22));
}
#sloth svg { display: block; }

.hero h1 {
  font-size: clamp(2rem, 7.4vw, 3.7rem);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -0.035em;
  margin: 10px 0 16px;
  text-wrap: balance;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
}

.wordmark {
  font-size: clamp(2.7rem, 10vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
  text-shadow: 0 6px 26px rgba(0, 0, 0, 0.24);
}

.hero p.lede {
  font-size: clamp(1rem, 3.4vw, 1.14rem);
  font-weight: 600;
  text-wrap: pretty;
  color: #fff;
  text-shadow: 0 1px 8px rgba(120, 25, 60, 0.22);
  max-width: 30em;
  margin: 0 auto 32px;
}

/* --------------------------------------------------------------------------
   Buttons — PrimaryButton: white glass, rose label
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: var(--rose);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 15px 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 28px rgba(120, 25, 60, 0.20);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(120, 25, 60, 0.26);
}
.btn:active { transform: translateY(0); }

/* --------------------------------------------------------------------------
   Glass cards — GlassCard, Theme.cornerRadius 26
   -------------------------------------------------------------------------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 16px;
  padding: 0 0 20px;
}

.card {
  background: rgba(198, 42, 88, 0.26);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius);
  padding: 22px;
  color: #fff;
  text-align: left;
  box-shadow: 0 8px 26px rgba(120, 25, 60, 0.14);
}
.card h3 {
  margin: 0 0 7px;
  font-size: 1.06rem;
  font-weight: 900;
  letter-spacing: -0.015em;
}
.card p {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 500;
  color: #fff;
}

/* DisclaimerNote */
.disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(120, 25, 60, 0.35);
  font-size: 0.93rem;
  font-weight: 600;
  max-width: 44em;
  margin: 26px auto 0;
  text-align: left;
  padding-bottom: 74px;
}
.disclaimer svg { flex: none; margin-top: 3px; }

/* --------------------------------------------------------------------------
   Doc pages — gradient masthead, then readable light body
   -------------------------------------------------------------------------- */

.masthead { padding: 46px 0 52px; text-align: center; }

.masthead h1 {
  font-size: clamp(2.1rem, 7vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  margin: 0 0 8px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.masthead .updated {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.92rem;
  font-weight: 600;
}

main.doc { padding: 44px 0 70px; }

main.doc h2 {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 42px 0 10px;
  scroll-margin-top: 24px;
}
main.doc h3 {
  font-size: 1.02rem;
  font-weight: 800;
  margin: 26px 0 7px;
}
main.doc p, main.doc li { font-weight: 500; }
main.doc ul, main.doc ol { padding-left: 22px; }
main.doc li { margin-bottom: 7px; }
main.doc a { color: var(--rose); font-weight: 700; }
main.doc strong { font-weight: 800; }

.callout {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--coral);
  border-radius: 6px var(--radius-sm) var(--radius-sm) 6px;
  padding: 17px 20px;
  margin: 26px 0;
  font-size: 0.97rem;
  box-shadow: 0 4px 18px rgba(240, 74, 120, 0.07);
}

.toc {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 34px;
  box-shadow: 0 4px 18px rgba(240, 74, 120, 0.07);
}
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin-bottom: 4px; font-size: 0.94rem; }
.toc a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.toc a:hover { color: var(--rose); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  margin: 18px 0;
  display: block;
  overflow-x: auto;
}
table.data th, table.data td {
  border: 1px solid var(--border);
  padding: 11px 13px;
  text-align: left;
  vertical-align: top;
  font-weight: 500;
}
table.data th {
  background: #fff;
  font-weight: 800;
  white-space: nowrap;
}

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

footer.site {
  background: var(--cream);
  border-top: 1px solid var(--border);
  padding: 30px 0 46px;
  color: var(--ink-soft);
  font-size: 0.89rem;
  font-weight: 600;
}
footer.site .wrap {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
footer.site a {
  color: var(--ink-soft);
  text-decoration: none;
  margin-right: 18px;
}
footer.site a:hover { color: var(--rose); }

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

/* Doc-page mastheads are short — scale the blobs down so they read as accents
   rather than washing the band out. */
.gradient.compact::before {
  width: 220px; height: 220px;
  top: -110px; right: -80px;
}
.gradient.compact::after {
  width: 190px; height: 190px;
  bottom: -110px; left: -70px;
  background: rgba(250, 168, 92, 0.30);
}

/* Hard break in the headline only where the line is wide enough to earn it. */
.wide-only { display: none; }
@media (min-width: 600px) { .wide-only { display: inline; } }

/* --------------------------------------------------------------------------
   Research / citation block on the landing page
   -------------------------------------------------------------------------- */

.research {
  background: rgba(198, 42, 88, 0.26);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-top: 22px;
  color: #fff;
  text-align: left;
  box-shadow: 0 8px 26px rgba(120, 25, 60, 0.14);
}
.research h2 {
  margin: 0 0 14px;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.025em;
}
.research p {
  margin: 0 0 14px;
  font-size: 0.97rem;
  font-weight: 500;
}
.research p:last-child { margin-bottom: 0; }
.research strong { font-weight: 800; }

.research .citation {
  background: rgba(255, 255, 255, 0.16);
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 4px 12px 12px 4px;
  padding: 13px 16px;
  font-size: 0.93rem;
  line-height: 1.55;
}
.research .citation a {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
