/* ============================================================================
   HomeClaw Design Tokens
   One brand, two rooms. Provider theme is dark; homeowner theme is light.
   The near-black + warm-cream pair swaps between them; the ember accent
   is shared. That inversion is the entire brand identity.
   ============================================================================ */

/* ---- Type ---------------------------------------------------------------- */
/* Fraunces  — variable serif. Warm optical curves for headlines; the SOFT
              axis gives us character without theatre.
   IBM Plex — Sans + Mono. Technical, professional, quietly unusual (the
              single-story a, the slab entries). Reads as engineering, not
              startup. The matched sans/mono pair keeps numbers and data
              in the same family as prose.

   Loaded from Google Fonts (no build step). Systems fonts fall back
   gracefully — the design still reads without the webfonts. */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..700,0..100;1,9..144,300..700,0..100&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

:root {
  /* ---- Colour: brand primitives --------------------------------------- */
  /* Two paired neutrals that invert between themes: warm near-black and
     warm cream. Nothing here is blue-tinted — trades and homes are warm,
     tech-neutral greys read cold and generic. */

  --hc-ink-950: #0F0E0D;   /* warm near-black — provider bg / homeowner fg */
  --hc-ink-900: #1A1816;
  --hc-ink-800: #24211F;
  --hc-ink-700: #3A3532;
  --hc-ink-500: #6B6058;
  --hc-ink-400: #8C837A;
  --hc-ink-300: #B4ACA3;
  --hc-ink-200: #D8CFC3;
  --hc-ink-100: #E4DCD0;
  --hc-cream-50: #F5F1EA;  /* warm cream — homeowner bg / provider fg */
  --hc-cream-00: #FFFDF9;  /* paper */

  /* Ember — the one shared accent. A cadmium-orange burn that reads as
     warmth (home) + intensity (work). Not neon, not brand-purple.
     Hex was tuned so ember-on-ink (5.77:1) and ink-on-ember (5.77:1)
     both pass WCAG AA normal. */

  --hc-ember: #E85D2A;
  --hc-ember-hover: #D14E1E;
  --hc-ember-tint: #F5B79A;      /* soft, for backgrounds/badges */

  /* Ember-as-text needs different values per theme to keep AA on body copy:
     on dark bg the ember lifts (F08557 → 5.31:1), on light bg it burns
     down (B7481B → 5.94:1). Same hue family — the eye reads one accent. */

  --hc-ember-text-on-dark: #F08557;
  --hc-ember-text-on-light: #B7481B;

  /* ---- Type scale ----------------------------------------------------- */
  /* Modular scale, ratio 1.25 (major third). Base 16px. Display sizes
     use the fraunces opsz axis so they get tighter and more precise as
     they get larger. */

  --hc-font-display: "Fraunces", "Iowan Old Style", "Palatino", "Georgia", serif;
  --hc-font-body: "IBM Plex Sans", "Helvetica Neue", "Segoe UI", "Roboto", sans-serif;
  --hc-font-mono: "IBM Plex Mono", "SF Mono", "Menlo", "Consolas", monospace;

  --hc-text-xs: 0.75rem;   /* 12 — mono labels, legal */
  --hc-text-sm: 0.875rem;  /* 14 — meta, captions */
  --hc-text-md: 1rem;      /* 16 — body */
  --hc-text-lg: 1.125rem;  /* 18 — lead body */
  --hc-text-xl: 1.375rem;  /* 22 — subhead */
  --hc-text-2xl: 1.75rem;  /* 28 — section title */
  --hc-text-3xl: 2.25rem;  /* 36 — page title */
  --hc-text-4xl: 3rem;     /* 48 — hero (mobile) */
  --hc-text-5xl: 4.25rem;  /* 68 — hero (desktop) */
  --hc-text-6xl: 6rem;     /* 96 — display, sparingly */

  --hc-lh-tight: 1.05;
  --hc-lh-snug: 1.2;
  --hc-lh-normal: 1.45;
  --hc-lh-body: 1.6;

  --hc-tracking-tight: -0.02em;
  --hc-tracking-normal: 0;
  --hc-tracking-wide: 0.08em;
  --hc-tracking-mono: 0.02em;

  /* ---- Spacing scale -------------------------------------------------- */
  /* Base unit 4px. Not a pure Fibonacci — spaced to be usable at every
     interaction distance without inflation. */

  --hc-space-1: 0.25rem;   /* 4  */
  --hc-space-2: 0.5rem;    /* 8  */
  --hc-space-3: 0.75rem;   /* 12 */
  --hc-space-4: 1rem;      /* 16 */
  --hc-space-5: 1.5rem;    /* 24 */
  --hc-space-6: 2rem;      /* 32 */
  --hc-space-7: 3rem;      /* 48 */
  --hc-space-8: 4rem;      /* 64 */
  --hc-space-9: 6rem;      /* 96 */
  --hc-space-10: 8rem;     /* 128 */
  --hc-space-11: 12rem;    /* 192 */

  /* ---- Radii ---------------------------------------------------------- */
  /* Trades don't need pillowy corners. Small, precise, occasionally sharp. */

  --hc-radius-1: 2px;      /* hairline chips */
  --hc-radius-2: 6px;      /* buttons, inputs, cards */
  --hc-radius-3: 12px;     /* large surfaces */
  --hc-radius-pill: 999px;

  /* ---- Elevation ------------------------------------------------------ */
  /* Prefer hairlines over shadows. When shadow is needed it is warm-tinted
     (ink, not blue-black) so it belongs to the palette. */

  --hc-shadow-0: none;
  --hc-shadow-1: 0 1px 0 0 rgba(15, 14, 13, 0.06);
  --hc-shadow-2: 0 4px 12px -2px rgba(15, 14, 13, 0.08),
                 0 1px 3px rgba(15, 14, 13, 0.06);
  --hc-shadow-3: 0 20px 48px -12px rgba(15, 14, 13, 0.18),
                 0 4px 12px rgba(15, 14, 13, 0.08);

  /* ---- Motion --------------------------------------------------------- */
  /* Sober. No bounce. Custom ease that settles rather than snaps.
     Anything faster than 120ms is invisible; anything past 400ms feels slow. */

  --hc-dur-fast: 120ms;
  --hc-dur-base: 200ms;
  --hc-dur-slow: 400ms;
  --hc-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --hc-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ---- Layout --------------------------------------------------------- */

  --hc-container: 1200px;
  --hc-container-narrow: 720px;
  --hc-hairline: 1px;
}

