/* ==========================================================================
   Tom Magerat — Resume & Portfolio
   style.css

   This file is organized as:
   1. Design tokens (CSS variables) — colors, spacing, type, radius
   2. Reset / base styles
   3. Layout helpers (container, section spacing)
   4. Typography
   5. Navigation bar
   6. Hero section
   7. About section
   8. Experience timeline
   9. Education cards
   10. Projects grid + project detail pages
   11. Skills section
   12. Contact section
   13. Footer
   14. Buttons, tags, small components
   15. Responsive breakpoints
   16. Accessibility (focus states, reduced motion)

   Tip for editing: almost every color, spacing and radius value used below
   comes from a variable defined in the :root block. Change a value there
   and it updates everywhere it's used.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Colors — light, professional palette with one blue accent */
  --color-bg: #fafbfc;              /* page background, very light grey */
  --color-surface: #ffffff;          /* cards, nav bar */
  --color-surface-alt: #f2f5f9;      /* subtle section tint */
  --color-text: #0b1220;             /* near-black navy, main text */
  --color-text-muted: #4b5568;       /* secondary text */
  --color-text-faint: #8792a2;       /* tertiary text, captions */
  --color-border: #e3e8ef;           /* hairline borders */
  --color-accent: #1a56c4;           /* primary blue accent */
  --color-accent-dark: #123d92;      /* hover state for accent */
  --color-accent-soft: #eaf1fd;      /* light accent background (tags, chips) */
  --color-accent-line: #c7d9f5;      /* accent used for thin decorative lines */

  /* Typography */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* Spacing scale (used for padding/margin/gaps) */
  --space-1: 0.4rem;
  --space-2: 0.8rem;
  --space-3: 1.2rem;
  --space-4: 1.6rem;
  --space-5: 2.4rem;
  --space-6: 3.2rem;
  --space-7: 4.8rem;
  --space-8: 6.4rem;

  /* Radius scale */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  /* Shadows — kept subtle, per the brief */
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, 0.05);
  --shadow-md: 0 6px 20px rgba(11, 18, 32, 0.06);
  --shadow-lg: 0 16px 40px rgba(11, 18, 32, 0.10);

  /* Layout */
  --content-max-width: 1120px;
  --nav-height: 72px;
}

/* --------------------------------------------------------------------------
   2. Reset / base styles
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Smooth scrolling for the nav-link anchor jumps */
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 12px);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   3. Layout helpers
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

section {
  padding: var(--space-8) 0;
}

.section-header {
  max-width: 640px;
  margin-bottom: var(--space-6);
}

/* The "eyebrow" is a small monospace label above section titles.
   It nods to schematic/technical-drawing annotations, tying the type
   system back to Tom's engineering background without being loud. */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.section-title {
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
}

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

/* --------------------------------------------------------------------------
   5. Navigation bar
   -------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(250, 251, 252, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.nav-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  padding: var(--space-1) 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.nav-links a.nav-cta {
  color: var(--color-surface);
  background: var(--color-accent);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border-bottom: none;
}

.nav-links a.nav-cta:hover,
.nav-links a.nav-cta:focus-visible {
  background: var(--color-accent-dark);
}

/* Mobile menu toggle button (hidden on desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  display: block;
  width: 18px;
  height: 2px;
  background: var(--color-text);
  position: relative;
  transition: transform 0.2s ease;
}

.nav-toggle span::before {
  position: absolute;
  top: -6px;
}

.nav-toggle span::after {
  position: absolute;
  top: 6px;
}

/* --------------------------------------------------------------------------
   6. Hero section
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-8) 0 var(--space-7);
}

/* Decorative single-line-diagram pattern: faint nodes + lines, a subtle
   nod to transmission-grid schematics. Purely decorative (aria-hidden). */
.hero-grid-pattern {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
}

.hero.hero-with-bg {
  position: relative;
  min-height: 76vh;
  display: flex;
  align-items: flex-start;
  overflow: hidden;
}

.hero.hero-with-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to top, rgba(8, 16, 34, 0.72) 5%, rgba(8, 16, 34, 0.35) 30%, rgba(8, 16, 34, 0.18) 100%),
    var(--hero-bg);
  background-size: cover;
  background-position: center 20%;
  background-repeat: no-repeat;
  transform: scale(1.02);
}

.hero.hero-with-bg .hero-grid-pattern {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.28;
  pointer-events: none;
}

