/* ==========================================================================
   Tamil Mani — Portfolio Stylesheet
   Theme: Minimal Engineering with Subtle Wonder
   ========================================================================== */

:root {
  /* Color tokens */
  --bg: #0B0F14;
  --surface: #111827;
  --surface-2: #0F1620;
  --accent: #00D9FF;
  --accent-dim: rgba(0, 217, 255, 0.14);
  --accent-glow: rgba(0, 217, 255, 0.35);
  --text: #FFFFFF;
  --text-secondary: #94A3B8;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);

  /* Type */
  --font-display: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --max-width: 1180px;
  --section-pad: clamp(72px, 12vw, 140px);
  --radius: 14px;
  --radius-sm: 8px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.6s;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

ul { list-style: none; }

button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }

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

/* Focus visibility for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Utility ---------- */
.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--section-pad) 24px;
}

.accent-text { color: var(--accent); }

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  max-width: 640px;
}

.section-note {
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 48px;
  font-size: 0.98rem;
}

/* Scroll reveal */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: calc(var(--delay, 0) * 90ms);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #06131A;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover {
  box-shadow: 0 0 28px 2px var(--accent-glow);
  transform: translateY(-2px);
}

.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-small {
  padding: 9px 18px;
  font-size: 0.85rem;
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #7CF2FF);
  z-index: 2000;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ---------- Custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 1999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent);
}
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid var(--border-strong);
  transition: opacity 0.3s ease, width 0.25s var(--ease), height 0.25s var(--ease), border-color 0.25s ease;
}
.cursor-ring.is-active {
  width: 50px; height: 50px;
  border-color: var(--accent);
}
.has-custom-cursor .cursor-dot,
.has-custom-cursor .cursor-ring { opacity: 1; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 18px 0;
  transition: padding 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  padding: 12px 0;
  background: rgba(11, 15, 20, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}
.nav-brand-alias {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  gap: 36px;
}

.nav-link {
  position: relative;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px 0;
  transition: color 0.3s ease;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  height: 1.5px;
  width: 0%;
  background: var(--accent);
  transition: width 0.35s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }
.nav-link.active { color: var(--text); }
.nav-link.active::after { width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
}
.nav-toggle span {
  height: 1.5px;
  width: 100%;
  background: var(--text);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 60px;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(0, 217, 255, 0.08), transparent 70%),
    var(--bg);
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 760px;
  text-align: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

.hero-headline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 9vw, 5.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
}


.hero-intro {
  color: var(--text-secondary);
  font-size: 1.02rem;
  max-width: 560px;
  margin: 0 auto 40px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Decorative orbits */
.hero-orbit {
  position: absolute;
  border: 1px solid var(--border);
  border-radius: 50%;
  pointer-events: none;
}
.hero-orbit-1 {
  width: 520px; height: 520px;
  top: 8%; left: 50%;
  transform: translateX(-50%);
  animation: spin-slow 60s linear infinite;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.1);
}
.hero-orbit-2 {
  width: 340px; height: 340px;
  bottom: -6%; right: 8%;
  animation: spin-slow-rev 46s linear infinite;
}


@keyframes spin-slow { from { transform: translateX(-50%) rotate(0); } to { transform: translateX(-50%) rotate(360deg); } }
@keyframes spin-slow-rev { from { transform: rotate(0); } to { transform: rotate(-360deg); } }


/* ---------- Skills ---------- */
.skills-list { border-bottom: 1px solid var(--border); }
.skill-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: center;
  padding: 22px 0;
  border-top: 1px solid var(--border);
}
.skill-row h3 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.skill-row .project-tech { margin: 0; }
.skill-row .project-tech span { font-size: 0.78rem; padding: 6px 12px; }

.tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--accent);
  border: 1px solid rgba(0, 217, 255, 0.3);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.45s var(--ease), border-color 0.45s var(--ease), box-shadow 0.45s var(--ease);
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 217, 255, 0.3);
  box-shadow: 0 22px 50px -20px rgba(0, 217, 255, 0.28);
}

