/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  --color-bg: #fafafa;
  --color-text: #1d1d1f;
  --color-text-secondary: #6e6e73;
  --color-accent: #b8973b;
  --color-accent-subtle: rgba(184, 151, 59, 0.12);
  --color-temple-red: #8b3a3a;
  --color-divider: rgba(29, 29, 31, 0.08);
  --color-kolam: #b8973b;

  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-tamil: 'Noto Sans Tamil', sans-serif;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
  --space-2xl: 10rem;

  --max-width: 720px;

  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-primary);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

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

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

section {
  padding: var(--space-xl) 0;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.tamil-text {
  font-family: var(--font-tamil);
}

/* Language system: hide Tamil by default */
[data-ta] {
  display: none;
}

[data-en] {
  display: inline;
}

body.lang-ta [data-ta] {
  display: inline;
}

body.lang-ta [data-en] {
  display: none;
}

/* --- 5. Language Toggle Cross-Fade --- */
[data-en], [data-ta] {
  transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Headings fade slightly faster (hierarchy-aware) */
h1 [data-en], h1 [data-ta],
h2 [data-en], h2 [data-ta],
h3 [data-en], h3 [data-ta],
.hero-philosophy [data-en], .hero-philosophy [data-ta] {
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Phase 1: fade out */
.lang-fading-out [data-en],
.lang-fading-out [data-ta] {
  opacity: 0;
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-fading-out h1 [data-en], .lang-fading-out h1 [data-ta],
.lang-fading-out h2 [data-en], .lang-fading-out h2 [data-ta],
.lang-fading-out h3 [data-en], .lang-fading-out h3 [data-ta] {
  transition: opacity 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Phase 2: new content starts hidden, fades in */
.lang-fading-in [data-en],
.lang-fading-in [data-ta] {
  opacity: 0;
}

/* ============================================
   LANGUAGE TOGGLE
   ============================================ */
.lang-toggle {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang-btn {
  background: none;
  border: none;
  font-family: var(--font-primary);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color 0.3s var(--ease-smooth), opacity 0.3s var(--ease-smooth);
  opacity: 0.4;
}

.lang-btn[data-lang="ta"] {
  font-family: var(--font-tamil);
  font-size: 0.75rem;
  letter-spacing: 0;
}

.lang-btn.active {
  color: var(--color-text);
  opacity: 0.7;
}

.lang-btn:hover {
  opacity: 0.8;
}

.lang-divider {
  color: var(--color-text-secondary);
  opacity: 0.2;
  font-size: 0.75rem;
  font-weight: 300;
  user-select: none;
}

/* ============================================
   HERO
   ============================================ */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2xl) 0;
}

@media (min-width: 768px) {
  .hero {
    min-height: 88vh;
    min-height: 88dvh;
  }
}

/* Hero Tamil Greeting */
.hero-greeting {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--color-accent);
  opacity: 0.55;
  margin-bottom: var(--space-md);
  letter-spacing: 0.02em;
  transition: opacity 0.6s var(--ease-smooth);
}

.hero-greeting.faded,
.hero-greeting.faded.visible {
  opacity: 0;
}

.hero-name {
  font-size: clamp(3.5rem, 10vw, 7rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--color-text);
  margin-bottom: 1.25rem;
}

.hero-role {
  font-size: clamp(0.75rem, 1.8vw, 0.85rem);
  font-weight: 400;
  color: var(--color-text-secondary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: var(--space-lg);
}

.hero-philosophy {
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  font-weight: 400;
  color: var(--color-text);
  letter-spacing: -0.005em;
  opacity: 0.8;
  margin-bottom: var(--space-xs);
}

.hero-tamil-whisper {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  opacity: 0.45;
  margin-bottom: var(--space-md);
}

/* Hero Kolam Motif */
.hero-kolam {
  display: flex;
  justify-content: center;
  margin-top: var(--space-lg);
  margin-bottom: 0;
  color: var(--color-kolam);
  opacity: 0.7;
}

.hero-kolam svg {
  width: 90px;
  height: 30px;
}

/* Scroll cue */
.scroll-cue {
  display: flex;
  justify-content: center;
  margin-top: var(--space-md);
}

.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--color-text-secondary), transparent);
  opacity: 0.3;
  animation: scrollPulse 2.5s var(--ease-smooth) infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.1; transform: scaleY(0.6); }
  50% { opacity: 0.3; transform: scaleY(1); }
}

/* ============================================
   KOLAM DIVIDERS
   ============================================ */
.kolam-divider {
  display: flex;
  justify-content: center;
  padding: var(--space-lg) 0;
  color: var(--color-kolam);
}

.kolam-divider svg {
  width: 280px;
  height: 40px;
}

.kolam-divider--grand svg {
  width: 340px;
  height: 56px;
}

/* ============================================
   SECTION TITLES
   ============================================ */
.section-title {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.section-title [data-ta] {
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: none;
}

/* Tamil micro-label below section title — always visible in EN mode */
.section-title-tamil {
  display: block;
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--color-accent);
  opacity: 0.45;
}

/* Hide the micro-label in Tamil mode since the title itself is in Tamil */
body.lang-ta .section-title-tamil {
  display: none;
}

/* ============================================
   IDENTITY
   ============================================ */
.identity {
  padding: var(--space-xl) 0;
}

.identity-grid {
  display: grid;
  gap: var(--space-md);
}

.identity-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-divider);
}

.identity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.identity-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.identity-label [data-ta] {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.75rem;
}

.identity-label--repeat {
  opacity: 0.4;
}

.identity-value {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

/* ============================================
   EXPERIENCE / TIMELINE
   ============================================ */
.experience {
  padding: var(--space-xl) 0;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-divider);
}

