/* QFI Hub (internally: Hangar): page styles. Colours, fonts, the header and the profile menu come from the QFI Shell.
   The Hub's own look: a dark "hangar" banner on the left with a faint blueprint grid,
   the websites in their own dark tray with colourful tiles, and everything else quieter around them. */

/* ---------- Hub-only tokens (light and dark) ---------- */
:root {
  --hub-tray: #14181C; --hub-tray-line: rgba(255, 255, 255, .07); --hub-tile: rgba(255, 255, 255, .045);
  --hub-ink: #FFFFFF; --hub-muted: rgba(255, 255, 255, .66);
  --hub-c1: #10202A; --hub-c1b: color-mix(in srgb, var(--tab-accent) 45%, #3C7CA0);   /* steel blue, follows the theme colour */
  --hub-c2: #2A140B; --hub-c2b: var(--signal);                                              /* QFI orange */
  --hub-c3: #15171A; --hub-c3b: #5B6670;                                              /* graphite */
  --hub-c4: #2B2112; --hub-c4b: #C9973A;                                              /* warm amber, like the banner lights */
}
:root[data-theme="dark"] { --hub-tray: #171B1F; --hub-tray-line: rgba(255, 255, 255, .08); --hub-tile: rgba(255, 255, 255, .045); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hub-tray: #171B1F; --hub-tray-line: rgba(255, 255, 255, .08); --hub-tile: rgba(255, 255, 255, .045); } }

/* ---------- Page layout ---------- */
main.hub { display: grid; gap: 28px; max-width: none; margin: 0; padding: 28px 20px 72px; }
.hub-main { display: grid; gap: 36px; min-width: 0; align-content: start; }

/* ---------- The centrepiece: date, greeting and title, centred at the top of the page ---------- */
.hero {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 26px 20px 8px; text-align: center; color: var(--ink);
}
/* A soft glow behind the title: QFI orange and the theme colour */
.hero::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(760px, 90%); height: 220px; z-index: -1; pointer-events: none;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(ellipse 50% 60% at 35% 55%, color-mix(in srgb, var(--hub-c1b) 22%, transparent), transparent 70%),
    radial-gradient(ellipse 45% 55% at 68% 60%, color-mix(in srgb, var(--signal) 14%, transparent), transparent 70%);
  filter: blur(20px);
  animation: hub-glow 26s ease-in-out infinite alternate;
}
@keyframes hub-glow { from { transform: translate(-50%, -50%) scale(1); } to { transform: translate(-52%, -49%) scale(1.06); } }
.hero-emblem { width: 50px; height: auto; filter: invert(1); }   /* the bare Y: black on light pages */
:root[data-theme="dark"] .hero-emblem { filter: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-emblem { filter: none; } }
.hero-body { display: grid; justify-items: center; }
.hero-date { margin: 0; font-size: 13.5px; letter-spacing: .02em; color: var(--muted); }
.hero-hello { margin: 6px 0 0; font-size: 18px; font-weight: 500; color: var(--ink); }
.hero h1 {
  margin: 14px 0 0; font-family: var(--display); font-weight: 400;
  font-size: clamp(28px, 4vw, 52px); line-height: 1.15; letter-spacing: .03em;
}
.hero p.lead { margin: 12px 0 0; max-width: 46ch; font-size: 16px; color: var(--muted); }

/* ---------- Section headings (page) ---------- */
.sec-head {
  position: relative; margin: 0 0 14px; padding-bottom: 9px; border-bottom: 1px solid var(--line);
  font-family: var(--display); font-weight: 400; font-size: 13px; letter-spacing: .05em;
}
.sec-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 30px; height: 2px; border-radius: 2px; background: var(--tab-accent); }