.project-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.project-thumb video {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
  background: #0F1620;
}
.project-thumb img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}
.project-thumb[data-hover-video] { cursor: pointer; }
.project-thumb[data-hover-video] .thumb-label {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(11, 15, 20, 0.72);
  color: var(--text);
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.project-thumb.is-playing .thumb-label { opacity: 0; }

/* Featured card: media left, text right (stacks on small screens) */
.project-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}
.project-card--featured .project-thumb {
  aspect-ratio: auto;
  min-height: 340px;
  border-bottom: 0;
  border-right: 1px solid var(--border);
}
.project-card--featured .project-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px;
}
.project-card--featured .project-body h3 { font-size: 1.6rem; }
.project-card--featured .project-body p { font-size: 1rem; }
@media (max-width: 820px) {
  .project-card--featured { grid-template-columns: 1fr; }
  .project-card--featured .project-thumb {
    aspect-ratio: 4 / 3;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .project-card--featured .project-body { padding: 24px; }
}
.project-thumb svg { width: 100%; height: 100%; }
.thumb-label {
  position: absolute;
  bottom: 10px; right: 12px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-body { padding: 24px; }
.project-body h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.project-body p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.project-tech {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.project-tech span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: 999px;
}

.project-body .project-focus {
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.project-focus span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  margin-right: 10px;
}

.project-actions {
  display: flex;
  gap: 10px;
}

/* ---------- Contact ---------- */
.contact { background: var(--surface-2); }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.contact-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 16px 40px -18px var(--accent-glow);
}

.contact-icon {
  width: 30px; height: 30px;
  color: var(--accent);
  margin-bottom: 20px;
}
.contact-icon svg { width: 100%; height: 100%; }

.contact-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.contact-value {
  display: block;
  font-size: 0.92rem;
  font-weight: 500;
  word-break: break-word;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-inner p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.footer-top {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}
.footer-top:hover { color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(11, 15, 20, 0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease);
  }
  .nav-links.is-open { max-height: 320px; }
  .nav-link { padding: 16px 24px; width: 100%; border-top: 1px solid var(--border); }
  .nav-toggle { display: flex; }

  .projects-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }

  .cursor-dot, .cursor-ring { display: none; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* ==========================================================================
   Systems
   ========================================================================== */
.systems { background: var(--surface-2); }
.systems .project-card { background: var(--surface); }

.systems-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  align-items: stretch;
}

.system-card .project-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 28px;
}
.system-card .project-actions { margin-top: auto; flex-wrap: wrap; }
.system-card .project-tech { margin-bottom: 24px; }
.system-card .project-body p { margin-bottom: 22px; }

.system-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.system-icon {
  width: 36px; height: 36px;
  color: var(--accent);
  transition: transform 0.45s var(--ease);
}
.system-icon svg { width: 100%; height: 100%; }
.system-card:hover .system-icon { transform: scale(1.08); }

.system-card .btn svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
}
.btn.is-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: default;
}

@media (max-width: 720px) {
  .systems-grid { grid-template-columns: 1fr; }
  .system-card .project-body { padding: 24px; }
  .skill-row { grid-template-columns: 1fr; gap: 12px; padding: 20px 0; }
}

/* ---------- Hero portrait ---------- */
.hero-avatar {
  --size: 168px;
  --ring: 16px;
  position: absolute;
  z-index: 2;
  top: 112px;
  /* outer ring lines up with the nav brand's left edge */
  left: max(calc(24px + var(--ring)), calc((100% - var(--max-width)) / 2 + 24px + var(--ring)));
  width: var(--size); height: var(--size);
  transition: transform 0.4s var(--ease);
}
.hero-avatar-frame {
  width: 100%; height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: 0 0 0 6px rgba(0, 217, 255, 0.08), 0 14px 36px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.4s var(--ease);
}
.hero-avatar-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* dashed orbit ring, same language as the hero background orbits */
.hero-avatar::before {
  content: "";
  position: absolute;
  inset: calc(var(--ring) * -1);
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 50%;
  pointer-events: none;
  animation: spin-slow-rev 50s linear infinite;
}
.hero-avatar:hover { transform: scale(1.03); }
.hero-avatar:hover .hero-avatar-frame {
  box-shadow: 0 0 0 6px var(--accent-glow), 0 14px 36px rgba(0, 0, 0, 0.45);
}

/* ---------- Project context line + aligned actions ---------- */
.project-body .project-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.project-card:not(.project-card--featured) { display: flex; flex-direction: column; }
.project-card:not(.project-card--featured) .project-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.project-card:not(.project-card--featured) .project-actions { margin-top: auto; }
.project-card:not(.project-card--featured) .project-tech { margin-bottom: 22px; }

@media (max-width: 900px) {
  .hero-avatar { --size: 132px; --ring: 14px; top: 108px; }
}
@media (max-width: 720px) {
  .hero-avatar { --size: 100px; --ring: 10px; top: 92px; }
  .hero { padding-top: 224px; }   /* hero text starts below the portrait */
  .hero-avatar-frame { box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.4); }
}
