/*
 * BGPer shared UI: tokens, header, drawer, page hero, footer, buttons, type.
 * Loaded on every page. Everything is scoped to .bgper-ui so it never leaks into
 * Neve / Elementor content: the front page puts .bgper-ui on <body>, inner pages
 * only on the header, page hero and footer.
 */
:root {
  --bg: #FBFBFA;
  --bone: #F7F6F3;
  --surface: #FFFFFF;
  --ink: #111111;
  --text: #2F3437;
  --muted: #6B6A67;   /* 5.3:1 on --bg: small mono labels and dates stay readable */
  --faint: #A9A9A6;   /* decorative arrows and inactive marks only, never text that must be read */
  --line: #EAEAEA;
  --line-soft: rgba(0,0,0,0.06);
  --line-strong: #CFCFCC; /* hovered borders, wires, separators */
  --accent: #1F6C9F;
  --blue-bg: #E1F3FE;
  --red: #9F2F2D;   --red-bg: #FDEBEC;
  --green: #346538; --green-bg: #EDF3EC;
  --yellow: #956400; --yellow-bg: #FBF3DB;
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  /* headings: Geist set tight and heavy reads technical and formal */
  --display: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* three elevations: resting lift, hovered card, floating layer */
  --shadow-rest: 0 1px 2px rgba(17,17,17,0.04), 0 12px 32px -24px rgba(17,17,17,0.18);
  --shadow-hover: 0 2px 8px rgba(17,17,17,0.04), 0 16px 40px -20px rgba(17,17,17,0.16);
  --shadow-float: 0 24px 80px rgba(17,17,17,0.18);
  --wrap: 1180px;
  --nav-h: 68px;
}

/* ---------- resets inside our components (Neve styles bare elements) ---------- */
.bgper-ui, .bgper-ui *, .bgper-ui *::before, .bgper-ui *::after { box-sizing: border-box; }
.bgper-ui a { color: inherit; text-decoration: none; }
.bgper-ui ul { list-style: none; margin: 0; padding: 0; }
.bgper-ui button {
  font: inherit; line-height: 1; margin: 0; padding: 0; min-height: 0; box-shadow: none;
  text-transform: none; letter-spacing: normal; cursor: pointer;
}
.bgper-ui img { display: block; max-width: 100%; }
.bgper-ui h1, .bgper-ui h2, .bgper-ui h3, .bgper-ui h4, .bgper-ui h5 { color: var(--ink); margin: 0; font-weight: 400; }
.bgper-ui .wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .bgper-ui .wrap { padding: 0 16px; } }

/* ---------- type ---------- */
.bgper-ui .eyebrow {
  font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 10px;
}
.bgper-ui .eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.bgper-ui .display {
  font-family: var(--display); font-weight: 600; font-size: clamp(38px, 5.8vw, 78px);
  line-height: 1.04; letter-spacing: -0.045em;
}
.bgper-ui .display em { font-style: normal; color: var(--accent); }
.bgper-ui .h2 { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 3.8vw, 48px); line-height: 1.1; letter-spacing: -0.045em; }
.bgper-ui :is(h1, h2, h3, h4) { text-wrap: balance; }
.bgper-ui p { text-wrap: pretty; }
.bgper-ui .lede { font-size: clamp(16px, 1.4vw, 18px); color: var(--muted); max-width: 34em; }

