/* ══════════════════════════════════════════
   svbk.dev — S. V. Bala Kumaran
   Hybrid dark/light · Space Mono + Anton
   ══════════════════════════════════════════ */

:root {
  --black: #050507;
  --white: #f4f2ee;
  --ink: #16161a;
  --dim: rgba(244, 242, 238, 0.55);
  --dim-ink: rgba(22, 22, 26, 0.6);
  --accent: #c8ff4d;
  --accent-ink: #5f7a13;
  --line-dark: rgba(244, 242, 238, 0.12);
  --line-light: rgba(22, 22, 26, 0.12);
  --mono: "Space Mono", monospace;
  --display: "Anton", sans-serif;
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--mono);
  background: var(--black);
  color: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.7s var(--ease-out), color 0.7s var(--ease-out);
}
body.light { background: var(--white); color: var(--ink); }

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

img, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

.container {
  width: min(1200px, 100% - 3rem);
  margin-inline: auto;
}

/* ── Preloader ── */
.preloader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--black);
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: 2.5rem;
}
.preloader-inner { display: flex; flex-direction: column; gap: 0.5rem; }
.preloader-count {
  font-size: clamp(64px, 14vw, 160px);
  font-weight: 700; letter-spacing: -0.04em; line-height: 1;
  color: var(--white);
}
.preloader-label { color: var(--dim); font-size: 13px; }

/* ── Nav ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.5rem;
  opacity: 0;
}
.nav-logo {
  display: inline-flex; align-items: center; gap: 0.6rem;
  height: 44px; padding: 0 1.1rem;
  border-radius: 12px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: rgba(128, 128, 128, 0.14);
  border: 1px solid var(--line-dark);
  font-size: 14px; font-weight: 700; letter-spacing: -0.02em;
  transition: transform 0.25s var(--ease-out), border-color 0.7s;
}
body.light .nav-logo { border-color: var(--line-light); }
.nav-logo:hover { transform: scale(1.03); }
.nav-logo-mark {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(200, 255, 77, 0.7);
}
.nav-links {
  display: flex; gap: 0.4rem;
  height: 44px; padding: 0 0.5rem; align-items: center;
  border-radius: 12px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: rgba(128, 128, 128, 0.14);
  border: 1px solid var(--line-dark);
}
body.light .nav-links { border-color: var(--line-light); }
.nav-links a {
  font-size: 13px; padding: 0.35rem 0.75rem; border-radius: 8px;
  opacity: 0.8; transition: opacity 0.2s, background 0.2s;
}
.nav-links a:hover { opacity: 1; background: rgba(128, 128, 128, 0.18); }
.nav-cta {
  height: 44px; padding: 0 1.4rem; border-radius: 999px;
  display: inline-flex; align-items: center;
  background: var(--white); color: var(--black);
  font-size: 13px; font-weight: 700;
  transition: transform 0.25s var(--ease-out), background 0.7s, color 0.7s;
}
body.light .nav-cta { background: var(--ink); color: var(--white); }
.nav-cta:hover { transform: scale(1.04); }
.nav-burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 10px;
}
.nav-burger span {
  width: 22px; height: 2px; background: currentColor; color: inherit;
  transition: transform 0.3s var(--ease-out), opacity 0.3s;
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(5, 5, 7, 0.96);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 2rem; gap: 1.6rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}
.mobile-menu.open { opacity: 1; pointer-events: auto; }
.mobile-menu a { font-size: 32px; font-weight: 700; color: var(--white); letter-spacing: -0.02em; }

/* ── Hero ── */
.hero {
  position: relative; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(244, 242, 238, 1) 1px, transparent 1px);
  background-size: 24px 24px; opacity: 0.05;
}
.hero-watermark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-size: clamp(160px, 34vw, 620px);
  letter-spacing: -0.02em; line-height: 1;
  pointer-events: none; user-select: none;
  background: radial-gradient(circle, rgba(142, 127, 148, 0) 0%, #8e7f94 70%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; opacity: 0.1;
  transform: translateY(40px);
}
.hero-content {
  position: relative; z-index: 2; flex: 1;
  display: flex; flex-direction: column;
  padding: 6.5rem 2rem 2.5rem;
}
.hero-topline {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem;
  font-size: 12px; color: var(--dim);
  opacity: 0;
}
.hero-status { display: inline-flex; align-items: center; gap: 0.5rem; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 255, 77, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(200, 255, 77, 0); }
}
.hero-bottom {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.hero-h1 {
  font-weight: 400; line-height: 0.95; letter-spacing: -0.03em;
  font-size: clamp(44px, 9.5vw, 110px);
  min-height: 1em;
}
.hero-h1 .line { display: inline-block; min-height: 0.95em; }
.hero-desc {
  max-width: 26rem; margin-top: 1.4rem;
  font-size: 14px; line-height: 1.7; color: var(--dim);
  opacity: 0; transform: translateY(25px);
}
.hl { color: var(--accent); font-weight: 700; }
body.light .hl { color: var(--accent-ink); }
.hero-scroll {
  margin-top: 2.5rem;
  display: flex; align-items: center; gap: 0.8rem;
  font-size: 11px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--dim);
  opacity: 0;
}
.hero-scroll-line {
  width: 56px; height: 1px; background: var(--dim);
  transform-origin: left; animation: scrollhint 2s var(--ease-out) infinite;
}
@keyframes scrollhint {
  0% { transform: scaleX(0); } 55% { transform: scaleX(1); } 100% { transform: scaleX(0); transform-origin: right; }
}

