/* Portfolio home page */

/* Base palette from the ALT-1 site; each project card borrows its accent
   from that project's own site (Luno dusk orange, Starchitect magenta,
   Evosim teal, ALT-1 blue, Digit Reader ink blue). */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1d1f21;
  --muted: #5c6166;
  --border: #dcdcd7;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --code-bg: #eeeeea;
  --luno: #b9503b;
  --starchitect: #a3007c;
  --alt1: #1f6feb;
  --evosim: #0e7077;
  --digits: #2446c7;
  --max: 64rem;
  --gutter: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1d2024;
    --text: #e6e6e3;
    --muted: #9aa0a6;
    --border: #33373c;
    --accent: #4c8dff;
    --accent-text: #0b0d10;
    --code-bg: #24282d;
    --luno: #ff9040;
    --starchitect: #ff5cbf;
    --alt1: #4c8dff;
    --evosim: #3fdc8a;
    --digits: #8aa4ff;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 4rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

a { color: var(--accent); }

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-header nav a:hover { color: var(--text); }

/* Sections */

section { padding: 3rem 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.15; margin: 0.25rem 0 1rem; }
h2 { font-size: 1.6rem; margin: 0 0 1rem; }

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.lede { font-size: 1.15rem; color: var(--muted); max-width: 44rem; margin-bottom: 0; }

/* Project cards: two columns on wide screens */

.projects {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 52rem) {
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.project {
  --project: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--project);
  border-radius: 8px;
  overflow: hidden;
  /* The light surface is already white, so hover tints it with the project accent */
  --surface-hover: color-mix(in srgb, var(--project) 5%, var(--surface));
  transition: background-color 0.3s ease;
}
.project:hover,
.project:focus-within { background: var(--surface-hover); }
@media (prefers-color-scheme: dark) {
  .project { --surface-hover: #262a2f; }
}
.project-luno { --project: var(--luno); }
.project-starchitect { --project: var(--starchitect); }
.project-alt1 { --project: var(--alt1); }
.project-evosim { --project: var(--evosim); }
.project-digits { --project: var(--digits); }

/* Thumbnail links to the project site; the image zooms inside its frame.
   It sits above the title's stretched link so it gets its own hover. */
.thumb {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  /* Zooming towards the cursor pans the image with it; --pan-x and --pan-y
     are set by the script in index.html */
  transform-origin: var(--pan-x, 50%) var(--pan-y, 50%);
  transition: transform 0.3s ease, transform-origin 0.1s ease-out;
}
.thumb:hover img,
.project:focus-within .thumb img { transform: scale(1.05); }

@media (prefers-reduced-motion: reduce) {
  .thumb img { transition: none; }
}

.project-body { padding: 1.25rem; }
.project h2 { font-size: 1.3rem; line-height: 1.3; margin-bottom: 0.75rem; }
.project h2 a { color: var(--text); text-decoration: none; }
.project:hover h2 a { color: var(--project); text-decoration: underline; }

/* The title link stretches over the whole tile, so anywhere on it is clickable */
.project h2 a::after { content: ""; position: absolute; inset: 0; }
.project h2 a:focus-visible { outline: none; }
.project:has(h2 a:focus-visible) { outline: 2px solid var(--project); outline-offset: 2px; }
.project p { margin: 0; color: var(--muted); }

/* Tech stack pills */

.pills {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.pills li {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: nowrap;
}

/* Footer */

.site-footer { padding: 2rem 0; color: var(--muted); font-size: 0.9rem; }
