/* Niki Tong Yuk Ying — plain HTML/CSS/vanilla JS.
   Faithful to original Wix styling:
   brand Aboreto, headings Playfair Display, body/nav Raleway. */
:root {
  --bg: #ffffff;
  --ink: #000000;
  --body: #191919;
  --muted: #4d4d4d;
  --line: #e5e5e5;
  --maxw: 980px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: "Raleway", "Helvetica Neue", Helvetica, Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 14px;
  line-height: 1.79;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: #000; color: #fff; padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* Header — one full-width line like Wix: brand left, menu + instagram right */
.site-header { background: #fff; }
.header-inner {
  display: flex; align-items: center; gap: 28px;
  padding: 16px 32px;
}
.brand {
  font-family: "Aboreto", "Playfair Display", serif;
  font-size: 24px; line-height: 1.4;
  text-decoration: none; color: #000;
  white-space: nowrap;
}
.header-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.insta-link {
  display: inline-flex; align-items: center;
  text-decoration: none;
}
.insta-link img { width: 20px; height: 20px; display: block; }
.insta-label { display: none; }
.nav-toggle {
  display: none;
  border: 1px solid var(--line); background: #fff;
  padding: 8px 12px; font-size: 14px; font-family: inherit; cursor: pointer;
}
.site-nav { flex: 1 1 auto; background: #fff; }
.nav-list {
  margin: 0; padding: 0;
  list-style: none;
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0;
}
.nav-list > li { position: relative; }
.nav-list a, .nav-list summary {
  display: inline-block; padding: 0 10px;
  font-size: 14px; line-height: 30px;
  text-decoration: none; color: #000;
  cursor: pointer; white-space: nowrap;
  transition: color 0.4s ease;
}
.nav-list a:hover, .nav-list summary:hover { color: #777; }
.nav-list a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.has-sub details { position: relative; }
.has-sub details > summary { list-style: none; }
.has-sub details > summary::-webkit-details-marker { display: none; }
.submenu {
  list-style: none; margin: 0; padding: 6px 0;
  background: #fff; border: 1px solid var(--line);
  min-width: 210px;
}
.has-sub details[open] .submenu {
  position: absolute; right: 0; top: 100%; z-index: 60;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.submenu a { display: block; padding: 6px 16px; line-height: 1.6; }

/* Content — centered narrow column like Wix */
main { max-width: var(--maxw); margin: 0 auto; padding: 30px 20px 60px; }
.page-title {
  font-family: "Playfair Display", Didot, serif;
  font-size: 22px; font-weight: 400; line-height: 1.4;
  text-align: center;
  margin: 10px 0 12px; color: #000;
}
.lede {
  font-family: "Playfair Display", Didot, serif;
  font-size: 15px; line-height: 1.7;
  text-align: center;
  max-width: 760px; margin: 0 auto 10px; color: var(--body);
}
.lede-left { text-align: left; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
h2 {
  font-family: "Playfair Display", serif;
  font-size: 18px; font-weight: 400; text-align: center;
  margin: 26px 0 12px; color: #000;
}
h2.left, .left { text-align: left; }
p { margin: 0 0 12px; }
.meta { color: var(--muted); font-size: 13px; }
.meta span { display: block; }

/* Galleries — borderless like Wix (image + caption below) */
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px 20px; margin: 24px 0;
}
.gallery figure { margin: 0; background: #fff; }
.gallery button.img-btn {
  border: 0; padding: 0; background: none; width: 100%; cursor: zoom-in; display: block;
}
.gallery img {
  width: 100%; height: auto; object-fit: cover; background: #f7f7f7;
}
.gallery figcaption {
  padding: 10px 2px 0;
  font-size: 14px; line-height: 1.4;
}
.gallery figcaption strong { font-weight: 600; }
.card {
  margin: 0; background: #fff;
}
.card img { width: 100%; height: auto; }
.card-body { padding: 10px 2px 0; font-size: 14px; }
.card-body h3 {
  font-family: "Playfair Display", serif; font-weight: 400;
  font-size: 17px; margin: 0 0 4px; text-align: center;
}
.card-body .meta { text-align: center; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px 20px; }
.hub-grid a.card-link { text-decoration: none; color: inherit; }
.hub-grid a.card-link:hover img { opacity: 0.88; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
/* About — portrait + bio side by side on top, stacked CV below (original order) */
.about-top { display: grid; grid-template-columns: 380px 1fr; gap: 32px; align-items: start; margin: 12px 0 8px; }
.about-portrait img { width: 100%; max-width: 422px; height: auto; display: block; }
.about-bio { font-size: 15px; }
.about-bio p { margin: 0 0 12px; }
.about-role { font-size: 13px; margin: 0; }
.about-cv .cv-label { font-size: 14px; font-weight: 700; color: #000; margin: 20px 0 4px; }
.about-cv .cv-label:first-child { margin-top: 0; }
.about-cv .cv-item { font-size: 13px; margin: 0 0 2px; }
.zh { font-family: "Raleway", "PingFang TC", "Microsoft JhengHei", sans-serif; }

/* Footer — centered like Wix */
.site-footer { background: #fff; border-top: 1px solid var(--line); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 22px 20px;
  text-align: center;
  font-size: 14px; line-height: 1.79; color: #000;
}

@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; gap: 12px 14px; padding: 14px 16px; }
  .brand { font-size: 20px; flex: 1 1 auto; }
  .header-right { display: contents; }
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; flex: 1 1 100%; order: 10; }
  .site-nav.open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; padding: 4px 0 8px; }
  .nav-list a, .nav-list summary { display: block; padding: 11px 4px; }
  .has-sub details[open] .submenu { position: static; box-shadow: none; border: 0; border-left: 2px solid var(--line); margin-left: 6px; }
  .two-col, .about-top { grid-template-columns: 1fr; }
  .about-top { gap: 14px; }
  main { padding: 22px 16px 48px; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 20px 12px; }
}
@media (max-width: 560px) {
  .gallery { grid-template-columns: 1fr; }
}

/* Very small phones: keep brand + icon + Menu on one line */
@media (max-width: 400px) {
  .header-inner { padding: 12px; gap: 10px; }
  .brand { font-size: 17px; }
  .nav-toggle { padding: 7px 9px; font-size: 13px; }
  main { padding: 18px 14px 40px; }
  .carousel-btn { width: 38px; height: 38px; font-size: 20px; }
}

/* Lightbox (progressive enhancement, invisible until clicked) */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.88);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: min(92vw, 1100px); max-height: 82vh; object-fit: contain; background: #111; }
.lightbox-caption { color: #eee; text-align: center; margin-top: 10px; font-size: 14px; max-width: 90vw; font-family: "Raleway", sans-serif; }
.lightbox-controls { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.lightbox button {
  border: 1px solid #555; background: #222; color: #fff;
  padding: 8px 12px; cursor: pointer; font-size: 16px; font-family: inherit;
}
.lightbox button:hover { background: #000; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); display: flex; justify-content: space-between; width: 100%; left: 0; padding: 0 12px; pointer-events: none; }
.lightbox-nav button { pointer-events: auto; }

/* Photo carousel (like Wix Pro Gallery slider: large photo + thumbs) */
.carousel { margin: 24px 0; }
.carousel-main { position: relative; max-width: 710px; margin: 0 auto; }
.carousel-main:focus { outline: 2px solid #000; outline-offset: 4px; }
.carousel-slide { margin: 0; }
.carousel-slide img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; background: #f7f7f7; }
.carousel-slide figcaption { text-align: center; font-size: 14px; line-height: 1.4; padding: 10px 2px 0; min-height: 2.2em; }
.carousel-btn {
  position: absolute; top: 42%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid #ddd; background: rgba(255,255,255,0.92);
  font-size: 24px; line-height: 1; cursor: pointer; color: #000; font-family: inherit;
}
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }
.carousel-btn:hover { background: #000; color: #fff; border-color: #000; }
.carousel-thumbs {
  display: flex; gap: 8px; overflow-x: auto;
  max-width: 710px; margin: 14px auto 0; padding-bottom: 6px;
}
.carousel-thumbs button {
  border: 2px solid transparent; background: none; padding: 0;
  cursor: pointer; flex: 0 0 auto; font-family: inherit;
}
.carousel-thumbs img { width: 96px; height: 96px; object-fit: cover; display: block; background: #f7f7f7; }
.carousel-thumbs button.active { border-color: #000; }
.carousel-thumbs button:not(.active) { opacity: 0.65; }
.carousel-thumbs button:hover { opacity: 1; }

/* One-column photo stack (Projects pages, like original Wix flow) */
.stack { max-width: 680px; margin: 24px auto; }
/* Size-matched caps so small originals are never upscaled blurry */
.stack.s480 { max-width: 480px; }
.stack.s375 { max-width: 375px; }
.stack figure { margin: 0 0 6px; background: #fff; }
.stack button.img-btn {
  border: 0; padding: 0; background: none; width: 100%; cursor: zoom-in; display: block;
}
.stack img { width: 100%; height: auto; display: block; background: #f7f7f7; }
.stack figcaption { font-size: 14px; line-height: 1.5; padding: 8px 2px 0; }
.stack-group { margin: 0 0 36px; }
.stack-group:last-child { margin-bottom: 0; }

/* Murals — centered 600px column like original: singles + side-by-side pairs */
.mural { max-width: 600px; margin: 24px auto; }
.mural button.img-btn {
  border: 0; padding: 0; background: none; cursor: zoom-in; display: block;
  min-width: 0;
}
.mural button.img-btn img { width: 100%; height: auto; display: block; background: #f7f7f7; }
.mural-single button.img-btn { width: 100%; }
.mural-row { display: flex; gap: 6px; }
.mural-row button.img-btn { flex: 1 1 0; }
.mural-cap { font-size: 14px; line-height: 1.5; margin: 8px 0 0; }
.mural-cap.loc { font-size: 15px; }
.mural-block { margin: 0 0 26px; }
.mural-block:last-child { margin-bottom: 0; }
@media (max-width: 560px) {
  .mural-row { flex-direction: column; }
}
