
/* ============================================================================
   RELAY'S LOOK — Orb's glass on RELAY itself, a part at a time.

   Every rule here starts with body.look-<part>, a class Js_RelayLook adds only
   for the parts an admin switched on (RelayLook.gs). With none, nothing here
   applies and RELAY looks as it always has.

   Deliberately never styled: forms, inputs, tables and the call screens. They
   stay plain so they are quick to read and to use under pressure. High
   contrast turns all of it off (:not(.a11y-contrast-high)), and reduced
   motion — from the device or Profile → Accessibility — stops the movement.
   ============================================================================ */

body.look-on {
  --look-glass:        rgba(255, 255, 255, .62);
  --look-glass-strong: rgba(255, 255, 255, .82);
  --look-edge:         rgba(255, 255, 255, .75);
  --look-line:         rgba(9, 81, 124, .14);
  --look-glow:         rgba(70, 150, 220, .35);
  --look-violet:       #6b5bd6;
  --look-ink:          linear-gradient(100deg, var(--color-primary) 0%, #2a73b8 55%, var(--look-violet) 100%);
  --look-shadow:       0 10px 30px -12px rgba(9, 50, 90, .28), 0 2px 6px -2px rgba(9, 50, 90, .12);
  --look-radius:       18px;
}
body.look-on.dark-mode {
  --look-glass:        rgba(22, 36, 54, .62);
  --look-glass-strong: rgba(22, 36, 54, .86);
  --look-edge:         rgba(255, 255, 255, .12);
  --look-line:         rgba(160, 210, 240, .16);
  --look-glow:         rgba(90, 170, 240, .35);
  --look-violet:       #a497ff;
  --look-ink:          linear-gradient(100deg, #8cc8f0 0%, #6fb0ea 50%, var(--look-violet) 100%);
  --look-shadow:       0 12px 34px -12px rgba(0, 0, 0, .7), 0 2px 6px -2px rgba(0, 0, 0, .4);
}

/* ── Navigation bar ─────────────────────────────────────────────────────── */
body.look-navbar:not(.a11y-contrast-high) .navbar {
  background: var(--look-glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--look-line), 0 6px 24px -14px rgba(9, 50, 90, .35);
}
body.look-navbar:not(.a11y-contrast-high) .navbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--color-primary) 20%, var(--look-violet) 80%, transparent);
  opacity: .55;
}
body.look-navbar:not(.a11y-contrast-high) .navbar .header-controls .btn,
body.look-navbar:not(.a11y-contrast-high) .navbar .header-controls button,
body.look-navbar:not(.a11y-contrast-high) .navbar .header-controls .status-indicator {
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(9, 50, 90, .08);
}

/* ── Menu ───────────────────────────────────────────────────────────────── */
body.look-menu:not(.a11y-contrast-high) .sidebar {
  background: var(--look-glass-strong);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--look-edge);
  border-top: 1px solid var(--look-edge);
  border-radius: var(--look-radius);
  box-shadow: var(--look-shadow), inset 0 1px 0 var(--look-edge);
  padding: .35rem 0;
}
body.look-menu:not(.a11y-contrast-high) .sidebar .menu-item {
  border-left: 0;
  margin: 2px .5rem;
  border-radius: 12px;
}
body.look-menu:not(.a11y-contrast-high) .sidebar .menu-item:hover {
  background: rgba(70, 150, 220, .10);
}
body.look-menu:not(.a11y-contrast-high) .sidebar .menu-item.active {
  background: radial-gradient(120% 140% at 0% 50%, rgba(120, 190, 255, .35), rgba(107, 91, 214, .14) 70%, transparent);
  box-shadow: inset 0 0 0 1px rgba(70, 150, 220, .35), 0 0 18px -6px var(--look-glow);
}

/* ── Page titles ────────────────────────────────────────────────────────── */
body.look-headers:not(.a11y-contrast-high) .page-header {
  border-bottom: 0;
  position: relative;
}
body.look-headers:not(.a11y-contrast-high) .page-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--color-primary), #4aa3e0 45%, var(--look-violet) 75%, transparent);
  box-shadow: 0 0 12px var(--look-glow);
  opacity: .8;
}
body.look-headers:not(.a11y-contrast-high) .page-header h2 {
  background: var(--look-ink);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1.5px;
}

/* An emoji in a title keeps its own colours (Js_RelayLook wraps it). */
body.look-headers:not(.a11y-contrast-high) .page-header h2 .look-emoji {
  -webkit-text-fill-color: initial;
  background: none;
}