/* ============================================================================
   Themes
   ------
   Provider theme is dark cockpit; homeowner theme is light warm.
   Semantic tokens (--hc-bg / --hc-fg / …) are the ONLY things pages
   should read from. The primitives above are for defining tokens, not
   for use in components.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   ROOT DEFAULTS — the palette an element gets when no theme is declared.
   These are the LIGHT (homeowner) values, despite what this comment used to
   claim; nothing here has ever set the dark palette.

   ORDER IS LOAD-BEARING. This block MUST come before the [data-theme=…]
   blocks below. `:root` and `[data-theme="provider"]` have IDENTICAL
   specificity (0,1,0), and `:root` matches <html> just as the attribute
   selector does — so whichever is declared LAST wins. This block used to sit
   after them, which meant a page doing <html data-theme="provider"> silently
   got the light palette. web/homeclaw-providers.html shipped that way: a page
   with color-scheme:dark, a #0F0E0D theme-color and cream-at-3% ambient
   texture, rendering on a cream background with its texture invisible.

   Do not move this block below the theme blocks again. If you need a default
   that a theme must NOT override, give it higher specificity rather than
   relying on source order.
   ---------------------------------------------------------------------------- */
:root {
  color-scheme: light dark;
  --hc-bg: var(--hc-cream-50);
  --hc-surface: var(--hc-cream-00);
  --hc-surface-2: #EFEAE0;
  --hc-fg: var(--hc-ink-950);
  --hc-fg-muted: var(--hc-ink-700);
  --hc-fg-subtle: var(--hc-ink-500);
  --hc-border: rgba(15, 14, 13, 0.10);
  --hc-border-strong: rgba(15, 14, 13, 0.22);
  --hc-accent: var(--hc-ember);
  --hc-accent-hover: var(--hc-ember-hover);
  --hc-accent-fg: var(--hc-cream-50);
  --hc-accent-text: var(--hc-ember-text-on-light);
  --hc-focus: var(--hc-ember-text-on-light);
  --hc-focus-offset: var(--hc-cream-50);
}

