/* ==========================================================
   macblair221.github.io
   Palette borrowed from low-visibility aircraft paint
   (light/dark ghost gray) with one "remove before flight" red.
   ========================================================== */

:root {
  --bg: #e8eaeb;          /* light ghost gray */
  --panel: #f3f4f5;
  --ink: #14181c;
  --muted: #545c64;
  --rule: #c5cacf;
  --rule-strong: #8d959c;
  --red: #c8102e;         /* remove-before-flight red, used sparingly */
  --link: #14181c;

  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;

  --wide: 1180px;
  --gutter: clamp(1rem, 4vw, 3rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1f23; --panel: #22272c; --ink: #e5e8ea; --muted: #9aa2aa;
    --rule: #343a41; --rule-strong: #5b636b; --red: #ef3b54; --link: #e5e8ea;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1f23; --panel: #22272c; --ink: #e5e8ea; --muted: #9aa2aa;
  --rule: #343a41; --rule-strong: #5b636b; --red: #ef3b54; --link: #e5e8ea;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }
a { color: var(--link); text-decoration-color: var(--rule-strong); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
.wrap { max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-nav .wrap { display: flex; align-items: center; gap: 1.75rem; min-height: 3.5rem; }
.site-nav .mark { font: 700 1.2rem var(--display); color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap; }
.site-nav .mark .short { display: none; }
.site-nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.site-nav ul a { font: 500 1rem var(--body); color: var(--muted); text-decoration: none; padding-block: 0.3rem; border-bottom: 2px solid transparent; }
.site-nav ul a:hover { color: var(--ink); }
.site-nav ul a[aria-current] { color: var(--ink); border-bottom-color: var(--red); }
.theme-toggle {
  font: 500 0.9rem var(--body); color: var(--muted);
  background: none; border: 1px solid var(--rule-strong);
  padding: 0.2rem 0.7rem; cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3rem, 9vw, 6rem) clamp(3.5rem, 8vw, 5.5rem); border-bottom: 1px solid var(--rule-strong); }
.hero h1 {
  font-weight: 700;
  font-size: clamp(3.6rem, 11vw, 9rem);
  letter-spacing: -0.01em;
  line-height: 0.88;
}
.hero .role {
  font: 500 clamp(1.4rem, 2.6vw, 2rem) var(--display);
  color: var(--muted);
  margin: 1.25rem 0 1.75rem;
}
.hero .summary { max-width: 42rem; font-size: 1.125rem; }
.hero .summary p:last-child { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.btn {
  display: inline-block;
  font: 600 1rem var(--body);
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--ink);
  color: var(--ink);
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- Sections ---------- */
section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.75rem; margin-bottom: 2.5rem;
}
h2 { font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 700; }

/* Experience */
.role-block { display: grid; grid-template-columns: minmax(12rem, 18rem) 1fr; gap: 1rem 2.5rem; padding-block: 1.75rem; border-bottom: 1px solid var(--rule); }
.role-block:last-child { border-bottom: 0; }
.role-block .org { font: 700 1.5rem/1.1 var(--display); }
.role-block .org small { display: block; font: 400 0.95rem var(--body); color: var(--muted); margin-top: 0.35rem; }
.role-block h3 { font-size: 1.3rem; margin-bottom: 0.15rem; }
.role-block .dates { font-size: 0.92rem; color: var(--muted); margin-bottom: 0.6rem; }
.role-block ul { margin: 0 0 1.25rem; padding-left: 1.1rem; }
.role-block li { margin-bottom: 0.4rem; }
.role-block li::marker { color: var(--red); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.filters button {
  font: 500 1rem var(--body); color: var(--muted);
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 0.2rem 0; cursor: pointer;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--red); }

/* Projects */
.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-areas: "figure text";
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding-block: 2.75rem;
  border-top: 1px solid var(--rule);
}
.project:first-of-type { border-top: 0; padding-top: 0.5rem; }
.project[hidden] { display: none; }
.project .figure { grid-area: figure; margin: 0; }
.project .text { grid-area: text; }
.project .meta { font-size: 0.92rem; color: var(--muted); margin-bottom: 0.5rem; }
.project h3 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin-bottom: 0.6rem; }
.project .stack { font-size: 0.95rem; color: var(--muted); margin-bottom: 1.1rem; }
.project ul { padding-left: 1.1rem; margin: 0 0 1.25rem; }
.project li { margin-bottom: 0.45rem; }
.project li::marker { color: var(--red); }
.project .links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-weight: 500; }

