/* ---------- Base ---------- */
:root {
  --text: #222;
  --muted: #555;
  --accent: #2952a3;
  --rule: #d0d7de;
  --bg: #f5f6f8;
  --paper: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-heading: var(--font);
  --base-size: 14px;
  --resume-pad-v: 0.75in;
  --resume-pad-h: 0.85in;
  --section-gap: 1.25rem;
  --job-gap: 0.9rem;
  --h1-size: 2.25rem;
  --h2-size: 0.85rem;
  --h2-tt: uppercase;
  --h2-weight: 700;
  --h2-letter: 0.5px;
  --h2-rule: 1px solid var(--rule);
  --h2-rule-pad: 0.35rem;
  --tech-col: 220px;
  --link-decoration: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--base-size);
  line-height: 1.5;
}

.resume {
  max-width: 8.5in;
  margin: 2rem auto;
  background: var(--paper);
  padding: var(--resume-pad-v) var(--resume-pad-h);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.header { margin-bottom: 1.5rem; }
.header h1 {
  font-family: var(--font-heading);
  font-size: var(--h1-size);
  margin: 0 0 0.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.contact { margin: 0; color: var(--muted); font-size: 0.9rem; }
.contact a { color: var(--muted); text-decoration: var(--link-decoration); }
.contact a:hover { text-decoration: underline; }
.contact .sep { margin: 0 0.4rem; }

section { margin-bottom: var(--section-gap); }

section > h2 {
  font-family: var(--font-heading);
  font-size: var(--h2-size);
  font-weight: var(--h2-weight);
  text-transform: var(--h2-tt);
  letter-spacing: var(--h2-letter);
  color: var(--accent);
  border-bottom: var(--h2-rule);
  padding-bottom: var(--h2-rule-pad);
  margin: 0 0 0.6rem;
}
section > p { margin: 0; }

.tech {
  display: grid;
  grid-template-columns: var(--tech-col) 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
}
.tech dt { font-weight: 600; }
.tech dd { margin: 0; color: var(--muted); }

.job { margin-bottom: var(--job-gap); }
.job:last-child { margin-bottom: 0; }

.job-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.job-head h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}
.employer { margin: 0.1rem 0 0.35rem; color: var(--muted); font-size: 0.9rem; }
.dates { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

.job ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.job li { margin-bottom: 0.2rem; color: #333; }

/* ---------- Theme bar (lives inside .resume) ---------- */
.theme-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed var(--rule);
}
.theme-bar-buttons { display: flex; gap: 0.2rem; flex-wrap: wrap; }
.theme-bar-buttons button {
  background: transparent;
  border: 1px solid var(--rule);
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.theme-bar-buttons button:hover { color: var(--text); border-color: var(--muted); }
.theme-bar-buttons button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- Contact link in header (replaces email) ---------- */
.contact-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  text-decoration: var(--link-decoration);
}
.contact-link:hover { text-decoration: underline; color: var(--text); }

/* ---------- Contact modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.modal {
  background: #fff;
  color: #222;
  border-radius: 10px;
  padding: 1.5rem 1.75rem 1.75rem;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #222;
  border: none;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
}
.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}
.modal-close:hover { color: #222; }
.modal label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 0.85rem;
}
.modal input, .modal textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid #cfd6dc;
  border-radius: 6px;
  background: #fff;
  color: #222;
}
.modal input:focus, .modal textarea:focus {
  outline: none;
  border-color: #2952a3;
  box-shadow: 0 0 0 3px rgba(41,82,163,0.15);
}
.modal textarea { resize: vertical; min-height: 5rem; }
.modal .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.submit-btn {
  background: #2952a3;
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.submit-btn:hover { filter: brightness(0.92); }
.submit-btn:disabled { opacity: 0.5; cursor: default; }
.form-status { font-size: 0.85rem; color: #555; }
.form-status.success { color: #1e7a3a; }
.form-status.error { color: #b3261e; }

/* ---------- Theme: Modern ---------- */
.theme-modern {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #d97706;
  --rule: #e5e5e5;
  --bg: #fafafa;
  --font: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --h1-size: 2.8rem;
  --h2-size: 1.05rem;
  --h2-tt: none;
  --h2-letter: 0;
  --h2-weight: 800;
  --h2-rule: 4px solid var(--accent);
  --h2-rule-pad: 0.45rem;
  --tech-col: 200px;
}
.theme-modern .header h1 { letter-spacing: -1.5px; font-weight: 800; }
.theme-modern.body-pad .resume { padding: 0.9in 1in; }
.theme-modern .job-head h3 { font-size: 1.1rem; font-weight: 700; }

/* ---------- Theme: Minimal ---------- */
.theme-minimal {
  --text: #222;
  --muted: #555;
  --accent: #222;
  --rule: #ccc;
  --bg: #fff;
  --paper: #fff;
  --font: Georgia, "Times New Roman", serif;
  --h1-size: 2rem;
  --h2-size: 0.8rem;
  --h2-tt: uppercase;
  --h2-letter: 2px;
  --h2-rule: none;
  --h2-rule-pad: 0;
  --tech-col: 200px;
}
.theme-minimal .resume { box-shadow: none; border: 1px solid var(--rule); }
.theme-minimal section > h2 { margin-bottom: 0.4rem; }
.theme-minimal .job-head h3 { font-weight: 600; }

/* ---------- Theme: Compact ---------- */
.theme-compact {
  --base-size: 12px;
  --section-gap: 0.75rem;
  --job-gap: 0.5rem;
  --h1-size: 1.7rem;
  --h2-size: 0.75rem;
  --resume-pad-v: 0.45in;
  --resume-pad-h: 0.6in;
  --tech-col: 180px;
}
.theme-compact { line-height: 1.4; }
.theme-compact .header { margin-bottom: 0.9rem; }
.theme-compact .job ul { margin-top: 0.15rem; }
.theme-compact .job li { margin-bottom: 0.1rem; }
.theme-compact .employer { margin-bottom: 0.2rem; }

/* ---------- Print ---------- */
@media print {
  @page { size: letter; margin: 0.5in; }
  html, body { background: #fff; font-size: 11pt; }
  .resume {
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    max-width: none;
  }
  .no-print { display: none !important; }
  a { color: inherit; text-decoration: none; }
  .job { page-break-inside: avoid; }
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .resume { margin: 0; padding: 1.25rem; }
  .header h1 { font-size: 1.75rem; }
  .tech { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .tech dt { margin-top: 0.4rem; }
  .job-head { flex-direction: column; }
  .dates { font-size: 0.8rem; }
  .theme-bar { flex-wrap: wrap; gap: 0.5rem; }
  .export-btn { margin-left: 0; }
}
