/* ------------------------------------------------------------
   Manvi Jain: personal site
   Concept: EEG chart paper. A pale green millimetre grid, a dark
   green ink trace, and a reading serif for the long text.
   ------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --text: "Literata", Georgia, "Times New Roman", serif;

  --bg: #eef3ef;
  --paper: #f8fbf8;
  --ink: #10231c;
  --muted: #4d6258;
  --rule: rgba(16, 35, 28, 0.16);
  --grid: rgba(20, 99, 76, 0.09);
  --grid-major: rgba(20, 99, 76, 0.17);
  --green: #14634c;
  --green-deep: #0d4a39;
  --on-green: #ffffff;
  --trace: #0e6b53;
  --tint: #dde9e1;
  --deep: #0d3a2d;
  --on-deep: #e6f3ec;
  --deep-link: #bfe8d3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a15;
    --paper: #14231c;
    --ink: #e7efe9;
    --muted: #9bb0a4;
    --rule: rgba(231, 239, 233, 0.16);
    --grid: rgba(127, 209, 172, 0.07);
    --grid-major: rgba(127, 209, 172, 0.13);
    --green: #7fd1ac;
    --green-deep: #a4e3c4;
    --on-green: #08261c;
    --trace: #8fe0b8;
    --tint: #15271f;
    --deep: #0a2a20;
    --on-deep: #e0eee6;
    --deep-link: #a9e0c6;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

img { max-width: 100%; }

a {
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 20px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--green);
  color: var(--on-green);
  font-family: var(--display);
  font-weight: 600;
  border-radius: 8px;
}
.skip:focus { top: 12px; }

p { margin: 0 0 1em; max-width: 68ch; }
h1, h2, h3 { font-family: var(--display); }
strong { font-weight: 650; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.menu-btn {
  font: 600 0.95rem var(--display);
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

#primary-nav {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 8px 20px 20px;
}
.site-header.open #primary-nav { display: block; }
html:not(.js) #primary-nav { display: block; position: static; }

#primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
#primary-nav a {
  display: block;
  padding: 12px 4px;
  font-family: var(--display);
  font-weight: 560;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
#primary-nav a[aria-current="true"] { color: var(--green); }

@media (min-width: 1040px) {
  .menu-btn { display: none; }
  #primary-nav {
    display: block;
    position: static;
    background: none;
    border: 0;
    padding: 0;
  }
  #primary-nav ul { display: flex; gap: 2px; }
  #primary-nav a {
    padding: 8px 13px;
    border: 0;
    border-radius: 999px;
    font-size: 0.95rem;
  }
  #primary-nav a:hover { background: var(--tint); }
  #primary-nav a[aria-current="true"] {
    background: var(--green);
    color: var(--on-green);
  }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-top: clamp(40px, 8vw, 92px);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 12px 12px, 12px 12px, 60px 60px, 60px 60px;
  background-position: -1px -1px;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

.hero-copy { position: relative; z-index: 2; }

.hello {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--green);
}

.hero h1 {
  margin: 0;
  max-width: 21ch;
  font-weight: 700;
  font-stretch: 88%;
  font-size: clamp(2.2rem, 6vw, 4.3rem);
  line-height: 1.04;
  letter-spacing: -0.022em;
}

.lede {
  margin: 24px 0 0;
  max-width: 56ch;
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1.5px solid var(--green);
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}
.btn-primary { background: var(--green); color: var(--on-green); }
.btn-primary:hover { background: var(--green-deep); color: var(--on-green); }
.btn-quiet { background: transparent; color: var(--green); }
.btn-quiet:hover { background: var(--tint); }

.trace {
  position: relative;
  z-index: 1;
  height: clamp(210px, 32vw, 330px);
  margin-top: clamp(24px, 5vw, 52px);
}
.trace canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
.trace-hint {
  position: absolute;
  right: 20px;
  top: 2px;
  z-index: 3;
  margin: 0;
  font-family: var(--display);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Sections ---------- */

.band {
  padding-block: clamp(56px, 9vw, 108px);
  border-top: 1px solid var(--rule);
}
.band.tint { background: var(--tint); }

.split { display: grid; gap: 28px; }
.split-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.split-body { min-width: 0; }

