/* ─────────────────────────────────────────────────────────────
   Liam Loh — personal site
   Shared editorial stylesheet
───────────────────────────────────────────────────────────── */

:root {
  --paper: #f6f3ec;
  --paper-edge: #ede9df;
  --ink: #1a1a1a;
  --ink-soft: #2c2a27;
  --muted: #807a72;
  --muted-strong: #5a544c;
  --rule: #d9d3c5;
  --rule-strong: #bdb6a4;
  --accent: oklch(0.55 0.13 40);
  --accent-hover: oklch(0.45 0.14 40);
}

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

html, body { margin: 0; padding: 0; }
html { background: var(--paper); }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
  font-size: 19px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variation-settings: "opsz" 16;
}

::selection { background: var(--accent); color: var(--paper); }

.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.74em;
  letter-spacing: 0.02em;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .12s ease, text-decoration-color .12s ease;
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ── page frame ────────────────────────────────── */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 32px 160px;
}

/* ── header / nav ──────────────────────────────── */
header.site {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 64px;
}
header.site .brand {
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.01em;
}
header.site .brand a { text-decoration: none; }
header.site nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
header.site nav a {
  text-decoration: none;
  color: var(--muted-strong);
  font-size: 14px;
  position: relative;
  padding-bottom: 2px;
}
header.site nav a:hover { color: var(--accent); }
header.site nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 500;
}
header.site nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -19px;
  height: 1px;
  background: var(--ink);
}
/* ── floating quick-links stack ──────────────────── */
.fab-stack {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 6px 20px rgba(26, 26, 26, 0.25);
  transition: background 0.15s ease, transform 0.15s ease;
}
.fab-icon svg { width: 18px; height: 18px; fill: currentColor; }
.fab-icon:hover {
  background: var(--accent);
  transform: translateY(-2px);
}
@media (max-width: 640px) {
  .fab-stack { right: 16px; bottom: 16px; gap: 8px; }
  .fab-icon { width: 38px; height: 38px; }
  .fab-icon svg { width: 16px; height: 16px; }
}

/* ── page-title (used on inner pages) ──────────── */
.page-title {
  margin: 0 0 8px;
  font-size: 36px;
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 36;
}
.page-title em { font-style: italic; color: var(--ink-soft); }
.page-kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 14px;
}
.page-lede {
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 56px;
  max-width: 60ch;
}

/* ── section heading ───────────────────────────── */
h2.section {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 80px 0 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
h2.section .aside {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: none;
}

/* ── intro / hero ──────────────────────────────── */
.intro {
  display: block;
}
.intro-header {
  display: flex;
  flex-direction: row;
  gap: 32px;
  align-items: center;
  margin-bottom: 24px;
}
.intro h1 {
  font-family: 'Newsreader', serif;
  font-weight: 400;
  font-size: 38px;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
  font-variation-settings: "opsz" 36;
}
.intro h1 em { font-style: italic; font-weight: 400; color: var(--ink-soft); }
.intro p {
  margin: 0 0 18px;
  font-size: 19.5px;
  line-height: 1.62;
  color: var(--ink-soft);
}
.intro p:last-of-type { margin-bottom: 0; }
.intro .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin-top: 30px;
  font-size: 13.5px;
  color: var(--muted-strong);
}
.intro .meta span::before {
  content: "↳";
  color: var(--muted);
  margin-right: 6px;
}

/* ── portrait ──────────────────────────────────── */
.portrait {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background-image: url('assets/wutong.jpg');
  background-size: cover;
  background-position: center 25%;
  border: 1px solid var(--rule-strong);
  flex-shrink: 0;
}

/* ── bio intro (about page) ────────────────────── */
.bio-intro {
  display: flex;
  flex-direction: row;
  gap: 40px;
  align-items: start;
}

/* ── home avatar ───────────────────────────────── */
.portrait--home {
  background-image: url('assets/github.jpg');
  background-position: center 10%;
  width: 180px;
  height: 180px;
  border-radius: 16px;
}

/* ── about page portrait ───────────────────────── */
.portrait--about {
  background-image: url('assets/umh_pic.jpg');
}

/* ── featured projects ─────────────────────────── */
.features { display: flex; flex-direction: column; gap: 64px; }
.feature {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.feature .plate {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: var(--paper-edge);
  border: 1px solid var(--rule-strong);
  position: relative;
  overflow: hidden;
}
.feature .plate::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.18) 100%);
  z-index: 2;
  pointer-events: none;
}

