/* =============================================================================
 * GHMM design tokens, expressed as a Bulma 1.0 theme.
 *
 * Bulma 1.0 is driven entirely by CSS custom properties, so the whole GHMM
 * palette, type scale and radius vocabulary can be configured here rather than
 * fought with `!important` further down the cascade. Anything Bulma already
 * models — button colours, control radii, input focus, title sizes — belongs in
 * this file as a `--bulma-*` value, not as a bespoke class in ghmm.css.
 *
 * Two things to know before editing:
 *
 *   1. Bulma splits every colour into hue / saturation / lightness so it can
 *      derive the light, dark, soft, bold and invert variants itself. Set the
 *      triplet, not the composed colour, or the variants stop tracking.
 *
 *   2. Component tokens (`--bulma-button-*`, `--bulma-input-*`, `--bulma-title-*`)
 *      are declared by Bulma on the component selector, not at `:root`, so a
 *      `:root` value for them is ignored. They are set on their own selectors at
 *      the bottom of this file — this stylesheet loads after Bulma, so equal
 *      specificity wins.
 *
 * The palette comes from the Bubble export's `settings.client_safe.color_tokens`
 * (docs/bubble/Ghmm Bubble.json), not from prose — docs/DESIGN_SYSTEM.md had the
 * primary button colours the wrong way round for a long time.
 * ========================================================================== */

