/* ===== Profile overview (About / Hero) =====
   Modelled on the LoL client's Profile > Overview: champion splash full-bleed
   behind the page, Connor's photo with the identity block beside it, and a bottom strip of sections (featured
   project, favourite champion). Responsive steps are container queries on .profile so
   the page adapts to the main column's width, not the viewport's. */

.profile {
  --pf-gutter: clamp(20px, 3.4vw, 56px);
  /* Photo, spacing and the chibi grow with the window's height too, so tall
     windows fill with content instead of an empty band. */
  --pf-photo-w: clamp(150px, min(13vw, 26vh), 250px);
  --pf-top-pad: clamp(28px, 6.5vh, 96px); /* photo and name share a top line */
  /* Right edge of the bio column, measured from the content area beside the
     nav. The splash and the text shade both key off it. */
  --pf-bio-end: calc(var(--pf-gutter) + var(--pf-photo-w) + var(--pf-col-gap) + var(--pf-bio-w));
  /* Prestige Arcane Commander splash: her shoulder sits ~47% across the art,
     her face ~64% (the cape trails off left of the shoulder). */
  --pf-splash-anchor: 0.47;
  --pf-face-x: 0.64;
  --pf-face-inset: 120px; /* keep her face at least this far from the right edge */
  --pf-col-gap: clamp(24px, 3vw, 48px);
  --pf-bio-w: 27rem; /* ~60-65 characters per line at body size */
  --pf-beaufort: "BeaufortLoL", "Cinzel", serif;
  --pf-spiegel: "Spiegel", "Source Sans 3", sans-serif;

  /* Type roles: display (.pf-name) / body / label (Beaufort caps) / meta.
     Floors keep phones (14px root) readable. */
  --pf-body: max(16px, 1rem);
  --pf-label: max(13px, 0.875rem);
  --pf-meta: max(12px, 0.8rem);
  --pf-caps-sm: max(11.5px, 0.75rem);

  /* Client uikit values the gold/navy tokens don't cover: flat-button
     surfaces and the hextech blue used on tier-2 crests. */
  --pf-btn-text: #CDBE91;
  --pf-btn-fill: #1E2328;
  --pf-btn-fill-hover: #433D2B;
  --pf-btn-edge-active: #463714;
  --pf-bio: color-mix(in oklab, var(--text-2) 55%, var(--text-1));

  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
  container-name: profile;
}

/* .main-inner has a definite height; let the section wrapper fill it so the
   profile (and its splash) always reaches the bottom of the column. */
