/* ===== 1. Design tokens: change these to restyle the whole site ===== */
:root {
  --bg: #0f1115;        /* page background */
  --surface: #171a21;   /* cards, panels */
  --text: #e8eaed;      /* main text */
  --muted: #9aa0a6;     /* secondary text */
  --accent: #ff6a00;    /* one highlight colour */
  --line: #2a2f3a;      /* borders and dividers */
  --max-width: 1100px;
  --radius: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ===== 2. Base reset ===== */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: inherit; }

/* ===== 3. Navigation bar ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 17, 21, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo { font-weight: 700; text-decoration: none; letter-spacing: 0.05em; }
.nav-links { list-style: none; display: flex; gap: 24px; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); }

/* ===== 4. Hero ===== */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 96px 16px 64px;
}
.hero-eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 12px;
}
.hero-name { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.05; margin: 0; }
.hero-title { font-size: clamp(1.1rem, 2.5vw, 1.5rem); color: var(--muted); margin: 8px 0 24px; }
.hero-summary { max-width: 60ch; margin: 0 0 24px; }

.hero-tags { list-style: none; padding: 0; margin: 0 0 32px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-tags li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ===== 5. Buttons ===== */
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 48px; }
.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--accent); color: #111; }
.btn-primary:hover { background: #ff8533; }
.btn-secondary { border: 1px solid var(--line); }
.btn-secondary:hover { border-color: var(--text); }

/* ===== 6. Key facts row ===== */
.hero-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.hero-facts dt {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.hero-facts dd { margin: 0; }

/* ===== 7. Phones (screens 700px wide or narrower) ===== */
@media (max-width: 700px) {
  .nav-links { display: none; }
  .hero { padding-top: 64px; }
  .hero-facts { grid-template-columns: 1fr; }
}

/* ===== 8. Shared section styles ===== */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 16px;
}
.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.section-title { font-size: clamp(1.6rem, 3.5vw, 2.25rem); margin: 0 0 32px; }

/* ===== 9. Key highlights strip ===== */
.highlights {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}
.highlight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.highlight-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hl-num { font-size: 1.6rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.hl-text { font-size: 0.9rem; color: var(--muted); }

/* ===== 10. Project cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--muted); }
.card-tag {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 8px;
}
.card-title { font-size: 1.2rem; margin: 0 0 4px; }
.card-meta { font-size: 0.85rem; color: var(--muted); margin: 0 0 12px; }
.card-summary { margin: 0 0 12px; }
.card-points { margin: 0 0 12px; padding-left: 18px; font-size: 0.92rem; color: var(--muted); }
.card-points li { margin-bottom: 4px; }
.card-result {
  font-size: 0.92rem;
  margin: 0 0 16px;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
}
.card-tools {
  list-style: none;
  margin: auto 0 0;     /* pushes the tool tags to the bottom of the card */
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card-tools li {
  font-size: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--muted);
}

/* ===== 11. Responsive tweaks for the new sections ===== */
@media (max-width: 900px) {
  .highlight-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .highlight-list { grid-template-columns: 1fr; }
}

/* ===== 12. Card images ===== */
.card-img {
  width: calc(100% + 48px);   /* stretch over the card's 24px side padding */
  margin: -24px -24px 16px;   /* sit flush with the card's top and side edges */
  aspect-ratio: 16 / 9;       /* every thumbnail the same shape */
  height: auto;
  object-fit: cover;          /* fill the box, cropping the overflow */
  display: block;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.card-img--dil { object-position: 75% 50%; }               /* keep the wheel and HUD in frame */
.card-img--drawing { object-fit: contain; padding: 8px; }  /* show the whole drawing, never crop it */
.card-img--esports { object-position: 50% 30%; }            /* keep faces and the tyre in a square photo */
.hero-subheading { color: var(--accent); font-weight: 600; margin: -16px 0 24px; }

/* ===== 13. Card link ===== */
.card-link {
  margin-top: 16px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

/* ===== 14. Project detail page ===== */
.detail {
  max-width: 820px;            /* narrower than the home page, for comfortable reading */
  margin: 0 auto;
  padding: 48px 16px 80px;
}
.back-link { display: inline-block; margin-bottom: 24px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--text); }
.detail-title { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 16px; }
.detail-lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 32px; }
.detail-figures { grid-template-columns: repeat(2, 1fr); margin: 32px 0 48px; }
.detail-section { margin-bottom: 48px; }
.detail-section h2 { font-size: 1.5rem; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.detail-section h3 { font-size: 1.15rem; margin: 24px 0 8px; }
.detail-list { padding-left: 20px; }
.detail-list li { margin-bottom: 10px; }
.detail-tools { color: var(--muted); }

/* Figures */
.figure { margin: 24px 0; }
.figure img { width: 100%; height: auto; display: block; border-radius: var(--radius); border: 1px solid var(--line); }
.figure figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.figure--narrow { max-width: 420px; }   /* portrait photos would be too tall at full width */
.figure--chart { max-width: 820px; }    /* keeps chart text readable; matches project-page width */

/* Equation and research question */
.equation {
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
}
.research-q {
  margin: 24px 0 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-style: italic;
}
.note { font-size: 0.85rem; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }          /* tables scroll sideways on phones instead of breaking the layout */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }


/* ===== 15. Anchor scrolling ===== */
html { scroll-behavior: smooth; }
.section { scroll-margin-top: 72px; }   /* stop the sticky 60px nav covering section headings */

/* ===== 16. Experience timeline ===== */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 180px 1fr;   /* date column | content */
  gap: 24px;
  padding: 0 0 32px 24px;
}
.timeline-item::before {               /* orange dot sitting on the line */
  content: "";
  position: absolute;
  left: -7px;                          /* centre of a 12px dot on the 2px line: -1px - 6px */
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-date { margin: 0; color: var(--muted); font-size: 0.9rem; }
.timeline-role { margin: 0; font-size: 1.1rem; }
.timeline-org { margin: 2px 0 8px; color: var(--muted); font-size: 0.9rem; }
.timeline-item p:last-child { margin-bottom: 0; }

/* ===== 17. Skills ===== */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 20px;
}
.skill-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.skill-group h3 { margin: 0 0 12px; font-size: 1rem; }
.skill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.skill-list li { font-size: 0.85rem; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--muted); }

