/* ==========================================================================
   Harmony House · System layer (v2.50, Visual 10X phase 4). Loaded LAST on every device: the Mac and Windows app (src/ui/system.css)
   and the Studio B team app on phones, iPads and browsers (server/public/system.css). The two files must stay identical (a test checks).
   It applies the tokens in brand.css everywhere: one typeface family and a strict hierarchy, frosted command-center glass for every
   surface over the city, one radius and depth scale, 150–250 ms eased motion, Sal's living orb, and designed empty / loading /
   error / "Needs Studio B" states. Look, layout and motion only: no function, permission or data changes here.
   ========================================================================== */

/* ---- type: one family, strict hierarchy ---- */
html, body { font-family: var(--hh-ui); font-weight: var(--hh-fw-reg); line-height: var(--hh-lh); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: "tnum" 0, "ss01" 1; }
h1 { font: var(--hh-fw-bold) var(--hh-fs-3xl)/var(--hh-lh-tight) var(--hh-display); letter-spacing: -.02em; }
h2 { font: var(--hh-fw-bold) var(--hh-fs-2xl)/var(--hh-lh-tight) var(--hh-display); letter-spacing: -.015em; }
h3 { font: var(--hh-fw-med) var(--hh-fs-xl)/var(--hh-lh-tight) var(--hh-display); letter-spacing: -.01em; }
.card h4, .card .hd h2, .card > .hd > h2 { font: var(--hh-fw-med) var(--hh-fs-xs)/1.3 var(--hh-ui) !important; letter-spacing: var(--hh-caps) !important; text-transform: uppercase !important; color: var(--hh-ink3) !important; }
.num, .tile b, .tiles b, .kpi b, .stat b { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; letter-spacing: -.01em; }

/* ---- surfaces: frosted command-center glass, crisp borders, real depth ---- */
.card, .rtile, .rnow, .rb, .cpanel, .selcard, .sheet, .modal, .g3menu, .cmdk, .st-panel, .drawer, .banner {
  background: var(--hh-panel-sheen), var(--hh-panel) !important;
  -webkit-backdrop-filter: var(--hh-blur) !important; backdrop-filter: var(--hh-blur) !important;
  border: 1px solid var(--hh-panel-line) !important; box-shadow: var(--hh-elev-2) !important;
}
.card, .rtile, .rnow, .rb, .cpanel, .selcard, .banner { border-radius: var(--hh-r-lg) !important; }
.sheet, .modal, .g3menu, .cmdk, .st-panel { border-radius: var(--hh-r-xl) !important; box-shadow: var(--hh-elev-3) !important; }
.card:hover, .rtile:hover, .selcard:hover { border-color: var(--hh-panel-hi) !important; }
@media (max-width: 600px) { .card, .sheet, .drawer { -webkit-backdrop-filter: blur(14px) saturate(140%) !important; backdrop-filter: blur(14px) saturate(140%) !important; } }   /* phones: lighter blur */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .card, .sheet, .modal, .drawer, .g3menu { background: var(--hh-panel-solid) !important; } }

/* ---- controls: one radius and focus language ---- */
button, .btn, .g3mbtn, .dk, .nav, input, select, textarea { border-radius: var(--hh-r-md); }
.btn.pri, button.pri { border-radius: var(--hh-r-pill); }
:focus-visible { outline: 2px solid var(--hh-brass) !important; outline-offset: 2px !important; }

/* ---- motion: 150–250 ms, eased; every interactive surface on the same clock ---- */
button, a, .btn, .g3mbtn, .dk, .nav, .card, .rtile, .row, .tile, input, select, textarea, .salfab, .chip, .tag {
  transition-duration: var(--hh-dur-2) !important; transition-timing-function: var(--hh-ease) !important;
}
button:active, .btn:active, .g3mbtn:active { transform: scale(.97); transition-duration: var(--hh-dur-1) !important; }
/* panels open from what was clicked (system.js sets the origin) */
.hh-open { animation: hhOpen var(--hh-dur-3) var(--hh-ease) both; transform-origin: var(--hh-ox, 50%) var(--hh-oy, 0); }
@keyframes hhOpen { from { opacity: 0; transform: scale(.94) translateY(4px); } to { opacity: 1; transform: none; } }
.hh-count { transition: color var(--hh-dur-3) var(--hh-ease); }
.hh-count.up { color: var(--hh-ok); } .hh-count.down { color: var(--hh-warn); }

/* ---- Sal's orb: alive. idle breathes; listening ripples outward; speaking pulses with the voice; thinking turns ----
   The state comes from what is really happening (html[data-sal], set by saltalk.js from the microphone and the speech engine). */