[data-theme="provider"],
.hc-theme-provider {
  color-scheme: dark;

  --hc-bg: var(--hc-ink-950);
  --hc-surface: var(--hc-ink-900);
  --hc-surface-2: var(--hc-ink-800);
  --hc-fg: var(--hc-cream-50);
  --hc-fg-muted: var(--hc-ink-300);
  --hc-fg-subtle: var(--hc-ink-400);
  --hc-border: rgba(245, 241, 234, 0.10);
  --hc-border-strong: rgba(245, 241, 234, 0.22);
  --hc-accent: var(--hc-ember);
  --hc-accent-hover: var(--hc-ember-hover);
  --hc-accent-fg: var(--hc-ink-950);
  --hc-accent-text: var(--hc-ember-text-on-dark);
  --hc-focus: var(--hc-ember);
  --hc-focus-offset: var(--hc-ink-950);
  --hc-scrim: rgba(15, 14, 13, 0.72);
}

[data-theme="homeowner"],
.hc-theme-homeowner {
  color-scheme: light;

  --hc-bg: var(--hc-cream-50);
  --hc-surface: var(--hc-cream-00);
  --hc-surface-2: #EFEAE0;
  --hc-fg: var(--hc-ink-950);
  --hc-fg-muted: var(--hc-ink-700);
  --hc-fg-subtle: var(--hc-ink-500);
  --hc-border: rgba(15, 14, 13, 0.10);
  --hc-border-strong: rgba(15, 14, 13, 0.22);
  --hc-accent: var(--hc-ember);
  --hc-accent-hover: var(--hc-ember-hover);
  --hc-accent-fg: var(--hc-cream-50);
  --hc-accent-text: var(--hc-ember-text-on-light);
  --hc-focus: var(--hc-ember-text-on-light);
  --hc-focus-offset: var(--hc-cream-50);
  --hc-scrim: rgba(245, 241, 234, 0.72);
}

/* ============================================================================
   Base
   ============================================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--hc-bg);
  color: var(--hc-fg);
  font-family: var(--hc-font-body);
  font-size: var(--hc-text-md);
  line-height: var(--hc-lh-body);
  font-feature-settings: "ss01", "ss02", "cv02", "cv11";
}

img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Focus. Visible outline in accent, 2px offset for breathing room, not a
   sci-fi glow. Only shows on keyboard focus. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--hc-focus);
  outline-offset: 3px;
  border-radius: var(--hc-radius-1);
}

::selection {
  background: var(--hc-ember);
  color: var(--hc-ink-950);
}

/* ============================================================================
   Typography classes
   ============================================================================ */

.hc-display {
  font-family: var(--hc-font-display);
  font-variation-settings: "opsz" 96, "wght" 500, "SOFT" 40;
  font-weight: 500;
  line-height: var(--hc-lh-tight);
  letter-spacing: var(--hc-tracking-tight);
}

.hc-serif {
  font-family: var(--hc-font-display);
  font-variation-settings: "opsz" 24, "wght" 500, "SOFT" 30;
  font-weight: 500;
}

.hc-mono {
  font-family: var(--hc-font-mono);
  font-size: var(--hc-text-xs);
  letter-spacing: var(--hc-tracking-wide);
  text-transform: uppercase;
  color: var(--hc-fg-subtle);
}

.hc-lede {
  font-size: var(--hc-text-lg);
  line-height: var(--hc-lh-normal);
  color: var(--hc-fg-muted);
  max-width: 46ch;
}

/* ============================================================================
   Layout primitives
   ============================================================================ */

.hc-container {
  max-width: var(--hc-container);
  margin-inline: auto;
  padding-inline: var(--hc-space-5);
}
@media (min-width: 768px) {
  .hc-container { padding-inline: var(--hc-space-7); }
}

.hc-container-narrow {
  max-width: var(--hc-container-narrow);
  margin-inline: auto;
  padding-inline: var(--hc-space-5);
}

.hc-section {
  padding-block: var(--hc-space-8);
}
@media (min-width: 768px) {
  .hc-section { padding-block: var(--hc-space-10); }
}

.hc-hairline {
  border: 0;
  border-top: var(--hc-hairline) solid var(--hc-border);
  margin: 0;
}

