/* ═══════════════════════════════════════════════════════════════════════
   Aaditya Agarwal — Portfolio Stylesheet
   Inspired by darioamodei.com
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Design tokens ─────────────────────────────────────────────────── */
:root {
  --bg:         #fafaf8;
  --text:       #1a1a18;
  --muted:      #6b6b66;
  --link:       #1a1a18;
  --link-hover: #4a4a45;
  --border:     #e8e8e3;
  --accent:     #2a2a27;
  --sel:        rgba(30, 80, 200, 0.18);
}
[data-theme="dark"] {
  --bg:         #111110;
  --text:       #e8e8e3;
  --muted:      #7a7a75;
  --link:       #e8e8e3;
  --link-hover: #b8b8b3;
  --border:     #2a2a27;
  --accent:     #c8c8c3;
  --sel:        rgba(100, 160, 255, 0.2);
}

/* ─── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: var(--sel); color: inherit; }

/* ─── Base ──────────────────────────────────────────────────────────── */
html { font-size: 17px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Layout ────────────────────────────────────────────────────────── */
.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 80px 28px 140px;
}

/* ─── Page entrance ─────────────────────────────────────────────────── */
.page-content {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 0.5s ease 0.08s forwards;
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Header ────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 52px;
}
.site-name {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.15s;
}
.site-name:hover { color: var(--muted); }

/* ─── Toggle ────────────────────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  user-select: none;
}
.toggle-icon { font-size: 11px; color: var(--muted); line-height: 1; }
.toggle-checkbox { display: none; }
.toggle-label {
  position: relative;
  display: inline-block;
  width: 36px; height: 20px;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-label::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s;
}
.toggle-checkbox:checked + .toggle-label { background: var(--accent); }
.toggle-checkbox:checked + .toggle-label::before {
  transform: translateX(16px);
  background: var(--bg);
}

/* ─── Bio ───────────────────────────────────────────────────────────── */
.bio {
  font-size: 16.5px;
  color: var(--text);
  line-height: 1.78;
  margin-bottom: 56px;
}
.bio p + p { margin-top: 16px; }
.bio a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: text-decoration-color 0.15s;
}
.bio a:hover { text-decoration-color: var(--muted); }

/* ─── Social links ──────────────────────────────────────────────────── */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 64px;
}
.links a {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  transition: color 0.15s;
}
.links a:hover { color: var(--text); }
.links svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ─── Sections ──────────────────────────────────────────────────────── */
section { margin-bottom: 0; }
.section-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 22px;
}
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 52px 0;
}

/* ─── Bullet list ───────────────────────────────────────────────────── */
.bullet-list { list-style: none; }
.bullet-list li {
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
}
.bullet-list li::before {
  content: '\2022';
  color: var(--muted);
  font-size: 0.9em;
  margin-right: 0.65em;
  flex-shrink: 0;
}
.bullet-list a {
  color: var(--link);
  text-decoration: none;
  font-size: 16px;
  font-weight: 400;
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
  transition: color 0.15s, border-color 0.15s;
}
.bullet-list a:hover {
  color: var(--link-hover);
  border-color: var(--muted);
}
.bullet-list .meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: 6px;
  white-space: nowrap;
}

/* ─── Experience ────────────────────────────────────────────────────── */
.experience-item { margin-bottom: 36px; }
.experience-item:last-child { margin-bottom: 0; }
.exp-company { font-size: 15.5px; font-weight: 500; color: var(--text); }
.exp-role { font-size: 14px; color: var(--muted); margin-top: 1px; }
.exp-date {
  font-size: 12.5px; color: var(--muted);
  margin-top: 2px; font-variant-numeric: tabular-nums;
}
.exp-bullets { list-style: none; margin-top: 12px; }
.exp-bullets li {
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
  padding-left: 1.4em;
  position: relative;
  margin-bottom: 9px;
}
.exp-bullets li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--muted);
  font-size: 0.85em;
  top: 0.12em;
}
.exp-bullets strong { font-weight: 500; }

/* ─── Projects ──────────────────────────────────────────────────────── */
.project { margin-bottom: 30px; }
.project:last-child { margin-bottom: 0; }
.project-name { font-size: 15.5px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.project-tech { font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.project-desc { font-size: 14.5px; color: var(--muted); line-height: 1.7; }
.project-links { margin-top: 8px; display: flex; gap: 16px; flex-wrap: wrap; }
.project-links a {
  font-size: 13px; color: var(--muted); text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.project-links a:hover { color: var(--text); border-color: var(--muted); }

/* ─── Essay page ────────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  background: none; border: none; padding: 0;
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  margin-bottom: 48px;
  text-decoration: none;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--text); }
.back-btn svg { width: 13px; height: 13px; }
.essay-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.4px;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 6px;
  text-wrap: balance;
}
.essay-date { font-size: 13px; color: var(--muted); margin-bottom: 48px; }
.essay-body {
  font-size: 17px; line-height: 1.82;
  color: var(--text);
  font-family: 'Lora', Georgia, serif;
}
.essay-body p { margin-bottom: 24px; }
.essay-body p:last-child { margin-bottom: 0; }
.essay-body h3 {
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 48px 0 18px;
}
.essay-body blockquote {
  border-left: 2px solid var(--border);
  padding: 2px 0 2px 22px;
  color: var(--muted);
  margin: 32px 0;
  font-style: italic;
}
.essay-body strong { font-weight: 600; font-style: normal; color: var(--text); }

/* ─── Transition overlay ────────────────────────────────────────────── */
.transition-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
  overflow: hidden;
}
.transition-circle {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  transform-origin: center center;
}
.transition-circle.expanding {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.15, 1);
  transform: scale(1);
}
/* Reveal = starts at scale(1), shrinks to scale(0) */
.transition-circle.contracting {
  transform: scale(1);
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.transition-circle.contracting.go {
  transform: scale(0);
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .container { padding: 52px 20px 100px; }
  .essay-title { font-size: 23px; }
  .site-header { margin-bottom: 40px; }
  .bio { margin-bottom: 44px; }
  .links { gap: 16px; margin-bottom: 48px; }
}

/* ─── Theme colour crossfade ─────────────────────────────────────────
   Scoped to real elements (not *) so it doesn't fight the page-content
   entrance animation or the circle-overlay's transform transition.     */
body, .site-name, .bio, .bio p, .bio a,
.links a, .bullet-list a, .bullet-list li::before, .bullet-list .meta,
.exp-company, .exp-role, .exp-date, .exp-bullets li, .exp-bullets li::before,
.project-name, .project-tech, .project-desc, .project-links a,
.section-title, .section-divider, .back-btn, .essay-title, .essay-date,
.essay-body, .essay-body blockquote, .essay-body h3,
.toggle-label, .toggle-label::before {
  transition: background-color 0.22s ease, border-color 0.22s ease,
              color 0.22s ease;
}

/* ─── Water-drop theme transition (View Transitions API) ────────────── */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(root) { animation: none !important; }
}

/* Disable CSS transitions during View Transitions to prevent lag/glitches */
html.is-view-transitioning *,
html.is-view-transitioning *::before,
html.is-view-transitioning *::after {
  transition: none !important;
}