/* ── Cards and panels ───────────────────────────────────────────────────── */
/* The page sits off the window's edges, so its rounded corners have room. */
body.look-cards:not(.a11y-contrast-high) .main-content .page {
  margin: 18px 22px 28px;
  border-radius: var(--look-radius);
  box-shadow: var(--look-shadow);
  border: 1px solid var(--look-line);
}
@media (max-width: 700px) {
  body.look-cards:not(.a11y-contrast-high) .main-content .page { margin: 10px 8px 20px; border-radius: 14px; }
}
body.look-cards:not(.a11y-contrast-high) .page .card,
body.look-cards:not(.a11y-contrast-high) .page .stat-card,
body.look-cards:not(.a11y-contrast-high) .page .section-card {
  border-radius: 14px;
  border: 1px solid var(--look-line);
  box-shadow: 0 1px 2px rgba(9, 50, 90, .06), 0 6px 18px -12px rgba(9, 50, 90, .22);
}
/* RELAY's cards have no padding of their own; with a border it shows. */
body.look-cards:not(.a11y-contrast-high) .page .card > .card-body { padding: 18px 22px; }
body.look-cards:not(.a11y-contrast-high) .page .card:not(:has(> .card-body)):not(:has(> table)):not(:has(> .table-responsive)) { padding: 16px 20px; }
body.look-cards:not(.a11y-contrast-high) .page .stat-card {
  background-image: linear-gradient(160deg, rgba(120, 190, 255, .08), transparent 55%);
}
/* Square fields inside rounded cards looked pinned to the edge: a little
   rounding to match. Nothing else about forms changes. */
body.look-cards:not(.a11y-contrast-high) .page .form-control,
body.look-cards:not(.a11y-contrast-high) .page select,
body.look-cards:not(.a11y-contrast-high) .page textarea,
body.look-cards:not(.a11y-contrast-high) .page input[type="text"],
body.look-cards:not(.a11y-contrast-high) .page input[type="search"],
body.look-cards:not(.a11y-contrast-high) .page input[type="email"],
body.look-cards:not(.a11y-contrast-high) .page input[type="date"],
body.look-cards:not(.a11y-contrast-high) .page input[type="time"] {
  border-radius: 10px;
}
/* A table at the top of a rounded card keeps the card's corners. */
body.look-cards:not(.a11y-contrast-high) .page .card:has(> table),
body.look-cards:not(.a11y-contrast-high) .page .card:has(> .table-responsive),
body.look-cards:not(.a11y-contrast-high) .page .table-container {
  overflow: hidden;
  border-radius: 14px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
/* Flat colour, a soft shadow and rounded corners — no bevel, no gloss. */
body.look-buttons:not(.a11y-contrast-high) .page .btn,
body.look-buttons:not(.a11y-contrast-high) .modal .btn {
  border-radius: 12px;
  letter-spacing: .6px;
  box-shadow: none;
}
body.look-buttons:not(.a11y-contrast-high) .page .btn-primary,
body.look-buttons:not(.a11y-contrast-high) .modal .btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(9, 50, 90, .16), 0 4px 12px -6px rgba(9, 81, 124, .45);
}
body.look-buttons:not(.a11y-contrast-high) .page .btn-primary:hover,
body.look-buttons:not(.a11y-contrast-high) .modal .btn-primary:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-light);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(9, 50, 90, .16), 0 8px 18px -8px rgba(9, 81, 124, .5);
}
body.look-buttons:not(.a11y-contrast-high) .page .btn-secondary,
body.look-buttons:not(.a11y-contrast-high) .modal .btn-secondary {
  background: transparent;
  border: 1.5px solid rgba(9, 81, 124, .35);
  color: var(--color-primary);
}
body.look-buttons:not(.a11y-contrast-high) .page .btn-secondary:hover,
body.look-buttons:not(.a11y-contrast-high) .modal .btn-secondary:hover {
  background: rgba(9, 81, 124, .06);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}
body.look-buttons.dark-mode:not(.a11y-contrast-high) .page .btn-secondary,
body.look-buttons.dark-mode:not(.a11y-contrast-high) .modal .btn-secondary {
  border-color: rgba(160, 210, 240, .35);
  color: #8cc8f0;
}
body.look-buttons.dark-mode:not(.a11y-contrast-high) .page .btn-secondary:hover,
body.look-buttons.dark-mode:not(.a11y-contrast-high) .modal .btn-secondary:hover {
  background: rgba(160, 210, 240, .08);
}

/* ── Pop-ups and messages ───────────────────────────────────────────────── */
body.look-popups:not(.a11y-contrast-high) .modal {
  background: rgba(8, 24, 40, .38);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
body.look-popups:not(.a11y-contrast-high) .modal-content {
  border-radius: calc(var(--look-radius) + 4px);
  border: 1px solid var(--look-edge);
  box-shadow: 0 30px 70px -20px rgba(0, 20, 40, .55), inset 0 1px 0 var(--look-edge);
}
body.look-popups:not(.a11y-contrast-high) .toast {
  background: var(--look-glass-strong);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  border-radius: 16px;
  border-top: 1px solid var(--look-edge);
  border-right: 1px solid var(--look-edge);
  border-bottom: 1px solid var(--look-edge);
  box-shadow: var(--look-shadow);
}

/* ── Background ─────────────────────────────────────────────────────────── */
body.look-background:not(.a11y-contrast-high) .main-content {
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(90, 170, 240, .16), transparent 60%),
    radial-gradient(800px 600px at 105% 15%, rgba(107, 91, 214, .12), transparent 60%),
    var(--color-background);
  background-attachment: fixed;
}

