/* ---------- Variables ---------- */
:root {
  --bg: #0f0f0d;
  --fg: #ece9e1;
  --muted: #8d8b84;
  --line: #2a2a26;
  --accent: #8ecbff;   /* light blue */
  --display: "Syne", "Helvetica Neue", Arial, sans-serif;   /* headings */
  --serif: "Syne", "Helvetica Neue", Arial, sans-serif;     /* project names, email */
  --sans: "DM Sans", "Helvetica Neue", Arial, sans-serif;   /* body text */
  --mono: "DM Mono", "Courier New", monospace;              /* small labels */
  --pad: clamp(20px, 5vw, 72px);
}

/* ---------- Reset & base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #0f0f0d; }

/* ---------- Top bar ---------- */
.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* name left, nav dead centre */
  align-items: center;
  padding: 28px var(--pad);
  mix-blend-mode: difference;   /* stays readable over any section */
  color: #fff;
}

.mark { font-weight: 500; font-size: 1.15rem; letter-spacing: 0.01em; justify-self: start; }

.top nav { display: flex; gap: 36px; font-size: 1.1rem; justify-self: center; }
.top nav a { position: relative; }
.top nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.top nav a:hover::after { transform: scaleX(1); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  padding: 140px var(--pad) 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ---------- Hero background: soft glow + film grain ---------- */
.hero { position: relative; overflow: hidden; }
.hero > * { position: relative; z-index: 1; }

.hero > .hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* keeps the left side (where the text is) clean and dark */
  -webkit-mask-image: linear-gradient(90deg, transparent 15%, #000 65%);
  mask-image: linear-gradient(90deg, transparent 15%, #000 65%);
}

/* Layer 1: slow-drifting light */
.hero-bg::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(ellipse 45% 55% at 78% 45%, rgba(236, 233, 225, 0.13), transparent 70%),
    radial-gradient(ellipse 35% 35% at 92% 88%, rgba(142, 203, 255, 0.16), transparent 70%),
    radial-gradient(ellipse 40% 40% at 62% 8%, rgba(236, 233, 225, 0.05), transparent 70%);
  animation: drift 18s ease-in-out infinite alternate;
}

/* Layer 2: grain */
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-3%, 4%) scale(1.08); }
}

/* Country line, name, role and buttons grouped, sitting near the top.
   Make the first number bigger to push it down, smaller to pull it up. */
.hero-main { margin: 6vh 0 auto; }

.meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.6rem, 9vw, 8rem);   /* Syne is wide, so this is smaller than before */
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-left: -0.04em;
}
.period { color: var(--accent); }

.lede {
  max-width: 34ch;
  margin-top: 32px;
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  line-height: 1.35;
  color: var(--muted);
}

/* ---------- Hero buttons ---------- */
.buttons { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 44px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 30px;
  border: 1px solid var(--fg);
  font-size: 1.05rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn span { display: inline-block; transition: transform 0.2s; }
.btn:hover span { transform: translateX(5px); }

.btn-solid { background: var(--fg); color: #0f0f0d; }
.btn-solid:hover { background: transparent; color: var(--fg); }

.btn-outline { color: var(--fg); border-color: #555; }
.btn-outline:hover { background: var(--fg); color: #0f0f0d; border-color: var(--fg); }

/* ---------- About: photo left, text right ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) 1.1fr;
  gap: clamp(32px, 7vw, 120px);
  align-items: center;
  padding: 120px var(--pad);
  border-top: 1px solid var(--line);
}

.photo {
  aspect-ratio: 1;
  max-width: 460px;
  width: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #181816;   /* shows if photo.jpg is missing */
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.about-text .label { padding-top: 0; margin-bottom: 16px; }

.about-text h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 32px;
}

.about-text p:not(.label) {
  max-width: 52ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.4vw, 1.3rem);
  line-height: 1.6;
}
.about-text p:not(.label) + p { margin-top: 1.2em; }

/* ---------- Two-column rows ---------- */
.row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 4fr;
  gap: 24px;
  padding: 72px var(--pad);
  border-top: 1px solid var(--line);
}

.label {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 8px;
}

.big {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.8vw, 3.4rem);
  line-height: 1.15;
  max-width: 24em;
}