/* ── carousel slides ───────────────────────────── */
.plate .slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 1;
}
.plate .slide.active { opacity: 1; }

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 30px;
  height: 30px;
  background: rgba(246, 243, 236, 0.88);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, opacity 0.15s;
  opacity: 0;
}
.plate:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: var(--paper); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-btn[data-hidden] { display: none; }

.plate .label {
  z-index: 3;
}
.plate .corner {
  z-index: 3;
}

.feature .plate .label {
  position: absolute;
  left: 12px; bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink);
  letter-spacing: 0.04em;
  background: var(--paper);
  opacity: 0.87;
  padding: 4px 8px;
  border: 1px solid var(--rule);
}
.feature .plate .corner {
  position: absolute;
  right: 12px; top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.feature .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.feature .name {
  font-size: 26px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.005em;
}
.feature .name em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted-strong);
  margin-left: 8px;
  font-size: 0.78em;
}
.feature .laurel {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted-strong);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.feature .summary {
  font-size: 18px;
  line-height: 1.58;
  color: var(--ink-soft);
  margin: 0;
}
.feature .bullets {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 28px;
  font-size: 15px;
  color: var(--muted-strong);
}
.feature .bullets li {
  position: relative;
  padding-left: 16px;
  line-height: 1.45;
}
.feature .bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--muted);
  font-size: 11px;
  top: 2px;
}
.feature .stack {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
  padding-top: 6px;
  border-top: 1px dashed var(--rule);
}
.feature .stack span + span::before {
  content: "·";
  margin: 0 6px;
  color: var(--rule);
}

/* ── more projects (compact list) ──────────────── */
.projects { list-style: none; padding: 0; margin: 0; }
.projects li {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 28px;
  padding: 18px 0;
  border-bottom: 1px dashed var(--rule);
  align-items: baseline;
}
.projects li:last-child { border-bottom: none; }
.projects .year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.projects .name {
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
}
.projects .name em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted-strong);
  margin-left: 6px;
}
.projects .desc {
  grid-column: 2;
  margin: 4px 0 0;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--muted-strong);
}
.projects .award {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: right;
  padding-top: 2px;
}

/* ── writing list ──────────────────────────────── */
.writing { list-style: none; padding: 0; margin: 0; }
.writing li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 28px;
  padding: 22px 0;
  border-bottom: 1px dashed var(--rule);
  align-items: baseline;
}
.writing li:last-child { border-bottom: none; }
.writing .date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding-top: 4px;
}
.writing .post-title {
  font-size: 22px;
  line-height: 1.3;
  margin: 0 0 6px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.writing .post-title a { text-decoration: none; color: var(--ink); }
.writing .post-title a:hover { color: var(--accent); }
.writing .dek {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--muted-strong);
}
.writing .tags {
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.writing .tags span + span::before {
  content: "·";
  margin: 0 6px;
  color: var(--rule);
}

/* ── experience ────────────────────────────────── */
.experience { display: flex; flex-direction: column; gap: 36px; }
.role { display: grid; grid-template-columns: 130px 1fr; gap: 24px; }
.role .when {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding-top: 6px;
}
.role .when small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.role .title {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 2px;
  letter-spacing: -0.005em;
}
.role .at {
  margin: 0 0 12px;
  font-style: italic;
  color: var(--muted-strong);
  font-size: 16px;
}
.role ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.role ul li {
  padding-left: 16px;
  position: relative;
}
.role ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--muted);
}

/* ── skills ────────────────────────────────────── */
.skills {
  display: grid;
  grid-template-columns: 130px 1fr;
  row-gap: 18px;
  column-gap: 24px;
}
.skills dt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 4px;
}
.skills dd {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.skills dd em {
  font-style: italic;
  color: var(--muted-strong);
}

/* ── education ─────────────────────────────────── */
.education-list { display: flex; flex-direction: column; gap: 28px; }
.school {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
}
.school .yr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding-top: 4px;
}
.school .name {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
}
.school .name em {
  display: block;
  font-style: italic;
  font-weight: 400;
  color: var(--muted-strong);
  font-size: 16px;
  margin-top: 2px;
}
.school .extra {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted-strong);
}

