/* Jason Liu: personal site. Plain CSS, no external fonts or CDNs (they load slowly or not at all in mainland China). */

:root {
  --bg: #fbfaf6;
  --surface: #ffffff;
  --ink: #16222c;
  --muted: #5b6770;
  --line: #e4e1d8;
  --accent: #1b6f8f;       /* copper-sulfate blue, a nod to the crystals */
  --accent-deep: #0f4c63;
  --soft: #e8f2f6;
  --copper: #b4673a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 34, 44, .06), 0 8px 24px rgba(22, 34, 44, .08);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-deep); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- Header and navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(251, 250, 246, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 22px var(--serif); color: var(--ink); text-decoration: none; letter-spacing: .2px; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); }
.nav { display: flex; gap: 2px; }
.nav a {
  padding: 8px 10px; border-radius: 8px; color: var(--ink);
  text-decoration: none; font-size: 15px; white-space: nowrap;
}
.nav a:hover { background: var(--soft); }
.nav a[aria-current="page"] { color: var(--accent-deep); background: var(--soft); font-weight: 600; }
.menu-btn {
  display: none; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; font: 600 15px var(--sans); color: var(--ink); cursor: pointer;
}

@media (max-width: 1200px) {
  .menu-btn { display: inline-flex; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(22, 34, 44, .08);
  }
  .nav.open { display: flex; }
  .nav a { padding: 13px 8px; font-size: 17px; border-radius: 8px; }
}

/* ---------- Type ---------- */
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(36px, 6vw, 64px); line-height: 1.05; }
h2 { font-size: clamp(25px, 3.4vw, 32px); line-height: 1.2; }
.eyebrow { font: 600 13px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--copper); margin: 0 0 12px; }
.lead { font-size: 19px; color: #2c3a45; max-width: 36em; margin: 16px 0 0; }

.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  background: var(--accent-deep); color: #fff; text-decoration: none;
  font-weight: 600; font-size: 15px; border: 1px solid var(--accent-deep);
}
.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent-deep); }
.btn.ghost:hover { background: var(--soft); }
.btn.small { padding: 8px 16px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Home ---------- */
/* The hero is a wall of photos: six cells, each fading through its own set (see js/site.js). A dark wash at the bottom keeps the name readable. */
.hero { position: relative; isolation: isolate; overflow: hidden; background: #0c1a22; color: #fff; height: clamp(540px, 84vh, 800px); }
.wall { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; gap: 4px; }
.cell { position: relative; overflow: hidden; background: #16222c; }
.cell-a { grid-column: 1; grid-row: 1 / 3; }
.cell-b { grid-column: 2; grid-row: 1; }
.cell-c { grid-column: 2; grid-row: 2; }
.cell-d { grid-column: 3; grid-row: 1 / 3; }
.cell-e { grid-column: 4; grid-row: 1; }
.cell-f { grid-column: 4; grid-row: 2; }
.cell img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0;
  object-position: var(--pos, 50% 50%);
  opacity: 0; transform: scale(1.08);
  transition: opacity .8s ease, transform 5s ease-out;
}
.cell img.on { opacity: 1; transform: scale(1); }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(7, 18, 25, .95) 0%, rgba(7, 18, 25, .62) 34%, rgba(7, 18, 25, .1) 66%, rgba(7, 18, 25, .3) 100%);
}
.hero-text { position: absolute; z-index: 2; left: 0; right: 0; bottom: 120px; }
.hero .eyebrow { color: #f2b992; margin-bottom: 8px; }
.hero h1 { color: #fff; font-size: clamp(56px, 10vw, 132px); line-height: .95; letter-spacing: -.02em; text-shadow: 0 2px 28px rgba(0, 0, 0, .5); }
.alt-name { margin: 14px 0 0; color: rgba(255, 255, 255, .88); font-size: 17px; font-weight: 500; }
.hero-foot { position: absolute; z-index: 2; left: 0; right: 0; bottom: 22px; }
.wall-pause {
  position: absolute; z-index: 3; top: 14px; right: 14px; padding: 5px 13px; cursor: pointer;
  background: rgba(7, 18, 25, .55); color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
  font: 600 13px var(--sans);
}
.wall-pause:hover { background: rgba(7, 18, 25, .8); }

.edu {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 22px; color: var(--ink);
  background: rgba(255, 255, 255, .94); border: 1px solid var(--line); border-radius: var(--radius);
}
.edu strong { font-family: var(--serif); font-size: 19px; }
.edu span { display: block; color: var(--muted); font-size: 15px; }

.mosaic-wrap { padding: 28px 0 64px; }
.mosaic { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 190px; gap: 12px; }
.tile {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: flex-end; border-radius: var(--radius);
  background: #16222c; color: #fff; text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); z-index: -1; border-radius: 0; transition: transform .5s ease; }
.tile:hover img { transform: scale(1.05); }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 20, 28, .78), transparent 62%); }
.tile span { position: relative; z-index: 1; padding: 14px 16px; font: 600 19px var(--serif); }
.tile small { display: block; margin-top: 2px; font: 500 13px var(--sans); color: rgba(255, 255, 255, .85); }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.t-lg { grid-column: span 2; grid-row: span 2; }
.t-lg span { font-size: 26px; padding: 20px 22px; }
.t-wide { grid-column: span 2; }

