/* ============================================================
   Kevin Shao — 水墨 (Shui-Mo / ink-wash) theme
   Xuan paper, five shades of ink, one cinnabar seal.
   ============================================================ */

:root {
  /* 宣纸 paper */
  --paper: #f3eee3;
  --paper-deep: #e9e2d3;
  --paper-rgb: 243, 238, 227;

  /* 墨分五色 — five shades of ink */
  --ink: #1c1b18;      /* 焦 */
  --ink-2: #3b3934;    /* 浓 */
  --ink-3: #6b675f;    /* 重 */
  --ink-4: #9a958a;    /* 淡 */
  --ink-5: #cfc9bb;    /* 清 */
  --ink-rgb: 28, 27, 24;

  /* 朱砂 seal red */
  --cinnabar: #a4322b;
  --cinnabar-soft: rgba(164, 50, 43, 0.14);

  --font-display: 'Cormorant Garamond', 'Songti SC', 'Noto Serif SC', Georgia, serif;
  --font-body: 'EB Garamond', 'Songti SC', 'Noto Serif SC', Georgia, serif;
  --font-brush: 'Ma Shan Zheng', 'Kaiti SC', 'STKaiti', 'KaiTi', serif;

  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Paper grain: fine fibers + broad mottling, both generated by SVG noise */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch' seed='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.24 0 0 0 0 0.2 0 0 0 0 0.13 0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23g)'/%3E%3C/svg%3E");
  --mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='2' stitchTiles='stitch' seed='5'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='900' height='900' filter='url(%23m)'/%3E%3C/svg%3E");
}

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

html {
  font-size: 17px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.06rem;
  line-height: 1.7;
  color: var(--ink-2);
  background-color: var(--paper);
  background-image: var(--grain), var(--mottle);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--cinnabar), var(--cinnabar));
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 92%;
  transition: color 0.25s var(--ease), background-size 0.25s var(--ease);
}

a:hover { color: var(--cinnabar); }

a:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 3px;
}

p { margin: 0 0 1rem; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin: 0;
}

.container {
  width: min(980px, 100% - 2rem);
  margin-inline: auto;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Brush-calligraphy glyphs */
.zh { font-family: var(--font-brush); font-weight: 400; }

/* Ink-brushed strokes (symbols in index.html) */
.brush-line,
.divider svg {
  display: block;
  color: var(--ink);
}

.divider {
  width: min(440px, 72%);
  height: 12px;
  margin: 3.6rem auto;
  color: var(--ink-3);
  opacity: 0.85;
}

.divider svg { width: 100%; height: 100%; }

/* ---------- Buttons ---------- */
.ink-btn {
  display: inline-block;
  padding: 0.32rem 0.95rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  border: 1px solid var(--ink-4);
  border-radius: 2px;
  background: none;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.ink-btn:hover {
  color: var(--paper);
  background-color: var(--ink);
  border-color: var(--ink);
  transform: translateY(-1px);
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: var(--nav-h);
  background: rgba(var(--paper-rgb), 0.86);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--ink-5);
}

.nav {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: none;
}

.brand::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  background: var(--cinnabar);
  border-radius: 2px;
  transform: rotate(6deg);
  box-shadow: inset 0 0 0 1.5px rgba(var(--paper-rgb), 0.55);
}

.brand:hover { color: var(--ink); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.8rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  position: relative;
  font-size: 0.92rem;
  font-variant: small-caps;
  letter-spacing: 0.16em;
  color: var(--ink-2);
  background: none;
  padding: 0.25rem 0;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--cinnabar);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0 9px;
  background: none;
  border: 1px solid var(--ink-5);
  border-radius: 2px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---------- Hero ---------- */
main {
  position: relative;
  z-index: 1;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: calc(var(--nav-h) + 4.5rem) 0 6.5rem;
}

.hero::before {
  /* a faint wash of ink behind the name */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 45% at 58% 32%, rgba(var(--ink-rgb), 0.06), transparent 70%);
  pointer-events: none;
}

.hero-mountains {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 330px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 320px 1fr auto;
  gap: 3rem;
  align-items: center;
}

/* Portrait mounted as a hanging scroll (挂轴) */
.scroll-wrap { position: relative; padding-top: 30px; }

.cord {
  position: absolute;
  top: 0;
  left: 50%;
  width: 120px;
  height: 30px;
  transform: translateX(-50%);
  color: var(--ink-3);
}

.scroll-frame {
  position: relative;
  margin: 0;
  padding: 14px;
  background: var(--paper-deep);
  border: 1px solid var(--ink-5);
  box-shadow: 0 18px 34px -24px rgba(var(--ink-rgb), 0.55);
}

