/* =========================================================
   Archi Tyagi — Portfolio
   Elevated warm editorial · bold dynamic motion
   ========================================================= */

:root {
  --bg: #f1ece4;
  --bg-2: #e8e1d6;
  --ink: #1a1a1a;
  --ink-2: #3a3a3a;
  --muted: #8a8378;
  --line: #cdc5b8;
  --line-soft: #ded7ca;
  --peach: #f4c8b1;
  --peach-deep: #e9a98a;
  --sage: #cfd9c8;
  --sky: #c9d6e0;
  --cream: #faf6ef;
  --serif: "Fraunces", "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(24px, 6vw, 96px);
  --ease: cubic-bezier(.16,1,.3,1);
}

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

html { scroll-behavior: smooth; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--peach-deep); color: var(--ink); }

/* ---------- Animated aurora canvas (the "bold" motion) ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  filter: blur(72px) saturate(135%);
  opacity: 0.85;
  transform: translateZ(0);
}

/* ---------- Paper grain overlay ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.32'/%3E%3C/svg%3E");
}

/* ---------- Fixed grid guide lines ---------- */
.grid-lines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  padding: 0 var(--gutter);
}
.grid-lines span {
  border-left: 1px solid var(--line);
  opacity: 0.28;
}
.grid-lines span:last-child { border-right: 1px solid var(--line); }
@media (max-width: 900px) { .grid-lines { display: none; } }

.page {
  position: relative;
  z-index: 3;
}

/* ---------- Custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.cursor-dot {
  width: 7px; height: 7px;
  background: #fff;
}
.cursor-ring {
  width: 38px; height: 38px;
  border: 1px solid #fff;
  transition: width .3s var(--ease), height .3s var(--ease), background .3s var(--ease), opacity .3s;
}
.cursor-ring.hover {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.12);
}
@media (hover: none), (max-width: 900px) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px var(--gutter);
  z-index: 50;
  mix-blend-mode: multiply;
}
.nav .mark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  font-style: italic;
}
.nav ul {
  display: flex;
  gap: 36px;
  list-style: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav a { position: relative; padding: 6px 0; transition: opacity 0.2s; }
.nav a:hover { opacity: 0.55; }
.nav ul a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.nav ul a:hover::after { transform: scaleX(1); }
@media (max-width: 900px) { .nav ul { display: none; } }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  padding: 180px var(--gutter) 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.hero-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.hero .eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.hero .eyebrow::before,
.hero .eyebrow::after {
  content: "";
  width: 48px; height: 1px;
  background: var(--peach-deep);
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(56px, 11vw, 180px);
  line-height: 0.92;
  letter-spacing: -0.045em;
  color: var(--ink);
}
.hero h1 .split-line { white-space: nowrap; line-height: 0.92; }
.hero h1 .italic { font-style: italic; font-weight: 300; color: var(--peach-deep); }

.hero-sub {
  margin-top: 40px;
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(19px, 1.7vw, 26px);
  color: var(--ink-2);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.hero-meta {
  margin-top: 56px;
  display: flex;
  gap: 56px;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.5;
}
.hero-meta > div { display: flex; flex-direction: column; gap: 6px; }
.hero-meta > div span:first-child { color: var(--muted); }

.hero-cta-row { margin-top: 56px; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 34px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: transform 0.5s var(--ease), background 0.4s ease, color 0.4s ease;
  border: 1px solid var(--ink);
}
.btn-solid { background: var(--ink); color: var(--cream); }
.btn-solid:hover { background: var(--peach-deep); border-color: var(--peach-deep); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--cream); }
.btn .arrow { display: inline-block; transition: transform 0.5s var(--ease); }
.btn:hover .arrow { transform: translate(3px, 0); }

/* ---------- Marquee band (kinetic type) ---------- */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 26px 0;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}
.marquee-track {
  display: inline-flex;
  gap: 0;
  animation: marquee 32s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(28px, 4vw, 56px);
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: 0 36px;
}
.marquee-track span .dot { color: var(--peach-deep); font-style: normal; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Section header ---------- */
.section { padding: 150px var(--gutter); position: relative; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 80px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 28px;
  gap: 24px;
}
.section-head .label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(52px, 8vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.035em;
}
.section-head h2 em { font-style: italic; color: var(--peach-deep); }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; }
.about p {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
}
.about p + p { margin-top: 24px; }
.about p .accent { background: var(--peach); padding: 0 4px; }
.about p em { font-style: italic; color: var(--ink); }

.about-aside { position: relative; }
.about-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 30px 60px -40px rgba(0,0,0,0.2);
}
.about-card .row {
  display: flex;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
}
.about-card .row:last-child { border-bottom: none; padding-bottom: 0; }
.about-card .row .k { color: var(--muted); text-transform: uppercase; letter-spacing: 0.18em; font-size: 10px; }
.about-card .row .v { color: var(--ink); }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  perspective: 1500px;
}
.skill-card {
  background: var(--cream);
  border: 1px solid var(--line);
  padding: 28px 22px;
  border-radius: 6px;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease), box-shadow 0.5s;
  position: relative;
  overflow: hidden;
}
.skill-card:hover { box-shadow: 0 30px 60px -30px rgba(0,0,0,0.28); }
.skill-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent, var(--peach));
}
.skill-card .num { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--muted); }
.skill-card h3 { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 28px; letter-spacing: -0.02em; }
.skill-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