:root {
  /* ===== BRAND PALETTE — the single source of truth ======================= */

  --ghmm-olive: #404A3C;   /* every primary button, dark bands, link colour   */
  --ghmm-orange: #EB5620;  /* brand · Happiest · icons · focus · button hover */
  --ghmm-teal: #7FACA1;    /* Greatest — has no token in Bubble, hard-coded   */
  --ghmm-yellow: #FBAA1A;  /* Most Motivated                                  */
  --ghmm-ink: #151814;     /* all text                                        */
  --ghmm-paper: #FFFAF8;   /* page background and every surface               */

  /* One digit off --ghmm-orange, and deliberately so: this is the exact value
     Bubble uses for the dashed goal-list border and its row separators. */
  --ghmm-dashed: #EB561F;

  --ghmm-orange-rgb: 235, 86, 32;
  --ghmm-ink-rgb: 21, 24, 20;

  /* ===== BULMA: TYPE ====================================================== */

  --bulma-family-primary: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bulma-family-secondary: 'Bodoni Moda', Georgia, 'Times New Roman', serif;

  /* Bubble's scale: H1 50, H2 40, H3 30, H4 25, H5 20, H6 18. The top three
     clamp down for narrow viewports; below that they are already small enough.

     These reach `.title` only because of the block near the bottom of this file
     that hands them over one by one. Bulma hardcodes `.title.is-1{font-size:3rem}`
     rather than reading --bulma-size-1, so setting the tokens alone leaves every
     heading in the app at Bulma's default — which is exactly what it did until
     17 Aug 2026. */
  --bulma-size-1: clamp(2.25rem, 6vw, 3.125rem);      /* 36 – 50px */
  --bulma-size-2: clamp(1.875rem, 4.5vw, 2.5rem);     /* 30 – 40px */
  --bulma-size-3: clamp(1.5rem, 3.5vw, 1.875rem);     /* 24 – 30px */
  --bulma-size-4: 1.5625rem;                          /* 25px */
  --bulma-size-5: 1.25rem;                            /* 20px */
  --bulma-size-6: 1.125rem;                           /* 18px */
  --bulma-size-7: 0.875rem;                           /* 14px */

  /* Above the scale, and deliberately outside it: the home page hero is 70px in
     Bubble, larger than anything in its own text styles, which stop at 50. It is
     one heading on one page, so it gets a token rather than a sixth heading
     level nothing else would use. */
  --ghmm-size-hero: clamp(2.5rem, 7vw, 4.375rem);     /* 40 – 70px */

  /* Optical size for the display serif. Bodoni Moda is a Didone: its `opsz`
     axis thins the hairlines as the size goes up, and `font-optical-sizing:
     auto` — the browser default — drives it automatically. At 48px that was a
     deliberate choice. At the 70px hero it collapses the thin strokes to
     literal hairlines, which on a Retina screen resolve to something close to
     invisible: the face reads spindly rather than elegant, and much lighter
     than the Amadine it stands in for.
     Pinning the axis low gives Bodoni's *text* cut drawn at display size —
     the same letterforms with strokes that survive. Lower is sturdier. */
  --ghmm-display-opsz: 11;

  --bulma-weight-normal: 400;
  --bulma-weight-medium: 500;
  --bulma-weight-semibold: 600;
  --bulma-weight-bold: 700;
  --bulma-weight-extrabold: 700;   /* Bubble never goes above 700 */

  --bulma-body-font-size: 1em;
  --bulma-body-weight: var(--bulma-weight-normal);
  /* Every text style in the Bubble export is line-height 1.4. */
  --bulma-body-line-height: 1.4;

  /* ===== BULMA: SCHEME ==================================================== */

  /* Hue and saturation drive Bulma's derived neutrals — borders, muted text,
     the alternate surfaces. Kept warm but low-saturation so those greys stay
     grey; the page colour itself is pinned to the brand value below rather than
     derived, because #FFFAF8 is too saturated to use as a scheme base. */
  --bulma-scheme-h: 17deg;
  --bulma-scheme-s: 20%;
  --bulma-scheme-main-l: 98.5%;
  --bulma-scheme-main: var(--ghmm-paper);
  --bulma-scheme-main-bis: var(--ghmm-paper);

  /* #151814 — much darker than Bulma's default text, so the strong/weak
     lightnesses have to come down with it or "strong" ends up lighter. */
  --bulma-text-h: 105deg;
  --bulma-text-s: 9%;
  --bulma-text-l: 9%;
  --bulma-text-strong-l: 5%;
  --bulma-text-title-l: 5%;
  --bulma-text-weak-l: 40%;

  /* ===== BULMA: COLOURS =================================================== */

  /* primary is the dark olive, because that is what the Bubble primary button
     is. Orange is the brand accent and the hover state, so it lands on link. */
  --bulma-primary-h: 103deg;
  --bulma-primary-s: 10%;
  --bulma-primary-l: 26%;
  /* The label colour, and the one token in this block that is NOT derived.
     Bulma computes the light/dark/soft/bold variants from the triplet above,
     but `-invert-l` is a constant it compiled against its own default palette —
     turquoise, which is light, so its label is near-black. Olive is dark, and
     without this it inherits that near-black label: 2.01:1 against the fill.
     Paper's lightness, so the label matches every other surface in the app. */
  --bulma-primary-invert-l: 98.5%;

  --bulma-link-h: 16deg;
  --bulma-link-s: 84%;
  --bulma-link-l: 52%;

  --bulma-success-h: 165deg;   /* Greatest */
  --bulma-success-s: 21%;
  --bulma-success-l: 59%;

  --bulma-warning-h: 38deg;    /* Most Motivated */
  --bulma-warning-s: 97%;
  --bulma-warning-l: 54%;

  --bulma-danger-h: 16deg;     /* Happiest — the same orange */
  --bulma-danger-s: 84%;
  --bulma-danger-l: 52%;

  --bulma-info-h: 103deg;      /* unused by the design; kept off the rainbow */
  --bulma-info-s: 10%;
  --bulma-info-l: 26%;

  --bulma-dark-h: 103deg;
  --bulma-dark-s: 10%;
  --bulma-dark-l: 26%;

  /* ===== BULMA: SHAPE ===================================================== */

  /* Bubble's radius vocabulary is 5 / 8 / 10 / 15 / 20. */
  --bulma-radius-small: 5px;
  --bulma-radius: 8px;
  --bulma-radius-medium: 10px;
  --bulma-radius-large: 15px;
  --bulma-radius-rounded: 9999px;

  /* Inputs sit at 5–8px in the original; buttons are visibly rounder. */
  --bulma-control-radius: 6px;
  --ghmm-radius-button: 10px;
  --ghmm-radius-card: 20px;      /* the goal card */
  --ghmm-radius-list: 10px;      /* the dashed goal-list container */

  /* ===== LEGACY GHMM TOKENS ==============================================
   * Aliases onto the palette above, kept so existing templates and stylesheets
   * keep working. New work should use the Bulma classes and the --ghmm-* names.
   * ====================================================================== */

  --color-primary: var(--ghmm-orange);
  --color-primary-rgb: var(--ghmm-orange-rgb);
  --color-primary-contrast: var(--ghmm-olive);

  --color-greatest: var(--ghmm-teal);
  --color-greatest-light: #D7E4DF;
  --color-happiest: var(--ghmm-orange);
  --color-motivated: var(--ghmm-yellow);

  /* --color-text-default is the name the Bubble-era markup uses and it was
     never declared — every `border: 2px dashed var(--color-text-default)` was
     therefore invalid at computed-value time and silently fell back to
     currentColor. Declaring it is a fix, not tidying. */
  --color-text-default: var(--ghmm-ink);
  --color-text-dark: var(--ghmm-ink);
  --color-text-dark-rgb: var(--ghmm-ink-rgb);
  --color-text-grey: rgba(var(--ghmm-ink-rgb), 0.6);
  --color-text-muted: rgba(var(--ghmm-ink-rgb), 0.55);
  --color-background: var(--ghmm-paper);
  --color-surface: var(--ghmm-paper);
  --color-border-light: rgba(var(--ghmm-ink-rgb), 0.15);

  --color-success: var(--ghmm-yellow);
  --color-destructive: #FF0000;

  --font-primary: var(--bulma-family-primary);
  --font-secondary: var(--bulma-family-secondary);

  --font-size-sm: 0.875rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;

  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-3xl: 4rem;

  --border-radius-sm: var(--bulma-radius-small);
  --border-radius-md: var(--bulma-radius);
  --border-radius-lg: var(--bulma-radius-medium);
  --border-radius-full: var(--bulma-radius-rounded);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  /* Bubble's button shadow, verbatim: a wide, very faint orange bloom. */
  --shadow-primary: 0 7px 30px -10px rgba(var(--ghmm-orange-rgb), 0.1);

  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-out;

  --z-modal: 1050;
}

