/* CoHabby shared design system — r1
   Loaded AFTER each page's inline <style> so these rules win ties.
   Scope: tokens, nav, footer, buttons, cards, section rhythm, utilities.
   Base element selectors are kept minimal so legacy inline page styles
   keep working; everything else is class-scoped. */

:root {
  /* Brand (Direction A — Warm Anchor, founder-final) */
  --coral: #FF6B4A;
  --coral-deep: #E85A3A;
  --amber: #FFB347;
  --aqua: #4ECDC4;
  --teal: #00A699;
  --teal-deep: #00867C;
  --gradient-hero: linear-gradient(135deg, #FF6B4A 0%, #FFB347 35%, #4ECDC4 65%, #00A699 100%);

  /* Warm neutrals */
  --ink: #201714;
  --ink-soft: #4A3F39;
  --muted: #6E625C;
  --faint: #A6988F;
  --dusk: #221712;
  --paper: #FFF9F8;
  --white: #FFFFFF;
  --border: #F0E4DF;
  --border-strong: #E3D2CA;

  /* Legacy aliases (used by pre-redesign inline styles) */
  --primary: #FF6B4A;
  --primary-dark: #E85A3A;
  --secondary: #00A699;
  --text-primary: #201714;
  --text-secondary: #6E625C;
  --bg-cream: #FFF9F8;
  --bg-white: #FFFFFF;
  --bg-subtle: #FAF4F1;

  /* Type */
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: clamp(2.6rem, 6.5vw, 4.9rem);
  --h2: clamp(1.9rem, 3.6vw, 2.8rem);
  --h3: 1.3rem;
  --body: 1.0625rem;

  /* Rhythm */
  --space-section: clamp(72px, 10vw, 128px);
  --space-gutter: 24px;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow-card: 0 2px 8px rgba(32, 23, 20, 0.05), 0 12px 32px rgba(32, 23, 20, 0.07);
  --shadow-lift: 0 4px 12px rgba(32, 23, 20, 0.08), 0 20px 48px rgba(32, 23, 20, 0.12);
}

body { font-family: var(--font); }

/* ---------- Utilities ---------- */
.s-container { max-width: 1180px; margin: 0 auto; padding: 0 var(--space-gutter); }
.s-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 14px;
}
.s-h2 {
  font-size: var(--h2);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--ink);
  margin: 0 0 14px;
}
.s-lede {
  font-size: var(--body);
  line-height: 1.65;
  color: var(--muted);
  max-width: 560px;
  margin: 0;
}
.s-section { padding: var(--space-section) var(--space-gutter); }
.s-grad-text {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Scroll reveal (pairs with IntersectionObserver adding .visible).
   Hidden state only applies when JS marked <html class="js">, so content
   is never lost if scripts fail. */
.js .animate-on-scroll { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .animate-on-scroll.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll { opacity: 1; transform: none; transition: none; }
  .s-btn, .s-card { transition: none !important; }
}

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Buttons ---------- */
.s-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  padding: 16px 30px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.s-btn svg { width: 19px; height: 19px; flex: none; }
.s-btn--primary {
  color: #fff;
  background: linear-gradient(120deg, var(--coral) 0%, var(--coral-deep) 100%);
  box-shadow: 0 6px 20px rgba(255, 107, 74, 0.35);
}
.s-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(255, 107, 74, 0.45); }
.s-btn--ghost {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}
.s-btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.s-btn--light { color: var(--ink); background: #fff; box-shadow: 0 6px 20px rgba(32, 23, 20, 0.18); }
.s-btn--light:hover { transform: translateY(-2px); }

/* ---------- Cards ---------- */
.s-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.s-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); border-color: var(--border-strong); }
.s-card h3 { font-size: var(--h3); font-weight: 650; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 8px; }
.s-card p { font-size: 0.95rem; line-height: 1.6; color: var(--muted); margin: 0; }

