/* Per-project branding. Anything under [data-brand] is drawn in that project's own
   palette and type: brand.js writes the tokens (--bg, --fg, --accent, --brand-*) onto the
   card on the home page, or onto <html> on the project page, and these rules add the
   shape and motion that go with them. Nothing here names a project - the values come
   from the `brand` block in data.js. */

/* Registered so the pointer glow and the tilt can ease instead of jumping. */
@property --mx { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@property --my { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@property --rx { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
@property --ry { syntax: "<angle>"; inherits: true; initial-value: 0deg; }

/* ---------- ground, type ---------- */

[data-brand] {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--brand-body);
}

[data-brand] * { font-family: var(--brand-body); }

[data-brand] :is(.pcard__title, .phero__title, .psec__title, .pnext__name, .h-sec) {
  font-family: var(--brand-display);
  font-weight: 400;
  text-transform: none;
  letter-spacing: -.012em;
}
[data-brand] :is(.pcard__title, .phero__title, .psec__title, .pnext__name) * { font-family: inherit; }

/* The descriptor after the colon, in the brand's italic gradient. The second colour
   only ever appears as the far end of a gradient. */
[data-brand] .btitle__tail {
  font-style: italic;
  background-image: linear-gradient(100deg, var(--brand-grad-a) 0%, var(--brand-grad-b) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 .08em .06em 0;
}

[data-brand] :is(.eyebrow, .h-sub) {
  font-weight: 600;
  letter-spacing: .22em;
  color: var(--accent-text);
}

[data-brand] .lede { color: var(--fg-dim); }

/* ---------- controls ---------- */

/* Branded buttons belong to the project page. On the home page every card keeps the
   portfolio's own buttons, so the row of cards moves as one. */

html[data-brand] .btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 999px;
  padding: 11px 20px;
  border-color: var(--line);
  background: var(--fill);
  color: var(--fg);
  transition:
    transform .5s var(--brand-ease),
    box-shadow .5s var(--brand-ease),
    background-color .3s ease, border-color .3s ease, color .3s ease;
}
html[data-brand] .btn:hover {
  transform: translateY(-2px);
  border-color: rgb(var(--brand-accent-rgb) / .5);
  background: rgb(var(--brand-accent-rgb) / .08);
  color: var(--fg);
}
html[data-brand] .btn:active { transform: translateY(0); transition-duration: .1s; }

html[data-brand] .btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 12px 32px -12px rgb(var(--brand-accent-rgb) / .8), inset 0 1px 0 rgb(255 255 255 / .28);
}
html[data-brand] .btn--primary:hover {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  filter: none;
  box-shadow: 0 18px 44px -12px rgb(var(--brand-accent-rgb) / .95), inset 0 1px 0 rgb(255 255 255 / .32);
}
/* A light sweep across the primary action on hover. */
html[data-brand] .btn--primary::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .38) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .9s var(--brand-ease);
}
html[data-brand] .btn--primary:hover::after { transform: translateX(120%); }

html[data-brand] .btn--ghost { border-color: rgb(var(--brand-accent-rgb) / .45); background: transparent; color: var(--accent-text); }

[data-brand] .pill {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0;
  border-radius: 999px;
  border-color: var(--line-soft);
  background: var(--fill);
  color: var(--fg-dim);
  transition: border-color .3s ease, color .3s ease, background-color .3s ease;
}
[data-brand] .pill:hover { border-color: rgb(var(--brand-accent-rgb) / .5); color: var(--fg); }

[data-brand] :where(a, button, [tabindex]):focus-visible { outline-color: var(--accent); }

/* ---------- reveal on scroll (brand.js adds .brand-motion) ---------- */

.brand-motion [data-brand-reveal] {
  transition:
    opacity .9s var(--brand-ease, ease) calc(var(--i, 0) * 90ms),
    transform .9s var(--brand-ease, ease) calc(var(--i, 0) * 90ms);
}
.brand-motion [data-brand-reveal]:not(.is-in) { opacity: 0; transform: translateY(18px); }

/* ---------- slides ---------- */

[data-brand] [data-slides] .bslides__img {
  transition: opacity .9s var(--brand-ease), transform 7s linear;
}
[data-brand] [data-slides] .bslides__img.is-active { transform: scale(1.035); }

