/* =========================================================
   Kulilin · Personal Brand
   Dark editorial · amber accent
   ========================================================= */

:root {
  --bg: #0c0b09;
  --bg-elevated: #141210;
  --bg-card: #161410;
  --bg-card-hover: #1c1914;
  --ink: #f2efe8;
  --ink-muted: #a39e93;
  --ink-faint: #6b665c;
  --line: rgba(242, 239, 232, 0.08);
  --line-strong: rgba(242, 239, 232, 0.14);
  --accent: #d4a574;
  --accent-soft: rgba(212, 165, 116, 0.16);
  --accent-glow: rgba(212, 165, 116, 0.35);

  --font-cn: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-en: "Instrument Sans", "Noto Sans SC", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 4.5rem;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --max: 72rem;
  --cursor-size: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: auto;
  -webkit-text-size-adjust: 100%;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  font-family: var(--font-cn);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-weight: 400;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

body.has-cursor {
  cursor: none;
}

body.has-cursor a,
body.has-cursor button,
body.has-cursor .magnetic {
  cursor: none;
}

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

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

ul {
  list-style: none;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

/* Noise overlay — subtle film grain */
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9990;
  opacity: 0.035;
  mix-blend-mode: overlay;
  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");
}

/* Custom cursor */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--cursor-size);
  height: var(--cursor-size);
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 10000;
  transform: translate3d(-100px, -100px, 0);
  mix-blend-mode: difference;
  opacity: 0;
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), opacity 0.3s ease;
  will-change: transform;
}

.cursor.is-visible {
  opacity: 1;
}

.cursor.is-hover {
  width: 28px;
  height: 28px;
  background: var(--ink);
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--pad);
  background: linear-gradient(to bottom, rgba(12, 11, 9, 0.92), rgba(12, 11, 9, 0));
  backdrop-filter: blur(0px);
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

.site-header.is-scrolled {
  background: rgba(12, 11, 9, 0.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.logo {
  font-family: var(--font-en);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  display: inline-block;
}

.nav {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}

.nav-link {
  font-size: 0.9rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  transition: color 0.3s ease;
  display: inline-block;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.25em;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease-out);
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--ink);
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  transform: scaleX(1);
}

/* Hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 2rem) var(--pad) 5rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: min(55vw, 36rem);
  height: min(55vw, 36rem);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
  filter: blur(20px);
}

.hero-inner {
  position: relative;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
}

.hero-eyebrow {
  font-family: var(--font-en);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.75rem;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.75rem;
}

.hero-cn {
  display: block;
  font-size: clamp(3.2rem, 11vw, 7.5rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.08em;
  overflow: hidden;
}

.hero-en {
  display: block;
  font-family: var(--font-en);
  font-size: clamp(1.6rem, 4.5vw, 2.75rem);
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  overflow: hidden;
}

.split-line,
.split-char,
.split-word {
  display: inline-block;
  will-change: transform, opacity;
}

.split-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.hero-sub {
  max-width: 28rem;
  color: var(--ink-muted);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 300;
  margin-bottom: 2.75rem;
  line-height: 1.7;
}

/* CTA */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #1a140e;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: background 0.3s ease, transform 0.3s var(--ease-out), box-shadow 0.3s ease;
  box-shadow: 0 0 0 0 transparent;
}

.cta:hover,
.cta:focus-visible {
  background: #e0b588;
  box-shadow: 0 8px 32px var(--accent-glow);
}

.cta-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.cta-outline:hover,
.cta-outline:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: none;
}

.cta-arrow {
  font-family: var(--font-en);
  transition: transform 0.35s var(--ease-out);
}

.cta:hover .cta-arrow {
  transform: translateY(3px);
}

.cta-outline:hover .cta-arrow {
  transform: translateX(4px);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 3.5rem;
  overflow: hidden;
  opacity: 0.45;
}

.hero-scroll-hint span {
  display: block;
  width: 100%;
  height: 40%;
  background: var(--accent);
  animation: scrollPulse 2.2s var(--ease-out) infinite;
}

@keyframes scrollPulse {
  0% { transform: translateY(-100%); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(250%); opacity: 0; }
}

/* Sections */
.section {
  padding: clamp(5rem, 14vh, 9rem) var(--pad);
  border-top: 1px solid var(--line);
}

.section-grid {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(6rem, 10rem) 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

.section-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--font-en);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 0.4rem;
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

.section-label .num {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
  max-width: 18em;
}

.about-text,
.contact-text {
  max-width: 36rem;
  color: var(--ink-muted);
  font-weight: 300;
  font-size: 1.0625rem;
  margin-bottom: 2rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.tag {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.85rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
  margin-top: 0.5rem;
}

.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  padding: 1.6rem 1.5rem 1.5rem;
  min-height: 15rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.45s var(--ease-out), border-color 0.35s ease, background 0.35s ease, box-shadow 0.45s ease;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, var(--accent-soft), transparent 55%);
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(212, 165, 116, 0.35);
  background: var(--bg-card-hover);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.card:hover::before {
  opacity: 1;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.card-index {
  font-family: var(--font-en);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.card-status {
  font-size: 0.75rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.65rem;
  position: relative;
  letter-spacing: 0.02em;
}

.card-desc {
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.65;
  flex: 1;
  position: relative;
}

.card-link {
  margin-top: 1.5rem;
  font-family: var(--font-en);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  position: relative;
}

/* Contact */
.contact-body .cta {
  margin-top: 0.5rem;
}

/* Footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 2rem var(--pad) 2.5rem;
  border-top: 1px solid var(--line);
  max-width: calc(var(--max) + 2 * var(--pad));
  margin: 0 auto;
  color: var(--ink-faint);
  font-size: 0.85rem;
  font-family: var(--font-en);
}

.back-top {
  color: var(--ink-muted);
  transition: color 0.3s ease;
  display: inline-block;
}

.back-top:hover {
  color: var(--accent);
}

/* Reveal defaults (JS enhances) */
.reveal,
.reveal-line,
.reveal-card {
  opacity: 1;
}

/* Magnetic wrappers keep layout stable */
.magnetic {
  display: inline-block;
  will-change: transform;
}

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

  .section-label {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .nav {
    gap: 1rem;
  }

  .nav-link {
    font-size: 0.82rem;
  }

  .hero {
    padding-bottom: 4rem;
  }

  .hero-cn {
    letter-spacing: 0.04em;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-scroll-hint span {
    animation: none;
    opacity: 0.5;
    transform: none;
  }

  .card:hover {
    transform: none;
  }

  .cursor {
    display: none !important;
  }

  body.has-cursor,
  body.has-cursor a,
  body.has-cursor button,
  body.has-cursor .magnetic {
    cursor: auto;
  }
}

@media (pointer: coarse) {
  .cursor {
    display: none !important;
  }

  body.has-cursor {
    cursor: auto;
  }
}