/* ---------- buttons & links ---------- */
.bgper-ui .btn {
  display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 20px;
  border-radius: 6px; font: 500 15px/1 var(--sans); border: 1px solid transparent;
  transition: background .2s, border-color .2s, transform .15s var(--ease);
}
.bgper-ui .btn:active { transform: scale(0.96); }
.bgper-ui .btn-dark { background: var(--ink); color: #fff; }
.bgper-ui .btn-dark:hover { background: #333; color: #fff; }
.bgper-ui .btn-ghost { border-color: var(--line); background: var(--surface); color: var(--ink); }
.bgper-ui .btn-ghost:hover { border-color: var(--line-strong); }
.bgper-ui .btn i { transition: transform .3s var(--ease); }
.bgper-ui .btn:hover i { transform: translateX(3px); }
.bgper-ui .link {
  display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; font-size: 15px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .3s var(--ease);
}
.bgper-ui .link:hover { background-size: 100% 1px; }
.bgper-ui .link i { transition: transform .3s var(--ease); }
.bgper-ui .link:hover i { transform: translate(2px, -2px); }
/* touch screens: small text links get a taller hit area (44px) without changing the layout */
@media (pointer: coarse) {
  .bgper-ui .foot-links a { padding: 11px 0; }
  .bgper-ui .link { position: relative; }
  .bgper-ui .link::after { content: ""; position: absolute; left: -4px; right: -4px; top: 50%; height: 44px; transform: translateY(-50%); }
}
.bgper-ui .icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink); cursor: pointer; font-size: 17px;
}
.bgper-ui .icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }

/* ---------- header ---------- */
.bgper-ui.nav {
  position: sticky; top: 0; z-index: 50; font-family: var(--sans);
  border-bottom: 1px solid transparent; transition: background .3s, border-color .3s;
}
.bgper-ui.nav.scrolled, .bgper-ui.nav.search-open {
  background: rgba(251,251,250,0.85); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-color: var(--line);
}
.bgper-ui .nav-inner { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); }
.bgper-ui .brand { display: flex; align-items: center; gap: 10px; font: 600 18px/1 var(--sans); color: var(--ink); letter-spacing: -0.02em; }
/* uploads/2022/05/logo.png is white (made for the old purple header): render it in ink */
.bgper-ui .brand-logo { height: 30px; width: auto; filter: brightness(0); opacity: .92; }
.bgper-ui .drawer-head .brand-logo { height: 26px; }

/* menu: a line under the current page that slides to the hovered item */
.bgper-ui .nav-links { position: relative; display: flex; gap: 4px; }
.bgper-ui .nav-links a { display: block; padding: 8px 12px; font-size: 14px; line-height: 1.4; color: var(--muted); transition: color .2s; }
.bgper-ui .nav-links a:hover, .bgper-ui .nav-links a.active { color: var(--ink); }
.bgper-ui .nav-links .nav-line {
  position: absolute; left: 0; bottom: 1px; height: 2px; width: var(--w, 0); transform: translateX(var(--x, 0));
  border-radius: 2px; background: var(--ink); opacity: 0; pointer-events: none;
  transition: transform .5s var(--ease), width .5s var(--ease), opacity .2s;
}
.bgper-ui .nav-links .nav-line.on { opacity: 1; }
.bgper-ui .nav-links .nav-line.instant { transition: opacity .2s; }
/* without JS the current page is still underlined */
.bgper-ui .nav-links:not(.has-line) a.active { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 9px; }

.bgper-ui .nav-cta { display: flex; align-items: center; gap: 8px; }
.bgper-ui .nav-cta .btn { height: 36px; padding: 0 14px; font-size: 14px; gap: 0; overflow: hidden; }
.bgper-ui .nav-cta .btn i { width: 0; opacity: 0; transform: translateX(-6px); transition: width .3s var(--ease), margin .3s var(--ease), opacity .2s, transform .3s var(--ease); }
.bgper-ui .nav-cta .btn:hover i { width: 14px; margin-left: 8px; opacity: 1; transform: none; }
.bgper-ui .nav-cta .icon-btn { transition: border-color .2s, background .2s, transform .15s var(--ease); }
.bgper-ui .nav-cta .icon-btn:active { transform: scale(0.96); }
.bgper-ui.nav.search-open #searchOpen { border-color: var(--ink); }
.bgper-ui .menu-btn { display: none; }
@media (max-width: 960px) {
  .bgper-ui .nav-links, .bgper-ui .nav-cta .btn { display: none; }
  .bgper-ui .menu-btn { display: grid; }
}