/* ====================================================================
   Home page: the branded project card
   ==================================================================== */

.pcard[data-brand] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/* The headline and the name under it stay in the portfolio's type, so the
   cards read as one row; the pitch and the buttons carry the brand's own. */
.pcard[data-brand] .pcard__title {
  font: 800 clamp(18px, 1.6vw, 22px)/1.05 Archivo, sans-serif;
  letter-spacing: -.02em;
  text-transform: uppercase;
}
.pcard[data-brand] :is(.pcard__name, .pcard__name *) { font-family: Archivo, sans-serif; }
.pcard[data-brand] .btitle__tail { font-style: normal; padding: 0; }
.pcard[data-brand] .pcard__title a { transition: opacity .3s ease; }
.pcard[data-brand] .pcard__title a:hover { opacity: .88; }
.pcard[data-brand] .pcard__pitch { font-size: 14px; line-height: 1.6; }
.pcard[data-brand] .pcard__stack .pill { font-size: 11px; padding: 4px 10px; }
.pcard[data-brand] .btn { font-family: Archivo, sans-serif; }

.pcard[data-brand] .pcard__frame {
  background: var(--brand-surface);
  box-shadow: 0 30px 60px -30px var(--brand-shadow), 0 0 0 1px var(--brand-sheen);
}

/* ====================================================================
   Project page: <html data-brand>
   ==================================================================== */

html[data-brand] .site-header {
  border-bottom-color: var(--line-soft);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
}
html[data-brand] .nav__link { border-radius: 999px; font-weight: 500; letter-spacing: .02em; text-transform: none; font-size: 13px; }
html[data-brand] .nav__link:hover { border-color: rgb(var(--brand-accent-rgb) / .5); color: var(--fg); }

/* Reading progress, violet into pink. */
.bprogress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  height: 2px;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--brand-accent-2));
  pointer-events: none;
}

/* ---------- hero ---------- */

html[data-brand] .phero {
  --mx: 22%; --my: 28%;
  background: var(--bg);
  isolation: isolate;
  border-bottom: 0;
  transition: --mx 1.4s var(--brand-ease), --my 1.4s var(--brand-ease);
}

html[data-brand] .phero > .baurora {
  position: absolute; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(44% 70% at var(--mx) var(--my), rgb(var(--brand-accent-rgb) / .24) 0%, transparent 68%),
    radial-gradient(40% 60% at 84% 10%, rgb(var(--brand-accent-2-rgb) / .14) 0%, transparent 66%);
}
/* A slow second light, so the wash is alive even when nobody is pointing at it. */
html[data-brand] .phero > .baurora::after {
  content: "";
  position: absolute; inset: -20%;
  background: radial-gradient(30% 40% at 50% 50%, rgb(var(--brand-accent-rgb) / .12) 0%, transparent 70%);
  animation: brand-drift 18s ease-in-out infinite alternate;
}
@keyframes brand-drift {
  0%   { transform: translate3d(-18%, -6%, 0) scale(1); }
  50%  { transform: translate3d(12%, 8%, 0) scale(1.15); }
  100% { transform: translate3d(22%, -10%, 0) scale(.95); }
}

html[data-brand] .phero__in { padding-block: 72px 44px; gap: 48px; }
html[data-brand] .phero__text { gap: 18px; }
html[data-brand] .phero__title { font-size: clamp(46px, 7.2vw, 96px); line-height: .96; }
html[data-brand] .phero__title .btitle__tail { display: block; }

