/* Start page at /: the Pulse brand, a role picker and a preview of each console. */
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/nunito-sans-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --field: linear-gradient(62deg, #5b2134 0%, #442c4c 24%, #33345e 50%, #1e3e74 76%, #064a8c 100%);
  --on-field: #ffffff;
  --on-field-muted: rgba(255, 255, 255, 0.74);
  --glass: rgba(255, 255, 255, 0.12);
  --lit: #e9ecf1;
  --ink: #201d3a;
  --muted: #5f5c7a;
  --ground: #f4f4f8;
  --sheet: #ffffff;
  --tone: #e9e8f2;
  --rule: #e1e0eb;
  --bar: #474d8c;
  --bar-today: #b9bcdb;
  --text: "Nunito Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23201d3a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.5 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #8fb4ff; outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { width: min(1200px, 100% - 48px); margin-inline: auto; }

/* Hero */
.hero { background: var(--field); color: var(--on-field); padding-block: 24px 150px; }

.hero-body {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  grid-template-areas: "intro video"; align-items: center; gap: 0 64px; padding-block: 72px 56px;
}
.intro { grid-area: intro; }
.wordmark { display: flex; align-items: center; gap: 0.2em; margin: 0; font-size: clamp(88px, 9vw, 136px); font-weight: 900; letter-spacing: -0.04em; line-height: 0.86; }
.mark { flex: none; width: auto; height: 0.86em; overflow: visible; }
.repo-link {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 20px; border-radius: 6px;
  font-size: 16px; font-weight: 700; color: var(--on-field); text-decoration: none;
}
.repo-link svg { width: 20px; height: 20px; opacity: 0.85; }
.repo-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.tagline { margin: 18px 0 0; max-width: 30ch; font-size: clamp(20px, 2vw, 26px); line-height: 1.3; color: var(--on-field-muted); }

/* Video */
.video {
  grid-area: video; align-self: center;
  display: grid; gap: 14px; padding: 10px 10px 18px;
  border-radius: 22px; background: var(--lit); color: var(--ink); text-decoration: none;
  box-shadow: 0 18px 48px rgba(14, 10, 40, 0.45);
}
.video:hover { background: #ffffff; }
.video-poster { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; }
.video-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-poster::after { content: ""; position: absolute; inset: 0; background: rgba(16, 18, 36, 0.4); transition: background-color 160ms ease-out; }
.play { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; }
.play span {
  display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%;
  background: #ffffff; color: var(--ink); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  transition: transform 160ms ease-out, box-shadow 160ms ease-out;
}
.video:hover .video-poster::after, .video:focus-visible .video-poster::after { background: rgba(16, 18, 36, 0.2); }
.video:hover .play span, .video:focus-visible .play span {
  transform: scale(1.12); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.22), 0 6px 22px rgba(0, 0, 0, 0.4);
}
.play svg { width: 26px; height: 26px; margin-left: 4px; }
.video-text { padding-inline: 10px; }
.video-text b { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }

/* Video dialog */
.video-dialog { width: min(1100px, 100% - 32px); max-width: none; padding: 0; border: 0; border-radius: 16px; background: #0f1020; overflow: visible; }
.video-dialog::backdrop { background: rgba(16, 12, 36, 0.82); }
.video-frame { aspect-ratio: 16 / 9; }
.video-frame iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 16px; }
.video-close {
  position: absolute; top: -56px; right: 0; display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: #ffffff; color: var(--ink); cursor: pointer;
}
.video-close svg { width: 16px; height: 16px; }

/* Role picker: tabs on the top edge of the preview, which rises into the hero */
.picker { position: relative; margin-top: -150px; color: var(--on-field); }
.picker-label { margin: 0 0 12px; font-weight: 700; }
.role-select { display: none; }
.roles { display: flex; align-items: flex-end; gap: 8px; }
.role {
  position: relative; display: grid; gap: 2px; min-width: 216px; padding: 14px 22px 16px;
  border: 0; border-radius: 14px 14px 0 0; text-align: left; cursor: pointer;
  background: var(--glass); color: var(--on-field);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.4);
  transition: background-color 160ms ease-out, box-shadow 160ms ease-out;
}
.role b { font-size: 18px; font-weight: 800; }
.role span { font-size: 14px; color: var(--on-field-muted); transition: color 160ms ease-out; }
.role:hover { background: rgba(255, 255, 255, 0.24); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.7); }
.role:hover span { color: var(--on-field); }
.role[aria-selected="true"] { z-index: 1; margin-bottom: -1px; padding-bottom: 17px; background: var(--sheet); color: var(--ink); box-shadow: none; cursor: default; }
.role[aria-selected="true"] span { color: var(--muted); }

/* Preview */
main { padding-bottom: 56px; }
.preview { position: relative; padding: 28px 32px 32px; border: 1px solid var(--rule); border-radius: 0 16px 16px 16px; background: var(--sheet); box-shadow: 0 24px 48px rgba(14, 10, 40, 0.12); }
.preview-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.preview-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.preview-title h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
.preview-note { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.status { margin: 0; color: var(--muted); }
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 240px; font-weight: 600; color: var(--muted); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--rule); border-top-color: var(--bar); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.project-menu { position: relative; max-width: 100%; }
.project-button {
  min-width: 140px; max-width: 100%; height: 40px; padding: 0 40px 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ground) var(--chevron) no-repeat right 14px center / 14px; box-shadow: inset 0 0 0 1px var(--rule);
  font-size: 15px; font-weight: 700; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-button:hover, .project-button[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--muted); }