.timeline-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.timeline-duration {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
}

.timeline-company {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-top: 0.25rem;
}

.timeline-role {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.timeline-impact {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-impact li {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.5;
  padding-left: 1rem;
  position: relative;
}

.timeline-impact li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 1px;
  background-color: var(--color-accent);
  opacity: 0.6;
}

/* ============================================
   PROJECTS
   ============================================ */
.projects {
  padding: var(--space-xl) 0;
}

.project-list {
  display: flex;
  flex-direction: column;
}

.project-item {
  border-bottom: 1px solid var(--color-divider);
}

.project-item:last-child {
  border-bottom: none;
}

.project-header {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: var(--space-md) 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 0.25rem;
  font-family: inherit;
  transition: opacity 0.2s var(--ease-smooth);
}

.project-header:hover {
  opacity: 0.7;
}

.project-name {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
  grid-column: 1;
  grid-row: 1;
}

.project-line {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  grid-column: 1;
  grid-row: 2;
  line-height: 1.5;
}

.project-expand {
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  transition: transform 0.3s var(--ease-smooth);
  line-height: 1;
}

.project-item.open .project-expand {
  transform: rotate(45deg);
}

.project-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-smooth), opacity 0.3s var(--ease-smooth);
  opacity: 0;
}

.project-item.open .project-details {
  max-height: 200px;
  opacity: 1;
}

.project-details p {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  line-height: 1.6;
  padding-bottom: var(--space-md);
}

/* ============================================
   SKILLS
   ============================================ */
.skills {
  padding: var(--space-xl) 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.skill-group {
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-divider);
}

.skill-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.skill-group-title {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.skill-group-title [data-ta] {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.75rem;
}

.skill-items {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text);
  letter-spacing: -0.01em;
  line-height: 1.6;
}

/* ============================================
   LEADERSHIP
   ============================================ */
.leadership {
  padding: var(--space-xl) 0;
}

.leadership-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.leadership-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-divider);
}

.leadership-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.leadership-label {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text);
}

.leadership-detail {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--color-text-secondary);
}

/* ============================================
   PHILOSOPHY
   ============================================ */
.philosophy {
  padding: var(--space-2xl) 0;
}

.philosophy-statements {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  text-align: center;
}

.philosophy-line {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 300;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.4;
}

.philosophy-line [data-ta] {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
}

/* Tamil-only philosophy line — always visible, cultural anchor */
.philosophy-line--tamil {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 300;
  color: var(--color-accent);
  opacity: 0.5;
  margin-top: var(--space-sm);
}

/* ============================================
   CONTACT
   ============================================ */
.contact {
  padding: var(--space-2xl) 0 var(--space-xl);
  text-align: center;
}

.contact-text {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
  letter-spacing: -0.01em;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.contact-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.3s var(--ease-smooth), opacity 0.3s var(--ease-smooth);
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.contact-link:hover {
  color: var(--color-text);
  opacity: 1;
}

.contact-signature {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  opacity: 0.5;
  letter-spacing: 0.01em;
}

.contact-signature .tamil-text {
  color: var(--color-accent);
  opacity: 0.7;
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */
[data-animate] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- 1. Kolam Settle-In --- */
.kolam-divider[data-animate] {
  transform: none;
  transition: none;
}

.kolam-divider[data-animate] svg {
  opacity: 0;
}

.kolam-divider[data-animate].visible svg {
  animation: kolamSettle 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes kolamSettle {
  0%   { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

.kolam-divider--grand[data-animate].visible svg {
  animation-duration: 800ms;
}

/* --- 2. Section Title Reveal --- */
.section-title[data-animate] {
  transform: translateY(5px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-title[data-animate] .section-title-tamil {
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1) 80ms;
}

.section-title[data-animate].visible .section-title-tamil {
  opacity: 0.45;
}

/* --- 3. Philosophy Cadence --- */
.philosophy-line[data-animate] {
  transform: none;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.philosophy-line:nth-child(1) { transition-delay: 0s; }
.philosophy-line:nth-child(2) { transition-delay: 0.2s; }
.philosophy-line:nth-child(3) { transition-delay: 0.4s; }
.philosophy-line:nth-child(4) { transition-delay: 0.6s; }
.philosophy-line:nth-child(5) { transition-delay: 0.9s; }

/* --- 4. Divider Awareness --- */
.identity-item,
.experience-entry,
.leadership-item {
  border-color: rgba(29, 29, 31, 0.05);
  transition: border-color 0.6s var(--ease-smooth);
}

[data-animate].visible .identity-item,
[data-animate].visible .experience-entry,
[data-animate].visible .leadership-item {
  border-color: rgba(29, 29, 31, 0.08);
}

/* ============================================
   RESPONSIVE — DESKTOP
   ============================================ */
@media (min-width: 768px) {
  :root {
    --max-width: 640px;
  }

  section {
    padding: var(--space-2xl) 0;
  }

  .identity-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
  }

  .timeline-item {
    grid-template-columns: 160px 1fr;
    gap: var(--space-md);
  }

  .timeline-company {
    margin-top: 0;
  }

  .skills-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md) var(--space-lg);
  }

  .skill-group {
    border-bottom: none;
    padding-bottom: 0;
  }

  .leadership-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
  }
}

@media (min-width: 1024px) {
  :root {
    --max-width: 720px;
  }

  .hero-name {
    letter-spacing: -0.04em;
  }

  .philosophy {
    padding: 12rem 0;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .lang-toggle,
  .scroll-cue,
  .kolam-divider {
    display: none;
  }

  section {
    page-break-inside: avoid;
    padding: 1rem 0;
  }

  .hero {
    min-height: auto;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }
}