:root {
  --cream: #f4efe2;
  --cream-2: #e9e3d1;
  --sky: #74a9f2;
  --mist: #dde9f8;
  --ink: #0e1a2e;

  --pad: clamp(.7rem, 1vw, 1rem);
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  position: fixed; inset: 0; margin: 0;
  font-family: "Archivo", "Noto Sans", "Noto Sans SC", "Noto Sans KR", "Noto Sans Bengali", "Noto Sans Arabic", "Noto Sans Hebrew", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-stretch: 100%;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background: var(--sky);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
::selection { background: var(--ink); color: var(--cream); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.meta { font-size: .72rem; line-height: 1.3; letter-spacing: .01em; text-transform: uppercase; font-weight: 500; }
.wide { font-stretch: 125%; font-weight: 800; text-transform: uppercase; letter-spacing: -.03em; }

/* ---------- slides ---------- */
.view {
  --bg: var(--cream); --fg: var(--ink); --giant: var(--sky);
  position: fixed; inset: 0; z-index: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "title" "nav" "stage" "meta";
  padding: var(--pad) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom));
  background: var(--bg); color: var(--fg);
  visibility: hidden; clip-path: inset(100% 0 0 0);
  outline: none;
}
.view.is-prev { visibility: visible; clip-path: inset(0); z-index: 1; }
.view.is-active { visibility: visible; clip-path: inset(0); z-index: 2; transition: clip-path .95s var(--ease); }

.view--home { --bg: var(--sky); --giant: var(--cream); }
.view--examples { --bg: var(--cream); --giant: var(--sky); }
.view--journal { --bg: var(--sky); --giant: var(--cream); }
.view--contact { --bg: var(--cream); --giant: var(--sky); }
.view--post { --bg: var(--cream); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "nav" "stage" "meta"; }

/* ---------- giant fitted type ---------- */
.giant {
  grid-area: title; display: block; width: 100%; margin: 0 0 0 -.01em;
  color: var(--giant); font-stretch: 125%; font-weight: 800; text-transform: uppercase;
  letter-spacing: -.03em; line-height: .8; white-space: nowrap; font-size: 15vw;
}
.fit__in { display: inline-block; }
.giant .l { display: inline-block; transform-origin: 50% 100%; }
.giant .l.bounce { animation: letter-bounce .75s cubic-bezier(.3, .6, .3, 1); }
@keyframes letter-bounce {
  0%   { transform: none; }
  22%  { transform: translateY(.13em) scale(1.07, .9); }     /* squash down */
  48%  { transform: translateY(-.035em) scale(.96, 1.05); }  /* spring back up */
  68%  { transform: translateY(.045em) scale(1.02, .98); }
  84%  { transform: translateY(-.01em); }
  100% { transform: none; }
}
.js .giant .l { opacity: 0; transform: translateY(.2em); }
.ready .view.is-prev .giant .l { opacity: 1; transform: none; }
.ready .view.is-active .giant .l { opacity: 1; transform: none; transition: opacity .9s var(--ease), transform 1.1s var(--ease); transition-delay: calc(.25s + var(--i) * 65ms); }

/* ---------- nav pills + buttons ---------- */
.navrow { grid-area: nav; display: flex; flex-wrap: wrap; gap: .45rem; margin-top: clamp(.6rem, 1.6vh, 1rem); }
.view--home .navrow { display: none; }

.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; gap: .55rem;
  height: 2.2rem; padding: 0 1rem; border-radius: 999px;
  border: 1.5px solid var(--fg); background: transparent; color: var(--fg);
  font-size: .82rem; font-weight: 600; font-stretch: 112%; letter-spacing: -.005em; white-space: nowrap;
  transition: color .35s var(--ease);
}
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--fg); transform: translateY(101%); transition: transform .45s var(--ease); }
.btn:hover { color: var(--bg); }
.btn:hover::before { transform: none; }
.btn b { display: inline-block; font-weight: 500; transition: transform .4s var(--ease); }
.btn:hover b { transform: translate(2px, -2px); }
.btn--solid, .btn.is-current { background: var(--fg); color: var(--bg); }
.btn--solid::before, .btn.is-current::before { background: var(--bg); }
.btn--solid:hover, .btn.is-current:hover { color: var(--fg); }
.btn--lg { height: 3.4rem; padding: 0 1.7rem; font-size: 1rem; }