html[data-brand] .facts {
  border-radius: var(--brand-radius);
  border-color: var(--line-soft);
  background: color-mix(in srgb, var(--brand-surface) 72%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 40px 80px -40px var(--brand-shadow), inset 0 1px 0 var(--brand-sheen);
  padding: 22px;
  gap: 14px;
}
html[data-brand] .facts__row { border-bottom-color: var(--line-soft); padding-bottom: 9px; }
html[data-brand] .facts__row dd { font-weight: 500; }

/* ---------- showcase ---------- */

html[data-brand] .pmedia { border-radius: calc(var(--brand-radius) + 4px); border-color: var(--line-soft); background: var(--brand-surface); }

html[data-brand] .pmedia__frame {
  border-radius: calc(var(--brand-radius) + 4px);
  border-color: var(--line);
  background: var(--brand-surface);
  transform: perspective(1800px) rotateX(var(--rx)) rotateY(var(--ry));
  box-shadow: 0 60px 140px -60px rgb(var(--brand-accent-rgb) / .55), 0 0 0 1px var(--brand-sheen);
  transition: transform .9s var(--brand-ease), box-shadow .6s var(--brand-ease);
  will-change: transform;
}
html[data-brand] .pmedia__frame.is-pointer { transition: transform .2s linear, box-shadow .6s var(--brand-ease); }

html[data-brand] .showcase__bar { margin-top: 18px; }
html[data-brand] .showcase__cap { color: var(--fg-dim); font-size: 14px; transition: opacity .4s ease; }
html[data-brand] .showcase__thumb {
  border-radius: 12px;
  border-color: var(--line-soft);
  transition: opacity .4s ease, transform .5s var(--brand-ease), box-shadow .4s ease;
}
html[data-brand] .showcase__thumb:hover { transform: translateY(-3px); }
html[data-brand] .showcase__thumb.is-active {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--accent), 0 12px 28px -10px rgb(var(--brand-accent-rgb) / .8);
}

/* ---------- body ---------- */

html[data-brand] .pstage { padding-block: 56px 64px; }
html[data-brand] .pstage__text { gap: 52px; }
html[data-brand] .psec { gap: 16px; }
html[data-brand] .psec__title { font-size: clamp(28px, 3vw, 38px); line-height: 1.05; }
html[data-brand] .psec p { font-size: 16px; line-height: 1.75; }

html[data-brand] .features { gap: 12px; }
html[data-brand] .feature {
  --mx: 50%; --my: 50%;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--fill);
  transition: transform .6s var(--brand-ease), border-color .4s ease, background-color .4s ease;
}
html[data-brand] .feature::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(240px circle at var(--mx) var(--my), rgb(var(--brand-accent-rgb) / .16), transparent 70%);
  opacity: 0;
  transition: opacity .5s ease;
}
html[data-brand] .feature:hover { transform: translateY(-3px); border-color: rgb(var(--brand-accent-rgb) / .35); }
html[data-brand] .feature:hover::before { opacity: 1; }
html[data-brand] .feature__ic {
  width: 36px; height: 36px;
  border-radius: 11px;
  border-color: rgb(var(--brand-accent-rgb) / .28);
  background: rgb(var(--brand-accent-rgb) / .12);
  color: var(--accent-text);
  transition: transform .6s var(--brand-ease);
}
html[data-brand] .feature:hover .feature__ic { transform: rotate(-8deg) scale(1.06); }
html[data-brand] .feature__name { font-weight: 600; font-size: 15px; }
html[data-brand] .feature__body p { font-size: 14px; line-height: 1.6; }

html[data-brand] .layer { border-bottom-color: var(--line-soft); padding-block: 16px; }

/* ---------- rail ---------- */

html[data-brand] .toc a { transition: color .3s ease, border-color .3s ease, background-color .3s ease; }
html[data-brand] .toc a[aria-current="true"] { color: var(--fg); border-color: rgb(var(--brand-accent-rgb) / .6); }

html[data-brand] .pask { border-radius: var(--brand-radius); }

/* ---------- next, lightbox, action bar ---------- */

html[data-brand] .pnext { border-top-color: var(--line-soft); }
html[data-brand] .pnext__card {
  border-color: var(--line-soft);
  border-radius: 16px;
  transition: border-color .3s ease, transform .5s var(--brand-ease), background-color .3s ease;
}
html[data-brand] .pnext__card:hover { border-color: rgb(var(--brand-accent-rgb) / .5); transform: translateY(-2px); background: rgb(var(--brand-accent-rgb) / .05); }
html[data-brand] .pnext__thumb { border-radius: 8px; }

html[data-brand] .lightbox::backdrop {
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
html[data-brand] .lightbox img { border-radius: var(--brand-radius); border-color: var(--line-soft); }
html[data-brand] .lightbox[open] .lightbox__in { animation: brand-pop .5s var(--brand-ease); }
@keyframes brand-pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  html[data-brand] .phero__in { padding-block: 40px 28px; }
  html[data-brand] .pstage { padding-block: 32px 40px; }
  html[data-brand] .actionbar {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top-color: var(--line-soft);
  }
}