.section-anim:has(> .profile) {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.section-anim > .profile { flex: 1 0 auto; }


/* --- Splash --- */
.pf-splash {
  position: absolute;
  top: 0;
  /* Ideally her shoulder lands just past the end of the bio. On narrower
     columns that would push her face off the right edge, so the face wins:
     it never sits closer than --pf-face-inset to the edge. Widths are
     measured from the content area beside the nav (100% minus --nav-w),
     since the profile box runs under it. */
  left: calc(min(
      var(--nav-w, 0px) + var(--pf-bio-end) + 16px
        + (var(--pf-face-x) - var(--pf-splash-anchor)) * max(100% - var(--nav-w, 0px), 60rem),
      100% - var(--pf-face-inset))
    - var(--pf-face-x) * max(100% - var(--nav-w, 0px), 60rem));
  z-index: -1;
  width: max(100% - var(--nav-w, 0px), 60rem);
  aspect-ratio: 1215 / 717;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0%, #000 24%),
    linear-gradient(0deg, transparent 0%, #000 34%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent 0%, #000 24%),
    linear-gradient(0deg, transparent 0%, #000 34%);
  mask-composite: intersect;
}
/* Legibility shade over the splash, sized to the page rather than the art:
   dark under the identity column, and under the bottom strip. */
.profile::after {
  content: "";
  /* starts beside the nav so its stops track the bio, like the splash */
  position: absolute; inset: 0 0 0 var(--nav-w, 0px);
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(0deg, var(--bg-deep) 0%, rgba(1,10,19,0.86) 30%, rgba(1,10,19,0) 52%),
    /* dark behind the identity column, easing off just past the bio */
    linear-gradient(90deg, rgba(1,10,19,0.96) 0,
      rgba(1,10,19,0.9) calc(var(--pf-bio-end) - 140px),
      rgba(1,10,19,0.74) var(--pf-bio-end),
      rgba(1,10,19,0.2) calc(var(--pf-bio-end) + 150px),
      rgba(1,10,19,0) calc(var(--pf-bio-end) + 280px)),
    linear-gradient(180deg, rgba(1,10,19,0.5) 0%, rgba(1,10,19,0) 16%);
}
.profile .particles { z-index: 0; }

/* --- Top: photo + identity --- */
.pf-top {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--pf-photo-w) minmax(0, 1fr);
  column-gap: var(--pf-col-gap);
  align-items: start;
  padding: 0 var(--pf-gutter) clamp(32px, 6vh, 72px);
  /* takes whatever height the strip leaves and centres its content in it,
     so any spare space splits evenly above the name and below the button */
  flex: 1 0 auto;
  align-content: center;
}

.pf-photo {
  display: block;
  width: var(--pf-photo-w);
  aspect-ratio: 920 / 1379;
  margin-top: var(--pf-top-pad);
  object-fit: cover;
  box-shadow: 0 18px 32px rgba(0,0,0,0.55);
}

/* Identity: name / Riot ID / title sit tight as one nameplate; the bio and
   the CTA are a separate, more loosely spaced group below it. */
.pf-id {
  padding-top: var(--pf-top-pad);
  max-width: 36rem;
}
.pf-name {
  margin: 0;
  font-family: var(--pf-beaufort);
  font-weight: 700;
  font-size: clamp(2.4rem, 4.6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-wrap: balance;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
.pf-title {
  margin-top: 0.5rem;
  font-family: var(--pf-beaufort);
  font-weight: 700;
  font-size: var(--pf-meta);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.pf-bio {
  margin: 1.5rem 0 1.5rem;
  max-width: var(--pf-bio-w);
  font-size: var(--pf-body);
  line-height: 1.6;
  color: var(--pf-bio);
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}

/* Client "flat button": gold gradient border, dark fill, Beaufort caps. */
.pf-cta {
  display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.7em 1.5em 0.65em;
  font-family: var(--pf-beaufort);
  font-weight: 700;
  font-size: var(--pf-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pf-btn-text);
  background:
    linear-gradient(180deg, var(--pf-btn-fill), var(--pf-btn-fill)) padding-box,
    linear-gradient(180deg, var(--gold-text), var(--gold-muted)) border-box;
  border: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: color 160ms ease-out, background 160ms ease-out, box-shadow 160ms ease-out;
}
.pf-cta svg { transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1); }
.pf-cta:hover {
  color: var(--gold-bright);
  background:
    linear-gradient(180deg, var(--pf-btn-fill) 0%, var(--pf-btn-fill-hover) 100%) padding-box,
    linear-gradient(180deg, var(--gold-bright), var(--gold)) border-box;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
.pf-cta:hover svg { transform: translateX(3px); }
.pf-cta:active {
  color: var(--gold-muted);
  background:
    linear-gradient(180deg, var(--pf-btn-fill), var(--pf-btn-fill)) padding-box,
    linear-gradient(180deg, var(--pf-btn-edge-active), var(--pf-btn-edge-active)) border-box;
}
.pf-cta:focus-visible { outline: 1px solid var(--gold-bright); outline-offset: 3px; }

/* --- Bottom strip --- */
.pf-strip {
  position: relative;
  z-index: 1;
  /* follows the bio at a fixed gap (.pf-top's bottom padding) rather than
     sinking to the bottom of tall windows */
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(240px, 30%, 320px);
  padding: clamp(16px, 2.4vh, 24px) var(--pf-gutter) clamp(20px, 4vh, 48px);
}
/* Dark ground under the strip, carried with it: on tall windows the strip
   sits over the splash art, so it brings its own shade down to the bottom
   of the page (the profile clips the overhang). */
.pf-strip::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0; right: 0; top: 0; bottom: -100vh;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(1,10,19,0.6) 0, rgba(1,10,19,0.9) 90px, var(--bg-deep) 220px);
}
.pf-strip::before {
  /* top rule, fading out at both ends like the client's section dividers */
  content: "";
  position: absolute;
  top: 0; left: var(--pf-gutter); right: var(--pf-gutter);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-muted) 12%, var(--gold-muted) 88%, transparent);
}
.pf-sec {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.pf-sec:not(:last-child) { padding-right: var(--pf-col-gap); }
.pf-sec + .pf-sec { padding-left: var(--pf-col-gap); }
.pf-sec + .pf-sec::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--divider-strong), rgba(42,47,54,0));
}

