/* ==========================================================================
   Chandan Kumar Thakur — Portfolio
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --bg-card: #ffffff;
  --text: #14161a;
  --text-muted: #5b6472;
  --border: #e3e6ea;
  --accent: #2f6df6;
  --accent-2: #7b5cf6;
  --accent-soft: rgba(47, 109, 246, 0.1);
  --accent-glow: rgba(47, 109, 246, 0.18);
  --card-top: #ffffff;
  --card-bot: #fbfcfe;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lift: 0 2px 4px rgba(16, 24, 40, 0.06), 0 18px 40px -12px rgba(16, 24, 40, 0.18);
  --radius: 16px;
  --max: 1080px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --bg-alt: #141922;
  --bg-card: #161b23;
  --text: #eef1f6;
  --text-muted: #9aa4b2;
  --border: #232a35;
  --accent: #5b8cff;
  --accent-2: #a78bfa;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --accent-glow: rgba(91, 140, 255, 0.22);
  --card-top: #1a212b;
  --card-bot: #141a23;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.45), 0 20px 44px -12px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116;
    --bg-alt: #141922;
    --bg-card: #161b23;
    --text: #eef1f6;
    --text-muted: #9aa4b2;
    --border: #232a35;
    --accent: #5b8cff;
    --accent-2: #a78bfa;
    --accent-soft: rgba(91, 140, 255, 0.14);
    --accent-glow: rgba(91, 140, 255, 0.22);
    --card-top: #1a212b;
    --card-bot: #141a23;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.45), 0 20px 44px -12px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6rem; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 750; }
h3 { font-size: 1.12rem; font-weight: 650; }
p { margin: 0 0 1rem; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 22px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 1rem; height: 66px; }
.brand { font-weight: 750; letter-spacing: -0.02em; color: var(--text); font-size: 1.02rem; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.nav-links { display: flex; gap: .35rem; margin-left: auto; align-items: center; }
.nav-actions { display: flex; gap: .5rem; align-items: center; margin-left: .75rem; }
.nav-links a {
  color: var(--text-muted); font-size: .93rem; font-weight: 500;
  padding: .45rem .7rem; border-radius: 8px;
}
.nav-links a:hover { color: var(--text); background: var(--bg-alt); text-decoration: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { color: var(--text); background: var(--bg-alt); }
.nav-toggle { display: none; }

@media (max-width: 780px) {
  .nav-toggle { display: inline-grid; }
  .nav-actions { margin-left: auto; }
  .nav-links {
    position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: .5rem 18px 1rem; display: none;
    max-height: calc(100dvh - 66px); overflow-y: auto;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .8rem .5rem; font-size: 1rem; }
}

/* ---------- Sections ---------- */
section { padding: 84px 0; }
section:nth-of-type(even) { background: var(--bg-alt); }

.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 650;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .5rem;
}
.section-head { max-width: 640px; margin-bottom: 2.6rem; }
.section-head p { color: var(--text-muted); margin: 0; }

/* ---------- Hero ---------- */
.hero { padding: 92px 0 84px; background: var(--bg); }
.hero-grid {
  display: grid; grid-template-columns: 1.25fr .75fr;
  gap: 3.5rem; align-items: center;
}
.hero p.lead { font-size: 1.1rem; color: var(--text-muted); max-width: 56ch; }
.hero .role { color: var(--accent); }

.hero-photo {
  position: relative; border-radius: 20px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  background: var(--bg-alt); aspect-ratio: 4 / 5;
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }

.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.6rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .72rem 1.25rem; border-radius: 10px;
  font-weight: 600; font-size: .95rem; border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn { transition: transform .25s ease, box-shadow .25s ease, background .25s ease, filter .25s ease; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 6px 18px -6px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -8px var(--accent-glow); filter: brightness(1.05); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--bg-card); }
.btn-ghost:hover { background: var(--bg-alt); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); transform: translateY(-2px); }

