/* ==========================================================================
   Praveen Yadav — portfolio stylesheet
   No external fonts, no CDNs. System font stacks only.
   Theme model: light/dark (prefers-color-scheme + manual override),
   4 accent presets, 2 font pairings — all via data-attributes on <html>,
   persisted in localStorage by js/theme.js.
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { list-style: none; padding: 0; }
img, picture, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- Font pairings ---------- */
:root,
:root[data-font="serif"] {
  --font-heading: ui-serif, Georgia, "Cambria", "Times New Roman", serif;
  --font-body: -apple-system, "Segoe UI", ui-sans-serif, system-ui, Roboto, Helvetica, Arial, sans-serif;
}
:root[data-font="sans"] {
  --font-heading: -apple-system, "Segoe UI", ui-sans-serif, system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-body: -apple-system, "Segoe UI", ui-sans-serif, system-ui, Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Accent presets (light + dark variants) ---------- */
:root {
  --accent-slate-l: #2e5fa3;    --accent-slate-d: #7fa6e0;
  --accent-forest-l: #2f6b4f;   --accent-forest-d: #6fbe94;
  --accent-copper-l: #a35a30;   --accent-copper-d: #e0925f;
  --accent-graphite-l: #4d5563; --accent-graphite-d: #a6aebb;
}

/* ---------- Light tokens (default) ---------- */
:root,
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --surface: #ffffff;
  --text: #14161a;
  --text-muted: #545a66;
  --border: #e2e4e9;
  --border-strong: #c7cbd3;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.06), 0 1px 1px rgba(20, 22, 26, 0.04);
  --accent: var(--accent-slate-l);
  color-scheme: light;
}
:root[data-accent="slate"]    { --accent: var(--accent-slate-l); }
:root[data-accent="forest"]   { --accent: var(--accent-forest-l); }
:root[data-accent="copper"]   { --accent: var(--accent-copper-l); }
:root[data-accent="graphite"] { --accent: var(--accent-graphite-l); }

/* ---------- Dark tokens ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --bg-alt: #171a20;
    --surface: #171a20;
    --text: #e8eaed;
    --text-muted: #a7adb8;
    --border: #2a2f38;
    --border-strong: #3a4049;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.3);
    --accent: var(--accent-slate-d);
    color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-accent="slate"]    { --accent: var(--accent-slate-d); }
  :root:not([data-theme="light"])[data-accent="forest"]   { --accent: var(--accent-forest-d); }
  :root:not([data-theme="light"])[data-accent="copper"]   { --accent: var(--accent-copper-d); }
  :root:not([data-theme="light"])[data-accent="graphite"] { --accent: var(--accent-graphite-d); }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-alt: #171a20;
  --surface: #171a20;
  --text: #e8eaed;
  --text-muted: #a7adb8;
  --border: #2a2f38;
  --border-strong: #3a4049;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.3);
  --accent: var(--accent-slate-d);
  color-scheme: dark;
}
:root[data-theme="dark"][data-accent="slate"]    { --accent: var(--accent-slate-d); }
:root[data-theme="dark"][data-accent="forest"]   { --accent: var(--accent-forest-d); }
:root[data-theme="dark"][data-accent="copper"]   { --accent: var(--accent-copper-d); }
:root[data-theme="dark"][data-accent="graphite"] { --accent: var(--accent-graphite-d); }

/* ---------- Scale ---------- */
:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6.5rem;

  --radius: 8px;
  --radius-lg: 12px;
  --content-width: 46rem;
  --page-width: 76rem;

  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.2rem, 1.13rem + 0.35vw, 1.4rem);
  --step-2:  clamp(1.44rem, 1.32rem + 0.6vw, 1.75rem);
  --step-3:  clamp(1.8rem, 1.6rem + 1vw, 2.3rem);
  --step-4:  clamp(2.2rem, 1.85rem + 1.75vw, 3.2rem);
}

/* ---------- Base ---------- */
html {
  font-family: var(--font-body);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-size: var(--step-0);
  line-height: 1.6;
  transition: background-color 0.15s ease, color 0.15s ease;
}
h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); margin-bottom: var(--space-5); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); margin-top: var(--space-7); margin-bottom: var(--space-3); }
h5 {
  font-size: var(--step-0);
  color: var(--accent);
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}
p  { max-width: 68ch; }
a  { text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:not(.btn):not(.card):not(.nav-link):not(.brand) { color: var(--accent); }

::selection { background: var(--accent); color: var(--bg); }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* ---------- Layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.prose { max-width: var(--content-width); margin-inline: 0; }
section { padding-block: var(--space-8); }
section + section { border-top: 1px solid var(--border); }

/* ---------- Collapsible sections ---------- */
.section-details summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
}
.section-details summary::-webkit-details-marker { display: none; }
.section-details summary::marker { content: ""; }
.section-details .summary-text { flex: 1; min-width: 0; }
.section-details summary h2 { margin-bottom: var(--space-2); }
.section-details[open] summary h2 { margin-bottom: var(--space-5); }
.section-teaser {
  color: var(--text-muted);
  max-width: 68ch;
}
.teaser-more {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  white-space: nowrap;
  margin-left: 0.3em;
}
.section-details[open] .section-teaser { display: none; }
.chevron {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: var(--step-0);
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.section-details:hover .chevron { border-color: var(--accent); color: var(--accent); }
.section-details[open] .chevron { transform: rotate(180deg); }
.details-body { padding-top: var(--space-6); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  background: var(--accent);
  color: var(--bg);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  z-index: 100;
  transition: top 0.15s ease;
  font-weight: 600;
}
.skip-link:focus { top: var(--space-4); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
  gap: var(--space-4);
}
.site-header .brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.site-header .brand:hover { filter: brightness(1.08); }
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.site-nav ul {
  display: flex;
  gap: var(--space-5);
  font-size: var(--step-0);
  font-weight: 600;
}
.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  padding-block: var(--space-3);
  border-bottom: 2px solid transparent;
}
.nav-link:hover, .nav-link:focus-visible { color: var(--text); border-color: var(--accent); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}

