/* ============================================================
   wangzhangwu.com — style.css
   Instrument Sans · GSAP 3 + ScrollTrigger + Lenis · no build step
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --color-dark: #1C1D20;
  --color-dark-dark: #141517;
  --color-white: #FFFFFF;
  --color-light: #FFFFFF;
  --color-blue: #455CE9;
  --color-blue-dark: #334BD3;
  --color-gray: #999D9E;
  --color-lightgray: #E9EAEB;
  --color-border: rgba(28, 29, 32, 0.175);
  --color-border-solid: #D2D2D2;
  --color-border-light: rgba(255, 255, 255, 0.2);
  --color-border-solid-light: #545557;
  --color-text: #1C1D20;
  --color-text-light: #FFFFFF;
  --alert-error: #ff4444;
  --alert-success: #24C958;

  --animation-primary: all .5s cubic-bezier(.7, 0, .3, 1);
  --animation-fast: all .3s cubic-bezier(.7, 0, .3, 1);
  --animation-smooth: all .7s cubic-bezier(.7, 0, .3, 1);
  --animation-slow: all .9s cubic-bezier(.7, 0, .3, 1);

  --section-padding: clamp(5em, 21vh, 12em);
  --container-padding: clamp(2.5em, 8vw, 8em);
  --gap-padding: clamp(1.5em, 4vw, 2.5em);

  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: initial; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

html, body {
  width: 100%;
  background: var(--color-dark);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: clamp(16px, 1.2vw, 19px);
  font-weight: 450;
  line-height: 1.6;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

::selection { background: var(--color-blue); color: #FFF; }

img { max-width: 100%; display: block; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }

h1, h2, h3, h4, h5, p, a { font-weight: 450; letter-spacing: normal; }
strong { font-weight: 700; }

h1 { font-size: calc(clamp(3.25em, 7vw, 8em) * .875); line-height: 1.065; }
h2 { font-size: calc(clamp(3.25em, 5vw, 4.5em) * .75); line-height: 1.065; }
h3 { font-size: clamp(2.66em, 4.65vw, 5.32em); line-height: 1.065; }
h4 { font-size: clamp(1.55em, 2.3vw, 2.5em); line-height: 1.45; }
h5 {
  font-size: .6em; line-height: 1.065;
  /* .65 (not the reference's .5): #1C1D20 at 50% on white is 3.28:1 — below
     WCAG 4.5:1 for this small uppercase label. .65 passes on both themes. */
  text-transform: uppercase; letter-spacing: .05em; opacity: .65;
}
p { font-size: 1em; line-height: 1.66; }
p.small { font-size: .8em; line-height: 1.75; letter-spacing: .015em; }
p.big { font-size: 1.2em; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 3px;
  border-radius: 2px;
}
.theme-dark :focus-visible { outline-color: #8B9AF5; }

main {
  position: relative;
}
/* overscroll dark strip below the footer (spec-design 6 z-map) */
main::after {
  content: ""; display: block; height: 5vh; background: var(--color-dark-dark);
  position: relative; z-index: -1; margin-top: -5vh;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout primitives ---------- */
.section { padding-top: var(--section-padding); padding-bottom: var(--section-padding); }

.container {
  max-width: 100em;
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}
.container.medium { padding-left: calc(var(--container-padding) * 2); padding-right: calc(var(--container-padding) * 2); }
.container.small { padding-left: calc(var(--container-padding) * 3); padding-right: calc(var(--container-padding) * 3); }

.row { display: flex; flex-wrap: wrap; }
.flex-col { width: 100%; order: 2; }

.stripe, .line { height: 1px; width: 100%; background: var(--color-border); }
.theme-dark .stripe, .theme-dark .line { background: var(--color-border-light); }

/* ============================================================
   Preloader
   ============================================================ */
.loading-container {
  position: fixed; inset: 0;
  z-index: 800;
  pointer-events: all;
}
html:not(.js) .loading-container { display: none; }

.loading-screen {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--color-dark-dark);
}

.loading-words {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}
.loading-words h2 {
  position: relative;
  display: none;
  color: #FFF;
  padding-left: .6em;
  white-space: nowrap;
}
.loading-words h2.is-active { display: block; }
.loading-words h2.nonlatin { font-size: calc(clamp(3.25em, 5vw, 4.5em) * .65); }
.loading-words .dot {
  position: absolute; left: 0; top: 47%;
  width: calc(clamp(16px, 1.2vw, 19px) / 1.65);
  height: calc(clamp(16px, 1.2vw, 19px) / 1.65);
  border-radius: 50%;
  background: #FFF;
  transform: translateY(-50%);
}

/* The curve primitive (shared) */
.rounded-div-wrap {
  width: 100%;
  position: relative;
  height: 10vh;
  overflow: hidden;
  will-change: height;
}
.rounded-div {
  width: 150%; height: 750%;
  position: absolute; left: 50%;
  border-radius: 50%;
  background: var(--color-white);
  transform: translate(-50%, -86.666%);
  z-index: 1;
}

.loading-screen .rounded-div-wrap.bottom {
  position: absolute; bottom: 0; left: 0;
  transform: translateY(99%);
  height: 10vh;
  z-index: 2;
}
.loading-screen .rounded-div-wrap.bottom .rounded-div {
  height: 745%;
  background: var(--color-dark-dark);
}

/* ============================================================
   Nav bar
   ============================================================ */
.nav-bar {
  position: absolute; top: 0; left: 0;
  width: 100%;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--gap-padding) / 2);
  background: transparent;
  color: var(--color-text-light);
}