@media (min-width: 768px) {
  .hero-bottom { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .hero-right { text-align: right; }
}
.hero-right { font-size: clamp(38px, 7.5vw, 92px); white-space: nowrap; }

/* ── Sections shared ── */
section, footer.contact { position: relative; padding: 8rem 0; }
.section-tag {
  font-size: 12px; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 3rem;
}
.section-dark .section-tag, .light-tag { color: var(--accent); }
.section-h2 {
  font-weight: 400; letter-spacing: -0.02em; line-height: 1.1;
  font-size: clamp(30px, 5.5vw, 60px);
  margin-bottom: 4rem;
}
.section-h2 em, .about-h2 em { font-style: italic; color: var(--accent-ink); }

[data-reveal] { opacity: 0; transform: translateY(34px); }

/* ── About ── */
.about-grid {
  display: grid; grid-template-columns: 1fr; gap: 3.5rem;
  align-items: start;
}
@media (min-width: 860px) { .about-grid { grid-template-columns: 5fr 7fr; gap: 5rem; } }
.about-portrait { position: relative; }
#avatarCanvas {
  width: 100%; height: auto; border-radius: 6px;
  background: var(--ink);
}
.portrait-caption {
  margin-top: 0.8rem; font-size: 12px; color: var(--dim-ink);
}
.about-h2 {
  font-weight: 400; letter-spacing: -0.02em; line-height: 1.15;
  font-size: clamp(28px, 4.5vw, 48px);
  margin-bottom: 2.2rem;
}
.about-text p {
  font-size: 15px; line-height: 1.8; color: var(--dim-ink);
  margin-bottom: 1.4rem; max-width: 36rem;
}
.about-links { display: flex; gap: 1.8rem; margin-top: 2.4rem; flex-wrap: wrap; }
.about-links a {
  font-size: 14px; font-weight: 700;
  border-bottom: 1px solid var(--line-light);
  padding-bottom: 3px;
  transition: border-color 0.25s;
}
.about-links a:hover { border-color: var(--ink); }

