/* ==========================================================================
   mjl.ee — Gruvbox Typography & Design System (Framework-Free)
   ========================================================================== */

:root {
  /* Gruvbox Light (Default Palette) */
  --bg-primary: #fbf1c7;
  --bg-secondary: #f2e5bc;
  --bg-surface: #ebdbb2;
  --bg-highlight: #d5c4a1;

  --text-primary: #3c3836;
  --text-secondary: #504945;
  --text-muted: #7c6f64;
  --text-dim: #928374;

  --accent-gold: #b57614;
  --accent-green: #79740e;
  --accent-aqua: #427b58;
  --accent-blue: #076678;
  --accent-orange: #af3a03;
  --accent-purple: #8f3f71;
  --accent-red: #9d0006;

  --border-color: #d5c4a1;
  --border-subtle: #ebdbb2;
  --link-color: #076678;
  --link-hover: #b57614;

  --font-mono: ui-monospace, "SF Mono", "Fira Code", "JetBrains Mono", Menlo, Consolas, "Cutive Mono", monospace;
  --content-width: clamp(860px, 74vw, 1200px);
  --fluid-pad: clamp(1.25rem, 3.5vw, 3rem);
  --font-size-base: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);

  /* Spacing Scale Tokens */
  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* UI Shape & Motion Tokens */
  --radius-sm: 3px;
  --radius-md: 4px;
  --transition-fast: 0.15s ease;

  /* CV Component Layout Tokens */
  --skills-col-width: 200px;
  --skills-col-gap: 1.75rem;
  --skills-row-gap: 0.75rem;
}

/* System Dark Mode preference when no manual override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #282828;
    --bg-secondary: #32302f;
    --bg-surface: #3c3836;
    --bg-highlight: #504945;

    --text-primary: #ebdbb2;
    --text-secondary: #d5c4a1;
    --text-muted: #a89984;
    --text-dim: #928374;

    --accent-gold: #fabd2f;
    --accent-green: #b8bb26;
    --accent-aqua: #8ec07c;
    --accent-blue: #83a598;
    --accent-orange: #fe8019;
    --accent-purple: #d3869b;
    --accent-red: #fb4934;

    --border-color: #504945;
    --border-subtle: #3c3836;
    --link-color: #83a598;
    --link-hover: #fabd2f;
  }
}

/* Manual Dark Override */
html[data-theme="dark"] {
  --bg-primary: #282828;
  --bg-secondary: #32302f;
  --bg-surface: #3c3836;
  --bg-highlight: #504945;

  --text-primary: #ebdbb2;
  --text-secondary: #d5c4a1;
  --text-muted: #a89984;
  --text-dim: #928374;

  --accent-gold: #fabd2f;
  --accent-green: #b8bb26;
  --accent-aqua: #8ec07c;
  --accent-blue: #83a598;
  --accent-orange: #fe8019;
  --accent-purple: #d3869b;
  --accent-red: #fb4934;

  --border-color: #504945;
  --border-subtle: #3c3836;
  --link-color: #83a598;
  --link-hover: #fabd2f;
}

/* Manual Light Override */
html[data-theme="light"] {
  --bg-primary: #fbf1c7;
  --bg-secondary: #f2e5bc;
  --bg-surface: #ebdbb2;
  --bg-highlight: #d5c4a1;

  --text-primary: #3c3836;
  --text-secondary: #504945;
  --text-muted: #7c6f64;
  --text-dim: #928374;

  --accent-gold: #b57614;
  --accent-green: #79740e;
  --accent-aqua: #427b58;
  --accent-blue: #076678;
  --accent-orange: #af3a03;
  --accent-purple: #8f3f71;
  --accent-red: #9d0006;

  --border-color: #d5c4a1;
  --border-subtle: #ebdbb2;
  --link-color: #076678;
  --link-hover: #b57614;
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  line-height: 1.65;
  letter-spacing: normal;
  overflow-y: scroll;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* Layout Container */
.site-main {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--fluid-pad);
  flex-grow: 1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.3;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  font-weight: 700;
}

