/* ============================================================
   DHIVAKAR RAJARAM — Portfolio v4
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---- VARIABLES ---- */
[data-theme="dark"] {
  --bg:           #0d0d0d;
  --bg-alt:       #111111;
  --surface:      #161616;
  --surface-2:    #1e1e1e;
  --border:       rgba(255,255,255,0.07);
  --border-strong:rgba(255,255,255,0.13);
  --text:         #f0ede6;
  --text-muted:   #8a857a;
  --text-faint:   #3d3a35;
  --accent:       #c8a96e;
  --accent-dim:   rgba(200,169,110,0.10);
  --accent-hover: #d4b97e;
  --pill-bg:      #1a1a1a;
  --pill-border:  rgba(255,255,255,0.09);
  --card-bg:      #131313;
  --card-border:  rgba(255,255,255,0.07);
  --card-hover:   rgba(255,255,255,0.03);
  --nav-bg:       rgba(13,13,13,0.90);
  --timeline-line:rgba(255,255,255,0.07);
}

[data-theme="light"] {
  --bg:           #f5f2ec;
  --bg-alt:       #ede9e1;
  --surface:      #ffffff;
  --surface-2:    #f0ede6;
  --border:       rgba(0,0,0,0.07);
  --border-strong:rgba(0,0,0,0.13);
  --text:         #1a1814;
  --text-muted:   #6e6a64;
  --text-faint:   #b8b3ab;
  --accent:       #8b5e2e;
  --accent-dim:   rgba(139,94,46,0.09);
  --accent-hover: #7a5228;
  --pill-bg:      #ede9e1;
  --pill-border:  rgba(0,0,0,0.09);
  --card-bg:      #ffffff;
  --card-border:  rgba(0,0,0,0.07);
  --card-hover:   rgba(0,0,0,0.02);
  --nav-bg:       rgba(245,242,236,0.92);
  --timeline-line:rgba(0,0,0,0.08);
}

/* ---- TYPOGRAPHY ---- */
body {
  font-family: 'Libre Baskerville', Georgia, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}
.mono { font-family: 'DM Mono', monospace; letter-spacing: 0.04em; }
h1,h2,h3,h4 { font-family: 'Fraunces', serif; font-weight: 300; line-height: 1.1; }

/* ---- LAYOUT ---- */
.container { max-width: 1160px; margin: 0 auto; padding: 0 2rem; }

/* ---- NAV ---- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}
.nav-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 2rem;
  height: 64px; display: flex; align-items: center; gap: 2rem;
}
.nav-logo {
  font-family: 'Fraunces', serif; font-size: 1.2rem; color: var(--accent);
  letter-spacing: 0.06em; margin-right: auto;
}
.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a {
  font-family: 'DM Mono', monospace; font-size: 0.68rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

.theme-toggle {
  width: 36px; height: 36px; border: 1px solid var(--border-strong);
  border-radius: 50%; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1rem; transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
[data-theme="dark"] .sun { display: block; }
[data-theme="dark"] .moon { display: none; }
[data-theme="light"] .sun { display: none; }
[data-theme="light"] .moon { display: block; }

.nav-hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.nav-hamburger span { display: block; width: 22px; height: 1.5px; background: var(--text); transition: all 0.3s; }
.nav-mobile {
  display: none; flex-direction: column; padding: 1.5rem 2rem;
  border-top: 1px solid var(--border); gap: 1.2rem;
}
.nav-mobile a { font-family: 'DM Mono', monospace; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.nav-mobile.open { display: flex; }

/* ---- REVEAL ---- */
[data-reveal] {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.75s cubic-bezier(0.16,1,0.3,1), transform 0.75s cubic-bezier(0.16,1,0.3,1);
}
[data-reveal].revealed { opacity: 1; transform: translateY(0); }

/* ---- HERO ---- */
.hero {
  min-height: 100vh; display: flex; align-items: center;
  position: relative; overflow: hidden; padding: 120px 2rem 80px;
}
.hero-inner { max-width: 1160px; margin: 0 auto; width: 100%; position: relative; z-index: 2; }
.hero-eyebrow {
  font-family: 'DM Mono', monospace; font-size: 0.68rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 2rem;
}
.hero-name {
  font-family: 'Fraunces', serif; font-size: clamp(4rem, 10vw, 9.5rem);
  font-weight: 300; line-height: 0.95; letter-spacing: -0.02em;
  color: var(--text); display: flex; flex-direction: column; margin-bottom: 2.5rem;
}
.hero-name span:last-child { color: var(--accent); font-style: italic; }
.hero-domain {
  font-family: 'DM Mono', monospace; font-size: 0.7rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 1.2rem;
}
.hero-tagline {
  font-family: 'Fraunces', serif; font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 300; color: var(--text-muted); margin-bottom: 3rem; font-style: italic;
}
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 4rem; }