/* ---------- Nav ---------- */
nav.s-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 249, 248, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(240, 228, 223, 0.7);
}
.s-nav .nav-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-gutter);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.s-nav .nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.s-nav .nav-logo img { border-radius: 9px; }
.s-nav .nav-logo .logo-co { color: var(--coral); }
.s-nav .nav-logo .logo-habby { color: var(--teal-deep); }
.s-nav .nav-links { display: flex; align-items: center; gap: 26px; }
.s-nav .nav-links > a {
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s ease;
}
.s-nav .nav-links > a:hover { color: var(--coral-deep); }
.s-nav .nav-cta {
  color: #fff !important;
  font-weight: 600 !important;
  white-space: nowrap;
  flex: none;
  background: linear-gradient(120deg, var(--coral), var(--coral-deep));
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(255, 107, 74, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.s-nav .nav-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 107, 74, 0.4); }
@media (max-width: 860px) {
  .s-nav .nav-links > a:not(.nav-cta) { display: none; }
}
@media (max-width: 480px) {
  /* Give the wordmark and the CTA breathing room on phones — at 360px they
     were touching. Trim the logo mark + wordmark and the CTA in step. */
  .s-nav .nav-logo { font-size: 1rem; gap: 7px; }
  .s-nav .nav-logo img { width: 30px; height: 30px; }
  .s-nav .nav-cta { padding: 8px 12px; font-size: 0.8rem; }
}

