/* =========================
   GOOGLE FONTS
   Syne — used for headings and logo (bold, geometric)
   DM Sans — used for body text (clean, readable)
========================= */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* =========================
   DESIGN TOKENS (CSS Custom Properties)
   Centralised colour palette and spacing values.
   Change values here to restyle the whole site.
========================= */

:root {
  /* Background surfaces */
  --paper:   #faf8f5;   /* Main page background */
  --paper-2: #f3eee8;   /* Secondary / offset background */

  /* Text colours */
  --ink:   #15120f;     /* Primary text — near-black warm tone */
  --soft:  #38312c;     /* Secondary text */
  --muted: #6f6963;     /* Subdued text: captions, hints */

  /* Brand accent — warm rust/terracotta */
  --rust:       #bd482e;
  --rust-dark:  #912f1d; /* Hover state for rust elements */
  --rust-light: #f3d8d0; /* Tag backgrounds, focus rings */

  /* Component tokens */
  --card:   rgba(255, 255, 255, 0.78); /* Semi-transparent card surface */
  --border: rgba(21, 18, 15, 0.08);    /* Subtle divider / outline */
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.08);

  /* Layout */
  --radius:     24px;    /* Default border-radius for cards */
  --container:  1200px;  /* Max content width */
  --transition: .25s ease;
}

/* =========================
   DARK MODE OVERRIDES
   Applied via JS when body.dark class is toggled.
   Only colour tokens change; layout stays the same.
========================= */

body.dark {
  --paper:   #0d1117;
  --paper-2: #151b23;

  --ink:   #f5f2ed;
  --soft:  #d6d1ca;
  --muted: #9ea6b0;

  --card:   rgba(24, 29, 37, 0.82);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* =========================
   RESET
   Normalises browser default styles before custom rules.
========================= */

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.7;
  transition: background .3s, color .3s; /* Smooth dark/light switch */
  overflow-x: hidden; /* Prevent horizontal scroll from animations */
}

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

img {
  display: block; /* BUG FIX: "square" is not a valid display value */
  max-width: 75%;
}

button,
input,
textarea {
  font: inherit; /* Prevents browser from overriding font in form elements */
}

ul {
  list-style: none;
}

/* =========================
   HEADER — THEME TOGGLE & NAV ACTIONS
========================= */

/* Circular icon button for dark/light mode switch */
.theme-toggle {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--rust);
}

/* Row container for the Connect button + theme toggle */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Underline indicator for the currently active nav page */
.nav-links a.active {
  color: var(--rust);
  font-weight: 700;
  border-bottom: 2px solid var(--rust);
  padding-bottom: 4px;
}

/* =========================
   CONTAINER
   Responsive width wrapper used on every section.
========================= */

.container {
  width: min(92%, var(--container));
  margin: auto;
}

/* =========================
   BACKGROUND GLOW
   Decorative blurred circle fixed in the top-right corner.
   z-index:-1 keeps it behind all content.
========================= */

.bg-glow {
  position: fixed;
  top: -200px;
  right: -200px;
  width: 650px;
  height: 650px;
  background: rgba(219, 89, 59, 0.08);
  filter: blur(120px);
  z-index: -1;
}

/* =========================
   NAVBAR
   Sticky header with frosted-glass blur effect.
========================= */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  /* Semi-transparent background using color-mix for cross-theme support */
  background: color-mix(in srgb, var(--paper) 5%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-wrapper {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Site logo: "chetan.k" with rust-coloured dot */
.logo {
  font-family: 'Syne';
  font-weight: 800;
  font-size: 1.2rem;
}

.logo span {
  color: var(--rust);
}

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

.nav-links a {
  color: var(--muted);
  font-size: .95rem;
  transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--rust);
}

/* =========================
   BUTTONS
   .btn-primary  — filled rust CTA button
   .contact-btn  — same style, used in navbar
   .btn-secondary — outlined/ghost variant
========================= */

.btn-primary,
.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border-radius: 999px; /* Pill shape */
  background: var(--rust);
  color: white;
  font-weight: 700;
  transition: var(--transition);
}

.btn-primary:hover,
.contact-btn:hover {
  background: var(--rust-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 700;
}

/* =========================
   HERO SECTION
   Full-height landing area with optional compact variant.
========================= */

.hero {
  min-height: 60vh;
  display: flex;
  align-items: center;
  padding: 80px 0;
}

/* Shorter hero for interior pages (about, contact, etc.) */
.hero-compact {
  min-height: 45vh;
}

/* Two-column layout: text left, profile photo right */
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 70px;
  align-items: center;
}

.hero-content {
  max-width: 760px;
}

/* Small uppercase label above the main heading */
.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--rust);
  margin-bottom: 16px;
}

.hero h1 {
  font-family: 'Syne';
  font-size: clamp(3rem, 6vw, 5rem); /* Fluid type — scales with viewport */
  line-height: .95;
  letter-spacing: -.04em;
  margin-bottom: 22px;
}

.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 700px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.hero-socials {
  display: flex;
  gap: 20px;
  margin-top: 24px;
}

.hero-socials a {
  font-weight: 600;
  color: var(--muted);
}

/* Profile photo in homepage hero */
.hero-profile img {
  width: 100%;
  max-width: 75%;
  border-radius: 24px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  object-fit: cover;
}

/* =========================
   GRADIENT TEXT
   Applied to main headings for a subtle rust-to-ink gradient.
========================= */

