/* ==========================================================================
   Kavindu Karunaratne · 3D portfolio
   Ported from the Claude Design "Portfolio 3D" component to a standalone site.
   Accent colour is a single variable. Change --accent to re-theme everything.
   ========================================================================== */

:root {
  --accent: #c6f24e;
  --bg: #0a0a0b;
  --divider: #1a1a1a;
  --border: #2c2c2c;
  --text-dim: #6a6a62;
  --text-muted: #9a9a92;
  --gutter: clamp(20px, 5vw, 64px);
}

/* --- Base --------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: #f4f4ef;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }

/* --- Helpers ------------------------------------------------------------ */
.mono { font-family: 'JetBrains Mono', monospace; }
.accent { color: var(--accent); }

/* --- Background canvas -------------------------------------------------- */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* --- Preloader ---------------------------------------------------------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 6vw;
  opacity: 1;
  transition: opacity .6s ease, visibility .6s;
}
.preloader-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  flex-wrap: wrap;
  gap: 20px;
}
.preloader-label { font-size: 13px; letter-spacing: .08em; color: #7a7a72; }
.preloader-label--top { margin-bottom: 14px; }
.preloader-count {
  font-size: clamp(80px, 16vw, 240px);
  line-height: .8;
  font-weight: 600;
  letter-spacing: -.03em;
}
.preloader-pct { font-size: .35em; color: #7a7a72; vertical-align: super; }
.preloader-track {
  height: 1px;
  background: #232323;
  margin-top: 34px;
  position: relative;
  overflow: hidden;
}
.preloader-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
}

/* --- Navigation --------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--gutter);
  mix-blend-mode: difference;
}
.nav-brand { font-size: 14px; font-weight: 500; letter-spacing: .02em; }
.nav-links { display: flex; gap: clamp(16px, 3vw, 40px); font-size: 13px; letter-spacing: .02em; }

/* --- Content layer ------------------------------------------------------ */
.content { position: relative; z-index: 1; }

/* --- Reveal-on-scroll --------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s ease var(--d, 0s), transform .9s ease var(--d, 0s);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* --- Hero --------------------------------------------------------------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--gutter);
  position: relative;
}
.hero-eyebrow { font-size: 13px; letter-spacing: .1em; color: var(--accent); margin-bottom: 28px; }
.hero-title {
  margin: 0;
  font-size: clamp(48px, 11vw, 168px);
  line-height: .9;
  font-weight: 600;
  letter-spacing: -.035em;
}
.hero-bio {
  margin: 32px 0 0;
  max-width: 600px;
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.5;
  color: #b8b8b0;
}
.hero-cta { display: flex; gap: 14px; margin-top: 44px; flex-wrap: wrap; }

.hero-status {
  position: absolute;
  bottom: 34px;
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
}
/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 100px;
  font-size: 13px;
}
.btn-primary { background: var(--accent); color: var(--bg); font-weight: 500; }
.btn-primary:hover { filter: brightness(1.15); color: var(--bg); }
.btn-ghost { border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }

/* --- Sections ----------------------------------------------------------- */
.section {
  padding: clamp(80px, 12vw, 180px) var(--gutter);
  border-top: 1px solid var(--divider);
}
.section-label {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-bottom: clamp(40px, 6vw, 80px);
  font-size: 13px;
  color: var(--text-dim);
}
.section-slash { letter-spacing: .1em; }

/* --- About -------------------------------------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(40px, 6vw, 90px);
}
@media (min-width: 760px) {
  .about-grid {
    grid-template-columns: 1fr auto;
    align-items: start;
    max-width: 70%;
  }
}
.about-lead {
  margin: 0 0 24px;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: -.01em;
}
.about-body { margin: 0; font-size: 16px; line-height: 1.7; color: #a2a29a; width: 90%; }
.toolkit-label { font-size: 12px; letter-spacing: .1em; color: var(--text-dim); margin-bottom: 22px; }
.toolkit { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid #262626;
  padding: 9px 16px;
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #cfcfc7;
}
.toolkit-section { margin-top: clamp(56px, 8vw, 100px); }
.toolkit-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: clamp(28px, 4vw, 44px) clamp(40px, 5vw, 72px);
}
.toolkit-cat { font-size: 11px; letter-spacing: .12em; color: var(--accent); margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: auto; gap: 24px; margin-top: 0; }
.stat-num { font-size: clamp(32px, 4vw, 48px); font-weight: 600; letter-spacing: -.02em; }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* --- Selected work ------------------------------------------------------ */
.project-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: clamp(16px, 3vw, 48px);
  align-items: center;
  padding: clamp(24px, 3vw, 40px) 0;
  border-top: 1px solid var(--divider);
}
.project-row:hover { background: linear-gradient(90deg, rgba(255, 255, 255, .02), transparent); }
.project-num { font-size: 13px; color: var(--text-dim); }
.project-title {
  font-size: clamp(24px, 3.4vw, 44px);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.05;
}
.project-desc { margin-top: 10px; font-size: 15px; color: var(--text-muted); max-width: 520px; line-height: 1.5; }
.project-links { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: .02em;
  color: #d2d2ca;
  transition: border-color .2s, color .2s, background .2s;
}
.project-link:hover { border-color: var(--accent); color: var(--accent); }
.project-link svg { flex-shrink: 0; }
.project-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; align-self: flex-start; padding-top: 6px; }
.project-tag { font-size: 12px; color: var(--text-dim); }

