/* ============================================================
   5 Services — central hub for 5 Streaming Technical Solutions
   Tokens lifted from the 5 Streaming design system
   (colors_and_type.css) and 5-toolhub app/globals.css.
   ============================================================ */

:root {
  --brand-blue: #152c40;   /* page background */
  --brand-yellow: #f2d230; /* in production, focus ring */
  --brand-pink: #d966d1;   /* in beta, eyebrow heading */
  --fg: #ffffff;
  --fg-muted: #94a3b8;     /* planned, secondary labels */
  --fg-soft: rgba(255, 255, 255, 0.75);
  --hover-tint: rgba(255, 255, 255, 0.04);
  --ring-track: rgba(255, 255, 255, 0.05);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 200ms;
  --dim: 0.28;             /* opacity of non-hovered items */
  --stage-scale: 1;        /* set by app.js to fit the viewport */
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--brand-blue);
  color: var(--fg);
  font-family: "Haffer", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

p { margin: 0; }

a { color: inherit; text-decoration: none; }

::selection { background: rgba(242, 210, 48, 0.35); color: #fff; }

:focus-visible {
  outline: 2px solid var(--brand-yellow);
  outline-offset: 4px;
  border-radius: 6px;
}

/* ---------------- Top bar ---------------- */

.topbar {
  position: absolute;
  inset: 40px 48px auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-pink);
  font-weight: 500;
}

.updated { color: var(--fg-muted); }

/* ---------------- Stage ---------------- */

.stage-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 40px 0 60px;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 1280px;
  height: 700px;
  flex: none;
  transform: scale(var(--stage-scale));
  transform-origin: center center;
}

.ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.arc {
  stroke-width: 12;
  opacity: 1;
  transition: stroke-width var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}

.stage.is-hovering .arc { opacity: var(--dim); }
.stage.is-hovering .arc.is-active { stroke-width: 20; opacity: 1; }

/* ---------------- Centre ---------------- */

.centre {
  position: absolute;
  left: 640px;
  top: 330px;
  transform: translate(-50%, -50%);
  width: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  pointer-events: none;
}

.centre-logo { height: 38px; width: auto; }

.centre-title {
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
}

.centre-status {
  min-height: 34px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.centre-sub { font-size: 12px; color: var(--fg-soft); }

.centre-meta {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* ---------------- Service nodes ---------------- */

.nodes { margin: 0; padding: 0; list-style: none; }

.node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  width: 190px;
  opacity: 1;
  transition: opacity var(--dur) var(--ease-out);
}

.stage.is-hovering .node { opacity: var(--dim); }
.stage.is-hovering .node.is-active { opacity: 1; }

/* Tile positions on the 1280x700 canvas. These live here rather than in a
   style attribute on each <li> because the page is served under a CSP with no
   'unsafe-inline' in style-src — a style attribute is dropped outright, which
   collapses every tile onto the same spot. */
.node[data-arc="0"] { --x: 757px; --y: 87px; }
.node[data-arc="1"] { --x: 903px; --y: 270px; }
.node[data-arc="2"] { --x: 851px; --y: 498px; }
.node[data-arc="3"] { --x: 640px; --y: 600px; }
.node[data-arc="4"] { --x: 429px; --y: 498px; }
.node[data-arc="5"] { --x: 377px; --y: 270px; }
.node[data-arc="6"] { --x: 523px; --y: 87px; }

.node-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background var(--dur) var(--ease-out);
}

a.node-body:hover { background: var(--hover-tint); }

.node-icon { color: var(--tone); flex: none; }

.node-name {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.node-stage {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tone);
}

.node--prod    { --tone: var(--brand-yellow); }
.node--beta    { --tone: var(--brand-pink); }
.node--planned { --tone: var(--fg-muted); }
.node--planned .node-name { color: var(--fg-muted); }

/* No-JS fallback: app.js overrides --stage-scale with an exact fit, but
   without it these steps keep the 1280x700 stage inside the viewport. */
@media (min-width: 960px) and (max-width: 1099px) { :root { --stage-scale: 0.70; } }
@media (min-width: 1100px) and (max-width: 1279px) { :root { --stage-scale: 0.82; } }

/* ---------------- Narrow screens ----------------
   Below 960px the 1280x700 ring would scale text down past
   legibility, so the same markup reflows to a plain card list. */

@media (max-width: 959px) {
  .topbar {
    position: static;
    padding: 24px 20px 0;
    inset: auto;
    align-items: baseline;
  }

  .updated { white-space: nowrap; }

  .stage-wrap {
    display: block;
    min-height: 0;
    padding: 24px 20px 48px;
    overflow: visible;
  }

  .stage {
    width: 100%;
    max-width: 100%;
    height: auto;
    transform: none;
  }

  .ring { display: none; }

  .centre {
    position: static;
    transform: none;
    width: auto;
    margin: 0 auto 32px;
    max-width: 420px;
  }

  .nodes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
  }

  @media (min-width: 620px) {
    .nodes { grid-template-columns: 1fr 1fr; max-width: 720px; }
  }

  .node {
    position: static;
    transform: none;
    width: auto;
    opacity: 1;
  }

  /* Hover dimming is a ring affordance — switch it off in list mode. */
  .stage.is-hovering .node { opacity: 1; }

  .node-body {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon name"
      "icon stage";
    column-gap: 12px;
    align-items: center;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 68px;
  }

  .node-icon { grid-area: icon; width: 28px; height: 28px; }
  .node-name { grid-area: name; align-self: end; }
  .node-stage { grid-area: stage; align-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .arc, .node, .node-body { transition: none; }
}
