/* Home hero: a live tablet. One token changes at a time and the whole interface restyles itself.
   The tablet screen is its own little product, so its colors are fixed here and not part of the
   generated dark theme (this file is not in tools/build-dark-theme.py). */

@property --hx-accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #2563eb;
}
@property --hx-bg {
  syntax: '<color>';
  inherits: true;
  initial-value: #f5f7fb;
}
@property --hx-surface {
  syntax: '<color>';
  inherits: true;
  initial-value: #ffffff;
}
@property --hx-side {
  syntax: '<color>';
  inherits: true;
  initial-value: #fbfcfe;
}
@property --hx-line {
  syntax: '<color>';
  inherits: true;
  initial-value: #e8ecf3;
}
@property --hx-ink {
  syntax: '<color>';
  inherits: true;
  initial-value: #0f172a;
}
@property --hx-ink2 {
  syntax: '<color>';
  inherits: true;
  initial-value: #64748b;
}
@property --hx-glow {
  syntax: '<color>';
  inherits: true;
  initial-value: #2563eb;
}
@property --hx-r {
  syntax: '<length>';
  inherits: true;
  initial-value: 8px;
}

/* ---------- placement ---------- */
.hx {
  position: absolute;
  top: 50%;
  right: max(24px, (100% - 1280px) / 2 + 24px);
  width: min(640px, 50%);
  transform: translateY(-50%);
  perspective: 1800px;
}
.hx__tilt {
  position: relative;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.hx__glow {
  position: absolute;
  inset: 12% 6% -6% 10%;
  border-radius: 40px;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--hx-glow, #2563eb) 30%, transparent), transparent);
  filter: blur(40px);
  transition: --hx-glow 1s;
  z-index: 0;
}

/* ---------- device ---------- */
.hx__device {
  position: relative;
  z-index: 1;
  padding: 2.2%;
  aspect-ratio: 1.43;
  border-radius: 6.2% / 8.9%;
  background: linear-gradient(160deg, #2a3142, #0d111b 55%, #171c28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 1px 0 1px rgba(15, 23, 42, 0.5),
    0 40px 80px -24px rgba(15, 23, 42, 0.35),
    0 18px 36px -18px rgba(15, 23, 42, 0.3);
}
.hx__fit {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4.4% / 6.4%;
  background: var(--hx-bg);
}
/* the screen is authored at 800 x 560 and scaled to fit (js/hero-anim.js sets --hx-s) */
.hx__screen {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  width: 800px;
  height: 560px;
  transform: scale(var(--hx-s, 0.72));
  transform-origin: 0 0;
  font-family: var(--font-family);
  color: var(--hx-ink);
  background: var(--hx-bg);
  -webkit-font-smoothing: antialiased;
  transition:
    --hx-accent 1s cubic-bezier(0.65, 0, 0.35, 1),
    --hx-bg 1s cubic-bezier(0.65, 0, 0.35, 1),
    --hx-surface 1s cubic-bezier(0.65, 0, 0.35, 1),
    --hx-side 1s cubic-bezier(0.65, 0, 0.35, 1),
    --hx-line 1s cubic-bezier(0.65, 0, 0.35, 1),
    --hx-ink 1s cubic-bezier(0.65, 0, 0.35, 1),
    --hx-ink2 1s cubic-bezier(0.65, 0, 0.35, 1),
    --hx-r 0.9s cubic-bezier(0.34, 1.4, 0.64, 1);
  --hx-soft: color-mix(in oklab, var(--hx-accent) 10%, var(--hx-surface));
  --hx-soft2: color-mix(in oklab, var(--hx-accent) 22%, var(--hx-surface));
}
.hx__screen[data-brand='blue'] {
  --hx-accent: #2563eb;
}
.hx__screen[data-brand='violet'] {
  --hx-accent: #7c3aed;
}
.hx__screen[data-brand='green'] {
  --hx-accent: #0d9488;
}
.hx__screen[data-radius='lg'] {
  --hx-r: 16px;
}
.hx__screen[data-mode='dark'] {
  --hx-bg: #0b0f19;
  --hx-surface: #131a28;
  --hx-side: #0e1320;
  --hx-line: #222b3d;
  --hx-ink: #e9eef8;
  --hx-ink2: #8c98ae;
}

/* ---------- screen content ---------- */
.hx-side {
  display: flex;
  flex-direction: column;
  flex: none;
  width: 172px;
  padding: 22px 14px;
  background: var(--hx-side);
  border-right: 1px solid var(--hx-line);
}
.hx-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hx-mark {
  display: flex;
  width: 22px;
  height: 22px;
  color: var(--hx-accent);
}
.hx-mark svg {
  width: 100%;
  height: 100%;
}
.hx-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 24px;
}
.hx-nav span {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  border-radius: calc(var(--hx-r) * 0.75);
  font-size: 12.5px;
  color: var(--hx-ink2);
}
.hx-nav i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: currentColor;
  opacity: 0.22;
}
.hx-nav .is-on i {
  opacity: 1;
  border-radius: calc(var(--hx-r) * 0.4);
}
.hx-nav .is-on {
  background: var(--hx-soft);
  color: var(--hx-accent);
  font-weight: 500;
}
.hx-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 0 8px;
}
.hx-av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f472b6);
}
.hx-user b {
  width: 64px;
  height: 8px;
  border-radius: 4px;
  background: var(--hx-line);
}