.project-list {
  position: absolute; z-index: 3; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: min(320px, 100vw - 48px);
  max-height: 320px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  border-radius: 14px; background: var(--sheet); box-shadow: 0 0 0 1px var(--rule), 0 18px 40px rgba(14, 10, 40, 0.16);
}
.project-list button {
  display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  font-size: 15px; font-weight: 700; text-align: left; color: var(--muted);
}
.project-list button:hover { background: var(--ground); color: var(--ink); }
.project-list button[aria-current="true"] { background: var(--tone); color: var(--ink); }

.button { display: inline-flex; align-items: center; height: 44px; padding: 0 20px; border-radius: 999px; font-size: 15px; font-weight: 700; text-decoration: none; }
.button-line { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1.5px #cfcde0; }
.button-line:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }

/* View site */
.head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; align-self: flex-start; gap: 8px 12px; margin-left: auto; }
.visit-split { display: inline-flex; height: 44px; border-radius: 999px; background: var(--ink); color: #ffffff; }
.visit-split a, .visit-split button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; }
.visit-split a { padding: 0 18px 0 20px; border-radius: 999px 0 0 999px; }
.visit-split button { padding: 0 16px 0 14px; border-left: 1px solid rgba(255, 255, 255, 0.28); border-radius: 0 999px 999px 0; }
.visit-split button:disabled { color: rgba(255, 255, 255, 0.4); cursor: not-allowed; }
.visit-split svg { width: 16px; height: 16px; }
.visit-split button svg { width: 18px; height: 18px; }
.visit-note { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--muted); text-align: right; }

.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--rule); }
.figure-label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.info {
  position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: var(--tone); color: var(--muted); font-size: 11px; font-weight: 800; line-height: 1; cursor: help;
}
.info:hover, .info:focus-visible { background: var(--ink); color: #ffffff; }
.info::after, .info::before {
  position: absolute; z-index: 2; opacity: 0; visibility: hidden; transition: opacity 120ms ease-out, visibility 120ms;
}
.info::after {
  content: attr(data-tip); left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
  width: max-content; max-width: 240px; padding: 8px 10px; border-radius: 8px;
  background: var(--ink); color: #ffffff; font-size: 13px; font-weight: 600; line-height: 1.35; text-align: left;
}
.info::before {
  content: ""; left: 50%; bottom: calc(100% + 3px); margin-left: -8px;
  border-width: 8px 8px 0; border-style: solid; border-color: var(--ink) transparent transparent;
}
.info:hover::after, .info:focus-visible::after, .info:hover::before, .info:focus-visible::before { opacity: 1; visibility: visible; }
.figure-value { margin: 2px 0 0; font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.figure-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; margin-top: 24px; }
.block-title { margin: 0 0 14px; font-size: 16px; font-weight: 800; }
.chart { height: 200px; }
.chart rect { fill: var(--bar); }
.chart .today { fill: var(--bar-today); }
.chart line { stroke: #cfcde0; }
.axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--muted); }

.ranked { margin: 0; padding: 0; list-style: none; }
.ranked li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 9px 0; font-size: 15px; }
.ranked li + li { border-top: 1px solid var(--rule); }
.meter { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--bar); }

.table-wrap { margin-top: 20px; overflow-x: auto; }
table { width: 100%; min-width: 640px; border-collapse: collapse; }
th { padding: 10px 12px; border-bottom: 1px solid var(--rule); font-size: 14px; font-weight: 700; text-align: left; color: var(--muted); }
td { padding: 14px 12px; border-bottom: 1px solid var(--rule); }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
td.num { font-weight: 800; }
.name b { display: block; font-weight: 800; }
.name span, .name a { font-size: 14px; color: var(--muted); }
.name a:hover { color: var(--ink); }
.small { color: var(--muted); font-weight: 600; }
.figure-value .small { font-size: 24px; }

/* Footer */
.site-footer { background: var(--ink); color: var(--on-field-muted); }
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 28px; }
.footer-credit { display: inline-flex; align-items: center; gap: 8px; border-radius: 6px; color: inherit; text-decoration: none; }
.footer-credit-label { font-size: 14px; }
.footer-credit svg { display: block; color: #c5c2cb; transition: color 0.2s ease; }
.footer-credit:hover svg, .footer-credit:focus-visible svg { color: #ffffff; }
.footer-source { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -7px; border-radius: 50%; color: inherit; transition: color 160ms ease-out; }
.footer-source:hover { color: var(--on-field); }
.footer-source svg { width: 20px; height: 20px; }

@media (max-width: 760px) {
  .hero { padding-bottom: 0; }
  .hero-body { grid-template-columns: 1fr; grid-template-areas: "intro" "video"; padding-block: 36px 24px; }
  .wordmark { font-size: 68px; }
  .video { margin-top: 24px; padding: 8px 8px 14px; border-radius: 18px; }
  .video-poster { border-radius: 11px; }
  .play span { width: 60px; height: 60px; }
  .play svg { width: 22px; height: 22px; }
  .video-text b { font-size: 20px; }
  .picker { margin-top: 24px; color: var(--ink); }
  .roles { display: none; }
  .preview-head > div { flex: 1 1 100%; }
  .preview-head .button { flex: 1 1 100%; justify-content: center; }
  .visit-split { flex: 1 1 100%; }
  .visit-split a { flex: 1; justify-content: center; }
  .visit-note { text-align: left; }
  .role-select {
    display: block; width: 100%; height: 52px; padding: 0 48px 0 16px;
    border: 2px solid var(--ink); border-radius: 14px; appearance: none; cursor: pointer;
    background: #ffffff var(--chevron) no-repeat right 16px center / 16px;
    font: 800 18px/1 var(--text); color: var(--ink);
  }
  .preview { margin-top: 12px; padding: 22px 18px; border-radius: 16px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info::after { max-width: 160px; }
  .split { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .spinner { animation-duration: 2.4s; }
}
