/* ==========================================================
   Renta Nagasaka — Portfolio
   Apple-inspired: big type, generous whitespace, glass nav,
   alternating black / off-white sections, scroll reveals.
   ========================================================== */

:root {
  --black: #000;
  --white: #fff;
  --offwhite: #f5f5f7;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --gray: #86868b;
  --gray-2: #a1a1a6;
  --card-dark: #1d1d1f;
  --card-dark-2: #2a2a2d;
  --blue: #2997ff;
  --blue-dark: #0071e3;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-pill: 980px;
  --nav-h: 48px;
  --maxw: 1200px;
  --maxw-narrow: 880px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro JP",
          "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
          "Noto Sans JP", "Yu Gothic", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  overflow-x: hidden;
}
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; cursor: pointer; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: var(--maxw-narrow); }
.br-desktop { display: none; }
@media (min-width: 735px) { .br-desktop { display: inline; } }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s var(--ease) var(--d, 0s), transform .9s var(--ease) var(--d, 0s);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Gradient text ---------- */
.gradient-text {
  background: linear-gradient(90deg, #6ec1ff 0%, #a98bff 45%, #ff8fb1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ---------- Arrow links (Apple blue "Learn more >") ---------- */
.link-arrow {
  color: var(--blue);
  font-size: 19px;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: .25em;
  transition: color .2s;
}
.link-arrow::after {
  content: "›";
  font-size: 1.25em;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform .25s var(--ease);
}
.link-arrow:hover { text-decoration: underline; }
.link-arrow:hover::after { transform: translate(3px, -1px); }
.section--light .link-arrow { color: var(--blue-dark); }

/* ==========================================================
   Nav
   ========================================================== */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 100;
  background: rgba(0, 0, 0, .72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.88);
  transition: background .4s;
}
.nav__inner {
  max-width: 1024px;
  margin: 0 auto;
  height: 100%;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.nav__links { display: flex; align-items: center; gap: 34px; }
.nav__links a {
  font-size: 12px;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.8);
  opacity: .9;
  transition: opacity .2s, color .2s;
}
.nav__links a:hover { opacity: 1; color: #fff; }
.nav__cta {
  background: var(--blue-dark);
  color: #fff !important;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  font-weight: 500;
}
.nav__cta:hover { background: #0077ed; }

.nav__toggle {
  display: none;
  width: 36px; height: 36px;
  background: none; border: 0;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
}
.nav__toggle span {
  display: block; width: 20px; height: 1.5px; background: #fff; border-radius: 2px; flex: none;
  transition: transform .35s var(--ease), opacity .3s;
}
.nav.is-open .nav__toggle span:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav.is-open .nav__toggle span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

@media (max-width: 834px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    height: calc(100vh - var(--nav-h));
    height: calc(100dvh - var(--nav-h));
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 12px 40px 36px;
    background: #000;
    overflow-y: auto;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s, transform .4s var(--ease);
  }
  .nav.is-open .nav__links { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a {
    font-size: 17px;
    padding: 14px 0;
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .nav__cta { border-bottom: 0 !important; margin-top: 14px; width: auto !important; padding: 9px 18px; }
}

/* ==========================================================
   Hero
   ========================================================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: calc(var(--nav-h) + 80px) 24px 80px;
  color: var(--offwhite);
  overflow: hidden;
  isolation: isolate;
}
.hero__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.blob {
  position: absolute;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
  mix-blend-mode: screen;
  animation: drift 22s ease-in-out infinite alternate;
}
.blob--1 { background: radial-gradient(circle, #1f6fff, transparent 60%); top: -20vmax; left: -10vmax; }
.blob--2 { background: radial-gradient(circle, #8a5cff, transparent 60%); bottom: -25vmax; right: -10vmax; animation-delay: -7s; animation-duration: 26s; }
.blob--3 { background: radial-gradient(circle, #ff5c8a, transparent 60%); bottom: -10vmax; left: 20vmax; opacity: .35; animation-delay: -14s; animation-duration: 30s; }
@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(12vw, -8vh, 0) scale(1.15); }
}
.hero::after {
  /* vignette + bottom fade into black */
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.55) 100%),
    linear-gradient(to bottom, transparent 70%, #000 100%);
  pointer-events: none;
}

.hero__content { max-width: 980px; }
.hero__eyebrow {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--gray-2);
  margin-bottom: 18px;
}
.hero__title {
  font-size: clamp(44px, 8.4vw, 104px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -.035em;
  margin-bottom: 28px;
}
.hero__sub {
  font-size: clamp(19px, 2.2vw, 26px);
  line-height: 1.4;
  font-weight: 400;
  color: var(--gray-2);
  letter-spacing: -.01em;
  max-width: 760px;
  margin: 0 auto 28px;
}
.hero__actions { display: flex; gap: 36px; justify-content: center; flex-wrap: wrap; }

.hero__scroll {
  position: absolute; bottom: 28px; left: 50%;
  width: 22px; height: 36px; margin-left: -11px;
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 12px;
}
.hero__scroll span {
  position: absolute; left: 50%; top: 7px;
  width: 3px; height: 7px; margin-left: -1.5px;
  background: rgba(255,255,255,.8); border-radius: 2px;
  animation: scrollhint 1.8s ease-in-out infinite;
}
@keyframes scrollhint {
  0%   { transform: translateY(0); opacity: 1; }
  70%  { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ==========================================================
   Sections
   ========================================================== */
.section { padding: clamp(96px, 12vw, 160px) 0; }
.section--light { background: var(--offwhite); color: var(--ink); }
.section--dark  { background: var(--black); color: var(--offwhite); }

.section__head { margin-bottom: clamp(44px, 6vw, 72px); }
.section__head--row {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.section__eyebrow {
  font-size: 17px; font-weight: 600; color: var(--blue-dark); margin-bottom: 10px;
}
.section--dark .section__eyebrow { color: var(--blue); }
.section__title {
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -.03em;
}
.section__lead {
  font-size: clamp(21px, 2.4vw, 28px);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--ink-2);
  margin-top: 12px;
}
.section--dark .section__lead { color: var(--gray); }

/* ---------- About: statement ---------- */
.statement { color: var(--ink-2); }
.statement p {
  font-size: clamp(17px, 1.75vw, 22px);
  line-height: 1.75;
  font-weight: 500;
  letter-spacing: -.005em;
  word-break: auto-phrase;      /* Japanese phrase-aware wrapping (Chrome) */
  text-wrap: pretty;
  max-width: 40em;
}
.statement p + p { margin-top: 1.1em; }
.statement__lead {
  font-size: clamp(34px, 5vw, 56px) !important;
  line-height: 1.1 !important;
  font-weight: 700 !important;
  letter-spacing: -.03em !important;
  color: var(--ink);
  margin-bottom: 28px;
}
.statement strong { color: var(--ink); font-weight: 700; }
.nowrap { white-space: nowrap; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  margin-top: clamp(56px, 8vw, 96px);
  padding-top: 40px;
  border-top: 1px solid rgba(0,0,0,.1);
}
.stat { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 2px; }
.stat__num, .stat__suffix {
  font-size: clamp(44px, 5vw, 64px);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1;
  background: linear-gradient(135deg, #0071e3, #8a5cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat__label { flex-basis: 100%; margin-top: 10px; font-size: 15px; font-weight: 500; color: var(--ink-2); }

/* ---------- Skills: bento grid ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.card {
  position: relative;
  background: var(--card-dark);
  border-radius: var(--radius-xl);
  padding: 32px 32px 34px;
  min-height: 300px;
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: 0 30px 60px -30px rgba(0,0,0,.8); }
.card--wide { grid-column: span 2; }
.card--accent {
  background: linear-gradient(145deg, #0a2a5c 0%, #0b5bd3 55%, #3b8cff 100%);
}
.card--glow::before {
  content: ""; position: absolute; inset: -40% -20% auto auto;
  width: 60%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(138,92,255,.55), transparent 65%);
  filter: blur(30px);
  pointer-events: none;
}
.card__eyebrow { font-size: 14px; font-weight: 600; color: var(--gray); letter-spacing: .01em; margin-bottom: 10px; }
.card--accent .card__eyebrow { color: rgba(255,255,255,.7); }
.card__title { font-size: clamp(24px, 2.2vw, 30px); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 14px; }
.card__text { font-size: 16px; line-height: 1.5; color: var(--gray-2); max-width: 46ch; }
.card--accent .card__text { color: rgba(255,255,255,.85); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 24px; }
.chips li {
  font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.06);
}

@media (max-width: 1024px) { .bento { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; gap: 14px; }
  .card, .card--wide { grid-column: span 1; min-height: 0; padding: 28px 26px; }
}

/* ---------- Featured: device mock (scroll-driven) ---------- */
.featured { overflow: clip; }
.featured .section__head { text-align: center; max-width: 820px; margin-left: auto; margin-right: auto; }
.featured__stage { perspective: 1400px; padding: 0 24px; margin: 0 auto clamp(56px, 7vw, 96px); max-width: 1100px; }

.device {
  border-radius: 18px;
  background: #0b0b0d;
  box-shadow: 0 60px 120px -40px rgba(0,0,0,.45), 0 0 0 1px rgba(0,0,0,.06);
  overflow: hidden;
  transform-origin: center top;
  transform: scale(.88) rotateX(10deg);
  opacity: .6;
  transition: transform 1.1s var(--ease), opacity .9s;
}
.device.in { transform: none; opacity: 1; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .device, .device.in {
      transition: none;
      animation: device-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 90%;
    }
  }
}
@keyframes device-in {
  from { transform: scale(.86) rotateX(14deg) translateY(40px); opacity: .5; }
  to   { transform: none; opacity: 1; }
}

.device__bar {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 14px;
  background: #1a1a1d;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.device__bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a3a3f; }
.device__bar span:nth-child(1) { background: #ff5f57; }
.device__bar span:nth-child(2) { background: #febc2e; }
.device__bar span:nth-child(3) { background: #28c840; }
.device__bar p { flex: 1; text-align: center; font-size: 12px; color: #86868b; margin-right: 50px; }
.device__screen {
  display: grid; grid-template-columns: 190px 1fr;
  min-height: 460px;
  background: #0f0f11;
}
.mock--sidebar { padding: 22px 16px; border-right: 1px solid rgba(255,255,255,.05); display: flex; flex-direction: column; gap: 14px; }
.mock--sidebar i { display: block; height: 10px; border-radius: 5px; background: rgba(255,255,255,.08); width: 70%; }
.mock--sidebar i:first-child { background: var(--blue-dark); width: 85%; }
.mock--main { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.mock__hero { height: 120px; border-radius: 14px; background: linear-gradient(120deg, #1f6fff, #8a5cff 60%, #ff5c8a); }
.mock__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mock__row i { display: block; height: 64px; border-radius: 12px; background: rgba(255,255,255,.06); }
.mock__chart {
  flex: 1; display: flex; align-items: flex-end; gap: 10px;
  padding: 18px; border-radius: 14px; background: rgba(255,255,255,.04); min-height: 150px;
}
.mock__chart b {
  flex: 1; height: var(--h);
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(to top, #0071e3, #6ec1ff);
  transform-origin: bottom; transform: scaleY(0);
  transition: transform 1s var(--ease);
}
.device.in .mock__chart b { transform: scaleY(1); }
.mock__chart b:nth-child(n) { transition-delay: calc(var(--i, 0) * .05s); }
@media (max-width: 734px) {
  .device__screen { grid-template-columns: 1fr; min-height: 360px; }
  .mock--sidebar { display: none; }
}

.features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px;
  max-width: 1000px; margin: 0 auto;
}
.feature h3 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 8px; }
.feature p { font-size: 17px; color: var(--ink-2); line-height: 1.5; }
@media (max-width: 734px) { .features { grid-template-columns: 1fr; gap: 28px; } }
.featured__links { display: flex; gap: 36px; justify-content: center; margin-top: 56px; flex-wrap: wrap; }

/* ---------- Projects: snap carousel ---------- */
.carousel__nav { display: flex; gap: 12px; }
.round-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.12); color: #fff;
  display: grid; place-items: center;
  transition: background .2s, transform .2s, opacity .2s;
}
.round-btn:hover { background: rgba(255,255,255,.22); }
.round-btn:active { transform: scale(.94); }
.round-btn[disabled] { opacity: .3; cursor: default; }

.carousel {
  --gap: 20px;
  --pad: max(24px, calc((100vw - var(--maxw)) / 2 + 24px));
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--pad);
  padding: 8px var(--pad) 32px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }

.tile {
  position: relative;
  flex: 0 0 auto;
  width: min(405px, 82vw);
  height: 500px;
  border-radius: var(--radius-xl);
  padding: 32px;
  scroll-snap-align: start;
  display: flex; flex-direction: column;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.tile::before {
  /* subtle sheen */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 80% at 80% 100%, rgba(255,255,255,.18), transparent 60%);
}
.tile:hover { transform: scale(1.015); box-shadow: 0 40px 80px -40px rgba(0,0,0,.9); }
.tile--blue   { background: linear-gradient(160deg, #0b1f3f 0%, #0a4ac4 60%, #2997ff 100%); }
.tile--purple { background: linear-gradient(160deg, #1e0b3f 0%, #5b2bd1 60%, #a98bff 100%); }
.tile--green  { background: linear-gradient(160deg, #06261d 0%, #0a7a57 60%, #34d399 100%); }
.tile--orange { background: linear-gradient(160deg, #3a1300 0%, #c2410c 60%, #fb923c 100%); }
.tile--mono   { background: linear-gradient(160deg, #1d1d1f 0%, #2a2a2d 100%); }

.tile__eyebrow { font-size: 14px; font-weight: 600; letter-spacing: .01em; color: rgba(255,255,255,.7); margin-bottom: 8px; }
.tile__title { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.08; margin-bottom: 14px; }
.tile__text { font-size: 17px; line-height: 1.45; color: rgba(255,255,255,.85); max-width: 32ch; }
.tile__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.tile__tags li {
  font-size: 13px; font-weight: 500; padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.tile__plus {
  position: absolute; right: 24px; bottom: 24px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
  font-size: 24px; font-weight: 500; line-height: 1;
  transition: background .2s, transform .3s var(--ease);
}
.tile:hover .tile__plus { background: rgba(255,255,255,.3); transform: rotate(90deg); }
.tile--mono .tile__plus { font-size: 28px; }
.tile--mono:hover .tile__plus { transform: translateX(3px); }
@media (max-width: 600px) { .tile { height: 440px; padding: 26px; } .tile__title { font-size: 30px; } }

/* ---------- Experience: timeline ---------- */
.timeline { position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px;
  width: 1px; background: rgba(0,0,0,.12);
}
.timeline__item {
  position: relative;
  display: grid; grid-template-columns: 140px 1fr; gap: 24px;
  padding: 0 0 48px 32px;
}
.timeline__item::before {
  content: ""; position: absolute; left: -5px; top: 9px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--offwhite); border: 2px solid var(--blue-dark);
}
.timeline__item:first-child::before { background: var(--blue-dark); box-shadow: 0 0 0 6px rgba(0,113,227,.15); }
.timeline__item time { font-size: 17px; font-weight: 600; color: var(--blue-dark); letter-spacing: -.01em; padding-top: 2px; }
.timeline__item h3 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 8px; line-height: 1.2; }
.timeline__item p { font-size: 17px; color: var(--ink-2); line-height: 1.55; }
.placeholder { color: #c2410c; }
@media (max-width: 600px) { .timeline__item { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact__title { font-size: clamp(40px, 7vw, 88px); font-weight: 700; letter-spacing: -.035em; line-height: 1.04; margin-bottom: 24px; }
.contact__lead { font-size: clamp(19px, 2.2vw, 26px); color: var(--gray-2); line-height: 1.4; margin-bottom: 40px; }
.contact__actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 44px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 28px; border-radius: var(--radius-pill);
  font-size: 17px; font-weight: 500; letter-spacing: -.01em;
  transition: background .2s, transform .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--blue-dark); color: #fff; }
.btn--primary:hover { background: #0077ed; }
.btn--ghost { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #fff; cursor: pointer; }
.btn--ghost:hover { border-color: #fff; }
.socials { display: flex; flex-wrap: wrap; gap: 14px 28px; justify-content: center; padding: 0 16px; }
.socials a { font-size: 15px; color: var(--gray); transition: color .2s; }
.socials a:hover { color: #fff; }

/* ---------- Footer ---------- */
.footer {
  background: var(--black); color: var(--gray);
  font-size: 12px; padding: 24px 0 40px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Selection ---------- */
::selection { background: rgba(41,151,255,.35); }

/* ==========================================================
   Motion additions
   ========================================================== */

/* ---------- Typewriter (hero) ---------- */
.typewriter { display: inline-block; min-height: 1.02em; white-space: nowrap; }
.typewriter__text { display: inline; }
.typewriter__caret {
  display: inline-block;
  width: .06em; height: .9em;
  margin-left: .06em;
  vertical-align: -.08em;
  background: #a98bff;
  border-radius: 2px;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@media (max-width: 600px) { .typewriter { white-space: normal; } }

/* ---------- Ticker (infinite marquee) ---------- */
.ticker {
  background: var(--black);
  color: var(--gray);
  border-top: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
  padding: 18px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.ticker__track {
  display: flex; gap: 48px; width: max-content;
  animation: ticker 40s linear infinite;
}
.ticker__track span {
  font-size: 14px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap; position: relative;
}
.ticker__track span::after {
  content: ""; position: absolute; right: -27px; top: 50%;
  width: 5px; height: 5px; border-radius: 50%; background: var(--blue); transform: translateY(-50%);
}
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker:hover .ticker__track { animation-play-state: paused; }

/* ---------- Split-word title reveal ---------- */
.split .word { display: inline-block; overflow: hidden; vertical-align: bottom; }
.split .word > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform .9s var(--ease) calc(var(--i, 0) * .08s);
}
.in .split .word > span, .split.in .word > span { transform: none; }

/* ---------- 3D tilt on hover (cards, tiles) ---------- */
.tilt { transform-style: preserve-3d; }
.tilt.is-tilting {
  transition: transform .08s linear, box-shadow .5s var(--ease);
  transform: perspective(900px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)) translateY(-4px) scale(1.01);
}
.tilt.is-tilting::after {
  /* light sheen following the cursor */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(500px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.14), transparent 45%);
}

/* ---------- Hero parallax ---------- */
.hero__content { will-change: transform, opacity; }

/* ---------- Featured: live iframe inside the device ---------- */
.device__screen--live { display: block; min-height: 0; height: clamp(420px, 56vw, 640px); background: #fff; }
.device__screen--live iframe { width: 100%; height: 100%; border: 0; display: block; }
.featured__hint { text-align: center; font-size: 14px; color: var(--ink-2); margin-top: 16px; }
@media (max-width: 734px) { .device__screen--live { height: 520px; } }

/* ---------- Timeline line draws in on scroll ---------- */
.timeline::before { transform-origin: top; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .timeline::before {
      animation: draw-line linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 60%;
    }
  }
}
@keyframes draw-line { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
  .typewriter__caret { animation: none; }
  .split .word > span { transform: none; transition: none; }
  .tilt.is-tilting { transform: none; }
}

/* ---------- Avatar (nav + hero) ---------- */
.nav__avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.hero__avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 22px;
  box-shadow: 0 0 0 3px rgba(255,255,255,.12), 0 20px 50px -20px rgba(0,0,0,.9);
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.hero__avatar.reveal { transform: translateY(28px) scale(.9); }
.hero__avatar.reveal.in { transform: none; }
@media (prefers-reduced-motion: reduce) { .hero__avatar { animation: none; } }

/* ---------- Rating + quote (Creative card) ---------- */
.rating { display: flex; align-items: baseline; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.rating__score { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1; color: #fff; }
.rating__stars { color: #ffb340; font-size: 16px; letter-spacing: .08em; }
.rating__meta { font-size: 13px; color: var(--gray); }
.card__quote {
  margin: 16px 0 0; padding: 14px 16px;
  border-left: 2px solid rgba(255,255,255,.18);
  font-size: 14px; line-height: 1.55; color: var(--gray-2);
}
.card__quote cite { display: block; margin-top: 6px; font-style: normal; font-size: 12px; color: var(--gray); }

/* ---------- Project tile icon ---------- */
.tile__icon { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 18px; box-shadow: 0 8px 24px -8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.12); }

/* ---------- Services ---------- */
.services__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.service {
  position: relative; background: #fff; border-radius: var(--radius-xl);
  padding: 32px 30px 30px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 20px 50px -40px rgba(0,0,0,.35);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.service:hover { box-shadow: 0 30px 60px -30px rgba(0,0,0,.25); }
.service__num { font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--blue-dark); margin-bottom: 14px; }
.service h3 { font-size: 24px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 12px; }
.service p { font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.chips--light li { background: rgba(0,0,0,.05); color: var(--ink); border-color: rgba(0,0,0,.04); }
.services .featured__links { margin-top: 44px; }
@media (max-width: 900px) { .services__grid { grid-template-columns: 1fr; } }

/* ---------- Nav brand as button ---------- */
button.nav__brand { background: none; border: 0; padding: 6px 8px; margin-left: -8px; border-radius: 10px; color: inherit; cursor: pointer; transition: background .2s; }
button.nav__brand:hover { background: rgba(255,255,255,.08); }

/* ---------- Profile card dialog ---------- */
.pcard {
  border: 0; padding: 0; background: transparent; color: var(--offwhite);
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  overflow: visible;
}
.pcard::backdrop { background: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
.pcard__inner {
  position: relative;
  background: linear-gradient(160deg, #26262a 0%, #151517 60%, #0d0d0f 100%);
  border-radius: 28px;
  padding: 30px 28px 26px;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.08) inset;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.pcard[open] .pcard__inner { animation: pcard-in .55s var(--ease) both; }
@keyframes pcard-in { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
.pcard__close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center;
}
.pcard__close:hover { background: rgba(255,255,255,.2); }
.pcard__head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.pcard__avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px rgba(255,255,255,.12); flex: none; }
.pcard__name { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.pcard__romaji { font-size: 13px; color: var(--gray); margin-top: 4px; letter-spacing: .02em; }
.pcard__role { font-size: 14px; color: var(--blue); margin-top: 8px; font-weight: 600; }
.pcard__meta { margin: 0 0 20px; display: grid; gap: 10px; }
.pcard__meta div { display: grid; grid-template-columns: 76px 1fr; gap: 10px; font-size: 14px; line-height: 1.5; }
.pcard__meta dt { color: var(--gray); font-weight: 600; }
.pcard__meta dd { margin: 0; color: var(--gray-2); }
.pcard__links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pcard__links a {
  font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.08); transition: background .2s;
}
.pcard__links a:hover { background: rgba(255,255,255,.16); }
.pcard__actions { display: flex; flex-direction: column; gap: 10px; }
.pcard__actions .btn { font-size: 15px; padding: 12px 18px; }
@media (prefers-reduced-motion: reduce) { .pcard[open] .pcard__inner { animation: none; } }

/* ---------- Project gallery dialog ---------- */
.gallery {
  border: 0; padding: 0; background: transparent; color: var(--offwhite);
  width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto;
}
.gallery::backdrop { background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
.gallery__inner {
  position: relative; background: #121214; border-radius: 28px; padding: 32px 32px 28px;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.08) inset;
  max-height: calc(100vh - 32px); overflow: auto;
}
.gallery[open] .gallery__inner { animation: pcard-in .55s var(--ease) both; }
.gallery__head { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; padding-right: 40px; }
.gallery__icon { width: 64px; height: 64px; border-radius: 16px; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.gallery__eyebrow { font-size: 13px; font-weight: 600; color: var(--blue); margin-bottom: 4px; }
.gallery__title { font-size: clamp(26px, 3vw, 34px); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.gallery__desc { font-size: 16px; line-height: 1.65; color: var(--gray-2); max-width: 70ch; }
.gallery__facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 24px; }
.gallery__facts li { font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: var(--radius-pill); background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
.gallery__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gallery__grid figure { margin: 0; border-radius: 16px; overflow: hidden; background: #1d1d1f; }
.gallery__grid img { width: 100%; height: auto; display: block; aspect-ratio: var(--ar, auto); object-fit: cover; transition: transform .6s var(--ease); }
.gallery__grid figure:hover img { transform: scale(1.03); }
.gallery__grid figcaption { font-size: 12px; color: var(--gray); padding: 8px 10px 10px; }
.gallery__grid--phones { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.gallery__note { font-size: 12px; color: var(--gray); margin-top: 18px; }
@media (max-width: 600px) { .gallery__inner { padding: 24px 20px 22px; border-radius: 22px; } .gallery__grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
@media (prefers-reduced-motion: reduce) { .gallery[open] .gallery__inner { animation: none; } }

/* ---------- Japanese line breaking ---------- */
/* .ph = a phrase that must not break internally. Kept inline (not inline-block): WebKit does not paint
   background-clip:text through inline-block children, which made gradient text vanish on iOS. */
.ph { display: inline; white-space: nowrap; }
/* Phrase-aware wrapping where supported (Chrome), balanced headings everywhere. */
h2, h3, p, li, dd { word-break: auto-phrase; }
.section__title, .section__lead, .contact__title, .contact__lead, .statement__lead { text-wrap: balance; }
.hero__sub { max-width: 860px; }
.contact__title { font-size: clamp(36px, 6.4vw, 84px); }
.contact__lead { font-size: clamp(18px, 2vw, 24px); }

/* ==========================================================
   Intro / loading motion
   ========================================================== */
html.is-intro, html.is-intro body { overflow: hidden; }
.intro {
  position: fixed; inset: 0; z-index: 1000;
  background: #000; color: var(--offwhite);
  display: grid; place-items: center;
  isolation: isolate; cursor: pointer;
  clip-path: inset(0 0 0 0);
}
.intro__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; opacity: .8; }
.intro__center { display: grid; justify-items: center; gap: 10px; transform: translateY(0); }
.intro__mark { width: clamp(120px, 16vw, 180px); height: auto; margin-bottom: 14px; filter: drop-shadow(0 0 24px rgba(138,92,255,.35)); }
.intro__stroke { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw .5s var(--ease) forwards; }
.intro__stroke--1 { animation-delay: .02s; }
.intro__stroke--2 { stroke-dasharray: 60; stroke-dashoffset: 60; animation-delay: .32s; animation-duration: .25s; }
.intro__stroke--3 { animation-delay: .18s; animation-duration: .5s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.intro__name {
  font-size: clamp(22px, 3.2vw, 34px); font-weight: 700; letter-spacing: .28em; text-transform: uppercase;
  opacity: 0; transform: translateY(14px);
  animation: name-in .55s var(--ease) .35s forwards;
}
@keyframes name-in { to { opacity: 1; transform: none; letter-spacing: .06em; } }
.intro__sub { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--gray); opacity: 0; animation: fade-in .4s ease .6s forwards; }
@keyframes fade-in { to { opacity: 1; } }
.intro__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.08); }
.intro__bar span { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #6ec1ff, #a98bff, #ff8fb1); animation: bar 1s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes bar { to { transform: scaleX(1); } }
.intro__skip { display: none; }

/* exit: curtain wipes upward, content drifts up */
.intro--out { transition: clip-path .5s cubic-bezier(.76, 0, .24, 1); clip-path: inset(0 0 100% 0); pointer-events: none; }
.intro--out .intro__center { transition: transform .5s cubic-bezier(.76, 0, .24, 1), opacity .3s ease; transform: translateY(-50px); opacity: 0; }
.intro--out .intro__bar, .intro--out .intro__skip { opacity: 0; transition: opacity .3s; }

/* hero waits for the intro, then settles in with a slight scale */
body.has-intro .hero__content { opacity: 0; transform: scale(1.04); transition: opacity .7s var(--ease), transform .9s var(--ease); }
body.intro-done .hero__content { opacity: 1; transform: none; }
body:not(.has-intro) .hero__content { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
  body.has-intro .hero__content { opacity: 1; transform: none; transition: none; }
}
/* On narrow screens, phrase blocks in the hero make ragged lines — let the text flow instead. */
@media (max-width: 600px) { .hero__sub .ph { white-space: normal; } }

/* ==========================================================
   Scroll motion — stacked sections, ambient light, scroll-linked entrances
   ========================================================== */

/* Sections stack like rounded cards over the one before. */
.section { position: relative; border-radius: 40px 40px 0 0; margin-top: -40px; padding-top: calc(clamp(96px, 12vw, 160px) + 40px); }
.ticker { padding-bottom: calc(18px + 40px); }
.footer { position: relative; }
@media (max-width: 600px) { .section { border-radius: 28px 28px 0 0; margin-top: -28px; padding-top: calc(clamp(96px, 12vw, 160px) + 28px); } .ticker { padding-bottom: calc(18px + 28px); } }

/* Ambient light that lives behind every dark section and drifts with the page scroll.
   The fixed pseudo-elements are clipped to their section via clip-path. */
.section--dark { clip-path: inset(0 round 40px 40px 0 0); isolation: isolate; }
@media (max-width: 600px) { .section--dark { clip-path: inset(0 round 28px 28px 0 0); } }
.section--dark::before, .section--dark::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  width: 60vmax; height: 60vmax; border-radius: 50%;
  opacity: .5; will-change: transform;
}
.section--dark::before { background: radial-gradient(circle, rgba(31,111,255,.55) 0%, rgba(31,111,255,.18) 30%, transparent 62%); top: -30vmax; left: -20vmax; animation: amb-a 30s ease-in-out infinite alternate; }
.section--dark::after  { background: radial-gradient(circle, rgba(138,92,255,.5) 0%, rgba(255,92,138,.22) 32%, transparent 62%); bottom: -35vmax; right: -25vmax; animation: amb-b 36s ease-in-out infinite alternate; }
@keyframes amb-a { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(18vw, 22vh, 0) scale(1.2); } }
@keyframes amb-b { from { transform: translate3d(0,0,0) scale(1.1); } to { transform: translate3d(-16vw, -24vh, 0) scale(.9) rotate(30deg); } }

/* Where scroll-driven animations exist, tie the ambient light and entrances to the scroll position. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .section--dark::before { animation: amb-scroll-a linear both; animation-timeline: scroll(root); }
    .section--dark::after  { animation: amb-scroll-b linear both; animation-timeline: scroll(root); }
    @keyframes amb-scroll-a { from { transform: translate3d(-10vw, -10vh, 0) scale(1); } to { transform: translate3d(28vw, 40vh, 0) scale(1.25); } }
    @keyframes amb-scroll-b { from { transform: translate3d(10vw, 10vh, 0) scale(1.1) rotate(0deg); } to { transform: translate3d(-30vw, -45vh, 0) scale(.95) rotate(50deg); } }

    /* Section headers drift up as they enter. */
    .section__head { animation: enter-up linear both; animation-timeline: view(); animation-range: entry 0% entry 45%; }
    /* Cards, services and timeline rows settle in while scrolling (scrubbed, not timed). */
    .card, .service, .timeline__item, .feature, .features { animation: enter-up linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
    .card:nth-child(even), .service:nth-child(2) { animation-range: entry 5% entry 50%; }
    .card:nth-child(3n), .service:nth-child(3) { animation-range: entry 10% entry 55%; }
    /* Project tiles scale up as they slide into the carousel. */
    .tile { animation: tile-enter linear both; animation-timeline: view(x); animation-range: entry 0% entry 90%; }
    /* The live demo frame rises and straightens on scroll (already defined for the device). */
    .featured__hint { animation: fade-up linear both; animation-timeline: view(); animation-range: entry 0% entry 80%; }
    /* The contact headline zooms gently into place. */
    .contact .container { animation: zoom-in linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
  }
}
@keyframes enter-up { from { translate: 0 56px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes tile-enter { from { scale: .92; opacity: .45; } to { scale: 1; opacity: 1; } }
@keyframes fade-up { from { translate: 0 16px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes zoom-in { from { scale: .9; opacity: .2; } to { scale: 1; opacity: 1; } }

/* Scroll-linked text highlight (About): characters brighten as they pass through the viewport. */
.statement .ch { color: color-mix(in srgb, currentColor calc(var(--p, 1) * 100%), rgba(0,0,0,.14)); transition: color .12s linear; }
.statement strong .ch { color: color-mix(in srgb, var(--ink) calc(var(--p, 1) * 100%), rgba(0,0,0,.14)); }
.statement.is-live p { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  .section--dark::before, .section--dark::after { animation: none; }
  .statement .ch { color: inherit; }
}

/* ---------- Services: detailed rows ---------- */
.services__list { display: grid; gap: 20px; }
.service--row { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 36px; padding: 40px 40px 36px; }
.service__intro { display: flex; flex-direction: column; align-items: flex-start; }
.service__pitch { font-size: 19px; font-weight: 600; letter-spacing: -.015em; color: var(--ink); line-height: 1.4; margin-bottom: 14px; }
.service__proof { font-size: 14px; line-height: 1.6; color: var(--ink-2); margin-bottom: 18px; }
.service__intro .link-arrow { font-size: 16px; margin-top: auto; }
.service__body h4 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blue-dark); margin: 0 0 10px; }
.service__body h4 + ul { margin-bottom: 22px; }
.service__cases { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 18px; }
.service__cases li { position: relative; padding-left: 18px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.service__cases li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--blue-dark); }
.service__deliverables { display: grid; gap: 10px; }
.service__deliverables li { font-size: 15px; line-height: 1.6; color: var(--ink-2); padding-left: 18px; position: relative; }
.service__deliverables li::before { content: ""; position: absolute; left: 0; top: .72em; width: 8px; height: 2px; background: var(--ink); border-radius: 2px; }
.service__deliverables strong { color: var(--ink); font-weight: 700; }
.service__flow { font-size: 14px; color: var(--ink-2); padding: 12px 14px; background: rgba(0,0,0,.04); border-radius: 12px; margin-bottom: 18px; }
.service__flow strong { color: var(--ink); }
.service--row .chips { margin-top: 0; padding-top: 0; }
@media (max-width: 900px) {
  .service--row { grid-template-columns: 1fr; gap: 24px; padding: 30px 26px 28px; }
  .service__intro .link-arrow { margin-top: 6px; }
}

/* ==========================================================
   Background canvas stage + layering (replaces the blurred blobs)
   ========================================================== */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
main, .ticker, .footer { position: relative; z-index: 1; }
/* Dark areas are transparent so the canvas shows through; light sections float over it as rounded cards. */
.hero { background: transparent; }
.hero__bg, .blob, .intro__bg { display: none; }
.hero::after { background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.5) 100%), linear-gradient(to bottom, transparent 75%, rgba(0,0,0,.6) 100%); }
.ticker { background: transparent; }
.footer { background: transparent; }
.section--dark { background: transparent; border-radius: 0; margin-top: 0; padding-top: clamp(96px, 12vw, 160px); clip-path: none; isolation: auto; }
.section--dark::before, .section--dark::after { content: none; animation: none; }
.section--light { box-shadow: 0 -30px 80px -40px rgba(0,0,0,.6); }
/* The light section right after the ticker keeps its overlap; dark sections now sit flush. */
.intro { background: radial-gradient(ellipse at 50% 60%, #0b0b14 0%, #000 70%); }

/* ---------- Nav: current section ---------- */
.nav__links a.is-active { color: #fff; opacity: 1; }
.nav__links a:not(.nav__cta) { position: relative; }
.nav__links a:not(.nav__cta)::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 4px; height: 4px; border-radius: 50%; background: #fff; transform: translateX(-50%) scale(0); transition: transform .3s var(--ease); }
.nav__links a.is-active:not(.nav__cta)::after { transform: translateX(-50%) scale(1); }
@media (max-width: 834px) { .nav__links a:not(.nav__cta)::after { display: none; } .nav__links a.is-active { color: var(--blue); } }

/* ---------- Keyboard focus ---------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.section--light :focus-visible { outline-color: var(--blue-dark); }
.tile:focus-visible, .card:focus-visible, .service:focus-visible { outline-offset: 4px; border-radius: var(--radius-xl); }
.btn:focus-visible, .round-btn:focus-visible, .pcard__close:focus-visible, .lightbox__close:focus-visible, .lightbox__nav:focus-visible { outline-offset: 3px; border-radius: var(--radius-pill); }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 2000; padding: 10px 14px; background: var(--blue-dark); color: #fff; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600; transform: translateY(-200%); transition: transform .2s; }
.skip-link:focus-visible { transform: none; outline-color: #fff; }

/* ---------- Lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; display: none; place-items: center; }
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: rgba(0,0,0,.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.lightbox__figure { margin: 0; display: grid; justify-items: center; gap: 12px; max-width: min(1200px, 92vw); animation: pcard-in .45s var(--ease) both; }
.lightbox__figure img { max-width: 92vw; max-height: 82vh; width: auto; height: auto; border-radius: 16px; box-shadow: 0 40px 100px -30px rgba(0,0,0,.9); }
.lightbox__figure figcaption { font-size: 13px; color: var(--gray-2); letter-spacing: .02em; }
.lightbox__close { position: fixed; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; }
.lightbox__close:hover { background: rgba(255,255,255,.22); }
.lightbox__nav { position: fixed; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; transition: background .2s; }
.lightbox__nav:hover { background: rgba(255,255,255,.22); }
.lightbox__nav--prev { left: 18px; } .lightbox__nav--next { right: 18px; }
@media (max-width: 600px) { .lightbox__nav { top: auto; bottom: 18px; transform: none; } .lightbox__nav--prev { left: calc(50% - 56px); } .lightbox__nav--next { right: calc(50% - 56px); } .lightbox__figure img { max-height: 70vh; } }
@media (prefers-reduced-motion: reduce) { .lightbox__figure { animation: none; } }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 3000; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 14px; font-size: 14px; line-height: 1.4; color: #fff;
  background: rgba(29,29,31,.92); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 20px 50px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.08);
  transition: opacity .3s, transform .4s var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================
   Contact form dialog
   ========================================================== */
.cform { border: 0; padding: 0; background: transparent; color: var(--offwhite); width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto; }
.cform::backdrop { background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
.cform__inner { position: relative; background: linear-gradient(160deg, #202024 0%, #141416 60%, #0d0d0f 100%); border-radius: 28px; padding: 34px 32px 28px; box-shadow: 0 40px 100px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.08) inset; max-height: calc(100vh - 32px); overflow: auto; }
.cform[open] .cform__inner { animation: pcard-in .55s var(--ease) both; }
.cform__eyebrow { font-size: 13px; font-weight: 600; color: var(--blue); margin-bottom: 6px; }
.cform__title { font-size: clamp(26px, 3vw, 32px); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; margin-bottom: 8px; }
.cform__lead { font-size: 15px; color: var(--gray-2); line-height: 1.5; margin-bottom: 22px; }
.cform__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 600; color: var(--gray-2); }
.field em { font-style: normal; font-size: 11px; color: var(--blue); margin-left: 6px; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 15px; color: #fff; width: 100%;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
  padding: 12px 14px; transition: border-color .2s, background .2s, box-shadow .2s; -webkit-appearance: none; appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, #a1a1a6 50%), linear-gradient(135deg, #a1a1a6 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.field select option { color: #000; }
.field textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
.field input::placeholder, .field textarea::placeholder { color: rgba(255,255,255,.3); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); background: rgba(255,255,255,.08); box-shadow: 0 0 0 4px rgba(41,151,255,.18); }
.field input:user-invalid, .field textarea:user-invalid { border-color: #ff6b6b; }
.cform__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cform__error { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: rgba(255,107,107,.12); color: #ff8a8a; font-size: 14px; line-height: 1.5; }
.cform__actions { display: flex; align-items: center; gap: 22px; margin-top: 20px; flex-wrap: wrap; }
.cform__actions .btn { min-width: 150px; }
.cform__actions .btn[disabled] { opacity: .6; cursor: progress; }
.cform__alt { font-size: 15px; }
.cform__note { font-size: 12px; color: var(--gray); margin-top: 14px; }
.cform__done { text-align: center; padding: 20px 0 8px; animation: pcard-in .5s var(--ease) both; }
.cform__check { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0071e3, #8a5cff); box-shadow: 0 20px 50px -20px rgba(41,151,255,.8); }
.cform__done .cform__lead { margin-bottom: 22px; }
@media (max-width: 600px) { .cform__inner { padding: 26px 20px 22px; border-radius: 22px; } .cform__grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .cform[open] .cform__inner, .cform__done { animation: none; } }

/* ==========================================================
   "Sent" motion: letter folds into a paper plane and flies away
   ========================================================== */
.sendfx { display: grid; place-items: center; min-height: 360px; }
.sendfx__stage { position: relative; width: 320px; height: 260px; perspective: 900px; }
.sendfx__letter {
  position: absolute; left: 50%; top: 50%; width: 240px; height: 156px; margin: -78px 0 0 -120px;
  background: linear-gradient(180deg, #fff, #ececf1); border-radius: 10px;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.8), inset 0 0 0 1px rgba(0,0,0,.05);
  padding: 24px 22px; display: grid; gap: 12px; align-content: start;
  transform-origin: 50% 50%;
  animation: letter-fold 1.3s cubic-bezier(.65, 0, .35, 1) forwards;
}
.sendfx__line { display: block; height: 8px; border-radius: 4px; background: #c9c9d1; }
.sendfx__line--short { width: 55%; }
@keyframes letter-fold {
  0%   { transform: translateY(0) rotateX(0) scale(1); opacity: 1; }
  25%  { transform: translateY(-6px) rotateX(0) scale(1.02); }
  60%  { transform: translateY(0) rotateX(78deg) scaleX(.62) scaleY(.5); opacity: 1; border-radius: 4px; }
  100% { transform: translateY(10px) rotateX(90deg) scaleX(.2) scaleY(.1); opacity: 0; }
}
.sendfx__plane {
  position: absolute; left: 50%; top: 50%; width: 104px; height: 104px; margin: -52px 0 0 -52px;
  opacity: 0; filter: drop-shadow(0 18px 30px rgba(0,0,0,.6));
  animation: plane-fly 2.1s cubic-bezier(.4, 0, .2, 1) 1.05s forwards;
}
@keyframes plane-fly {
  0%   { opacity: 0; transform: translate(0, 10px) rotate(-6deg) scale(.6); }
  12%  { opacity: 1; transform: translate(0, -4px) rotate(-6deg) scale(1); }
  30%  { transform: translate(-30px, 18px) rotate(10deg) scale(1.02); }
  55%  { transform: translate(90px, -60px) rotate(-24deg) scale(.95); }
  100% { opacity: 0; transform: translate(340px, -260px) rotate(-30deg) scale(.45); }
}
.sendfx__trail {
  position: absolute; left: 50%; top: 50%; width: 400px; height: 120px; margin: -70px 0 0 -60px;
  opacity: 0; animation: trail-draw 1.5s ease-out 1.35s forwards;
}
.sendfx__trail path { stroke-dashoffset: 0; }
@keyframes trail-draw { 0% { opacity: 0; clip-path: inset(0 100% 0 0); } 20% { opacity: .9; } 100% { opacity: 0; clip-path: inset(0 0 0 0); } }
.sendfx__spark {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; border-radius: 50%;
  background: #a98bff; opacity: 0; animation: spark .9s ease-out 1.15s forwards;
}
.sendfx__spark:nth-child(4) { --dx: -70px; --dy: -40px; background: #6ec1ff; }
.sendfx__spark:nth-child(5) { --dx: 60px; --dy: -70px; animation-delay: 1.2s; }
.sendfx__spark:nth-child(6) { --dx: -40px; --dy: 60px; background: #ff8fb1; animation-delay: 1.25s; }
.sendfx__spark:nth-child(7) { --dx: 80px; --dy: 30px; background: #6ec1ff; animation-delay: 1.3s; }
.sendfx__spark:nth-child(8) { --dx: -90px; --dy: 10px; animation-delay: 1.35s; }
.sendfx__spark:nth-child(9) { --dx: 20px; --dy: -95px; background: #ff8fb1; animation-delay: 1.4s; }
@keyframes spark { 0% { opacity: 0; transform: translate(0,0) scale(.4); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx, 60px), var(--dy, -60px)) scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .sendfx { display: none !important; } }

/* ---------- Bottom of the page on phones: make Contact + footer fit one screen ---------- */
@media (max-width: 600px) {
  .contact { padding-top: 64px; padding-bottom: 44px; }
  .contact__title { font-size: clamp(34px, 10vw, 44px); margin-bottom: 16px; }
  .contact__lead { font-size: 16px; margin-bottom: 26px; }
  .contact__actions { margin-bottom: 26px; gap: 10px; }
  .contact__actions .btn { padding: 12px 22px; font-size: 16px; }
  .socials { gap: 10px 22px; }
  .socials a { font-size: 14px; }
  .footer { padding: 16px 0 22px; font-size: 11px; }
  .footer .container { flex-direction: column; gap: 4px; align-items: center; text-align: center; }
}

/* ---------- No sideways movement: clip overflow inside dialogs and the page ---------- */
html, body { overflow-x: clip; }
.sendfx, .sendfx__stage { overflow: hidden; }
.sendfx__stage { width: min(320px, 100%); }
.cform__inner, .pcard__inner, .gallery__inner { overflow-x: hidden; overscroll-behavior: contain; }
.cform__grid, .cform__actions { min-width: 0; }
.field input, .field select, .field textarea { min-width: 0; max-width: 100%; }
/* While a dialog is open the page behind it is frozen (also stops iOS from panning it). */
html.modal-open, html.modal-open body { overflow: hidden; }
html.modal-open body { position: fixed; left: 0; right: 0; width: 100%; }

/* ==========================================================
   Experience (oldest → newest): the line is drawn from the top down as you scroll,
   its tip staying around the lower half of the screen; dots light up as the tip passes.
   --p (0..1) is set by script.js from the scroll position. Text never dims.
   ========================================================== */
.timeline { --p: 0; }
.timeline::before {
  width: 2px; left: -0.5px; top: 10px; bottom: 10px;
  background: linear-gradient(180deg, #ff5c8a, #8a5cff 40%, #0071e3);
  transform-origin: top; transform: scaleY(var(--p));
  animation: none; transition: none;
}
.timeline::after {
  /* glowing head riding on the tip of the line */
  content: ""; position: absolute; left: -5px; width: 11px; height: 11px; border-radius: 50%;
  top: calc(10px + var(--p) * (100% - 20px));
  background: #fff; box-shadow: 0 0 0 4px rgba(0,113,227,.25), 0 0 24px 6px rgba(41,151,255,.55);
  opacity: var(--head, 0); transition: opacity .3s; animation: none;
}
.timeline__item { opacity: 1; }
.timeline__item::before {
  background: var(--offwhite); border: 2px solid rgba(0,113,227,.4);
  transform: scale(.7); opacity: .85;
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .3s, background .3s, box-shadow .4s, border-color .3s;
}
.timeline__item.is-lit::before {
  transform: scale(1); opacity: 1; background: var(--blue-dark); border-color: var(--blue-dark);
  box-shadow: 0 0 0 6px rgba(0,113,227,.14);
}
.timeline__item:first-child::before { box-shadow: none; }
.timeline__item:last-child.is-lit::before { box-shadow: 0 0 0 6px rgba(0,113,227,.18), 0 0 22px 4px rgba(41,151,255,.45); }
.timeline__item time { color: var(--blue-dark); }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .timeline__item { animation: row-slide linear both; animation-timeline: view(); animation-range: entry 0% entry 50%; }
  }
}
@keyframes row-slide { from { translate: -18px 0; } to { translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .timeline { --p: 1; }
  .timeline::after { display: none; }
  .timeline__item::before { transform: none; opacity: 1; background: var(--blue-dark); border-color: var(--blue-dark); }
}
  .timeline::after { display: none; }
  .timeline__item::before { transform: none; opacity: 1; background: var(--blue-dark); border-color: var(--blue-dark); }
}
  .timeline::after { display: none; }
  .timeline__item, .timeline__item:not(.is-lit) { opacity: 1; }
  .timeline__item::before { transform: none; opacity: 1; background: var(--blue-dark); border-color: var(--blue-dark); }
  .timeline__item time { color: var(--blue-dark); }
}

/* ==========================================================
   Experience background: faint ruled grid, soft light, and a big year watermark
   that follows the tip of the timeline
   ========================================================== */
.experience { position: relative; overflow: clip; }
.experience .container { position: relative; z-index: 1; }
.experience::before {
  /* ruled lines + soft colour washes */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 40% at 8% 12%, rgba(41,151,255,.10), transparent 70%),
    radial-gradient(50% 35% at 92% 85%, rgba(255,92,138,.08), transparent 70%),
    radial-gradient(40% 30% at 70% 30%, rgba(138,92,255,.06), transparent 70%),
    repeating-linear-gradient(180deg, transparent 0 55px, rgba(0,0,0,.045) 55px 56px);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 120px, #000 calc(100% - 120px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 120px, #000 calc(100% - 120px), transparent 100%);
}
.experience__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.experience__year {
  position: sticky; top: 34vh;
  display: flex; justify-content: flex-end; padding-right: 4vw;
  font-size: clamp(120px, 22vw, 300px); font-weight: 800; letter-spacing: -.06em; line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(0,0,0,.10);
  user-select: none;
}
.experience__year span {
  display: inline-block;
  background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.02));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  transition: transform .5s var(--ease), opacity .5s;
}
.experience__year span.is-flipping { transform: translateY(-14px); opacity: 0; transition: none; }
@media (max-width: 900px) {
  .experience__year { top: 18vh; justify-content: flex-end; padding-right: 10px; font-size: clamp(96px, 26vw, 150px); -webkit-text-stroke: 1px rgba(0,0,0,.07); }
  .experience__year span { background: linear-gradient(180deg, rgba(0,0,0,.055), rgba(0,0,0,.015)); -webkit-background-clip: text; background-clip: text; }
}

/* Items stay a little quiet until the line reaches them, then come forward. */
.timeline__item { transition: opacity .6s ease, filter .6s ease; }
.timeline__item:not(.is-lit) { opacity: .55; }
.timeline__item.is-lit { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .timeline__item:not(.is-lit) { opacity: 1; } .experience__year span { transition: none; } }

/* ==========================================================
   Backgrounds for the light sections — same palette, a different texture each
   ========================================================== */
.section--light { overflow: clip; }
.section--light > .container, .featured__stage { position: relative; z-index: 1; }
.section--light::before, .section--light::after { border-radius: inherit; }

/* About: fine dot grid under a soft halo */
#about::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(55% 45% at 50% 0%, rgba(41,151,255,.16), transparent 70%),
    radial-gradient(40% 35% at 92% 92%, rgba(255,92,138,.09), transparent 70%),
    radial-gradient(35% 30% at 6% 70%, rgba(138,92,255,.08), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(0,0,0,.085) 1px, transparent 1.6px) 0 0 / 26px 26px;
  -webkit-mask-image: radial-gradient(75% 80% at 50% 45%, #000 35%, transparent 100%);
  mask-image: radial-gradient(75% 80% at 50% 45%, #000 35%, transparent 100%);
}

/* Featured (live demo): product stage — square grid, spotlight, coloured corners */
#featured::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(48% 36% at 50% 48%, rgba(255,255,255,.95), rgba(255,255,255,0) 72%),
    radial-gradient(42% 32% at 12% 18%, rgba(138,92,255,.12), transparent 70%),
    radial-gradient(42% 32% at 88% 84%, rgba(41,151,255,.12), transparent 70%),
    linear-gradient(rgba(0,0,0,.055) 1px, transparent 1px) 0 0 / 100% 48px,
    linear-gradient(90deg, rgba(0,0,0,.055) 1px, transparent 1px) 0 0 / 48px 100%;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 110px, #000 calc(100% - 110px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 110px, #000 calc(100% - 110px), transparent 100%);
}
#featured::after {
  /* a soft floor shadow under the device so it sits on the stage */
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 50%; top: 52%; width: min(1100px, 92vw); height: 220px; transform: translate(-50%, 0);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.14), transparent 70%);
  filter: blur(10px);
}
@media (max-width: 734px) { #featured::after { height: 140px; } }

/* Services: thin gradient rings that drift slightly with the scroll */
#services::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(50% 40% at 100% 0%, rgba(41,151,255,.12), transparent 70%),
    radial-gradient(45% 35% at 0% 100%, rgba(255,92,138,.09), transparent 70%),
    radial-gradient(40% 30% at 50% 55%, rgba(138,92,255,.06), transparent 70%);
}
#services::after {
  content: ""; position: absolute; inset: -10% 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(circle at 12% 22%, transparent 219px, rgba(138,92,255,.16) 220px, rgba(138,92,255,.16) 222px, transparent 223px),
    radial-gradient(circle at 88% 38%, transparent 139px, rgba(41,151,255,.16) 140px, rgba(41,151,255,.16) 142px, transparent 143px),
    radial-gradient(circle at 70% 88%, transparent 299px, rgba(255,92,138,.13) 300px, rgba(255,92,138,.13) 302px, transparent 303px),
    radial-gradient(circle at 25% 78%, transparent 89px, rgba(0,113,227,.12) 90px, rgba(0,113,227,.12) 91px, transparent 92px);
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    #services::after { animation: rings-drift linear both; animation-timeline: view(); animation-range: entry 0% exit 100%; }
  }
}
@keyframes rings-drift { from { translate: 0 60px; } to { translate: 0 -60px; } }

/* ==========================================================
   Buddy: floating avatar in the corner that opens the contact form
   ========================================================== */
.buddy {
  position: fixed; right: 22px; bottom: 22px; z-index: 900;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  transform: translateY(140%); opacity: 0; pointer-events: none;
  transition: transform .7s cubic-bezier(.34, 1.4, .64, 1), opacity .4s;
}
.buddy.is-in { transform: none; opacity: 1; pointer-events: auto; }
.buddy.is-hidden, html.modal-open .buddy { transform: translateY(140%); opacity: 0; pointer-events: none; }
.buddy__btn {
  position: relative; width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: linear-gradient(135deg, #6ec1ff, #a98bff 50%, #ff8fb1);
  box-shadow: 0 18px 40px -14px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.15);
  animation: buddy-bob 4.5s ease-in-out infinite;
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.buddy__btn:hover { transform: translateY(-4px) scale(1.06); animation-play-state: paused; }
.buddy__btn:active { transform: scale(.96); }
.buddy__btn img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; display: block; margin: 3px; box-shadow: 0 0 0 2px #000 inset; }
.buddy__badge {
  position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--blue-dark); color: #fff; display: grid; place-items: center;
  box-shadow: 0 0 0 3px #fff, 0 6px 14px -4px rgba(0,0,0,.6);
}
@keyframes buddy-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.buddy__bubble {
  position: relative; max-width: min(280px, calc(100vw - 60px));
  padding: 12px 36px 12px 14px; border-radius: 16px 16px 4px 16px;
  background: #fff; color: var(--ink); font-size: 14px; line-height: 1.5; font-weight: 500;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.45), 0 0 0 1px rgba(0,0,0,.05);
  transform: translateY(8px) scale(.96); opacity: 0; pointer-events: none; transform-origin: 90% 100%;
  transition: transform .45s cubic-bezier(.34, 1.4, .64, 1), opacity .3s;
}
.buddy__bubble::after {
  content: ""; position: absolute; right: 16px; bottom: -7px; width: 14px; height: 14px;
  background: #fff; transform: rotate(45deg); border-radius: 2px; box-shadow: 2px 2px 3px -2px rgba(0,0,0,.15);
}
.buddy.is-talking .buddy__bubble { transform: none; opacity: 1; pointer-events: auto; }
.buddy__dismiss {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.06); color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
}
.buddy__dismiss:hover { background: rgba(0,0,0,.12); }
@media (max-width: 600px) {
  .buddy { right: 14px; bottom: 14px; gap: 8px; }
  .buddy__btn { width: 56px; height: 56px; }
  .buddy__btn img { width: 50px; height: 50px; }
  .buddy__bubble { font-size: 13px; padding: 10px 32px 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { .buddy, .buddy__bubble, .buddy__btn { transition: none; animation: none; } }