/* ---------- The website tray: its own dark space, built to hold many sites ---------- */
.launchpad {
  position: relative; isolation: isolate; overflow: hidden;
  padding: 22px 22px 24px; border-radius: 28px; background: var(--hub-tray); color: var(--hub-ink);
  box-shadow: 0 30px 60px -30px rgba(10, 14, 18, .75), inset 0 0 0 1px var(--hub-tray-line);
}
.launchpad::before {   /* a faint glow along the top of the tray */
  content: ""; position: absolute; left: 10%; right: 10%; top: -60px; height: 120px; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 100%, color-mix(in srgb, var(--hub-c1b) 40%, transparent), transparent 70%); filter: blur(10px);
}
.launchpad > .sec-head {
  display: flex; align-items: center; gap: 10px; margin: 2px 4px 20px; padding: 0; border: 0;
  font-size: 15px; letter-spacing: .06em; color: var(--hub-ink);
}
.launchpad > .sec-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 18%, transparent), 0 0 14px color-mix(in srgb, var(--signal) 70%, transparent); }
.launchpad > .sec-head::after {
  position: static; flex: 1; width: auto; height: 1px; border-radius: 0; margin-left: 6px;
  background: linear-gradient(90deg, var(--hub-tray-line), transparent);
}

.sites { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.sites > li { animation: tile-in .5s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 80ms + 120ms); }
@keyframes tile-in { from { opacity: 0; transform: translateY(14px); } }

