/* house-ui polish layer v1 (ComputerPro / Den). Drop in AFTER the site's own CSS.
   Brand-neutral: set --accent (and optionally --ring, --radius) in the site's tokens. */
:root {
  --accent: #0a84ff;
  --ring: color-mix(in srgb, var(--accent) 60%, transparent);
  --ease-out: cubic-bezier(.23, 1, .32, 1);        /* strong ease-out for UI */
  --ease-spring: cubic-bezier(.34, 1.36, .64, 1);  /* small overshoot, use sparingly */
  --t-fast: 140ms;
  --t-base: 200ms;
}

/* Text rendering + wrapping (unslop 16, 18) */
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
.num, [data-num], table td, output, time { font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* Touch: no grey flash, no double-tap zoom delay, 44px targets */
a, button, [role="button"], label, summary, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button, [role="button"], .btn { min-height: 44px; cursor: pointer; user-select: none; }

/* Press feedback: everything tappable shrinks a touch, fast in, smooth out */
button, [role="button"], .btn, .card-link, [data-press] {
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out), opacity var(--t-base) var(--ease-out);
}
button:active:not(:disabled), [role="button"]:active, .btn:active, [data-press]:active { transform: scale(.97); }
.card-link:active { transform: scale(.985); }

/* Hover only where a real pointer exists (no sticky hover on phones) */
@media (hover: hover) and (pointer: fine) {
  .card-link:hover, [data-press]:hover { transform: translateY(-1px); }
}

/* Keyboard focus that looks designed, not default */
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: inherit; }
:focus:not(:focus-visible) { outline: none; }

/* Loading state (unslop 19): add [aria-busy="true"] or use Polish.busy() */
[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 1.1em; height: 1.1em;
  border: 2px solid currentColor; border-color: var(--spinner, #fff) transparent var(--spinner, #fff) transparent;
  border-radius: 50%; animation: hu-spin .7s linear infinite;
}
@keyframes hu-spin { to { transform: rotate(360deg); } }

/* Success / error feedback (unslop 20) */
.hu-ok { animation: hu-pop var(--t-base) var(--ease-spring); }
@keyframes hu-pop { 0% { transform: scale(.9); } 100% { transform: scale(1); } }
.hu-shake { animation: hu-shake 320ms var(--ease-out); }
@keyframes hu-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* Skeletons that match the final layout */
.skeleton {
  background: linear-gradient(90deg, rgb(128 128 128 / .12) 25%, rgb(128 128 128 / .22) 50%, rgb(128 128 128 / .12) 75%);
  background-size: 200% 100%; animation: hu-shimmer 1.2s linear infinite; border-radius: 8px; color: transparent;
}
@keyframes hu-shimmer { to { background-position: -200% 0; } }

/* Entrances: content fades up once, short and calm */
[data-reveal] { opacity: 0; transform: translateY(8px); transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out); }
[data-reveal].in { opacity: 1; transform: none; }

/* Toast */
.hu-toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 9999;
  transform: translate(-50%, 16px); opacity: 0; padding: 10px 16px; border-radius: 999px;
  background: #111; color: #fff; font: 500 14px/1.3 system-ui, sans-serif; box-shadow: 0 8px 24px rgb(0 0 0 / .25);
  transition: transform var(--t-base) var(--ease-out), opacity var(--t-base) var(--ease-out); pointer-events: none;
}
.hu-toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Smooth page-to-page transitions (Chrome/Edge/Safari 18+; others just navigate) */
@view-transition { navigation: auto; }

/* Mobile app feel */
html { scroll-behavior: smooth; }
body { overscroll-behavior-y: none; }
.safe-bottom { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

/* Respect people who turn motion off */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