.hx-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-width: 0;
  padding: 18px 22px 22px;
}
.hx-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hx-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 260px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--hx-line);
  border-radius: calc(var(--hx-r) * 0.75);
  background: var(--hx-surface);
  font-size: 12px;
  color: var(--hx-ink2);
}
.hx-search i {
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.hx-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--hx-soft);
  color: var(--hx-accent);
  font-size: 11px;
  font-weight: 500;
}
.hx-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 168px;
  padding: 0 28px;
  overflow: hidden;
  border-radius: calc(var(--hx-r) * 1.5);
  background: radial-gradient(120% 140% at 100% 0%, var(--hx-soft2), transparent 60%), var(--hx-soft);
  border: 1px solid color-mix(in oklab, var(--hx-accent) 14%, var(--hx-line));
}
.hx-banner > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.hx-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hx-accent);
}
.hx-h {
  margin-top: 6px;
  font-size: 24px;
  line-height: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.hx-p {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--hx-ink2);
}
.hx-btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.hx-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: calc(var(--hx-r) * 0.75);
  background: var(--hx-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 6px 14px -6px color-mix(in oklab, var(--hx-accent) 70%, transparent);
}
.hx-btn--ghost {
  background: var(--hx-surface);
  color: var(--hx-ink);
  border: 1px solid var(--hx-line);
  box-shadow: none;
}
.hx-stack {
  position: relative;
  width: 132px;
  height: 120px;
  margin-right: 8px;
}
.hx-stack i {
  position: absolute;
  left: 18px;
  width: 84px;
  height: 84px;
  border-radius: calc(var(--hx-r) * 2);
  transform: rotate(45deg) skew(-8deg, -8deg);
  background: var(--hx-accent);
}
.hx-stack i:nth-child(1) {
  top: 34px;
  opacity: 0.18;
}
.hx-stack i:nth-child(2) {
  top: 20px;
  opacity: 0.4;
}
.hx-stack i:nth-child(3) {
  top: 6px;
  background: linear-gradient(135deg, color-mix(in oklab, var(--hx-accent) 60%, #fff), var(--hx-accent));
  box-shadow: 0 16px 30px -10px color-mix(in oklab, var(--hx-accent) 60%, transparent);
}

.hx-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.hx-card {
  display: flex;
  flex-direction: column;
  height: 124px;
  padding: 14px;
  border: 1px solid var(--hx-line);
  border-radius: var(--hx-r);
  background: var(--hx-surface);
}
.hx-card b {
  margin-top: auto;
  font-size: 12.5px;
  font-weight: 600;
}
.hx-card small {
  margin-top: 2px;
  font-size: 11px;
  color: var(--hx-ink2);
}
.hx-sw {
  display: flex;
}
.hx-sw i {
  width: 24px;
  height: 24px;
  margin-right: -6px;
  border-radius: 50%;
  border: 2px solid var(--hx-surface);
}
.hx-sw i:nth-child(1) {
  background: var(--hx-accent);
}
.hx-sw i:nth-child(2) {
  background: color-mix(in oklab, var(--hx-accent) 55%, #fff);
}
.hx-sw i:nth-child(3) {
  background: #f59e0b;
}
.hx-sw i:nth-child(4) {
  background: #10b981;
}
.hx-aa {
  font-size: 26px;
  line-height: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--hx-accent);
}
.hx-corner {
  width: 26px;
  height: 26px;
  border-top: 3px solid var(--hx-accent);
  border-left: 3px solid var(--hx-accent);
  border-top-left-radius: calc(var(--hx-r) * 1.1);
}
.hx-space {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hx-space i {
  height: 6px;
  border-radius: 3px;
  background: var(--hx-soft2);
}
.hx-space i:nth-child(1) {
  width: 46px;
  background: var(--hx-accent);
}
.hx-space i:nth-child(2) {
  width: 32px;
}
.hx-space i:nth-child(3) {
  width: 20px;
}

.hx-comps {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  gap: 14px 12px;
  flex: 1;
  padding: 0 18px;
  border: 1px solid var(--hx-line);
  border-radius: var(--hx-r);
  background: var(--hx-surface);
}
.hx-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--hx-accent);
}
.hx-toggle i {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
}
.hx-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: calc(var(--hx-r) * 0.5);
  background: var(--hx-accent);
}
.hx-check svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hx-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--hx-soft);
  color: var(--hx-accent);
  font-size: 11px;
  font-weight: 500;
}
.hx-input {
  display: inline-flex;
  align-items: center;
  width: 170px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--hx-accent);
  border-radius: calc(var(--hx-r) * 0.75);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--hx-accent) 16%, transparent);
  font-size: 11.5px;
  color: var(--hx-ink);
}
.hx-slider {
  position: relative;
  width: 150px;
  height: 4px;
  border-radius: 2px;
  background: var(--hx-line);
}
.hx-slider::before {
  content: '';
  position: absolute;
  inset: 0 40% 0 0;
  border-radius: 2px;
  background: var(--hx-accent);
}
.hx-slider i {
  position: absolute;
  top: 50%;
  left: 60%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--hx-accent);
}
.hx-avs {
  display: flex;
}
.hx-avs i {
  width: 24px;
  height: 24px;
  margin-right: -7px;
  border-radius: 50%;
  border: 2px solid var(--hx-surface);
  background: linear-gradient(135deg, #93c5fd, #6366f1);
}
.hx-avs i:nth-child(2) {
  background: linear-gradient(135deg, #fda4af, #f97316);
}
.hx-avs i:nth-child(3) {
  background: linear-gradient(135deg, #86efac, #14b8a6);
}

/* light passing over the glass on each change */
.hx-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.28) 48%,
    rgba(255, 255, 255, 0.06) 54%,
    transparent 62%
  );
  transform: translateX(-110%);
}
.hx-sheen.is-run {
  animation: hx-sheen 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes hx-sheen {
  to {
    transform: translateX(110%);
  }
}

/* ---------- token panel ---------- */
.hx-panel {
  position: absolute;
  z-index: 2;
  left: -12%;
  bottom: -9%;
  width: 236px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.05),
    0 24px 48px -16px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  transform: translateZ(40px);
  font-family: var(--font-family);
}
.hx-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
  font:
    500 11px/16px ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  color: #667085;
}
.hx-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-family);
  font-size: 11px;
}
.hx-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.18);
}
.hx-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  transition:
    background-color 0.4s,
    box-shadow 0.4s;
}
.hx-row code {
  font:
    400 12px/16px ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  color: #344054;
}
.hx-row.is-on {
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.25),
    0 4px 12px -4px rgba(37, 99, 235, 0.25);
}
.hx-val {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  height: 20px;
}
.hx-val em {
  display: block;
  font:
    500 12px/20px ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-style: normal;
  color: #101828;
}
.hx-val em.is-flip {
  animation: hx-flip 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes hx-flip {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
}
.hx-chip {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--hx-chip, #2563eb);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: background-color 1s;
}
.hx-sw2 {
  position: relative;
  width: 26px;
  height: 16px;
  border-radius: 999px;
  background: #e4e7ec;
  transition: background-color 0.5s;
}
.hx-sw2::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2);
  transition: transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.hx-sw2.is-on {
  background: #101828;
}
.hx-sw2.is-on::after {
  transform: translateX(10px);
}

