/* Ashton Z. Shu, portfolio site
   Layout after the Daikoku Design Institute site: a full-bleed slideshow on the home page,
   a quiet header, image grids that show names on hover, one centered text column.
   Inter at regular weight throughout; Poppins 800 only for "Ashton is" on the first slide. */

:root {
  --ink: #111;
  --ink-2: #444;     /* secondary text, e.g. résumé details */
  --muted: #6b6b6b;
  --paper: #fff;
  --soft: #f2f2f2;
  --gutter: clamp(16px, 3.5vw, 50px);
  --head-top: clamp(20px, 3.5vw, 50px);
  --frame: 1240px;   /* home grid, footer, breadcrumb */
  --wide: 1080px;    /* project images */
  --text: 704px;     /* text column */
  --fs: clamp(16px, .19vw + 15.3px, 18px);
  --fs-ui: clamp(15px, .65vw + 12.6px, 22px);
  --fs-mid: clamp(20px, .77vw + 16.9px, 28px);
  --fs-big: clamp(26px, 1.53vw + 20px, 42px);
  --g: clamp(12px, 1.7vw, 24px);
  --head-h: calc(var(--head-top) + 1.2 * var(--fs-ui) + 14px);   /* js/site.js replaces it with the measured height */
  --ease: cubic-bezier(.4, 0, .2, 1);
  color-scheme: light;
}

/* ---------- light / dark ---------- */
:root[data-theme="dark"] { --ink: #f2f2f2; --ink-2: #c6c6c6; --muted: #a3a3a3; --paper: #0d0d0d; --soft: #1a1a1a; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ink: #f2f2f2; --ink-2: #c6c6c6; --muted: #a3a3a3; --paper: #0d0d0d; --soft: #1a1a1a; color-scheme: dark; }
  :root:not([data-theme="light"]) img[src$="mark.png"] { filter: invert(1); }
}
:root[data-theme="dark"] img[src$="mark.png"] { filter: invert(1); }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--fs);
  line-height: 1.5;
  text-wrap: pretty;
  orphans: 3;
  widows: 3;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { margin: 0; font-size: inherit; font-weight: 400; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; transition: opacity .3s var(--ease); }
:focus-visible { outline: 1.5px solid currentColor; outline-offset: 4px; }

.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 30;
  background: var(--ink); color: var(--paper); padding: 10px 16px; text-decoration: none;
}
.skip:focus { top: 12px; }

.frame { width: min(100% - 2 * var(--gutter), var(--frame)); margin-inline: auto; }

/* text link with an arrow that opens up on hover */
.arrow-link { font-size: var(--fs-ui); text-decoration: none; }
.arrow-link::after { content: "\2192"; display: inline-block; margin-left: .4em; transition: margin .3s var(--ease); }
.arrow-link:hover { opacity: .3; }
.arrow-link:hover::after { margin-left: .9em; }

/* ---------- header ---------- */

/* always on screen: see-through over the slideshow or a project's hero image,
   a compact bar of page colour with a hairline once the page scrolls under it (js/site.js) */
.site-header {
  position: fixed; top: 0; right: 0; left: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px;
  padding: var(--head-top) var(--gutter) 14px;
  border-bottom: 1px solid transparent;
  font-size: var(--fs-ui);
  line-height: 1.2;
  color: var(--ink);
  transition: padding .3s var(--ease), color .4s var(--ease), background-color .3s var(--ease), border-color .3s var(--ease);
}
.site-header.is-stuck {
  padding-top: min(var(--head-top), 16px);
  background: var(--paper);
  border-bottom-color: color-mix(in srgb, var(--ink) 16%, transparent);
}
.site-header:not(.is-stuck) { pointer-events: none; }   /* see-through: clicks reach the image below */
.site-header :is(.wordmark, .site-nav a, .theme-toggle) {
  pointer-events: auto;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity .3s var(--ease), background-color .3s var(--ease);
}
.site-header :is(.wordmark, .site-nav a, .theme-toggle):hover { opacity: .3; }
.wordmark { letter-spacing: .01em; }
.site-nav ul { display: flex; align-items: center; gap: 0 .9em; }
.site-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .3em; }