/* "© Code by Steve" hover anatomy */
.btn-left-top {
  display: inline-flex;
  align-items: center;
  padding: 0 calc(var(--gap-padding) / 2);
  height: 2.75em;
  white-space: nowrap;
}
.btn-left-top .btn-text { display: inline-flex; align-items: center; pointer-events: none; }
.btn-left-top .cb-symbol {
  display: inline-block;
  margin-right: .4em;
  transition: var(--animation-primary);
}
.btn-left-top:hover .cb-symbol { transform: rotate(360deg); }
.btn-left-top .cb-mask {
  display: inline-block;
  overflow: hidden;
  position: relative;
}
.btn-left-top .cb-inner {
  position: relative;
  display: inline-flex;
  white-space: pre;
  transition: var(--animation-primary);
}
.btn-left-top .last-name {
  position: absolute;
  left: 100%; top: 0;
  white-space: pre;
}
.btn-left-top:hover .cb-inner { transform: translateX(calc(var(--cb-shift, 0px) * -1)) rotate(0.001deg); }

.links-wrap { display: flex; }

.btn-menu { display: none; }

.btn-link { position: relative; }
.btn-link .btn-click {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 2.75em;
  padding: 0 calc(var(--gap-padding) / 2);
}
.btn-link .btn-click::after {
  content: "";
  position: absolute;
  bottom: -.5em; left: 50%;
  width: calc(clamp(16px, 1.2vw, 19px) / 2.75);
  height: calc(clamp(16px, 1.2vw, 19px) / 2.75);
  border-radius: 50%;
  background: var(--color-white);
  transform: translate(-50%, -50%) scale(0) rotate(0.001deg);
  transition: var(--animation-fast);
}
.btn-link.active .btn-click::after,
.btn-link .btn-click:hover::after { transform: translate(-50%, -50%) scale(1) rotate(0.001deg); }
.links-wrap:hover .btn-link .btn-click::after { transform: translate(-50%, -50%) scale(0); }
.links-wrap:hover .btn-link .btn-click:hover::after { transform: translate(-50%, -50%) scale(1); }

/* ============================================================
   Hero
   ============================================================ */
.home-header {
  position: relative;
  min-height: 115vh;
  display: flex;
  align-items: center;
  background: var(--color-gray);
  overflow: hidden;
  color: var(--color-text-light);
}

.personal-image {
  position: absolute;
  top: -10%; left: 0;
  width: 100%; height: 120%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  will-change: transform;
}
.personal-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 42% 22%;
}

.hero-container {
  position: relative;
  z-index: 2;
  width: 100%;
  padding-bottom: 15vh;
}
.hero-row { justify-content: flex-end; }

.header-role { position: relative; width: auto; }
.header-role h4 { line-height: 1.4; }
.header-role h4 span { display: block; }
.header-above-h4 {
  position: absolute;
  top: -12.5vh; left: 0;
}
.arrow {
  width: clamp(1.1em, 1.3vw, 1.25em);
  will-change: transform;
}
.arrow svg { display: block; width: 100%; height: auto; }

/* Marquee */
.big-name {
  position: absolute;
  bottom: 15vh; left: 0;
  width: 100%;
  z-index: 1;
  padding-bottom: calc(var(--gap-padding) * 1.25);
  pointer-events: none;
}
.name-roll { position: relative; white-space: nowrap; }
.name-wrap { display: inline-block; will-change: transform; }
.name-h1 {
  font-size: max(9em, 15vw);
  line-height: 1;
  color: #FFF;
  white-space: nowrap;
}
.spacer { padding: 0 3vw; }

