/* Home page: a full-screen opening, three role words and one card per role.
   Everything here is scoped to the home page; the shared site stays unchanged. */
:root {
  /* Astro Boy (Atom) red, used only for the small dots. */
  --red: #e1251b;
  --hair: rgb(0 0 0 / 0.06);
  --card: #f3f3f5;
  --hd-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
:root[data-theme-now="dark"] {
  --red: #ff4b3e;
  --hair: rgb(255 255 255 / 0.08);
  --card: #1b1b1e;
}
.hd { overflow-x: clip; }
/* Same column and side gutters as every other page (site.css .container). */
.hd-wrap, .hd-wrap--w { width: min(var(--w-main), calc(100% - 2 * var(--g))); margin-inline: auto; position: relative; }
.hd-meta { font-family: var(--mono); font-size: 11px; line-height: 1.5; letter-spacing: 0.07em; text-transform: uppercase; color: var(--fg-2); }
.hd-meta b { color: var(--fg); font-weight: 600; }
.hd-sf { font-weight: 400; }
.hd-link { color: inherit; font-size: var(--fs-body); text-decoration: none; text-underline-offset: 5px; }
.hd-link:hover { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--fg-3); }
.hd :is(a, button):focus-visible { outline: 2px solid var(--fg); outline-offset: 5px; }
.btn.hd-btn { background: var(--fg); border-color: var(--fg); color: var(--bg); gap: 16px; }
.btn.hd-btn:hover { background: var(--fg-2); border-color: var(--fg-2); color: var(--bg); }

/* The opening: name, one sentence and the way in. Nothing else. */
/* The opening fills the first screen below the menu bar, over a landscape cut into
   blocks that glitch between clear and blurred (drawn by home.js). Without
   JavaScript, or before the canvas is ready, the plain photo shows. */
