/* Vaishnav Divy Anilkumar | Portfolio
   Tokens, base, layout, components, responsive, motion. */

:root {
  --bg: #0f1318;
  --surface: #151b22;
  --line: #252e39;
  --text: #f4f6f8;
  --body: #c3ccd6;
  --muted: #9aa6b3;
  --accent: #1fe3c6;
  --accent-ink: #04201b;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1080px;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --header-h: 60px;
  color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

section { padding: clamp(4rem, 10vw, 7rem) 0; scroll-margin-top: var(--header-h); }
h2 {
  font: 600 clamp(1.8rem, 4vw, 2.5rem)/1.15 var(--serif);
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}
.lede { color: var(--muted); max-width: 56ch; margin-bottom: 2.5rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15, 19, 24, 0.85);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.logo { color: var(--text); font: 600 1rem var(--mono); letter-spacing: -0.02em; text-decoration: none; }
.nav { display: flex; gap: clamp(0.85rem, 3vw, 1.75rem); }
.nav a { color: var(--muted); font-size: 0.9rem; text-decoration: none; transition: color 0.2s; }
.nav a:hover { color: var(--text); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-weight: 600; font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #6ff0dc; border-color: #6ff0dc; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: rgba(31, 227, 198, 0.1); }
.btn-sm { padding: 0.45rem 0.95rem; font-size: 0.88rem; }

/* Hero: chessboard texture fades in from the lower right */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center;
  min-height: calc(100svh - var(--header-h));
  padding-block: 4rem;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.07;
  background: repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 112px 112px;
  -webkit-mask-image: linear-gradient(115deg, transparent 35%, #000);
  mask-image: linear-gradient(115deg, transparent 35%, #000);
}
.hello { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.25rem; }
.hero h1 { font-weight: 400; font-size: clamp(2.1rem, 7.4vw, 5.25rem); line-height: 1.02; margin-bottom: 1.75rem; }
.hero h1 span { display: block; }
.h-code { font-family: var(--mono); font-weight: 600; letter-spacing: -0.05em; }
.h-story { font-family: var(--serif); font-style: italic; letter-spacing: -0.02em; }
.sub { max-width: 38ch; color: var(--muted); font-size: clamp(1.1rem, 2.4vw, 1.35rem); margin-bottom: 2.25rem; }
.cta { display: flex; flex-wrap: wrap; gap: 0.9rem; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2.5rem; margin-top: 1.5rem; }
.about-text { max-width: 60ch; color: var(--body); }
.about-text p + p { margin-top: 1rem; }
.traits { display: grid; gap: 1.5rem; align-content: start; }
.trait { border-left: 2px solid var(--accent); padding-left: 1rem; }
.trait strong { display: block; font: 600 1.6rem/1.2 var(--serif); }
.trait span { color: var(--muted); font-size: 0.95rem; }

.stack { margin-top: 3.5rem; }
.stack h3 { font: 600 1.25rem var(--serif); margin-bottom: 1rem; }
.stack-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.stack-grid li {
  padding: 1.1rem 1rem;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transition: background 0.2s;
}
.stack-grid li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.stack-grid li:hover { background: var(--surface); }
.stack-grid b { display: block; font-weight: 600; }
.stack-grid small { color: var(--muted); font-size: 0.85rem; }

/* Cards (shared) */
.card, .article {
  display: flex; flex-direction: column; gap: 1rem;
  background: var(--surface); border: 1px solid var(--line);
}
.card:hover, .article:hover { border-color: var(--accent); }

/* Projects */
.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.card { padding: 1.75rem; border-radius: 12px; }
.card h3 { font: 600 1.5rem/1.2 var(--sans); letter-spacing: -0.02em; }
.card--story h3 { font-family: var(--serif); letter-spacing: 0; }
.card p { color: var(--body); }
.status { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.9rem; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.status--plain::before { display: none; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags li { padding: 0.2rem 0.7rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.82rem; }
.link { margin-top: auto; padding-top: 0.5rem; font-weight: 600; }

/* Writing */
.writing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.article { padding: 1.5rem; border-top: 2px solid var(--accent); border-radius: 8px; }
.cat { color: var(--accent); font-size: 0.9rem; font-weight: 600; }
.article h3 { font: 600 1.15rem/1.35 var(--serif); }
.article p { color: var(--muted); font-size: 0.95rem; }
.meta { margin-top: auto; padding-top: 0.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.read { color: var(--muted); font-size: 0.88rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 3rem 0 2.5rem; scroll-margin-top: var(--header-h); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1.5rem 2rem; }
.footer-note { color: var(--muted); font-size: 0.9rem; }
.socials { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* Scroll reveal (only active when JS has added .js to <html>) */
.js .reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.7s ease var(--d, 0ms), transform 0.7s ease var(--d, 0ms), border-color 0.25s;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* Responsive */
@media (min-width: 720px) {
  .stack-grid { grid-template-columns: repeat(5, 1fr); }
  .stack-grid li:last-child:nth-child(odd) { grid-column: auto; }
}
@media (max-width: 860px) {
  .about-grid, .project-grid, .writing-grid { grid-template-columns: 1fr; }
}

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