.socials { display: flex; gap: .6rem; margin-top: 1.6rem; }
.socials a {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-muted); background: var(--bg-card);
  transition: color .25s ease, border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.socials a svg { width: 18px; height: 18px; }
.socials a:hover {
  color: var(--accent); border-color: var(--accent); text-decoration: none;
  transform: translateY(-2px); box-shadow: 0 6px 14px -4px var(--accent-glow);
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.2rem; }
  .hero-photo { max-width: 300px; }
}

/* ---------- Stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-top: 3rem; box-shadow: var(--shadow);
}
.stat {
  position: relative;
  background: linear-gradient(165deg, var(--card-top), var(--card-bot));
  padding: 1.45rem 1.5rem;
}
.stat::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0); transform-origin: left;
  transition: transform .4s cubic-bezier(.22,.61,.36,1);
}
.stat:hover::before { transform: scaleX(1); }
.stat b {
  display: block; font-size: 2rem; font-weight: 800; letter-spacing: -0.035em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--accent);
}
.stat span { font-size: .85rem; color: var(--text-muted); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 1.35rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); }

.card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(165deg, var(--card-top), var(--card-bot));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  transition: transform .35s cubic-bezier(.22,.61,.36,1),
              box-shadow .35s ease,
              border-color .35s ease;
}

/* accent hairline across the top, drawn in on hover */
.card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0); transform-origin: left;
  transition: transform .45s cubic-bezier(.22,.61,.36,1);
}

/* soft coloured bloom in the top-right corner */
.card::after {
  content: "";
  position: absolute; top: -55%; right: -35%;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  opacity: 0; pointer-events: none; z-index: -1;
  transition: opacity .45s ease;
}

.card h3 { font-size: 1.16rem; letter-spacing: -0.015em; }
.card p { color: var(--text-muted); font-size: .945rem; margin: 0; }

.card .card-icon {
  display: inline-grid; place-items: center;
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 1.15rem; line-height: 1;
  margin-bottom: 1rem;
  box-shadow: 0 6px 16px -4px var(--accent-glow);
  transition: transform .35s cubic-bezier(.22,.61,.36,1), box-shadow .35s ease;
}
.card-icon svg { width: 22px; height: 22px; display: block; }

/* interactive lift — grid cards only, not the contact form or info panel */
.grid .card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  box-shadow: var(--shadow-lift);
}
.grid .card:hover::before { transform: scaleX(1); }
.grid .card:hover::after { opacity: 1; }
.grid .card:hover .card-icon {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 10px 22px -4px var(--accent-glow);
}