/* ---------- Projects ---------- */
.featured {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
  padding: 56px;
  background: var(--cream);
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 40px 80px -50px rgba(0,0,0,0.25);
}
.featured .visual {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
  background: var(--bg-2);
  border-radius: 8px;
  overflow: hidden;
}
.featured-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.featured .visual-tag {
  position: absolute;
  bottom: 16px; left: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255,255,255,0.7);
  padding: 6px 10px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.featured .body { display: flex; flex-direction: column; justify-content: center; }
.featured .kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--peach-deep);
  margin-bottom: 16px;
}
.featured h3 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}
.featured h3 em { font-style: italic; color: var(--peach-deep); }
.featured p { color: var(--ink-2); margin-bottom: 24px; text-wrap: pretty; }
.featured .stack { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.featured + .featured { margin-top: 28px; }
.featured.reverse { grid-template-columns: 0.9fr 1.1fr; }

/* Static decorative visual (layered dossier pages) */
.visual-static {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sky), var(--cream));
}
.visual-art { position: relative; width: 58%; aspect-ratio: 1 / 1; }
.visual-art span {
  position: absolute;
  inset: 8%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 20px 40px -28px rgba(0,0,0,0.3);
}
.visual-art span:nth-child(1) { transform: rotate(-9deg) translate(-10px, 6px); }
.visual-art span:nth-child(3) { transform: rotate(9deg) translate(10px, -6px); }
.visual-art em {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(80px, 12vw, 150px);
  color: var(--peach-deep);
  z-index: 2;
}

.projects-note {
  margin-top: 48px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  color: var(--muted);
  text-wrap: pretty;
}
.projects-note em { color: var(--ink); font-style: italic; }

/* ---------- Open Source ---------- */
.os-card {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 60px;
  padding: 56px;
  background: linear-gradient(135deg, var(--sage), var(--cream));
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 40px 80px -50px rgba(0,0,0,0.25);
}
.os-card .body { z-index: 2; }
.os-card .kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 20px;
}
.os-card h3 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.os-card h3 em { font-style: italic; }
.os-card p { font-size: 17px; line-height: 1.5; color: var(--ink-2); margin-bottom: 32px; max-width: 90%; }
.os-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.os-pill {
  padding: 8px 16px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
}
.os-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  background: var(--cream);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.os-stat .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}
.os-stat .stat-row:last-child { border-bottom: none; padding-bottom: 0; }
.os-stat .stat-row .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.os-stat .stat-row .value { font-family: var(--serif); font-weight: 300; font-size: 26px; font-style: italic; }
.os-stat .merged {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--peach);
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
  align-self: flex-start;
}

/* ---------- Contact ---------- */
.contact { padding: 160px var(--gutter) 80px; position: relative; }
.contact h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(80px, 14vw, 220px);
  line-height: 0.88;
  letter-spacing: -0.045em;
  margin-bottom: 60px;
}
.contact h2 em { font-style: italic; color: var(--peach-deep); }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}
.contact-cell {
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: padding-left 0.4s var(--ease);
}
.contact-cell + .contact-cell { border-left: 1px solid var(--line); padding-left: 36px; }
.contact-cell:hover { padding-left: 12px; }
.contact-cell + .contact-cell:hover { padding-left: 48px; }
.contact-cell .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.contact-cell .value { font-family: var(--serif); font-weight: 300; font-size: 24px; letter-spacing: -0.01em; }
.contact-cell:hover .value { color: var(--peach-deep); }
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-cell + .contact-cell { border-left: none; padding-left: 0; }
  .contact-cell + .contact-cell:hover { padding-left: 12px; }
}

.footer {
  margin-top: 120px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Reveal animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(56px);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
  will-change: transform, opacity;
}
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 1.1s var(--ease), transform 1.2s var(--ease);
}
.reveal-stagger.in > * { opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(1) { transition-delay: 0.08s; }
.reveal-stagger.in > *:nth-child(2) { transition-delay: 0.18s; }
.reveal-stagger.in > *:nth-child(3) { transition-delay: 0.28s; }
.reveal-stagger.in > *:nth-child(4) { transition-delay: 0.38s; }
.reveal-stagger.in > *:nth-child(5) { transition-delay: 0.48s; }
.reveal-stagger.in > *:nth-child(6) { transition-delay: 0.58s; }
.reveal-stagger.in > *:nth-child(7) { transition-delay: 0.68s; }

.split-line { display: inline-block; overflow: hidden; vertical-align: top; }
.split-line span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1.3s cubic-bezier(.5,.05,.1,1);
}
.split-line.in span { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .marquee-track { animation: none; }
  #bg-canvas { display: none; }
}

@media (max-width: 900px) {
  .hero { padding: 140px 24px 70px; }
  .about { grid-template-columns: 1fr; gap: 40px; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .featured, .featured.reverse { grid-template-columns: 1fr; padding: 28px; }
  .visual-static { min-height: 240px; }
  .os-card { grid-template-columns: 1fr; padding: 32px; }
}
