/* =========================================================
   Conrad Kelsay — Engineering Portfolio
   Design system: restrained, light, high contrast, few colors.
   ========================================================= */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f7;
  --bg-inset: #eef0f2;
  --text: #16191d;
  --text-muted: #52585f;
  --text-faint: #7a8087;
  --border: #dfe2e6;
  --border-strong: #c3c8ce;
  --accent: #1c4b8c;
  --accent-ink: #0f3564;
  --accent-soft: #e8eefb;
  --status-current: #1c6e3e;
  --status-current-bg: #e8f5ec;
  --status-progress: #a15c00;
  --status-progress-bg: #fbf0dd;
  --focus-ring: #1c4b8c;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --content-max: 1120px;
  --prose-max: 720px;

  --radius-sm: 4px;
  --radius-md: 8px;

  --shadow-sm: 0 1px 2px rgba(16, 20, 24, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 20, 24, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a;
    --bg-alt: #181c22;
    --bg-inset: #1e232a;
    --text: #eceef1;
    --text-muted: #b0b6bd;
    --text-faint: #83898f;
    --border: #2b313a;
    --border-strong: #3a414c;
    --accent: #6ea1e8;
    --accent-ink: #cfe0f8;
    --accent-soft: #1c2b42;
    --status-current: #6fcf97;
    --status-current-bg: #163524;
    --status-progress: #e0ab5c;
    --status-progress-bg: #3a2c14;
    --focus-ring: #6ea1e8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  font-size: 17px;
}

h1, h2, h3, h4, p, ul, ol, dl, figure {
  margin: 0 0 0 0;
}

ul, ol {
  padding-left: 0;
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

/* ---------- Focus visibility ---------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ---------- Layout helpers ---------- */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.prose {
  max-width: var(--prose-max);
}

section {
  padding-block: clamp(3rem, 6vw, 5rem);
}

.section-alt {
  background: var(--bg-alt);
}

.section-head {
  max-width: var(--prose-max);
  margin-bottom: 2.25rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.section-head h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
}

.section-head p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ---------- Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.9rem;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.nav-brand span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.35rem 0.1rem;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

.nav-links a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600 !important;
}

.nav-cta:hover {
  background: var(--accent-ink);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 760px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 1.5rem 1rem;
    display: none;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-links a[aria-current="page"] {
    border-bottom: 1px solid var(--border);
  }

  .nav-cta {
    text-align: center;
    margin-top: 0.6rem;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-ink);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(2.75rem, 7vw, 5.5rem) clamp(2.5rem, 6vw, 4rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.hero-kicker {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-lede {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 56ch;
  margin-bottom: 1.5rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-meta li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hero-meta svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-faint);
}

/* Hero credentials panel */
.credentials-panel {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.credentials-panel h2 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.credential-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.credential-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.credential-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.credential-org {
  font-weight: 700;
  font-size: 0.98rem;
  grid-column: 1 / -1;
}

.credential-role {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.35rem;
}

.status-current {
  color: var(--status-current);
  background: var(--status-current-bg);
}

.status-progress {
  color: var(--status-progress);
  background: var(--status-progress-bg);
}

.status-complete {
  color: var(--text-muted);
  background: var(--bg-inset);
}

/* ---------- Stat strip ---------- */
.stat-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding-block: 1.75rem;
}

@media (max-width: 760px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat {
  border-left: 2px solid var(--accent);
  padding-left: 0.9rem;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

/* ---------- Project cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 760px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  height: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.project-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.project-org {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.96rem;
  margin-bottom: 1rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.project-card-link {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.project-card-link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}

.project-card:hover .project-card-link svg {
  transform: translateX(2px);
}

.card-featured {
  grid-column: span 2;
}

@media (max-width: 760px) {
  .card-featured {
    grid-column: span 1;
  }
}

/* Secondary project (compact row style) */
.project-compact {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}

.project-compact:last-child {
  border-bottom: 1px solid var(--border);
}

.project-compact-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-compact h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

/* ---------- Experience timeline ---------- */
.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  padding-block: 1.75rem;
  border-top: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: 1px solid var(--border);
}

@media (max-width: 700px) {
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.timeline-when {
  font-size: 0.88rem;
  color: var(--text-faint);
  font-weight: 600;
  padding-top: 0.15rem;
}

.timeline-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.timeline-org {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.timeline-body ul {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.timeline-body li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.timeline-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

.skill-group h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 0.85rem;
}

.skill-group .tag-list {
  margin-bottom: 0;
}

/* ---------- Education ---------- */
.edu-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  background: var(--bg);
}

@media (max-width: 600px) {
  .edu-card {
    grid-template-columns: 1fr;
  }
}

.edu-mark {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.edu-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.edu-card .edu-sub {
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.edu-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.edu-facts strong {
  color: var(--text);
}

.edu-facts + .edu-facts {
  margin-top: 0.85rem;
}

.edu-label {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  max-width: 640px;
}

@media (max-width: 600px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  background: var(--bg);
}

.contact-card:hover {
  border-color: var(--accent);
}

.contact-card svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.contact-card-label {
  font-size: 0.78rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contact-card-value {
  font-weight: 600;
  font-size: 0.98rem;
  word-break: break-word;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.88rem;
  color: var(--text-faint);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a:hover {
  color: var(--text);
}

/* =========================================================
   Project detail pages
   ========================================================= */

.detail-hero {
  padding-block: clamp(2.5rem, 6vw, 4rem) 2rem;
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-faint);
  margin-bottom: 1.25rem;
}

.breadcrumb a {
  color: var(--text-muted);
  font-weight: 600;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.detail-hero h1 {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
  max-width: var(--prose-max);
}

.detail-org {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 760px) {
  .detail-facts {
    grid-template-columns: repeat(2, 1fr);
  }
}

.detail-fact-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}

.detail-fact-value {
  font-weight: 600;
  font-size: 0.95rem;
}

.detail-body {
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.detail-main section + section {
  margin-top: 2.75rem;
}

.detail-main h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.9rem;
}

.detail-main p {
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.detail-main p:last-child {
  margin-bottom: 0;
}

.spec-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.spec-list li {
  position: relative;
  padding-left: 1.15rem;
  color: var(--text-muted);
}

.spec-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.spec-list strong {
  color: var(--text);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 700px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.info-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  background: var(--bg-alt);
}

.info-box h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 0.6rem;
}

.info-box.status-box-progress {
  background: var(--status-progress-bg);
  border-color: transparent;
}

.info-box.status-box-progress h3 {
  color: var(--status-progress);
}

.status-box-progress p {
  color: var(--text);
}

/* Sidebar */
.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 5.5rem;
}

.sidebar-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.sidebar-card h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

.sidebar-fact {
  margin-bottom: 0.9rem;
}

.sidebar-fact:last-child {
  margin-bottom: 0;
}

.sidebar-fact-label {
  font-size: 0.82rem;
  color: var(--text-faint);
}

.sidebar-fact-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.detail-nav-links {
  display: flex;
  justify-content: space-between;
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.detail-nav-links a {
  color: var(--accent);
}

.detail-nav-links a:hover {
  color: var(--accent-ink);
}

/* ---------- Utility ---------- */
.text-center {
  text-align: center;
}

.mt-lg {
  margin-top: 2.5rem;
}

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

/* ---------- Placeholder marker (dev only, harmless in prod) ---------- */
.needs-info {
  border-bottom: 1px dashed var(--status-progress);
}

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