/* ---------- Projects: card grid ---------- */
.projects {
  padding: 100px var(--pad);
  border-top: 1px solid var(--line);
}

.projects-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 56px;
}
.projects-head h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.count {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 28px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: #0b0b0a;
  transition: border-color 0.25s, transform 0.25s;
}
.card:hover { border-color: var(--accent); transform: translateY(-4px); }

/* Screenshot area. Falls back to a dark gradient if there's no image yet. */
.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #1a1a17, #0f0f0d 60%, #141c24);
}
.card:nth-child(2n) .thumb { background: linear-gradient(135deg, #141c24, #0f0f0d 60%, #1a1a17); }
.card:nth-child(3n) .thumb { background: linear-gradient(225deg, #1a1a17, #0f0f0d 55%, #1b1f26); }
.thumb::after {
  content: attr(data-n);
  position: absolute;
  left: 20px; bottom: 14px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: #55534d;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 1;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 32px;
}

.tag {
  align-self: flex-start;
  padding: 10px 16px;
  border: 1px solid #3a3a35;
  font-family: var(--mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 28px;
}

.card h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

/* Description fades out at the bottom, like the reference */
.card p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
  margin-bottom: 36px;
}

.view {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg);
}
.view i { font-style: normal; display: inline-block; transition: transform 0.2s; }
.card:hover .view { color: var(--accent); }
.card:hover .view i { transform: translateX(6px); }

/* ---------- Stack ---------- */
.tools {
  padding: 100px 0 40px;
  border-top: 1px solid var(--line);
}
.tools-head { padding: 0 var(--pad); margin-bottom: 56px; }
.tools-head .label { padding-top: 0; margin-bottom: 16px; }
.tools-head h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

/* Scrolling rows of tool names */
.marquee {
  overflow: hidden;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  /* fades the text out at both edges */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee + .marquee { border-top: 0; }

.marquee-track {
  display: flex;
  width: max-content;
  animation: scroll-left 40s linear infinite;
}
.marquee.reverse .marquee-track { animation-direction: reverse; }

.marquee ul { display: flex; list-style: none; }
.marquee li {
  position: relative;
  padding: 0 44px;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  transition: color 0.2s;
}
.marquee li:hover { color: var(--fg); }
.marquee li::after {            /* little dot between items */
  content: "";
  position: absolute;
  right: -3px; top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

@keyframes scroll-left { to { transform: translateX(-50%); } }

/* ---------- Contact ---------- */
.mail {
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.5vw, 4rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  transition: color 0.2s, border-color 0.2s;
  word-break: break-all;
}
.mail:hover { color: var(--accent); border-color: var(--accent); }

.social { display: flex; gap: 28px; margin-top: 28px; }
.social a {
  font-family: var(--mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: color 0.2s;
}
.social a:hover { color: var(--fg); }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  padding: 28px var(--pad);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.foot a:hover { color: var(--fg); }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .top { padding: 20px var(--pad); grid-template-columns: 1fr; }
  .mark { display: none; }
  .top nav { gap: 16px; font-size: 0.85rem; }

  .top nav { font-size: 0.95rem; }

  .row { grid-template-columns: 1fr; gap: 8px; padding: 56px var(--pad); }

  .about { grid-template-columns: 1fr; padding: 72px var(--pad); }
  .photo { max-width: 280px; }

  .projects { padding: 72px var(--pad); }
  .card-body { padding: 24px; }

  .tools { padding: 72px 0 32px; }
  .marquee li { font-size: 0.95rem; padding: 0 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .marquee-track { animation: none; }
}

/* =====================================================
   WORK & EDUCATION PAGE (work.html)
   ===================================================== */

/* current page link in the top nav stays underlined */
.top nav a.active::after { transform: scaleX(1); }

.work-page {
  padding: 130px var(--pad) 100px;
  max-width: 1280px;
  margin: 0 auto;
}

.back {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 56px;
  transition: color 0.2s;
}
.back:hover { color: var(--accent); }

.work-page > .label { padding-top: 0; margin-bottom: 14px; }

.work-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.work-head h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.work-head .count { font-size: 0.95rem; white-space: nowrap; }

/* ---------- Filters ---------- */
.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin: 28px 0 72px;
}
.tabs { display: flex; gap: 28px; }
.tab {
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 4px;
  font-family: var(--mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--fg); }

.legend {
  display: flex;
  gap: 24px;
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 10px; }
.key { display: inline-block; width: 9px; height: 9px; border: 1px solid var(--muted); }
.key-work { transform: rotate(45deg); }
.key-edu  { border-radius: 50%; }

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  position: relative;
}
.timeline::before {                 /* the centre line */
  content: "";
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--line);
}

.year, .entry { position: relative; }
.year[hidden], .entry[hidden] { display: none; }

.year { text-align: center; margin: 0 0 48px; }
.year span {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid #3a3a35;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.entry {
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  align-items: start;
  margin-bottom: 56px;
}

/* card on the left, date on the right */
.entry.left  .tl-card { grid-column: 1; grid-row: 1; }
.entry.left  .when    { grid-column: 3; grid-row: 1; text-align: left; }
/* card on the right, date on the left */
.entry.right .tl-card { grid-column: 3; grid-row: 1; }
.entry.right .when    { grid-column: 1; grid-row: 1; text-align: right; }

.node {
  grid-column: 2; grid-row: 1;
  justify-self: center;
  position: relative;
  z-index: 1;
  width: 12px; height: 12px;
  margin-top: 30px;
  border: 1px solid var(--muted);
  background: var(--bg);
  transform: rotate(45deg);          /* diamond = work */
}
.entry[data-type="education"] .node { border-radius: 50%; transform: none; }  /* circle = education */
.entry.current .node { background: var(--accent); border-color: var(--accent); }

.when { margin-top: 24px; font-family: var(--mono); }
.when time {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg);
}
.when span {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
}

/* ---------- Entry card ---------- */
.tl-card {
  padding: 28px;
  border: 1px solid var(--line);
  background: #0b0b0a;
  transition: border-color 0.25s, transform 0.25s;
}
.tl-card:hover { border-color: var(--accent); transform: translateY(-3px); }

.tl-card header { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }

.tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 1px solid #3a3a35;
  background: #141412;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--muted);
}

.tl-card h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.org { color: var(--fg); font-size: 0.95rem; margin-top: 4px; }
.org em { font-style: normal; color: var(--muted); margin-left: 8px; }

.tl-card ul { list-style: none; }
.tl-card li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}
.tl-card li + li { margin-top: 10px; }
.tl-card li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.75em;
  width: 6px; height: 1px;
  background: var(--accent);
}
.tl-card > p { color: var(--muted); font-size: 0.98rem; line-height: 1.6; }