/* ---------- stage ---------- */
.stage { grid-area: stage; min-height: 0; display: flex; flex-direction: column; padding-block: clamp(.6rem, 1.6vh, 1rem); }
.stage > * { flex: 1; min-height: 0; }
.lead { max-width: 22ch; font-size: clamp(1.5rem, 3vw, 3.1rem); line-height: 1.06; font-stretch: 112%; font-weight: 600; letter-spacing: -.03em; }

.stage--home { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem; }
.stage--home > * { flex: 0 1 auto; }
.ctas { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- projects ---------- */
/* horizontal gallery strip: the page never scrolls, the strip does */
.grid { display: flex; gap: .6rem; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain; }
.grid::-webkit-scrollbar { display: none; }
.navtools { grid-area: nav; justify-self: end; align-self: end; display: flex; align-items: center; gap: .4rem; margin-top: clamp(.6rem, 1.6vh, 1rem); }
.ctl { display: flex; gap: .4rem; }
.ctl button { width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--fg); transition: background .3s var(--ease), color .3s var(--ease), opacity .3s; }
.ctl button:hover:not(:disabled) { background: var(--fg); color: var(--bg); }
.ctl button:disabled { opacity: .28; cursor: default; }
.tile {
  flex: 0 0 clamp(20rem, 46vw, 44rem); scroll-snap-align: start;
  display: flex; flex-direction: column; gap: .6rem; min-height: 0;
  padding: .55rem .55rem .8rem; border-radius: 14px; overflow: hidden;
  background: var(--t-bg); color: var(--t-fg);
  transition: background .5s var(--ease), color .5s var(--ease), border-radius .6s var(--ease);
}
.tile:hover { background: var(--h-bg); color: var(--h-fg); border-radius: 28px; }
/* live, scaled-down preview of each example site */
.shot { position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: 9px; background: #fff; }
.shot iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.tile__row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding-inline: .45rem; }
.tile__name { display: block; font-size: clamp(1.15rem, 1.8vw, 1.9rem); line-height: 1; font-stretch: 118%; font-weight: 700; letter-spacing: -.03em; }
.tile__kind { display: block; margin-top: .3rem; opacity: .75; }
.tile__arrow { flex: none; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid currentColor; transition: transform .5s var(--ease); }
.tile:hover .tile__arrow { transform: rotate(45deg); }
.tile--1 { --t-bg: var(--sky); --t-fg: var(--ink); --h-bg: var(--ink); --h-fg: var(--cream); }
.tile--2 { --t-bg: var(--ink); --t-fg: var(--cream); --h-bg: var(--cream-2); --h-fg: var(--ink); }
.tile--3 { --t-bg: var(--cream-2); --t-fg: var(--ink); --h-bg: var(--sky); --h-fg: var(--ink); }
.tile--4 { --t-bg: var(--mist); --t-fg: var(--ink); --h-bg: var(--ink); --h-fg: var(--cream); }

/* ---------- project detail ---------- */
.view--example { --bg: var(--cream); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "nav" "stage" "meta"; }
.proj { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(1rem, 3vw, 3rem); padding-top: clamp(.75rem, 2.5vh, 2rem); overflow: auto; scrollbar-width: none; }
.proj::-webkit-scrollbar { display: none; }
.proj__info { display: flex; flex-direction: column; gap: 1.1rem; min-height: 0; }
.proj__info h1 { font-size: clamp(2rem, 4.2vw, 4.8rem); line-height: .9; font-stretch: 125%; font-weight: 800; text-transform: uppercase; letter-spacing: -.045em; }
.proj__blurb { max-width: 30rem; font-size: clamp(.98rem, 1.15vw, 1.15rem); line-height: 1.45; }
.proj__facts { display: grid; gap: .85rem; margin: auto 0 0; }
.proj__facts dt { opacity: .6; }
.proj__facts dd { margin: .15rem 0 0; font-weight: 500; }
.swatches { display: flex; gap: .35rem; }
.swatches i { width: 1.7rem; height: 1.7rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(14, 26, 46, .22); }
.proj__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.browser { display: flex; flex-direction: column; min-height: 0; border-radius: 14px; overflow: hidden; background: var(--ink); }
.browser__bar { display: flex; align-items: center; gap: .4rem; padding: .6rem .8rem; }
.browser__bar span { width: .6rem; height: .6rem; border-radius: 50%; background: rgba(244, 239, 226, .3); }
.browser__bar em { flex: 1; margin-left: .6rem; padding: .15rem .8rem; border-radius: 999px; background: rgba(244, 239, 226, .12); color: var(--cream); font-size: .75rem; font-style: normal; text-align: center; }
.browser iframe { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; }