/* ── Marquee ── */
.marquee {
  margin-top: 6rem; overflow: hidden; white-space: nowrap;
  border-top: 1px solid var(--line-light);
  border-bottom: 1px solid var(--line-light);
  padding: 1.1rem 0;
}
.marquee-track { display: inline-block; animation: marquee 40s linear infinite; }
.marquee-track span { font-size: 15px; color: var(--dim-ink); letter-spacing: 0.05em; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── Work ── */
.job-list { display: flex; flex-direction: column; }
.job {
  padding: 2.6rem 0;
  border-top: 1px solid var(--line-light);
  transition: background 0.3s;
}
.job:last-child { border-bottom: 1px solid var(--line-light); }
.job-meta {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim-ink); margin-bottom: 0.9rem;
}
.job-co { display: inline-flex; align-items: center; gap: 0.65rem; }
.job-logo {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line-light);
  background: var(--ink); color: var(--white);
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
}
.job-logo::before { content: attr(data-mono); }
.job-logo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #fff; padding: 4px;
}
.job-role {
  font-weight: 700; letter-spacing: -0.01em;
  font-size: clamp(19px, 2.6vw, 26px);
  margin-bottom: 0.9rem;
}
.job-desc {
  font-size: 14px; line-height: 1.75; color: var(--dim-ink);
  max-width: 44rem; margin-bottom: 1.2rem;
}
.job-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.job-tags span {
  font-size: 11px; padding: 0.3rem 0.7rem;
  border: 1px solid var(--line-light); border-radius: 999px;
  color: var(--dim-ink);
}

/* ── Metrics ── */
.metrics { padding: 7rem 0; }
.metrics-grid {
  display: grid; grid-template-columns: 1fr; gap: 3.5rem;
  text-align: center;
}
@media (min-width: 700px) { .metrics-grid { grid-template-columns: repeat(4, 1fr); gap: 2rem; } }
.metric-value {
  display: block;
  font-size: clamp(52px, 8vw, 96px);
  font-weight: 400; letter-spacing: -0.04em; line-height: 1;
}
.metric-label {
  display: block; margin-top: 1rem;
  font-size: 13px; color: var(--dim); line-height: 1.5;
  max-width: 15rem; margin-inline: auto;
}