/* Location pill + globe */
.hanger {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  z-index: 3;
}
.hanger-tab {
  position: relative;
  display: flex;
  align-items: center;
  height: 6em;
  background: var(--color-dark);
  border-radius: 0 3em 3em 0;
  padding-left: var(--gap-padding);
  padding-right: 6em;
  will-change: transform;
}
.hanger-text { line-height: 1.2; color: #FFF; }
.hanger-text span { display: block; }

.digital-ball {
  position: absolute;
  right: .9em; top: .9em;
  width: 4.2em; height: 4.2em;
  border-radius: 50%;
  background: var(--color-blue);
  overflow: hidden;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ball-overlay {
  position: absolute; inset: 0;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}
.digital-ball:hover .ball-overlay {
  opacity: .45;
  animation: digitalball 6s ease-in-out infinite;
}
@keyframes digitalball {
  0%, 100% { background: var(--color-blue); }
  50% { background: var(--alert-error); }
}

.globe {
  position: relative;
  width: 2.5em; height: 2.5em;
  will-change: transform;
}
.globe-wrap {
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 .125em #FFF;
  overflow: hidden;
  animation: globe-swing 5.4s cubic-bezier(0.35, 0, 0.65, 1) infinite;
}
@keyframes globe-swing {
  0% { transform: rotate(15deg); }
  50% { transform: rotate(-15deg); }
  100% { transform: rotate(15deg); }
}
.globe .circle {
  position: absolute;
  top: 0; left: 50%;
  height: 100%;
  border-radius: 50%;
  transform: translateX(-50%) rotate(0.001deg);
  animation: globe-meridian 2.7s linear infinite;
}
.globe .c1 { animation-delay: -1.8s; }
.globe .c2 { animation-delay: -.9s; }
.globe .c3 { animation-delay: 0s; }
@keyframes globe-meridian {
  0%     { width: 100%; box-shadow: inset .175em 0 0 0 #FFF; }
  49.99% { width: 4%;   box-shadow: inset .175em 0 0 0 #FFF; }
  50%    { width: 4%;   box-shadow: inset -.175em 0 0 0 #FFF; }
  100%   { width: 100%; box-shadow: inset -.175em 0 0 0 #FFF; }
}
.globe .circle-hor {
  position: absolute;
  top: 50%; left: 50%;
  width: 150%; height: 55%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 0 .125em #FFF;
}
.globe .circle-hor-middle {
  position: absolute;
  top: 50%; left: -25%;
  width: 150%; height: .15em;
  background: #FFF;
  transform: translateY(-50%);
}

/* ============================================================
   Buttons — shared anatomy
   ============================================================ */
.btn { position: relative; z-index: 5; }
.btn:hover { z-index: 15; }

.btn-click {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 4.25em;
  border-radius: 2.125em;
  overflow: hidden;
  transform: translateZ(0) rotate(0.001deg);
  will-change: transform;
}
.btn-normal .btn-click {
  box-shadow: inset 0 0 0 1px var(--color-border);
  min-width: 10em;
  color: var(--color-text);
}
.theme-dark .btn-normal .btn-click {
  box-shadow: inset 0 0 0 1px var(--color-border-light);
  color: var(--color-text-light);
}

.btn-fill {
  position: absolute;
  width: 150%; height: 200%;
  border-radius: 50%;
  top: -50%; left: -25%;
  transform: translate3d(0, -76%, 0);
  background: var(--color-dark);
  transition: background-color .25s ease-in-out;
  pointer-events: none;
  will-change: transform;
}
.theme-dark .btn-normal .btn-fill { background: var(--color-dark-dark); }

.btn-text {
  position: relative;
  z-index: 2;
  padding: 0 2.5em;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.btn-text-inner { position: relative; display: inline-block; }

.count-nr {
  display: inline-block;
  font-size: .7em;
  opacity: .6;
  position: absolute;
  transform: translate(20%, -15%);
  margin-left: .25em;
}

/* Round (circle) buttons */
.btn-round .btn-click {
  width: clamp(9em, 12vw, 11em);
  height: clamp(9em, 12vw, 11em);
  border-radius: 50%;
  background: var(--color-dark);
  color: var(--color-text-light);
  box-shadow: none;
}
.btn-round .btn-fill { background: var(--color-blue); }
.btn-round .btn-text { padding: 0 1em; text-align: center; }

/* ============================================================
   Statement section
   ============================================================ */
.home-intro {
  position: relative;
  background: var(--color-white);
  padding-bottom: calc(var(--section-padding) * .66);
}
.home-intro .container { position: relative; }
.intro-col-left { width: 70%; padding-right: var(--gap-padding); }
.intro-col-right { position: relative; width: 30%; padding-left: var(--gap-padding); }
.intro-col-right p {
  max-width: 14em;
  margin-bottom: 6em;
  padding-top: .5em;
}
.intro-circle {
  position: absolute;
  top: 80%;
  left: 0;
  z-index: 20;
}

/* Word-reveal masks */
.span-line { display: inline-block; overflow: hidden; vertical-align: bottom; }
.span-line-inner { display: inline-block; will-change: transform; }

/* ============================================================
   Work section
   ============================================================ */
.work-section { background: var(--color-white); padding-bottom: var(--section-padding); }
.grid-sub-title { padding-bottom: var(--gap-padding); }

.work-grid { width: 100%; }
.work-items { position: relative; }
.work-items .work-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  padding: calc(var(--section-padding) / 3.5) 0 calc(var(--section-padding) / 3) 0;
  transition: var(--animation-fast);
}
.work-items .title-col {
  width: 70%;
  order: 1;
  padding-left: calc(var(--container-padding) * 1);
}
.work-items .cat-col {
  width: 30%;
  order: 2;
  padding-left: var(--gap-padding);
  padding-right: calc(var(--container-padding) * .5);
  padding-top: 1em;
}
.work-items h4 {
  font-size: calc(clamp(3.25em, 7vw, 8em) * .75);
  line-height: 1;
  transition: var(--animation-fast);
}
.work-items p { transition: var(--animation-fast); }
.work-items .work-row:hover { opacity: .33; }
.work-items .work-row:hover h4 { transform: translateX(calc(var(--container-padding) * -.1)) rotate(0.001deg); }
.work-items .work-row:hover p { transform: translateX(calc(var(--container-padding) * .1)) rotate(0.001deg); }

.work-grid .stripe.last { display: block; }

.center-grid-btn {
  display: flex;
  justify-content: center;
  padding-top: calc(var(--section-padding) / 2);
}

/* Floating preview + custom cursor */
.mouse-pos-list-image {
  position: fixed;
  top: 0; left: 0;
  z-index: 25;
  width: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translate(-50%, -52%) rotate(0.001deg);
  transition: width .4s cubic-bezier(0.36, 0, 0.66, 0);
  border-radius: 4px;
}
.mouse-pos-list-image.active {
  width: clamp(10em, 27.5vw, 25em);
  transition: width .4s cubic-bezier(0.34, 1, 0.64, 1);
}
.mpli-inner {
  position: relative;
  width: 100%;
  padding-top: 100%;
  overflow: hidden;
}
.float-image-wrap {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 500%;
  will-change: transform;
}
.float-tile {
  position: relative;
  width: 100%; height: 20%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1em;
  padding: 2em;
  text-align: center;
  overflow: hidden;
}
.float-tile::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(80% 60% at 50% 0%, rgba(255,255,255,.08), transparent 70%);
  pointer-events: none;
}
.tile-mark {
  position: relative;
  z-index: 1;
  color: #FFF;
  font-size: clamp(1.6em, 2.4vw, 2.4em);
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1;
}
.tile-cap {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, .7);
  font-size: .78em;
  line-height: 1.5;
  max-width: 18em;
}

.tile--openyak  { background: linear-gradient(155deg, #0F1B2D 0%, #16324F 60%, #1C4266 100%); }
.tile--doxmind  { background: linear-gradient(155deg, #0D1622 0%, #1C3350 65%, #27496E 100%); }
.tile--abliterix{ background: linear-gradient(155deg, #16090D 0%, #3A1220 70%, #55182B 100%); }
.tile--ora      { background: linear-gradient(155deg, #0E1A16 0%, #1E3D33 65%, #2A5244 100%); }
.tile--trainall { background: linear-gradient(155deg, #101318 0%, #24303F 65%, #33455A 100%); }

.mouse-pos-list-btn,
.mouse-pos-list-span {
  position: fixed;
  top: 0; left: 0;
  width: 0; height: 0;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -60%) rotate(0.001deg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: width .4s cubic-bezier(0.36, 0, 0.66, 0), height .4s cubic-bezier(0.36, 0, 0.66, 0);
}
.mouse-pos-list-btn { z-index: 26; background: var(--color-blue); }
.mouse-pos-list-span { z-index: 27; background: transparent; color: #FFF; }
.mouse-pos-list-span span { font-size: .95em; opacity: 0; transition: opacity .2s ease .1s; }
.mouse-pos-list-btn.active,
.mouse-pos-list-span.active {
  width: clamp(3.75em, 5.5vw, 5em);
  height: clamp(3.75em, 5.5vw, 5em);
  transition: width .4s cubic-bezier(0.34, 1, 0.64, 1), height .4s cubic-bezier(0.34, 1, 0.64, 1);
}
.mouse-pos-list-span.active span { opacity: 1; }
.mouse-pos-list-btn.active.pressed,
.mouse-pos-list-span.active.pressed {
  width: calc(clamp(3.75em, 5.5vw, 5em) * 1.2);
  height: calc(clamp(3.75em, 5.5vw, 5em) * 1.2);
}

/* Mobile / tablet tiles */
.work-tiles {
  display: none;
  padding: 0 var(--container-padding);
  gap: var(--gap-padding);
  grid-template-columns: 1fr 1fr;
}
.work-tile { display: block; }
.work-tile .tile-visual {
  position: relative;
  width: 100%;
  padding-top: 100%;
  border-radius: 4px;
  overflow: hidden;
  display: block;
}
.work-tile .tile-visual .tile-mark,
.work-tile .tile-visual .tile-cap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 3em);
}
.work-tile .tile-visual .tile-mark { top: 42%; transform: translate(-50%, -50%); text-align: center; }
.work-tile .tile-visual .tile-cap { top: 58%; text-align: center; }
.work-tile .tile-visual::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(80% 60% at 50% 0%, rgba(255,255,255,.08), transparent 70%);
}
.tile-meta { padding-top: 1.25em; }
.tile-meta h4 { font-size: 1.55em; line-height: 1.2; padding-bottom: .5em; }
.tile-meta p { font-size: .85em; opacity: .65; padding-top: .75em; }

/* ============================================================
   Curved divider into footer
   ============================================================ */
.footer-rounded-div {
  height: 0;
  position: relative;
  z-index: 2;
}
.footer-rounded-div .rounded-div-wrap { transform: translateY(-1px); }
.footer-rounded-div .rounded-div { background: var(--color-white); }

/* ============================================================
   Footer
   ============================================================ */
.footer-wrap {
  position: relative;
  background: var(--color-dark-dark);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  box-shadow: 0 5px 0 5px var(--color-dark);
  color: var(--color-text-light);
}
.footer {
  position: relative;
  width: 100%;
  background: var(--color-dark);
  padding-top: calc(var(--section-padding) * .75);
  will-change: transform;
}
.footer::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: calc(var(--section-padding) * .75);
  background: linear-gradient(to bottom, rgba(28, 29, 32, 1) 0%, rgba(28, 29, 32, 0) 100%);
  opacity: .75;
  pointer-events: none;
}

.footer-row-1 {
  position: relative;
  padding-bottom: calc(var(--section-padding) / 2);
}
.footer-row-1 h2 { font-size: calc(clamp(3.25em, 7vw, 8em) * .875); line-height: 1.065; }
.footer-row-1 .h2-line { display: block; }

.profile-picture {
  display: inline-block;
  width: .85em; height: .85em;
  border-radius: 50%;
  overflow: hidden;
  transform: translateY(.09em);
  margin-right: .25em;
  vertical-align: baseline;
}
.profile-picture img { width: 100%; height: 100%; object-fit: cover; }

.footer-arrow {
  position: absolute;
  right: 0;
  bottom: calc(var(--gap-padding) * 1.5);
  transform: rotate(90deg);
}

.footer-row-2 {
  position: relative;
  padding-bottom: calc(var(--section-padding) * .475);
}
.btn-fixed {
  position: absolute;
  right: 0; top: 0;
  transform: translate(-50%, -50%);
  z-index: 20;
}
.btn-fixed .btn-click { background: var(--color-blue); }
.btn-fixed .btn-fill { background: var(--color-blue-dark); }
.btn-drift { will-change: transform; }

.footer-row-3 { display: flex; flex-wrap: wrap; }
.footer-row-3 .btn { display: inline-flex; margin-right: .5em; margin-bottom: .75em; }

.bottom-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: calc(var(--section-padding) / 1.3) calc(var(--gap-padding) / 1.33) calc(var(--gap-padding) / 1.75) calc(var(--gap-padding) / 1);
}
.footer-meta-left { display: flex; }
.credits { padding-right: var(--gap-padding); }
.credits h5, .time h5 { margin-bottom: 1.5em; }
.credits p, .time p, .socials li { font-size: .85em; }
.time p { text-transform: uppercase; font-variant-numeric: tabular-nums; }

.socials h5 { padding-left: calc(var(--gap-padding) * .5); margin-bottom: 1em; }
.socials ul { display: flex; }
.socials li a {
  position: relative;
  display: inline-block;
  padding: .25em calc(var(--gap-padding) * .5);
}
.socials li a::after,
.drawer-socials a::after {
  content: "";
  position: absolute;
  bottom: -.1em; left: 50%;
  width: calc(clamp(16px, 1.2vw, 19px) / 2.75);
  height: calc(clamp(16px, 1.2vw, 19px) / 2.75);
  border-radius: 50%;
  background: var(--color-white);
  transform: translate(-50%, -50%) scale(0) rotate(0.001deg);
  transition: var(--animation-fast);
}
.socials li a:hover::after,
.drawer-socials a:hover::after { transform: translate(-50%, -50%) scale(1) rotate(0.001deg); }

/* ============================================================
   Hamburger + drawer
   ============================================================ */
.btn-hamburger {
  position: fixed;
  top: calc(var(--gap-padding) / 1.5);
  right: calc(var(--gap-padding) / 1.5);
  z-index: 105;
  width: clamp(4em, 5.5vw, 5em);
  height: clamp(4em, 5.5vw, 5em);
  pointer-events: none;
  /* visibility (delayed to let the scale-out play) removes the hidden button
     from the tab order; pointer-events alone leaves it keyboard-focusable */
  visibility: hidden;
  transition: visibility 0s .4s;
}
.btn-hamburger .btn-click {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--color-dark);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 10px 30px rgba(0, 0, 0, .3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0) rotate(0.001deg);
  transition: transform .4s cubic-bezier(0.34, 1.5, 0.64, 1), background-color .3s ease;
  will-change: transform;
}
body.scrolled .btn-hamburger,
body.nav-open .btn-hamburger { pointer-events: auto; visibility: visible; transition-delay: 0s; }
body.scrolled .btn-hamburger .btn-click,
body.nav-open .btn-hamburger .btn-click { transform: scale(1) rotate(0.001deg); }
.btn-hamburger.active .btn-click { background: var(--color-blue); }
.btn-hamburger .btn-fill { background: var(--color-blue); }

.btn-bars {
  position: relative;
  width: 28%; height: 8%;
  padding: 0;
  z-index: 2;
}
.btn-bars::before, .btn-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%; height: 1.5px;
  background: #FFF;
  transition: var(--animation-primary);
}
.btn-bars::before { top: 0; }
.btn-bars::after { top: 100%; }
.btn-hamburger.active .btn-bars::before { top: 50%; transform: rotate(45deg); }
.btn-hamburger.active .btn-bars::after { top: 50%; transform: rotate(-45deg); }

.fixed-nav {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  width: clamp(22em, 34vw, 30em);
  background: var(--color-dark);
  z-index: 100;
  transform: translateX(calc(100% + 6vw)) rotate(0.001deg);
  transition: transform .8s cubic-bezier(.7, 0, .2, 1);
  visibility: hidden;
  color: var(--color-text-light);
}
.fixed-nav { transition: transform .8s cubic-bezier(.7, 0, .2, 1), visibility 0s linear .8s; }
body.nav-open .fixed-nav {
  transform: translateX(0) rotate(0.001deg);
  visibility: visible;
  transition: transform .8s cubic-bezier(.7, 0, .2, 1), visibility 0s;
}

.fixed-nav-rounded-div {
  position: absolute;
  left: 1px; top: 0;
  height: 100%;
  transform: translateX(-100%);
  pointer-events: none;
}
.fixed-nav-rounded-div .rounded-div-wrap {
  width: 6vw; height: 100%;
  transition: width .85s cubic-bezier(.7, 0, .2, 1);
  will-change: width;
}
body.nav-open .fixed-nav-rounded-div .rounded-div-wrap { width: 0vw; }
.fixed-nav-rounded-div .rounded-div {
  width: 775%; height: 150%;
  top: 50%; left: 0;
  background: var(--color-dark);
  transform: translate(-6.5%, -50%);
}

.fixed-nav-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15vh 7.5vw 10vh 7.5vw;
  overflow-y: auto;
}
.fixed-nav-top h5 { margin-bottom: 3em; }
.fixed-nav-top .stripe { margin-bottom: 1.5em; }
.fixed-nav-links li {
  transform: translateX(15vw) rotate(0.001deg);
  opacity: 0;
  transition: transform .8s cubic-bezier(.7, 0, .2, 1), opacity .6s ease;
}
body.nav-open .fixed-nav-links li { transform: translateX(0) rotate(0.001deg); opacity: 1; }
body.nav-open .fixed-nav-links li:nth-child(1) { transition-delay: .06s; }
body.nav-open .fixed-nav-links li:nth-child(2) { transition-delay: .09s; }
body.nav-open .fixed-nav-links li:nth-child(3) { transition-delay: .12s; }
body.nav-open .fixed-nav-links li:nth-child(4) { transition-delay: .15s; }

.drawer-link {
  position: relative;
  display: inline-block;
  font-size: calc(clamp(3.25em, 5vw, 4em) * .875);
  line-height: 1.4;
  color: #FFF;
}
.drawer-link::before {
  content: "";
  position: absolute;
  left: calc(var(--gap-padding) / -2.5);
  top: 50%;
  width: calc(clamp(16px, 1.2vw, 19px) / 1.65);
  height: calc(clamp(16px, 1.2vw, 19px) / 1.65);
  border-radius: 50%;
  background: #FFF;
  transform: translateY(-50%) scale(0);
  transition: var(--animation-fast);
}
.drawer-link.active::before,
.drawer-link:hover::before { transform: translateY(-50%) scale(1); }
.fixed-nav-links:hover .drawer-link.active:not(:hover)::before { transform: translateY(-50%) scale(0); }

.fixed-nav-bottom .stripe { margin-bottom: 1.5em; }
.fixed-nav-bottom h5 { margin-bottom: 1em; }
.drawer-socials { display: flex; flex-wrap: wrap; }
.drawer-socials li { margin-right: 1.75em; }
.drawer-socials a { position: relative; display: inline-block; padding: .2em 0; }

.fixed-nav-back {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: linear-gradient(to right, hsla(220, 13%, 0%, .3) 40%, hsla(220, 13%, 0%, 1) 80%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s cubic-bezier(.7, 0, .2, 1), visibility 0s linear .8s;
}
body.nav-open .fixed-nav-back { opacity: .35; visibility: visible; transition: opacity .8s cubic-bezier(.7, 0, .2, 1), visibility 0s; }

/* ============================================================
   AI chat
   ============================================================ */
.ai-fab-wrap {
  position: fixed;
  right: calc(var(--gap-padding) / 1.5);
  bottom: calc(var(--gap-padding) / 1.5);
  z-index: 300;
  transition: var(--animation-fast);
}
body.nav-open .ai-fab-wrap { opacity: 0; pointer-events: none; }
.ai-fab {
  width: clamp(3.5em, 4.5vw, 4em);
  height: clamp(3.5em, 4.5vw, 4em);
  border-radius: 50%;
  background: var(--color-dark);
  box-shadow: inset 0 0 0 1px var(--color-border-light), 0 10px 30px rgba(0, 0, 0, .25);
  color: #FFF;
  min-width: 0;
}
.ai-fab .btn-text { padding: 0; }
.ai-fab svg { width: 1.1em; height: 1.1em; display: block; }
.ai-fab .btn-fill { background: var(--color-blue); }

.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  pointer-events: none;
}
.chat-overlay.open { pointer-events: auto; }
.chat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 21, 23, .45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .5s cubic-bezier(.7, 0, .3, 1);
}
.chat-overlay.open .chat-backdrop { opacity: 1; }

.chat-panel {
  position: absolute;
  right: clamp(1em, 2.5vw, 2em);
  bottom: clamp(1em, 2.5vw, 2em);
  width: min(27em, calc(100vw - 2em));
  height: min(34em, calc(100vh - 4em));
  height: min(34em, calc(var(--vh, 1vh) * 100 - 4em));
  display: flex;
  flex-direction: column;
  background: var(--color-dark);
  color: var(--color-text-light);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px var(--color-border-light), 0 30px 80px rgba(0, 0, 0, .45);
  overflow: hidden;
  opacity: 0;
  transform: translateY(1.5em) scale(.98) rotate(0.001deg);
  transition: transform .5s cubic-bezier(.7, 0, .3, 1), opacity .5s cubic-bezier(.7, 0, .3, 1);
}
.chat-overlay.open .chat-panel { opacity: 1; transform: translateY(0) scale(1) rotate(0.001deg); }

.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1em;
  padding: 1.5em 1.5em 1.15em;
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}
.chat-head h3 { font-size: 1.15em; line-height: 1.2; font-weight: 500; }
.chat-sub { font-size: .72em; line-height: 1.5; opacity: .5; margin-top: .5em; }
.chat-close {
  flex-shrink: 0;
  width: 2.4em; height: 2.4em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--color-border-light);
  transition: var(--animation-fast);
}
.chat-close:hover { background: var(--color-dark-dark); }
.chat-close svg { width: .7em; height: .7em; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1.25em 1.5em;
  display: flex;
  flex-direction: column;
  gap: 1em;
  font-family: var(--font-mono);
  font-size: .78em;
  line-height: 1.65;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-solid-light) transparent;
  overscroll-behavior: contain;
}
.chat-msg { max-width: 92%; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg strong { color: #FFF; font-weight: 600; }
.chat-msg code { background: rgba(255,255,255,.08); border-radius: 4px; padding: .1em .35em; font-size: .95em; }
.chat-msg .chat-code { display: block; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: .8em 1em; margin: .6em 0; overflow-x: auto; white-space: pre; font-size: .92em; }
.chat-msg.assistant { align-self: flex-start; color: rgba(255, 255, 255, .85); }
.chat-msg.assistant.is-error { color: rgba(255, 255, 255, .6); }
.chat-msg.user {
  align-self: flex-end;
  background: #2A2B30;
  color: #FFF;
  padding: .6em 1em;
  border-radius: 1em 1em .25em 1em;
}

.chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: .4em;
  padding: .4em 0;
}
.chat-typing span {
  width: .38em; height: .38em;
  border-radius: 50%;
  background: rgba(255, 255, 255, .6);
  animation: chat-dot 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .18s; }
.chat-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes chat-dot {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-.25em); }
}

.chat-form {
  display: flex;
  align-items: center;
  gap: .6em;
  padding: 1em 1.25em 1.25em;
  border-top: 1px solid var(--color-border-light);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  min-width: 0;
  background: var(--color-dark-dark);
  border: 1px solid transparent;
  border-radius: 1.4em;
  color: #FFF;
  font-family: var(--font-mono);
  /* never below 16px: iOS Safari auto-zooms the page when focusing a smaller
     input, and this one sits in a fixed overlay */
  font-size: max(16px, .8em);
  padding: .85em 1.25em;
  transition: border-color .3s ease;
}
.chat-input::placeholder { color: rgba(255, 255, 255, .55); }
.chat-input:focus { border-color: var(--color-blue); outline: none; }
.chat-input:disabled { opacity: .5; }

.chat-reset {
  font-size: .72em;
  text-transform: uppercase;
  letter-spacing: .05em;
  opacity: .5;
  padding: .5em .25em;
  transition: opacity .3s ease;
}
.chat-reset:hover { opacity: 1; }

.chat-send {
  flex-shrink: 0;
  width: 2.75em; height: 2.75em;
  border-radius: 50%;
  background: var(--color-blue);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--animation-fast);
}
.chat-send:hover { background: var(--color-blue-dark); }
.chat-send:disabled { opacity: .5; cursor: default; }
.chat-send svg { width: .85em; height: .85em; }

/* ============================================================
   Utility / state
   ============================================================ */
.fade-in { will-change: transform, opacity; }
html.wait, html.wait * { cursor: wait !important; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  :root { --container-padding: 6vw; }
}

@media (max-width: 1024px) {
  .large-work-grid { display: none; }
  .work-tiles { display: grid; }
  .mouse-pos-list-image, .mouse-pos-list-btn, .mouse-pos-list-span { display: none; }
}

@media (max-width: 1000px) {
  .digital-ball { transform: translate(-20%, -50%); top: 50%; }
}

@media (max-width: 900px) {
  .footer-row-2 { padding-bottom: calc(var(--section-padding) * .75); }
}

@media (max-width: 720px) {
  :root { --section-padding: 12vh; }

  .home-header {
    min-height: 110vh;
    max-height: 110vh;
    min-height: calc(var(--vh, 1vh) * 110);
    max-height: calc(var(--vh, 1vh) * 110);
    align-items: flex-end;
  }
  .hero-container { padding-bottom: 9vh; }
  .hero-row { justify-content: flex-start; }
  .big-name { bottom: 33vh; }
  .header-above-h4 { top: -9vh; }
  .personal-image img { object-position: 30% 12%; }

  .hanger {
    left: 0; right: auto;
    top: 100vh;
    top: calc(var(--vh, 1vh) * 100);
    transform: translate(20%, -330%);
  }
  .hanger-tab {
    background: transparent;
    padding: 0;
    height: auto;
    border-radius: 0;
  }
  .hanger-text { display: none; }
  .digital-ball { position: static; transform: none; }
  .digital-ball .globe { width: 3em; height: 3em; }

  .intro-col-left { width: 100%; padding-right: 0; }
  .intro-col-right { width: 100%; padding-left: 0; padding-top: 2em; padding-bottom: 10.5em; position: relative; }
  .intro-col-right p { margin-bottom: 0; }
  .intro-circle {
    top: auto;
    left: auto;
    bottom: 0;
    right: 0;
    transform: translate(-12%, 35%);
  }
  .home-intro { padding-bottom: calc(var(--section-padding) * .9); }

  .footer-rounded-div .rounded-div-wrap { height: 7.5vh; }
  .footer-row-3 .btn { width: 100%; margin-right: 0; }
  .footer-row-3 .btn .btn-click { width: 100%; }
  .btn-fixed { transform: translate(-20%, -30%); }
  .bottom-footer { flex-direction: column-reverse; align-items: flex-start; }
  .socials { padding-bottom: 2.5em; }
  .socials h5 { padding-left: 0; }
  .socials ul { flex-wrap: wrap; }
  .socials li a { padding-left: 0; padding-right: calc(var(--gap-padding) * .75); }
  .credits p, .time p, .socials li { font-size: 1em; }
}

@media (max-width: 620px) {
  .work-tiles { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  :root {
    --container-padding: clamp(1.25em, 4vw, 2.5em);
    --section-padding: max(2.5em, 12vh);
    --color-border: rgba(28, 29, 32, 0.225);
    --color-border-light: rgba(255, 255, 255, 0.225);
  }

  /* container.medium/.small collapse to plain container padding (spec-design 3) */
  .container.medium, .container.small {
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
  }

  /* nav links hidden; only the "Menu" item shows (spec-design 4.1) */
  .links-wrap .btn-link:not(.btn-menu) { display: none; }
  .btn-menu { display: inline-flex; color: #FFF; }
  .btn-hamburger { pointer-events: auto; visibility: visible; }
  .btn-hamburger .btn-click { transform: scale(1) rotate(0.001deg); }
  .btn-left-top:hover .cb-inner { transform: none; }
  .btn-left-top:hover .cb-symbol { transform: none; }

  .fixed-nav { width: 100%; transform: translateX(calc(100% + 20vw)) rotate(0.001deg); }
  .fixed-nav-rounded-div .rounded-div-wrap { width: 20vw; }
  .fixed-nav-back { background: hsla(220, 13%, 5%, 1); }
  .nav-open .fixed-nav-back { opacity: .5; }
  .nav-open .fixed-nav-links li:nth-child(1) { transition-delay: .1s; }
  .nav-open .fixed-nav-links li:nth-child(2) { transition-delay: .13s; }
  .nav-open .fixed-nav-links li:nth-child(3) { transition-delay: .16s; }
  .nav-open .fixed-nav-links li:nth-child(4) { transition-delay: .19s; }

  .chat-panel {
    right: .75em;
    left: .75em;
    bottom: .75em;
    width: auto;
    height: min(80vh, calc(var(--vh, 1vh) * 100 - 1.5em));
  }
  .ai-fab-wrap { right: 1em; bottom: 1em; }

  /* Copy-email pill: the 31-char address needs the padding budget on narrow
     phones; the ellipsis guard makes any residual truncation visible. */
  .footer-row-3 .btn-text { padding: 0 1em; }
  .footer-row-3 .btn-text-inner { font-size: .85em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-height: 680px) {
  .drawer-link { font-size: 3em; line-height: 1.25; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .globe-wrap, .globe .circle, .ball-overlay { animation: none !important; }
  .loading-container { display: none !important; }
}