/* =============================================================================
 * COMPONENT TOKENS
 *
 * Bulma declares these on the component selector, so they have to be set there
 * too. Same specificity, later in the cascade — no `!important` needed.
 * ========================================================================== */

/* Buttons — Bubble primary: olive fill, paper label, 600 weight, generous
   padding, a faint orange bloom rather than a hard drop shadow. */
.button {
  --bulma-button-weight: var(--bulma-weight-semibold);
  --bulma-button-padding-vertical: 0.75em;
  --bulma-button-padding-horizontal: 1.5em;
  --bulma-button-border-width: 2px;
  --bulma-button-outer-shadow-h: 16deg;
  --bulma-button-outer-shadow-s: 84%;
  --bulma-button-outer-shadow-l: 52%;
  --bulma-button-outer-shadow-a: 0.1;
  border-radius: var(--ghmm-radius-button);
}

/* The outline button, and the single most distinctive detail in the original:
   transparent, 2px dashed ink, hover to a faint orange wash. Replaces the
   inline `style="border: 2px dashed ..."` that was repeated across templates. */
.button.is-dashed {
  --bulma-button-border-style: dashed;
  --bulma-button-border-width: 2px;
  --bulma-button-outer-shadow-a: 0;
  background-color: transparent;
  border-color: var(--ghmm-ink);
  color: var(--ghmm-ink);
}

/* Hover only. This rule used to cover :focus as well, which meant a keyboard
   user landing on a dashed button saw exactly what a mouse user saw hovering
   one — an 8% wash and no ring at all. Focus is handled by the :focus-visible
   rule in ghmm.css, which applies to every control rather than just this one. */