/* ============================================================================
   Buttons
   ------
   Two variants:  primary (ember fill)  |  ghost (bordered)
   Both are large tap targets (44px min) and honor keyboard focus.
   ============================================================================ */

.hc-btn {
  --pad-y: 0.75rem;
  --pad-x: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: var(--pad-y) var(--pad-x);
  border-radius: var(--hc-radius-2);
  font-family: var(--hc-font-body);
  font-size: var(--hc-text-md);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background-color var(--hc-dur-base) var(--hc-ease),
    border-color var(--hc-dur-base) var(--hc-ease),
    color var(--hc-dur-base) var(--hc-ease),
    transform var(--hc-dur-fast) var(--hc-ease);
}
.hc-btn:active { transform: translateY(1px); }

.hc-btn-primary {
  background: var(--hc-accent);
  color: var(--hc-accent-fg);
  border-color: var(--hc-accent);
}
.hc-btn-primary:hover { background: var(--hc-accent-hover); border-color: var(--hc-accent-hover); }

.hc-btn-ghost {
  background: transparent;
  color: var(--hc-fg);
  border-color: var(--hc-border-strong);
}
.hc-btn-ghost:hover { border-color: var(--hc-fg); }

.hc-btn-lg { --pad-y: 1rem; --pad-x: 1.75rem; font-size: var(--hc-text-lg); }

/* Small ember arrow used on links & CTAs. Purely decorative — hidden from
   screen readers by the calling site. */
.hc-arrow { display: inline-block; transition: transform var(--hc-dur-base) var(--hc-ease); }
.hc-btn:hover .hc-arrow,
.hc-link:hover .hc-arrow { transform: translateX(3px); }

/* ============================================================================
   Link style
   ============================================================================ */

.hc-link {
  color: var(--hc-accent-text);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: color var(--hc-dur-base) var(--hc-ease);
}
.hc-link:hover { color: var(--hc-accent); }

/* ============================================================================
   Cards & surfaces
   ============================================================================ */

.hc-card {
  background: var(--hc-surface);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-3);
  padding: var(--hc-space-6);
}

/* Tile — flat, hairline, denser. Used in capability grids. */
.hc-tile {
  padding: var(--hc-space-6) var(--hc-space-5);
  border-top: 1px solid var(--hc-border);
}

/* ============================================================================
   Utilities
   ============================================================================ */

.hc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--hc-font-mono);
  font-size: var(--hc-text-xs);
  letter-spacing: var(--hc-tracking-wide);
  text-transform: uppercase;
  color: var(--hc-fg-subtle);
}
.hc-eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--hc-accent);
  border-radius: 1px;
  display: inline-block;
}

.hc-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;
}

/* Skip-to-content link — hidden until keyboard focus, then visible. */
.hc-skip {
  position: absolute;
  left: var(--hc-space-4);
  top: var(--hc-space-4);
  padding: var(--hc-space-3) var(--hc-space-4);
  background: var(--hc-fg);
  color: var(--hc-bg);
  border-radius: var(--hc-radius-2);
  font-family: var(--hc-font-body);
  font-weight: 500;
  z-index: 100;
  transform: translateY(-150%);
  transition: transform var(--hc-dur-base) var(--hc-ease);
}
.hc-skip:focus { transform: translateY(0); }

/* ============================================================================
   Wordmark
   ------
   The HomeClaw wordmark is plain type — Fraunces at display opsz, tight
   tracking, no icon. Confidence over decoration. Ember is optional and
   used as a bridging color on the split hero only.
   ============================================================================ */

.hc-wordmark {
  font-family: var(--hc-font-display);
  font-variation-settings: "opsz" 144, "wght" 600, "SOFT" 20;
  font-weight: 600;
  font-size: var(--hc-text-xl);
  letter-spacing: -0.015em;
  color: var(--hc-fg);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.125em;
  line-height: 1;
}
.hc-wordmark::before {
  /* small ember pip that ties every page back to the shared accent */
  content: "";
  width: 0.35em; height: 0.35em;
  background: var(--hc-accent);
  border-radius: 1px;
  align-self: center;
  margin-right: 0.4em;
}

/* ============================================================================
   Reduced motion — respect the OS preference.
   ============================================================================ */

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