.scroll-frame::before,
.scroll-frame::after {
  content: "";
  position: absolute;
  left: -11px;
  right: -11px;
  height: 9px;
  border-radius: 5px;
  background: linear-gradient(#5a4535, #2a1f17);
  box-shadow: 0 2px 4px rgba(var(--ink-rgb), 0.35);
}

.scroll-frame::before { top: -5px; }
.scroll-frame::after { bottom: -5px; }

.scroll-frame img,
.scroll-frame video {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: 50% 18%;
  border: 1px solid var(--ink-4);
  filter: grayscale(1) contrast(1.06) brightness(1.02);
  transition: filter 0.8s var(--ease);
}

/* The landscape video is cropped to a square so both the traveler on the
   left and the tallest peak on the right stay in frame. */
.scroll-frame video {
  aspect-ratio: 1 / 1;
  object-position: 50% 50%;
  background: var(--paper-deep);
}

.scroll-frame:hover img,
.scroll-frame:hover video { filter: none; }

.hero-text { position: relative; }

.name {
  font-size: clamp(2.7rem, 6vw, 3.9rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.05;
  margin-bottom: 0.35rem;
}

.name-line {
  width: 210px;
  height: 11px;
  margin: 0.2rem 0 1.5rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Vertical calligraphy inscription (题跋) with seal */
.inscription {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  align-self: start;
  padding-top: 0.4rem;
}

.verse {
  writing-mode: vertical-rl;
  font-family: var(--font-brush);
  font-size: 2rem;
  line-height: 1.4;
  letter-spacing: 0.18em;
  color: var(--ink);
  margin: 0;
}

.seal {
  width: 50px;
  height: 50px;
  filter: drop-shadow(0 1px 1px rgba(var(--ink-rgb), 0.25));
}

.seal text { font-family: var(--font-brush); }

/* ---------- Sections ---------- */
.section { position: relative; }

.section-title {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  font-size: 2.05rem;
  padding-bottom: 0.55rem;
  margin-bottom: 1.6rem;
}

.section-title .zh {
  font-size: 2.6rem;
  line-height: 1;
  color: var(--ink);
}

.section-title .brush-line {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 150px;
  height: 10px;
}

.lead {
  font-size: 1.14rem;
  max-width: 70ch;
}

.lead::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.6em;
  font-weight: 600;
  line-height: 0.78;
  color: var(--ink);
  margin: 0.09em 0.14em 0 0;
}

/* Custom ink-dot bullets */
.section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.section li {
  position: relative;
  padding-left: 1.15rem;
  margin-bottom: 0.3rem;
}

.section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 5px;
  height: 5px;
  background: var(--ink-3);
  border-radius: 55% 45% 60% 40%;
}

/* ---------- Hobbies ---------- */
.hobbies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.7rem 2.6rem;
}

.hobby {
  display: grid;
  grid-template-columns: 3.6rem 1fr;
  gap: 1.05rem;
  align-items: start;
}

.hobby-glyph {
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  font-size: 2.35rem;
  line-height: 1;
  color: var(--ink);
  background: rgba(233, 226, 211, 0.55);
  border: 1px solid var(--ink-5);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.hobby:hover .hobby-glyph {
  color: var(--cinnabar);
  border-color: var(--ink-4);
  transform: rotate(-4deg);
}

.hobby h3 {
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.hobby p {
  font-size: 0.98rem;
  margin: 0;
}

.hobby ul {
  font-size: 0.98rem;
  margin-top: 0.3rem;
}

.hobby li { margin-bottom: 0.15rem; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 4rem;
}

.footer-landscape {
  display: block;
  width: 100%;
  height: 240px;
}

.footer-note {
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 0.6rem 1rem 2.2rem;
  margin: 0;
}

/* ---------- Bamboo in the margin (wide screens only) ---------- */
.bamboo {
  display: none;
  position: fixed;
  right: 1.5vw;
  top: calc(var(--nav-h) + 12px);
  height: min(78vh, 720px);
  width: auto;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
}

@media (min-width: 1440px) {
  .bamboo { display: block; }
}

/* ---------- Ink-drop cursor (drawn by ink-cursor.js) ---------- */
.ink-cursor {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  pointer-events: none;
}

/* The native cursor is hidden only once the script has taken over */
.has-ink-cursor,
.has-ink-cursor * { cursor: none !important; }

/* ---------- Reveal: ink bleeding onto paper ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(6px);
  transition: opacity 1s var(--ease), transform 1s var(--ease), filter 1s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
  .ink-btn, .hobby-glyph, .scroll-frame img, .scroll-frame video { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 270px 1fr;
    gap: 2.2rem;
  }

  .inscription {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    padding-top: 0.4rem;
  }

  .verse {
    writing-mode: horizontal-tb;
    font-size: 1.6rem;
    line-height: 1.2;
  }

  .seal { width: 40px; height: 40px; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.4rem 0 0.8rem;
    background: rgba(var(--paper-rgb), 0.97);
    border-bottom: 1px solid var(--ink-5);
  }

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

  .nav-links li { width: min(980px, 100% - 2rem); margin-inline: auto; }

  .nav-links a {
    display: block;
    padding: 0.7rem 0;
    font-size: 1rem;
  }

  .nav-links a::after { display: none; }
}

@media (max-width: 640px) {
  html { font-size: 16px; }

  .hero { padding-bottom: 5rem; }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .scroll-wrap {
    width: min(300px, 82%);
    margin-inline: auto;
  }

  .name-line { margin-inline: auto; }
  .links { justify-content: center; }
  .inscription { justify-content: center; }

  .hero-mountains { height: 260px; }

  .section-title { font-size: 1.75rem; }
  .section-title .zh { font-size: 2.2rem; }

  .lead::first-letter { font-size: 3em; }

  .footer-landscape { height: 180px; }
}
