:root {
  --bg: #F7F5F1;
  --ink: #111110;
  --muted: #6B6A66;
  --soft: #9A9892;      /* large serif "unread" grey, passes 3:1 for display sizes */
  --ghost: #ECE9E3;     /* oversized background word */
  --accent: #15803D;
  --line: #E3E0D9;
  --tint: #EFECE6;

  --sans: "Be Vietnam Pro", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --hand: "Caveat", "Comic Sans MS", cursive;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1280px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Shape rule: buttons 4px, chat bubbles and chips full pill, tool thumbnails and portrait 16px (inner image 10px). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }
.serif em { font-style: italic; font-weight: 500; }
.grey { color: var(--soft); }
.muted { color: var(--muted); }
.hand { font-family: var(--hand); font-weight: 500; font-size: 20px; line-height: 1.1; color: var(--muted); }
section[id] { scroll-margin-top: 64px; }

/* Hand-drawn strokes: every line uses pathLength=1 so it can draw itself in */
.stroke { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.js .draw .stroke { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.6s cubic-bezier(.65,0,.35,1); }
.js .draw.in .stroke { stroke-dashoffset: 0; }
.end-dot { fill: var(--ink); }
.js .draw .end-dot { opacity: 0; transition: opacity .4s 2.3s; }
.js .draw.in .end-dot { opacity: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: 4px;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--ink);
  transition: background .25s, color .25s, border-color .25s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-ink:hover { background: var(--accent); border-color: var(--accent); }
.btn-line { background: transparent; }
.btn-line:hover { border-color: var(--accent); color: var(--accent); }
.btn .arr { transition: transform .3s var(--ease); }
.btn:hover .arr { transform: translate(2px, -2px); }

/* Chat bubble */
.bubble {
  display: inline-block; padding: 8px 15px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 500; line-height: 1.3;
  transform-origin: 0 100%;
}
.js .bubble.pop { opacity: 0; transform: scale(.6) translateY(8px); transition: opacity .3s, transform .5s var(--spring); transition-delay: var(--delay, 0s); }
.js .in .bubble.pop, .js .bubble.pop.in { opacity: 1; transform: none; }

/* Scroll reveal */
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--d, 0) * 90ms); }
.js [data-reveal].in { opacity: 1; transform: none; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--bg); }
.site-header .wrap { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logo { font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.head-right { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.avail { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); position: relative; flex: none; }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--accent); animation: ping 2.4s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.nav { display: flex; gap: 22px; }
.nav a { transition: color .2s; }
.nav a:hover { color: var(--accent); }

/* Language switch */
.lang { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer; font: 500 12px var(--sans); color: var(--muted); }
.lang span { padding: 3px 8px; border-radius: 999px; transition: background .2s, color .2s; }
.lang:hover { border-color: var(--ink); }
html:not([lang="vi"]) .lang [data-l="en"], html[lang="vi"] .lang [data-l="vi"] { background: var(--ink); color: var(--bg); }

/* Caveat has no Vietnamese diacritics; Patrick Hand does */
html[lang="vi"] { --hand: "Patrick Hand", "Caveat", cursive; }
html[lang="vi"] .hand { font-size: 19px; }
html[lang="vi"] .ghost-word { font-size: clamp(56px, 16vw, 236px); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: calc(100dvh - 64px); display: grid; grid-template-rows: 1fr auto; padding-bottom: clamp(28px, 4vw, 48px); }
.hero-art { position: relative; display: grid; place-items: center; padding-top: 8px; }
.scribble { width: min(44vh, 400px, 78vw); aspect-ratio: 1; overflow: visible; }
.scribble .stroke { stroke-width: 1.5; }
.js .scribble .stroke { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 3.6s cubic-bezier(.45,0,.25,1) .2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.hero-note { position: absolute; top: 6%; left: calc(50% + min(18vh, 170px)); width: 190px; }
.hero-note svg { width: 46px; height: 26px; margin-bottom: 4px; }
.js .hero-note { opacity: 0; animation: fade .8s var(--ease) 2.2s forwards; }

.hero-foot { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.hero h1 { font-size: clamp(42px, 6.4vw, 92px); line-height: 1; padding-bottom: .06em; }
/* name + role live inside the h1 for search, styled as a small eyebrow */
.hero h1 .kicker { display: block; margin-bottom: 18px; font: 500 14px/1.4 var(--sans); letter-spacing: 0; color: var(--muted); }
.hero-side { display: grid; justify-items: end; gap: 14px; padding-bottom: 6px; }
.hero-side { max-width: 330px; }
html[lang="vi"] .hero h1 { font-size: clamp(40px, 5.6vw, 80px); }
.hero-side p { font-size: 14px; color: var(--muted); text-align: right; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.js .hero h1, .js .hero-side { opacity: 0; animation: fade 1s var(--ease) forwards; }
.js .hero-side { animation-delay: .25s; }
@keyframes fade { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- Tools constellation ---------- */
.trades { position: relative; height: clamp(640px, 64vw, 820px); margin-top: clamp(40px, 6vw, 96px); }
.trades-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trades-copy { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center; width: min(560px, 90%); z-index: 2; }
.trades-copy .small { font-size: 14px; color: var(--muted); }
.trades-copy h2 { font-size: clamp(40px, 5vw, 72px); line-height: 1.02; margin: 10px 0 12px; }
.trades-bubble { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 3; }
.float {
  position: absolute; z-index: 1; width: clamp(150px, 17vw, 236px);
  left: var(--x); top: var(--y); transform: rotate(var(--r));
  transition: transform .6s var(--spring);
}
.float:hover { transform: rotate(0deg) translateY(-6px) scale(1.04); z-index: 4; }
.float figure { margin: 0; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 6px 6px 0; }
.float img { border-radius: 10px; aspect-ratio: 1440 / 1000; object-fit: cover; object-position: top; width: 100%; }
.float figcaption { font-family: var(--hand); font-size: 19px; padding: 4px 4px 6px; text-align: center; }
.js .float { opacity: 0; transition: opacity .7s var(--ease), transform .6s var(--spring); transition-delay: calc(var(--d) * 140ms + .3s), 0s; }
.js .trades.in .float { opacity: 1; }

/* ---------- Big sentence ---------- */
.say-wrap { padding: clamp(96px, 12vw, 180px) 0; }
.say { font-size: clamp(32px, 4.4vw, 64px); line-height: 1.12; max-width: 20ch; }
.say-note { margin: 28px 0 0 auto; max-width: 32ch; font-size: 16px; color: var(--muted); text-align: right; }
@keyframes ink { from { color: var(--soft); } to { color: var(--ink); } }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .js .say { view-timeline-name: --say; }
    .js .say .w { animation: ink linear both; animation-timeline: --say; animation-range: cover calc(18% + var(--i) * 1.7%) cover calc(23% + var(--i) * 1.7%); }
  }
}

/* ---------- Process timeline ---------- */
.process { padding-bottom: clamp(80px, 10vw, 140px); }
.process-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.process-head h2 { font-size: clamp(36px, 4.6vw, 64px); line-height: 1.02; }
.timeline { position: relative; height: 420px; margin-top: 24px; }
.timeline svg { position: absolute; left: 0; top: 50%; width: 100%; height: 240px; transform: translateY(-50%); overflow: visible; }
.pin { position: absolute; left: calc(var(--x) * 100%); top: 50%; }
.pin .pt { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.pin .stem { position: absolute; left: 0; width: 1px; height: 64px; background: var(--muted); }
.pin .lab { position: absolute; left: 0; transform: translateX(-50%); width: 200px; text-align: center; font-size: 13px; color: var(--muted); }
.pin .lab strong { display: block; color: var(--ink); font-weight: 600; font-size: 15px; }
.pin.up .stem { bottom: 6px; }
.pin.up .lab { bottom: 78px; }
.pin.down .stem { top: 6px; }
.pin.down .lab { top: 78px; }
.js .pin { opacity: 0; transition: opacity .6s var(--ease); transition-delay: calc(var(--x) * 2.2s + .2s); }
.js .timeline.in .pin { opacity: 1; }

/* ---------- Capabilities ---------- */
.half { padding: clamp(80px, 10vw, 140px) 0; border-top: 1px solid var(--line); }
.half-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 48px clamp(32px, 6vw, 96px); align-items: start; }
.half h2 { font-size: clamp(40px, 5vw, 72px); line-height: 1.02; }
.half-note { display: flex; align-items: flex-start; gap: 6px; margin-top: 24px; }
.half-note svg { width: 44px; height: 30px; flex: none; transform: scaleY(-1); }
.caps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 40px 40px; }
.caps li { border-top: 1px solid var(--ink); padding-top: 18px; }
.caps h3 { font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; margin-bottom: 8px; }
.caps p { color: var(--muted); font-size: 15px; }

/* ---------- Works ---------- */
/* clip, not hidden: keeps .work-side sticky and stops the ghost word widening the mobile viewport */
.work { position: relative; padding-bottom: clamp(80px, 10vw, 140px); overflow-x: clip; }
.ghost-word {
  font-weight: 600; font-size: clamp(64px, 22vw, 320px); line-height: .8; letter-spacing: -0.05em;
  color: var(--ghost); text-align: center; white-space: nowrap; user-select: none;
  margin-bottom: clamp(-60px, -3vw, -20px);
}
.work-grid { position: relative; display: grid; grid-template-columns: 4fr 8fr; gap: 48px clamp(32px, 5vw, 80px); align-items: start; }
.work-side { position: sticky; top: 96px; }
.work-side .small { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.work-side h2 { font-size: clamp(42px, 5vw, 72px); line-height: 1.02; }
.work-side .lead { margin-top: 18px; color: var(--muted); font-size: 15px; max-width: 30ch; }
.chips-label { margin-top: 32px; font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font: 500 13px var(--sans); padding: 7px 14px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  transition: background .2s, color .2s, border-color .2s;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.cards { display: grid; gap: clamp(56px, 6vw, 88px); }
.card { transition: opacity .35s var(--ease), transform .35s var(--ease); }
.card[hidden] { display: none; }
.card .shot { display: block; border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; }
.card .shot img { width: 100%; aspect-ratio: 1440 / 1000; object-fit: cover; object-position: top; transition: transform 1s var(--ease); }
.card:hover .shot img { transform: scale(1.025); }
.card-meta { margin-top: 16px; font-size: 12px; color: var(--muted); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 2px; }
.card-title h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3vw, 40px); letter-spacing: -0.015em; line-height: 1.15; }
.sq { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 4px; transition: background .2s, color .2s, border-color .2s; }
.card:hover .sq { background: var(--accent); border-color: var(--accent); color: #fff; }
.card p { margin-top: 8px; color: var(--muted); max-width: 56ch; }
.more { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: clamp(56px, 6vw, 80px); padding-top: 28px; border-top: 1px solid var(--line); }
.more p { font-family: var(--serif); font-size: 28px; }
.more .btn { border-radius: 999px; }

/* ---------- Contact ---------- */
.hi { position: relative; padding: clamp(80px, 10vw, 140px) 0 clamp(64px, 8vw, 100px); border-top: 1px solid var(--line); overflow: hidden; }
.hi-grid { position: relative; display: grid; grid-template-columns: 6fr 5fr; gap: 48px; align-items: center; }
.hi-note { display: flex; align-items: flex-end; gap: 4px; margin-bottom: 8px; }
.hi-note svg { width: 40px; height: 34px; }
.hi h2 { font-size: clamp(56px, 7.6vw, 112px); line-height: .98; padding-bottom: .05em; }
.hi .lines { margin-top: 16px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.hi h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 36px); line-height: 1.15; margin-top: 40px; letter-spacing: -0.01em; }
.hi h3 em { font-weight: 500; }
.hi .btn-row { margin-top: 24px; }
.hi .avail { margin-top: 20px; }
.portrait-wrap { position: relative; justify-self: end; width: min(100%, 380px); }
.portrait { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; background: var(--tint); border: 1px solid var(--line); border-radius: 16px; }
.portrait-note { position: absolute; left: -164px; bottom: 18%; width: 150px; text-align: right; transform: rotate(-4deg); }
.hi-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }

.bye { position: fixed; left: var(--gutter); bottom: 76px; z-index: 25; pointer-events: none; }

/* ---------- Footer ---------- */
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; padding-top: 20px; padding-bottom: 28px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .avail-head { display: none; }
  .half-grid, .work-grid, .hi-grid { grid-template-columns: minmax(0, 1fr); }
  .work-side { position: static; }
  .portrait-wrap { justify-self: start; }
  .portrait-note { left: auto; right: 4px; bottom: -40px; width: 170px; text-align: right; }
}

