/* The main page, section by section. */

/* Hero -------------------------------------------------------------- */
/* The name, split around the arc reactor (reactor.css), then the
   headline, the lede, the two pills and the credentials. --core is the
   reactor's diameter; the name's two words sit either side of it. */
.hero {
  --core: clamp(240px, 30vw, 440px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav) - var(--nav-top));
  min-height: calc(100svh - var(--nav) - var(--nav-top));
  position: relative;
  isolation: isolate;
  /* Clipped at the sides only (the reactor's canvas overhangs on phones);
     above and below its glow may spill, so it never ends in a hard line. */
  overflow: hidden;
  overflow: clip visible;
  padding: 32px var(--gutter) 64px;
  text-align: center;
}

.hero__stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 1240px;
  height: var(--core);
}

.hero__name {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: calc(var(--core) * 0.8);
  align-items: center;
  width: 100%;
  font-size: clamp(64px, 12.4vw, 196px);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.055em;
  pointer-events: none;
}

.hero__name span:first-child { justify-self: end; }
.hero__name span:last-child { justify-self: start; }

/* The reactor's canvas reaches past the stage; the text below sits over it. */
.hero__title,
.hero__lede,
.hero__actions {
  position: relative;
  z-index: 2;
}

.hero__title {
  margin-top: 28px;
  font-size: clamp(30px, 3.6vw, 54px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.hero__title .serif {
  font-size: 1.1em;
  text-shadow: 0 0 0.6em var(--accent-glow);
}

.hero__lede {
  max-width: 36em;
  text-wrap: balance;
  margin-top: 18px;
  color: var(--muted);
  font-size: var(--t-lede);
  line-height: 1.55;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}

.hero__creds {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 36px;
  margin-top: 48px;
  color: var(--dim);
}

.hero__creds b {
  margin-right: 0.4em;
  color: var(--muted);
  font-weight: 400;
}

@media (max-width: 719px) {
  .hero {
    --core: min(280px, 72vw);
    padding-top: 24px;
  }

  /* On a phone the reactor comes first, then the name on one line. */
  .hero__stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: auto;
  }

  .hero__name {
    display: block;
    margin-top: 8px;
    font-size: clamp(52px, 16vw, 84px);
  }

  .hero__title {
    margin-top: 20px;
  }

  .hero__actions {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
  }

  .hero__creds {
    flex-direction: column;
    gap: 8px;
    margin-top: 44px;
  }
}

/* Load (or, behind the gate, waking): the name rises either side of the
   reactor as it powers on, then everything under it follows. */
@media (prefers-reduced-motion: no-preference) {
  :root:not(.gated) .hero__name span {
    animation: rise 1s var(--ease-out) 200ms backwards;
  }

  .hero__name span:last-child { animation-delay: 300ms; }

  :root:not(.gated) .hero > :not(.hero__stage, .hero__title, .hero__lines) {
    animation: rise 900ms var(--ease-out) backwards;
  }

  .hero > .reactor__panel { animation-delay: 700ms; }
  .hero > .hero__lede { animation-delay: 620ms; }
  .hero > .hero__actions { animation-delay: 700ms; }
  .hero > .hero__creds { animation-delay: 780ms; }
}

/* About ------------------------------------------------------------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px 72px;
  align-items: start;
}

/* On wide screens the photo stays in view while the longer text column
   scrolls past it. */
@media (min-width: 1024px) {
  .about__photo {
    position: sticky;
    top: calc(var(--nav-top) + var(--nav) + 32px);
  }
}

/* The photo, framed on the face, in the same card as the work. */
.about__photo {
  justify-self: center;
  width: 100%;
  max-width: 400px;
  overflow: hidden;
  padding: 8px;
}

.about__photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: calc(var(--radius) - 8px);
  object-fit: cover;
  object-position: 50% 30%;
}

.about__text {
  max-width: 38em; /* about 68 characters a line */
  color: var(--text-2);
}

/* Four figures from the paragraphs above, counted up once when seen. */
.proof {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 24px;
  margin-top: 48px;
}