.hd-hero { position: relative; isolation: isolate; overflow: hidden; display: grid; align-content: center; min-height: calc(100svh - var(--nav-h, 48px)); padding: 48px 0 64px; color: #fff; }
.hd-hero__bg { position: absolute; z-index: -1; inset: 0; background: #5f8a35 url("/assets/img/home/hills.jpg") center / cover no-repeat; }
.hd-hero__bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.8s ease; }
.hd-hero__bg canvas.is-ready { opacity: 1; }
/* The grid layers follow their photo's zoom (home.js sets --lx, --ly, --lz, --lo). */
.hd-hero__bg .hd-hero__grid-lines { z-index: 1; pointer-events: none; transform-origin: 0 0; transform: translate(var(--lx, 0px), var(--ly, 0px)) scale(var(--lz, 1)); }
.hd-hero__bg canvas.hd-hero__grid-lines.is-ready { opacity: var(--lo, 1); transition: none; }
.hd-hero__bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(10 20 10 / 0.08), rgb(10 20 10 / 0.3)), radial-gradient(60% 60% at 50% 50%, rgb(10 20 10 / 0.2), transparent 75%); pointer-events: none; }
.hd-hero :is(.hd-name, .hd-intro) { color: #fff; text-shadow: 0 1px 24px rgb(0 0 0 / 0.18); }
.hd-hero .hd-intro em { color: #fff; }
.hd-hero .btn.hd-btn { background: #fff; border-color: #fff; color: #1d1d1f; }
.hd-hero .btn.hd-btn:hover { background: rgb(255 255 255 / 0.82); border-color: transparent; color: #1d1d1f; }
.hd-hero .hd-link { color: #fff; }
.hd-hero .hd-link:hover { text-decoration-color: rgb(255 255 255 / 0.6); }
.hd-hero :is(a, button):focus-visible { outline-color: #fff; }
/* One centered column: photo circle, name, intro, button. */
.hd-hero__inner { display: flex; flex-direction: column; align-items: center; text-align: center; }

/* The photo circle tilts a little toward the pointer (home.js sets --rx and --ry).
   home.js adds one photo at random, shown in black and white, which fades in and
   hides the outline drawing (still shown without JavaScript). */
.hd-face { width: clamp(112px, 11vw, 148px); aspect-ratio: 1; margin-bottom: clamp(24px, 2.6vw, 34px); perspective: 600px; }
.hd-face__disc { position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: rgb(255 255 255 / 0.16); border: 1px solid rgb(255 255 255 / 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 24px 48px -12px rgb(0 0 0 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.4);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 0.6s var(--hd-ease, ease); will-change: transform; }
.hd-face.is-tilting .hd-face__disc { transition-duration: 0.15s; }
.hd-face__ph { width: 62%; height: 62%; fill: none; stroke: rgb(255 255 255 / 0.75); stroke-width: 3; stroke-linecap: round; }
.hd-face__disc > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: grayscale(1); transition: opacity 0.6s ease; }
.hd-face__disc > img.is-ready { opacity: 1; }
.hd-face__disc:has(> img) .hd-face__ph { display: none; }

.hd-name { font-size: clamp(48px, 5vw, 76px); line-height: 1; font-weight: 500; letter-spacing: -0.045em; }
/* The visible name scrambles into other site languages (home.js). */
.hd-name__show { display: block; direction: ltr; }   /* the English name keeps its order on right-to-left pages */
.hd-name__show > span { display: inline-block; white-space: nowrap; }
.hd-name__show > span + span { margin-inline-start: 0.24em; }
.hd-name__show:lang(ja) { font-weight: 700; letter-spacing: -0.02em; }
.hd-name__show:lang(ko), .hd-name__show:lang(zh) { letter-spacing: -0.02em; }
/* Arabic: a geometric Kufi face, no letter spacing (it would break the joins), and
   the first name on the right, where Arabic starts. */
.hd-name__show:lang(ar) { direction: rtl; font-family: "Noto Kufi Arabic", var(--font); font-weight: 600; font-size: 0.82em; line-height: 1.25; letter-spacing: 0; }
.hd-dot { color: var(--red); }
.hd-hero__text { max-width: 600px; margin-top: clamp(18px, 1.8vw, 24px); }
.hd-intro { font-size: clamp(21px, 1.9vw, 26px); line-height: 1.32; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; }
.hd-intro em { color: inherit; }
.hd-cta { display: flex; gap: 24px; align-items: center; justify-content: center; margin-top: 30px; flex-wrap: wrap; }


/* Selected work: three role words on the left; pointing at one slides its card in
   from the right while the previous card slips away to the left. All cards share
   one grid cell, so the layout never moves; only opacity and transform animate.
   Without JavaScript the three cards are simply listed. */
.hd-files { padding: clamp(88px, 10vw, 144px) 0 clamp(96px, 11vw, 160px); scroll-margin-top: 72px; }
.hd-on-touch { display: none; }
@media (hover: none) { .hd-on-hover { display: none; } .hd-on-touch { display: inline; } }
.hd-rl { display: grid; grid-template-columns: max-content minmax(0, 620px); justify-content: space-between; gap: 40px; align-items: center; }
.hd-rl__words { display: flex; flex-direction: column; align-items: flex-start; }
.hd-rl__word { display: flex; align-items: flex-start; padding: 2px 0; color: var(--fg-3); text-decoration: none; }
.hd-rl__t { display: block; font-size: clamp(52px, 5.8vw, 80px); line-height: 1.02; font-weight: 500; letter-spacing: -0.045em; transition: color 0.35s var(--hd-ease); }
.hd-rl__t .hd-dot { opacity: 0; transition: opacity 0.35s var(--hd-ease); }
.hd-rl__word:hover .hd-rl__t { color: var(--fg-2); }
.hd-rl__word.is-on .hd-rl__t { color: var(--fg); }
.hd-rl__word.is-on .hd-dot { opacity: 1; }
.hd-rl__word:focus-visible { outline-offset: 2px; }

/* The deck: the card sits on two fainter cards, so it reads as a stack, and tilts a
   little toward the pointer anywhere in the section (home.js sets --rx and --ry).
   The card's text and link act as a layer floating --lift px above the card: they
   shift by as much as such a layer would as the deck turns (lift x sin of the angle).
   The angles are registered, so they animate smoothly and the card and its text
   always move together. (The shift uses `translate`, so it adds to the slide-in
   `transform`.) Each card is four stats and one link; the whole card is clickable. */
@property --rx { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
@property --ry { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
.hd-rl__deck { --rx: 0deg; --ry: 0deg; --lift: 100px; position: relative; isolation: isolate; display: grid; gap: 32px; transform: perspective(1400px) rotateX(var(--rx)) rotateY(var(--ry)); transition: --rx 0.6s var(--hd-ease), --ry 0.6s var(--hd-ease); }
.hd-rl__deck.is-tilting { transition-duration: 0.2s; }
.hd-rl.is-enhanced .hd-rl__deck::before, .hd-rl.is-enhanced .hd-rl__deck::after { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: 32px; background: var(--card); transform-origin: 50% 0; pointer-events: none; }
.hd-rl.is-enhanced .hd-rl__deck::before { transform: translateY(-14px) scale(0.95); opacity: 0.7; }
.hd-rl.is-enhanced .hd-rl__deck::after { transform: translateY(-27px) scale(0.9); opacity: 0.4; }
.hd-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 38px 42px 34px; border-radius: 32px; background: var(--card); box-shadow: 0 1px 0 rgb(255 255 255 / 0.6) inset, 0 30px 60px -36px rgb(0 0 0 / 0.35); transition: box-shadow 0.3s; }
:root[data-theme-now="dark"] .hd-card { box-shadow: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 30px 60px -36px rgb(0 0 0 / 0.8); }
.hd-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0 36px; margin-top: 22px; list-style: none; }
.hd-stats li { display: flex; flex-direction: column; gap: 10px; padding: 28px 0; border-top: 1px solid var(--hair); }
.hd-stats li:nth-child(-n + 2) { border-top: 0; padding-top: 8px; }
.hd-stats b { font-size: clamp(40px, 4vw, 56px); line-height: 1; font-weight: 500; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.hd-stats span { font-size: 15px; line-height: 1.4; color: var(--fg-2); max-width: 22ch; }
.hd-card__open { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin-top: 12px; padding-top: 22px; color: var(--fg); text-decoration: none; font-size: 16px; font-weight: 500; }
/* Only the words underline on hover, never the arrow. */
.hd-card__open:hover { text-decoration: none; }
.hd-card__label { text-decoration: underline 1px transparent; text-underline-offset: 5px; transition: text-decoration-color 0.3s; }
.hd-card:hover .hd-card__label { text-decoration-color: var(--fg-3); }
.hd-card__arrow { color: var(--fg-2); transition: transform 0.3s var(--hd-ease), color 0.3s; }
.hd-card:hover .hd-card__arrow { color: var(--fg); }
.hd-card__open::after { content: ""; position: absolute; inset: 0; border-radius: 32px; }
.hd-card > * { translate: calc(sin(var(--ry)) * var(--lift, 0px)) calc(sin(var(--rx)) * var(--lift, 0px) * -1); }
.hd-card:hover .hd-card__arrow { transform: translateX(4px); }
.hd-card:hover { box-shadow: 0 1px 0 rgb(255 255 255 / 0.6) inset, 0 34px 70px -34px rgb(0 0 0 / 0.42); }
.hd-card__open:focus-visible { outline: none; }
.hd-card:has(.hd-card__open:focus-visible) { outline: 2px solid var(--fg); outline-offset: 4px; }

.hd-rl.is-enhanced .hd-card { grid-area: 1 / 1; visibility: hidden; opacity: 0; transform: translateX(90px) rotate(3deg); transform-origin: 100% 100%; }
.hd-rl.is-enhanced .hd-card.is-out { visibility: visible; transform: translateX(-56px) rotate(-2deg) scale(0.96); transition: opacity 0.3s ease, transform 0.45s var(--hd-ease); }
.hd-rl.is-enhanced .hd-card.is-on { z-index: 1; visibility: visible; opacity: 1; transform: none; transition: opacity 0.45s ease 0.08s, transform 0.8s var(--hd-ease) 0.08s, box-shadow 0.3s; }
.hd-rl.is-enhanced .hd-card > *, .hd-rl.is-enhanced .hd-stats li { opacity: 0; transform: translateX(18px); }
.hd-rl.is-enhanced .hd-card.is-on > *, .hd-rl.is-enhanced .hd-card.is-on .hd-stats li { opacity: 1; transform: none; transition: opacity 0.5s ease var(--dl, 0.2s), transform 0.7s var(--hd-ease) var(--dl, 0.2s); }
.hd-rl.is-enhanced .hd-card.is-on .hd-stats { transition-delay: 0s; }
.hd-stats li:nth-child(1) { --dl: 0.24s; }
.hd-stats li:nth-child(2) { --dl: 0.3s; }
.hd-stats li:nth-child(3) { --dl: 0.36s; }
.hd-stats li:nth-child(4) { --dl: 0.42s; }
.hd-card__open { --dl: 0.48s; }

.hd-contact { padding: 0 0 72px; }
.hd-contact__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; border-top: 1px solid var(--hair); padding-top: 40px; }
.hd-mail { position: relative; display: inline-block; margin-top: 16px; border: 0; background: none; padding: 0; color: var(--fg); font: inherit; font-size: clamp(30px, 4.6vw, 66px); font-weight: 600; letter-spacing: -0.045em; line-height: 1.08; cursor: pointer; text-align: start; overflow-wrap: anywhere; }
.hd-mail .hd-sf { display: inline-block; color: var(--fg-3); }
.hd-mail__stamp { position: absolute; right: 0; top: -30px; border-radius: 999px; padding: 4px 10px; background: var(--fg); color: var(--bg); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.35s var(--hd-ease); pointer-events: none; }
.hd-mail.is-copied .hd-mail__stamp { opacity: 1; transform: none; }
.hd-contact__note { margin-top: 18px; color: var(--fg-2); font-size: var(--fs-small); line-height: 1.5; max-width: 68ch; }
.hd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1000px) {
  .hd-rl { gap: 36px; }
  .hd-contact__row { grid-template-columns: 1fr; gap: 24px; }
  .hd-contact__row > .btn { justify-self: start; }
}
@media (max-width: 833px) {
  .hd-rl { grid-template-columns: 1fr; gap: 32px; }
  .hd-rl__t { font-size: clamp(48px, 11vw, 84px); }
  .hd-rl__deck { max-width: 620px; }
}
@media (max-width: 600px) {
  .hd-hero { padding: 32px 0 48px; }
  .hd-name { font-size: clamp(44px, 13vw, 56px); }
  .hd-name__show > span { display: block; }
  .hd-name__show > span + span { margin-inline-start: 0; }
  .hd-intro { font-size: 19px; }
  .hd-files { padding: 64px 0 80px; }
  .hd-rl { gap: 28px; }
  .hd-rl__t { font-size: clamp(46px, 14vw, 64px); }
  .hd-card { padding: 22px 20px 20px; border-radius: 24px; }
  .hd-card__open::after { border-radius: 24px; }
  .hd-stats { gap: 0 18px; }
  .hd-stats li { padding: 16px 0; }
  .hd-stats b { font-size: 34px; }
  .hd-stats span { font-size: 13px; }
  .hd-rl.is-enhanced .hd-card { transform: translateX(48px) rotate(2deg); }
  .hd-rl.is-enhanced .hd-card.is-out { transform: translateX(-32px) rotate(-1.5deg) scale(0.97); }
  .hd-contact { padding-bottom: 48px; }
  .hd-contact__row { padding-top: 30px; }
  .hd-mail { font-size: clamp(28px, 7.4vw, 42px); }
  .hd-contact__note { font-size: 13px; }
}
@media (max-width: 360px) {
  .hd-intro { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .hd *, .hd *::before, .hd *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Other languages. Long German and Spanish role words get a smaller size. Arabic
   keeps normal letter spacing so its letters stay joined. Right-to-left pages mirror
   the card arrow. */
.hd-rl__t:is(:lang(de), :lang(es)) { font-size: clamp(44px, 4.6vw, 64px); }
.hd-rl__t:is(:lang(ja), :lang(zh), :lang(ko)) { font-size: clamp(44px, 4.8vw, 66px); letter-spacing: 0; }
:is(:lang(ja), :lang(zh), :lang(ko), :lang(ar)) .hd-intro em { font-style: normal; }
:lang(ar) .hd-meta { font-family: var(--font); font-size: 13px; text-transform: none; }
.hd-mail { unicode-bidi: isolate; direction: ltr; }   /* the address always reads left to right */
:lang(ar) :is(.hd-meta, .hd-rl__t, .hd-intro, .hd-stats b, .hd-card__open) { letter-spacing: 0; }
.hd-card__arrow:dir(rtl) { display: inline-block; scale: -1 1; }
.hd-card:hover .hd-card__arrow:dir(rtl) { transform: translateX(-4px); }
