/* ============================================================
   KARTHIK VISWANATHAN
   Warm editorial · Artistic · Minimal
   ============================================================ */

:root {
  --bg:       #f7f2ea;
  --bg-alt:   #f0ebe0;
  --ink:      #1c1510;
  --text:     #3a2f28;
  --muted:    #7c6d61;
  --faint:    #b0a193;
  --wine:     #721c28;
  --violet:   #6b5490;
  --gold:     #a87228;
  --rule:     #ddd4c5;

  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans:  'Inter', system-ui, sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Hello screen ── */
#hello-screen {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: #f7f2ea;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: helloScreenFade 2.4s ease forwards;
}
#hello-screen span {
  font-family: var(--serif);
  font-size: clamp(3rem, 9vw, 6.5rem);
  font-weight: 300;
  color: var(--ink);
  letter-spacing: 0.18em;
  animation: helloTextAnim 2.4s ease forwards;
}
@keyframes helloScreenFade {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes helloTextAnim {
  0%   { opacity: 0; transform: translateY(14px); }
  18%  { opacity: 1; transform: translateY(0); }
  60%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: transparent; /* canvas provides the bg */
  color: var(--text);
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.8;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
::selection { background: rgba(114, 28, 40, 0.15); }

/* ============================================================
   SCROLL PROGRESS — just a thin wine line at top
   ============================================================ */
#scroll-progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 1px;
  width: 0%;
  background: var(--wine);
  z-index: 999;
  transition: width 0.1s linear;
  opacity: 0.6;
}

/* ============================================================
   ANIMAL BACKGROUND — canvas paints the whole background
   ============================================================ */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
#navbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 7%;
  transition: background 0.4s var(--ease), padding 0.4s var(--ease);
}
#navbar.scrolled {
  padding: 1rem 7%;
  background: rgba(247, 242, 234, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--rule);
}

.nav-logo {
  display: flex;
  align-items: center;
  color: var(--ink);
  transition: color 0.3s var(--ease);
}
.nav-logo:hover { color: var(--wine); }
.nav-logo svg { display: block; }

.nav-links {
  display: flex;
  gap: 2.5rem;
}
.nav-links a {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  color: var(--muted);
  transition: color 0.3s;
}
.nav-links a:hover { color: var(--ink); }

.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 1px; background: var(--ink); transition: 0.3s; }

/* ============================================================
   HERO
   ============================================================ */
#hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: max(10rem, 16vh) 7% 6rem;
}

.hero-inner {
  max-width: 820px;
  background: rgba(247, 242, 234, 0.58);
  backdrop-filter: blur(6px);
  padding: 2.2rem 2.6rem;
}

.hero-eyebrow {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wine);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.8s 0.2s var(--ease) forwards;
}

.hero-name {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 2.6rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeUp 0.9s 0.4s var(--ease) forwards;
}

.hero-bio {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.85;
  max-width: 560px;
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 0.9s 0.7s var(--ease) forwards;
}

.hero-links {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  opacity: 0;
  animation: fadeUp 0.9s 1s var(--ease) forwards;
}
.hero-links a {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: border-color 0.3s, color 0.3s;
}
.hero-links a:hover { color: var(--wine); border-color: var(--wine); }
.link-sep { color: var(--faint); font-size: 0.9rem; }

