/* Cowlsly welded shell patch - 2026-07-09 (spit-polish 2026-07-10)
   Purpose: final fallback polish and hyphen/underscore compatibility layer.
   Real welded SVG plates are now wired via script.js assetMap; this patch still
   reinforces bevels, zone borders, and mobile safety when assets or CSS vars are missing.
   Does not enable live wallet/payment flows or microphone capture. */

:root {
  --welded-patch-hairline: rgba(242, 204, 123, 0.34);
  --welded-patch-shadow: 0 1rem 2.8rem rgba(0, 0, 0, 0.35);
  --cowlsly-master-gears: url("/assets/images/backgrounds/cowlsly_master_gears_dense_loop_v01.webp");
  --cowlsly-panel-stud: radial-gradient(circle, #f4dfaa 0 18%, #8c6a2f 20% 36%, #151a21 38% 55%, transparent 57%);
}

.asset-button,
.asset_button,
.asset-backed-search,
.asset_backed_search,
.asset-backed-profile-context,
.asset_backed_profile_context,
.asset-backed-feed-card,
.asset_backed_feed_card,
.welded-side-panel,
.welded_side_panel,
.centre-ai-cog,
.centre_ai_cog {
  isolation: isolate;
}

.topbar {
  background:
    linear-gradient(180deg, rgba(8, 13, 22, 0.96), rgba(5, 9, 16, 0.88)),
    radial-gradient(circle at 12% 0%, rgba(242, 204, 123, 0.08), transparent 18rem);
  border-bottom-color: rgba(242, 204, 123, 0.16);
}

.icon-button,
.glow-button,
.asset-button,
.asset_button,
.side-panel a {
  position: relative;
  min-height: 2.35rem;
}

.icon-button::after,
.glow-button::after,
.asset-button::after,
.asset_button::after,
.side-panel a::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 -1px 0 rgba(0, 0, 0, 0.32);
}

.console[aria-current="page"],
.console.active {
  transform: translateY(-1px);
}

.profile-context,
.asset-backed-profile-context,
.asset_backed_profile_context,
.search input,
.hero-card,
.post-card,
.dash-card,
.entity-card,
.message-row,
.basil-panel,
.decision-audit-panel {
  outline: 1px solid rgba(255, 255, 255, 0.025);
}

.hero-card::after,
.post-card::after,
.basil-panel::after,
.decision-audit-panel::after,
.entity-card::after,
.dash-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.055), transparent 18%, transparent 82%, rgba(242, 204, 123, 0.035));
  mix-blend-mode: screen;
}

.side-panel,
.welded-side-panel,
.welded_side_panel {
  box-shadow:
    var(--weld-bevel, inset 0 1px 0 rgba(255,255,255,.12)),
    var(--welded-patch-shadow),
    inset -1px 0 0 var(--welded-patch-hairline),
    0 0 1.2rem rgba(138, 232, 255, 0.10);
}

.panel-tab {
  border: 1px solid rgba(242, 204, 123, 0.36);
  background:
    radial-gradient(circle at 35% 20%, rgba(242, 204, 123, 0.26), transparent 45%),
    rgba(8, 13, 22, 0.82);
}

.centre-ai-cog,
.centre_ai_cog {
  background:
    var(--asset-base, none),
    radial-gradient(circle at 50% 28%, rgba(138, 232, 255, 0.13), transparent 40%),
    linear-gradient(155deg, rgba(19, 29, 48, 0.96), rgba(5, 9, 16, 0.88));
  box-shadow:
    var(--weld-bevel, inset 0 1px 0 rgba(255,255,255,.12)),
    0 0.9rem 2.4rem rgba(0, 0, 0, 0.38),
    0 0 1.2rem rgba(138, 232, 255, 0.14);
}

.centre-ai-cog-machine::before {
  content: "";
  position: absolute;
  inset: 14%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 204, 123, 0.14), transparent 68%);
  pointer-events: none;
}

.ai-zone-status {
  min-height: 2.1em;
}