/* A tile: a coloured cover with the site's icon, a badge overlapping it, then the name, text and status */
.site {
  --c1: var(--hub-c1); --c2: var(--hub-c1b);
  position: relative; isolation: isolate; overflow: hidden; height: 100%; box-sizing: border-box;
  display: flex; flex-direction: column; text-decoration: none; color: var(--hub-ink);
  background: var(--hub-tile); border: 1px solid var(--hub-tray-line); border-radius: 22px;
  transition: transform .22s cubic-bezier(.2, .7, .2, 1), border-color .2s ease, box-shadow .22s ease, background-color .2s ease;
}
.sites > li:nth-child(4n + 2) .site { --c1: var(--hub-c2); --c2: var(--hub-c2b); }
.sites > li:nth-child(4n + 3) .site { --c1: var(--hub-c3); --c2: var(--hub-c3b); }
.sites > li:nth-child(4n + 4) .site { --c1: var(--hub-c4); --c2: var(--hub-c4b); }
/* The cover */
.site::before {
  content: ""; display: block; flex: none; height: 128px; order: -2;
  background:
    radial-gradient(circle at 18% 30%, rgba(255, 255, 255, .22) 0 6px, transparent 22px),
    radial-gradient(circle at 70% 70%, rgba(255, 255, 255, .14) 0 10px, transparent 36px),
    radial-gradient(circle at 92% 18%, rgba(255, 255, 255, .10) 0 4px, transparent 18px),
    linear-gradient(135deg, var(--c1) 0%, var(--c2) 115%);
  transition: filter .25s ease;
}
/* The site's icon, large and soft, on the cover */
.site-mark {
  position: absolute; top: -18px; right: -14px; z-index: 0; width: 150px; height: 150px; color: #FFFFFF; opacity: .2;
  transform: rotate(-8deg); transition: opacity .25s ease, transform .4s cubic-bezier(.2, .7, .2, 1);
}
.site-mark svg { width: 100%; height: 100%; }
/* The badge, overlapping the bottom of the cover */
.site-ico {
  position: relative; z-index: 1; display: grid; place-items: center; width: 58px; height: 58px; margin: -29px 0 0 20px;
  border-radius: 18px; background: #0F1316; color: #FFFFFF;
  box-shadow: 0 0 0 4px var(--hub-tray), 0 10px 20px -8px rgba(0, 0, 0, .7);
  transition: background-color .2s ease, transform .25s ease;
}
.site-ico svg { width: 26px; height: 26px; }
.site-name { margin: 14px 20px 0; font-family: var(--display); font-size: 18px; letter-spacing: .02em; line-height: 1.3; }
.site-text { margin: 8px 20px 0; color: var(--hub-muted); font-size: 14.5px; line-height: 1.55; }
.site-go {
  margin: auto 0 0; padding: 16px 20px 18px; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 14.5px; color: var(--hub-ink);
}
.site-go > span:first-child { position: relative; padding-right: 20px; }
.site-go > span:first-child::after {   /* a small arrow after "Open …" */
  content: ""; position: absolute; right: 2px; top: 50%; width: 7px; height: 7px; margin-top: -4px;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s ease;
}
.site-text + .site-go { border-top: 1px solid var(--hub-tray-line); margin-top: 18px; }
.site-status { flex: none; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, .78); background: rgba(255, 255, 255, .08); }
.site-status.hot { color: var(--on-signal, #111111); background: var(--signal); box-shadow: 0 0 14px color-mix(in srgb, var(--signal) 45%, transparent); }
/* Hover and keyboard focus */
.site:hover, .site:focus-visible {
  transform: translateY(-5px); border-color: rgba(255, 255, 255, .18); background-color: rgba(255, 255, 255, .07);
  box-shadow: 0 26px 44px -22px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .04);
}
.site:hover::before, .site:focus-visible::before { filter: brightness(1.18) saturate(1.1); }
.site:hover .site-mark, .site:focus-visible .site-mark { opacity: .32; transform: rotate(0deg) scale(1.06); }
.site:hover .site-ico, .site:focus-visible .site-ico { background: var(--signal); color: var(--on-signal, #111111); transform: translateY(-3px); }
.site:hover .site-go > span:first-child::after { transform: translateX(3px) rotate(45deg); }
.site:active { transform: translateY(-2px); }
.empty { grid-column: 1 / -1; color: var(--hub-muted); padding: 28px; text-align: center; border: 1px dashed var(--hub-tray-line); border-radius: 18px; }

/* ---------- "For you": what's waiting on you across QFI's websites ---------- */
.foryou { display: grid; }
.fy-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.fy-list > li { animation: tile-in .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms + 320ms); }
.fy-item {
  display: flex; gap: 12px; align-items: center; height: 100%; box-sizing: border-box; padding: 11px 13px; border-radius: 14px; text-decoration: none;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface)); border: 1px solid var(--card-border); box-shadow: var(--card-shadow);
  transition: box-shadow .18s ease, transform .18s ease;
}
.fy-item:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.fy-ico {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--bg); font-size: 16px;
  font-family: "QFI Icons", "Barlow", sans-serif; font-variant-emoji: text;
}
.fy-ico.hot { background: color-mix(in srgb, var(--signal) 22%, transparent); }
.fy-text { display: grid; flex: 1; min-width: 0; }
.fy-text strong { font-weight: 600; font-size: 14.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fy-text span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fy-go { flex: none; width: 16px; height: 16px; color: var(--muted); transition: transform .18s ease, color .18s ease; }
.fy-item:hover .fy-go { transform: translateX(3px); color: var(--signal); }

/* ---------- Around QFI: your card, new colleagues, recently updated in Codex ---------- */
.side { display: grid; gap: 30px; align-content: start; min-width: 0; }
.side-card .pv-card { box-shadow: var(--card-shadow); border: 1px solid var(--card-border); background: linear-gradient(180deg, var(--surface-hi), var(--surface)); border-radius: 20px; }
.side-card .pv-card:hover { box-shadow: var(--card-shadow-hover); }
.side-card .pv-cover { height: 84px; }
.side-card .pv-card.has-cover .pv-body { margin-top: -42px; }
.side-sec { display: grid; align-content: start; }
.side-sec .sec-head { margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .03em; }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-list > li { animation: tile-in .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 50ms + 360ms); }
.side-item { display: flex; gap: 11px; align-items: center; padding: 7px 8px; border-radius: 12px; text-decoration: none; transition: background-color .15s ease; }
.side-item:hover { background: color-mix(in srgb, var(--surface) 80%, transparent); }
.side-item .qs-av, .side-item .qp-av { flex: none; width: 36px; height: 36px; font-size: 12px; }
.side-text { display: grid; min-width: 0; }
.side-text strong { font-weight: 600; font-size: 14px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.side-text > span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-meta { font-size: 11.5px !important; }
.side-kind { flex: none; align-self: flex-start; margin-top: 2px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted); }
.side-kind.policy { background: color-mix(in srgb, var(--tab-accent) 16%, transparent); color: var(--tab-accent); }
.side-kind.process { background: color-mix(in srgb, var(--signal) 18%, transparent); color: var(--ink); }

