/* ===========================================================================
   Theme variables — tweak these to restyle the whole site.
   Dark mode is automatic based on the visitor's OS setting.
   =========================================================================== */
:root {
  --bg:     #ffffff;
  --text:   #1a1d21;
  --muted:  #5c636e;
  --accent: #2f6fed;
  --border: #e6e8eb;
  --maxw:   700px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #15171a;
    --text:   #e7e9ec;
    --muted:  #9aa1ab;
    --accent: #74a4ff;
    --border: #2a2e34;
  }
}

/* ===========================================================================
   Base
   =========================================================================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
}

p { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===========================================================================
   Header — name on the left, links on the right
   =========================================================================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .4rem 1.5rem;
  margin-bottom: 2.25rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 650;
}

.links { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.links a { color: var(--muted); font-size: .95rem; transition: color .15s ease; }
.links a:hover { color: var(--text); text-decoration: none; }

/* ===========================================================================
   Intro / about (no heading — just the opening paragraph)
   =========================================================================== */
.intro { margin: 0; }

/* ===========================================================================
   Divider
   =========================================================================== */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ===========================================================================
   Projects — title, then description underneath
   =========================================================================== */
.project { margin-bottom: 2rem; }
.project:last-of-type { margin-bottom: 0; }

.project h2 {
  margin: 0 0 .4rem;
  font-size: 1.1rem;
  font-weight: 650;
}
.project h2 a { color: var(--text); transition: opacity .15s ease; }
.project h2 a:hover { opacity: .8; text-decoration: none; }

.project p { margin: 0; }

/* A project with a figure beside the description — the title stays full width */
.project--fig {
  display: grid;
  grid-template-columns: 1fr 270px;
  column-gap: 0.1rem;
  align-items: center;
}
.project--fig h2 { grid-column: 1 / -1; }
.project-figure { width: 100%; height: auto; }

@media (max-width: 540px) {
  .project--fig { grid-template-columns: 1fr; }
  .project-figure { max-width: 260px; }
}

/* ===========================================================================
   Footer
   =========================================================================== */
footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
}
footer p { margin: 0; }

/* ===========================================================================
   Responsive
   =========================================================================== */
@media (max-width: 540px) {
  main { padding: 2.5rem 1.25rem; }
  .topbar { gap: .25rem; }
}
