/* ==========================================================================
   HOME PAGE
   Hero · Card fan · Services · Work grid · About summary · References
   ========================================================================== */

/* ---------- Hero ---------- */
/* The header sits clear over the hero (header.js gives it its frosted
   background as soon as the page scrolls) */
.site-header--clear {
  margin-bottom: calc(-1 * var(--nav-height) - 1px); /* the header is nav height + its 1px border */
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.site-header--clear:not(.is-solid) {
  background: transparent; border-bottom-color: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}

/* Fills the screen; the marquee runs along its bottom edge */
.hero {
  position: relative; overflow: hidden; background: var(--surface-hero);
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column;
  padding-top: calc(var(--nav-height) + clamp(8px, 2vh, 32px));
}
.hero .marquee { position: relative; background: transparent; padding-block: 22px; border-top-color: var(--accent); }
.hero .marquee-run, .hero .marquee-sep { color: var(--accent); }
.hero-ring {
  left: 50%; top: 44%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%);
}
.hero-ring--outer { width: min(120vw, 1180px); border: 1px solid rgba(124, 44, 221, 0.22); }
.hero-ring--inner {
  width: min(88vw, 840px); border: 1px solid rgba(124, 44, 221, 0.16);
  background: radial-gradient(closest-side, rgba(196, 160, 255, 0.42), rgba(196, 160, 255, 0) 78%);
}
.hero-drift {
  inset: -12%; filter: blur(90px);
  background: conic-gradient(from 210deg at 32% 38%, rgba(124, 44, 221, 0.32), rgba(255, 122, 196, 0.24) 22%, rgba(58, 20, 130, 0.28) 46%, rgba(124, 44, 221, 0) 66%, rgba(140, 90, 255, 0.3) 88%, rgba(124, 44, 221, 0.32));
  animation: drift var(--dur-drift) ease-in-out infinite alternate;
}
.hero-rules {
  inset: 0; background-size: 14.28% 100%;
  background-image: linear-gradient(to right, rgba(58, 20, 130, 0.07) 1px, transparent 1px);
}
@keyframes drift {
  0% { transform: translate3d(-3%, -2%, 0) scale(1.05) rotate(0deg); }
  100% { transform: translate3d(3%, 2%, 0) scale(1.14) rotate(12deg); }
}

