/* neo-home: minimal homepage experiment */
:root {
  --text: "IBM Plex Sans", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --ink: #111;
  --muted: #696e75;
  --faint: #a0a5ac;
  --rule: #e7e7e7;
  --tile: #f5f5f5;
  --col: 576px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --lift: 0 1px 2px rgba(17, 17, 17, .04), 0 4px 14px rgba(17, 17, 17, .07);  /* pills and the mobile section bar */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 400 13px/16px var(--text);
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.mono { font-family: var(--mono); font-size: 11px; line-height: 16px; letter-spacing: 0; }
.idx { font-family: var(--mono); font-size: 11px; letter-spacing: 0; }
.sq { display: inline-block; width: 6px; height: 6px; margin-right: 6px; vertical-align: 1px; background: var(--c, var(--ink)); flex: none; }

.page { max-width: calc(var(--col) + 40px); margin: 0 auto; padding: 84px 20px 64px; }

/* Header */
.head__row { display: flex; justify-content: space-between; align-items: baseline; }
.name { margin: 0; font-size: 20px; line-height: 24px; font-weight: 400; letter-spacing: -0.03em; }
.intro p + p { margin-top: 16px; }
/* Bio on the left, contact links in a narrow column on the right */
.head__body { display: grid; grid-template-columns: minmax(0, 1fr) 1px 96px; column-gap: 40px; align-items: start; margin-top: 14px; }

.rule { height: 1px; background: var(--rule); border: 0; margin: 32px 0; }

/* Education + Experience */
.lists { display: grid; grid-template-columns: 1fr 1px 1fr; column-gap: 40px; align-items: start; }
.lists__divider, .head__divider { align-self: center; height: 64px; background: var(--rule); }
.list__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.list a { display: flex; justify-content: space-between; align-items: baseline; width: 100%; }
.list a:hover .list__label, .list a:focus-visible .list__label { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.sup { margin-right: 2px; }
/* Education: logo, degree on two lines, years */
.edu { display: grid; row-gap: 14px; }
.edu li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 14px; align-items: center; }
.edu__logo { justify-self: center; }
.edu__deg, .edu li > .mono { align-self: first baseline; }
.edu__deg { text-wrap: balance; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.arrow { flex: none; align-self: center; }

/* Tabs */
.work { margin-top: 72px; }
.tabs { position: relative; display: flex; align-items: baseline; gap: 20px; margin-bottom: 16px; }
.tab { position: relative; padding: 2px 0 6px; color: var(--faint); transition: color .2s ease; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab .count { margin-left: 3px; font-family: var(--mono); font-size: 9px; vertical-align: 4px; letter-spacing: 0; }
.tabs__line { position: absolute; left: 0; bottom: 0; height: 1px; width: 0; background: var(--ink); }
.tabs__line.is-ready { transition: transform .45s var(--ease), width .45s var(--ease); }

/* Grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 16px; }
.card { display: block; }
.tile { position: relative; aspect-ratio: 16 / 9; background: var(--tile); overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); transform: scale(1); transition: filter .6s ease, transform .8s var(--ease); }
.tile--portrait img { width: auto; height: 100%; margin: 0 auto; object-fit: contain; }
.card:hover .tile img,
.card:focus-visible .tile img,
.card.is-lit .tile img { filter: grayscale(0); }
.card:hover .tile img, .card:focus-visible .tile img { transform: scale(1.015); }
.always-color .tile img { filter: none; }

.card__row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 8px; }
.card__title { min-width: 0; }
.card:hover .card__name, .card:focus-visible .card__name { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.card__meta { flex: none; }
.card__desc { margin-top: 2px; color: var(--muted); }

[role="tabpanel"][hidden] { display: none; }
/* Switching tabs keeps the quick card rise (first load uses the page reveal below) */
.grid.is-switched .card { animation: neo-rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes neo-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.more { margin-top: 20px; display: flex; justify-content: flex-end; }
.more a:hover { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* Footer */
.foot { margin-top: 64px; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--muted); }
.foot__row { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.foot__meta { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.foot__link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); transition: color .2s ease; }
.foot__link:hover, .foot__link:focus-visible { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .appear, .grid.is-switched .card { animation: none; }
  .tabs__line.is-ready, .tile img { transition: none; }
}

@media (max-width: 600px) {
  .page { padding: 48px 16px 48px; }
  .head__body { grid-template-columns: 1fr; row-gap: 20px; }
  .lists { grid-template-columns: 1fr; row-gap: 24px; }
  .lists__divider, .head__divider { display: none; }
  .work { margin-top: 56px; }
  .grid { gap: 22px 12px; }
}
@media (max-width: 600px) {
  /* the credits line is too long to sit beside the Chiikawas on a phone */
  .foot__row--credits { flex-direction: column; align-items: flex-start; gap: 16px; }
  .foot__row--credits .foot__meta { align-items: flex-start; text-align: left; }
}
@media (max-width: 420px) {
  .card__row { flex-direction: column; gap: 0; }
  .card__meta { color: var(--muted); }
}

/* "More on YouTube" tile */
.tile--more { display: flex; align-items: center; justify-content: center; color: var(--muted); transition: color .2s ease; }
.card--more:hover .tile--more, .card--more:focus-visible .tile--more { color: var(--ink); }
.list__title { margin: 0; font-size: 13px; line-height: 16px; font-weight: 400; }

/* Chiikawa row on the left of the footer */
.chars { display: flex; align-items: flex-end; gap: 20px; }
.chii {
  display: block; height: 32px; width: auto;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
@media (hover: hover) { .chii:hover { transform: scale(1.2) rotate(6deg); } }
.chii.is-tapped { transform: scale(1.2) rotate(6deg); }

/* Coming-soon case studies */
.tile--soon { display: flex; align-items: center; justify-content: center; background: #f2f2f2; color: var(--muted); }
.card--soon { cursor: default; }

/* "Read more..." pill that follows the cursor over case studies */
.pill {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  width: 24px; height: 24px; overflow: hidden; border-radius: 8px;
  background: var(--pill-bg, #fff); border: 1px solid var(--pill-line, #f2f2f2); color: var(--pill-ink, var(--muted)); box-shadow: var(--lift);
  font: 400 13px/1 var(--text); letter-spacing: -0.01em; white-space: nowrap;
  opacity: 0; transition: width .45s var(--ease), opacity .2s ease, background-color .16s ease, border-color .16s ease, color .16s ease;
}
.pill.is-jump { transition: none; }
/* 7px sides, about the visible gap above and below the text; the text sits 1px above center so it reads centered */
.pill span { position: absolute; left: 6px; top: 50%; transform: translateY(calc(-50% - 1px)); opacity: 0; transition: opacity .2s ease; }
.pill.is-on { width: var(--w, 96px); opacity: 1; }
.pill.is-on span { opacity: 1; transition-delay: .08s; }
/* Experience rows: the pill takes the row's square color and swaps in the job title */
.pill span.is-swap { animation: pill-swap .3s var(--ease); }
@keyframes pill-swap { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .chii { transition: none; }
  .pill { transition: opacity .15s ease; }
  .pill span.is-swap { animation: none; }
  .pill.is-on { width: var(--w, 96px); }
}

/* Page-load reveal, matched to ethanchng.com (Framer "Stagger"): every block starts 24px low,
   blurred 10px and transparent, then springs in over 1.1s (Framer spring, bounce 0.3), 80ms apart.
   The linear() curve is that spring sampled every 10ms, as Framer does (it overshoots 4.6 percent at ~490ms). */
:root { --spring: cubic-bezier(.22, 1, .36, 1); }
@supports (animation-timing-function: linear(0, 1)) {
  :root { --spring: linear(0, 0.0039, 0.015, 0.0323, 0.0549, 0.0821, 0.113, 0.1471, 0.1837, 0.2221, 0.262, 0.3028, 0.344, 0.3854, 0.4266, 0.4672, 0.5071, 0.5461, 0.5839, 0.6204, 0.6554, 0.689, 0.7209, 0.7512, 0.7798, 0.8066, 0.8318, 0.8553, 0.8771, 0.8972, 0.9157, 0.9327, 0.9482, 0.9622, 0.9749, 0.9862, 0.9963, 1.0053, 1.0131, 1.0199, 1.0258, 1.0307, 1.0348, 1.0382, 1.0409, 1.0429, 1.0444, 1.0454, 1.0459, 1.046, 1.0457, 1.0451, 1.0442, 1.0431, 1.0418, 1.0404, 1.0388, 1.0371, 1.0353, 1.0334, 1.0316, 1.0297, 1.0278, 1.0259, 1.024, 1.0222, 1.0204, 1.0187, 1.017, 1.0154, 1.0139, 1.0125, 1.0111, 1.0098, 1.0086, 1.0074, 1.0064, 1.0054, 1.0045, 1.0037, 1.0029, 1.0022, 1.0016, 1.001, 1.0005, 1.0001, 0.9997, 0.9993, 0.999, 0.9988, 0.9985, 0.9984, 0.9982, 0.9981, 0.998, 0.9979, 0.9979, 0.9979, 0.9979, 0.9979, 0.9979, 0.998, 0.998, 0.9981, 0.9982, 0.9982, 0.9983, 0.9984, 0.9985, 1); }
}
.appear { animation: appear 1.1s var(--spring) backwards; animation-delay: calc(var(--n, 0) * 80ms); }
@keyframes appear { from { opacity: 0; filter: blur(10px); transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) { .appear { animation: none; } }

/* Motion clips (tools/build_neo_motion.py): a muted loop fades in over the still once it plays */
.tile video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: grayscale(1); transform: scale(1);
  transition: opacity .4s ease, filter .6s ease, transform .8s var(--ease); }
.tile--portrait video { left: 34.1796875%; width: 31.640625%; }  /* a 9:16 clip at full height in the middle of a 16:9 tile */
.tile video.is-playing { opacity: 1; }
.card:hover .tile video, .card:focus-visible .tile video, .card.is-lit .tile video { filter: grayscale(0); }
.card:hover .tile video, .card:focus-visible .tile video { transform: scale(1.015); }
.always-color .tile video { filter: none; }

/* Motion lightbox: the tile grows into a YouTube player, same look as the case study lightbox */
.vb { position: fixed; inset: 0; z-index: 60; }
.vb[hidden] { display: none; }
.vb__bg { position: fixed; inset: 0; background: #fff; opacity: 0; cursor: zoom-out; }
.vb__box { position: fixed; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; background: var(--tile); }
.vb__box img { width: 100%; height: 100%; object-fit: cover; }
.vb__box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .35s ease; }
.vb__box iframe.is-ready { opacity: 1; }
.vb__close { position: fixed; top: 16px; right: 20px; z-index: 61; color: var(--muted); opacity: 0; transition: color .2s ease; }
.vb__close:hover, .vb__close:focus-visible { color: var(--ink); }
html.vb-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .tile video, .vb__box iframe { transition: none; } }

/* Home loader (neo-home only): a white screen where Kurimanju drops in at the center and glides left while
   "AJ Sangle" rises in letter by letter, then the screen fades away and the page's own reveal plays.
   The head script adds html.has-loader (first visit in a tab, or a reload; never with reduced motion), the
   script after .loader runs it. While html.loader-hold is on, the page's reveal waits. */
.loader { display: none; }
.loader .loader__kuri, .loader .loader__line > span { opacity: 0; }
html.has-loader .loader { display: flex; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; background: #fff; }
.loader.is-out { opacity: 0; transition: opacity .5s ease; }
html.loader-hold .appear { animation-play-state: paused; }
/* Optical centering. Kurimanju's body (without the "?") is centered at 57.2% / 63% of the image, 7px below the
   box center at 56px, so the mark moves up 7px to put the body on the screen's center line, and the two-line name
   moves down 7px so the middle of its text block (top of "Welcome" to the baseline of "portfolio!", descenders
   left out) sits on that same line. At 56px the bean's body is about as tall as the text block (41 vs 38px).
   Left and right ink edges are already even (measured), so nothing moves sideways. The name matches the
   page's .name (20/24, -0.03em). */
.loader__mark { position: relative; top: -7px; display: flex; align-items: center; gap: 12px; }
.loader__kuri { position: relative; z-index: 1; width: 56px; height: 56px; transform-origin: 57.2% 63%; }  /* above the letters it uncovers */
.loader__name { position: relative; top: 7px; font-size: 20px; line-height: 24px; letter-spacing: -0.03em; white-space: pre; }
.loader__line { display: block; }
.loader__line > span { display: inline-block; }