@media (max-width: 720px) {
  .head-right { gap: 16px; }
  .nav { gap: 14px; }
  .nav .opt { display: none; }
  .nav a { white-space: nowrap; }
  .nav .wide { display: none; }
  .hero-note { left: auto; right: 0; top: 0; width: 150px; }
  .hero-side { justify-items: start; }
  .hero-side p { text-align: left; }

  /* Constellation becomes a simple two-up gallery */
  .trades { height: auto; margin-top: 64px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 14px; }
  .trades-line { display: none; }
  .trades-copy, .trades-bubble { position: static; transform: none; grid-column: 1 / -1; width: auto; }
  .trades-copy { text-align: left; }
  .trades-bubble { justify-self: start; }
  .float { position: static; width: auto; }
  .float:nth-of-type(odd) { transform: rotate(-2deg); }
  .float:nth-of-type(even) { transform: rotate(2deg); }

  /* Timeline turns vertical */
  .timeline { height: auto; margin-top: 32px; padding-left: 20px; border-left: 1px solid var(--ink); display: grid; gap: 28px; }
  .timeline svg { display: none; }
  .pin, .js .pin { position: relative; left: auto; top: auto !important; opacity: 1; }
  .pin .pt { left: -24.5px; top: 7px; }
  .pin .stem { display: none; }
  .pin .lab, .pin.up .lab, .pin.down .lab { position: static; transform: none; width: auto; text-align: left; }

  .caps { grid-template-columns: 1fr; gap: 28px; }
  .more p { font-size: 24px; }
  .more .btn { white-space: normal; }
  .hi-line { display: none; }
}

/* hero already has a "let's talk" button */
@media (max-width: 360px) {
  .nav .talk { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .scribble .stroke, .js .draw .stroke { stroke-dashoffset: 0; }
  .js .hero h1, .js .hero-side, .js .hero-note, .js .float, .js .pin, .js .draw .end-dot, .js .bubble.pop, .js [data-reveal] { opacity: 1; transform: none; }
}