/* ── Stack ── */
.stack-grid {
  display: grid; grid-template-columns: 1fr; gap: 1px;
  background: var(--line-light);
  border: 1px solid var(--line-light);
}
@media (min-width: 700px) { .stack-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .stack-grid { grid-template-columns: repeat(3, 1fr); } }
.stack-cell {
  background: var(--white); padding: 2.2rem 1.8rem;
  transition: background 0.25s;
}
.stack-cell:hover { background: #ece9e3; }
.stack-cell h3 {
  font-size: 13px; letter-spacing: 0.15em; text-transform: uppercase;
  font-weight: 700; margin-bottom: 1rem; color: var(--accent-ink);
}
.stack-cell p { font-size: 14px; line-height: 1.75; color: var(--dim-ink); }
.stack-icons {
  display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.3rem;
  align-items: center;
}
.stack-icons img {
  width: 26px; height: 26px; object-fit: contain;
  filter: grayscale(0.35); opacity: 0.85;
  transition: filter 0.25s, opacity 0.25s, transform 0.25s var(--ease-out);
}
.stack-icons img:hover { filter: none; opacity: 1; transform: translateY(-3px); }

/* ── Projects ── */
.project-card {
  display: block;
  border: 1px solid var(--line-light); border-radius: 10px;
  padding: 2.6rem 2.4rem;
  transition: background 0.3s, transform 0.35s var(--ease-out), box-shadow 0.35s;
}
.project-card:hover {
  background: #ece9e3;
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(22, 22, 26, 0.08);
}
.project-head {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 0.7rem;
}
.project-name {
  font-size: clamp(24px, 3.6vw, 38px); font-weight: 700; letter-spacing: -0.02em;
}
.project-live {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 11px; letter-spacing: 0.2em;
  color: var(--accent-ink);
  border: 1px solid var(--accent-ink); border-radius: 999px;
  padding: 0.3rem 0.75rem;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-ink);
  animation: pulse 2.2s infinite;
}
.project-card + .project-card { margin-top: 1.6rem; }
.project-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line-light); border-radius: 8px;
  overflow: hidden;
  background: #ece9e3;
  margin-top: 2.2rem;
}
.project-preview img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.project-preview img.active { opacity: 1; }
.project-preview.contain { background: #14161a; }
.project-preview.contain img { object-fit: contain; }
.project-preview canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.project-preview.canvas-mode img { display: none; }
@media (min-width: 900px) {
  .project-card {
    display: grid; grid-template-columns: 1fr 340px;
    gap: 3rem; align-items: center;
  }
  .project-preview { margin-top: 0; }
}
.project-live.wip { color: var(--dim-ink); border-color: var(--line-light); }
.project-live.wip .live-dot { background: var(--dim-ink); }
.project-tagline {
  font-size: 15px; font-weight: 700; color: var(--accent-ink);
  margin-bottom: 1rem;
}
.project-desc {
  font-size: 14px; line-height: 1.75; color: var(--dim-ink);
  max-width: 42rem; margin-bottom: 1.4rem;
}
.project-tags { margin-bottom: 1.8rem; }
.project-link {
  font-size: 14px; font-weight: 700;
  border-bottom: 1px solid var(--line-light); padding-bottom: 3px;
  transition: border-color 0.25s;
}
.project-card:hover .project-link { border-color: var(--ink); }

/* ── Dev Log ── */
.devlog-intro {
  font-size: 15px; line-height: 1.8; color: var(--dim-ink);
  max-width: 34rem; margin: -2rem 0 3.5rem;
}
.log-list { display: flex; flex-direction: column; }
.log-entry {
  display: flex; align-items: center; gap: 1.6rem;
  padding: 1.7rem 0.4rem;
  border-top: 1px solid var(--line-light);
  cursor: pointer;
  transition: background 0.25s, padding-left 0.3s var(--ease-out);
}
.log-entry:last-of-type { border-bottom: 1px solid var(--line-light); }
.log-entry:hover { background: #ece9e3; padding-left: 1rem; }
.log-num { font-size: 12px; color: var(--dim-ink); }
.log-body h3 {
  font-size: clamp(15px, 2.2vw, 19px); font-weight: 700; letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
}
.log-meta { font-size: 12px; color: var(--dim-ink); }
.log-arrow { margin-left: auto; font-size: 20px; opacity: 0.35; transition: opacity 0.25s, transform 0.3s; }
.log-entry:hover .log-arrow { opacity: 1; transform: translateX(5px); }

.newsletter { margin-top: 3.5rem; max-width: 30rem; }
.newsletter label {
  display: block; font-size: 13px; margin-bottom: 0.9rem; color: var(--dim-ink);
}
.newsletter-row { display: flex; gap: 0.6rem; }
.newsletter input {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 14px;
  padding: 0.85rem 1rem;
  background: transparent; color: inherit;
  border: 1px solid var(--line-light); border-radius: 8px;
  outline: none; transition: border-color 0.25s;
}
.newsletter input:focus { border-color: var(--ink); }
.newsletter button {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  padding: 0 1.4rem; border: 0; border-radius: 8px;
  background: var(--ink); color: var(--white); cursor: pointer;
  transition: transform 0.2s var(--ease-out);
}
.newsletter button:hover { transform: scale(1.03); }
.newsletter-note { display: block; margin-top: 0.7rem; font-size: 12px; color: var(--accent-ink); min-height: 1em; }

/* ── Contact / Footer ── */
.contact { padding-bottom: 3rem; }
.contact-h2 {
  font-weight: 400; letter-spacing: -0.03em; line-height: 1.02;
  font-size: clamp(46px, 9vw, 110px);
  margin-bottom: 3rem;
}
.contact-email {
  display: inline-block;
  font-size: clamp(16px, 3vw, 26px);
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 6px;
  transition: border-color 0.25s, color 0.25s;
}
.contact-email:hover { border-color: var(--white); color: var(--white); }
.footer-row {
  margin-top: 6rem; padding-top: 1.6rem;
  border-top: 1px solid var(--line-dark);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.footer-links { display: flex; gap: 1.6rem; }
.footer-links a { font-size: 13px; color: var(--dim); transition: color 0.2s; }
.footer-links a:hover { color: var(--white); }
.footer-copy { font-size: 12px; color: rgba(244, 242, 238, 0.3); }

/* ── Responsive nav ── */
@media (max-width: 760px) {
  .nav-links, .nav-cta { display: none; }
  .nav-burger { display: flex; }
  .hero-content { padding: 5.5rem 1.25rem 2rem; }
  section, footer.contact { padding: 5.5rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track, .status-dot, .hero-scroll-line { animation: none; }
  html { scroll-behavior: auto; }
}
