/* -----------------------------------------------------------------------------
   yirtinci.com — shared foundation

   The palette is not a web palette. It is lifted verbatim from the app's dark
   theme, which was computed in OKLCH rather than picked: every accent clears
   4.5:1 against every surface it lands on, and the four sleep-stage colours are
   separated by at least ΔE 8 under all three common colour-vision deficiencies.
   Keeping the site on the same values means the marketing page and the product
   are demonstrably the same object, and it means the contrast work is already
   done.
   -------------------------------------------------------------------------- */

:root {
  /* surfaces */
  --bg: #080b18;
  --bg-soft: #0d1226;
  --surface: #141a33;
  --surface-high: #1c2342;
  --ambient: #101838;

  /* ink */
  --text: #f0f2ff;
  --muted: #98a0c6;
  --faint: #8a91b4;

  /* accents */
  --primary: #7c6bf5;
  --primary-deep: #5b4fd6;
  --primary-button: #6e5be4;
  --violet: #987de7;
  --indigo: #6375f2;
  --teal: #00a7af;
  --sun: #b09018;
  --amber: #cf7210;
  --rose: #f2555a;
  --mint: #3cac56;

  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* the app's spacing scale */
  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 12px;
  --s-lg: 16px;
  --s-xl: 24px;
  --s-2xl: 32px;
  --s-3xl: 48px;
  --s-4xl: 80px;
  --s-5xl: 128px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  --page: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* The ambient wash the app paints behind every screen. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(150deg, var(--ambient) 0%, var(--bg) 55%);
  z-index: -1;
  pointer-events: none;
}

h1,
h2,
h3 {
  font-family: 'Bricolage Grotesque', 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.6rem, 7.2vw, 5.2rem);
}
h2 {
  font-size: clamp(1.9rem, 4.2vw, 3.1rem);
}
h3 {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  letter-spacing: -0.015em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
}

/* Numbers are data here, not decoration: line them up. */
.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.wrap {
  width: min(100% - 2 * var(--s-xl), var(--page));
  margin-inline: auto;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0;
}

.lede {
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  color: var(--muted);
  max-width: 62ch;
}

/* A skip link that is invisible until focused, and unmissable once it is.
   Parking it off-screen with no focus style, as it was, means a keyboard user
   tabs onto a control they cannot see -- worse than not having one. */
.skip {
  position: absolute;
  left: var(--s-lg);
  top: -80px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s-lg);
  border-radius: var(--r-pill);
  background: var(--surface-high);
  border: 1px solid var(--primary);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip:focus-visible {
  top: var(--s-md);
}

/* --- site chrome ---------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.nav[data-scrolled='true'] {
  border-bottom-color: var(--line);
}
.nav__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-lg);
  height: 68px;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--s-xl);
  font-size: 14px;
}
/* 44pt is the floor on a touch screen, and a nav link that is 38 tall is a
   link people miss. Padding rather than height keeps the row visually the same. */
.nav__links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.nav__links a:hover,
.nav__links a:focus-visible {
  color: var(--text);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand__mark {
  display: block;
  width: 26px;
  height: 26px;
  flex: none;
}

.footer {
  border-top: 1px solid var(--line);
  padding: var(--s-3xl) 0 var(--s-2xl);
  margin-top: var(--s-5xl);
  color: var(--faint);
  font-size: 14px;
}
.footer a {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.footer a:hover,
.footer a:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-lg) var(--s-xl);
  align-items: baseline;
  justify-content: space-between;
}

/* --- buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-sm);
  min-height: 52px;
  padding: 0 var(--s-xl);
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn--primary {
  /* Same gradient and same white ink as the app's primary button, tuned so the
     label clears 4.5:1 at both stops rather than only at the deep end. */
  background: linear-gradient(135deg, var(--primary-button), var(--primary-deep));
  color: #fff;
  box-shadow: 0 10px 30px -12px rgba(124, 107, 245, 0.7);
}
.btn--primary:hover,
.btn--primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -14px rgba(124, 107, 245, 0.85);
}
.btn--quiet {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn--quiet:hover,
.btn--quiet:focus-visible {
  border-color: var(--primary);
  transform: translateY(-2px);
}

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

/* --- cards ---------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
}

/* --- reveal --------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* --- prose (legal pages) -------------------------------------------------- */

.prose {
  max-width: 68ch;
}
.prose h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  margin: var(--s-3xl) 0 var(--s-md);
}
.prose h3 {
  margin: var(--s-xl) 0 var(--s-sm);
}
.prose p,
.prose li {
  color: var(--muted);
  margin-bottom: var(--s-md);
}
.prose ul {
  padding-left: 1.2em;
  margin: 0 0 var(--s-lg);
}
.prose strong {
  color: var(--text);
  font-weight: 600;
}
.prose a {
  color: var(--violet);
  text-underline-offset: 3px;
}

/* --- motion --------------------------------------------------------------- */

/* WCAG 2.3.3. The app honours the same setting; a marketing page that ignores
   it while the product respects it would be saying two different things. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