.salfab i, .st-orb, .orb, .ic-orb, .cmdk-s { position: relative; }
.salfab i, .st-orb, .cmdk-s { animation: salIdle 4.2s var(--hh-ease) infinite; }
html[data-sal="listening"] .salfab i, html[data-sal="listening"] .st-orb { animation: salListen 1.4s ease-out infinite; }
html[data-sal="speaking"] .salfab i, html[data-sal="speaking"] .st-orb { animation: salSpeak .52s ease-in-out infinite alternate; }
html[data-sal="thinking"] .salfab i, html[data-sal="thinking"] .st-orb { animation: salThink 1.1s linear infinite; }
@keyframes salIdle { 0%, 100% { box-shadow: 0 0 0 0 var(--hh-go-glow), 0 0 14px 2px var(--hh-go-glow); transform: scale(1); } 50% { box-shadow: 0 0 0 3px rgba(34, 216, 119, .12), 0 0 22px 6px var(--hh-go-glow); transform: scale(1.03); } }
@keyframes salListen { 0% { box-shadow: 0 0 0 0 rgba(34, 216, 119, .55), 0 0 18px 4px var(--hh-go-glow); } 100% { box-shadow: 0 0 0 14px rgba(34, 216, 119, 0), 0 0 18px 4px var(--hh-go-glow); } }
@keyframes salSpeak { from { transform: scale(.98); filter: brightness(1); } to { transform: scale(1.08); filter: brightness(1.25); } }
@keyframes salThink { from { filter: hue-rotate(0deg) brightness(1.05); } to { filter: hue-rotate(25deg) brightness(1.15); } }
/* the phone app's large orb: the same breathing, slower */
.orb .orb-glow { animation: salIdleBig 5s var(--hh-ease) infinite; }
@keyframes salIdleBig { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }

/* ---- designed states: empty, loading, error, "Needs Studio B" ---- */
.hh-state { display: grid; justify-items: center; gap: var(--hh-sp-2); padding: var(--hh-sp-7) var(--hh-sp-5); text-align: center; color: var(--hh-ink2); }
.hh-state .ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .05); border: 1px solid var(--hh-panel-line); color: var(--hh-ink2); }
.hh-state .ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.hh-state b { font: var(--hh-fw-med) var(--hh-fs-lg)/1.3 var(--hh-display); color: var(--hh-ink); }
.hh-state p { margin: 0; max-width: 34ch; font-size: var(--hh-fs-sm); color: var(--hh-ink3); }
.hh-state.error .ic { color: var(--hh-bad); border-color: rgba(242, 109, 109, .35); }
.hh-state.needs .ic { color: var(--hh-info); border-color: rgba(99, 199, 232, .35); }
.hh-state.loading .ic { border-color: transparent; background: conic-gradient(from 0deg, var(--hh-brass), transparent 70%); animation: hhSpin .9s linear infinite; -webkit-mask: radial-gradient(circle, transparent 15px, #000 16px); mask: radial-gradient(circle, transparent 15px, #000 16px); }
@keyframes hhSpin { to { transform: rotate(1turn); } }
.hh-skel { height: 12px; border-radius: var(--hh-r-sm); background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .1), rgba(255, 255, 255, .04)); background-size: 200% 100%; animation: hhShimmer 1.2s linear infinite; }
@keyframes hhShimmer { to { background-position: -200% 0; } }

/* ---- icons: one set (src/ui/icons.js): 24 grid, 1.75 stroke, round caps and joins ---- */
svg.hh-i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.22em; flex: none; }

/* ---- the top-left menu (Mac app): everything that isn't briefing, approvals, bookings or schedule lives here ---- */
.hmenu { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-right: var(--hh-sp-2); border: 1px solid var(--hh-panel-line); border-radius: var(--hh-r-md); background: var(--hh-panel); color: var(--hh-ink); cursor: pointer; }
.hmenu:hover { border-color: var(--hh-panel-hi); }
.hdrawer-bg { position: fixed; inset: 0; z-index: 80; background: rgba(4, 6, 10, .45); animation: hhFade var(--hh-dur-2) var(--hh-ease) both; }
.hdrawer { position: fixed; z-index: 81; top: 10px; left: 10px; bottom: 10px; width: min(380px, calc(100vw - 20px)); overflow: auto; padding: var(--hh-sp-4); border-radius: var(--hh-r-xl) !important; box-shadow: var(--hh-elev-3) !important; animation: hhSlide var(--hh-dur-3) var(--hh-ease) both; }
.hdrawer .hd2 { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--hh-sp-3); font: var(--hh-fw-bold) var(--hh-fs-lg) var(--hh-display); }
.hnav { display: grid; gap: 2px; margin-bottom: var(--hh-sp-4); }
.hn { display: flex; align-items: center; gap: var(--hh-sp-3); width: 100%; padding: 10px 12px; border: 0; border-radius: var(--hh-r-md); background: transparent; color: var(--hh-ink2); font: var(--hh-fw-med) var(--hh-fs-md) var(--hh-ui); text-align: left; cursor: pointer; }
.hn:hover { background: rgba(255, 255, 255, .05); color: var(--hh-ink); } .hn.on { background: var(--hh-brass-glow); color: var(--hh-brass-hi); }
.hn .badge { margin-left: auto; }
.hhub { border-top: 1px solid var(--hh-panel-line); padding-top: var(--hh-sp-4); }
.card.brief { border-color: color-mix(in srgb, var(--hh-brass) 30%, transparent) !important; }
@keyframes hhFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hhSlide { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

/* v2.51 (live test L): district names on the map read over any part of the city: a dark glass plate, near-white text */
.g3d button { color: rgba(255, 255, 255, .92) !important; background: rgba(8, 10, 16, .55) !important; padding: 4px 12px !important; border-radius: var(--hh-r-pill) !important; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); text-shadow: none !important; }
.g3l span { color: var(--hh-ink2) !important; background: rgba(8, 10, 16, .72) !important; }

/* v3.0 Riviera paper: the page is light, so native controls and scrollbars are light too */
:root[data-style="riviera"] { color-scheme: light; }