.list-end { border-top: 1px solid var(--divider); }

/* --- Experience --------------------------------------------------------- */
.role-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: clamp(20px, 4vw, 60px);
  padding: clamp(24px, 3vw, 40px) 0;
  border-top: 1px solid var(--divider);
}
.role-years { font-size: 13px; color: var(--text-dim); }
.role-title { font-size: clamp(20px, 2.4vw, 28px); font-weight: 600; letter-spacing: -.01em; }
.role-company { margin-top: 6px; font-size: 13px; color: var(--accent); }
.role-desc { margin-top: 14px; font-size: 15px; color: var(--text-muted); line-height: 1.6; }
.role-bullets {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}
.role-bullets li {
  position: relative;
  padding-left: 18px;
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}
.role-bullets li:first-child { margin-top: 0; }
.role-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.role-bullets strong { color: #e6e6df; font-weight: 600; }

/* --- Contact ------------------------------------------------------------ */
.contact { padding: clamp(90px, 14vw, 200px) var(--gutter) clamp(40px, 6vw, 64px); }
.contact-eyebrow { font-size: 13px; letter-spacing: .1em; color: var(--accent); margin-bottom: 28px; }
.contact-email {
  font-size: clamp(28px, 6vw, 80px);
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: .95;
  display: inline-block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.contact-email:hover { color: var(--accent); }
.copy-hint { margin-top: 20px; font-size: 12px; letter-spacing: .1em; color: var(--text-dim); transition: color .2s; }
.copy-hint.copied { color: var(--accent); }
.footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: clamp(60px, 10vw, 140px);
  padding-top: 28px;
  border-top: 1px solid var(--divider);
  font-size: 13px;
  color: var(--text-dim);
}
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

/* Social buttons (contact) */
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
}
.social-btn svg { width: 16px; height: 16px; display: block; }
.social-btn--github { background: var(--accent); color: var(--bg); }
.social-btn--github:hover { filter: brightness(1.15); color: var(--bg); }
.social-btn--linkedin { border: 1px solid var(--accent); color: var(--accent); }
.social-btn--linkedin:hover { background: var(--accent); color: var(--bg); }

/* --- Mobile tweaks ------------------------------------------------------ */
@media (max-width: 640px) {
  /* Nav: brand + 4 links overflow phone widths at desktop sizing, so tighten */
  .nav { padding: 14px 18px; }
  .nav-brand { font-size: 13px; }
  .nav-links { gap: 14px; font-size: 11px; }

  .hero { padding-bottom: 40px; }
  .hero-status {
    position: static;
    margin-top: 44px;
    flex-wrap: wrap;
    gap: 10px 20px;
    font-size: 11px;
  }

  /* Experience: stack the years above the role instead of a side column */
  .role-row { grid-template-columns: 1fr; gap: 10px; }
  .role-years { order: -1; }

  /* Projects: number + content only; the tag drops below the description */
  .project-row { grid-template-columns: 28px 1fr; gap: 14px; }
  .project-meta {
    grid-column: 2;
    flex-direction: row;
    align-items: flex-start;
    padding-top: 0;
  }
}

/* --- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition-duration: .01ms; transform: none; }
}