/* ---------- Footer ---------- */
footer.s-footer {
  background: var(--dusk);
  color: #CBBBB2;
  padding: 72px var(--space-gutter) 36px;
  font-size: 0.9rem;
}
.s-footer .footer-container { max-width: 1180px; margin: 0 auto; }
.s-footer .footer-top {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, 1fr);
  gap: 36px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(203, 187, 178, 0.16);
}
@media (max-width: 1024px) { .s-footer .footer-top { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .s-footer .footer-top { grid-template-columns: repeat(2, 1fr); } }
.s-footer .footer-brand { grid-column: span 1; }
@media (max-width: 1024px) { .s-footer .footer-brand { grid-column: 1 / -1; } }
.s-footer .footer-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: #fff; margin-bottom: 12px; }
.s-footer .footer-logo img { border-radius: 9px; }
.s-footer .footer-tagline { color: #A6988F; line-height: 1.6; max-width: 240px; }
.s-footer .footer-column h4 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 14px;
}
.s-footer .footer-column ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.s-footer .footer-column a { color: #CBBBB2; text-decoration: none; transition: color 0.15s ease; }
.s-footer .footer-column a:hover { color: #fff; }
.s-footer .footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
}
.s-footer .footer-maker-row {
  display: flex;
  flex-basis: 100%;
  justify-content: flex-end;
}
.s-footer .footer-maker {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  box-sizing: border-box;
  width: min(100%, 520px);
  min-height: 96px;
  margin: 8px 0 10px;
  padding: 20px 22px 20px 26px;
  color: #fff;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(120deg, #2A1C17, #172526) padding-box,
    linear-gradient(110deg, rgba(255, 179, 71, 0.78), rgba(78, 205, 196, 0.64) 62%, rgba(255, 107, 74, 0.72)) border-box;
  box-shadow: 0 18px 48px rgba(8, 19, 22, 0.2);
}
.s-footer .footer-maker::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--aqua), var(--amber));
}
.s-footer .footer-maker-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.s-footer .footer-maker-label {
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  line-height: 1.4;
  text-transform: uppercase;
}
.s-footer .footer-maker-services {
  color: #CBBBB2;
  font-size: 0.84rem;
  line-height: 1.5;
}
.s-footer .footer-maker-brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 20px;
  padding-left: 24px;
  border-left: 1px solid rgba(78, 205, 196, 0.2);
}
.s-footer .footer-maker-brand img {
  display: block;
  width: 96px;
  height: 41px;
  object-fit: contain;
}
.s-footer .footer-maker-arrow {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--aqua);
  font-size: 1rem;
  line-height: 1;
  border: 1px solid rgba(78, 205, 196, 0.45);
  border-radius: 50%;
}
.s-footer .footer-maker:hover {
  box-shadow: 0 20px 56px rgba(0, 166, 153, 0.17);
}
.s-footer .footer-maker:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}
.s-footer .footer-copyright { color: #8A7A70; margin: 0; }
.s-footer .footer-legal { display: flex; gap: 18px; }
.s-footer .footer-legal a { color: #8A7A70; text-decoration: none; }
.s-footer .footer-legal a:hover { color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .s-footer .footer-maker {
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 180ms ease;
  }
  .s-footer .footer-maker:hover { transform: translateY(-2px); }
}
@media (max-width: 640px) {
  .s-footer .footer-maker {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    padding: 20px;
  }
  .s-footer .footer-maker-brand {
    justify-content: space-between;
    padding: 16px 0 0;
    border-top: 1px solid rgba(78, 205, 196, 0.2);
    border-left: 0;
  }
}

/* ---------- Store buttons (App Store / Google Play) ---------- */
.s-store {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.s-store:hover { transform: translateY(-1px); opacity: 0.92; }
.s-store svg { width: 22px; height: 22px; }
.s-store .store-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.s-store .store-kicker { font-size: 0.62rem; font-weight: 400; opacity: 0.8; }
.s-store .store-name { font-size: 0.95rem; font-weight: 600; }
.s-store--light { background: #fff; color: var(--ink); }

/* ---------- SERP answer block (featured-snippet capture) ----------
   Scannable answer in the first screen of SEO pages. Loaded after each
   page's own stylesheet, so these class-scoped rules win. Variants:
   default (list/definition), --verdict (one-line callout above a table). */
.serp-answer {
  margin: 22px 0 30px;
  padding: 20px 22px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-left: 4px solid var(--coral);
  border-radius: 14px;
}
.serp-answer > :first-child { margin-top: 0; }
.serp-answer > :last-child { margin-bottom: 0; }
.serp-answer-label {
  display: block;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--teal-deep); margin-bottom: 9px;
}
.serp-answer h2, .serp-answer h3 { font-size: 1.15rem; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.serp-answer p { margin: 0 0 10px; line-height: 1.6; color: var(--ink-soft); }
.serp-answer ol, .serp-answer ul { margin: 8px 0 0; padding-left: 1.35em; }
.serp-answer li { margin-bottom: 8px; line-height: 1.55; color: var(--ink-soft); }
.serp-answer li:last-child { margin-bottom: 0; }
.serp-answer li strong { color: var(--ink); font-weight: 650; }
.serp-answer a { color: var(--coral-deep); font-weight: 600; text-decoration: none; }
.serp-answer a:hover { text-decoration: underline; }
.serp-answer--verdict { border-left-color: var(--teal); }
.serp-answer--verdict p { font-size: 1.02rem; color: var(--ink); }

/* ---------- Synergy demo widget (.sv-*) ----------
   Portable internals for the interactive Synergy Score demo, shared by the
   homepage hero and the mid-page .synergy-embed on landing pages. The
   homepage keeps its hero-specific .sv-card (glass) inline; here .sv-card is
   only styled inside .synergy-embed. Rules copied verbatim from the homepage
   so it renders identically. */
.sv-header { display: flex; flex-direction: column; gap: 3px; margin-bottom: 20px; }
.sv-title { font-weight: 650; font-size: 1.05rem; letter-spacing: -0.01em; }
.sv-sub { font-size: 0.82rem; color: var(--muted); }
.sv-body { display: grid; grid-template-columns: auto 1fr; gap: 8px 22px; align-items: center; }
.sv-score { position: relative; width: 118px; height: 118px; grid-row: span 2; }
.sv-score svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sv-ring-track { fill: none; stroke: var(--border); stroke-width: 9; }
.sv-ring-fill {
  fill: none;
  stroke: url(#sv-grad);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.sv-score-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; letter-spacing: -0.03em;
}
.sv-number { font-size: 2rem; font-variant-numeric: tabular-nums; }
.sv-percent { font-size: 1rem; color: var(--muted); margin-top: 6px; }
.sv-verdict { font-size: 0.88rem; font-weight: 600; color: var(--teal-deep); align-self: end; }
.sv-controls { display: grid; gap: 10px; align-self: start; }
.sv-row { display: grid; gap: 5px; }
.sv-row-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); }
.sv-chips { display: flex; gap: 8px; }
.sv-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 1 1 0; min-width: 0;
  font-family: var(--font);
  font-size: 0.85rem; font-weight: 550;
  color: var(--ink-soft);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.sv-chip-label { min-width: 0; }
.sv-chip:hover { border-color: var(--border-strong); }
.sv-chip:active { transform: scale(0.97); }
.sv-chip.is-on {
  border-color: var(--coral);
  background: rgba(255, 107, 74, 0.08);
  color: var(--ink);
}
.sv-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.sv-fine { font-size: 0.75rem; color: var(--faint); max-width: 17em; }
.sv-cta {
  flex: none;
  font-size: 0.88rem; font-weight: 650;
  color: var(--coral-deep);
  text-decoration: none;
  white-space: nowrap;
}
.sv-cta::after { content: ' →'; }
.sv-cta:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .sv-body { grid-template-columns: 1fr; gap: 20px; }
  .sv-score { grid-row: auto; margin: 0 auto; }
  .sv-verdict { align-self: auto; text-align: center; }
  .sv-controls { width: 100%; }
  .sv-foot { flex-direction: column; align-items: stretch; gap: 12px; text-align: center; }
  .sv-fine { max-width: none; }
}

/* Completion state — the conversion moment: the small link becomes a button. */
.sv-foot.is-complete { flex-direction: column; align-items: stretch; gap: 12px; text-align: center; }
.sv-foot.is-complete .sv-fine { max-width: none; order: 2; color: var(--ink-soft); font-size: 0.82rem; }
.sv-foot.is-complete .sv-cta {
  order: 1;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(120deg, var(--coral), var(--coral-deep));
  color: #fff;
  padding: 13px 22px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(255, 107, 74, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sv-foot.is-complete .sv-cta:hover { text-decoration: none; transform: translateY(-1px); }

/* ---------- Mid-page embed wrapper ---------- */
.synergy-embed { padding: clamp(40px, 6vw, 72px) var(--space-gutter); background: var(--paper); }
.synergy-embed-inner { max-width: 660px; margin: 0 auto; text-align: center; }
.synergy-embed-eyebrow {
  display: inline-block;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--teal-deep); margin-bottom: 10px;
}
.synergy-embed-title { font-size: clamp(1.5rem, 3vw, 2.05rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.12; color: var(--ink); margin: 0 0 8px; }
.synergy-embed-sub { font-size: 1rem; line-height: 1.55; color: var(--muted); margin: 0 auto 28px; max-width: 40em; }
.synergy-embed .sv-card {
  position: relative;
  isolation: isolate;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  text-align: left;
}
/* Breathing coral→teal glow behind the card. Only opacity animates
   (compositor-cheap, no repaint) and the box never changes size, so it can't
   overflow the viewport. Disabled under reduced-motion. */
.synergy-embed .sv-card::before {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--coral), var(--amber), var(--aqua), var(--teal));
  filter: blur(13px);
  opacity: 0.26;
  animation: sv-halo 5s ease-in-out infinite;
}
@keyframes sv-halo { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.34; } }
@media (prefers-reduced-motion: reduce) {
  .synergy-embed .sv-card::before { animation: none; }
}
/* Phones: the embed was over-containerized — a 24px section gutter plus 28px
   card padding stacked on each side ate ~27% of the width, squishing the
   widget into a skinny center column. Reclaim the horizontal space. Embed-only:
   the homepage hero uses its own inline .sv-card and never loads these rules. */
@media (max-width: 560px) {
  /* The embed already sits inside the article `.container` (24px gutter); its
     own horizontal padding was double-containment. Drop it so the card aligns
     to the same gutter as the body text, and trim the card's inner padding. */
  .synergy-embed { padding-left: 0; padding-right: 0; }
  /* When the embed is a top-level section (no article container to borrow a
     gutter from, e.g. best-roommate-app), give it its own so the card isn't
     flush to the screen edge. */
  body > .synergy-embed { padding-left: 16px; padding-right: 16px; }
  .synergy-embed .sv-card { padding: 20px 16px; max-width: none; }
}

/* Landing pages style `.article-body a` with an underline; keep the widget
   CTA clean (matches the homepage). Scoped so it beats `.article-body a`. */
.synergy-embed .sv-cta { text-decoration: none; }
.synergy-embed .sv-foot:not(.is-complete) .sv-cta:hover { text-decoration: underline; }
.synergy-embed .sv-foot.is-complete .sv-cta { color: #fff; }