html[data-px-theme='dark'] .hx-panel {
  background: rgba(22, 28, 42, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.6);
}
html[data-px-theme='dark'] .hx-panel__head {
  color: #98a2b3;
}
html[data-px-theme='dark'] .hx-row code {
  color: #cfd6e2;
}
html[data-px-theme='dark'] .hx-val em {
  color: #fff;
}
html[data-px-theme='dark'] .hx-row.is-on {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(96, 140, 255, 0.4);
}
html[data-px-theme='dark'] .hx-sw2 {
  background: #344054;
}
html[data-px-theme='dark'] .hx-sw2.is-on {
  background: #608cff;
}
html[data-px-theme='dark'] .hx__device {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 40px 80px -24px rgba(0, 0, 0, 0.7);
}

/* ---------- entrance (plays once) ---------- */
.hx.is-ready .hx__device {
  animation: hx-device 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hx.is-ready .hx-panel {
  animation: hx-panel 0.9s 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hx.is-ready [style*='--i'] {
  animation: hx-rise 0.8s calc(0.35s + var(--i) * 70ms) cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes hx-device {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}
@keyframes hx-panel {
  from {
    opacity: 0;
    transform: translate(-16px, 12px) translateZ(40px);
  }
}
@keyframes hx-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hx *,
  .hx.is-ready * {
    animation: none !important;
    transition: none !important;
  }
  .hx__tilt {
    transform: none;
  }
}

/* ---------- smaller screens ---------- */
@media (max-width: 1000px) {
  .hx {
    position: relative;
    top: auto;
    right: auto;
    width: min(640px, calc(100% - 32px));
    margin: 8px 0 64px auto;
    transform: none;
  }
}
@media (max-width: 600px) {
  .hx {
    width: 100%;
    margin: 8px 0 72px;
  }
  .hx {
    margin-bottom: 56px;
  }
  .hx-panel {
    left: -2%;
    bottom: -14%;
    transform: scale(0.64);
    transform-origin: 0 100%;
  }
}
