/* ============================================================
   Nari — landing & support portal
   Tokens extracted from the iOS app:
   · backgrounds/text: OnboardingTheme.swift (#FAF9F6 / #000000 / #8E8E93)
   · phase pastels:    Phase+UI.swift  (#FF99B3 #FFE680 #99CCFF #99E699)
   · deep variants:    PhaseBlobView.swift (#FF8099 #F2CC33 #66B3FF #66CC80)
   · type system:      New York serif light headlines, SF Pro body
   ============================================================ */

:root {
  --bg: #FAF9F6;
  --bg-soft: #F2F2F7;
  --text: #000000;
  /* app token is #8E8E93; darkened to #6E6E73 for WCAG AA body contrast */
  --text-secondary: #6E6E73;
  --text-tertiary: #8E8E93;
  --hairline: rgba(0, 0, 0, 0.08);
  --surface: rgba(250, 249, 246, 0.72);
  --card: rgba(0, 0, 0, 0.025);
  --pill-inactive: #F2F2F7;
  --highlight: #EBEBEB;
  --btn-bg: #000000;
  --btn-fg: #ffffff;
  --focus-ring: rgba(0, 0, 0, 0.55);

  --menstrual: #FF99B3;  --menstrual-deep: #FF8099;
  --follicular: #FFE680; --follicular-deep: #F2CC33;
  --ovulation: #99CCFF;  --ovulation-deep: #66B3FF;
  --luteal: #99E699;     --luteal-deep: #66CC80;

  /* current phase (JS swaps these) */
  --phase: var(--ovulation);
  --phase-deep: var(--ovulation-deep);
  --ambient-opacity: 0.35;

  --font-serif: ui-serif, "New York", "Iowan Old Style", "Playfair Display", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-soft: #0A0A0A;
  --text: #ffffff;
  --text-secondary: #A1A1A6;
  --text-tertiary: #8E8E93;
  --hairline: rgba(255, 255, 255, 0.12);
  --surface: rgba(0, 0, 0, 0.6);
  --card: rgba(255, 255, 255, 0.045);
  --pill-inactive: #151515;
  --highlight: #262626;
  --btn-bg: #ffffff;
  --btn-fg: #000000;
  --focus-ring: rgba(255, 255, 255, 0.7);
  --ambient-opacity: 0.22;
}

/* ---------- base ---------- */

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
  overflow-x: hidden;
}

::selection { background: var(--phase); color: #000; }

a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 0.6rem 1.2rem;
  border-radius: 0 0 12px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1.25rem, 5vw, 3rem);
  background: var(--surface);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--hairline);
  transition: background-color 0.5s var(--ease), border-color 0.5s var(--ease);
}

.logo {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
}

.site-header nav a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.site-header nav a:hover { color: var(--text); }

.site-header nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--text);
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.theme-toggle:hover { background: var(--highlight); }
.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

/* ---------- ambient orbs ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  transition: background 1s var(--ease), opacity 0.8s var(--ease);
}

.orb-1 {
  top: -15vmax;
  right: -10vmax;
  width: 55vmax;
  height: 55vmax;
  background: radial-gradient(circle at 42% 40%,
    var(--phase-deep) 0%,
    var(--phase) 45%,
    transparent 72%);
  opacity: var(--ambient-opacity);
  animation: drift-1 24s ease-in-out infinite alternate;
}

.orb-2 {
  bottom: -15vmax;
  left: -12vmax;
  width: 50vmax;
  height: 50vmax;
  background: radial-gradient(circle at 55% 55%,
    var(--phase) 0%,
    var(--phase-deep) 50%,
    transparent 75%);
  opacity: calc(var(--ambient-opacity) * 0.7);
  animation: drift-2 28s ease-in-out infinite alternate-reverse;
}

@keyframes drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-6vmax, 6vmax) scale(1.1); }
}

@keyframes drift-2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(7vmax, -5vmax) scale(1.15); }
}

/* ---------- layout & routing ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 3rem);
}

.route {
  padding: clamp(3rem, 8vh, 6rem) 0 4rem;
  animation: route-in 0.5s var(--ease) both;
}

.route.route-leaving {
  animation: route-out 0.22s var(--ease) both;
}

@keyframes route-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes route-out {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ---------- hero ---------- */

.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}

