/* Amitesh Garg — design tokens
   Two themes: editorial-light (default) + builder-dark.
   Single accent: dark teal #1F5757. */

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:          #FAF8F4;
  --bg-raised:   #FFFFFF;
  --bg-sunken:   #F1EDE5;
  --rule:        #E5E0D5;
  --rule-strong: #C9C2B2;
  --text:        #16161A;
  --text-muted:  #5C5953;
  --text-faint:  #8A8680;
  --accent:      #1F5757;
  --accent-ink:  #FFFFFF;
  --accent-soft: rgba(31,87,87,0.10);
  --selection:   rgba(31,87,87,0.22);

  --f-display: 'Inter Tight', ui-sans-serif, system-ui, sans-serif;
  --f-body:    'Source Serif 4', Georgia, 'Times New Roman', serif;
  --f-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-h1:   clamp(2.25rem, 1.6rem + 2.5vw, 3.5rem);
  --t-h2:   clamp(1.5rem, 1.15rem + 1.4vw, 2.25rem);
  --t-h3:   clamp(1.125rem, 1.0rem + 0.4vw, 1.375rem);
  --t-body: clamp(1rem, 0.96rem + 0.16vw, 1.125rem);
  --t-meta: clamp(0.8125rem, 0.78rem + 0.1vw, 0.875rem);

  --lh-tight: 1.08;
  --lh-snug:  1.25;
  --lh-body:  1.55;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 56px; --s-10: 80px; --s-11: 120px; --s-12: 160px;

  --max-prose: 64ch;
  --max-page:  72rem;

  --r-sm: 4px; --r-md: 8px;
}

:root[data-theme="dark"] {
  --bg:          #0E0E0E;
  --bg-raised:   #161614;
  --bg-sunken:   #0a0a0a;
  --rule:        #24231f;
  --rule-strong: #36342e;
  --text:        #EDEAE3;
  --text-muted:  #8A8680;
  --text-faint:  #5C5953;
  --accent:      #5FA8A0;
  --accent-ink:  #0E0E0E;
  --accent-soft: rgba(95,168,160,0.14);
  --selection:   rgba(95,168,160,0.32);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--selection); }

h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: var(--lh-tight); letter-spacing: -0.02em; margin: 0; color: var(--text); }
h1 { font-size: var(--t-h1); letter-spacing: -0.03em; }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); line-height: var(--lh-snug); letter-spacing: -0.015em; }

p { margin: 0; max-width: var(--max-prose); text-wrap: pretty; }

a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--rule-strong); transition: color .15s, border-color .15s; }
a:hover { color: var(--accent); border-bottom-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s-9) 0; }

.mono   { font-family: var(--f-mono); font-size: var(--t-meta); letter-spacing: 0.01em; }
.muted  { color: var(--text-muted); }
.faint  { color: var(--text-faint); }
.upper  { text-transform: uppercase; letter-spacing: 0.08em; }

.page { width: 100%; max-width: var(--max-page); margin: 0 auto; padding: 0 var(--s-6); container-type: inline-size; }
.prose { max-width: var(--max-prose); }
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-7); }
.row { display: flex; align-items: center; gap: var(--s-4); }