.proof > div {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
}

.proof dd {
  order: -1;
  color: var(--text);
  font-size: clamp(32px, 3.2vw, 44px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.proof [data-count] {
  display: inline-block;
}

.proof small {
  margin-left: 4px;
  color: var(--dim);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
}

.proof dt {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 719px) {
  .proof {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
  }
}

/* The photo is wiped in from the top the first time it is seen, rather
   than faded like the rest. */
@media (prefers-reduced-motion: no-preference) {
  .js .about__photo[data-reveal] {
    opacity: 1;
    transform: none;
    clip-path: inset(0 0 100% 0 round var(--radius));
    transition: clip-path 1100ms var(--ease);
  }

  .js .about__photo[data-reveal].is-visible {
    clip-path: inset(0 0 0 0 round var(--radius));
  }
}

.about__text p + p {
  margin-top: 18px;
}

.about__statement {
  margin-bottom: 32px;
  color: var(--text);
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

@media (max-width: 1023px) {
  .about {
    grid-template-columns: minmax(0, 1fr);
  }

  .about__photo {
    max-width: 360px;
  }
}

@media (max-width: 719px) {
  .about__photo {
    max-width: 280px;
  }
}

/* Experience -------------------------------------------------------- */
/* A table of hairline rows: dates, who and what, then the points. A thin
   timeline runs down the left: a hairline track, a brighter line that
   motion.js draws down as the section scrolls past (--p, 0 to 1; whole
   when motion is reduced), and a node per role that lights as the role
   comes into view. */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before,
.timeline__fill {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 1px;
  background: var(--line-2);
}

.timeline__fill {
  background: var(--muted);
  transform: scaleY(var(--p, 1));
  transform-origin: 50% 0;
}

.role {
  position: relative;
}

.role::before {
  content: "";
  position: absolute;
  top: 38px;
  left: -40px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--band);
  transition: background-color 400ms, border-color 400ms;
}

.role.is-visible::before {
  border-color: var(--text);
  background: var(--text);
}

.roles--earlier .role::before {
  top: 28px;
}

@media (max-width: 719px) {
  .timeline {
    padding-left: 28px;
  }

  .role::before {
    top: 33px;
    left: -28px;
  }
}

.roles {
  border-top: 1px solid var(--line);
}

.role {
  display: grid;
  grid-template-columns: 13rem minmax(0, 17rem) minmax(0, 1fr);
  gap: 12px 40px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}

.role__dates {
  padding-top: 5px;
  color: var(--dim);
}

.role__org {
  font-size: var(--t-card);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* The Univers logo, turned white. */
.role__logo {
  width: auto;
  height: 22px;
  margin-top: 3px;
  filter: brightness(0) invert(1);
}

.role__title {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--t-small);
  line-height: 1.5;
}

.role__points {
  color: var(--text-2);
}

ul.role__points li + li {
  margin-top: 12px;
}

.roles__earlier {
  margin: 64px 0 16px;
  color: var(--dim);
  font-weight: 400;
}

.roles--earlier .role {
  padding: 22px 0;
}

.roles--earlier .role__org {
  font-size: 17px;
}

@media (max-width: 1023px) {
  .role {
    grid-template-columns: 9.5rem minmax(0, 1fr);
  }

  .role__points {
    grid-column: 2;
  }
}

@media (max-width: 719px) {
  .role {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 28px 0;
  }

  .role__points {
    grid-column: 1;
  }
}

/* Selected work ----------------------------------------------------- */
/* A clear gap separates the huge title from the cards below it. */
.work .work__grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: clamp(40px, 4.5vw, 72px);
}

.work__grid > li {
  display: flex;
}

.work__card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 340px;
  padding: 32px;
}