/* ── Loading ────────────────────────────────────────────────────────────── */
/* Every spinner becomes Orb's glass with its living core: the same element,
   so nothing that shows a spinner needs to change. */
body.look-loading:not(.a11y-contrast-high) .spinner,
body.look-loading:not(.a11y-contrast-high) .loading-spinner,
body.look-loading:not(.a11y-contrast-high) .loading-spinner-sm,
body.look-loading:not(.a11y-contrast-high) .queue-spinner {
  border: 0 !important;
  border-radius: 50%;
  padding: 0;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  background: radial-gradient(circle at 50% 42%, rgba(42, 140, 210, .35), rgba(9, 60, 110, .72) 78%, rgba(4, 30, 60, .86));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), inset 1px 1.5px 1px -.5px rgba(255, 255, 255, .9),
    0 3px 8px -3px rgba(0, 10, 25, .45);
  animation: lookOrbBreathe 1.8s ease-in-out infinite;
}
body.look-loading:not(.a11y-contrast-high) .spinner::before,
body.look-loading:not(.a11y-contrast-high) .loading-spinner::before,
body.look-loading:not(.a11y-contrast-high) .loading-spinner-sm::before,
body.look-loading:not(.a11y-contrast-high) .queue-spinner::before {
  content: ''; position: absolute; inset: 22%; border-radius: 50%;
  background: conic-gradient(from 0deg, #2aa8e0, #7c5cff, #3ee0c5, #c79bff, #2aa8e0);
  filter: blur(3px); opacity: .95;
  animation: lookOrbCore 1.4s linear infinite;
}
body.look-loading:not(.a11y-contrast-high) .spinner::after,
body.look-loading:not(.a11y-contrast-high) .loading-spinner::after {
  content: ''; position: absolute; left: 16%; right: 16%; top: 6%; height: 34%; border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0));
}
body.look-loading:not(.a11y-contrast-high) .loading-spinner-sm::before,
body.look-loading:not(.a11y-contrast-high) .queue-spinner::before { inset: 18%; filter: blur(1px); }
@keyframes lookOrbBreathe { 0%, 100% { transform: scale(.92); } 50% { transform: scale(1.04); } }
@keyframes lookOrbCore { to { transform: rotate(360deg); } }

/* The bar along the top, in Orb's colours. (There is no "Loading…" pill:
   see #loadingOverlay in StylesExtra.) */
body.look-loading:not(.a11y-contrast-high) #loadingOverlay .loading-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent, #2aa8e0, #7c5cff, transparent);
}

/* Reduced motion: the core stays, still; the words say it's loading. */
body.look-loading.a11y-reduce-motion .spinner, body.look-loading.a11y-reduce-motion .loading-spinner,
body.look-loading.a11y-reduce-motion .loading-spinner-sm, body.look-loading.a11y-reduce-motion .queue-spinner,
body.look-loading.a11y-reduce-motion .spinner::before, body.look-loading.a11y-reduce-motion .loading-spinner::before { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  body.look-loading .spinner, body.look-loading .loading-spinner, body.look-loading .loading-spinner-sm,
  body.look-loading .queue-spinner, body.look-loading .spinner::before, body.look-loading .loading-spinner::before { animation-duration: 4s !important; }
}

/* ── Gentle movement ────────────────────────────────────────────────────── */
body.look-motion:not(.a11y-contrast-high):not(.a11y-reduce-motion) .page .card,
body.look-motion:not(.a11y-contrast-high):not(.a11y-reduce-motion) .page .stat-card,
body.look-motion:not(.a11y-contrast-high):not(.a11y-reduce-motion) .page .section-card {
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.3), box-shadow .25s ease;
}
body.look-motion:not(.a11y-contrast-high):not(.a11y-reduce-motion) .page .stat-card:hover,
body.look-motion:not(.a11y-contrast-high):not(.a11y-reduce-motion) .page .section-card:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 var(--look-edge), 0 14px 30px -14px rgba(9, 50, 90, .35);
}
body.look-motion:not(.a11y-contrast-high):not(.a11y-reduce-motion) .btn {
  transition: transform .18s cubic-bezier(.2, .9, .3, 1.5), box-shadow .2s ease, background .2s ease;
}
body.look-motion:not(.a11y-contrast-high):not(.a11y-reduce-motion) .btn:active {
  transform: scale(.97);
}
@media (prefers-reduced-motion: reduce) {
  body.look-motion .page .card, body.look-motion .page .stat-card,
  body.look-motion .page .section-card, body.look-motion .btn { transition: none !important; transform: none !important; }
}

/* ── Settings card and the personal choice ──────────────────────────────── */
.rl-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem .9rem; margin: .75rem 0; }
.rl-part { display: flex; gap: .55rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--n-200); border-radius: 10px; cursor: pointer; }
.rl-part input { margin-top: .25rem; }
.rl-part small { display: block; color: var(--color-text-secondary); line-height: 1.35; }
.rl-trying { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: rgba(107, 91, 214, .14); color: #5446b8; }
body.dark-mode .rl-trying { color: #c4bbff; }
#relayLookMine { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--n-200); }