.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--f-display); font-weight: 500;
  font-size: var(--t-body);
  padding: 12px 20px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.btn:hover { background: transparent; color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-ghost {
  background: transparent; color: var(--text); border-color: var(--rule-strong);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

.tag { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; margin-right: 6px; }

/* ── Nav ───────────────────────────────────────────────── */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 32px 0 24px; border-bottom: 1px solid var(--rule); gap: 12px;
}
.nav-brand { border-bottom: 0; font-family: var(--f-display); font-weight: 600; letter-spacing: -0.01em; font-size: 18px; }
.nav-links { display: flex; align-items: center; gap: clamp(12px, 2vw, 24px); font-family: var(--f-display); font-size: 15px; flex-wrap: wrap; }
.nav-links a { border-bottom: 0; color: var(--text-muted); }
.nav-links a:hover { color: var(--accent); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 4px;
  background: transparent; color: var(--text);
  border: 1px solid var(--rule-strong); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.linkedin-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 4px;
  background: transparent; color: var(--text);
  border: 1px solid var(--rule-strong);
  font-size: 14px; font-family: var(--f-display); font-weight: 500;
}
.linkedin-btn:hover { border-color: var(--accent); color: var(--accent); }

.nav-mobile-toggle, .nav-mobile, .nav-mobile-controls { display: none; }

@media (max-width: 760px) {
  .nav { padding: 18px 0 14px; }
  .nav-links.desktop { display: none; }
  .nav-mobile-toggle { display: inline-flex; }
  .nav-mobile-controls { display: flex; align-items: center; gap: 8px; }
  .nav-mobile.open { display: grid; gap: 2px; padding: 8px 0 18px; border-top: 1px solid var(--rule); }
  .nav-mobile a { border-bottom: 0; color: var(--text); padding: 12px 4px; font-family: var(--f-display); font-size: 17px; }
  .nav-mobile a.linkedin { color: var(--text-muted); font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
}

/* ── Email popover ─────────────────────────────────────── */
.email-pop-wrap { position: relative; display: inline-block; }
.email-pop {
  position: absolute; top: calc(100% + 8px); left: 0;
  display: none; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--rule-strong);
  font-family: var(--f-mono); font-size: 14px;
  white-space: nowrap; z-index: 20;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}
.email-pop.open { display: inline-flex; }
.email-pop .addr { color: var(--text); border-bottom: 0; }
.email-pop .copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 4px;
  background: transparent; color: var(--text);
  border: 1px solid var(--rule-strong); cursor: pointer;
  font-family: var(--f-display); font-size: 13px; font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.email-pop .copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.email-pop .copy-btn.copied { border-color: var(--accent); color: var(--accent-ink); background: var(--accent); }

/* ── Hero ──────────────────────────────────────────────── */
.hero { padding: 80px 0 96px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 32%, 380px); gap: 64px; align-items: center; }
.hero-meta { font-family: var(--f-mono); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; margin-bottom: 12px; }
.hero h1 span.muted-line { color: var(--text-muted); }
.hero p.lede { font-size: calc(var(--t-body) * 1.1); color: var(--text); margin-top: 20px; line-height: 1.55; }
.hero p.sub { margin-top: 16px; color: var(--text-muted); }
.hero-ctas { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.hero-portrait { width: 100%; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 6px; border: 1px solid var(--rule-strong); }
.hero-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 55% 25%; display: block; }
.hero-mobile-strip { display: none; }

@media (max-width: 760px) {
  .hero { padding: 24px 0 36px; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero-portrait { display: none; }
  .hero-mobile-strip { display: flex; align-items: center; gap: 14px; }
  .hero-mobile-strip img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 55% 30%; border: 1px solid var(--rule-strong); flex: 0 0 auto; }
  .hero-mobile-strip .meta-block { font-family: var(--f-mono); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; line-height: 1.5; }
  .hero-meta { display: none; }
  .hero p.lede { font-size: var(--t-body); margin-top: 16px; }
  .hero p.sub { margin-top: 12px; }
  .hero-ctas { margin-top: 20px; }
}