.hero h1,
.section-title {
  background: linear-gradient(110deg, var(--ink) 20%, var(--rust) 110%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

/* =========================
   SECTIONS
   Standard vertical rhythm wrappers.
========================= */

.section {
  padding: 25px 0;
}

.section-small {
  padding: 30px 0;
}

.section-header {
  margin-bottom: 40px;
}

/* Overline label above section titles */
.section-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 800;
  color: var(--rust);
  margin-bottom: 10px;
}

.section-title {
  font-family: 'Syne';
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.section-subtitle {
  color: var(--muted);
  margin-top: 12px;
  max-width: 700px;
}

/* =========================
   GRID SYSTEM
   Utility classes for multi-column layouts.
========================= */

.grid {
  display: grid;
  gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Two-column split used on the About page */
.split {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

/* =========================
   CARDS
   Reusable surface components used across all pages.
========================= */

.card,
.project-card,
.feature-card,
.contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

/* Subtle lift on hover for interactive cards */
.card:hover,
.project-card:hover {
  transform: translateY(-4px);
  transition: var(--transition);
}

.card h3,
.project-card h3 {
  font-family: 'Syne';
  margin-bottom: 12px;
}

.card p,
.project-card p {
  color: var(--muted);
}

/* =========================
   TAGS
   Small pill labels used on project cards.
========================= */

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.tag {
  background: var(--rust-light);
  color: var(--rust);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}

/* =========================
   TIMELINE
   Used on About and Resume pages for education/roadmap sections.
========================= */

.timeline-card {
  display: grid;
  gap: 24px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 120px 1fr; /* Year label | Content */
  gap: 24px;
}

.timeline-year {
  font-weight: 800;
  color: var(--rust);
}

/* =========================
   PROJECT FILTERS
   Filter button row on the Projects page.
========================= */

.project-filters {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
}

/* Active / selected filter */
.filter-btn.active {
  background: var(--rust);
  color: white;
}

/* =========================
   CONTACT FORM
   Used on the Contact page.
========================= */

.contact-form {
  display: grid;
  gap: 24px;
  margin-top: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

/* Rust-coloured focus ring for accessibility */
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--rust);
  box-shadow: 0 0 0 4px var(--rust-light);
}

.form-group textarea {
  resize: vertical;  /* Allow height resize only */
  min-height: 160px;
}

/* Side-by-side layout: contact cards left, form right */
.contact-side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

/* Submit button inside the form */
.contact-form .btn-primary {
  cursor: pointer;
  border: none;
  align-self: flex-start; /* Prevents button from stretching full column width */
  padding: 16px 32px;
  margin-top: 8px;
}

/* =========================
   FOOTER
========================= */

.footer {
  padding: 50px 0;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

/* =========================
   WHATSAPP FLOATING BUTTON
   Fixed bottom-right CTA present on every page.
========================= */

.whatsapp-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #25D366; /* WhatsApp brand green */
  color: white;
  font-size: 1.7rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  z-index: 999;
}

.whatsapp-float:hover {
  transform: translateY(-4px);
}

/* =========================
   HAMBURGER BUTTON
   Only visible on mobile (≤992px). Hidden on desktop.
========================= */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 10px;
  transition: var(--transition);
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .3s ease, opacity .3s ease;
}

/* Animate the three bars into an X when open */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================
   MOBILE NAVIGATION DRAWER
   Slides down from the navbar on mobile.
   Hidden on desktop.
========================= */

.mobile-nav {
  display: none; /* hidden on desktop */
  position: absolute;
  top: 78px; /* flush below the navbar */
  left: 0;
  width: 100%;
  z-index: 99;
  backdrop-filter: blur(20px);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  max-height: 0;
  transition: max-height .4s cubic-bezier(0.4, 0, 0.2, 1),
              padding .4s ease;
}

.mobile-nav.open {
  max-height: 400px;
  padding: 16px 0 24px;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: min(92%, 1200px);
  margin: auto;
}

.mobile-nav-links a {
  width: 100%;
  padding: 13px 20px;
  border-radius: 12px;
  color: var(--soft);
  font-weight: 600;
  font-size: 1rem;
  transition: var(--transition);
  text-align: left;
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
  background: var(--rust-light);
  color: var(--rust);
}

.mobile-nav-links a.active {
  font-weight: 700;
}

/* Divider before the CTA button */
.mobile-nav-cta {
  width: min(92%, 1200px);
  margin: 12px auto 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

.mobile-nav-cta .btn-primary {
  flex: 1;
  text-align: center;
  padding: 12px 16px;
}

/* =========================
   RESPONSIVE BREAKPOINTS
========================= */

/* Tablet and below — collapse multi-column grids to single column */
@media (max-width: 992px) {
  .hero-grid,
  .grid-4,
  .grid-3,
  .grid-2,
  .split {
    grid-template-columns: 1fr;
  }

  .hero {
    text-align: center;
  }

  .hero-actions,
  .hero-socials {
    justify-content: center;
  }

  /* Hide desktop nav links — mobile drawer replaces them */
  .nav-links {
    display: none;
  }

  /* Show hamburger button on mobile */
  .hamburger {
    display: flex;
  }

  /* Show mobile nav drawer on mobile */
  .mobile-nav {
    display: block;
  }

  /* Make navbar position:relative so the drawer can anchor below it */
  .navbar {
    position: sticky;
    top: 0;
  }
}

/* Mobile — tighten type and layout */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.8rem;
  }

  .section {
    padding: 20px 0;
  }

  /* Stack timeline year above content on small screens */
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}