/* ---------- Mobile: single column, line on the left ---------- */
@media (max-width: 760px) {
  .work-page { padding: 110px var(--pad) 72px; }
  .work-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filters { flex-direction: column; align-items: flex-start; margin-bottom: 48px; }

  .timeline::before { left: 11px; }
  .year { text-align: left; padding-left: 36px; }

  .entry { grid-template-columns: 24px 1fr; margin-bottom: 40px; }
  .entry .node { grid-column: 1; grid-row: 1 / span 2; justify-self: center; }
  .entry.left .when, .entry.right .when {
    grid-column: 2; grid-row: 1; text-align: left; margin: 0 0 12px 12px;
  }
  .entry.left .tl-card, .entry.right .tl-card {
    grid-column: 2; grid-row: 2; margin-left: 12px;
  }
  .tl-card { padding: 22px; }
}

/* =====================================================
   HERO LOGO (the PP mark on the right)
   ===================================================== */
.hero > .hero-logo {
  position: absolute;
  z-index: 1;
  right: clamp(24px, 7vw, 140px);
  top: 50%;
  width: clamp(220px, 26vw, 440px);
  height: auto;
  opacity: 0.85;                          /* lower this for a fainter logo */
  transform: translateY(-50%);
  filter: drop-shadow(0 30px 70px rgba(142, 203, 255, 0.14));
  pointer-events: none;
  animation: logo-float 8s ease-in-out infinite alternate;
}

@keyframes logo-float {
  from { transform: translateY(-50%); }
  to   { transform: translateY(calc(-50% - 14px)); }
}

@media (max-width: 760px) {
  .hero > .hero-logo {
    top: auto;
    bottom: 5vh;
    right: -6vw;
    width: 56vw;
    opacity: 0.3;
    transform: none;
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero > .hero-logo { animation: none; }
}