/* UGO | Signage — the screen on the home page and the Signage page (markup: tools/ugo-cm-screen.js; behaviour: js/ugo-screen.js).
 *
 * A slim-bezel screen that plays the live signage feed (signage/web.html). The old Signage TV had a 14px padded bezel inside a 2px border (16px a side);
 * every style here is 3 to 6px. Four styles, chosen with data-style on the figure (open a page with ?screens to compare them live):
 *   edge   the slimmest: a 3px black bezel with a hairline rim, no stand, the LIVE badge sits on the glass
 *   glass  smoked-glass bezel with a bright rim and a soft terracotta glow behind (the default)
 *   frame  a 6px brushed-aluminium frame with a thin neck and base, like a product shot
 *   lit    a 3px bezel lit in terracotta, with a slow light running round it
 * Orientation: data-orient="landscape" (16:9, the home page) or "portrait" (9:16, the Signage page).
 * The screen is dark hardware in both themes; only the shadows and the caption follow the light / dark theme. */
.ugo-screen {
  --ug-bezel: 5px; --ug-radius: 12px; --ug-aspect: 16 / 9; --ug-max: 600px; --ug-mark: 58px;
  --ug-cap: rgba(255, 255, 255, .6); --ug-pop: #d4664a;
  position: relative; width: 100%; max-width: var(--ug-max); margin: 0 auto; padding: 0; isolation: isolate;
  font-family: inherit; color: #fff; text-align: left;
}
.ugo-screen[data-orient="portrait"] { --ug-aspect: 9 / 16; --ug-max: 340px; --ug-mark: 66px; }
html[data-theme="light"] .ugo-screen { --ug-cap: rgba(58, 53, 48, .82); }
.ugo-screen, .ugo-screen *, .ugo-screen *::before, .ugo-screen *::after { box-sizing: border-box; }