/* ---- BUTTONS ---- */
.btn {
  font-family: 'DM Mono', monospace; font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.9rem 2rem; border-radius: 2px; cursor: pointer;
  transition: all 0.22s ease; display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-filled { background: var(--accent); color: #0d0d0d; border: 1px solid var(--accent); }
.btn-filled:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ---- HERO STATS ---- */
.hero-stats {
  display: flex; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--border); width: fit-content; max-width: 100%;
}
.stat { display: flex; flex-direction: column; padding: 1.2rem 2rem; }
.stat-value { font-family: 'Fraunces', serif; font-size: 1.3rem; font-weight: 400; color: var(--text); line-height: 1; margin-bottom: 0.3rem; }
.stat-label { font-family: 'DM Mono', monospace; font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

.hero-bg-text {
  position: absolute; right: -0.05em; top: 50%; transform: translateY(-50%);
  font-family: 'Fraunces', serif; font-size: clamp(12rem, 28vw, 28rem);
  font-weight: 700; color: transparent;
  -webkit-text-stroke: 1px var(--border); text-stroke: 1px var(--border);
  user-select: none; pointer-events: none; line-height: 1; z-index: 0;
}
.hero::after {
  content: '↓'; position: absolute; bottom: 2.5rem; left: 50%;
  transform: translateX(-50%); font-size: 1rem; color: var(--text-faint);
  animation: bounce 2.4s ease-in-out infinite; z-index: 2;
}
@keyframes bounce {
  0%,100% { transform: translateX(-50%) translateY(0); opacity: 0.4; }
  50% { transform: translateX(-50%) translateY(6px); opacity: 0.8; }
}

/* ---- SECTION COMMON ---- */
.section-label {
  font-family: 'DM Mono', monospace; font-size: 0.62rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); display: block; margin-bottom: 1rem;
}
.section-header { margin-bottom: 4rem; }
.section-title { font-family: 'Fraunces', serif; font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 300; color: var(--text); }

/* ---- ABOUT ---- */
.about { padding: 8rem 0; border-top: 1px solid var(--border); }
.about-inner { display: grid; grid-template-columns: 1fr 1.4fr; gap: 6rem; align-items: start; }
.about-left { position: sticky; top: 100px; }
.pull-quote {
  font-family: 'Fraunces', serif; font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300; font-style: italic; line-height: 1.2;
  color: var(--text); margin: 1.5rem 0 2rem;
}
.about-location { font-size: 0.72rem; color: var(--text-muted); }
.about-right p { font-size: 1rem; color: var(--text-muted); margin-bottom: 1.4rem; line-height: 1.8; }
.about-right p strong { color: var(--text); font-weight: 700; }

/* ---- SKILLS PILLS ---- */
.skills-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2.5rem; }
.pill {
  font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.08em;
  padding: 0.4rem 0.85rem; border: 1px solid var(--pill-border);
  background: var(--pill-bg); color: var(--text-muted); border-radius: 2px;
  transition: all 0.2s; cursor: default;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }

/* ---- PILLARS ---- */
.pillars {
  padding: 0 0 8rem;
  border-bottom: 1px solid var(--border);
}
.pillars-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
}
.pillar-card {
  padding: 2.5rem 2rem; border-right: 1px solid var(--border);
  transition: background 0.2s;
}
.pillar-card:last-child { border-right: none; }
.pillar-card:hover { background: var(--card-hover); }
.pillar-num {
  font-size: 0.6rem; letter-spacing: 0.16em; color: var(--accent);
  display: block; margin-bottom: 1rem;
}
.pillar-title {
  font-family: 'Fraunces', serif; font-size: 1rem; font-weight: 400;
  color: var(--text); margin-bottom: 0.8rem;
}
.pillar-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.75; }