/* search bar that drops down under the header */
.bgper-ui .nav-search {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 1px;
  background: rgba(251,251,250,0.97); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-rest);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .2s var(--ease), transform .3s var(--ease), visibility 0s .3s;
}
.bgper-ui.nav.search-open .nav-search { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.bgper-ui .nav-search form { display: flex; align-items: center; gap: 12px; height: 72px; }
.bgper-ui .nav-search form > i { font-size: 20px; color: var(--muted); }
.bgper-ui .nav-search input {
  flex: 1; min-width: 0; height: 44px; padding: 0; margin: 0; border: 0; background: none; box-shadow: none; outline: none;
  font: 400 18px/1 var(--sans); color: var(--ink);
}
.bgper-ui .nav-search input::placeholder { color: var(--muted); }
.bgper-ui .nav-search input::-webkit-search-cancel-button { display: none; }
.bgper-ui .nav-search .btn { height: 36px; padding: 0 16px; font-size: 14px; }
.bgper-ui .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) {
  .bgper-ui .nav-search form { height: 64px; gap: 10px; }
  .bgper-ui .nav-search form > i { display: none; }
  .bgper-ui .nav-search input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .bgper-ui .nav-links .nav-line, .bgper-ui .nav-cta .btn i, .bgper-ui .nav-search { transition: none; }
}

/* ---------- mobile drawer ---------- */
.bgper-ui.drawer {
  position: fixed; inset: 0; z-index: 99999; background: var(--bg); padding: 16px; font-family: var(--sans);
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  /* hidden (not just transparent) once faded out, so its links leave the Tab order */
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s var(--ease), visibility 0s .3s;
}
.bgper-ui.drawer.open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.bgper-ui .drawer-head { display: flex; justify-content: space-between; align-items: center; height: 52px; }
.bgper-ui.drawer ul { padding: 32px 0 0; }
.bgper-ui.drawer li { border-bottom: 1px solid var(--line); transform: translateY(10px); opacity: 0; transition: transform .5s var(--ease), opacity .5s var(--ease); transition-delay: calc(var(--i) * 40ms); }
.bgper-ui.drawer.open li { transform: none; opacity: 1; }
.bgper-ui.drawer li a { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; font: 600 28px/1.1 var(--display); letter-spacing: -0.035em; color: var(--ink); }
.bgper-ui.drawer li a.active { color: var(--accent); }

/* ---------- inner page hero ----------
   Same look as the Partners page header: no rule underneath, a soft light in the top-right
   corner (the homepage's ambient glow) and the title sliding up from a clip on load. */
.bgper-ui.page-hero { position: relative; padding: 32px 0 24px; overflow: hidden; font-family: var(--sans); }
/* the glow fades out before the hero's bottom edge so no seam shows against the content */
.bgper-ui.page-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 55% 100% at 82% 0%, rgba(31,108,159,0.07), transparent 100%);
}
.bgper-ui.page-hero .wrap { position: relative; z-index: 1; }
.bgper-ui .crumbs { display: flex; flex-wrap: wrap; gap: 8px; font: 500 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bgper-ui .crumbs a { position: relative; }
.bgper-ui .crumbs a::after { content: ""; position: absolute; inset: -12px -4px; } /* 40px tall hit area */
.bgper-ui .crumbs a:hover { color: var(--ink); }
.bgper-ui .crumbs span[aria-hidden] { color: var(--line-strong); }
.bgper-ui.page-hero .display { font-size: clamp(34px, 3.8vw, 52px); margin-top: 12px; max-width: 16em; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.bgper-ui.page-hero .display > span { display: inline-block; animation: hero-mask 1s var(--ease) .08s both; }
.bgper-ui.page-hero .crumbs, .bgper-ui.page-hero .meta, .bgper-ui.page-hero .hero-figure { animation: hero-rise .8s var(--ease) both; }
.bgper-ui.page-hero .meta { animation-delay: .16s; }
.bgper-ui.page-hero .hero-figure { animation-delay: .24s; }
@keyframes hero-mask { from { transform: translateY(105%); } }
@keyframes hero-rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  .bgper-ui.page-hero .display > span, .bgper-ui.page-hero .crumbs, .bgper-ui.page-hero .meta, .bgper-ui.page-hero .hero-figure { animation: none; }
}
.bgper-ui.page-hero .display.is-long { font-size: clamp(28px, 3.6vw, 46px); line-height: 1.12; letter-spacing: -0.045em; }
.bgper-ui.page-hero .meta { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 18px; font: 400 13px/1.4 var(--mono); color: var(--muted); }
.bgper-ui.page-hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.bgper-ui .hero-figure { margin: 40px 0 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bone); aspect-ratio: 21 / 9; }
.bgper-ui .hero-figure img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }
@media (max-width: 640px) {
  .bgper-ui.page-hero { padding: 24px 0 16px; }
  .bgper-ui .hero-figure { aspect-ratio: 16 / 10; margin-top: 28px; }
}