/* ---------- journal ---------- */
/* sideways strip of posts */
.cards { display: flex; gap: .6rem; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain; }
.cards::-webkit-scrollbar { display: none; }
.card {
  flex: 0 0 clamp(17rem, 30vw, 27rem); scroll-snap-align: start;
  display: flex; flex-direction: column; justify-content: space-between; gap: 1.25rem; min-height: 0;
  padding: 1rem 1.1rem 1.1rem; border-radius: 12px; background: var(--cream); color: var(--ink);
  transition: background .5s var(--ease), color .5s var(--ease), border-radius .6s var(--ease);
}
.card:hover { background: var(--ink); color: var(--cream); border-radius: 28px; }
.card__top { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.tag { padding: .18rem .65rem; border: 1.5px solid currentColor; border-radius: 999px; }
.card h3 { margin-top: auto; font-size: clamp(1.5rem, 2.9vw, 3.1rem); line-height: .98; font-stretch: 118%; font-weight: 800; letter-spacing: -.04em; }
.card p { margin-top: .8rem; max-width: 34ch; opacity: .7; font-size: .95rem; }
.card__foot { display: flex; justify-content: space-between; align-items: center; }
.card__arrow { font-size: 1.5rem; transition: transform .5s var(--ease); }
.card:hover .card__arrow { transform: translate(4px, -4px); }

/* ---------- journal post ---------- */
.post { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(1.5rem, 5vw, 5rem); padding-top: clamp(.75rem, 4vh, 3rem); overflow: auto; scrollbar-width: none; }
.post::-webkit-scrollbar { display: none; }
.post h1 { margin: .9rem 0 1.1rem; font-size: clamp(2.1rem, 5.4vw, 6rem); line-height: .93; font-stretch: 118%; font-weight: 800; letter-spacing: -.045em; }
.post__dek { max-width: 26rem; font-size: clamp(1.05rem, 1.5vw, 1.4rem); line-height: 1.25; font-stretch: 105%; font-weight: 500; letter-spacing: -.015em; }
.post__body { align-self: end; max-width: 38rem; font-size: clamp(.98rem, 1.2vw, 1.2rem); line-height: 1.55; }
.post__body p + p { margin-top: 1em; }
.post__body strong { font-weight: 700; }
.post__body em { font-style: normal; font-weight: 700; background: var(--mist); padding: 0 .25em; border-radius: .25em; }

/* ---------- contact ---------- */
.stage--contact { flex-direction: row; gap: clamp(1.5rem, 5vw, 6rem); align-items: stretch; }
.stage--contact > * { flex: 1 1 0; }
.contact__left { display: flex; flex-direction: column; justify-content: flex-end; gap: 1.25rem; }
.bigmail { align-self: flex-start; font-size: clamp(1.1rem, 2.1vw, 2rem); font-stretch: 118%; font-weight: 700; letter-spacing: -.03em; border-bottom: 2px solid currentColor; }
.form { display: flex; flex-direction: column; justify-content: flex-end; gap: 1.1rem; }
.field { display: grid; gap: .3rem; padding-bottom: .45rem; border-bottom: 1.5px solid var(--fg); }
.field:focus-within { border-bottom-width: 3px; padding-bottom: calc(.45rem - 1.5px); }
.field span { opacity: .65; }
.field input, .field textarea { width: 100%; background: transparent; border: 0; outline: 0; resize: none; font: inherit; font-size: 1.15rem; font-stretch: 108%; font-weight: 500; color: var(--fg); }
.field ::placeholder { color: rgba(14, 26, 46, .35); }
.form__row { display: flex; align-items: center; gap: 1rem; }

/* ---------- bottom metadata (like a slide caption) ---------- */
.metarow { grid-area: meta; display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: 1rem; align-items: end; }
.metarow p { margin: 0; }

/* ---------- 3D model on the home slide ---------- */
.model { position: absolute; z-index: 3; inset-inline-end: clamp(1rem, 9vw, 11rem); top: 54%; translate: 0 -50%; width: clamp(9rem, 26vw, 23rem); aspect-ratio: 1; pointer-events: none; }
.model model-viewer { width: 100%; height: 100%; background: transparent; --poster-color: transparent; --progress-bar-color: transparent; opacity: 0; transition: opacity .9s var(--ease); }
.model model-viewer.ready { opacity: 1; }
@media (max-width: 1100px) { .model { top: 45%; } }
@media (max-width: 720px) { .model { inset-inline-end: auto; left: 50%; top: 31%; translate: -50% -50%; width: clamp(9rem, 46vw, 14rem); } }

/* ---------- mascot: a tiny easter egg peeking up from the corner ---------- */
.mascot { position: fixed; z-index: 20; inset-inline-end: calc(var(--pad) + .8rem); bottom: 0; width: 2.5rem; translate: 0 13%; cursor: pointer; transition: translate .5s var(--ease); -webkit-tap-highlight-color: transparent; }
.mascot:hover, .mascot:focus-within { translate: 0 2%; }
.mascot svg { display: block; width: 100%; height: auto; overflow: visible; }
.mascot__in.hop { animation: hop .6s var(--ease); }
@keyframes hop { 30% { transform: translateY(-.5rem) scale(.96, 1.06); } 60% { transform: scale(1.06, .94); } }

/* ---------- language switcher (lives in the header row of the active slide) ---------- */
.lang { position: relative; z-index: 30; }
.lang__btn { display: inline-flex; align-items: center; gap: .45rem; height: 2.2rem; padding: 0 .85rem 0 .7rem; border-radius: 999px; border: 1.5px solid var(--fg); color: var(--fg); font-size: .78rem; font-weight: 600; font-stretch: 112%; letter-spacing: .02em; transition: background .3s var(--ease), color .3s var(--ease); }
.lang__btn:hover, .lang__btn[aria-expanded="true"] { background: var(--fg); color: var(--bg); }
.lang__btn svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.lang__menu { position: absolute; inset-inline-end: 0; top: calc(100% + .5rem); min-width: 12.5rem; max-height: min(70vh, 25rem); overflow: auto; padding: .35rem; border-radius: 18px; background: var(--ink); color: var(--cream); box-shadow: 0 24px 40px -20px rgba(0, 0, 0, .55); scrollbar-width: none; }
.lang__menu::-webkit-scrollbar { display: none; }
.lang__menu[hidden] { display: none; }
.lang__menu button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem .8rem; border-radius: 12px; text-align: start; font-size: .95rem; font-weight: 500; letter-spacing: 0; }
.lang__menu button:hover, .lang__menu button:focus-visible { background: rgba(244, 239, 226, .14); outline: none; }
.lang__menu button[aria-checked="true"]::after { content: "✓"; }