.hero-scroll-hint {
  position: absolute;
  bottom: 3rem;
  left: 7%;
  opacity: 0;
  animation: fadeIn 1s 1.8s ease forwards;
}
.hero-scroll-hint span {
  display: block;
  width: 1px;
  height: 52px;
  background: linear-gradient(to bottom, var(--wine), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50%       { opacity: 1;   transform: scaleY(0.6); }
}

/* ============================================================
   SECTIONS — shared
   ============================================================ */
.section {
  position: relative;
  z-index: 1;
  padding: 8rem 7%;
  background: rgba(247, 242, 234, 0.55);
}
.section-alt { background: rgba(232, 224, 210, 0.65); }
.container { max-width: 1020px; margin: 0 auto; }

.section-title {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.25vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

/* Reveal */
.reveal-item {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}
.reveal-item.visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: start;
}

.about-facts {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.4rem;
  border-top: 1px solid var(--rule);
}
.about-fact {
  display: grid;
  grid-template-columns: 340px 1fr;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.fact-key {
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.fact-val {
  font-family: var(--serif);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.about-prose p {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.9;
  margin-bottom: 1.4rem;
  font-weight: 600;
}

/* Education block */
.edu-card {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.edu-inst {
  font-family: var(--serif);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.edu-deg {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}
.edu-meta {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--faint);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.edu-gpa { color: var(--gold); }
.edu-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.8rem;
}
.edu-tag {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Stats */
.stat-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}
.stat-num {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--wine);
}
.stat-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ============================================================
   RESEARCH
   ============================================================ */
.research-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2.5rem 4rem;
}
.r-item {
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}
.r-icon-title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}
.r-icon { font-size: 1.3rem; }
.r-title {
  font-family: var(--serif);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
}
.r-desc {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.75;
}

/* ============================================================
   PUBLICATIONS
   ============================================================ */
.pubs-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pub-item {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1rem;
  padding: 1.8rem 0;
  border-bottom: 1px solid var(--rule);
  transition: background 0.3s;
}
.pub-item:first-child { border-top: 1px solid var(--rule); }

.pub-n {
  font-family: var(--serif);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--faint);
  padding-top: 0.2rem;
  text-align: right;
}

.pub-body {}

.pub-title {
  font-family: var(--serif);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 0.35rem;
}
.pub-title.is-patent {
  font-style: italic;
  font-weight: 400;
  color: var(--text);
}

.pub-authors {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
  line-height: 1.6;
}
.pub-authors strong { color: var(--text); font-weight: 500; }

.pub-footer {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.pub-venue {
  font-size: 0.65rem;
  color: var(--gold);
  font-style: italic;
  font-family: var(--serif);
}
.pub-badge {
  font-family: var(--sans);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--rule);
  color: var(--muted);
  border-radius: 2px;
}
.pub-badge.is-journal    { color: #3d7a5e; border-color: rgba(61,122,94,0.4); }
.pub-badge.is-conference { color: var(--wine); border-color: rgba(114,28,40,0.3); }
.pub-badge.is-workshop   { color: var(--violet); border-color: rgba(107,84,144,0.35); }
.pub-badge.is-preprint   { color: var(--gold); border-color: rgba(168,114,40,0.35); }
.pub-badge.is-patent     { color: #5c5c5c; border-color: rgba(92,92,92,0.35); }
.pub-note {
  font-size: 0.6rem;
  color: var(--violet);
  font-style: italic;
}
.pub-link {
  font-size: 0.6rem;
  color: var(--wine);
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(114,28,40,0.3);
  transition: border-color 0.3s;
  margin-left: auto;
}
.pub-link:hover { border-color: var(--wine); }

/* ============================================================
   EXPERIENCE
   ============================================================ */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.exp-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.exp-left {}
.exp-company {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.2rem;
}
.exp-company-sub {
  font-size: 1.1rem;
  color: var(--faint);
  display: block;
  margin-bottom: 0.5rem;
}
.exp-role {
  font-size: 1.1rem;
  color: var(--wine);
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 0.25rem;
}
.exp-meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--faint);
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.exp-right {}
.exp-bullets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.exp-bullets li {
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.7;
  padding-left: 1rem;
  position: relative;
}
.exp-bullets li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--rule);
  font-size: 0.75rem;
  top: 0.12rem;
}

.exp-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}
.exp-tech span {
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.05em;
}
.exp-tech span:not(:last-child)::after {
  content: ' ·';
  margin-left: 0.4rem;
  color: var(--rule);
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem 4rem;
}
.skill-group {
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.skill-cat {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.65rem;
}
.skill-items {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.9;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.skill-items.visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   BLOGS
   ============================================================ */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.blog-item {
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: 2rem;
}
.blog-item:first-child { border-top: 1px solid var(--rule); }
.blog-status {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wine);
  background: rgba(114, 28, 40, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.blog-teaser {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--muted);
  font-style: italic;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-inner {
  max-width: 640px;
}
.contact-heading {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 300;
  color: var(--ink);
  line-height: 1.15;
  margin-bottom: 1.5rem;
}
.contact-blurb {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.85;
  margin-bottom: 3rem;
}
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.contact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.contact-row:first-of-type { border-top: 1px solid var(--rule); }
.c-label {
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.c-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--wine);
  transition: opacity 0.3s;
}
.contact-row:hover .c-value { opacity: 0.65; }

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
  position: relative;
  z-index: 1;
  padding: 2.5rem 7%;
  border-top: 1px solid var(--rule);
  background: transparent;
}
#footer-line {
  font-size: 1.17rem;
  color: var(--faint);
  letter-spacing: 0.04em;
}
#footer-line span { color: var(--wine); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; gap: 3.5rem; }
  .exp-item { grid-template-columns: 1fr; gap: 1.5rem; }
  .research-list { grid-template-columns: 1fr; }
  .skills-wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  #hero { padding: 10rem 5% 5rem; }
  .section { padding: 5rem 5%; }
  #navbar { padding: 1rem 5%; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 60px 0 0 0;
    background: rgba(247,242,234,0.97);
    padding: 2.5rem 5%;
    gap: 2rem;
    z-index: 99;
  }
  .nav-links.open a { font-size: 1.2rem; color: var(--ink); }
  .hamburger { display: flex; }
  .skills-wrap { grid-template-columns: 1fr; }
  .pub-item { grid-template-columns: 1.5rem 1fr; }
}