/* ===== 18. Contact and footer ===== */
.contact-lead { max-width: 60ch; margin: 0 0 24px; }
.site-footer { border-top: 1px solid var(--line); text-align: center; padding: 24px 16px; color: var(--muted); font-size: 0.85rem; }

/* ===== 19. Phones ===== */
@media (max-width: 700px) {
  .timeline-item { grid-template-columns: 1fr; gap: 4px; }   /* date above the content instead of beside it */
}
/* ===== 20. Contact email fallback ===== */
.contact-email { margin: 16px 0 0; color: var(--muted); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.copy-btn {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 12px;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--text); }
.copy-status { font-size: 0.85rem; color: var(--accent); }


/* ===== 21. Phone navigation menu ===== */
.nav-toggle { display: none; }               /* hidden on desktop */

@media (max-width: 700px) {
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;                             /* minimum comfortable touch target */
    height: 44px;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
  }
  .nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
  }
  /* Morph the three bars into an X when open */
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Dropdown panel */
  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;                               /* directly under the header bar */
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px;
  }
  .nav-links.is-open a { display: block; padding: 12px 0; font-size: 1.05rem; }
}

/* ===== 22. About: outside the day job ===== */
.about-lead { max-width: 720px; margin: 0 0 24px; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}
.photo-grid figure { margin: 0; }
.photo-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.photo-grid figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.about-group { margin-top: 32px; }
.about-group h3 { font-size: 1.15rem; margin: 0 0 8px; }

/* ===== 23. Hero photo ===== */
.hero-photo {
  display: block;
  width: 144px;
  height: 144px;
  border-radius: 50%;
  object-fit: cover;
  border: 6px solid teal;
  margin-bottom: 24px;
}
@media (min-width: 900px) {
  .hero-photo { float: right; width: 240px; height: 240px; margin: 0 0 24px 48px; }
}
.hero-facts { clear: both; }

/* ===== 24. Sub-heading inside a section (personal projects) ===== */
.subsection-title { font-size: 1.25rem; margin: 48px 0 20px; }
.card-img--dark { background: var(--surface); }   /* dark charts and renders: no white box around them */

/* ===== 25. Project-page image grids ===== */
.photo-grid--full { align-items: start; margin: 20px 0 8px; }
.photo-grid--full img { aspect-ratio: auto; object-fit: contain; }   /* show the whole image, no cropping */
.photo-grid img.img--fit { background: #fff; }                      /* CAD renders sit on white */

/* ===== 26. Click to enlarge (js/main.js opens a.zoom in a viewer) ===== */
a.zoom { display: block; position: relative; cursor: zoom-in; }
a.zoom::after {
  content: "Enlarge";
  position: absolute; right: 8px; bottom: 8px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.75rem; color: #fff; background: rgba(0, 0, 0, 0.65);
  opacity: 0.85; pointer-events: none;
}
a.zoom:hover::after, a.zoom:focus-visible::after { opacity: 1; }
.lightbox { border: none; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.88); }
.lightbox img { display: block; max-width: 96vw; max-height: 84vh; width: auto; height: auto; margin: 0 auto; border-radius: var(--radius); background: #fff; }
.lightbox p { color: #e8eaed; font-size: 0.9rem; text-align: center; margin: 10px 0 0; }
.lightbox button {
  position: absolute; top: -44px; right: 0;
  font: inherit; font-size: 0.9rem; color: #fff;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