/* right-to-left languages (Arabic, Yiddish) and scripts that must not be tracked tight */
html[dir="rtl"] .grid, html[dir="rtl"] .cards { direction: ltr; }             /* keep strip scrolling maths simple */
html[dir="rtl"] .tile, html[dir="rtl"] .card { direction: rtl; }
html[lang="ar"] *, html[lang="bn"] * { letter-spacing: 0 !important; }         /* tight tracking breaks joined letters */
html[lang="ar"] .giant, html[lang="bn"] .giant, html[lang="yi"] .giant { line-height: 1.05; }
html[lang="zh"] .giant, html[lang="ko"] .giant { line-height: .95; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .proj { grid-template-columns: 1fr; grid-auto-rows: auto; align-content: start; }
  .proj__info { min-height: auto; }
  .proj__facts { margin-top: .5rem; }
  .browser { min-height: auto; height: min(72svh, 34rem); }
  .card { flex-basis: clamp(16rem, 62vw, 24rem); }
  .card h3 { font-size: clamp(1.5rem, 5vw, 2.4rem); }
  .post { grid-template-columns: 1fr; }
  .post__body { align-self: start; }
  .stage--contact { flex-direction: column; gap: 1rem; }
  .stage--contact > * { flex: 0 0 auto; }
  .contact__left { justify-content: flex-start; }
  .form { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .btn--lg { height: 3rem; padding: 0 1.3rem; }
  .ctas { width: 100%; }
  .ctas .btn { flex: 1 1 auto; justify-content: space-between; }
  .card__foot { display: none; }
  .navrow .btn { height: 2rem; padding: 0 .8rem; font-size: .78rem; }
}
@media (max-height: 640px) {
  .lead { font-size: 1.4rem; }
  .card h3 { font-size: 1.3rem; }
  .card p { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .view.is-active { transition: none; }
  .js .giant .l, .ready .view.is-active .giant .l { opacity: 1; transform: none; transition: none; }
}
