/* ===============================================
   liuhai.vip — Editorial Gallery System
   Designed as a quiet, premium designer portfolio.
   =============================================== */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --paper: #f4efe7;            /* warm gallery paper */
  --paper-deep: #ebe5da;       /* recessed sections */
  --ink: #1a1a1a;              /* off-black body */
  --ink-soft: #2a2a2a;
  --muted: #6f6960;            /* warm gray */
  --muted-soft: #a39c91;
  --hairline: rgba(26, 26, 26, 0.12);
  --hairline-strong: rgba(26, 26, 26, 0.22);
  --accent: #a93826;           /* deep terracotta */
  --accent-soft: #c25540;

  /* Type */
  --serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;

  /* Rhythm */
  --shell: 1240px;
  --gutter: 40px;
  --gutter-mobile: 22px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  opacity: 1;
  transition: opacity 0.32s ease;
}
body.fade-out { opacity: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Paper texture (subtle vignette) ---------- */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at top left, rgba(255,250,240,0.6), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(169,56,38,0.04), transparent 60%);
}

/* ---------- Layout helpers ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
  z-index: 1;
}
.shell--narrow { max-width: 880px; }
.shell--wide   { max-width: 1480px; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(244, 239, 231, 0.88);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--hairline);
}
.nav__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.nav__brand {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-style: italic;
}
.nav__brand small {
  font-family: var(--sans);
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--muted);
  display: block;
  margin-top: 2px;
  text-transform: uppercase;
}
.nav__links {
  display: flex; align-items: center;
  gap: 38px;
}
.nav__links a {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
  position: relative;
  transition: color 0.2s ease;
}
.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after,
.nav__links a.is-active::after { transform: scaleX(1); }
.nav__links a.is-active { color: var(--ink); }
.nav__cta {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 12px 22px;
  border-radius: 0;
  transition: background 0.25s ease, color 0.25s ease;
}
.nav__cta:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- Typography utilities ---------- */
.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.eyebrow::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--ink);
}
.eyebrow--solo::before { display: none; }

.display {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.display-1 { font-size: clamp(54px, 9vw, 128px); }
.display-2 { font-size: clamp(40px, 6vw, 84px); }
.display-3 { font-size: clamp(32px, 4.5vw, 58px); }

.h-section {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 4.5vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.lede {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.55;
  color: var(--ink-soft);
}

.body-prose {
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-soft);
}
.body-prose p + p { margin-top: 1em; }

.caption {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Section rhythm ---------- */
.section {
  padding: clamp(80px, 12vw, 160px) 0;
  position: relative;
  z-index: 1;
}
.section--deep {
  background: var(--paper-deep);
}
.section--tight { padding: clamp(48px, 8vw, 96px) 0; }

.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
  margin-bottom: clamp(48px, 6vw, 88px);
  max-width: 880px;
}
.section-head.with-meta {
  grid-template-columns: 1fr 220px;
  align-items: end;
  gap: 48px;
  max-width: none;
}
.section-head__index {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Rule ---------- */
.rule {
  height: 1px;
  background: var(--hairline);
  border: 0;
  margin: 0;
}
.rule--ink { background: var(--ink); }

/* ---------- Buttons / links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 18px 26px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  transition: background 0.25s, color 0.25s, transform 0.2s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 4px 0;
  border-bottom: 1px solid var(--ink);
  transition: gap 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.link-arrow:hover { gap: 16px; color: var(--accent); border-color: var(--accent); }

/* ---------- Contact Modal ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: 999;
  background: rgba(20, 18, 16, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal__card {
  width: min(440px, 100%);
  background: var(--paper);
  border: 1px solid var(--hairline);
  padding: 36px 36px 40px;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  position: relative;
}
.modal.is-open .modal__card { transform: translateY(0); opacity: 1; }
.modal__close {
  position: absolute;
  top: 18px; right: 18px;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--hairline);
  font-size: 18px;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.modal__close:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.modal__eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.modal__title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 14px;
  line-height: 1.2;
}
.modal__desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 24px;
}
.modal__qr {
  width: 200px;
  height: 200px;
  margin: 0 auto 20px;
  border: 1px solid var(--hairline);
  background: #fff;
  padding: 8px;
}
.modal__qr img { width: 100%; height: 100%; object-fit: contain; }
.modal__handle {
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}
.modal__handle b { font-weight: 700; }

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid var(--hairline);
  padding: 60px 0 56px;
  position: relative;
  z-index: 1;
}
.foot__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
}
.foot__brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 6px;
}
.foot__tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.foot__meta {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
  line-height: 1.8;
}
.foot__meta a { color: var(--ink); border-bottom: 1px solid var(--hairline); }
.foot__meta a:hover { border-bottom-color: var(--accent); color: var(--accent); }

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}
.reveal-2 { transition-delay: 0.08s; }
.reveal-3 { transition-delay: 0.16s; }
.reveal-4 { transition-delay: 0.24s; }

/* ---------- Responsive Nav ---------- */
@media (max-width: 880px) {
  .nav__inner { padding: 14px var(--gutter-mobile); flex-wrap: wrap; gap: 12px; }
  .nav__brand { font-size: 19px; }
  .nav__brand small { font-size: 9px; letter-spacing: 0.18em; }
  .nav__cta { padding: 10px 16px; font-size: 11px; letter-spacing: 0.14em; }
  .nav__links {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    gap: 22px;
    padding-top: 10px;
    border-top: 1px solid var(--hairline);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav__links::-webkit-scrollbar { display: none; }
  .nav__links a {
    font-size: 11px;
    letter-spacing: 0.14em;
    flex-shrink: 0;
  }
  .shell { padding: 0 var(--gutter-mobile); }
  .section-head.with-meta { grid-template-columns: 1fr; gap: 14px; }
  .foot__inner { grid-template-columns: 1fr; padding: 0 var(--gutter-mobile); }
  .foot__meta { text-align: left; }
}
@media (max-width: 480px) {
  .nav__brand small { display: none; }
}

/* ---------- Print-safe motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