.hero-visual {
  position: relative;
  width: clamp(200px, 40vw, 300px);
  aspect-ratio: 1;
  margin: 0 auto 0.5rem;
  display: grid;
  place-items: center;
}

.hero-orb {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    var(--phase-deep) 0%,
    var(--phase) 48%,
    transparent 74%);
  filter: blur(26px);
  opacity: 0.85;
  transition: background 0.9s var(--ease);
  animation: breathe 5.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.07); }
}

.moth {
  position: relative;
  z-index: 1;
  width: 64%;
  height: 64%;
  animation: hover-float 7s ease-in-out infinite;
}

@keyframes hover-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.moth-lines path, .moth-lines ellipse {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
  transition: stroke 0.5s var(--ease);
}
.moth-body { fill: var(--text); opacity: 0.85; }
.moth-spots circle {
  fill: var(--phase-deep);
  transition: fill 0.9s var(--ease);
}

.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-secondary);
  font-weight: 500;
}

h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.lede {
  max-width: 34rem;
  color: var(--text-secondary);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  height: 54px;                /* app: largeButtonHeight */
  padding: 0 1.7rem;
  border-radius: 27px;         /* app: buttonCornerRadius */
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease),
              background-color 0.5s var(--ease), color 0.5s var(--ease);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary[disabled] { opacity: 0.5; cursor: default; transform: none; }

/* pre-launch App Store badge: not a link until the app is live */
.btn.is-soon {
  cursor: default;
  opacity: 0.55;
  user-select: none;
}
.btn.is-soon:hover,
.btn.is-soon:active { transform: none; }

.btn-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-ghost {
  background: var(--pill-inactive);
  color: var(--text);
}
.btn-ghost:hover { background: var(--highlight); }

.btn-block { width: 100%; }

.apple-mark { width: 18px; height: 18px; fill: currentColor; }

.text-link {
  color: var(--text);
  font-size: 0.92rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--text-tertiary);
  transition: text-decoration-color 0.3s var(--ease);
}
.text-link:hover { text-decoration-color: var(--text); }

/* ---------- partner mode ---------- */

.partner {
  margin-top: clamp(4rem, 10vh, 7rem);
  text-align: center;
}

.section-title {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.2;
}

.section-sub {
  color: var(--text-secondary);
  margin-top: 0.6rem;
  margin-bottom: 2.4rem;
  font-size: 0.95rem;
}

.partner-demo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.2rem;
  align-items: stretch;
  text-align: left;
  max-width: 880px;
  margin: 0 auto;
}

.demo-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  padding: 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: border-color 0.4s var(--ease), background-color 0.5s var(--ease);
}

.demo-partner { border-color: color-mix(in srgb, var(--phase) 45%, var(--hairline)); }

.demo-card-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-tertiary);
}

/* sharing goals */

.goal-list { display: flex; flex-direction: column; gap: 0.6rem; }

.goal-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.goal-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.goal-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: var(--bg);
  transition: border-color 0.3s var(--ease), background-color 0.4s var(--ease),
              box-shadow 0.3s var(--ease);
}
.goal-option:hover .goal-body { border-color: var(--text-tertiary); }

.goal-option input:checked + .goal-body {
  border-color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--phase) 45%, transparent);
}
.goal-option input:focus-visible + .goal-body { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.goal-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.goal-level {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--pill-inactive);
}
.goal-option input:checked + .goal-body .goal-level { background: var(--phase); color: #000; }

.goal-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* lock divider */

.demo-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-tertiary);
  font-size: 0.68rem;
  line-height: 1.5;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 0.4rem;
}

.demo-link .lock {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* partner card rows */

.partner-rows { display: flex; flex-direction: column; }

.p-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.95rem;
}
.p-row:last-child { border-bottom: none; }