h1 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2.1rem); margin-top: 0; }
h2 { font-size: clamp(1.25rem, 1.15rem + 0.6vw, 1.6rem); border-bottom: 1px dashed var(--border-color); padding-bottom: 0.3rem; }
h3 { font-size: clamp(1.1rem, 1.05rem + 0.3vw, 1.3rem); }

p {
  margin: 0 0 1.2em 0;
}

a {
  color: var(--link-color);
  text-decoration: underline 1px var(--border-color);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}

hr {
  border: 0;
  border-top: 1px dashed var(--border-color);
  margin: var(--space-xl) 0;
}

ul, ol {
  margin: 0 0 1.2em 0;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.4em;
}

code, pre {
  font-family: var(--font-mono);
}

code {
  background-color: var(--bg-secondary);
  color: var(--accent-orange);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

pre {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1.2em 0;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
}

blockquote {
  border-left: 3px solid var(--accent-gold);
  margin: 1.2em 0;
  padding: 0.5em var(--space-md);
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
}

/* Navbar */
.site-header {
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-bar {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-sm) var(--fluid-pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.base-nav-home {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent-orange);
  text-decoration: none;
}

.base-nav-home:hover {
  color: var(--accent-gold);
}

.base-nav-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.25rem;
}

.base-nav-list li {
  margin: 0;
}

.base-nav-list a {
  color: var(--text-secondary);
  text-decoration: none;
}

.base-nav-list a:hover {
  color: var(--accent-gold);
}

.nav-active-link a {
  color: var(--accent-gold);
  font-weight: 700;
  border-bottom: 2px solid var(--accent-gold);
}

.theme-toggle-btn {
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  line-height: 1;
}

.theme-toggle-btn #theme-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-toggle-btn:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background-color: var(--bg-surface);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  margin-top: auto;
}

.footer-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.25rem var(--fluid-pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-content a {
  color: var(--text-muted);
}

.footer-content a:hover {
  color: var(--accent-gold);
}

/* Helpers */
.separate {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Homepage Hero */
.home-hero {
  margin-bottom: var(--space-xl);
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: var(--space-lg);
}

.home-title {
  color: var(--accent-orange);
  margin-bottom: 0.2rem;
}

.home-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 0;
}

.markdown-body ul {
  list-style-type: square;
}

/* ==========================================================================
   CV / Resume Customizer & Styles
   ========================================================================== */

.cv-page {
  width: 100%;
}

.cv-toolbar {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: var(--space-md) 1.25rem;
  margin-bottom: 2.5rem;
}

.cv-toolbar-header {
  margin-bottom: 0.85rem;
}

.cv-toolbar-title strong {
  display: block;
  color: var(--accent-gold);
  font-size: 1.05rem;
}

.cv-toolbar-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cv-toolbar-controls {
  padding-top: var(--space-sm);
  border-top: 1px dashed var(--border-color);
  align-items: center;
}

.cv-presets-group {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.cv-control-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cv-pill-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cv-pill-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.cv-pill-btn.active {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-primary);
  font-weight: 700;
}

.cv-btn-primary {
  background-color: var(--accent-green);
  border: 1px solid var(--accent-green);
  color: var(--bg-primary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.cv-btn-primary:hover {
  opacity: 0.9;
}

.cv-estimate-badge {
  background-color: var(--bg-surface);
  color: var(--accent-aqua);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.cv-toggle-dimmed-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Resume Document View */
.cv-header {
  margin-bottom: var(--space-xl);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 1.25rem;
}

.cv-name {
  font-size: clamp(1.8rem, 1.5rem + 1vw, 2.4rem);
  color: var(--text-primary);
  margin: 0 0 0.15rem 0;
  letter-spacing: -0.5px;
}

.cv-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0 0 0.6rem 0;
}

.cv-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.cv-contact-link {
  color: var(--link-color);
}

.cv-sep {
  color: var(--border-color);
}

.cv-section {
  margin-bottom: var(--space-xl);
}

.cv-section-title {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
  margin-top: var(--space-lg);
  margin-bottom: 1.25rem;
}

.cv-entry {
  margin-bottom: 1.75rem;
  transition: opacity var(--transition-fast);
}

.cv-entry-header {
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.cv-entry-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.cv-job-title {
  font-weight: 700;
  color: var(--text-primary);
}

.cv-company-link,
.cv-company-name {
  color: var(--accent-blue);
  font-weight: 600;
}

.cv-at-sep {
  color: var(--text-muted);
}

.cv-date-wrap {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.cv-control-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin-right: 0.2rem;
}

.cv-control-checkbox input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent-gold);
  width: 14px;
  height: 14px;
  margin: 0;
}

.cv-bullet-list {
  list-style: none;
  padding-left: 0;
  margin: 0.35rem 0 0 0;
}

.cv-bullet-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
  font-size: 0.94rem;
  line-height: 1.55;
  transition: opacity var(--transition-fast);
}

.cv-bullet-text {
  flex-grow: 1;
}

/* Excluded Bullet, Entry & Skill Dimming */
.cv-excluded,
.cv-excluded .cv-bullet-text,
.cv-skill-category-row.cv-excluded .cv-skill-name-wrap,
.cv-skill-category-row.cv-excluded .cv-skill-category-items {
  opacity: 0.58;
  text-decoration: line-through;
  color: var(--text-dim);
}

.cv-excluded a {
  pointer-events: none;
}

/* When the user checks "Hide excluded items" */
.cv-hide-excluded-screen .cv-excluded {
  display: none !important;
}

/* Technical Skills Categorized Layout */
.cv-skills-wrap {
  display: grid;
  grid-template-columns: var(--skills-col-width) 1fr;
  row-gap: var(--skills-row-gap);
  column-gap: var(--skills-col-gap);
  align-items: baseline;
  margin-top: var(--space-xs);
}

.cv-skill-category-row {
  display: contents;
}

.cv-skill-name-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  max-width: var(--skills-col-width);
}