/* light / dark switch: moon or sun with its word; on phones the icon alone */
.theme-toggle {
  display: inline-flex; align-items: center; gap: .35em;
  margin-left: .35em; padding: 0; border: 0;
  background: none; cursor: pointer;
}
.theme-toggle svg { width: .85em; height: .85em; flex: none; }
.theme-toggle[data-mode="dark"] .ti-moon,
.theme-toggle:not([data-mode="dark"]) .ti-sun { display: none; }
@media (max-width: 639px) {
  .theme-toggle {
    justify-content: center;
    width: 30px; height: 30px; margin-left: .15em;
    border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
    border-radius: 50%;
  }
  .theme-toggle svg { width: 15px; height: 15px; }
  .theme-toggle .tt-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}
@media (max-width: 379px) {
  .site-header { column-gap: 12px; }
  .site-nav ul { gap: 0 .7em; }
}

/* over a hero the words take its tone; over a busy image they sit on small white blocks */
.site-header.is-over[data-tone="dark"] { color: #fff; }
.site-header.is-over:is([data-tone="light"], [data-tone="mixed"]) { color: #111; }
.site-header.is-over[data-tone="mixed"] :is(.wordmark, .site-nav a, .theme-toggle) { background: #fff; }

html { scroll-padding-top: calc(var(--head-h) + 16px); }

/* pages without a hero start below the header */
.page { padding-top: calc(var(--head-h) + clamp(32px, 3.2vw, 46px)); }

/* email and social links: a small line icon before the name */
.icon-link { display: inline-flex; align-items: center; gap: .5em; }
.icon-link svg, .big-link svg { width: 1em; height: 1em; flex: none; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: clamp(96px, 10.4vw, 150px);
  padding: clamp(40px, 4.2vw, 60px) var(--gutter) clamp(56px, 11vw, 160px);
  background: var(--soft);
  font-size: clamp(15px, .29vw + 13.9px, 18px);
  line-height: 1.5;
}
.crumbs + .site-footer { margin-top: clamp(32px, 3.5vw, 50px); }
.foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px 32px;
  width: min(100%, var(--frame));
  margin-inline: auto;
}
.foot a { text-decoration: none; }
.foot a:hover { opacity: .3; }
.foot-sig .mark { width: 36px; height: 36px; margin-bottom: 14px; }
.foot-based { margin-top: .35em; color: var(--muted); font-size: .85em; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 48px; }
.foot-links ul + ul { margin-top: 0; }
.foot-top { margin-top: 8px; }
.foot-top a::before { content: "\2191"; display: inline-block; margin-right: .5em; transition: transform .3s var(--ease); }
.foot-top a:hover::before { transform: translateY(-.3em); }
.copy { color: var(--muted); }

@media (min-width: 768px) {
  .foot { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.75fr) auto; }
  .foot-links { flex-direction: column; gap: 18px; }
  .foot-top { grid-column: 1; margin-top: 40px; }
  .copy { grid-column: 3; align-self: end; }
}

/* ---------- breadcrumb ---------- */

.crumbs {
  width: min(100% - 2 * var(--gutter), var(--frame));
  margin: clamp(96px, 10.4vw, 150px) auto 0;
  font-size: 16px;
  line-height: 1.3;
}
.crumbs ol { display: flex; flex-wrap: wrap; }
.crumbs li + li::before { content: "/"; padding: 0 .35em; color: var(--muted); opacity: .6; }
.crumbs a { color: var(--muted); text-decoration: underline; }
.crumbs a:hover { color: var(--ink); }

/* ---------- home: slideshow ---------- */

.show {
  --cap-pad: clamp(22px, 3vw, 44px);
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 440px;
  overflow: hidden;
  background: var(--soft);
  color: var(--ink);
  transition: color .4s var(--ease);
}
.show[data-tone="dark"] { color: #fff; }
.show[data-tone="light"] { color: #111; }

.slides { position: absolute; inset: 0; }
.slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; background: var(--bg, var(--soft)); }
.slide.is-active { z-index: 2; opacity: 1; visibility: visible; transition: opacity .6s ease-out; }
.slide.is-prev { z-index: 1; opacity: 1; visibility: visible; }
.slide[data-href] { cursor: pointer; }
.slide img { width: 100%; height: 100%; object-fit: cover; transform: scale(var(--zoom, 1)); }
/* on tall or square screens the whole artwork shows on its own ground colour instead of being cut,
   enlarged by --pz as far as its own margins allow */
@media (max-aspect-ratio: 155/100) { .slide.is-fit img { object-fit: contain; transform: scale(var(--pz, 1)); } }

/* the first slide: "Ashton is ..." (index.html script), set as on the earlier home page:
   Poppins 800 over a light Inter phrase, on the page gutter, vertically centred.
   It stays readable to screen readers when hidden. */
.slide-intro {
  display: grid;
  align-items: center;
  justify-items: start;
  padding: 0 var(--gutter);
  visibility: visible;
  background: var(--soft);
}
.is-line {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: clamp(44px, 8.2vw, 128px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.01em;
  color: var(--ink);
}
.is-static { display: block; font-weight: 800; }
.is-cycle {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  letter-spacing: -.02em;
  transition: opacity .3s ease, transform .3s ease;
}
.is-cycle.is-out { opacity: 0; transform: translateY(-.16em); }

.show-caption {
  position: absolute; z-index: 3; bottom: 0; left: var(--gutter);
  max-width: calc(100% - 2 * var(--gutter) - 176px);
  font-size: clamp(16px, .19vw + 15.3px, 18px);
  line-height: 1.2;
  transition: opacity .3s var(--ease);
}
.show-caption.is-out { opacity: 0; transition-duration: .2s; }
.show-caption a { display: inline-block; padding: var(--cap-pad) 0; text-decoration: none; }
.show-caption a[hidden] { display: none; }
.show-caption a::after { content: "\2192"; margin-left: .3em; transition: margin .3s var(--ease); }   /* inline, so the arrow never wraps alone */
.show-caption a:hover { opacity: .3; }
.show-caption a:hover::after { margin-left: .9em; }

.show-nav { position: absolute; z-index: 3; right: calc(var(--gutter) - 9px); bottom: calc(var(--cap-pad) - 2px); display: flex; }
.show-nav button {
  display: grid; place-items: center;
  width: 24px; height: 24px; padding: 0; border: 0;
  background: none; cursor: pointer;
}
.show-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease);
}
.show-dot[aria-current="true"]::before { background: transparent; box-shadow: 0 0 0 1px currentColor; }
.show-dot:hover::before { box-shadow: 0 0 0 1px currentColor; }
.show-pause { margin-left: 4px; }
.show-pause::before { content: ""; width: 6px; height: 8px; border-right: 2px solid; border-left: 2px solid; }
.show-pause.is-paused::before { width: 0; height: 0; border-style: solid; border-width: 4.5px 0 4.5px 7px; border-color: transparent transparent transparent currentColor; }

/* ---------- home: statement and selected work ---------- */

.intro { padding: clamp(64px, 6.1vw, 88px) var(--gutter) 0; text-align: center; }
.statement { max-width: 22em; margin-inline: auto; font-size: var(--fs-big); line-height: 1.3; letter-spacing: -.012em; }
.statement-sub { margin-top: clamp(16px, 2.5vw, 36px); }

.home-work { margin-top: clamp(64px, 7.6vw, 110px); }
.more { margin-top: clamp(32px, 3vw, 44px); }

/* ---------- image cards (home, archive, next project) ---------- */

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(40px, 4.9vw, 70px) clamp(24px, 5.6vw, 80px);
}
@media (min-width: 600px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card a { display: block; text-decoration: none; }
.thumb { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--soft); transition: background-color .3s var(--ease); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: opacity .3s var(--ease); }
.card figcaption { margin-top: 12px; }
.card-name { display: block; line-height: 1.3; }
.card-sub { display: block; margin-top: .15em; color: var(--muted); font-size: .875em; }

