/* alex-360.com: one stylesheet, no build step, no external requests. */

:root {
  color-scheme: light dark;
  --bg: #faf9f6;
  --surface: #ffffff;
  --text: #171a19;
  --muted: #5c6360;
  --line: #e4e1d9;
  --accent: #1d6b58;
  --on-accent: #ffffff;
  --radius: 12px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101211;
    --surface: #171a19;
    --text: #ecebe6;
    --muted: #9aa19d;
    --line: #272b29;
    --accent: #7ccdb4;
    --on-accent: #0c1512;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 47rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 5.5rem) 1.5rem 3rem;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

p {
  margin: 0;
}

/* ---------- Intro ---------- */

.hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.avatar {
  flex: none;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.role {
  margin-top: 0.4rem;
  color: var(--muted);
}

.lede {
  max-width: 40rem;
  margin-bottom: 1.75rem;
  font-size: 1.2rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition:
    border-color 0.15s,
    color 0.15s,
    background-color 0.15s;
}

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

.btn svg {
  flex: none;
  width: 1rem;
  height: 1rem;
}

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

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
  color: var(--on-accent);
}

/* ---------- Sections: label on the left, content on the right ---------- */

main {
  margin-top: 3rem;
}

section {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.5rem 2rem;
  padding: 2.25rem 0;
  border-top: 1px solid var(--line);
}

h2 {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}

.mono {
  color: var(--muted);
  font: 0.8rem/1.4 var(--mono);
  white-space: nowrap;
}

/* Company card */

.feature {
  display: block;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s;
}

.feature:hover {
  border-color: var(--accent);
  color: inherit;
}

.feature-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.feature-head strong {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.feature:hover .mono,
.project:hover .mono,
.project:hover h3 {
  color: var(--accent);
}

.feature p {
  color: var(--muted);
}

/* Projects */

.projects,
.entries {
  margin: 0;
  padding: 0;
  list-style: none;
}

.projects li + li {
  border-top: 1px solid var(--line);
}

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.1rem 1rem;
  align-items: baseline;
  padding: 0.9rem 0;
  text-decoration: none;
}

.projects li:first-child .project {
  padding-top: 0;
}

.projects li:last-child .project {
  padding-bottom: 0;
}

.project:hover {
  color: inherit;
}

.project p {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.97rem;
}

.more {
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Experience and education */

.entries {
  display: grid;
  gap: 1.4rem;
}

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

.org {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.95rem;
}

.entry-head + p {
  margin-top: 0.3rem;
}

/* Skills */

.facts {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.facts dt {
  font-weight: 600;
}

.facts dt small {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.facts dd {
  margin: 0.15rem 0 0;
}

.stack > * + * {
  margin-top: 0.75rem;
}

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.print-only {
  display: none;
}

/* Text pages (privacy, 404) */

.page h1 {
  margin: 1.5rem 0 1.25rem;
}

.page p + p {
  margin-top: 1rem;
}

@media (max-width: 40rem) {
  .hero {
    gap: 1rem;
  }

  .avatar {
    width: 4.25rem;
    height: 4.25rem;
  }

  .lede {
    font-size: 1.1rem;
  }

  section {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    padding: 1.75rem 0;
  }

  h2 {
    margin: 0;
  }
}

/* ---------- Print: the page doubles as the CV (see scripts/build-cv.ps1) ---------- */

@media print {
  @page {
    size: A4;
    margin: 11mm 15mm;
  }

  :root {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --text: #111;
    --muted: #4a4f4d;
    --line: #d5d5d0;
    --accent: #1d6b58;
  }

  body {
    font-size: 9.3pt;
    line-height: 1.42;
  }

  .wrap {
    max-width: none;
    padding: 0;
  }

  .no-print,
  footer {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  a {
    text-decoration: none;
  }

  .hero {
    margin-bottom: 0.8rem;
  }

  .avatar {
    width: 4.2rem;
    height: 4.2rem;
  }

  h1 {
    font-size: 21pt;
  }

  .contact-line {
    margin-bottom: 0.9rem;
    color: var(--muted);
    font-size: 9pt;
  }

  .lede {
    max-width: none;
    margin-bottom: 0;
    font-size: 10.2pt;
    line-height: 1.45;
  }

  /* A CV leads with experience; projects move to the end as one line each. */
  main {
    display: flex;
    flex-direction: column;
    margin-top: 1rem;
  }

  section[aria-labelledby="experience"] {
    order: 1;
  }

  section[aria-labelledby="education"] {
    order: 2;
  }

  section[aria-labelledby="skills"] {
    order: 3;
  }

  section[aria-labelledby="projects"] {
    order: 4;
  }

  section {
    grid-template-columns: 7.2rem minmax(0, 1fr);
    gap: 0.4rem 1.2rem;
    padding: 0.62rem 0;
  }

  h2 {
    font-size: 7.6pt;
  }

  h3 {
    font-size: 10pt;
  }

  .mono {
    font-size: 8pt;
  }

  .project p {
    font-size: 9pt;
  }

  .entries {
    gap: 0.5rem;
  }

  /* Role, organisation and dates share one line. */
  .entry-head {
    justify-content: flex-start;
    gap: 0 0.4rem;
  }

  .entry-head .org {
    flex-basis: auto;
    font-size: 9.3pt;
  }

  .entry-head .org::before {
    content: "· ";
  }

  .entry-head .mono {
    order: 1;
    margin-left: auto;
  }

  /* Degree titles are long: the school keeps its own line there. */
  section[aria-labelledby="education"] .org {
    order: 2;
    flex-basis: 100%;
  }

  section[aria-labelledby="education"] .org::before {
    content: none;
  }

  .entry,
  .projects li {
    break-inside: avoid;
  }

  .entry-head + p {
    margin-top: 0.05rem;
  }

  .projects li + li {
    border-top: 0;
  }

  .projects .project {
    grid-template-columns: 9.2rem minmax(0, 1fr);
    gap: 0 0.8rem;
    padding: 0.12rem 0;
  }

  .project h3 {
    grid-area: 1 / 1;
    font-size: 9pt;
  }

  .project p {
    grid-area: 1 / 2;
    color: var(--text);
  }

  /* The whole row stays a link in the PDF. */
  .project .mono {
    display: none;
  }

  .facts {
    gap: 0.45rem;
  }
}
