/* SayMorph look for template routes (pricing, auth, settings, blog).
   Loaded unlayered after globals.css, so these win over the template's
   @layer base tokens (including [data-theme] brand presets). The html
   element gets .sm-tpl on every non-admin template route; the theme is
   forced light there, so no .dark overrides are needed. */
html.sm-tpl {
  color-scheme: light;
  --background: #F5F2EA;
  --foreground: #242420;
  --card: #FFFFFF;
  --card-foreground: #242420;
  --popover: #FFFFFF;
  --popover-foreground: #242420;
  --primary: #C73D29;
  --primary-foreground: #FFFFFF;
  --secondary: #F2F0E9;
  --secondary-foreground: #242420;
  --muted: #F2F0E9;
  --muted-foreground: #66635C;
  --accent: #FCECE7;
  --accent-foreground: #242420;
  --destructive: #A52B1C;
  --destructive-foreground: #A52B1C;
  --border: #D8D3C9;
  --input: #918A7E;
  --ring: #C73D29;
  --sidebar: #FFFFFF;
  --sidebar-foreground: #242420;
  --sidebar-primary: #C73D29;
  --sidebar-primary-foreground: #FFFFFF;
  --sidebar-accent: #FCECE7;
  --sidebar-accent-foreground: #242420;
  --sidebar-border: #D8D3C9;
  --sidebar-ring: #C73D29;
  --font-sans: 'DM Sans', Arial, Helvetica;
  --font-serif-display: 'DM Sans', Arial, Helvetica;
}

html.sm-tpl body {
  background: #F5F2EA;
  color: #242420;
  font-family: 'DM Sans', Arial, Helvetica, sans-serif;
}

/* Template headings use .font-serif (Libre Baskerville). Home headings are
   DM Sans 700 with tight tracking, so match that. */
html.sm-tpl .font-serif {
  font-family: 'DM Sans', Arial, Helvetica, sans-serif;
  font-style: normal;
}
html.sm-tpl :is(h1, h2, h3).font-serif,
html.sm-tpl :is(h1, h2, h3) .font-serif {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Hover for solid primary buttons follows the homepage action hover. */
html.sm-tpl :is(button, a).bg-primary:hover {
  background-color: #AD3120;
}

/* Auth pages: brand logo above the card. */
html.sm-tpl .sm-auth-brand {
  display: inline-flex;
}
html.sm-tpl .sm-auth-brand img {
  display: block;
  width: var(--sm-logo-width, 184px);
  height: auto;
}

/* Sonner toasts: keep text dark on white in the fixed light theme. */
html.sm-tpl [data-sonner-toaster] [data-sonner-toast] {
  background: #FFFFFF;
  color: #242420;
  border-color: #D8D3C9;
  font-family: 'DM Sans', Arial, Helvetica, sans-serif;
}
html.sm-tpl [data-sonner-toaster] [data-sonner-toast] [data-description] {
  color: #66635C;
}

/* D4 review fixes */
/* Auth pages paint bg-muted full-screen; use the home paper instead. */
html.sm-tpl .sm-auth-page {
  background: var(--background);
}
/* Home h1/h2 are DM Sans 700; template h1/h2 use 500-600. */
html.sm-tpl :is(h1, h2) {
  font-weight: 700;
}
/* Solid primary buttons: the 50% ring blends into the fill, so add a
   full-strength outline for keyboard focus. */
html.sm-tpl :is(button, a).bg-primary:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

/* B3: page typography and surfaces use the homepage scale and controls.
   Structural selectors reuse existing markup; settings layouts stay intact. */
html.sm-tpl #pricing {
  /* SmHeader already draws the inset divider, as on the homepage. */
  border-top: 0;
}
html.sm-tpl :is(#pricing, main > .max-w-5xl, main > article) h1 {
  font-family: 'DM Sans', Arial, Helvetica, sans-serif;
  font-size: 54px;
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

/* Pricing group toggle: activeGroup already supplies .bg-background. */
html.sm-tpl #pricing .inline-flex.rounded-full.border:not(button) {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}
html.sm-tpl #pricing .inline-flex.rounded-full.border:not(button) > button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-foreground);
  box-shadow: none;
}
html.sm-tpl #pricing .inline-flex.rounded-full.border:not(button) > button:hover,
html.sm-tpl #pricing .inline-flex.rounded-full.border:not(button) > button.bg-background {
  border-color: var(--primary);
  background: var(--accent);
  color: var(--destructive);
}
html.sm-tpl #pricing .grid > .border {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
}
html.sm-tpl #pricing .grid > .border.ring-1 {
  border-color: var(--primary);
}
html.sm-tpl #pricing .grid > .border > button {
  height: 48px;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: none;
}

/* Blog cards keep metadata muted; only the linked title is accented. */
html.sm-tpl main a.group.border {
  background: var(--card);
  border-color: var(--border);
  border-radius: 9px;
  box-shadow: none;
}
html.sm-tpl main a.group.border:hover {
  border-color: var(--primary);
  box-shadow: none;
}
html.sm-tpl main a.group.border h3,
html.sm-tpl main > article a,
html.sm-tpl main > .max-w-5xl > .text-center a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
html.sm-tpl main > article > img {
  border-radius: 9px;
}

html.sm-tpl .sm-auth-page [data-slot='card'] {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: none;
}
html.sm-tpl .sm-auth-page :is([data-slot='input'], [data-slot='button']) {
  border-radius: 10px;
  box-shadow: none;
}

html.sm-tpl .sm-auth-page :is([data-slot='input'], [data-slot='button']):focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  html.sm-tpl :is(#pricing, main > .max-w-5xl, main > article) h1 {
    font-size: 44px;
  }
  html.sm-tpl #pricing .inline-flex.rounded-full.border:not(button) > button {
    min-height: 44px;
  }
}
@media (max-width: 767px) {
  html.sm-tpl .sm-auth-brand img {
    width: var(--sm-logo-width-mobile, 143px);
  }
  html.sm-tpl :is(#pricing, main > .max-w-5xl, main > article) h1 {
    font-size: 36px;
  }
}
@media (max-width: 359px) {
  html.sm-tpl .sm-auth-brand img {
    width: 128px;
  }
  html.sm-tpl :is(#pricing, main > .max-w-5xl, main > article) h1 {
    font-size: 31px;
  }
}

/* Round 3 C3: sign-in renders inside the site header/footer; the page logo is redundant there. */
html.sm-tpl .sm-auth-with-chrome .sm-auth-page { flex: 1 0 auto; min-height: auto; padding-block: 56px 72px; }
html.sm-tpl .sm-auth-with-chrome .sm-auth-brand { display: none; }
html.sm-tpl .sm-auth-page [data-slot='card'] { border-radius: 8px; }
@media (max-width: 767px) {
  html.sm-tpl .sm-auth-with-chrome .sm-auth-page { padding: 32px 16px 48px; }
}