/* names only on hover, the image fading back to the page */
@media (hover: hover) and (pointer: fine) {
  .is-hover .card figure { position: relative; }
  .is-hover .card figcaption {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin: 0; padding: 16px;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .3s var(--ease), transform .3s var(--ease);
  }
  .is-hover .card-name { font-size: clamp(18px, .6vw + 15.4px, 24px); }
  .is-hover .card-sub { font-size: 15px; }
  .is-hover .card a:is(:hover, :focus-visible) .thumb { background: var(--paper); }
  .is-hover .card a:is(:hover, :focus-visible) img { opacity: .08; }
  .is-hover .card a:is(:hover, :focus-visible) figcaption { opacity: 1; transform: none; }
}

/* ---------- work archive ---------- */

.archive + .archive { margin-top: clamp(80px, 9.2vw, 132px); }
.group { margin-bottom: clamp(20px, 2.5vw, 36px); font-size: var(--fs-ui); }
@media (min-width: 600px) { .archive .cards { gap: clamp(40px, 3.5vw, 50px) clamp(24px, 4.2vw, 60px); } }
@media (min-width: 992px) { .archive .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- project pages ---------- */

/* on phones the hero starts below the header; from 768px it runs under it, as on the home page */
.p-hero { position: relative; margin-top: var(--head-h); background: var(--hero-bg, var(--soft)); }
.p-hero img { width: 100%; }
/* artwork that should not be cropped sits whole on a plain band */
.p-hero.is-fit { padding: var(--gutter); }

@media (min-width: 768px) {
  .p-hero { height: min(50vw, 80vh); margin-top: 0; }
  .p-hero img { height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); }
  .p-hero.is-fit { padding: calc(var(--head-h) + 10px) var(--gutter); }
  .p-hero.is-fit img { object-fit: contain; }
}