.button.is-dashed:hover {
  background-color: rgba(var(--ghmm-orange-rgb), 0.08);
  border-color: var(--ghmm-ink);
  color: var(--ghmm-ink);
}

/* Controls — Bubble inputs are paper-filled with a hairline ink border that
   turns orange on hover as well as focus. */
.control,
.input,
.select,
.textarea {
  --bulma-input-radius: var(--bulma-control-radius);
  --bulma-input-border-color: rgba(var(--ghmm-ink-rgb), 0.15);
  --bulma-input-border-width: 1px;
  --bulma-input-placeholder-color: rgba(var(--ghmm-ink-rgb), 0.36);
  --bulma-input-focus-h: 16deg;
  --bulma-input-focus-s: 84%;
  --bulma-input-focus-l: 52%;
  --bulma-input-shadow: none;
}

.input:hover,
.textarea:hover,
.select select:hover {
  border-color: var(--ghmm-orange);
}

/* Titles — 1.4 line-height like everything else in the original, and 700
   rather than Bulma's 800, which Bubble never uses. */
.title,
.subtitle {
  --bulma-title-weight: var(--bulma-weight-bold);
  --bulma-title-line-height: 1.4;
  --bulma-subtitle-weight: var(--bulma-weight-normal);
  --bulma-subtitle-line-height: 1.4;
}

/* Hand the GHMM type scale to `.title`, one level at a time.
 *
 * Bulma 1.0 does **not** read --bulma-size-* here: it ships
 * `.title.is-1{font-size:3rem}` as a literal, so the scale above was authored,
 * documented and then ignored by every heading in the app. Two things were
 * wrong as a result — headings sat at Bulma's sizes rather than Bubble's, and
 * the clamp() never ran, so nothing scaled down on a phone.
 *
 * Same specificity as Bulma's own rule (0,2,0); this file loads after Bulma, so
 * it wins. That is the same mechanism the .button and .input blocks rely on.
 * The subtitle sizes are hardcoded by Bulma too, and are handed over here for
 * the same reason. */
.title.is-1, .subtitle.is-1 { font-size: var(--bulma-size-1); }
.title.is-2, .subtitle.is-2 { font-size: var(--bulma-size-2); }
.title.is-3, .subtitle.is-3 { font-size: var(--bulma-size-3); }
.title.is-4, .subtitle.is-4 { font-size: var(--bulma-size-4); }
.title.is-5, .subtitle.is-5 { font-size: var(--bulma-size-5); }
.title.is-6, .subtitle.is-6 { font-size: var(--bulma-size-6); }
.title.is-7, .subtitle.is-7 { font-size: var(--bulma-size-7); }

/* The one heading above the scale — see --ghmm-size-hero. */
.title.is-hero {
  font-size: var(--ghmm-size-hero);
}

/* The display serif is reserved for page and section titles. In the Bubble
   export exactly one style — Text_heading_1_ — carries Amadine; every other
   heading is the body face at 700. .title.is-1 covers the page title; add
   .is-display where a section heading needs the serif at a smaller size, which
   is what the marketing bands do. */
.title.is-1,
.title.is-hero,
.title.is-display {
  font-family: var(--bulma-family-secondary);
  font-weight: var(--bulma-weight-normal);
  letter-spacing: 0.01em;
  /* Overrides font-optical-sizing: auto — see --ghmm-display-opsz. Without
     this the hero's hairlines all but disappear at 2x. */
  font-variation-settings: 'opsz' var(--ghmm-display-opsz);
}

/* Modals — radius 5, paper surface, soft halo, and a properly dark scrim. */
.modal-card-head,
.modal-card-foot {
  --bulma-modal-card-head-background-color: var(--ghmm-paper);
  --bulma-modal-card-foot-background-color: var(--ghmm-paper);
}

.modal-card-body {
  --bulma-modal-card-body-background-color: var(--ghmm-paper);
}

.modal-background {
  background-color: rgba(0, 0, 0, 0.6);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
