/* James Qian — personal site. Four pages, one typeface, one accent. Follows the system theme. */

/* Switzer (Indian Type Foundry, via Fontshare; ITF Free Font License), served from here: no third-party requests */
@font-face { font-family: "Switzer"; font-weight: 400; font-style: normal; font-display: swap; src: url("assets/fonts/switzer-400.woff2") format("woff2"); }
@font-face { font-family: "Switzer"; font-weight: 500; font-style: normal; font-display: swap; src: url("assets/fonts/switzer-500.woff2") format("woff2"); }
@font-face { font-family: "Switzer"; font-weight: 600; font-style: normal; font-display: swap; src: url("assets/fonts/switzer-600.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #F2F1ED;
  --ink: #1A1A19;
  --mute: #6E6D68;
  --line: rgba(26, 26, 25, .14);
  --line-strong: rgba(26, 26, 25, .34);
  --acc: #E85A1B;
  --dust: #3F3E3B;          /* the panel's palette: a softer ink for the particles, then the colours, in tones that hold on the light ground */
  --sand: #BC8A36;
  --blue: #4668A3;
  --green: #3B8A5C;
  --red: #B8302A;
  --sky: #5F98D4;
  --graphite: #66655F;
  --sans: "Switzer", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.2, 0, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --ink: #ECEAE5;
    --mute: #8E8D88;
    --line: rgba(236, 234, 229, .14);
    --line-strong: rgba(236, 234, 229, .32);
    --acc: #F0691F;
    --dust: #C6C4BE;          /* and lighter tones on the dark ground */
    --sand: #E2BC78;
    --blue: #6F8FC4;
    --green: #5FAE7E;
    --red: #D9483C;
    --sky: #A9CEEC;
    --graphite: #8A8A86;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
img { max-width: 100%; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
main { flex: 1 0 auto; display: flex; flex-direction: column; }   /* the footer sits at the bottom of the window */

/* hairline links: one mechanism for the bio, the two profiles, the caption, and the Pause button */
.bio a, .links a, .hint a, .hint button span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
  transition: color .2s var(--ease), text-decoration-color .2s var(--ease);
}
.bio a { text-decoration-color: var(--line-strong); }
.links a { color: var(--mute); }
.bio a:hover, .links a:hover, .hint a:hover, .hint button:hover span { color: var(--ink); text-decoration-color: var(--acc); }

/* ---------- header ---------- */
.bar { display: flex; justify-content: space-between; align-items: center; height: 76px; }
.name { font-weight: 500; letter-spacing: -.01em; }
.nav { display: flex; gap: 28px; margin-left: auto; }
.nav a { position: relative; color: var(--mute); font-size: 15.5px; padding: 6px 0; transition: color .2s var(--ease); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a:focus-visible { outline-offset: 7px; }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -4px;
  width: 5px; height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--acc);
}
@media (max-width: 560px) {
  .bar { height: auto; flex-direction: column; align-items: flex-start; gap: 12px; padding: 22px 0 16px; }
  .nav { margin-left: 0; gap: 20px; }
}
@media (max-width: 380px) {
  .nav { gap: 16px; }
  .nav a { font-size: 15px; }
}

/* ---------- home: two equal halves, the text block and the square with its caption centred on each other ---------- */
.hero {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px 72px;
  align-items: center;
  padding: 40px 0;
}
.intro { max-width: 480px; }
.side { width: 100%; max-width: 480px; justify-self: end; }
.figure {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  touch-action: pan-y;
}
#diffusion { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hint {
  display: flex; justify-content: center; align-items: baseline; flex-wrap: wrap; gap: 6px 16px;
  margin: 14px 0 0; color: var(--mute); font-size: 14px; text-align: center;
}
.hint a { padding: 8px 0; }                            /* a taller hit area, same look */
.hint button { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 8px; margin: -8px; display: inline-grid; text-align: left; }
.hint button::after { content: "Pause"; visibility: hidden; height: 0; overflow: hidden; }   /* the wider label's width, so the caption never moves */
.portrait {
  display: block;
  width: 88px; height: 88px;
  object-fit: cover;
  border-radius: 3px;
  margin-bottom: 28px;
}
h1 {
  font-size: clamp(34px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.05;
  margin: 0 0 14px;
}
.lede {
  font-size: clamp(20px, 2.2vw, 24px);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -.012em;
}
.intro p { margin: 0 0 16px; text-wrap: pretty; }
.intro .lede { margin: 0 0 18px; }
.intro .links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 8px 0 0; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 16px 0 48px; align-content: center; }
  .intro { max-width: 560px; }
  .side { justify-self: center; max-width: min(420px, 70vh); }
}
@media (min-width: 901px) and (max-height: 760px) {
  .hero { padding: 16px 0; }
  .foot { padding: 20px 0; }
}

/* ---------- inner pages ---------- */
.page { max-width: 64ch; padding: 40px 0 80px; }
.page h1 { margin-bottom: 18px; }
.page:has(+ .gallery:not(:empty)) { padding-bottom: 8px; }

/* ---------- photography ---------- */
.gallery { columns: 3; column-gap: 14px; padding: 8px 0 80px; }
.gallery:empty { display: none; }
.gallery figure { margin: 0 0 14px; break-inside: avoid; }
.gallery button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.gallery img { display: block; width: 100%; height: auto; border-radius: 2px; transition: opacity .25s var(--ease); }
.gallery button:hover img { opacity: .85; }
@media (max-width: 900px) { .gallery { columns: 2; } }
@media (max-width: 480px) { .gallery { columns: 1; } }

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-rows: 1fr auto;
  background: rgba(18, 18, 17, .95);
  color: #ECEAE5;
}
.lightbox[hidden] { display: none; }
.lb-stage { display: grid; place-items: center; padding: 24px; min-height: 0; }
.lb-stage img { display: block; max-width: min(92vw, 1600px); max-height: 82vh; width: auto; height: auto; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 24px 24px; font-size: 14px; color: #8E8D88; }
.lb-nav { display: flex; gap: 8px; }
.lb-bar button {
  background: none; border: 1px solid rgba(236, 234, 229, .3); color: inherit;
  font: inherit; padding: 7px 12px; border-radius: 2px; cursor: pointer;
}
.lb-bar button:hover { color: #ECEAE5; border-color: #ECEAE5; }

/* ---------- footer ---------- */
.foot {
  margin: 0;
  padding: 32px 0;
  text-align: center;
  color: var(--mute);
  font-size: 12.5px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