.hero.hero-with-bg .hero-inner {
  position: absolute;
  z-index: 2;
  display: flex;
  justify-content: flex-start; /* left */
  width: 100%;
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

.hero.hero-with-bg .hero-text {
  max-width: 760px;
  color: #ffffff;
  transform: translateY(-96px); /* move text higher */
}

/* Optional fine-tune for small screens */
@media (max-width: 720px) {
  .hero.hero-with-bg .hero-text {
    transform: translateY(-96px);
  }
}

.hero.hero-with-bg .eyebrow,
.hero.hero-with-bg .hero-title,
.hero.hero-with-bg .hero-subtitle,
.hero.hero-with-bg .hero-tagline {
  color: rgba(255, 255, 255, 0.92);
}

/* Optional: hide old photo styles if still present */
.hero-photo {
  display: none;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-photo-placeholder {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-faint);
  text-align: center;
  padding: var(--space-2);
}

.hero-name {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  margin-bottom: var(--space-2);
}

.hero-title {
  font-size: clamp(1.3rem, 2.5vw, 2.3rem);
  color: var(--color-accent-dark);
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-text-faint);
  margin-bottom: var(--space-5);
  letter-spacing: 0.02em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   7. About section
   -------------------------------------------------------------------------- */
.about-content {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-size: 1.05rem;
  color: var(--color-text-muted);
}

.about-content p {
  margin: 0;
}

/* --------------------------------------------------------------------------
   8. Experience timeline
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-left: var(--space-6);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  border: 2px solid var(--color-accent);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-accent);
  margin-bottom: var(--space-1);
  display: block;
}

.timeline-role {
  font-size: 1.15rem;
  margin-bottom: 0.2rem;
}

.timeline-company {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-2);
}

.timeline-company .dot-sep {
  margin: 0 var(--space-1);
  color: var(--color-text-faint);
}

.timeline-description {
  color: var(--color-text-muted);
  max-width: 680px;
}

/* --------------------------------------------------------------------------
   9. Education cards
   -------------------------------------------------------------------------- */
.education-grid {
  display: grid;
  gap: var(--space-4);
}

.education-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.education-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-accent);
}

.education-degree {
  font-size: 1.1rem;
  margin: 0.3rem 0 0.15rem;
}

.education-institution {
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.education-honor {
  display: inline-block;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.education-description {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   10. Projects grid + cards
   -------------------------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  height: 100%;
}

.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.project-card-image {
  width: 100%;
  aspect-ratio: 16 / 9; /* was 16 / 10 */
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card-image-placeholder {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-faint);
}

.project-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card-title {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.project-card-tags {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.project-card-description {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  flex: 1;
  margin-bottom: var(--space-3);
}

.project-card-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Project detail pages */
.project-hero {
  padding: var(--space-6) 0 var(--space-4);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--color-accent);
}

.project-detail-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: var(--space-2);
}

.project-detail-tags {
  font-family: var(--font-mono);
  color: var(--color-accent);
  font-size: 0.85rem;
  margin-bottom: var(--space-4);
}

.project-detail-image {
  width: 100%;
  aspect-ratio: 16 / 9; /* was 16 / 8 */
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.project-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-detail-image-placeholder {
  font-family: var(--font-mono);
  color: var(--color-text-faint);
  font-size: 0.85rem;
}

.project-section {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-border);
}

.project-section:first-of-type {
  border-top: none;
}

.project-section h2 {
  font-size: 1.25rem;
  margin-bottom: var(--space-3);
}

.project-section p {
  color: var(--color-text-muted);
  max-width: 720px;
}

.project-section ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--color-text-muted);
}

.project-section ul li::before {
  content: '— ';
  color: var(--color-accent);
}

.back-cta {
  margin-top: var(--space-6);
}

/* --------------------------------------------------------------------------
   11. Skills section
   -------------------------------------------------------------------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.skills-category {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.skills-category h3 {
  font-size: 1rem;
  margin-bottom: var(--space-3);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
}

.language-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.language-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.language-item strong {
  color: var(--color-text);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   12. Contact section
   -------------------------------------------------------------------------- */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 420px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease;
}

.contact-item:hover,
.contact-item:focus-visible {
  border-color: var(--color-accent);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
}

.contact-value {
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-5) 0;
}

.site-footer p {
  color: var(--color-text-faint);
  font-size: 0.85rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   14. Buttons and small components
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--color-accent-dark);
}

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

.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

/* --------------------------------------------------------------------------
   15. Responsive breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --nav-height: 64px;
  }

  .container {
    padding: 0 var(--space-4);
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: var(--space-2) var(--space-4) var(--space-4);
    display: none;
    box-shadow: var(--shadow-md);
  }

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

  .nav-links a {
    width: 100%;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
  }

  .nav-links a.nav-cta {
    margin-top: var(--space-2);
    text-align: center;
    justify-content: center;
    border-bottom: none;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .hero-photo {
    width: 120px;
    height: 120px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   16. Accessibility
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .project-card,
  .nav-links a,
  .contact-item {
    transition: none;
  }
}

.item-links {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.62rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-surface);
  transition: .2s ease;
}

.mini-link:hover,
.mini-link:focus-visible {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg);
}

/* Project page text consistency */
.project-section,
.project-section p,
.project-section li,
.project-section h2,
.project-section h3 {
  color: var(--color-text);
}

/* Use real bullets for unordered lists */
.project-section ul {
  list-style-type: disc;
  list-style-position: outside;
  padding-left: 1.25rem;
  margin: 0.6rem 0 1rem;
}

/* Keep numbered steps for ordered lists */
.project-section ol {
  list-style-type: decimal;
  list-style-position: outside;
  padding-left: 1.25rem;
  margin: 0.6rem 0 1rem;
}

/* In case a custom dash marker exists elsewhere */
.project-section li::before {
  content: none !important;
}