/* ---------- Wider screens ---------- */
/* Laptops and up: the centrepiece across the top, then the websites and For you; Around QFI underneath */
@media (min-width: 1100px) {
  main.hub { grid-template-columns: minmax(0, 1fr); padding: 30px 36px 72px; align-items: start; }
  .hero { grid-column: 1 / -1; }
  .side { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 32px; }
}
/* Large screens: Around QFI gets its own column on the right */
@media (min-width: 1480px) {
  main.hub { grid-template-columns: minmax(0, 1fr) 320px; column-gap: 32px; }
  .hub-main { grid-column: 1; grid-row: 2; }
  .side { grid-column: 2; grid-row: 2; grid-template-columns: minmax(0, 1fr); position: sticky; top: 20px;
    padding-left: 28px; border-left: 1px solid var(--divider); }
}
/* Very wide: bigger tiles */
@media (min-width: 1900px) {
  main.hub { grid-template-columns: minmax(0, 1fr) 360px; }
  .sites { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
  .site::before { height: 148px; }
}

/* Phones */
@media (max-width: 760px) {
  main.hub { padding: 18px 14px 56px; gap: 22px; }
  .hero { padding: 14px 8px 0; }
  .hero-emblem { width: 42px; }
  .hero h1 { font-size: 26px; }
  .launchpad { padding: 18px 14px 16px; border-radius: 22px; }
  .sites { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .site::before { height: 108px; }
  .fy-list { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .hero::before, .sites > li, .fy-list > li, .side-list > li { animation: none; }
  .site, .site::before, .site-mark, .site-ico, .site-go > span:first-child::after, .fy-item, .fy-go { transition: none; }
  .site:hover, .site:focus-visible, .site:hover .site-ico, .site:hover .site-mark { transform: none; }
}

/* ---------- The QFI header as a sidebar on the left (Hub only; other sites keep the header on top) ---------- */
@media (min-width: 1100px) {
  body { padding-left: 248px; }
  #qfi-top.qs-top {
    position: fixed; left: 0; top: 0; bottom: 0; width: 248px; box-sizing: border-box; z-index: 50;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 18px;
    min-height: 0; padding: 30px 22px 24px; border-bottom: 0; border-right: 2px solid var(--signal);
  }
  /* The drone photo, faded, in the lower part of the sidebar */
  #qfi-top.qs-top::before {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 62%;
    background-position: 38% center; opacity: .12;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .6) 40%, #000 85%); mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .6) 40%, #000 85%);
    -webkit-mask-composite: source-over; mask-composite: add;
  }
  /* Logo on top, "Hub" underneath */
  #qfi-top .qs-mark { flex-direction: column; align-items: flex-start; gap: 14px; }
  #qfi-top .qs-word { height: 46px; }
  #qfi-top .qs-app { padding-left: 0; padding-top: 14px; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .25); line-height: 1; width: 100%; font-size: 20px; }
  /* Notifications and your profile at the bottom */
  #qfi-top .qs-actions { margin: auto 0 0; flex-direction: column; align-items: stretch; gap: 10px; }
  #qfi-top .qs-bell { align-self: flex-start; }
  /* Your profile: part of the sidebar, no box of its own */
  #qfi-top .qs-trigger { width: 100%; justify-content: flex-start; padding: 6px 4px; background: none; border-radius: 12px; }
  #qfi-top .qs-trigger:hover, #qfi-top .qs-trigger[aria-expanded="true"] { background: none; }
  #qfi-top .qs-trigger:hover .qs-tlabel { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--signal); }
  #qfi-top .qs-trigger svg { margin-left: auto; transform: rotate(-90deg); }
  #qfi-top .qs-trigger[aria-expanded="true"] svg { transform: rotate(90deg); }
  /* Menus open to the right of the sidebar */
  #qfi-top .qs-bell, #qfi-top .qs-me { position: static; }
  #qfi-top .qs-drop { left: calc(100% + 14px); right: auto; top: auto; bottom: 20px; max-height: calc(100vh - 40px); }
  #qfi-top .qs-me .qs-drop::before { left: -20px; right: auto; top: 0; bottom: 0; width: 20px; height: auto; }
}