/* --- Featured project: whole card is the link --- */
.pf-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  background: rgba(10,20,40,0.6);
  border: 1px solid var(--divider);
  border-radius: 0;
  transition: border-color 180ms ease-out, background-color 180ms ease-out;
}
.pf-card:hover { border-color: var(--gold-muted); background-color: rgba(14,28,52,0.75); }
.pf-card:focus-visible { outline: 1px solid var(--gold-bright); outline-offset: 2px; }

.pf-card-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-card-title {
  font-family: var(--pf-beaufort);
  font-weight: 700;
  font-size: var(--pf-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-bright);
}
.pf-card-sub {
  font-family: var(--pf-beaufort);
  font-weight: 700;
  font-size: var(--pf-caps-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.pf-card-tagline {
  font-size: var(--pf-meta);
  color: var(--gold-text);
}
.pf-card-desc {
  font-size: var(--pf-meta);
  line-height: 1.5;
  color: var(--pf-bio);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.pf-card-more {
  margin-top: auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--pf-beaufort);
  font-weight: 700;
  font-size: var(--pf-caps-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-text);
  transition: color 160ms ease-out;
}
.pf-card-more svg { transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1); }
.pf-card:hover .pf-card-more { color: var(--gold-bright); }
.pf-card:hover .pf-card-more svg { transform: translateX(3px); }

/* Featured project: tile art on the left, details beside it. */
.pf-feat {
  flex-direction: row;
  gap: 14px;
  padding: 0;
  overflow: hidden;
}
.pf-feat-art {
  position: relative;
  flex: none;
  width: clamp(96px, 28%, 180px);
  min-height: 132px;
  overflow: hidden;
  border-right: 1px solid var(--divider);
  container-type: inline-size;
}
/* The art fills whatever height the card gets instead of setting it, so the
   card ends level with the champion card beside it. */
.pf-feat-art .proj-art-img { position: absolute; inset: 0; }
.pf-feat:hover .proj-art-img { filter: none; }
.pf-feat-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px 14px 0;
}
.pf-feat .pf-card-desc { margin: 8px 0 10px; }

/* --- Favourite champion: chibi on a pedestal, card below --- */
.pf-champ { margin: 0; }

.pf-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  min-height: 1.25rem;
  margin-bottom: 1rem;
}
.pf-sec-h {
  margin: 0;
  white-space: nowrap;
  font-family: var(--pf-beaufort);
  font-weight: 700;
  font-size: var(--pf-label);
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-1);
}

/* Pedestal + chibi stage */
.pf-showcase {
  position: relative;
  display: flex;
  justify-content: center;
}
.pf-showcase::before {
  /* the pedestal: a gold-rimmed disc under her feet */
  content: "";
  position: absolute;
  left: 50%; bottom: 10px;
  width: clamp(132px, 14vh, 180px); aspect-ratio: 132 / 30;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1px solid var(--gold-muted);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(200,155,60,0.22), rgba(200,155,60,0) 70%),
    linear-gradient(180deg, var(--bg-panel), var(--bg-deep));
  box-shadow: 0 6px 12px rgba(0,0,0,0.6);
}
.chibi-stage {
  position: relative;
  height: clamp(120px, 20vh, 220px);
  aspect-ratio: 200 / 156;
}
.chibi-stage model-viewer {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  /* The model is decoration; its loading bar read as a stray hairline. */
  --progress-bar-height: 0px;
}
/* Persistent host for the model (see ChibiChamp in sections.jsx) and its
   click target; both just fill the stage. While another section is showing,
   the host waits in .chibi-parking: same footprint as the stage, but off
   screen, so model-viewer keeps the loaded model and skips rendering. */
.chibi-mount, .chibi-hit { width: 100%; height: 100%; }
.chibi-parking {
  position: fixed; top: 0; left: -10000px;
  width: 200px; height: 156px;
  visibility: hidden; pointer-events: none;
}