.centre-ai-cog.ai-zone-red,
.centre-ai-cog.ai_zone_red,
.centre_ai_cog.ai-zone-red,
.centre_ai_cog.ai_zone_red { border-color: rgba(255, 119, 168, 0.58); }
.centre-ai-cog.ai-zone-green,
.centre-ai-cog.ai_zone_green,
.centre_ai_cog.ai-zone-green,
.centre_ai_cog.ai_zone_green { border-color: rgba(63, 240, 178, 0.58); }
.centre-ai-cog.ai-zone-yellow,
.centre-ai-cog.ai_zone_yellow,
.centre_ai_cog.ai-zone-yellow,
.centre_ai_cog.ai_zone_yellow { border-color: rgba(242, 204, 123, 0.68); }
.centre-ai-cog.ai-zone-blocked-ring,
.centre-ai-cog.ai_zone_blocked_ring,
.centre_ai_cog.ai-zone-blocked-ring,
.centre_ai_cog.ai_zone_blocked_ring { filter: grayscale(0.18); }

.audit-toolbar,
.action-row,
.ai-zone-selector { align-items: stretch; }
.audit-toolbar .glow-button,
.action-row .glow-button,
.ai-zone-btn { justify-content: center; }

.locked-card,
.glow-button:disabled { position: relative; }
.locked-card::before,
.glow-button:disabled::before {
  content: "locked";
  position: absolute;
  right: 0.75rem;
  top: 0.55rem;
  z-index: 1;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 119, 168, 0.25);
  color: var(--rose);
  background: rgba(255, 119, 168, 0.08);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* The machine rolls behind the interface. It is never painted onto a panel. */
body.master-gears-backdrop .site-bg__machine {
  background-image: var(--cowlsly-master-gears);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.9;
  filter: saturate(0.92) contrast(1.06) brightness(0.72);
}

body.master-gears-backdrop .site-bg__circuit {
  opacity: 0.34;
}

body.master-gears-backdrop .site-bg__aurora {
  opacity: 0.48;
}

/* Information areas are mounted plates floating over the moving machine. */
body.master-gears-backdrop .hero-card,
body.master-gears-backdrop .dash-card,
body.master-gears-backdrop .entity-card,
body.master-gears-backdrop .basil-panel,
body.master-gears-backdrop .decision-audit-panel {
  position: relative;
  overflow: hidden;
  background-image:
    var(--cowlsly-panel-stud),
    var(--cowlsly-panel-stud),
    var(--cowlsly-panel-stud),
    var(--cowlsly-panel-stud),
    linear-gradient(145deg, rgba(31, 42, 58, 0.97), rgba(8, 13, 22, 0.95) 58%, rgba(17, 24, 36, 0.97)) !important;
  background-size:
    1rem 1rem,
    1rem 1rem,
    1rem 1rem,
    1rem 1rem,
    auto !important;
  background-position:
    0.55rem 0.55rem,
    calc(100% - 0.55rem) 0.55rem,
    0.55rem calc(100% - 0.55rem),
    calc(100% - 0.55rem) calc(100% - 0.55rem),
    center !important;
  background-repeat: no-repeat !important;
  border: 1px solid rgba(242, 204, 123, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 1rem 2.5rem rgba(0, 0, 0, 0.48),
    0 0 1.2rem rgba(138, 232, 255, 0.08);
  backdrop-filter: blur(8px);
}

body.master-gears-backdrop .hero-card > *,
body.master-gears-backdrop .dash-card > *,
body.master-gears-backdrop .entity-card > *,
body.master-gears-backdrop .basil-panel > *,
body.master-gears-backdrop .decision-audit-panel > * {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  body.master-gears-backdrop .site-bg__machine {
    animation: none !important;
  }
}

@media (max-width: 760px) {
  body { overflow-x: clip; }
  .topbar { position: relative; gap: 0.55rem; }
  .profile-context,
  .asset-backed-profile-context,
  .asset_backed_profile_context { width: auto; max-width: 16rem; justify-content: flex-start; }
  .search,
  .asset-backed-search,
  .asset_backed_search { width: 100%; }
  .top-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
  }
  .top-actions .icon-button { justify-content: center; flex: 0 0 auto; }
  .machine-shell { padding-left: 4.4rem; padding-right: 1rem; }
  .scroll-controller,
  .asset-scroll-controller { display: none; }
  .cog-bar { grid-template-columns: repeat(4, minmax(2.4rem, 1fr)); max-width: 100%; }
  .centre-ai-cog,
  .centre_ai_cog { max-width: min(100%, 13rem); margin-bottom: 0.85rem; }
  .centre-ai-cog-machine { width: min(6.25rem, 44vw); }
  .audit-toolbar,
  .action-row,
  .ai-zone-selector { display: grid; grid-template-columns: 1fr; }
  .audit-history { max-height: 18rem; }
}

@media (max-width: 420px) {
  .icon-button span:not(.sr-only):not(.notif-count):not(.btn-icon) { display: none; }
}