.work__figure {
  margin-top: 28px;
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.work__figure [data-count] {
  display: inline-block;
}

.work__figure small {
  margin-left: 8px;
  color: var(--dim);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
}

.work__name {
  margin-top: 28px;
  font-size: var(--t-card);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.work__line {
  margin: 8px 0 28px;
  color: var(--muted);
  font-size: var(--t-small);
  line-height: 1.55;
}

.work__more {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  transition: color 200ms;
}

/* The arrow slides on hover; motion.js adds the spotlight and lift. */
.work__arrow {
  display: inline-block;
  transition: transform 300ms var(--ease-out);
}

@media (hover: hover) {
  .work__card:hover .work__more { color: var(--text); }
  .work__card:hover .work__arrow { transform: translateX(4px); }
}

@media (prefers-reduced-motion: no-preference) {
  .work__grid > li:nth-child(3n + 2) { transition-delay: 80ms; }
  .work__grid > li:nth-child(3n) { transition-delay: 160ms; }
}

@media (max-width: 1023px) {
  .work .work__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 719px) {
  /* "Selected work" stays on one line on phones. */
  .work .work__title {
    font-size: min(var(--t-title), 13vw);
    white-space: nowrap;
  }

  .work .work__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 32px;
  }

  .work__card {
    min-height: 0;
    padding: 28px 24px 24px;
  }

  .work__figure {
    font-size: 48px;
  }
}

/* Toolkit ----------------------------------------------------------- */
/* Four tabs as one segmented pill. Without tabs.js the row stays hidden
   and every panel shows, one under another. */
.kit__tabs {
  display: flex;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 56px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}

.kit__tabs[hidden] {
  display: none;
}

.kit__tab {
  flex: none;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 200ms, background-color 200ms;
}

/* The chosen tab is filled, so it is marked by more than colour. */
.kit__tab[aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
}

@media (hover: hover) {
  .kit__tab[aria-selected="false"]:hover { color: var(--text); }
}

.kit__panel + .kit__panel {
  margin-top: 56px;
}

.kit.is-ready .kit__panel {
  margin-top: 0;
}

.kit__panel:focus-visible {
  outline-offset: 8px;
}

.kit__head {
  margin-bottom: 16px;
  color: var(--dim);
  font-weight: 400;
}

.kit.is-ready .kit__head {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Each tool is its mark and name; tools without a mark are name only. */
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
}

.tools li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.tools .icon {
  color: var(--muted);
}

.rows--named dt {
  color: var(--text);
  font-size: var(--t-card);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* Logos of the schools and certificate providers, above each name. Most
   are drawn in white, like the Univers logo; the VJC crest and the NCSF
   mark keep their own colours. */
.kit__logo {
  display: block;
  width: auto;
  height: 32px;
  margin-bottom: 14px;
  object-fit: contain;
  object-position: left center;
}

.kit__logo--sutd {
  width: 94px;
  height: 22px;
  margin-bottom: 12px;
  object-fit: cover;
  object-position: top;
  filter: brightness(0) invert(1);
}

.kit__logo--white {
  height: 52px;
  filter: brightness(0) invert(1);
}

.kit__logo--round {
  height: 40px;
}

.kit__logo--wide {
  height: 38px;
}

.text-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-color 200ms;
}

@media (hover: hover) {
  .text-link:hover { text-decoration-color: var(--text); }
}

/* A newly shown panel fades and rises a little. */
@media (prefers-reduced-motion: no-preference) {
  .kit.is-ready .kit__panel:not([hidden]) {
    animation: rise 420ms var(--ease-out);
  }
}

/* On a phone the four tabs sit two by two. */
@media (max-width: 719px) {
  .kit__tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-bottom: 40px;
    border-radius: 26px;
  }

  .kit__tab {
    padding: 0 12px;
  }
}

/* Contact ----------------------------------------------------------- */
.contact {
  text-align: center;
}

.contact .contact__invite {
  margin-top: 36px;
  color: var(--muted);
  font-size: var(--t-lede);
}

.contact__email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  margin-top: 40px;
}

.contact__address {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: clamp(26px, 4.4vw, 56px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
  transition: text-decoration-color 200ms;
}

@media (hover: hover) {
  .contact__address:hover { text-decoration-color: var(--text); }
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 40px;
}
