/* ==========================================================================
   Lily Ren · Portfolio · Global stylesheet
   Palette locked to cool tones. Inter + JetBrains Mono only.
   ========================================================================== */

:root {
  /* Core palette */
  --bg:          #ECECEC;
  --surface:     #F3F3F3;
  --ink:         #111111;
  --ink-soft:    #2A2A2A;
  --muted:       #838890;
  --line:        #D4D7DB;
  --line-soft:   #E3E5E8;
  --accent:      #6B7B8C;
  --accent-soft: #8A99A9;
  --black:       #0A0A0A;
  --dark:        #141414;
  --white:       #FFFFFF;

  /* Motion */
  --ease: cubic-bezier(.22,.61,.36,1);
  --bg-ease: 600ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  font-optical-sizing: auto;
  letter-spacing: -0.005em;
}

/* Dark section mode — applied via body class by scroll observer on polestar page */
body.is-dark { background: var(--black); color: #E8E8E8; }
body.is-dark .nav-pill { background: rgba(15,15,15,0.72); color: #E8E8E8; border-color: rgba(255,255,255,0.08); }
body.is-dark .site-footer { background: var(--black); color: #9aa0a8; border-top-color: rgba(255,255,255,0.08); }

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

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.kicker .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.display {
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.98;
  color: var(--ink);
}
.display .accent-italic {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
p { margin: 0 0 1em 0; }

/* Layout helpers */
.wrap {
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  padding: 0 96px;
}
@media (max-width: 1100px) { .wrap { padding: 0 64px; } }
@media (max-width: 720px) { .wrap { padding: 0 28px; } }
.section { padding: 140px 0; }
@media (max-width: 720px) { .section { padding: 80px 0; } }

.section-dark { background: var(--black); color: #E8E8E8; }
.section-dark .mono, .section-dark .kicker { color: #9aa0a8; }
.section-dark .display { color: #F3F3F3; }

/* ==========================================================================
   Nav — floating pill, top-center
   ========================================================================== */
.nav-wrap {
  position: fixed;
  top: 20px;
  left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.nav-wrap.is-hidden { opacity: 0; transform: translateY(-12px); }

.nav-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 18px 10px 14px;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 13px;
  letter-spacing: -0.005em;
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.nav-brand .mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink);
  position: relative;
}
.nav-brand .mark::after {
  content: ""; position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.nav-links { display: flex; gap: 22px; }
.nav-links a { position: relative; padding: 4px 2px; color: var(--ink-soft); transition: color 250ms var(--ease); }
.nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after {
  content: ""; position: absolute;
  left: 50%; bottom: -6px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}
.nav-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; }

@media (max-width: 720px) {
  .nav-pill { gap: 14px; padding: 8px 14px; font-size: 12px; }
  .nav-links { gap: 14px; }
  .nav-meta { display: none; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0;
  background: var(--bg);
  color: var(--muted);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer .brand-lockup { font-weight: 600; letter-spacing: -0.02em; color: var(--ink); font-size: 18px; }
.site-footer .copy { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; }
.site-footer .email { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--ink-soft); }
body.is-dark .site-footer .brand-lockup { color: #F0F0F0; }
body.is-dark .site-footer .email { color: #C9CED4; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 14px 22px;
  border-radius: 100px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1;
  border: 1px solid transparent;
  transition: background 250ms var(--ease), color 250ms var(--ease), border-color 250ms var(--ease);
  cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: var(--dark); color: var(--white); }
.btn-primary .arrow {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--white);
  font-size: 11px;
  transition: background 250ms var(--ease);
}
.btn-primary:hover .arrow { background: var(--accent-soft); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
body.is-dark .btn-ghost { color: #E8E8E8; border-color: rgba(255,255,255,0.2); }
body.is-dark .btn-ghost:hover { border-color: #E8E8E8; }

/* Circular CTA used on project cards */
.cta-circle {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  font-size: 14px;
  transition: background 300ms var(--ease), color 300ms var(--ease), border-color 300ms var(--ease), transform 300ms var(--ease);
  background: var(--white);
}
.cta-circle:hover { background: var(--accent); color: var(--white); border-color: var(--accent); }

/* ==========================================================================
   Stagger rise-in (for hero text)
   ========================================================================== */
.rise { opacity: 0; transform: translateY(18px); animation: rise 0.9s var(--ease) forwards; }
.rise-1 { animation-delay: 0.05s; }
.rise-2 { animation-delay: 0.18s; }
.rise-3 { animation-delay: 0.30s; }
.rise-4 { animation-delay: 0.42s; }
.rise-5 { animation-delay: 0.55s; }
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Flush media rules
   ========================================================================== */
.flush { width: 100%; margin: 0; padding: 0; }
.flush img, .flush video { width: 100%; height: auto; display: block; border-radius: 0; }
.flush-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.flush-grid-2 > * { width: 100%; }
.flush-grid-2 img, .flush-grid-2 video { width: 100%; height: 100%; object-fit: cover; display: block; }

.media-caption {
  display: block;
  padding: 22px 96px 60px 96px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
@media (max-width: 1100px) { .media-caption { padding: 22px 64px 48px 64px; } }
@media (max-width: 720px) { .media-caption { padding: 18px 28px 40px 28px; } }
.section-dark .media-caption { color: #9aa0a8; }

/* ==========================================================================
   Utility
   ========================================================================== */
.hairline { border-bottom: 1px solid var(--line); }
.hairline-soft { border-bottom: 1px solid var(--line-soft); }

/* ==========================================================================
   Custom cursor — dot (instant) + ring (lagging), auto-invert via blend mode
   Only on hover-capable devices with fine pointer; falls back to native on touch.
   ========================================================================== */
@media (hover: hover) and (pointer: fine) {
  html, body { cursor: none; }
  a, button, [role="button"], label, .btn, .cta-circle, .proj-card, .pillar-card,
  .hover-reveal, .process-toggle, .lang-toggle button, [data-toggle],
  .y-cell, .pill, .slot, svg, img, video {
    cursor: none;
  }
  input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
  textarea,
  [contenteditable="true"] { cursor: text; }

  .cursor-dot, .cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    opacity: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    will-change: transform;
  }
  .cursor-dot {
    width: 6px;
    height: 6px;
    background: #FFFFFF;
    mix-blend-mode: difference;
    z-index: 10000;
    transition: opacity 180ms var(--ease),
                width 220ms var(--ease),
                height 220ms var(--ease);
  }
  .cursor-ring {
    width: 34px;
    height: 34px;
    border: 1px solid #FFFFFF;
    mix-blend-mode: difference;
    z-index: 9999;
    transition: opacity 180ms var(--ease),
                width 300ms var(--ease),
                height 300ms var(--ease),
                border-width 200ms var(--ease);
  }

  body.cursor-hover .cursor-dot {
    width: 0;
    height: 0;
  }
  body.cursor-hover .cursor-ring {
    width: 58px;
    height: 58px;
    border-width: 1.5px;
  }
}