/* ---------- Website tiles: each one a different design (cycles every four sites) ---------- */
/* Cut corners on every tile, like an instrument panel; the shadow follows the cut */
.sites > li { filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .35)); }
.site {
  border: 0; border-radius: 0;
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  box-shadow: inset 0 0 0 1px var(--hub-tray-line);
}
.site:hover, .site:focus-visible { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }

/* 1: radar rings, angled cover, hexagon badge */
.site::before {
  background:
    repeating-radial-gradient(circle at 85% 115%, rgba(255, 255, 255, .13) 0 1px, transparent 1.5px 17px),
    linear-gradient(135deg, var(--c1) 0%, var(--c2) 115%);
  clip-path: polygon(0 0, 100% 0, 100% 72%, 0 100%);
}
.site-ico { border-radius: 0; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); width: 62px; height: 58px; box-shadow: none; }

/* 2: hazard stripes, cover cut the other way, round badge */
.sites > li:nth-child(4n + 2) .site::before {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .11) 0 2px, transparent 2px 13px),
    linear-gradient(135deg, var(--c1) 0%, var(--c2) 115%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 72%);
}
.sites > li:nth-child(4n + 2) .site-ico { clip-path: none; border-radius: 50%; width: 58px; box-shadow: 0 0 0 4px var(--hub-tray); }

/* 3: dot grid, chevron-shaped cover, diamond badge */
.sites > li:nth-child(4n + 3) .site::before {
  background:
    radial-gradient(circle, rgba(255, 255, 255, .2) 1.2px, transparent 1.7px) 0 0 / 14px 14px,
    linear-gradient(135deg, var(--c1) 0%, var(--c2) 115%);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
}
.sites > li:nth-child(4n + 3) .site-ico {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); border-radius: 0; width: 66px; height: 66px; margin-top: -33px;
}

/* 4: contour lines, curved cover, rounded-square badge */
.sites > li:nth-child(4n + 4) .site::before {
  background:
    repeating-radial-gradient(ellipse 140% 90% at 10% -10%, rgba(255, 255, 255, .12) 0 1px, transparent 1.5px 12px),
    linear-gradient(135deg, var(--c1) 0%, var(--c2) 115%);
  clip-path: none; border-radius: 0 0 50% 50% / 0 0 28px 28px;
}
.sites > li:nth-child(4n + 4) .site-ico { clip-path: none; border-radius: 18px; box-shadow: 0 0 0 4px var(--hub-tray); }

/* The badge sits centred on tiles 3 and 4 for variety */
.sites > li:nth-child(4n + 3) .site-ico, .sites > li:nth-child(4n + 4) .site-ico { align-self: center; margin-left: 0; }
.sites > li:nth-child(4n + 3) .site-name, .sites > li:nth-child(4n + 4) .site-name,
.sites > li:nth-child(4n + 3) .site-text, .sites > li:nth-child(4n + 4) .site-text { text-align: center; }
.sites > li:nth-child(4n + 3) .site-go, .sites > li:nth-child(4n + 4) .site-go { justify-content: center; }

@media (prefers-reduced-motion: reduce) { .sites > li { filter: none; } }

