/*
Theme Name:   Upside Child
Theme URI:    https://uphrn.org
Description:  Child theme for Upside Health Research Network and Humanly AI. Carries the
              full design system as CSS custom properties. Light theme only — this is a
              deliberate single-theme commitment, do not add a dark mode.
Author:       Upside Health Research Network
Author URI:   https://uphrn.org
Template:     blocksy
Version:      1.0.0
Text Domain:  upside-child
*/

/* ---------------------------------------------------------------------------
   Design tokens
   ---------------------------------------------------------------------------
   Two brand systems live on one site and MUST stay visually distinct:

     Upside pages  (Home, Research, Training, About, Donate)
        -> magenta to purple   #DD418F  ->  #522B8A

     Humanly AI pages (/humanly-ai/ and its children)
        -> Ember gradient      #E87722  ->  #C0392B

   Never mix them. The body class set in functions.php swaps --brand-* per page,
   so components below can be written once and inherit the right brand.
--------------------------------------------------------------------------- */

:root {
  /* --- Neutrals (shared) --- */
  --warm-white:      #FBF8F4;
  --pure-white:      #FFFFFF;
  --near-black:      #2A2A2A;
  --body-text:       #3D3D3D;
  --muted-text:      #6B6B6B;
  --hairline:        #E8E2DA;

  /* --- Upside kit palette (from the official branding package) --- */
  --upside-yellow:   #E6CC15;
  --upside-orange:   #EC7F1F;
  --upside-magenta:  #DD418F;
  --upside-blue:     #2568AE;
  --upside-purple:   #522B8A;

  /* --- Humanly AI --- */
  --ember-orange:    #E87722;
  --ember-red:       #C0392B;

  /* --- Brand slots: default to Upside. Overridden on Humanly AI pages. --- */
  --brand-start:     var(--upside-magenta);
  --brand-end:       var(--upside-purple);
  --brand-solid:     var(--upside-purple);
  --brand-gradient:  linear-gradient(135deg, var(--brand-start) 0%, var(--brand-end) 100%);

  /* --- Type --- */
  --font-display:    'Montserrat', system-ui, -apple-system, sans-serif;
  --font-body:       'Open Sans', system-ui, -apple-system, sans-serif;

  --step--1:  clamp(0.875rem, 0.84rem + 0.18vw, 0.95rem);
  --step-0:   clamp(1rem, 0.96rem + 0.22vw, 1.125rem);
  --step-1:   clamp(1.25rem, 1.16rem + 0.45vw, 1.5rem);
  --step-2:   clamp(1.5rem, 1.33rem + 0.85vw, 2rem);
  --step-3:   clamp(1.875rem, 1.6rem + 1.4vw, 2.75rem);
  --step-4:   clamp(2.25rem, 1.8rem + 2.2vw, 3.75rem);

  /* --- Spacing / shape --- */
  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  2rem;
  --space-lg:  3.5rem;
  --space-xl:  6rem;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 2px 4px rgba(42,42,42,0.04), 0 12px 32px rgba(42,42,42,0.07);
  --measure:   68ch;
}

/* Humanly AI pages: swap the brand slots to Ember. Set by body_class filter. */
body.brand-humanly {
  --brand-start:    var(--ember-orange);
  --brand-end:      var(--ember-red);
  --brand-solid:    var(--ember-orange);
}

/* ---------------------------------------------------------------------------
   Base
--------------------------------------------------------------------------- */

body {
  background-color: var(--warm-white);
  color: var(--body-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--near-black);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 700;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p, li { max-width: var(--measure); }

a { color: var(--brand-solid); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-end); }

/* Focus visibility — accessibility, do not remove */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--brand-solid);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------------------
   Utilities
--------------------------------------------------------------------------- */

.u-band            { padding-block: var(--space-xl); }
.u-band--white     { background: var(--pure-white); }
.u-band--warm      { background: var(--warm-white); }
.u-shell           { width: min(1140px, 100% - 2.5rem); margin-inline: auto; }
.u-shell--narrow   { width: min(760px, 100% - 2.5rem); margin-inline: auto; }
.u-center          { text-align: center; }
.u-center p        { margin-inline: auto; }