.pf-champ {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--gold-muted);
  background: linear-gradient(90deg, rgba(10,20,40,0.9), rgba(10,20,40,0.55));
}
.pf-champ-icon {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 2px var(--bg-deep), 0 0 0 3px var(--gold-muted);
}
.pf-champ-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-champ-name {
  font-family: var(--pf-beaufort);
  font-weight: 700;
  font-size: var(--pf-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
}
.pf-champ-sub { margin-top: 2px; font-size: var(--pf-meta); color: var(--text-2); }

/* particles (gold dust over the splash) */
.particles { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.particle {
  position: absolute;
  width: 3px; height: 3px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 6px rgba(200,155,60,0.7);
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty {
  0%   { opacity: 0; transform: translateY(0); }
  20%  { opacity: 0.7; }
  80%  { opacity: 0.4; }
  100% { opacity: 0; transform: translateY(-50px); }
}

/* --- Short desktop viewports (e.g. 1280x720): tighten the vertical budget
   so the strip still lands above the fold. --- */
@media (max-height: 800px) {
  @container profile (min-width: 601px) {
    /* The section nav moved from a row above the page to a column beside
       it, so the page starts 48px higher; give the name some of that back. */
    .profile { --pf-top-pad: clamp(16px, 5vh, 40px); }
    .pf-name { font-size: clamp(2.2rem, min(4.6vw, 6.5vh), 3.6rem); }
    .pf-bio { line-height: 1.5; margin: 1rem 0 1.25rem; }
    .pf-top { padding-bottom: 20px; }
    .pf-strip { padding-bottom: 16px; }
    .pf-fav .pf-sec-head { margin-bottom: 0.5rem; }
    .pf-card-desc { -webkit-line-clamp: 2; }
    .chibi-stage { height: 120px; }
    .pf-showcase::before { bottom: 4px; width: 112px; height: 26px; }
    .pf-champ { padding: 8px 12px; }
    .pf-champ-icon { width: 44px; height: 44px; }
  }
}

/* --- Mid-width column (most laptops, beside the left nav): tighter
   champion column and card padding. --- */
@container profile (761px <= width <= 1000px) {
  .pf-strip { grid-template-columns: minmax(0, 1fr) 220px; }
  .chibi-stage { height: clamp(120px, 18vh, 165px); }
  .pf-showcase::before { width: 132px; }
  .pf-sec:not(:last-child) { padding-right: 24px; }
  .pf-sec + .pf-sec { padding-left: 24px; }
  .pf-card { padding: 12px 14px; }
  .pf-feat-body { padding: 12px 14px 12px 0; }
}

/* --- Narrow column: featured project full width, champion row below --- */
@container profile (max-width: 760px) {
  .pf-strip { grid-template-columns: minmax(0, 1fr); row-gap: 1.75rem; }
  .pf-strip .pf-featured { padding-right: 0; }
  .pf-strip .pf-fav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "head head" "show card";
    align-items: end;
    column-gap: 20px;
    padding: clamp(16px, 2.4vh, 24px) 0 0;
  }
  .pf-strip .pf-fav::before {
    /* becomes a top rule, matching the strip's */
    top: 0; left: 0; right: 0; bottom: auto;
    width: auto; height: 1px;
    background: linear-gradient(90deg, var(--gold-muted), var(--gold-muted) 88%, transparent);
  }
  .pf-fav .pf-sec-head { grid-area: head; }
  .pf-showcase { grid-area: show; }
  .pf-champ { grid-area: card; justify-self: start; margin: 0 0 12px; }
}

/* --- Phone --- */
@container profile (max-width: 600px) {
  .profile { --pf-gutter: 16px; --pf-photo-w: 132px; --pf-top-pad: 18px; }
  .pf-splash {
    width: 230%;
    /* puts her face (64% across the art) at ~80% of the column, clear of
       the centred photo */
    left: -67%;
    -webkit-mask-image: linear-gradient(0deg, transparent 0%, #000 40%);
    mask-image: linear-gradient(0deg, transparent 0%, #000 40%);
  }
  .profile::after {
    background: linear-gradient(180deg,
      rgba(1,10,19,0.45) 0, rgba(1,10,19,0) 90px, rgba(1,10,19,0) 160px,
      rgba(1,10,19,0.82) 290px, var(--bg-deep) 420px);
  }
  .pf-top {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }
  .pf-id { max-width: 100%; }
  .pf-name { font-size: clamp(2rem, 10cqi, 2.6rem); }
  .pf-bio { text-align: left; margin: 1.25rem 0; }
  .pf-cta { width: 100%; justify-content: center; padding-block: 0.9em 0.85em; }
  .pf-strip { row-gap: 1.5rem; }
  .pf-strip .pf-fav {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "show" "card";
    justify-items: stretch;
  }
  .pf-showcase { justify-self: center; }
  .pf-champ { justify-self: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-cta svg, .pf-card-more svg { transition: none; }
}