.p-head { width: min(100% - 2 * var(--gutter), 924px); margin: clamp(48px, 6.1vw, 88px) auto 0; text-align: center; }
.p-head h1 { font-size: var(--fs-big); line-height: 1.3; letter-spacing: -.012em; }
.p-sub { margin-top: .6em; }
.p-meta { margin-top: .2em; color: var(--muted); }

.p-text, .p-cap { width: min(100% - 2 * var(--gutter), var(--text)); margin-inline: auto; }
.p-text { margin-top: clamp(32px, 3.5vw, 50px); }
.p-text p + p, .p-cap p + p { margin-top: 1em; }

.p-sec { margin-top: clamp(64px, 9.2vw, 132px); }
.p-art { display: flex; flex-direction: column; gap: var(--g); width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto; }
.p-art img { width: 100%; }
.p-cap { padding-top: clamp(20px, 3vw, 44px); }

/* rows where every image gets the same height */
.row { display: flex; gap: var(--g); }
.row > img { flex: var(--ar) 1 0%; width: 0; min-width: 0; }
.l1r2 { display: flex; gap: var(--g); }
.l1r2 .l { position: relative; flex: var(--ar) 1 0%; min-width: 0; }
.l1r2 .l img { position: absolute; inset: 0; height: 100%; object-fit: cover; }
.l1r2 .r { display: flex; flex-direction: column; gap: var(--g); flex: var(--ar) 1 0%; min-width: 0; }

.p-more { width: min(100% - 2 * var(--gutter), var(--wide)); margin: clamp(96px, 10.4vw, 150px) auto 0; }
.p-more .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px clamp(16px, 4.2vw, 60px); }
.p-dir { display: block; color: var(--muted); font-size: .875em; }
.p-all { margin-top: clamp(48px, 5vw, 72px); text-align: center; }

/* ---------- about ---------- */