/* Gradient headline highlight — the signature brand device */
.u-highlight {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Fallback for the rare browser without background-clip:text */
@supports not (background-clip: text) {
  .u-highlight { color: var(--brand-solid); background: none; }
}

.u-eyebrow {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brand-solid);
  margin-bottom: var(--space-xs);
}

.u-lede { font-size: var(--step-1); line-height: 1.55; color: var(--near-black); }

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */

.u-btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-0);
  padding: 0.85em 1.9em;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.u-btn--primary {
  background: var(--brand-gradient);
  color: #fff;
}
.u-btn--primary:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.u-btn--ghost {
  background: transparent;
  color: var(--brand-solid);
  border-color: var(--brand-solid);
}
.u-btn--ghost:hover { background: var(--brand-solid); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .u-btn { transition: none; }
  .u-btn--primary:hover { transform: none; }
}

/* ---------------------------------------------------------------------------
   Components
--------------------------------------------------------------------------- */

/* Stat tile — Research page */
.u-stats { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.u-stat {
  background: var(--pure-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-md);
  border-top: 4px solid var(--brand-solid);
}
.u-stat__figure {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 800;
  line-height: 1;
  background: var(--brand-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.u-stat__label { font-size: var(--step-0); color: var(--near-black); margin-top: var(--space-xs); font-weight: 600; }
.u-stat__note  { font-size: var(--step--1); color: var(--muted-text); margin-top: var(--space-xs); }
.u-stat__note a { color: var(--muted-text); }

/* Citation reference list + in-page anchor targets */
.u-refs { font-size: var(--step--1); color: var(--muted-text); }
.u-refs li { margin-bottom: var(--space-sm); max-width: none; }
.u-refs li:target { background: #FFF6E8; outline: 2px solid var(--upside-orange); outline-offset: 4px; border-radius: 3px; }
.u-cite { font-size: 0.75em; vertical-align: super; text-decoration: none; font-weight: 700; }

/* FAQ accordion — native <details>, no JavaScript */
.u-faq { border-top: 1px solid var(--hairline); }
.u-faq details { border-bottom: 1px solid var(--hairline); }
.u-faq summary {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--near-black);
  padding: var(--space-sm) 2.5rem var(--space-sm) 0;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.u-faq summary::-webkit-details-marker { display: none; }
.u-faq summary::after {
  content: '+';
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  font-size: 1.5em; font-weight: 400; color: var(--brand-solid);
}
.u-faq details[open] summary::after { content: '\2013'; }
.u-faq details > *:not(summary) { padding-bottom: var(--space-sm); }

/* Notify / email capture block */
.u-notify {
  background: var(--pure-white);
  border: 1px solid var(--hairline);
  border-left: 5px solid var(--brand-solid);
  border-radius: var(--radius);
  padding: var(--space-md);
}
.u-notify__disclosure { font-size: var(--step--1); color: var(--muted-text); margin-top: var(--space-sm); }

/* Full-width CTA band */
.u-cta {
  background: var(--brand-gradient);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
}
.u-cta h2, .u-cta p { color: #fff; }
.u-cta p { margin-inline: auto; }
.u-cta .u-btn { background: #fff; color: var(--brand-solid); }
.u-cta .u-btn:hover { background: var(--warm-white); color: var(--brand-end); }

/* Pull quote */
.u-quote {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.3;
  color: var(--near-black);
  border-left: 5px solid var(--brand-solid);
  padding-left: var(--space-md);
  margin-block: var(--space-lg);
  max-width: 42ch;
}

/* NBCC approval statement — must remain legible and unmodified in wording */
.u-nbcc {
  background: var(--pure-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  font-size: var(--step--1);
  color: var(--muted-text);
}
.u-nbcc img { max-width: 130px; height: auto; margin-bottom: var(--space-sm); }

/* Screen-reader-only */
.u-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