/* ---------- footer ----------
   One band, laid out like the CGTF footer: on the left the DragonLab mark | BGPer logo
   with the copyright line under them, on the right the platform links in a 4 x 2 grid
   whose columns line up. */
.bgper-ui.site-foot { position: relative; z-index: 1; background: var(--bone); border-top: 1px solid var(--line); padding: 48px 0; font-family: var(--sans); color: var(--text); font-size: 16px; line-height: 1.6; }
.bgper-ui .foot-main { display: flex; justify-content: space-between; align-items: center; gap: 32px 64px; flex-wrap: wrap; }
.bgper-ui .foot-about { display: grid; gap: 20px; justify-items: start; }
.bgper-ui .foot-marks { display: flex; align-items: center; gap: 24px; }
.bgper-ui .foot-marks .dl-logo { height: 32px; width: auto; flex: none; }
.bgper-ui .foot-brand { display: inline-flex; padding-left: 24px; border-left: 1px solid var(--line-strong); border-radius: 0; }
.bgper-ui .foot-brand .brand-logo { height: 30px; width: auto; }
.bgper-ui .foot-legal { margin: 0; font: 400 14px/1.5 var(--sans); color: var(--muted); }
.bgper-ui .foot-mail { color: var(--accent); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: color .2s, text-decoration-color .2s; }
.bgper-ui .foot-mail:hover { text-decoration-color: currentColor; }
.bgper-ui .foot-links ul { display: grid; grid-template-columns: repeat(4, auto); gap: 8px 56px; }
.bgper-ui .foot-links a { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 16px; line-height: 24px; color: var(--text); transition: color .2s; }
.bgper-ui .foot-links a i { font-size: 13px; color: var(--faint); transition: transform .3s var(--ease), color .2s; }
.bgper-ui .foot-links a:hover { color: var(--ink); }
.bgper-ui .foot-links a:hover i { color: var(--accent); transform: translate(2px, -2px); }
@media (max-width: 1080px) {
  .bgper-ui .foot-main { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .bgper-ui.site-foot { padding: 40px 0; }
  .bgper-ui .foot-marks { gap: 16px; }
  .bgper-ui .foot-brand { padding-left: 16px; }
  .bgper-ui .foot-links { width: 100%; }
  .bgper-ui .foot-links ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .bgper-ui .foot-links a, .bgper-ui .foot-links a i, .bgper-ui .foot-mail { transition: none; }
}

/* ---------- logged-in admin bar ---------- */
.admin-bar .bgper-ui.nav { top: 32px; }
@media (max-width: 782px) { .admin-bar .bgper-ui.nav { top: 46px; } }
@media (max-width: 600px) { .admin-bar .bgper-ui.nav { top: 0; } }

.bgper-ui :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  .bgper-ui.drawer, .bgper-ui.drawer li, .bgper-ui .btn, .bgper-ui .link { transition: none !important; }
}

/* ---------- spotlight cards ----------
   A soft ink-grey glow follows the pointer across .spotlight cards and lights the border near it.
   bgper-site.js sets --mx / --my; touch screens never get it. */
.bgper-ui .spotlight::before,
.bgper-ui .spotlight::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  opacity: 0; transition: opacity .3s var(--ease);
}
.bgper-ui .spotlight::before {
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(17,17,17,0.045), transparent 60%);
}
/* 1px ring: the gradient is masked down to the border box minus the padding box */
.bgper-ui .spotlight::after {
  padding: 1px;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(17,17,17,0.4), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
@media (hover: hover) {
  .bgper-ui .spotlight:hover::before, .bgper-ui .spotlight:hover::after { opacity: 1; }
}