/* ── Section heads ─────────────────────────────────────── */
section { padding: 24px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ── Now list ──────────────────────────────────────────── */
.now-list { list-style: none; padding: 0; margin: 8px 0 0; max-width: var(--max-prose); }
.now-list li { display: flex; gap: 14px; color: var(--text); margin-top: 16px; }
.now-list li:first-child { margin-top: 0; }
.now-list .bullet { font-family: var(--f-mono); color: var(--text-faint); flex: 0 0 auto; padding-top: 4px; font-size: 12px; }

/* ── Work rows ─────────────────────────────────────────── */
.work-list { margin-top: 8px; border-bottom: 1px solid var(--rule); }
.work-row {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 20px 0;
  border-top: 1px solid var(--rule); border-bottom: 0; color: var(--text);
  align-items: baseline;
}
.work-row .head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.work-row .name { font-family: var(--f-mono); font-size: 15px; color: var(--text); overflow-wrap: anywhere; word-break: break-word; }
.work-row .url-pill { font-family: var(--f-mono); color: var(--text-faint); font-size: 11px; overflow-wrap: anywhere; }
.work-row .role { font-family: var(--f-mono); color: var(--text-faint); font-size: 11px; }
.work-row .desc { margin: 6px 0 0; color: var(--text-muted); font-size: calc(var(--t-body) * 0.96); }
.work-row .tags { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.work-row .meta-right { text-align: right; flex: 0 0 auto; }
.work-row .meta-right .year { font-family: var(--f-mono); color: var(--text-faint); font-size: 12px; }
.work-row .meta-right .arrow { display: inline-block; margin-top: 6px; color: var(--text-faint); transition: transform .15s; }
.work-row:hover .arrow { transform: translateX(3px); color: var(--accent); }
.work-row:hover .name { color: var(--accent); }

/* ── Meta rows (Skills, Experience, Education) ─────────── */
.meta-row { display: grid; grid-template-columns: minmax(0, 180px) minmax(0, 1fr); gap: 24px; align-items: baseline; padding: 24px 0; border-top: 1px solid var(--rule); }
.meta-row.tight { padding: 16px 0; border-top: 0; border-bottom: 1px solid var(--rule); }
.meta-row .col-left { display: flex; flex-direction: column; gap: 4px; }
.meta-row .dates { font-family: var(--f-mono); font-size: 13px; color: var(--text); }
.meta-row .loc { font-family: var(--f-mono); color: var(--text-faint); font-size: 12px; }
.meta-row .role-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.meta-row .role-line .role { font-family: var(--f-display); font-weight: 600; font-size: calc(var(--t-body) * 1.05); }
.meta-row .role-line .co { font-family: var(--f-mono); font-size: 14px; color: var(--text); }
.meta-row .notes { list-style: none; padding: 0; margin: 10px 0 0; }
.meta-row .notes li { display: flex; gap: 12px; padding: 4px 0; color: var(--text-muted); }
.meta-row .notes li .bullet { font-family: var(--f-mono); color: var(--text-faint); font-size: 12px; padding-top: 4px; }

@container (max-width: 560px) {
  .meta-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 560px) {
  .meta-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

.work-list-wrap { border-top: 0; }
.exp-wrap { margin-top: 4px; border-bottom: 1px solid var(--rule); }
.edu-wrap { margin-top: 4px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.skills-wrap { margin-top: 4px; border-top: 1px solid var(--rule); }

.cert-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.cert-list li { display: flex; gap: 12px; color: var(--text-muted); }
.cert-list li .bullet { font-family: var(--f-mono); color: var(--text-faint); font-size: 12px; padding-top: 4px; }

/* ── Writing form ──────────────────────────────────────── */
.writing-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.writing-form input {
  flex: 1 1 220px; min-width: 0; padding: 12px 14px;
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--rule-strong); border-radius: var(--r-sm);
  font-family: var(--f-mono); font-size: 14px;
}

/* ── Contact ───────────────────────────────────────────── */
.contact-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 10px 24px; align-items: baseline; max-width: 560px;
}
.contact-list .label { font-family: var(--f-mono); color: var(--text-faint); font-size: 13px; }

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--rule); margin-top: 64px; padding: 28px 0 40px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.site-footer span { font-family: var(--f-mono); color: var(--text-faint); font-size: 12px; }

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Visually-hidden but readable to crawlers + screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Skip link for a11y */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  padding: 8px 12px; background: var(--accent); color: var(--accent-ink);
  border-radius: 4px; z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }
