/* style.css */
:root {
  color-scheme: light dark; /* This is the key line that enables native switching */
  --bg-color: #ffffff;
  --text-color: #333333;
  --heading-color: #111111;
  --meta-color: #666666;
  --border-color: #eaeaea;
  --link-color: #0056b3;
  --link-hover: #003d82;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --heading-color: #ffffff;
    --meta-color: #aaaaaa;
    --border-color: #333333;
    --link-color: #66b3ff;
    --link-hover: #99ccff;
  }
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  margin: 0;
  padding: 0 20px;
  transition: background-color 0.3s ease, color 0.3s ease; /* Smooth fade on toggle */
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 0;
}

.masthead {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.masthead h1 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--heading-color);
}

.masthead h1 a {
  color: inherit;
}

.masthead nav a {
  margin-left: 20px;
  font-weight: 500;
}

.masthead nav a:hover {
  text-decoration: none;
}

.masthead nav a.active,
.masthead nav a.active:hover,
.masthead nav a.active:focus {
  border-bottom: 2px solid var(--heading-color);
  color: var(--heading-color);
  padding-bottom: 4px;
  text-decoration: none;
}

html {
  scroll-behavior: smooth;
}

h2 {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--heading-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
  margin-top: 44px;
  margin-bottom: 20px;
}

section {
  scroll-margin-top: 24px;
}

.item {
  margin-bottom: 24px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.item-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--heading-color);
}

.item-meta {
  color: var(--meta-color);
  font-size: 0.95rem;
}

.item-desc {
  margin: 4px 0 0 0;
}

/* Compact sections (Education, Awards, Certifications, Memberships, Service):
   tighter spacing, lighter title weight to fit single-line entries. */
.compact .item {
  margin-bottom: 8px;
}
.compact .item:has(.item-desc) {
  margin-bottom: 14px;
}
.compact .item-title {
  font-weight: 500;
  font-size: 1rem;
}

/* Left-rail date column at ≥640px.
   Items without an .item-meta keep the default block layout. */
@media (min-width: 640px) {
  .item:has(.item-meta) {
    display: grid;
    grid-template-columns: 110px 1fr;
    column-gap: 24px;
    align-items: baseline;
  }
  .item:has(.item-meta) .item-header {
    display: contents;
  }
  .item:has(.item-meta) .item-meta {
    grid-column: 1;
    grid-row: 1;
    text-align: left;
    font-variant-numeric: tabular-nums;
  }
  .item:has(.item-meta) .item-title {
    grid-column: 2;
    grid-row: 1;
  }
  .item:has(.item-meta) > :not(.item-header) {
    grid-column: 2;
  }
}

ul {
  padding-left: 20px;
  margin-top: 8px;
  margin-bottom: 0;
}

li {
  margin-bottom: 6px;
}

.downloads {
  text-align: right;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.downloads a {
  margin-left: 10px;
}

a.ext::after {
  content: " ↗";
  font-size: 0.8em;
  color: var(--meta-color);
  margin-left: 1px;
}

/* Publication citations: regular weight, sit in the right column of the rail. */
.publications .item-title {
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.5;
}

.publications .footnote {
  color: var(--meta-color);
  font-size: 0.9rem;
  margin-top: 20px;
  font-style: italic;
}

.site-footer {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 0 40px;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--meta-color);
}

/* Sticky section nav — only on wide viewports.
   Sits to the left of the content column, fades into the page. */
.section-nav {
  display: none;
}

@media (min-width: 1180px) {
  .section-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 140px;
    left: max(24px, calc(50% - 560px));
    width: 130px;
    gap: 8px;
    font-size: 0.85rem;
    line-height: 1.3;
  }
  .section-nav a {
    color: var(--meta-color);
    text-decoration: none;
    transition: color 0.15s ease;
  }
  .section-nav a:hover {
    color: var(--heading-color);
    text-decoration: none;
  }
}

/* Artifact subheadings on fpga-vhdl page — quieter than h2 but visually grouping. */
.artifact-group {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--heading-color);
  margin-top: 28px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Subsection headings inside a section. Quieter than h2, distinct from item-title. */
h3.sub {
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading-color);
  margin: 28px 0 10px;
}

/* Competency lists: dense, two-column on wider viewports. */
ul.competencies {
  padding-left: 20px;
  margin: 6px 0 0;
  font-size: 0.95rem;
}
ul.competencies li {
  margin-bottom: 3px;
  break-inside: avoid;
}
@media (min-width: 640px) {
  ul.competencies {
    column-count: 2;
    column-gap: 40px;
  }
}

/* Program blocks in Selected Systems Programs. */
.program {
  margin-bottom: 36px;
}
.program h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--heading-color);
  margin: 0 0 8px;
}
.program ul {
  margin-top: 4px;
  margin-bottom: 12px;
}

/* Print optimizations */
@media print {
  body {
    color: #000;
    background: #fff;
  }
  .masthead nav, .downloads, .site-footer, .section-nav {
    display: none;
  }
  .container {
    padding: 0;
  }
  @page { margin: 1cm; }
}
