/* ---------- 1. Colours and fonts, defined once ---------- */

:root {
  --ink: #090919;      /* page background: deep navy */
  --rule: #2a3266;     /* thin divider lines */
  --text: #eef0fa;     /* main text */
  --muted: #a3a9cf;    /* secondary text */
  --pink: #f7c1d6;     /* baby pink accent */
  --tint: 247, 193, 214; /* default highlight colour (pink) as red, green, blue */

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- 2. Page foundations ---------- */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* The lattice sits behind everything and ignores clicks */
#lattice {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* The content sits in a centred column above the lattice */
header, main, footer {
  position: relative;
  z-index: 1;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.15;
  margin: 0;
}

a {
  color: inherit;
  text-decoration-color: var(--pink);
  text-underline-offset: 0.2em;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--pink);
}

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

.meta {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- 3. Header and menu ---------- */

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
}

header a {
  text-decoration: none;
}

.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
}

nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ---------- 4. Intro ---------- */

#top {
  padding: 6rem 0 5rem;
}

h1 {
  font-size: clamp(3rem, 11vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.95;
  color: var(--pink);
}

#top p {
  max-width: 32rem;
  margin: 2rem 0 0;
  font-size: 1.3rem;
  line-height: 1.5;
}

/* The name links to the About page and shows a hint on hover */
.name {
  position: relative;
  text-decoration: none;
}

.name:hover {
  color: var(--text);
}

.name::after {
  content: attr(data-hint);
  position: absolute;
  left: 0.25rem;
  bottom: 100%;
  margin-bottom: 0.25rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--pink);
  color: var(--ink);
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.name:hover::after,
.name:focus-visible::after {
  opacity: 1;
  transform: none;
}

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

/* ---------- 5. Sections ---------- */

#projects, #awards, #contact {
  padding: 3.5rem 0;
  border-top: 1px solid var(--rule);
}

h2 {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* Frosted panels so text stays readable over the lattice */
#projects, #awards, .page {
  margin: 0 -1.5rem 1.5rem;
  padding: 2.5rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 1rem;
  background: rgba(13, 19, 48, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* ---------- 6. Project cards ---------- */

.project {
  position: relative;
  padding: 1.75rem 0 1.75rem 1.5rem;
  border-top: 1px solid var(--rule);
}

/* The coloured bar on the left edge of each card */
.project::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.75rem;
  bottom: 1.75rem;
  width: 3px;
  border-radius: 2px;
  background: rgb(var(--tint));
  transform: scaleY(0.3);
  transform-origin: top;
  transition: transform 0.25s ease;
}

.project:hover::before,
.project:focus-within::before {
  transform: scaleY(1);
}

.project h3 {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0.4rem 0 0.5rem;
}

.project h3 a {
  text-decoration: none;
}

/* Stretches the title link so the whole card is clickable */
.project h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.project:hover h3 a,
.project:focus-within h3 a {
  color: rgb(var(--tint));
}

.project p {
  margin: 0;
  color: var(--muted);
}

.project .more {
  margin-top: 0.75rem;
  font-weight: 500;
  color: rgb(var(--tint));
}

.more a {
  text-decoration: none;
}

/* ---------- Project pages ---------- */

.page {
  margin-top: 2rem;
}

.page h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: rgb(var(--tint));
  margin: 0.5rem 0 1rem;
}

.page h2 {
  margin: 2.5rem 0 0.75rem;
}

.page .lead {
  font-size: 1.2rem;
}

.page img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.page figure {
  margin: 1.5rem 0;
}

.page figcaption {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* ---------- 7. Awards ---------- */

#awards h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--pink);
  margin-top: 2rem;
}

#awards ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

#awards li {
  padding: 0.65rem 0;
  border-top: 1px solid var(--rule);
}

#awards > .meta {
  margin: 2.5rem 0 0;
}

/* ---------- 8. Contact and footer ---------- */

.email {
  font-family: var(--display);
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--pink);
  text-decoration: none;
}

.email:hover {
  color: var(--text);
}

.links {
  display: flex;
  gap: 1.5rem;
}

footer {
  padding-top: 2rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
}

/* ---------- 9. Respect visitors who turn animations off ---------- */

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

  a, .project::before {
    transition: none;
  }
}