/* ── prose blocks ──────────────────────────────── */
.prose p {
  margin: 0 0 18px;
  color: var(--ink-soft);
}
.prose p:last-child { margin-bottom: 0; }

/* ── pull quote ────────────────────────────────── */
.pull {
  margin: 56px 0 0;
  padding: 24px 0 24px 28px;
  border-left: 2px solid var(--rule-strong);
  font-size: 22px;
  line-height: 1.4;
  font-style: italic;
  color: var(--ink);
  font-variation-settings: "opsz" 24;
}
.pull footer {
  margin-top: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── contact CTA strip ─────────────────────────── */
.contact-strip {
  margin-top: 36px;
  padding: 28px;
  background: var(--paper-edge);
  border: 1px solid var(--rule-strong);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
.contact-strip .ask {
  font-size: 20px;
  line-height: 1.35;
  color: var(--ink);
  font-style: italic;
  margin: 0;
}
.contact-strip .cta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 18px;
  border: 1px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.contact-strip .cta:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ── teaser row (used on landing) ──────────────── */
.teaser-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.teaser-row .tease {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 28px;
  padding: 18px 0;
  border-bottom: 1px dashed var(--rule);
  align-items: baseline;
  text-decoration: none;
  color: inherit;
}
.teaser-row .tease:last-child { border-bottom: none; }
.teaser-row .tease:hover .tt { color: var(--accent); }
.teaser-row .tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.teaser-row .tt {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: color .12s ease;
}
.teaser-row .tt em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted-strong);
  margin-left: 6px;
  font-size: 0.85em;
}
.teaser-row .arrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--muted);
}
.see-all {
  margin-top: 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

/* ── awards page ───────────────────────────────── */
.year-block {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 28px;
  padding: 36px 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.year-block:last-child { border-bottom: none; }
.year-block .yr-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 1;
  padding-top: 6px;
}
.year-block .yr-label small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 8px;
}
.awards-rich {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.award-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
}
.award-item .rank {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  margin-top: 6px;
}
.award-item > div {
  grid-column: 1;
  grid-row: 1;
}
.award-item .rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  padding: 5px 9px 4px;
  white-space: nowrap;
  min-width: 108px;
  text-align: center;
}
.award-item .rank.muted {
  background: var(--muted-strong);
}
.award-item .rank.accent {
  background: var(--accent);
}
.award-item h3 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.award-item h3 em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted-strong);
}
.award-item .event {
  margin: 0 0 8px;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.award-item .blurb {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.award-item .blurb a { color: var(--ink); }

/* ── footer ────────────────────────────────────── */
footer.site {
  margin-top: 120px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
footer.site a { color: var(--muted-strong); }
.footer-links {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* ── contact strip social row ──────────────────── */
.contact-social {
  grid-column: 1 / -1;
  display: flex;
  gap: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.contact-social a {
  color: var(--muted-strong);
  text-decoration: none;
}
.contact-social a:hover { color: var(--accent); }

/* ── page transition (View Transitions API) ─────── */
@view-transition {
  navigation: auto;
}
::view-transition-old(root) {
  animation: vt-fade-out 0.18s ease forwards;
}
::view-transition-new(root) {
  animation: vt-fade-in 0.22s ease forwards;
}
@keyframes vt-fade-out {
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes vt-fade-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* ── scroll entrance animation ─────────────────── */
.will-animate {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.will-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── responsive ────────────────────────────────── */
@media (max-width: 720px) {
  .page { padding: 36px 22px 100px; }
  header.site { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 48px; }
  header.site nav { gap: 16px 18px; }
  header.site nav a[aria-current="page"]::after { display: none; }

  .intro-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .bio-intro { flex-direction: column; gap: 20px; }
  .portrait { width: 110px; height: 110px; }
  .portrait--home { width: 120px; height: 120px; border-radius: 12px; }
  .intro h1, .page-title { font-size: 30px; }

  .writing li, .projects li, .role, .skills, .school,
  .teaser-row .tease, .year-block {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .projects .award, .feature .laurel { text-align: left; }
  .projects .desc { grid-column: 1; }
  .feature .bullets { grid-template-columns: 1fr; }
  .contact-strip { grid-template-columns: 1fr; }
  .year-block { padding: 24px 0; }
  .year-block .yr-label { font-size: 22px; }
}
