:root {
  --bg: #0a0a0a;
  --bg-2: #111111;
  --fg: #f3efe6;
  --fg-dim: #8a857a;
  --line: rgba(243, 239, 230, 0.12);
  --accent: #ff5b1f;
  --accent-2: #f6c560;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: none;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
em { font-family: var(--serif); font-style: italic; font-size: 1.15em; }

/* Grain overlay */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* Cursor */
.cursor, .cursor-dot {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 200;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s ease, transform 0.15s ease-out, width 0.25s ease, height 0.25s ease, border-color 0.25s ease;
  will-change: transform;
}
.cursor {
  width: 32px; height: 32px;
  border: 1px solid var(--fg);
  border-radius: 50%;
}
.cursor-dot {
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
}
.cursor.is-hover {
  width: 64px; height: 64px;
  border-color: var(--accent);
  mix-blend-mode: difference;
}

@media (hover: none), (pointer: coarse) {
  .cursor, .cursor-dot { display: none; }
  body { cursor: auto; }
}

/* Layout */
.nav, main > section, .footer {
  padding-left: clamp(20px, 5vw, 64px);
  padding-right: clamp(20px, 5vw, 64px);
}

/* Nav */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  padding-bottom: 24px;
  z-index: 50;
  background: linear-gradient(to bottom, rgba(10, 10, 10, 0.85), rgba(10, 10, 10, 0));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.nav__mark {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.08em;
}
.nav__links {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 13px;
}
.nav__links a {
  position: relative;
  padding-bottom: 4px;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}
.nav__links a:hover::after { transform: scaleX(1); }

.nav__status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  width: 8px; height: 8px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.blink {
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* Hero */
.hero {
  min-height: 100vh;
  padding-top: 140px;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hero__meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(80px, 18vw, 280px);
  line-height: 0.88;
  letter-spacing: -0.04em;
  margin-top: 40px;
}
.hero__title .line {
  display: block;
  overflow: hidden;
}
.hero__title .line span,
.hero__title .line {
  transform: translateY(110%);
  animation: rise 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.hero__title .line:nth-child(2) { animation-delay: 0.15s; }
.line--italic {
  font-style: italic;
  color: var(--accent);
  padding-left: 0.15em;
  padding-bottom: 0.22em;
}
@keyframes rise {
  to { transform: translateY(0); }
}

/* Marquee */
.marquee {
  margin: 60px -5vw 60px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 18px 0;
}
.marquee__track {
  display: flex;
  gap: 48px;
  white-space: nowrap;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(28px, 4vw, 56px);
  animation: scroll 15s linear infinite;
  color: var(--fg);
}
.marquee__track span:nth-child(even) {
  color: var(--accent);
  font-style: normal;
}
@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* About */
.about {
  max-width: 720px;
  margin-top: 40px;
}
.about__lead {
  font-family: var(--serif);
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.about__sub {
  margin-top: 20px;
  font-size: 16px;
  color: var(--fg-dim);
  max-width: 520px;
}

/* Section heads */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 32px;
  margin-bottom: 60px;
  gap: 40px;
  flex-wrap: wrap;
}
.section-head__num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-head__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Work */
.work { padding-top: 80px; padding-bottom: 80px; }
.projects {
  display: flex;
  flex-direction: column;
}
.project {
  border-top: 1px solid var(--line);
}
.project:last-child {
  border-bottom: 1px solid var(--line);
}
.project__inner {
  display: grid;
  grid-template-columns: 60px 1fr auto 40px;
  gap: 32px;
  align-items: center;
  padding: 36px 0;
  transition: padding 0.5s cubic-bezier(0.65, 0, 0.35, 1), color 0.4s ease;
  position: relative;
}
.project__inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: -1;
}
.project__inner:hover {
  padding-left: 24px;
  padding-right: 24px;
  color: var(--bg);
}
.project__inner:hover::before {
  transform: scaleY(1);
  transform-origin: top;
}
.project__num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  transition: color 0.4s ease;
}
.project__inner:hover .project__num { color: var(--bg); }
.project__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.project__desc {
  margin-top: 6px;
  color: var(--fg-dim);
  font-size: 15px;
  max-width: 620px;
  transition: color 0.4s ease;
}
.project__inner:hover .project__desc { color: rgba(10, 10, 10, 0.75); }
.project__meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  transition: color 0.4s ease;
}
.project__inner:hover .project__meta { color: var(--bg); }
.project__arrow {
  font-family: var(--serif);
  font-size: 32px;
  transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}
.project__inner:hover .project__arrow { transform: translateX(8px) rotate(-45deg); }

/* Stack */
.stack { padding-top: 80px; padding-bottom: 80px; }
.stack__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 48px;
  border-top: 1px solid var(--line);
  padding-top: 48px;
}
.stack__col h4 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  margin-bottom: 20px;
}
.stack__col ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stack__col li {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  position: relative;
  padding-left: 18px;
  transition: padding-left 0.3s ease, color 0.3s ease;
}
.stack__col li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-style: normal;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.stack__col li:hover { padding-left: 24px; color: var(--accent-2); }
.stack__col li:hover::before { opacity: 1; transform: translateX(0); }

/* Contact */
.contact {
  padding-top: 80px;
  padding-bottom: 120px;
}
.contact__email {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(40px, 8vw, 140px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 60px;
  transition: color 0.3s ease, letter-spacing 0.3s ease;
  word-break: break-all;
}
.contact__email .at {
  font-style: normal;
  color: var(--accent);
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}
.contact__email:hover { color: var(--accent); letter-spacing: -0.025em; }
.contact__email:hover .at { transform: rotate(45deg) scale(1.2); color: var(--fg); }

.contact__links {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}
.contact__links a {
  position: relative;
  transition: color 0.3s ease;
}
.contact__links a:hover { color: var(--accent); }

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  padding-bottom: 32px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-wrap: wrap;
  gap: 16px;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile */
@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__status { font-size: 10px; }
  .project__inner {
    grid-template-columns: 32px 1fr 24px;
    gap: 16px;
    padding: 24px 0;
  }
  .project__inner:hover { padding-left: 12px; padding-right: 12px; }
  .project__meta { display: none; }
  .footer { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .marquee__track { animation: none; }
}