/* ---------- Info list (about) ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 780px) { .about-grid { grid-template-columns: 1fr; gap: 1.8rem; } }

.info-list { list-style: none; margin: 0; padding: 0; }
.info-list.card { padding: .4rem 1.5rem; }
.info-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .68rem 0; border-bottom: 1px solid var(--border); font-size: .94rem;
}
.info-list li:last-child { border-bottom: 0; }
.info-list .k { color: var(--text-muted); }
.info-list .v { font-weight: 550; text-align: right; overflow-wrap: anywhere; }

/* ---------- Skills ---------- */
.skill-group { margin-bottom: 1.8rem; }
.skill-group h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: .8rem; }
.tags { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0; padding: 0; }
.tags li {
  padding: .38rem .82rem; border-radius: 999px; font-size: .86rem; font-weight: 550;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text);
  transition: border-color .25s ease, color .25s ease, background .25s ease;
}
.tags li:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.6rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding-bottom: 2rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-1.6rem - 6px); top: .45rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.timeline .when {
  display: inline-block; font-size: .78rem; font-weight: 650; letter-spacing: .05em;
  color: var(--accent); background: var(--accent-soft);
  padding: .18rem .55rem; border-radius: 6px; margin-bottom: .45rem;
}
.timeline h3 { margin-bottom: .15rem; }
.timeline .where { color: var(--text-muted); font-size: .92rem; margin-bottom: .5rem; }
.timeline ul { margin: .5rem 0 0; padding-left: 1.1rem; color: var(--text-muted); font-size: .93rem; }
.timeline ul li { padding-bottom: .3rem; }
.timeline ul li::before { content: none; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
@media (max-width: 780px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-item {
  display: flex; gap: 1rem; align-items: center;
  padding: 1rem 1.15rem; margin-bottom: .85rem;
  background: linear-gradient(165deg, var(--card-top), var(--card-bot));
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .3s cubic-bezier(.22,.61,.36,1), border-color .3s ease, box-shadow .3s ease;
}
.contact-item:hover {
  transform: translateX(4px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  box-shadow: var(--shadow);
}
.contact-item .card-icon { margin-bottom: 0; flex: none; }
.contact-item .k { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.contact-item .v { font-weight: 600; }

form label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
form input, form textarea {
  width: 100%; padding: .7rem .85rem; margin-bottom: 1rem;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: .95rem;
}
form input:focus, form textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
form textarea { resize: vertical; min-height: 130px; }
.form-note { font-size: .85rem; color: var(--text-muted); margin-top: .8rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); padding: 2rem 0;
  color: var(--text-muted); font-size: .88rem; background: var(--bg);
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card, .card::before, .card::after, .card .card-icon, .stat::before { transition: none; }
  .grid .card:hover { transform: none; }
  .grid .card:hover .card-icon { transform: none; }
  .btn, .socials a, .contact-item { transition: none; }
  .btn-primary:hover, .btn-ghost:hover, .socials a:hover { transform: none; }
  .contact-item:hover { transform: none; }
}

/* ==========================================================================
   Responsive — tablet and phone
   ========================================================================== */

@media (max-width: 1024px) {
  section { padding: 72px 0; }
  .hero { padding: 72px 0 72px; }
}

@media (max-width: 700px) {
  html { scroll-padding-top: 76px; }
  .container { padding: 0 18px; }

  section { padding: 56px 0; }
  .hero { padding: 44px 0 56px; }
  .section-head { margin-bottom: 1.9rem; }

  .hero p.lead { font-size: 1.02rem; }
  .hero-photo { max-width: 260px; border-radius: 16px; }
  .socials { margin-top: 1.3rem; justify-content: center; }

  .stats { margin-top: 2.2rem; }
  .stat { padding: 1.15rem 1.15rem; }
  .stat b { font-size: 1.65rem; }
  .stat span { font-size: .8rem; }

  .grid { gap: 1rem; }
  .card { padding: 1.3rem; }
  .card .card-icon { width: 42px; height: 42px; border-radius: 12px; margin-bottom: .85rem; }
  .card-icon svg { width: 20px; height: 20px; }
  .info-list.card { padding: .3rem 1.3rem; }

  .timeline { padding-left: 1.3rem; }
  .timeline li { padding-bottom: 1.7rem; }
  .timeline li::before { left: calc(-1.3rem - 6px); }
  .timeline ul { padding-left: 1rem; font-size: .9rem; }

  .contact-item { padding: .9rem 1rem; }

  /* 16px keeps iOS Safari from zooming in when a field is focused */
  form input, form textarea { font-size: 16px; }
  form textarea { min-height: 120px; }
}

@media (max-width: 460px) {
  h1 { font-size: 2.1rem; }
  .eyebrow { font-size: .72rem; letter-spacing: .1em; }

  /* buttons go full width so they're easy to hit */
  .actions { gap: .6rem; }
  .actions .btn { flex: 1 1 100%; justify-content: center; }

  .hero-photo { max-width: 100%; aspect-ratio: 1 / 1; }

  .stats { grid-template-columns: 1fr 1fr; }

  /* label above value — long emails no longer fight for the same line */
  .info-list li { flex-direction: column; align-items: flex-start; gap: .1rem; padding: .6rem 0; }
  .info-list .v { text-align: left; }

  .tags li { font-size: .82rem; padding: .34rem .7rem; }
  .site-footer .container { flex-direction: column; }
}
