/* =========================================================
   CAOXUEFAN PORTFOLIO TEMPLATE
   Palette: cream / parchment / sand / rust / gold
   Fonts: Playfair Display + Cormorant Garamond
   ========================================================= */

:root {
  --cream: #EDE8DF;
  --cream-2: #F7F1E7;
  --sand: #E4D4B8;
  --sand-deep: #C5AA78;
  --gold: #B98A2D;
  --rust: #9B531E;
  --ink: #201914;
  --muted: #8D8173;
  --line: rgba(117, 90, 45, .20);
  --paper: rgba(255, 252, 244, .58);
  --shadow: 0 28px 80px rgba(55, 40, 18, .12);
  --radius: 2px;
  --nav-height: 76px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--cream);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.75), transparent 45%),
    linear-gradient(180deg, var(--cream), #EFE6D6 52%, var(--cream));
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

img, video, iframe { max-width: 100%; display: block; }

::selection { background: rgba(185, 138, 45, .30); }

/* ---------------- TOP BAR ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--nav-height);
  padding: 12px 4.8vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(237, 232, 223, .84);
  backdrop-filter: blur(18px);
  transition: background .35s ease, box-shadow .35s ease;
}

.site-header.scrolled {
  background: rgba(237, 232, 223, .95);
  box-shadow: 0 8px 30px rgba(45, 31, 12, .08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: max-content;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform .45s ease;
}

.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }

.brand-name {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  letter-spacing: .04em;
  font-size: 1.02rem;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(14px, 2vw, 32px);
  font-family: Inter, system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.top-nav > a,
.nav-group > a {
  position: relative;
  padding: 12px 0;
  color: rgba(32, 25, 20, .78);
}

.top-nav > a::after,
.nav-group > a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 8px;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width .3s ease;
}

.top-nav > a:hover::after,
.nav-group:hover > a::after { width: 100%; }

.nav-group { position: relative; }

.dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  min-width: 235px;
  padding: 14px;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  visibility: hidden;
  background: rgba(247, 241, 231, .96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: .26s ease;
}

.nav-group:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown a {
  display: block;
  padding: 11px 12px;
  color: var(--muted);
  transition: .22s ease;
}

.dropdown a:hover {
  color: var(--rust);
  background: rgba(185, 138, 45, .08);
  transform: translateX(4px);
}

.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  font-size: 1.7rem;
  color: var(--ink);
}

/* ---------------- HOME HERO ---------------- */

.hero {
  min-height: calc(100vh - var(--nav-height));
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: visible;
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.hero-video-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: none;
  z-index: 0;
}

.hero-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  filter: none;
  display: block;
}

.hero-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(32, 25, 20, .20);
  font-family: "Playfair Display", serif;
  font-size: clamp(3rem, 10vw, 12rem);
  font-style: italic;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(1100px, 88vw);
  text-align: center;
  padding: 80px 0;
}

.name-section {
  width: 100%;
  padding: 40px 24px 80px;
  text-align: center;
}

.below-video-name {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(64px, 14vw, 190px);
  line-height: 0.85;
  font-weight: 900;
  letter-spacing: -0.08em;
  color: #3437C9;
}