.p-label {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.p-value {
  text-align: right;
  color: var(--text);
  transition: filter 0.4s var(--ease), opacity 0.4s var(--ease);
}

.p-tip {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.p-tip .p-value {
  text-align: left;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.98rem;
}

.p-row.is-hidden .p-value,
.p-row.is-hidden .phase-chip {
  filter: blur(5px);
  opacity: 0.4;
  user-select: none;
  pointer-events: none;
}
.p-row.is-hidden .p-label::after { content: " · not shared"; letter-spacing: 0.05em; }
.p-row.is-hidden .p-value { white-space: nowrap; overflow: hidden; text-overflow: clip; min-width: 0; }

.phase-chip {
  appearance: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  color: #000;
  background: var(--phase);
  transition: background-color 0.6s var(--ease), transform 0.3s var(--ease),
              filter 0.4s var(--ease), opacity 0.4s var(--ease);
}
.phase-chip:hover { transform: scale(1.05); }

.goal-footnote {
  margin-top: auto;
  padding-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-tertiary);
}

.partner-note {
  margin-top: 1.8rem;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- features ---------- */

.features {
  margin-top: clamp(4rem, 10vh, 7rem);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.4rem;
  border-top: 1px solid var(--hairline);
  padding-top: 3rem;
}

.feature h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.25rem;
  margin-bottom: 0.6rem;
}

.feature p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.7rem;
}

.disclaimer {
  margin-top: 4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-align: center;
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- prose (privacy) ---------- */

.prose {
  max-width: 42rem;
  margin: 0 auto;
}

.prose h1 {
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  margin: 0.6rem 0 0.4rem;
}

.doc-meta {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-bottom: 2.6rem;
}

.prose h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.45rem;
  margin: 2.4rem 0 0.7rem;
}

.prose p, .prose li {
  color: var(--text-secondary);
  font-size: 0.98rem;
}

.prose ul {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.prose strong { color: var(--text); font-weight: 600; }

/* ---------- support ---------- */

.support-head { text-align: center; margin-bottom: 3rem; }

.support-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.section-title-left {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.5rem;
  margin-bottom: 1.4rem;
}

/* FAQ accordion */

.faq-item { border-bottom: 1px solid var(--hairline); }
.faq-item:first-of-type { border-top: 1px solid var(--hairline); }

.faq-q {
  appearance: none;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  width: 100%;
  text-align: left;
  padding: 1.1rem 0.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-chevron {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 1.6px solid var(--text-tertiary);
  border-bottom: 1.6px solid var(--text-tertiary);
  transform: rotate(45deg);
  transition: transform 0.35s var(--ease);
}

.faq-q[aria-expanded="true"] .faq-chevron { transform: rotate(225deg); }

.faq-a {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.45s var(--ease);
}

.faq-a p {
  color: var(--text-secondary);
  font-size: 0.93rem;
  padding: 0 0.2rem 1.2rem;
}

/* contact */

.contact {
  position: relative;
  overflow: hidden;
  align-self: start;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  padding: clamp(1.8rem, 4vw, 2.6rem) clamp(1.4rem, 3.5vw, 2.4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.1rem;
}

/* soft phase light behind the card, echoing the hero orb */
.contact::before {
  content: "";
  position: absolute;
  top: -35%;
  left: 50%;
  width: 80%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--phase) 55%, transparent), transparent 70%);
  opacity: 0.5;
  filter: blur(30px);
  pointer-events: none;
}

.contact > * { position: relative; }

.contact-visual {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
}

.contact-orb {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--phase-deep), var(--phase) 55%, transparent 80%);
  filter: blur(6px);
  animation: breathe 4s ease-in-out infinite;
}

.contact-icon {
  position: relative;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #000;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-title { margin-bottom: 0; }

.contact-email {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.3s var(--ease);
}
.contact-email:hover { border-bottom-color: var(--text); }

#copy-email { width: 100%; max-width: 20rem; height: 50px; margin-top: 0.3rem; }
#copy-email .icon-check { display: none; }
#copy-email.is-copied { background: var(--phase); color: #000; }
#copy-email.is-copied .icon-copy { display: none; }
#copy-email.is-copied .icon-check { display: block; animation: pop 0.35s var(--ease); }

@keyframes pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- footer ---------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 1.6rem clamp(1.25rem, 5vw, 3rem) 2.2rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

.site-footer nav { display: flex; gap: 1.4rem; }
.site-footer a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.3s var(--ease);
}
.site-footer a:hover { color: var(--text); }

/* ---------- responsive ---------- */

@media (max-width: 880px) {
  .support-grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; gap: 2rem; }
  .partner-demo { grid-template-columns: 1fr; }
  .demo-link { flex-direction: row; padding: 0.2rem 0; }
  .demo-link br { display: none; }
}

@media (max-width: 560px) {
  .site-header nav a { font-size: 0.82rem; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; }
  .site-footer { flex-direction: column; gap: 0.8rem; }
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .orb, .hero-orb, .moth, .contact-orb { animation: none; }
}