/* ---- EXPERIENCE ---- */
.experience {
  padding: 8rem 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.timeline { position: relative; padding-left: 2px; }
.timeline::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 1px; background: var(--timeline-line);
}
.timeline-entry {
  display: grid; grid-template-columns: 220px 1fr; gap: 3rem;
  padding: 3rem 0 3rem 3rem;
  border-bottom: 1px solid var(--border); position: relative;
}
.timeline-entry::before {
  content: ''; position: absolute; left: -4px; top: 3.5rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-alt);
}
.timeline-entry:last-child { border-bottom: none; }
.timeline-meta { display: flex; flex-direction: column; gap: 0.4rem; padding-top: 0.3rem; }
.timeline-date { font-size: 0.65rem; color: var(--text-muted); }
.timeline-location { font-size: 0.62rem; color: var(--text-faint); }
.timeline-badge {
  font-family: 'DM Mono', monospace; font-size: 0.58rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-dim);
  padding: 0.22rem 0.55rem; border-radius: 2px; display: inline-block; margin-bottom: 0.8rem;
}
.timeline-company { font-family: 'Fraunces', serif; font-size: 1.6rem; font-weight: 300; color: var(--text); margin-bottom: 0.3rem; }
.timeline-role { font-family: 'DM Mono', monospace; font-size: 0.68rem; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 1.2rem; }
.timeline-bullets li {
  position: relative; padding-left: 1.2rem;
  font-size: 0.9rem; color: var(--text-muted);
  margin-bottom: 0.6rem; line-height: 1.7;
}
.timeline-bullets li::before { content: '—'; position: absolute; left: 0; color: var(--text-faint); font-size: 0.72rem; }

/* ---- DHIVA-LABS SECTION ---- */
.dhivalabs { padding: 8rem 0; border-top: 1px solid var(--border); }
.dhivalabs-inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 6rem; align-items: start; }
.dhivalabs-quote {
  font-family: 'Fraunces', serif; font-size: 1.6rem; font-weight: 300;
  font-style: italic; color: var(--accent); margin-bottom: 1.4rem; line-height: 1.3;
}
.dhivalabs-desc { font-size: 0.95rem; color: var(--text-muted); line-height: 1.8; margin-bottom: 1.2rem; }
.dhivalabs-domains { margin: 2rem 0; }
.domain-list { display: flex; flex-direction: column; gap: 1rem; }
.domain-item { display: flex; align-items: flex-start; gap: 0.8rem; }
.domain-icon { color: var(--accent); font-size: 0.65rem; margin-top: 0.35rem; flex-shrink: 0; }
.domain-item strong { font-family: 'DM Mono', monospace; font-size: 0.7rem; letter-spacing: 0.06em; color: var(--text); display: block; margin-bottom: 0.1rem; }
.domain-item span { font-size: 0.82rem; color: var(--text-muted); }
.dhivalabs-links { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }
.dhivalabs-links .btn { font-size: 0.65rem; padding: 0.7rem 1.4rem; }

.dhivalabs-stack-panel { padding-top: 0.5rem; }
.stack-category { margin-bottom: 1.6rem; }
.stack-cat-label { font-size: 0.58rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); }
.stack-category .skills-grid { margin-top: 0.5rem; }

.lab-status-box {
  display: flex; align-items: flex-start; gap: 1rem;
  border: 1px solid var(--border); padding: 1.4rem 1.6rem;
  margin-top: 2.5rem;
}
.lab-status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #4ade80;
  flex-shrink: 0; margin-top: 0.35rem;
  box-shadow: 0 0 8px rgba(74,222,128,0.4);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; } 50% { opacity: 0.5; }
}
.lab-status-title { font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); margin-bottom: 0.25rem; }
.lab-status-sub { font-size: 0.78rem; color: var(--text-muted); }

/* ---- PROJECTS ---- */
.projects { padding: 8rem 0; border-top: 1px solid var(--border); background: var(--bg-alt); }
.projects-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--card-border);
}
.projects-grid--lab { border-bottom: none; }

.project-card { background: var(--card-bg); transition: background 0.2s; }
.project-card:hover { background: var(--card-hover); }
.project-card:nth-child(odd) { border-right: 1px solid var(--card-border); }
.project-card:nth-child(1),.project-card:nth-child(2) { border-bottom: 1px solid var(--card-border); }
.projects-grid:not(.projects-grid--lab) .project-card:nth-child(3),
.projects-grid:not(.projects-grid--lab) .project-card:nth-child(4) { border-bottom: none; }
.projects-grid--lab .project-card:nth-child(3),
.projects-grid--lab .project-card:nth-child(4) { border-bottom: 1px solid var(--card-border); }