@media (max-width: 800px) {
  .mosaic { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; }
}
@media (max-width: 700px) {
  .hero { height: clamp(580px, 88vh, 740px); }
  .wall { grid-template-columns: repeat(2, 1fr); }
  .cell-d, .cell-e, .cell-f { display: none; }
  .hero-text { bottom: 190px; }
  .edu { padding: 12px 16px; gap: 10px; }
  .edu strong { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .cell img { transition: none; transform: none; }
}

.contact-band { padding: 36px 0; background: var(--soft); border-top: 1px solid var(--line); }
.band { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Contact ---------- */
.contact-wrap { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 32px; align-items: start; }
.contact-photo img { aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; box-shadow: var(--shadow); }
@media (max-width: 760px) { .contact-wrap { grid-template-columns: 1fr; } .contact-photo { max-width: 240px; } }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.contact-card { padding: 26px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.contact-card h2 { margin-bottom: 12px; font: 600 13px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--copper); }
.contact-card .reveal { font: 600 20px/1.7 var(--serif); color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.contact-card a.reveal[href]:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Section pages ---------- */
.page-head { padding: 52px 0 36px; background: linear-gradient(180deg, var(--soft), transparent); border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(34px, 5vw, 52px); }

.block { padding: 44px 0 8px; }
.block + .block { padding-top: 36px; }
.block:last-of-type { padding-bottom: 72px; }
.block-note { color: var(--muted); margin: 6px 0 22px; font-size: 15px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.gallery.wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
figure { margin: 0; }
figure img, figure video { width: 100%; border-radius: var(--radius); background: #e9edef; }
figcaption { font-size: 14.5px; color: var(--muted); margin-top: 8px; line-height: 1.45; }

/* Real photos: rows of equal height, each photo keeps its own proportions (--ar = width / height) */
.photos { --row: 280px; display: flex; flex-wrap: wrap; gap: 22px; }
.photos::after { content: ""; flex-grow: 999; }
.photos.fill::after { display: none; }
.photo { margin: 0; min-width: 0; flex: var(--ar) 1 calc(var(--ar) * var(--row)); }
.photo a { display: block; overflow: hidden; border-radius: var(--radius); background: #e9edef; cursor: zoom-in; }
.photo img { width: 100%; height: auto; border-radius: 0; transition: transform .35s; }
.photo a:hover img { transform: scale(1.03); }

.split { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 56px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 40px; } }

/* Award captions: name, level, then a short description */
.photos.certs { --row: 340px; }
.photo a.link { cursor: pointer; }
.photo figcaption strong { display: block; color: var(--ink); font-weight: 600; line-height: 1.35; }
.cap-meta { display: block; margin: 3px 0 4px; font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--copper); }
.cap-desc { display: block; }

.photos + .pdf-list { margin-top: 28px; }

.single { max-width: 560px; }

/* Videos play on the page; --w keeps tall phone clips from getting taller than about 560px */
.videos { display: flex; flex-wrap: wrap; gap: 22px; }
.vid { width: min(100%, var(--w, 640px)); }
.vid video { display: block; width: 100%; height: auto; border-radius: var(--radius); background: #10202a; }
.single a { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.single img { width: 100%; border-radius: 0; }

@media (max-width: 640px) {
  .photos { --row: 200px; gap: 16px; }
}

/* Photo viewer */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 56px 16px 24px; background: rgba(10, 17, 23, .94); color: #fff;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: min(96vw, 1400px); max-height: calc(100vh - 190px); object-fit: contain; border-radius: 8px; background: none; }
.lightbox p { max-width: min(92vw, 760px); margin: 0; white-space: pre-line; text-align: center; font-size: 16px; line-height: 1.5; color: #e6eef2; }
.lb-btn {
  position: absolute; display: grid; place-items: center;
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, .26); }
.lb-btn[hidden] { display: none; }
.lb-close { top: 12px; right: 12px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
@media (max-width: 640px) {
  .lb-prev, .lb-next { top: auto; bottom: 18px; transform: none; }
  .lightbox { padding-bottom: 80px; }
}

/* Placeholder boxes used only in the layout preview */
.ph {
  aspect-ratio: 4 / 3; border-radius: var(--radius);
  display: grid; place-items: center; text-align: center; padding: 12px;
  background: repeating-linear-gradient(45deg, #eef3f5, #eef3f5 12px, #e4edf1 12px, #e4edf1 24px);
  border: 1px dashed #b3c8d1; color: #5f808e; font-size: 14px;
}
.ph.video { aspect-ratio: 16 / 9; }
.ph.video::before { content: "\25B6"; font-size: 34px; display: block; margin-bottom: 4px; color: var(--accent); }
.ph.cert { aspect-ratio: 4 / 3; }

.pdf-list { display: grid; gap: 14px; }
.pdf-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.pdf-card strong { font-family: var(--serif); font-size: 18px; }
.pdf-card span { display: block; color: var(--muted); font-size: 14.5px; }
.pdf-card .actions { display: flex; gap: 10px; }
.pdf-card.pending { border-style: dashed; background: transparent; }
.pending-tag { color: var(--muted); font-size: 14px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14.5px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