.cv-skill-category-name {
  color: var(--accent-gold);
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  word-break: normal;
}

.cv-skill-category-items {
  color: var(--text-primary);
  line-height: 1.6;
}

@media (max-width: 700px) {
  .cv-skills-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }
  .cv-skill-category-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }
  .cv-skill-name-wrap {
    max-width: 100%;
  }
}

.print-only {
  display: none !important;
}

.cv-print-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-sm);
  padding: 0.45rem var(--space-sm);
  background-color: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
  line-height: 1.45;
}

.cv-pill-btn[disabled] {
  opacity: 0.65;
  cursor: default;
}

/* ==========================================================================
   PRINT STYLESHEET — Elite ATS & PDF Resume Export
   ========================================================================== */

/* Universal Page Margin Rule for Standard Letter Paper */
@page {
  size: letter portrait;
  margin: 0.5in;
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.5in;
  }

  /* Universal high-contrast executive typography */
  html, body,
  .cv-page,
  .cv-header,
  .cv-name,
  .cv-contact-row,
  .cv-section,
  .cv-section-title,
  .cv-entry,
  .cv-job-title,
  .cv-company-link,
  .cv-company-name,
  .cv-date-wrap,
  .cv-bullet-list,
  .cv-bullet-item,
  .cv-bullet-text,
  .cv-skills-wrap,
  .cv-skill-category-row,
  .cv-skill-name-wrap,
  .cv-skill-category-name,
  .cv-skill-category-items {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  }

  /* Base Document Ink Contrast & Legible Sizing */
  html, body {
    background: #ffffff !important;
    color: #111111 !important;
    font-size: 10.2pt !important;
    line-height: 1.44 !important;
    letter-spacing: normal !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
    overflow: visible !important;
  }

  .site-main {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
  }

  .cv-page {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide screen-only interactive controls and navigation */
  .screen-only,
  .site-header,
  .site-footer,
  .cv-toolbar,
  .cv-control-checkbox,
  .checkbox-indicator,
  #theme-toggle {
    display: none !important;
  }

  .print-only {
    display: inline !important;
  }

  /* Centered Executive Header */
  .cv-header {
    text-align: center !important;
    margin-bottom: 0.5rem !important;
    border-bottom: 1.2pt solid #111111 !important;
    padding-bottom: 0.32rem !important;
  }

  .cv-name {
    font-size: 20pt !important;
    font-weight: 700 !important;
    color: #000000 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.75px !important;
    margin: 0 0 0.16rem 0 !important;
    text-align: center !important;
  }

  .cv-subtitle {
    display: none !important;
  }

  .cv-contact-row {
    font-size: 9.6pt !important;
    color: #222222 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.45rem !important;
    margin: 0 !important;
  }

  .cv-contact-link {
    color: #111111 !important;
    text-decoration: none !important;
  }

  .cv-sep {
    color: #666666 !important;
  }

  /* Sections */
  .cv-section {
    margin-bottom: 0.52rem !important;
  }

  .cv-section-title {
    font-size: 11pt !important;
    color: #000000 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.75px !important;
    border-bottom: 0.75pt solid #111111 !important;
    padding-bottom: 0.1rem !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.28rem !important;
  }

  /* Job Entries */
  .cv-entry {
    margin-bottom: 0.48rem !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cv-entry-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    margin-bottom: 0.08rem !important;
  }

  .cv-entry-title-wrap {
    display: flex !important;
    align-items: baseline !important;
    gap: 0.35rem !important;
    font-size: 10.5pt !important;
  }

  .cv-job-title {
    font-size: 10.5pt !important;
    font-weight: 700 !important;
    color: #000000 !important;
  }

  .cv-company-link,
  .cv-company-name {
    font-size: 10.5pt !important;
    color: #111111 !important;
    font-weight: 600 !important;
    text-decoration: none !important;
  }

  .cv-at-sep {
    color: #555555 !important;
  }

  .cv-date-wrap {
    font-size: 9.4pt !important;
    font-weight: 500 !important;
    color: #333333 !important;
    white-space: nowrap !important;
    text-align: right !important;
  }

  /* Bullets */
  .cv-bullet-list {
    margin: 0.08rem 0 0 0 !important;
    padding-left: 1.25rem !important;
    list-style-type: disc !important;
  }

  .cv-bullet-item {
    display: list-item !important;
    font-size: 10pt !important;
    line-height: 1.44 !important;
    margin-bottom: 0.22rem !important;
    color: #111111 !important;
  }

  .cv-bullet-text {
    display: inline !important;
  }

  /* Categorized Technical Skills in Print */
  .cv-skills-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.22rem !important;
    margin-top: 0.15rem !important;
  }

  .cv-skill-category-row {
    display: flex !important;
    align-items: baseline !important;
    gap: 0.85rem !important;
    font-size: 10pt !important;
    line-height: 1.44 !important;
    margin-bottom: 0.15rem !important;
  }

  .cv-skill-name-wrap {
    display: block !important;
    width: 175px !important;
    min-width: 175px !important;
    flex-shrink: 0 !important;
  }

  .cv-skill-category-name {
    font-weight: 700 !important;
    color: #000000 !important;
    line-height: 1.25 !important;
    white-space: normal !important;
  }

  .cv-skill-category-items {
    color: #111111 !important;
    flex-grow: 1 !important;
    line-height: 1.44 !important;
  }

  /* Clean links */
  a {
    color: inherit !important;
    text-decoration: none !important;
  }

  /* Direct print hiding for excluded or unchecked elements */
  .cv-bullet-item:has(input:not(:checked)),
  .cv-entry:has(> header input.entry-toggle:not(:checked)),
  .cv-skill-category-row:has(input.skill-toggle:not(:checked)),
  .cv-bullet-item[data-print-hidden="true"],
  .cv-entry[data-print-hidden="true"],
  .cv-skill-category-row[data-print-hidden="true"],
  .cv-entry.cv-excluded,
  .cv-bullet-item.cv-excluded,
  .cv-skill-category-row.cv-excluded,
  li.cv-bullet-item.cv-excluded,
  div.cv-entry.cv-excluded,
  .cv-excluded,
  [data-print-hidden="true"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }
}