@media (min-width: 900px) {
  .split {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 56px;
  }
  .split-title { position: sticky; top: 92px; align-self: start; }
}

.big {
  max-width: 36em;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.45;
}

/* About */

.portrait { margin: 0 0 28px; max-width: 280px; }
.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 18px;
}

.threads { margin: 32px 0; }
.threads > div {
  display: grid;
  gap: 4px 24px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.threads > div:last-child { border-bottom: 1px solid var(--rule); }
.threads dt { font-family: var(--display); font-weight: 650; color: var(--green); }
.threads dd { margin: 0; max-width: 52ch; }
@media (min-width: 700px) {
  .threads > div { grid-template-columns: 190px 1fr; }
}

/* Timeline */

.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 30px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--rule);
}
.tl-item { position: relative; padding-bottom: 30px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: var(--bg);
}
.tl-item.now::before { background: var(--green); }
.tl-role { margin: 0; font-weight: 650; font-size: 1.2rem; line-height: 1.3; }
.tl-org, .tl-when { margin: 2px 0 0; }
.tl-when { font-family: var(--display); font-size: 0.92rem; color: var(--muted); }

/* Tabs */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tab {
  font: 600 0.95rem var(--display);
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.tab:hover { border-color: var(--green); }
.tab[aria-selected="true"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-green);
}
.tab .count { margin-left: 7px; font-weight: 500; opacity: 0.75; }

/* Ledger rows */

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  gap: 6px 32px;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
}
.row:last-child { border-bottom: 1px solid var(--rule); }
.row p:last-child { margin-bottom: 0; }
.row h3 {
  margin: 0 0 6px;
  font-weight: 650;
  font-size: 1.15rem;
  line-height: 1.3;
}
.row-meta {
  margin: 0;
  font-family: var(--display);
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--muted);
}
@media (min-width: 760px) {
  .row { grid-template-columns: 200px minmax(0, 1fr); }
}

/* Highlights filter */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  font: 600 0.92rem var(--display);
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
}
.chip:hover { border-color: var(--green); }
.chip[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-green);
}

/* Videos */

.vgroup { margin-top: 36px; }
.vgroup h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--green);
}
.vlist { list-style: none; margin: 0; padding: 0; }
.vlist a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
.vlist li:last-child a { border-bottom: 1px solid var(--rule); }
.vlist a:hover .vtitle { text-decoration: underline; text-underline-offset: 3px; }
.play {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--green);
}
.band.tint .play { background: var(--bg); }

/* Reflections */

.posts { border-bottom: 1px solid var(--rule); }
.post { border-top: 1px solid var(--rule); }
.post summary {
  position: relative;
  display: block;
  padding: 22px 48px 22px 0;
  cursor: pointer;
  list-style: none;
}
.post summary::-webkit-details-marker { display: none; }
.post summary::after {
  content: "+";
  position: absolute;
  right: 6px;
  top: 16px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1;
  color: var(--green);
  transition: transform 0.25s;
}
.post[open] summary::after { transform: rotate(45deg); }
.post-title {
  display: block;
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.3rem;
  line-height: 1.3;
}
.post-sub {
  display: block;
  margin-top: 4px;
  font-family: var(--display);
  font-size: 0.95rem;
  color: var(--muted);
}
.post-body { padding: 0 0 28px; max-width: 68ch; }
.post[open] .post-body { animation: open 0.3s ease; }
@keyframes open {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* Research assistance */

.help-grid { display: grid; gap: 36px; margin-top: 44px; }
.help-grid h3 {
  margin: 0 0 8px;
  font-weight: 650;
  font-size: 1.15rem;
}
.help-grid > div > h3:not(:first-child) { margin-top: 28px; }

/* Contact */

.band.contact {
  background: var(--deep);
  color: var(--on-deep);
  border-top: 0;
}
.contact a { color: var(--deep-link); }
.contact .btn { color: inherit; }
.contact-lede { font-size: 1.25rem; line-height: 1.5; }
.mail {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 90%;
  font-size: clamp(1.5rem, 5.4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--display);
  font-weight: 600;
}

.site-footer {
  padding: 22px 0 30px;
  background: var(--deep);
  color: var(--on-deep);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--display);
  font-size: 0.9rem;
}
.site-footer p { margin: 0; }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