/* the device: bezel around the glass; the outer radius is the glass radius plus the bezel, so the curves stay concentric */
.ugo-screen__device {
  position: relative; z-index: 1; padding: var(--ug-bezel); border-radius: calc(var(--ug-radius) + var(--ug-bezel)); background: #080706;
  transition: transform .7s cubic-bezier(.2, .8, .2, 1), box-shadow .4s ease;
}
.ugo-screen__panel { position: relative; aspect-ratio: var(--ug-aspect); border-radius: var(--ug-radius); overflow: hidden; background: #000; isolation: isolate; }
.ugo-screen__feed { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; border: 0; display: block; background: #000; pointer-events: none; }

/* standby: shown while the feed is empty or still loading (the player draws a black rectangle then) */
.ugo-screen__idle {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(212, 102, 74, .34), transparent 62%),
    radial-gradient(90% 80% at 50% 125%, rgba(212, 102, 74, .2), transparent 62%),
    linear-gradient(180deg, #1c1411, #0b0807);
  transition: opacity .9s ease;
}
.ugo-screen__idle::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(112deg, transparent 38%, rgba(255, 255, 255, .07) 50%, transparent 62%); animation: ugSweep 5.5s ease-in-out infinite;
}
.ugo-screen__mark { font-size: var(--ug-mark); color: #f4e7e0; filter: drop-shadow(0 6px 18px rgba(212, 102, 74, .45)); }
.ugo-screen__idle strong { font-family: inherit; font-weight: 700; font-size: clamp(14px, 1.5vw, 19px); line-height: 1.2; letter-spacing: .01em; color: #f6e9e2; }
.ugo-screen__idle small { font-family: inherit; font-weight: 600; font-size: 10px; line-height: 1; letter-spacing: .24em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.ugo-screen.is-live .ugo-screen__idle { opacity: 0; pointer-events: none; }
@keyframes ugSweep { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

/* a faint reflection across the glass */
.ugo-screen__sheen {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, .11) 0%, rgba(255, 255, 255, .035) 26%, rgba(255, 255, 255, 0) 46%);
}

/* LIVE / STANDBY: a badge on the glass (edge style) and a caption under the device (the others) */
.when-live { display: none; } .ugo-screen.is-live .when-live { display: inline; } .ugo-screen.is-live .when-idle { display: none; }
.ugo-screen__live {
  position: absolute; z-index: 5; top: 12px; left: 12px; display: none; align-items: center; gap: 7px; padding: 5px 9px 5px 8px; border-radius: 999px;
  background: rgba(10, 8, 7, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 0 0 1px rgba(255, 255, 255, .12);
  font-family: inherit; font-weight: 700; font-size: 9.5px; line-height: 1; letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .85);
}
.ugo-screen__live i, .ugo-screen__caption i { width: 6px; height: 6px; border-radius: 50%; background: var(--ug-pop); box-shadow: 0 0 8px var(--ug-pop); animation: ugBlink 2.2s ease-in-out infinite; flex: none; }
.ugo-screen__caption {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; position: relative; z-index: 1;
  font-family: inherit; font-weight: 600; font-size: 10px; line-height: 1; letter-spacing: .22em; text-transform: uppercase; color: var(--ug-cap);
}
.ugo-screen__caption .sep { opacity: .5; }
@keyframes ugBlink { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* the stand (frame style only) */
.ugo-screen__stand { display: none; justify-content: center; position: relative; z-index: 0; margin-top: -1px; }
.ugo-screen__stand span {
  display: block; width: 22%; max-width: 120px; height: 16px; clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #8b857f, #3a3531);
}
.ugo-screen__stand span::after { content: ""; display: block; }

/* ── edge ───────────────────────────────────────────────────────────────────────────────────── */
.ugo-screen[data-style="edge"] { --ug-bezel: 3px; --ug-radius: 14px; }
.ugo-screen[data-style="edge"] .ugo-screen__device {
  background: #050505;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .17), inset 0 1px 0 rgba(255, 255, 255, .24), 0 36px 62px -24px rgba(0, 0, 0, .72), 0 10px 24px -8px rgba(0, 0, 0, .42);
}
.ugo-screen[data-style="edge"] .ugo-screen__live { display: inline-flex; }
.ugo-screen[data-style="edge"] .ugo-screen__caption { display: none; }
html[data-theme="light"] .ugo-screen[data-style="edge"] .ugo-screen__device { box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .2), 0 30px 54px -24px rgba(70, 40, 28, .5), 0 8px 20px -8px rgba(70, 40, 28, .28); }

/* ── glass ──────────────────────────────────────────────────────────────────────────────────── */
.ugo-screen[data-style="glass"] { --ug-bezel: 5px; --ug-radius: 12px; }
.ugo-screen[data-style="glass"]::before {
  content: ""; position: absolute; z-index: 0; inset: -7% -9% -11%; border-radius: 44px; pointer-events: none;
  background: radial-gradient(60% 56% at 50% 46%, rgba(212, 102, 74, .6), rgba(212, 102, 74, 0) 70%); filter: blur(34px); opacity: .55;
}
html[data-theme="light"] .ugo-screen[data-style="glass"]::before { opacity: .38; }
.ugo-screen[data-style="glass"] .ugo-screen__device {
  background: linear-gradient(150deg, rgba(255, 255, 255, .38) 0%, rgba(255, 255, 255, .1) 22%, rgba(24, 19, 16, .82) 52%, rgba(10, 8, 7, .94) 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .24), inset 0 1px 0 rgba(255, 255, 255, .55), 0 42px 72px -28px rgba(0, 0, 0, .72), 0 14px 28px -10px rgba(0, 0, 0, .4);
}
.ugo-screen[data-style="glass"] .ugo-screen__panel { box-shadow: 0 0 0 1px rgba(0, 0, 0, .75); }
/* no resting tilt: a 3D transform resamples the picture and softens a live ad; the screen only lifts a little on hover */
.ugo-screen:hover .ugo-screen__device { transform: translateY(-3px); }

/* ── frame ──────────────────────────────────────────────────────────────────────────────────── */
.ugo-screen[data-style="frame"] { --ug-bezel: 6px; --ug-radius: 10px; }
.ugo-screen[data-style="frame"] .ugo-screen__device {
  background: linear-gradient(155deg, #f1ece7 0%, #a59f98 22%, #e8e2dc 45%, #716b65 70%, #cbc5bf 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(0, 0, 0, .28), 0 36px 62px -26px rgba(0, 0, 0, .66), 0 10px 22px -6px rgba(0, 0, 0, .3);
}
.ugo-screen[data-style="frame"] .ugo-screen__panel { box-shadow: 0 0 0 2px #0a0908, inset 0 0 22px rgba(0, 0, 0, .5); }
.ugo-screen[data-style="frame"] .ugo-screen__stand { display: flex; }
.ugo-screen[data-style="frame"] .ugo-screen__stand::after { content: ""; position: absolute; top: 15px; width: 42%; max-width: 210px; height: 5px; border-radius: 3px; background: linear-gradient(180deg, #5d5751, #2b2723); box-shadow: 0 10px 18px rgba(0, 0, 0, .35); }
.ugo-screen[data-style="frame"] .ugo-screen__caption { margin-top: 26px; }

/* ── lit ────────────────────────────────────────────────────────────────────────────────────── */
@property --ug-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.ugo-screen[data-style="lit"] { --ug-bezel: 3px; --ug-radius: 13px; }
.ugo-screen[data-style="lit"] .ugo-screen__device {
  background: conic-gradient(from var(--ug-angle), #d4664a, #f5b681, #d4664a 34%, #5b2012 60%, #d4664a 84%, #f5b681);
  animation: ugSpin 9s linear infinite;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 0 46px -6px rgba(212, 102, 74, .62), 0 34px 62px -26px rgba(0, 0, 0, .7);
}
.ugo-screen[data-style="lit"] .ugo-screen__panel { box-shadow: 0 0 0 1.5px #0a0807; }
@keyframes ugSpin { to { --ug-angle: 360deg; } }

@media (max-width: 600px) { .ugo-screen[data-orient="portrait"] { --ug-max: 300px; } }
@media (prefers-reduced-motion: reduce) {
  .ugo-screen *, .ugo-screen *::before, .ugo-screen *::after { animation: none !important; }
  .ugo-screen__device { transition: none; transform: none !important; }
}

/* On the Signage page the screen sits in a floating wrapper made for the old 380px portrait TV. Its animation rotated the whole TV in 3D, which
   would resample (soften) a live picture: it now only floats up and down. A landscape screen needs a wider wrapper than the portrait one. */
.floating-display:has(.ugo-screen) { perspective: none; animation: ugFloat 8s ease-in-out infinite; }
.floating-display:has(.ugo-screen[data-orient="landscape"]) { max-width: 880px; }
@keyframes ugFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .floating-display:has(.ugo-screen) { animation: none; } }

/* the style picker (only when a page is opened with ?screens) */
.ugo-screen-picker {
  position: fixed; left: 16px; bottom: 16px; z-index: 2000; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; max-width: calc(100vw - 32px); padding: 5px;
  border-radius: 14px; background: rgba(22, 18, 14, .92); box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 14px 40px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font: 600 12px/1 'Nunito Sans', system-ui, sans-serif; color: #e8e2da;
}
.ugo-screen-picker span { padding: 0 8px 0 6px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .6; }
.ugo-screen-picker b { width: 1px; align-self: stretch; margin: 4px 2px; background: rgba(255, 255, 255, .14); }
.ugo-screen-picker button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.ugo-screen-picker button:hover { background: rgba(255, 255, 255, .1); }
.ugo-screen-picker button[aria-pressed="true"] { background: #d4664a; color: #611200; }
.ugo-screen-picker button:focus-visible { outline: 2px solid #8dcef9; outline-offset: 1px; }
@media print { .ugo-screen-picker { display: none; } }