/* ---------- Tiles: the design fills the whole tile as its background; no icons ---------- */
.site { min-height: 250px; }
.site::before, .sites > li:nth-child(4n + 2) .site::before, .sites > li:nth-child(4n + 3) .site::before, .sites > li:nth-child(4n + 4) .site::before {
  position: absolute; inset: 0; height: auto; z-index: -2; clip-path: none; border-radius: 0;
}
/* A darker fade at the bottom so the text stays easy to read */
.site::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 10, 12, .05) 0%, rgba(8, 10, 12, .35) 45%, rgba(8, 10, 12, .78) 100%);
}
.site-ico, .site-mark { display: none; }
.site-name { margin-top: auto; padding-top: 70px; font-size: 20px; text-shadow: 0 2px 12px rgba(0, 0, 0, .45); }
.site-text { color: rgba(255, 255, 255, .82); }
.site-text + .site-go { border-top-color: rgba(255, 255, 255, .16); }
.site-go { margin-top: 18px; }
.site-status { background: rgba(0, 0, 0, .35); color: rgba(255, 255, 255, .88); }
.site:hover, .site:focus-visible { background-color: transparent; }
@media (max-width: 760px) { .site { min-height: 210px; } .site-name { padding-top: 48px; } }

/* More room between a tile's name and its description */
.site-text { margin-top: 16px; }

/* Tile names sit high, right under the top edge */
.site-name { margin-top: 0; padding-top: 28px; }
.site-go { margin-top: auto; }
.site-text + .site-go { margin-top: auto; }
.site-text { margin-bottom: 22px; }
@media (max-width: 760px) { .site-name { padding-top: 22px; } }

/* ---------- One background: the page and the sidebar share a faint blueprint grid and soft glows;
   the sidebar floats on it as a rounded dark panel instead of being split off by a line ---------- */