.hero-kicker,
.eyebrow {
  font-family: Inter, system-ui, sans-serif;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .55em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero h1,
.page-title {
  margin: 22px 0 16px;
  font-family: "Playfair Display", serif;
  font-size: clamp(4rem, 12vw, 12.5rem);
  line-height: .86;
  letter-spacing: -.055em;
}

.hero h1 em,
.page-title em,
.section-title em,
.contact-footer h2 em {
  color: var(--rust);
  font-style: italic;
}

.hero-subtitle {
  max-width: 700px;
  margin: 0 auto;
  font-size: clamp(1.25rem, 2.4vw, 2.1rem);
  color: var(--muted);
  font-style: italic;
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  text-align: center;
  font-family: Inter, system-ui, sans-serif;
  letter-spacing: .25em;
  text-transform: uppercase;
  font-size: .68rem;
  color: var(--gold);
}

/* ---------------- ROLE STRIP ---------------- */
.role-strip {
  padding: 34px 4vw;
  background: transparent;
  color: #000000;
  text-align: center;
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(1.35rem, 3vw, 3.2rem);
  font-weight: 800;
  font-style: italic;
  letter-spacing: -.03em;
}

/* ---------------- SECTIONS ---------------- */
.section {
  padding: clamp(80px, 10vw, 150px) 5.6vw;
}

.section-header {
  text-align: center;
  margin: 0 auto 62px;
}

.section-header .chapter {
  display: block;
  margin-bottom: 18px;
  font-family: Inter, system-ui, sans-serif;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .55em;
  color: var(--gold);
}

.section-title {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(3.2rem, 7vw, 6.5rem);
  line-height: 1;
  letter-spacing: -.04em;
}

.ornament {
  margin: 26px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--gold);
}

.ornament span {
  width: 105px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.project-grid {
  width: min(1500px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: clamp(26px, 3vw, 48px);
}

.project-grid.center-single {
  grid-template-columns: minmax(280px, 520px);
  justify-content: center;
}

.project-card {
  min-height: 530px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 252, 244, .64);
  border: 1px solid rgba(197, 170, 120, .35);
  box-shadow: 0 25px 80px rgba(75, 55, 22, .08);
  transform: translateY(28px);
  opacity: 0;
  transition: transform .75s cubic-bezier(.18,.85,.25,1), opacity .75s ease, box-shadow .3s ease;
}

.project-card.reveal {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover {
  box-shadow: 0 32px 90px rgba(75, 55, 22, .18);
  transform: translateY(-8px);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--sand);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .9s cubic-bezier(.18,.85,.25,1), filter .5s ease;
}

.project-card:hover .thumb img {
  transform: scale(1.045);
  filter: saturate(1.05) contrast(1.03);
}

.card-label {
  position: absolute;
  top: 24px;
  left: 24px;
  padding: 9px 14px;
  background: rgba(48, 42, 36, .88);
  color: var(--cream-2);
  font-family: Inter, system-ui, sans-serif;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.card-body {
  padding: 34px 34px 38px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-body h3 {
  margin: 0 0 12px;
  font-family: "Playfair Display", serif;
  font-size: clamp(1.65rem, 2vw, 2.25rem);
  line-height: 1.1;
}

.meta {
  margin: 0 0 16px;
  color: var(--rust);
  font-family: Inter, system-ui, sans-serif;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.role-text {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.42;
}

.view-link {
  margin-top: auto;
  align-self: flex-start;
  color: var(--gold);
  font-family: Inter, system-ui, sans-serif;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .25em;
  text-transform: uppercase;
  transition: gap .25s ease, color .25s ease;
}

.view-link:hover { color: var(--rust); }

/* ---------------- ABOUT ---------------- */
.about-page,
.project-page {
  min-height: 80vh;
  padding: clamp(70px, 9vw, 130px) 5.6vw;
}

.about-inner {
  width: min(880px, 100%);
  margin: 0 auto;
  text-align: center;
}

.avatar {
  width: clamp(160px, 22vw, 240px);
  aspect-ratio: 1;
  object-fit: cover;
  margin: 0 auto 36px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--sand);
}

.about-copy {
  color: #4D4137;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.55;
}

.about-info-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 44px;
  margin: 70px auto 50px;
  flex-wrap: wrap;
}

.about-info-card {
  position: relative;
  width: 320px;
  min-height: 250px;
  padding: 34px 30px 28px;
  background: transparent;
  border: 2px solid #222;
  border-radius: 0 0 24px 24px;
  color: #111;
}

.about-info-card h2 {
  font-size: 22px;
  margin: 0 0 16px;
}

.about-info-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.about-info-card li {
  font-size: 15px;
  line-height: 1.75;
}

.card-top {
  position: absolute;
  top: -9px;
  left: -2px;
  width: calc(100% + 4px);
  height: 14px;
  border-radius: 12px;
}

.card-top.purple {
  background: #4D4137;
}

.card-top.green {
  background: #8a5d39;
}

@media (max-width: 768px) {
  .about-info-wrapper {
    gap: 30px;
    margin: 55px auto 40px;
  }

  .about-info-card {
    width: 100%;
    max-width: 340px;
  }
}

.download-cv,
.primary-button {
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
  padding: 15px 24px;
  border: 1px solid rgba(155, 83, 30, .35);
  color: var(--rust);
  background: rgba(255, 252, 244, .35);
  font-family: Inter, system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .23em;
  text-transform: uppercase;
  transition: .25s ease;
}

.download-cv:hover,
.primary-button:hover {
  background: var(--rust);
  color: var(--cream-2);
  transform: translateY(-3px);
  box-shadow: 0 16px 35px rgba(155,83,30,.18);
}

/* ---------------- PROJECT DETAIL ---------------- */
.project-page {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.project-hero-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--sand);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.project-hero-media iframe,
.project-hero-media video,
.project-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-intro {
  text-align: center;
  margin: 52px auto 44px;
  width: min(860px, 100%);
}

.project-intro h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(3.2rem, 8vw, 7rem);
  line-height: 1;
}

.project-kind {
  margin: 10px 0 26px;
  color: var(--rust);
  font-family: Inter, system-ui, sans-serif;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-size: .72rem;
  font-weight: 800;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 38px 0 0;
}

.fact {
  padding: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 244, .35);
}

