/* ============================================================
   Robin Mehta — personal site v1
   brutalist-editorial: cream paper, ink, one loud accent
   ============================================================ */

:root {
  --paper: #f3eee3;
  --ink: #171310;
  --soft: #6f675c;
  --accent: #5b3df5;
  --rule: 2px solid var(--ink);
  --pad: clamp(1.25rem, 4vw, 4rem);
}

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

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

html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* faint paper-noise */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

h1, h2, h3, .work-name {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
}

code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem var(--pad);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: var(--rule);
}
.nav-mark {
  font-family: "Instrument Serif", serif;
  font-size: 1.5rem; text-decoration: none; letter-spacing: 0.02em;
}
.nav-mark .star { color: var(--accent); margin-left: 2px; }
.nav-links { display: flex; gap: clamp(0.75rem, 2.5vw, 2rem); }
.nav-links a {
  text-decoration: none; text-transform: uppercase;
  font-size: 0.78rem; letter-spacing: 0.12em; font-weight: 500;
}
.nav-links a:hover { color: var(--accent); }
.nav-cta {
  text-decoration: none; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.12em; font-weight: 700;
  border: var(--rule); padding: 0.45rem 0.9rem; border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.nav-cta:hover { background: var(--ink); color: var(--paper); }

/* ---------- hero ---------- */
.hero { padding: clamp(4rem, 12vh, 8rem) var(--pad) clamp(3rem, 8vh, 5rem); }

.kicker {
  text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.8rem; font-weight: 500; color: var(--soft);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(3rem, 10.5vw, 8.5rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero h1 em { color: var(--accent); }

.hero-sub {
  max-width: 44rem;
  margin-top: 2.25rem;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
}

.ai-word {
  all: unset; cursor: pointer;
  font-weight: 700; color: var(--accent);
  border-bottom: 3px solid var(--accent);
  transition: transform 0.12s;
}
.ai-word:hover { transform: rotate(-2deg) scale(1.08); display: inline-block; }

/* ---------- marquee ---------- */
.marquee {
  overflow: hidden; white-space: nowrap;
  border-top: var(--rule); border-bottom: var(--rule);
  padding: 0.7rem 0;
  font-family: "Instrument Serif", serif;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
}
.marquee-track { display: inline-block; animation: marquee 28s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
.section { padding: clamp(3.5rem, 9vh, 7rem) var(--pad); }

.section-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1.25rem;
  align-items: baseline;
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}
.index {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.9rem; color: var(--accent); font-weight: 700;
}
.section-head h2 {
  font-size: clamp(2.6rem, 6.5vw, 5rem);
  line-height: 1;
}
.section-note {
  grid-column: 2;
  max-width: 38rem; color: var(--soft);
}

/* ---------- work list ---------- */
.work-list { list-style: none; border-top: var(--rule); }
.work-row { border-bottom: var(--rule); }
.work-row > a {
  display: grid;
  grid-template-columns: 3.2rem 1.15fr 2fr 1fr;
  gap: 1rem; align-items: baseline;
  padding: 1.4rem 0.25rem;
  text-decoration: none;
  transition: padding-left 0.18s ease, background 0.18s;
}
.work-row > a:hover { padding-left: 1.25rem; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.work-no {
  font-family: ui-monospace, Menlo, monospace;
  color: var(--accent); font-size: 0.95rem;
}
.work-name { font-size: clamp(1.8rem, 3.6vw, 3rem); line-height: 1; }
.work-row > a:hover .work-name { font-style: italic; }
.work-desc { color: var(--ink); }
.work-meta {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--soft); text-align: right;
}

/* cursor-follow preview */
.cursor-preview {
  position: fixed; z-index: 90;
  width: clamp(220px, 24vw, 360px);
  border: var(--rule); border-radius: 6px;
  pointer-events: none;
  opacity: 0; transform: scale(0.94) rotate(2deg);
  transition: opacity 0.18s, transform 0.18s;
  box-shadow: 8px 8px 0 rgba(23, 19, 16, 0.25);
  background: #fff;
}
.cursor-preview.on { opacity: 1; transform: scale(1) rotate(2deg); }

/* phone strip */
.phone-strip {
  margin-top: clamp(2.5rem, 6vh, 4rem);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.75rem, 2vw, 1.5rem);
}
.phone-strip img {
  width: 100%; border: var(--rule); border-radius: 18px;
  transition: transform 0.25s ease;
}
.phone-strip img:nth-child(odd):hover { transform: rotate(-2deg) translateY(-8px); }
.phone-strip img:nth-child(even):hover { transform: rotate(2deg) translateY(-8px); }

/* ---------- systems (dark) ---------- */
.section-dark {
  background: var(--ink); color: var(--paper);
  --rule: 2px solid color-mix(in srgb, var(--paper) 30%, transparent);
}
.section-dark .section-note { color: color-mix(in srgb, var(--paper) 65%, transparent); }

.sys-for {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--paper) 45%, transparent);
}
.sys-tags {
  display: block; margin-top: 1rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: color-mix(in srgb, var(--paper) 55%, transparent);
}