:root { --hub-grid: rgba(20, 32, 44, .055); --hub-glow-a: color-mix(in srgb, var(--hub-c1b) 16%, transparent); --hub-glow-b: color-mix(in srgb, var(--signal) 7%, transparent); }
:root[data-theme="dark"] { --hub-grid: rgba(255, 255, 255, .035); --hub-glow-a: color-mix(in srgb, var(--hub-c1b) 18%, transparent); --hub-glow-b: color-mix(in srgb, var(--signal) 6%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hub-grid: rgba(255, 255, 255, .035); --hub-glow-a: color-mix(in srgb, var(--hub-c1b) 18%, transparent); --hub-glow-b: color-mix(in srgb, var(--signal) 6%, transparent); } }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 50% 40% at 18% 0%, var(--hub-glow-a), transparent 70%),
    radial-gradient(ellipse 45% 40% at 95% 100%, var(--hub-glow-b), transparent 70%),
    linear-gradient(var(--hub-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--hub-grid) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
  background-attachment: fixed;
}
@media (min-width: 1100px) {
  body { padding-left: 268px; }
  main.hub { padding-left: 36px; }
  #qfi-top.qs-top {
    left: 16px; top: 16px; bottom: 16px; width: 240px; border: 0; border-radius: 26px; overflow: hidden;
    padding: 28px 20px 20px;
    background:
      radial-gradient(ellipse 120% 40% at 0% 0%, color-mix(in srgb, var(--hub-c1b) 30%, transparent), transparent 70%),
      radial-gradient(ellipse 120% 35% at 50% 105%, color-mix(in srgb, var(--signal) 22%, transparent), transparent 70%),
      var(--brand);
    box-shadow: 0 24px 50px -24px rgba(10, 14, 18, .7), inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 1px 0 rgba(255, 255, 255, .1);
  }
  /* A short orange accent under "Hub" */
  #qfi-top .qs-app { position: relative; }
  #qfi-top .qs-app::after { content: ""; position: absolute; left: 0; top: -1px; width: 30px; height: 2px; border-radius: 2px; background: var(--signal); }
  #qfi-top .qs-drop { left: calc(100% + 16px); }
}
.sites { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

/* ---------- Fixes on top of the design ---------- */
/* The sidebar must not clip its own menus (the bell and My profile open to its right): only the photo is clipped */
@media (min-width: 1100px) {
  #qfi-top.qs-top { overflow: visible; }
  #qfi-top.qs-top::before { border-radius: 0 0 26px 26px; }
  #qfi-top .qs-drop { z-index: 80; }
}

/* ---------- Tile status line: hover or tap for that site's list ---------- */
.site-li { position: relative; }
.site-status-space { visibility: hidden; padding: 3px 10px; font-size: 12.5px; font-weight: 600; }   /* keeps the room where the real one sits */
.site-peek { position: absolute; right: 22px; bottom: 22px; z-index: 5; }
.site-peek .site-status { border: 0; font: inherit; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  background: rgba(0, 0, 0, .35); color: rgba(255, 255, 255, .88); transition: background-color .15s ease; }
.site-peek .site-status.hot { background: var(--signal); color: var(--on-signal, #111111); }
.site-peek .site-status:hover, .site-peek.open .site-status { background: rgba(0, 0, 0, .55); }
.site-peek .site-status.hot:hover, .site-peek.open .site-status.hot { background: color-mix(in srgb, var(--signal) 85%, #FFFFFF); }
.sites > li:nth-child(4n + 3) .site-peek, .sites > li:nth-child(4n + 4) .site-peek { right: 50%; transform: translateX(50%); }
.sites > li:nth-child(4n + 3) .site-go, .sites > li:nth-child(4n + 4) .site-go { flex-direction: column; }
/* The list opens upwards, inside the tile, so the tray never cuts it off */
.peek-pop { position: absolute; right: -8px; bottom: calc(100% + 10px); width: min(300px, calc(100vw - 48px)); padding: 8px;
  background: var(--surface-hi); color: var(--ink); border: 1px solid var(--card-border); border-radius: 16px; box-shadow: var(--card-shadow-hover);
  animation: peek-in .16s ease-out; }
.sites > li:nth-child(4n + 3) .peek-pop, .sites > li:nth-child(4n + 4) .peek-pop { right: auto; left: 50%; transform: translateX(-50%); animation-name: peek-in-c; }
@keyframes peek-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes peek-in-c { from { opacity: 0; transform: translate(-50%, 6px); } }
.peek-pop::after { content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 12px; }   /* a bridge, so the pointer can move up into the list */
.peek-title { margin: 2px 6px 6px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
/* Three items visible; scroll for more */
.peek-list { list-style: none; margin: 0; padding: 0; max-height: 186px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 2px; }
.peek-item { display: flex; gap: 10px; align-items: flex-start; min-height: 60px; box-sizing: border-box; padding: 8px; border-radius: 10px; color: inherit; text-decoration: none; }
.peek-item:hover, .peek-item:focus-visible { background: var(--bg); }
.peek-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--bg); font-size: 15px;
  font-family: "QFI Icons", "Barlow", sans-serif; font-variant-emoji: text; }
.peek-ico.hot { background: color-mix(in srgb, var(--signal) 22%, transparent); }
.peek-text { display: grid; min-width: 0; }
.peek-text strong { font-size: 13.5px; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.peek-item.unread .peek-text strong { font-weight: 700; }
.peek-text span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peek-text .peek-when { font-size: 11.5px; }
@media (prefers-reduced-motion: reduce) { .peek-pop { animation: none; } }

/* ---------- Tiles: no "Open …" line; the status is a bar across the bottom of the tile ---------- */
.site-bar-space { display: block; flex: none; height: 44px; margin-top: auto; }
.site-text { margin-bottom: 18px; }
.site-peek { position: absolute; left: 0; right: 0; bottom: 0; transform: none; z-index: 5; }
.sites > li:nth-child(4n + 3) .site-peek, .sites > li:nth-child(4n + 4) .site-peek { right: 0; transform: none; }
.site-peek .site-status {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px; padding: 0 22px; border: 0; border-radius: 0;
  font: inherit; font-size: 13.5px; font-weight: 600; letter-spacing: .01em; cursor: pointer;
  background: rgba(0, 0, 0, .42); color: rgba(255, 255, 255, .9); border-top: 1px solid rgba(255, 255, 255, .1);
  /* the same cut corner as the tile */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
  transition: background-color .15s ease;
}
.site-peek .site-status svg { width: 15px; height: 15px; flex: none; transition: transform .2s ease; }
.site-peek.open .site-status svg { transform: rotate(180deg); }
.site-peek .site-status.hot { background: var(--signal); color: var(--on-signal, #111111); border-top-color: transparent; }
.site-peek .site-status:hover, .site-peek.open .site-status { background: rgba(0, 0, 0, .6); }
.site-peek .site-status.hot:hover, .site-peek.open .site-status.hot { background: color-mix(in srgb, var(--signal) 85%, #FFFFFF); }
/* The bar moves with the tile when you hover it */
.site-li .site, .site-li .site-peek { transition: transform .22s cubic-bezier(.2, .7, .2, 1); }
.sites > li.site-li:hover .site, .sites > li.site-li:focus-within .site, .sites > li.site-li.peek-open .site,
.sites > li.site-li:hover .site-peek, .sites > li.site-li:focus-within .site-peek, .sites > li.site-li.peek-open .site-peek { transform: translateY(-5px); }   /* on every tile, whatever its position */
/* The list opens downwards, under the tile, above the tiles below it */
.site-li.peek-open { z-index: 30; }
.peek-pop, .sites > li:nth-child(4n + 3) .peek-pop, .sites > li:nth-child(4n + 4) .peek-pop {
  top: calc(100% + 8px); bottom: auto; left: 0; right: 0; width: auto; transform: none; animation-name: peek-down; }
@keyframes peek-down { from { opacity: 0; transform: translateY(-6px); } }
.peek-pop::after { top: -10px; bottom: auto; height: 10px; }   /* bridge from the bar into the list */
/* The tray lets the list hang out underneath it; only its top glow stays clipped */
.launchpad { overflow: visible; }
.launchpad::before { clip-path: inset(60px 0 0 0); }

/* ---------- Side column: Recently updated, per website ---------- */
.side-head { margin-bottom: 4px; }
.side-site { margin: 16px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-kind.voice { background: color-mix(in srgb, var(--hub-c1b) 22%, transparent); color: var(--ink); }
.side-kind.admin { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .site-li .site, .site-li .site-peek, .site-peek .site-status svg { transition: none; }
  .sites > li.site-li:hover .site, .sites > li.site-li:hover .site-peek, .sites > li.site-li:focus-within .site, .sites > li.site-li:focus-within .site-peek, .sites > li.site-li.peek-open .site, .sites > li.site-li.peek-open .site-peek { transform: none; }
}

/* ---------- "Coming soon" tiles: shown, not clickable ---------- */
.site-li.soon .site { cursor: default; filter: saturate(.35); opacity: .78; }
.sites > li.site-li.soon:hover .site { transform: none; box-shadow: none; }
.site-li.soon .site::before { display: none; }
.site-soon { align-self: center; margin-top: auto; margin-bottom: 18px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .35); border: 1px dashed rgba(255, 255, 255, .3); }

/* ---------- Every tile's name and text aligned to the left, the same on all tiles ---------- */
.sites > li .site-name, .sites > li .site-text { text-align: left !important; }
.sites > li .site-soon { align-self: flex-start; margin-left: 20px; }

/* ---------- No "Recently updated" column: the websites and the centrepiece use the full width ---------- */
#side { display: none !important; }
@media (min-width: 1480px) { main.hub { grid-template-columns: minmax(0, 1fr); } }

/* The top-left pills (QFI Hub, View as) inside the sidebar, where QFI Hub sits */
@media (min-width: 1100px) {
  #qfi-top .qs-pills { position: static; align-self: flex-start; margin-bottom: 8px; }
  #qfi-top .qs-pills .qs-hub { margin-bottom: 0; }
}

/* A tile whose website isn't live yet, for the people who can still go in (General Admins, its own admins) */
.site-flag { align-self: start; margin-top: 10px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: #FFFFFF; background: rgba(0, 0, 0, .4); border: 1px dashed rgba(255, 255, 255, .45); }
.site-flag.off { border-style: solid; border-color: rgba(255, 120, 90, .7); }

/* The tiles appear once, all together, in a single fade (no tile-by-tile entrance, and no animation when they update) */
.sites > li { animation: none; }
.sites.sites-wait { min-height: 220px; }
.sites.sites-in { animation: sites-fade .5s ease both; }
@keyframes sites-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sites.sites-in { animation: none; } }