.a-head { width: min(100% - 2 * var(--gutter), 924px); margin-inline: auto; text-align: center; }
.a-head h1 { font-size: var(--fs-big); line-height: 1.3; letter-spacing: -.012em; }
.a-head p { margin-top: clamp(12px, 2vw, 28px); }

.a-bio { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: clamp(56px, 7.6vw, 110px); }
.portrait { width: clamp(120px, 12.5vw, 180px); aspect-ratio: 1; object-fit: cover; }
.a-bio-text p + p { margin-top: 1em; }

.resume { margin-top: clamp(80px, 9.2vw, 132px); }
.resume > h2 { margin-bottom: clamp(36px, 4.4vw, 64px); font-size: var(--fs-big); line-height: 1.3; text-align: center; }
/* three levels: section heading on a hairline, item title (role and organisation)
   with place and dates under it, then the detail in a quieter ink. Items sit further
   apart than the lines inside an item, and sections twice as far again. */
.rcols {
  --item-gap: clamp(24px, 2.1vw, 30px);
  --sec-gap: calc(var(--item-gap) * 2.2);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sec-gap) clamp(32px, 4.2vw, 60px);
}
.rcols h3 {
  margin-bottom: calc(var(--item-gap) * .85);
  padding-top: .45em;
  border-top: 1px solid var(--ink);
  font-size: clamp(22px, .58vw + 19.6px, 28px);
  line-height: 1.2;
  letter-spacing: -.01em;
}
.rcols h3:not(:first-child) { margin-top: var(--sec-gap); }
.skills { margin: 0; }
.jobs li + li, .skills div + div, .plain li + li { margin-top: var(--item-gap); }
.jobs h4, .skills dt, .plain li { font-size: clamp(17.5px, .24vw + 16.5px, 20px); font-weight: 500; line-height: 1.3; }
.jobs .org { display: block; font-weight: 400; }
.jobs .meta { margin-top: .35em; color: var(--muted); font-size: clamp(14px, .1vw + 13.6px, 15px); }
.jobs p:not(.meta), .skills dd { max-width: 31em; margin: .6em 0 0; color: var(--ink-2); line-height: 1.6; }

@media (min-width: 768px) {
  .a-bio { grid-template-columns: clamp(120px, 12.5vw, 180px) minmax(0, 1fr); gap: 40px; }
}
@media (min-width: 992px) {
  .a-bio-text { columns: 2; column-gap: clamp(40px, 4.2vw, 60px); }
  .rcols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- contact ---------- */

.c-links { margin-top: clamp(40px, 5vw, 72px); text-align: center; }
.c-links h2 { color: var(--muted); }
.c-links h2:not(:first-child) { margin-top: clamp(32px, 3.5vw, 50px); }
.c-links p { margin-top: .3em; }
.big-link { display: inline-flex; align-items: center; gap: .45em; font-size: var(--fs-mid); text-decoration: none; }
.big-link svg { width: .8em; height: .8em; }
.big-link:hover { opacity: .3; }

.contact-form { width: min(100% - 2 * var(--gutter), var(--text)); margin: clamp(80px, 9.2vw, 132px) auto 0; }
.contact-form h2 { margin-bottom: 8px; font-size: var(--fs-mid); text-align: center; }
.contact-form label { display: block; margin: 24px 0 8px; color: var(--muted); }
.contact-form input,
.contact-form textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.contact-form textarea { min-height: 180px; resize: vertical; }
.contact-form input:focus-visible,
.contact-form textarea:focus-visible { outline-offset: 2px; }
.send { margin-top: 32px; padding: 0; border: 0; background: none; cursor: pointer; }
.hint, .status { margin-top: 16px; color: var(--muted); font-size: 15px; }
.status:empty { display: none; }

/* ---------- smaller screens ---------- */

@media (max-width: 639px) {
  .row, .l1r2 { flex-direction: column; }
  .row > img { flex: none; width: 100%; }
  .l1r2 .l, .l1r2 .r { flex: none; }
  .l1r2 .l img { position: static; height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header, .slide.is-active, .is-cycle, .show-caption, .thumb img, .card figcaption { transition: none !important; }
}