/* Name, fan and foot sit as one group, centred in the space above the marquee */
.hero-inner { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hero-name {
  font-weight: 800; font-size: min(7.28vw, 12.8vh, 200px); /* scales with width and height, so large screens keep the laptop proportions */ line-height: var(--leading-name);
  letter-spacing: var(--tracking-name); text-align: center; text-wrap: balance;
}
.hero-foot {
  width: 100%; padding: 0 0 clamp(14px, 2.5vh, 28px);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.hero-foot p { text-align: center; font-size: 22px; font-weight: 500; line-height: 1.4; text-wrap: balance; }
/* ↓ under the tagline, scrolls to the work section */
.hero-scroll { margin-top: clamp(8px, 6vh - 24px, 40px); }
@media (max-width: 767px) {
  .hero { padding-top: calc(var(--nav-height) + clamp(8px, 2vh, 24px)); }
  .hero .marquee { padding-block: 14px; }
  .hero-name { font-size: min(16vw, 90px, 9.5vh); line-height: 0.92; }
  /* Just the tagline: no ↓ on phones, so the hero stays light and the cards get the height */
  .hero-foot p { font-family: var(--font-display); font-weight: 500; font-size: min(4.8vw, 22px); line-height: 1.35; }
  .hero-scroll { display: none; }
}

/* ---------- Card fan ----------
   All geometry is in CSS, so the fan can never overflow the screen.
   The fan takes whatever height the hero has left after the header, name,
   foot and marquee, and the cards size to it (cqh), so the whole hero fits
   in one screen. Rest state is tighter; .is-open (hover / tap) spreads the cards.
   Fan height = card bottom (24px + 0.15cw) + card (5/3 cw) + space above. */
.fan {
  --above: calc(clamp(20px, 10vh - 50px, 60px) + clamp(16px, 4vh, 48px)); /* empty space above the cards; tighter on short screens */
  --fit: calc((100cqh - 24px - var(--above)) / 1.8167);             /* width that fits the fan's height */
  --cw: min(360px, max(72px, min(18vw, var(--fit))));               /* card width */
  --half: min(50vw - 48px, 3.6 * var(--cw));                         /* half the room the fan spreads into */
  --room: max(0px, calc(var(--half) - 1.364 * var(--cw)));
  --outer: min(calc(2.3 * var(--cw)), calc(0.8 * var(--room)));
  --inner: calc(0.34 * var(--outer));
  --rest-out: calc(0.55 * var(--outer));
  --rest-in: calc(0.34 * var(--rest-out));
  position: relative; z-index: 2; width: 100%;
  flex: 1 1 0; container-type: size;
  min-height: calc(72px * 1.8167 + 24px + var(--above));
  max-height: calc(min(360px, 18vw) * 1.8167 + 24px + var(--above));
  margin-top: clamp(-40px, -2.5vw, -24px); margin-bottom: 30px;
  display: flex; align-items: flex-end; justify-content: center; cursor: pointer;
}
.fan-card {
  /* 80px from the lowest card corner to the hero foot; rotated corners dip lower as cards grow */
  position: absolute; bottom: calc(24px + 0.15 * var(--cw)); width: var(--cw); aspect-ratio: 3 / 5;
  border-radius: 14px; overflow: hidden; background: var(--violet-050); box-shadow: var(--shadow-card);
  transform-origin: 50% 118%; transition: transform var(--dur-stage) var(--ease);
}
.fan-card img { width: 100%; height: 100%; object-fit: cover; }
.fan-card--1 { transform: translate(calc(-1 * var(--rest-out)), 18px) rotate(-16deg); }
.fan-card--2 { transform: translate(calc(-1 * var(--rest-in)), 2px) rotate(-5.5deg); }
.fan-card--3 { transform: translate(var(--rest-in), 2px) rotate(5.5deg); }
.fan-card--4 { transform: translate(var(--rest-out), 18px) rotate(16deg); }
.fan.is-open .fan-card--1 { transform: translate(calc(-0.75 * var(--outer)), 32px) rotate(-22deg); }
.fan.is-open .fan-card--2 { transform: translate(calc(-0.75 * var(--inner)), 4px) rotate(-8deg); }
.fan.is-open .fan-card--3 { transform: translate(calc(0.75 * var(--inner)), 4px) rotate(8deg); }
.fan.is-open .fan-card--4 { transform: translate(calc(0.75 * var(--outer)), 32px) rotate(22deg); }
.fan-card--phones { display: grid; place-items: center; background: #EFE0F3; }
.fan-card--phones .phone { height: 72%; }

/* Tablet & mobile: the fan is always spread, and the cards float gently.
   The float uses the separate `translate` property so it stacks on top of
   each card's fan transform instead of replacing it. */
@media (max-width: 1024px), (max-width: 1100px) and (orientation: portrait) {
  .fan {
    --cw: min(360px, max(72px, min(22vw, var(--fit))));
    max-height: calc(min(360px, 22vw) * 1.8167 + 24px + var(--above));
    --outer: min(calc(1.9 * var(--cw)), calc(50vw - 1.45 * var(--cw)));
    margin-bottom: 44px;
    cursor: default;
  }
  .fan .fan-card { animation: fan-float 5s ease-in-out infinite; }
  .fan .fan-card--1 { transform: translate(calc(-1 * var(--outer)), 28px) rotate(-18deg); animation-delay: -1.2s; }
  .fan .fan-card--2 { transform: translate(calc(-1 * var(--inner)), 4px) rotate(-7deg); animation-delay: -3.4s; animation-duration: 5.6s; }
  .fan .fan-card--3 { transform: translate(var(--inner), 4px) rotate(7deg); animation-delay: -0.4s; animation-duration: 4.6s; }
  .fan .fan-card--4 { transform: translate(var(--outer), 28px) rotate(18deg); animation-delay: -2.6s; animation-duration: 5.3s; }
}
/* Tablet: a bigger name, so it holds its own against the cards */
@media (min-width: 768px) and (max-width: 1024px), (min-width: 768px) and (max-width: 1100px) and (orientation: portrait) {
  .hero-name { font-size: min(10vw, 12.8vh); }
}
/* Portrait tablets have height to spare: bigger name and cards, overlapped a little more */
@media (min-width: 768px) and (max-width: 1100px) and (orientation: portrait) {
  .hero-name { font-size: min(11.5vw, 12.8vh); }
  .fan {
    --cw: min(360px, max(72px, min(27vw, var(--fit))));
    --outer: min(calc(1.9 * var(--cw)), calc(50vw - 1.4 * var(--cw)));
    max-height: calc(min(360px, 27vw) * 1.8167 + 24px + var(--above));
  }
}
/* Phones: big cards, tightly overlapped. Offsets are in card widths so the
   fan keeps its shape and always fits the screen. Like desktop, the fan fills
   the height left over, so short phones (and Safari's toolbars) still fit.
   Fan height = card bottom (34px + 0.15cw) + card (5/3 cw) + 24px above. */
@media (max-width: 767px) {
  .fan {
    --fit: calc((100cqh - 58px) / 1.8167);
    --cw: min(32vw, 190px, max(64px, var(--fit)));
    min-height: calc(64px * 1.8167 + 58px);
    max-height: calc(min(32vw, 190px) * 1.8167 + 58px);
    margin-top: 0; margin-bottom: 0;
  }
  .fan-card { bottom: calc(34px + 0.15 * var(--cw)); border-radius: 16px; }
  .fan .fan-card--1 { transform: translate(calc(-0.7 * var(--cw)), 16px) rotate(-10deg); }
  .fan .fan-card--2 { transform: translate(calc(-0.24 * var(--cw)), 0) rotate(-3deg); }
  .fan .fan-card--3 { transform: translate(calc(0.24 * var(--cw)), 2px) rotate(4deg); }
  .fan .fan-card--4 { transform: translate(calc(0.7 * var(--cw)), 18px) rotate(9deg); }
}
@keyframes fan-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}

/* ---------- Services ---------- */
.service .numeral { font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1; color: var(--accent); }
.service p { font-size: var(--size-body-sm); line-height: 1.62; color: var(--ink-600); }
.service:hover { border-color: var(--accent); }
.service.card--dark .numeral { color: var(--violet-300); }
.service.card--dark p { color: var(--ink-on-dark-strong); }
.service .dash-list { margin-top: auto; padding-top: 6px; }

.work-more { display: flex; justify-content: center; margin-top: 40px; }

/* ---------- About summary ---------- */
.about-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(32px, 5vw, 56px); align-items: center;
}
.about-portrait { position: relative; width: 100%; max-width: 380px; justify-self: center; }
.about-portrait .well { aspect-ratio: 4 / 5; border-radius: 24px; display: flex; align-items: flex-end; justify-content: center; }
/* The cut-out portrait sits on the bottom edge at 80% of the frame width */
.about-portrait .well img { width: 80%; height: auto; }
.about-badge {
  position: absolute; right: -14px; bottom: -18px; width: 76px; height: auto;
  padding: 12px; background: var(--surface-page); border-radius: 18px;
}
.about-text { display: flex; flex-direction: column; gap: 18px; }
.about-text h2 { font-size: clamp(32px, 3.6vw, 46px); }
.about-text > p:not(.eyebrow) { font-size: 17px; line-height: 1.68; color: var(--ink-600); }

/* ---------- References ---------- */
.reference > p { font-family: var(--font-display); font-weight: 500; font-size: 21px; line-height: var(--leading-quote); color: var(--ink-900); }
.reference footer { margin-top: auto; display: flex; align-items: center; gap: 12px; }

/* ---------- Services ---------- */
/* "How I do it" link under the service cards, to the process on the Resume page */
.section-more { margin-top: 40px; }