.frame { background: var(--panel); border: 1px solid var(--rule-strong); padding: clamp(0.75rem, 2vw, 1.25rem); }
figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.6rem; line-height: 1.45; }
.video-tall { aspect-ratio: 9 / 16; max-width: 300px; margin-inline: auto; background: var(--bg); }
.video-tall iframe { width: 100%; height: 100%; border: 0; display: block; }
.zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.zoom + .zoom { margin-top: 1rem; }

/* Spec tables (used for results, specs, skills) */
.spec { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.spec th, .spec td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rule); }
.spec thead th { font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--rule-strong); }
.spec tbody th { font-weight: 600; width: 38%; }
.spec td.num, .spec th.num { text-align: right; white-space: nowrap; }
.spec tr.key td { font-weight: 700; }
.spec tr.key td.num { color: var(--red); }

details.report { margin-top: 1.25rem; border: 1px solid var(--rule-strong); }
details.report summary { cursor: pointer; padding: 0.7rem 1rem; font-weight: 500; }
details.report iframe { width: 100%; height: 520px; border: 0; display: block; }

/* Skills */
.skills .spec tbody th { width: 14rem; font-family: var(--display); font-size: 1.15rem; }

/* Contact */
.contact p { max-width: 42rem; font-size: 1.15rem; }

footer { border-top: 1px solid var(--rule-strong); padding-block: 1.75rem; color: var(--muted); font-size: 0.92rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; }

/* Image viewer */
.image-modal { display: none; position: fixed; inset: 0; z-index: 100; background: rgba(12, 14, 17, 0.9); align-items: center; justify-content: center; padding: 2rem; cursor: zoom-out; }
.image-modal.open { display: flex; }
.image-modal img { max-width: 95vw; max-height: 90vh; background: #fff; }
.image-modal button { position: fixed; top: 1rem; right: 1.25rem; font-size: 2rem; line-height: 1; color: #fff; background: none; border: 0; cursor: pointer; }

/* ---------- Resume page ---------- */
.resume { padding-block: clamp(2.5rem, 6vw, 4rem); }
.resume header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.5rem; border-bottom: 2px solid var(--ink); padding-bottom: 1.25rem; }
.resume header h1 { font-size: clamp(2.8rem, 7vw, 4.5rem); font-weight: 700; }
.resume header .contact-line { color: var(--muted); margin: 0.5rem 0 0; }
.resume h2 { font-size: 1.6rem; margin: 2.25rem 0 0.75rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--rule-strong); }
.resume .entry { margin-bottom: 1.25rem; }
.resume .entry-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1.5rem; }
.resume .entry-head h3 { font-size: 1.3rem; }
.resume .entry-head .dates { color: var(--muted); font-size: 0.95rem; }
.resume .sub { color: var(--muted); margin: 0.15rem 0 0.4rem; }
.resume ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.resume li { margin-bottom: 0.3rem; }
.resume li::marker { color: var(--red); }
.resume .spec tbody th { width: 13rem; }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .site-nav .wrap { gap: 1rem; }
  .site-nav ul { gap: 1rem; }
  .site-nav .mark .full { display: none; }
  .site-nav .mark .short { display: inline; }
  .site-nav li.hide-sm { display: none; }
  .project { grid-template-columns: 1fr; grid-template-areas: "text" "figure"; }
  .role-block { grid-template-columns: 1fr; }
  .skills .spec tbody th, .resume .spec tbody th { width: auto; display: block; border-bottom: 0; padding-bottom: 0; }
  .skills .spec td, .resume .spec td { display: block; padding-top: 0.2rem; }
}

/* ---------- Print (resume) ---------- */
@media print {
  .site-nav, footer, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .resume { padding: 0; }
  a { color: #000; text-decoration: none; }
}

/* Keep resume lines readable */
.resume .wrap { max-width: 940px; }