.project-card-inner { padding: 2.5rem; height: 100%; display: flex; flex-direction: column; }
.project-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.project-number { font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.16em; color: var(--text-faint); }
.project-status { font-family: 'DM Mono', monospace; font-size: 0.56rem; letter-spacing: 0.1em; padding: 0.22rem 0.55rem; border-radius: 2px; }
.project-status--live   { color: #4ade80; background: rgba(74,222,128,0.08); border: 1px solid rgba(74,222,128,0.18); }
.project-status--wip    { color: var(--accent); background: var(--accent-dim); border: 1px solid rgba(200,169,110,0.2); }
.project-status--past   { color: var(--text-faint); background: transparent; border: 1px solid var(--border); }
.project-name { font-family: 'Fraunces', serif; font-size: 1.4rem; font-weight: 300; color: var(--text); margin-bottom: 0.8rem; }
.project-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.75; flex: 1; margin-bottom: 1.6rem; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.6rem; }
.tag {
  font-family: 'DM Mono', monospace; font-size: 0.58rem; letter-spacing: 0.08em;
  padding: 0.28rem 0.65rem; border: 1px solid var(--pill-border); color: var(--text-faint); border-radius: 2px;
}
.project-link {
  font-family: 'DM Mono', monospace; font-size: 0.65rem; letter-spacing: 0.1em;
  color: var(--accent); transition: letter-spacing 0.2s; margin-top: auto; display: block;
}
.project-link:hover { letter-spacing: 0.18em; }
.project-link--muted { color: var(--text-faint); }
.project-card--featured { position: relative; }
.project-card--featured::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: var(--accent);
}
.project-card--coming { opacity: 0.72; }
.project-card--coming:hover { opacity: 1; }

/* ---- CONTACT ---- */
.contact { padding: 8rem 0; border-top: 1px solid var(--border); }
.contact-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 6rem; align-items: start; }
.contact-headline { font-family: 'Fraunces', serif; font-size: clamp(2.2rem, 4.5vw, 3.4rem); font-weight: 300; color: var(--text); margin-bottom: 1.2rem; line-height: 1.15; }
.contact-sub { font-size: 0.92rem; color: var(--text-muted); line-height: 1.8; }
.open-to-list { display: flex; flex-direction: column; gap: 0.5rem; }
.open-to-item {
  font-family: 'DM Mono', monospace; font-size: 0.68rem; letter-spacing: 0.06em;
  color: var(--text-muted); padding-left: 1rem; position: relative;
}
.open-to-item::before { content: '→'; position: absolute; left: 0; color: var(--accent); }

.contact-right { padding-top: 1rem; display: flex; flex-direction: column; gap: 1.8rem; }
.contact-item { display: flex; align-items: flex-start; gap: 1.1rem; }
.contact-icon { font-size: 0.85rem; color: var(--accent); margin-top: 0.2rem; flex-shrink: 0; }
.contact-label { font-family: 'DM Mono', monospace; font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); display: block; margin-bottom: 0.2rem; }
.contact-value { font-size: 0.92rem; color: var(--text); display: block; transition: color 0.2s; }
a.contact-value:hover { color: var(--accent); }
.contact-cta { margin-top: 1rem; align-self: flex-start; }

/* ---- FOOTER ---- */
.footer { border-top: 1px solid var(--border); padding: 2rem 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer-name { font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.1em; color: var(--text-faint); }
.footer-tagline { font-family: 'Fraunces', serif; font-size: 0.85rem; font-style: italic; color: var(--text-muted); }
.footer-built { font-family: 'DM Mono', monospace; font-size: 0.6rem; letter-spacing: 0.1em; color: var(--text-faint); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1100px) {
  .pillars-grid { grid-template-columns: 1fr 1fr; }
  .pillar-card:nth-child(2) { border-right: none; }
  .pillar-card:nth-child(1),.pillar-card:nth-child(2) { border-bottom: 1px solid var(--border); }
  .pillar-card:nth-child(3),.pillar-card:nth-child(4) { border-bottom: none; }
  .pillar-card:nth-child(3) { border-right: 1px solid var(--border); }
}

@media (max-width: 900px) {
  .about-inner,.contact-inner,.dhivalabs-inner { grid-template-columns: 1fr; gap: 3rem; }
  .about-left { position: static; }
  .timeline-entry { grid-template-columns: 1fr; gap: 0.6rem; padding-left: 2.5rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card:nth-child(odd) { border-right: none; }
  .project-card { border-bottom: 1px solid var(--card-border) !important; }
  .project-card:last-child { border-bottom: none !important; }
  .hero-stats { flex-direction: column; align-items: flex-start; }
  .stat-divider { width: 40px; height: 1px; }
}

@media (max-width: 680px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .pillars-grid { grid-template-columns: 1fr; }
  .pillar-card { border-right: none !important; border-bottom: 1px solid var(--border) !important; }
  .pillar-card:last-child { border-bottom: none !important; }
  .hero-name { font-size: clamp(3.2rem, 14vw, 6rem); }
}

@media (max-width: 480px) {
  .hero { padding: 100px 1.5rem 60px; }
  .container { padding: 0 1.5rem; }
  .about,.experience,.dhivalabs,.projects,.contact { padding: 5rem 0; }
  .project-card-inner { padding: 2rem 1.5rem; }
  .footer-inner { justify-content: center; text-align: center; }
}