.fact strong {
  display: block;
  margin-bottom: 9px;
  font-family: Inter, system-ui, sans-serif;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.fact span {
  color: #4D4137;
  font-size: 1.15rem;
}

.project-copy {
  width: min(860px, 100%);
  margin: 0 auto;
  font-size: 1.25rem;
  line-height: 1.62;
  color: #4D4137;
}

.project-copy p { margin: 0 0 22px; }

.gallery {
  width: min(920px, 100%);
  margin: 54px auto;
  display: grid;
  gap: 30px;
}

.gallery figure {
  margin: 0;
  opacity: 0;
  transform: translateY(24px);
  transition: .75s cubic-bezier(.18,.85,.25,1);
}

.gallery figure.reveal {
  opacity: 1;
  transform: translateY(0);
}

.gallery img {
  width: 100%;
  border: 1px solid var(--line);
  box-shadow: 0 18px 65px rgba(55, 40, 18, .10);
  cursor: zoom-in;
  transition: transform .35s ease, filter .35s ease;
}

.gallery img:hover {
  transform: scale(1.012);
  filter: saturate(1.06);
}

.gallery figcaption {
  margin-top: 10px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 1.05rem;
}

/* ---------------- CONTACT FOOTER ---------------- */
.contact-footer {
  position: relative;
  padding: clamp(88px, 12vw, 160px) 5vw 54px;
  background:
    radial-gradient(circle at 50% 25%, rgba(185,138,45,.16), transparent 38%),
    linear-gradient(110deg, #21170D, #2C2116 45%, #17120E);
  color: var(--cream-2);
  text-align: center;
  border-top: 1px solid rgba(185,138,45,.22);
}

.contact-footer h2 {
  margin: 22px 0 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(3.5rem, 7vw, 7rem);
  line-height: 1;
}

.footer-note {
  width: min(700px, 90vw);
  margin: 62px auto 50px;
  color: rgba(247,241,231,.68);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-style: italic;
  line-height: 1.3;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
}

.contact-button {
  min-width: 210px;
  padding: 20px 22px;
  border: 1px solid rgba(237,232,223,.25);
  color: var(--cream-2);
  font-family: Inter, system-ui, sans-serif;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .23em;
  text-transform: uppercase;
  transition: .25s ease;
}

.contact-button span {
  display: inline-flex;
  justify-content: center;
  min-width: 20px;
  margin-right: 12px;
  font-weight: 900;
}

.contact-button:hover {
  background: var(--cream-2);
  color: #24180E;
  transform: translateY(-4px);
}

.contact-footer small {
  display: block;
  margin-top: 80px;
  color: rgba(237,232,223,.45);
  font-family: Inter, system-ui, sans-serif;
}

/* ---------------- UI EFFECTS ---------------- */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(237,232,223,.86);
  color: var(--rust);
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 40;
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(28, 20, 12, .86);
  cursor: zoom-out;
}

.lightbox img {
  max-height: 88vh;
  max-width: 92vw;
  box-shadow: 0 30px 100px rgba(0,0,0,.5);
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 1080px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .menu-toggle { display: block; }

  .top-nav {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 20px 6vw 28px;
    background: rgba(237, 232, 223, .98);
    border-bottom: 1px solid var(--line);
  }

  .top-nav.open { display: flex; }

  .top-nav > a,
  .nav-group > a {
    display: block;
    padding: 15px 0;
  }

  .dropdown {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    min-width: auto;
    box-shadow: none;
    background: rgba(255,252,244,.35);
    margin: 0 0 10px;
  }

  .detail-facts { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .project-grid,
  .project-grid.center-single {
    grid-template-columns: 1fr;
  }

  .project-card { min-height: auto; }
  .card-body { padding: 28px 24px; }
  .section { padding-left: 6vw; padding-right: 6vw; }
  .role-strip { font-size: 1.25rem; }
}

.gallery-section {
  width: min(1000px, 90%);
  margin: 60px auto 100px;
}

.gallery-main {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-main img {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 18px;
}

.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  font-size: 42px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}

.gallery-btn.prev {
  left: 16px;
}

.gallery-btn.next {
  right: 16px;
}

#galleryCounter {
  text-align: center;
  opacity: 0.7;
  margin: 14px 0 18px;
}

.gallery-thumbnails {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 4px 18px;
  justify-content: flex-start;
}

.gallery-thumb {
  width: 96px;
  height: 66px;
  object-fit: cover;
  border-radius: 10px;
  opacity: 0.55;
  cursor: pointer;
  border: 2px solid transparent;
  transition: 0.25s ease;
  flex: 0 0 auto;
}

.gallery-thumb:hover {
  opacity: 0.9;
}

.gallery-thumb.active {
  opacity: 1;
  border-color: #111;
}

.after-gallery-text {
  margin-top: 40px;
}

.project-video.after-gallery-video {
  width: 90%;
  max-width: 1200px;
  aspect-ratio: 16 / 9;
  margin: 50px auto 0;
}

.project-video.after-gallery-video iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

.extra-image-grid {
  max-width: 1100px;
  margin: 48px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.extra-image-grid img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 18px;
}

@media (max-width: 768px) {
  .extra-image-grid {
    grid-template-columns: 1fr;
  }
}

.gallery-main-image {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.gallery-main-image.fade-out {
  opacity: 0;
  transform: scale(0.98);
}

.gallery-main-image.fade-in {
  opacity: 1;
  transform: scale(1);
}

.gallery-caption {
  width: 100%;
  max-width: 900px;
  margin: 12px auto 14px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.6;
  opacity: 0.75;
}

.lightbox-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 22px;
  overflow: hidden;
}

.lightbox-trigger img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.lightbox-trigger:hover img {
  transform: scale(1.03);
  opacity: 0.9;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(20, 17, 14, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.image-lightbox img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.image-lightbox p {
  margin-top: 16px;
  color: #f5efe5;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: 28px;
  right: 34px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(245, 239, 229, 0.9);
  color: #2b241f;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.project-link-wrap {
  display: flex;
  justify-content: center;
  margin: 34px 0 28px;
}

.external-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 13px 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(237, 232, 223, .86);
  color: var(--rust);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: .25s ease;
}

.external-link-btn:hover {
  transform: translateY(-2px);
  background: var(--rust);
  color: #fff;
}