/* 徐博旭的艺术空间 — palette from rainy mountain oil study */
:root {
  --ink: #1a1916;
  --ink-soft: #3a3732;
  --mist: #d8ddd6;
  --paper: #eef0eb;
  --moss: #4a5a48;
  --lantern: #d4a84b;
  --asphalt: #2c2f2c;
  --muted: #6e716a;
  --header-h: 4rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", system-ui, sans-serif;
  font-weight: 400;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 10% 0%, #e4e8e1 0%, transparent 55%),
    radial-gradient(90% 60% at 100% 20%, #d6ddd4 0%, transparent 50%),
    linear-gradient(180deg, var(--paper) 0%, #e3e6df 100%);
  line-height: 1.65;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* —— Header —— */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}

.logo {
  font-family: "Noto Serif SC", serif;
  font-weight: 600;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  letter-spacing: 0.06em;
}

.site-nav {
  display: flex;
  gap: 1.75rem;
}

.site-nav a {
  font-size: 0.92rem;
  color: var(--ink-soft);
  position: relative;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2em;
  width: 100%;
  height: 1px;
  background: var(--lantern);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), opacity 0.3s;
}

.nav-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(0.28rem) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-0.28rem) rotate(-45deg);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(1.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— Sections —— */
.section-head {
  margin-bottom: 2rem;
}

.section-head h2 {
  margin: 0 0 0.5rem;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1.75rem, 3.5vw, 2.35rem);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 36rem;
}

.works,
.workspace,
.hobbies {
  padding: clamp(4rem, 10vh, 6.5rem) clamp(1.25rem, 5vw, 4rem);
}

.works-alt {
  background: color-mix(in srgb, var(--mist) 35%, transparent);
}

/* —— Gallery —— */
.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 3 220px;
  column-gap: 1.1rem;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1.1rem;
  opacity: 0;
  transform: translateY(1.25rem);
  animation: card-in 0.7s var(--ease) forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.05s; }
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }
.gallery-item:nth-child(7) { animation-delay: 0.35s; }
.gallery-item:nth-child(8) { animation-delay: 0.4s; }
.gallery-item:nth-child(9) { animation-delay: 0.45s; }
.gallery-item:nth-child(10) { animation-delay: 0.5s; }
.gallery-item:nth-child(11) { animation-delay: 0.55s; }
.gallery-item:nth-child(12) { animation-delay: 0.6s; }
.gallery-item:nth-child(13) { animation-delay: 0.65s; }

@keyframes card-in {
  to { opacity: 1; transform: translateY(0); }
}

.gallery-btn {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.gallery-btn img {
  width: 100%;
  transition: transform 0.7s var(--ease);
}

.gallery-btn:hover img,
.gallery-btn:focus-visible img {
  transform: scale(1.04);
}

.gallery-caption {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 0.15rem 0.2rem;
}

.gallery-caption strong {
  font-family: "Noto Serif SC", serif;
  font-weight: 600;
  font-size: 1rem;
}

.gallery-caption em {
  font-style: normal;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* —— Intro / About —— */
.about.intro {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 28rem);
  gap: clamp(1.75rem, 4vw, 3rem) clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  padding: calc(var(--header-h) + 2.5rem) clamp(1.25rem, 5vw, 4rem) clamp(3rem, 8vh, 5rem);
  animation: rise 0.9s var(--ease) both;
}

.about-portrait {
  position: relative;
  width: 100%;
  max-width: 360px;
}

.about-portrait::before {
  content: "";
  position: absolute;
  inset: 0.75rem -0.75rem -0.75rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--lantern) 55%, transparent);
  z-index: 0;
}

.about-portrait img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
}

.about-copy {
  max-width: 36rem;
}

.about-copy h1 {
  margin: 0 0 0.85rem;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.about-copy > p {
  margin: 0;
  color: var(--muted);
}

.about-copy > p.intro-brand {
  margin: 0 0 0.5rem;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1.65rem, 4.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.25;
  color: var(--ink);
}

.about-copy > p + p {
  margin-top: 1rem;
}

.intro-cta {
  display: inline-flex;
  margin-top: 1.5rem;
  padding: 0.65rem 1.35rem;
  border: 1px solid var(--asphalt);
  background: var(--asphalt);
  color: #f2f0ea;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.intro-cta:hover,
.intro-cta:focus-visible {
  background: transparent;
  color: var(--ink);
  border-color: var(--lantern);
}

/* —— Workspace —— */
.workspace-photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 3vw, 1.75rem);
}

.workspace-photos figure {
  margin: 0;
}

.workspace-photos img {
  width: 100%;
  height: auto;
  display: block;
}

.workspace-photos figcaption {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* —— Hobbies —— */
.hobby-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.hobby-list li {
  padding: 1.5rem 0 0;
  border-top: 2px solid var(--moss);
}

.hobby-list h3 {
  margin: 0 0 0.65rem;
  font-family: "Noto Serif SC", serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.hobby-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* —— Footer —— */
.site-footer {
  padding: 2.5rem clamp(1.25rem, 5vw, 4rem) 3rem;
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  text-align: center;
}

.footer-brand {
  margin: 0 0 0.35rem;
  font-family: "Noto Serif SC", serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.footer-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* —— Lightbox —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: rgba(14, 15, 13, 0.88);
  backdrop-filter: blur(6px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  width: 2.5rem;
  height: 2.5rem;
}

.lightbox-figure {
  margin: 0;
  max-width: min(92vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  animation: rise 0.4s var(--ease);
}

.lightbox-figure img {
  max-height: min(78vh, 820px);
  width: auto;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.lightbox-figure figcaption {
  color: #eceae4;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.lightbox-figure strong {
  font-family: "Noto Serif SC", serif;
  font-size: 1.1rem;
}

.lightbox-figure span {
  font-size: 0.85rem;
  color: color-mix(in srgb, #fff 55%, transparent);
}

body.lightbox-open {
  overflow: hidden;
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .about.intro {
    grid-template-columns: minmax(0, 28rem);
    justify-items: center;
    text-align: center;
    min-height: 0;
  }

  .about-portrait {
    max-width: 300px;
  }

  .about-copy {
    max-width: 28rem;
  }

  .intro-cta {
    margin-left: auto;
    margin-right: auto;
  }

  .hobby-list {
    grid-template-columns: 1fr;
  }

  .workspace-photos {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0 1rem;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s var(--ease), opacity 0.35s;
  }

  .site-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .site-nav a {
    padding: 0.85rem clamp(1.25rem, 5vw, 2rem);
  }

  .gallery {
    columns: 2 140px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .gallery-item,
  .about.intro,
  .lightbox-figure {
    animation: none !important;
  }

  .gallery-item {
    opacity: 1;
    transform: none;
  }

  .gallery-btn img {
    transition: none;
  }
}

:focus-visible {
  outline: 2px solid var(--lantern);
  outline-offset: 3px;
}