/* ---------- Theme switcher control ---------- */
.theme-switcher { position: relative; }
.theme-switcher > button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--step-0);
  font-weight: 600;
  cursor: pointer;
}
.theme-switcher > button:hover { border-color: var(--accent); }
.theme-panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  padding: var(--space-4);
  width: 15rem;
  display: none;
  flex-direction: column;
  gap: var(--space-4);
}
.theme-panel[data-open="true"] { display: flex; }
.theme-panel fieldset { border: 0; padding: 0; }
.theme-panel legend {
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.theme-panel .option-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.swatch {
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  cursor: pointer;
  padding: 0;
}
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.theme-panel .text-option {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  padding: var(--space-2) var(--space-3);
  font-size: var(--step--1);
  cursor: pointer;
}
.theme-panel .text-option[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* ---------- Hero / banner ---------- */
.hero {
  padding-block: var(--space-9) var(--space-8);
  background:
    radial-gradient(60rem 22rem at 15% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    linear-gradient(180deg, var(--bg-alt), var(--bg) 70%);
  border-top: none;
}
.hero .eyebrow {
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}
.hero h1 { margin-bottom: var(--space-3); }
.hero .headline {
  font-size: var(--step-2);
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: var(--space-5);
  max-width: 46ch;
}
.hero .lede { font-size: var(--step-1); max-width: 60ch; margin-bottom: var(--space-6); }
.credential { margin-bottom: var(--space-4); }
.credential a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: var(--space-1) var(--space-4);
}
.credential a:hover { border-color: var(--accent); text-decoration: underline; }
.hero .actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--step--1);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  border: 1.5px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}
#about .section-teaser,
.about-grid p {
  max-width: none;
}
#projects .section-teaser,
#projects .section-intro {
  max-width: none;
}
.about p { margin-bottom: var(--space-4); }
.about p:last-child { margin-bottom: 0; }
.about .opportunities {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-4);
  color: var(--text-muted);
}

/* ---------- Projects ---------- */
.section-intro { max-width: 60ch; color: var(--text-muted); margin-bottom: var(--space-6); }
.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: var(--space-2); }
.card .stack {
  font-size: var(--step--1);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.card .desc { margin-bottom: var(--space-3); }
.card .decision {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--step--1);
}
.card .decision strong { color: var(--accent); }
.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--step--1);
  align-items: center;
}
.card-links a {
  font-weight: 700;
  text-decoration: none;
  color: var(--accent);
}
.card-links a:hover { text-decoration: underline; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.pill.is-muted { font-weight: 600; }
.demo-note {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  font-size: var(--step--1);
  color: var(--text-muted);
}
.demo-note strong { color: var(--text); }
.fine-print {
  margin-top: var(--space-5);
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.8;
}

/* ---------- Experience ---------- */
.timeline { display: flex; flex-direction: column; gap: var(--space-6); }
.role-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.role-header .org { color: var(--text-muted); }
.role-header .dates {
  font-size: var(--step--1);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.role-bullets { display: flex; flex-direction: column; gap: var(--space-2); }
.role-bullets li {
  position: relative;
  padding-left: var(--space-5);
}
.role-bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.65em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.role-detail { margin-top: var(--space-5); }
.role-detail p { margin-bottom: var(--space-4); }
.role-detail .role-bullets { margin-block: var(--space-4); }
.flow-line {
  font-weight: 700;
  color: var(--accent);
  white-space: normal;
}
.pull-quote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-4);
  margin: var(--space-4) 0;
  font-style: italic;
  color: var(--text);
  max-width: none;
}
#experience .role-detail p,
#experience .section-teaser {
  max-width: none;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
.skill-group h3 {
  font-size: var(--step-0);
  margin-bottom: var(--space-3);
}
.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tag {
  font-size: var(--step--1);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

/* ---------- Education ---------- */
.edu-list { display: flex; flex-direction: column; gap: var(--space-3); }
.edu-list li { padding-left: var(--space-5); position: relative; }
.edu-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.65em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Certifications ---------- */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--space-4);
  max-width: 40rem;
}
.cert-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}
a.cert-badge:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.cert-badge img {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
}
.cert-badge.is-plain {
  justify-content: center;
  min-height: 8.5rem;
  color: var(--text-muted);
}
.cert-name { font-weight: 700; font-size: var(--step-0); color: var(--text); }
.cert-issuer { font-size: var(--step--1); color: var(--text-muted); }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  max-width: 32rem;
}
.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
}
.contact-row:hover, .contact-row:focus-visible { border-color: var(--accent); }
.contact-row .label { font-size: var(--step--1); color: var(--text-muted); }
.contact-row .value { font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer {
  padding-block: var(--space-6);
  font-size: var(--step--1);
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (min-width: 700px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
}
@media (min-width: 960px) {
  h1 { font-size: var(--step-4); }
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .site-nav ul { display: none; }
  .nav-toggle { display: inline-flex; }
  .site-nav[data-open="true"] ul {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--space-5);
    gap: var(--space-3);
  }
  .role-header { flex-direction: column; align-items: flex-start; }
}