/* featured systems */
.sys-featured article {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(2rem, 5vh, 3.25rem) 0;
  border-top: var(--rule);
}
.sys-featured article:nth-child(even) .sys-feat-text { order: 2; }
.sys-feat-text .sys-for { display: block; margin-bottom: 0.9rem; }
.sys-feat-text h3 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); margin-bottom: 0.7rem; }
.sys-feat-text p { color: color-mix(in srgb, var(--paper) 82%, transparent); }
.visual-cap {
  margin-top: 0.7rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: color-mix(in srgb, var(--paper) 55%, transparent);
}
.slide-pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(0.75rem, 1.5vw, 1.25rem); }
.slide-pair img { width: 100%; border: var(--rule); border-radius: 8px; }
.cutout-row {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: clamp(0.5rem, 1.2vw, 1rem); align-items: center;
}
.cutout-row img {
  width: 100%;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
  transition: transform 0.2s;
}
.cutout-row img:hover { transform: scale(1.15) rotate(3deg); }

/* systems index */
.sys-index {
  list-style: none;
  border-top: var(--rule);
  margin-top: clamp(1.5rem, 4vh, 2.5rem);
}
.sys-index li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) auto;
  gap: 1rem; align-items: baseline;
  padding: 0.85rem 0.25rem;
  border-bottom: var(--rule);
  transition: background 0.15s, padding-left 0.15s;
}
.sys-index li:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); padding-left: 0.9rem; }
.idx-name { font-family: "Instrument Serif", serif; font-size: 1.35rem; }
.idx-desc { font-size: 0.92rem; color: color-mix(in srgb, var(--paper) 68%, transparent); }
.idx-for {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--paper) 45%, transparent);
}

.sys-strip { margin-top: clamp(2rem, 5vh, 3rem); }
.sys-strip img { width: 100%; border: var(--rule); border-radius: 8px; }
.sys-strip figcaption {
  margin-top: 0.6rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: color-mix(in srgb, var(--paper) 55%, transparent);
}
.pixie-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.4rem, 1vw, 0.9rem);
}
.pixie-row img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 999px;
  transition: transform 0.2s;
}
.pixie-row img:hover { transform: scale(1.12) rotate(-3deg); }
@media (max-width: 560px) { .pixie-row { grid-template-columns: repeat(4, 1fr); } }
.sys-visuals figcaption {
  margin-top: 0.6rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--paper) 60%, transparent);
}

/* ---------- lab ---------- */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2.5vw, 2rem);
}
.lab-card img {
  width: 100%; border: var(--rule); border-radius: 8px;
  filter: grayscale(0.15);
  transition: filter 0.25s, transform 0.25s;
}
.lab-card:hover img { filter: none; transform: translateY(-6px); }
.lab-card figcaption { margin-top: 0.6rem; font-size: 0.9rem; color: var(--soft); }
.lab-card figcaption strong { color: var(--ink); font-weight: 700; }

/* ---------- about ---------- */
.about-body { max-width: 46rem; }
.about-lede {
  font-family: "Instrument Serif", serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.3;
  margin-bottom: 1.5rem;
}
.contact-row {
  margin-top: 2.5rem;
  display: flex; flex-wrap: wrap; gap: 0.9rem;
}
.contact-link {
  text-decoration: none;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  border: var(--rule); border-radius: 999px;
  padding: 0.55rem 1.1rem;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.contact-link:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); transform: rotate(-1.5deg); }

/* ---------- footer ---------- */
.footer {
  border-top: var(--rule);
  padding: 1.25rem var(--pad);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.85rem; color: var(--soft);
}

/* ---------- reveals ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .sys-featured article { grid-template-columns: 1fr; align-items: start; }
  .sys-featured article:nth-child(even) .sys-feat-text { order: 0; }
  .sys-index li { grid-template-columns: 1fr; gap: 0.15rem; }
  .idx-for { display: none; }
  .lab-grid { grid-template-columns: 1fr 1fr; }
  .work-row > a { grid-template-columns: 2.4rem 1fr; grid-template-rows: auto auto auto; }
  .work-desc { grid-column: 2; }
  .work-meta { grid-column: 2; text-align: left; }
  .cursor-preview { display: none; }
}
@media (max-width: 560px) {
  .nav-links { display: none; }
  .lab-grid { grid-template-columns: 1fr; }
  .phone-strip { grid-template-columns: 1fr 1fr; }
  .cutout-row { grid-template-columns: repeat(3, 1fr); }
}
