:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #5f6b76;
  --accent: #0f766e;
  --border: #e3e6e8;
}

* { box-sizing: border-box; }

/* Keeps layout identical whether or not the scrollbar is visible (needed for the splash intro) */
html { 
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

@import url('https://googleapis.com');

body {
  margin: 40px 0 0;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
}

header.site .inner,
main,
footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

header.site .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand { font-weight: 700; color: var(--text); text-decoration: none; }

nav a {
  margin-left: 18px;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
}
nav a:hover { color: var(--accent); }
nav a.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

main { padding-top: 40px; padding-bottom: 56px; }

h1 { font-size: 2rem; margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 40px 0 12px; }
h3 { font-size: 1.05rem; margin: 0; }
h4 { font-size: 1rem; margin: 0; }

/* ---------- Typewriter heading ---------- */
#greet { width: fit-content; white-space: pre; }
#greet .ghost { visibility: hidden; }
#greet .cursor { display: inline-block; position: relative; width: 0; }
#greet .cursor::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: -0.01em;
  height: 0.9em;
  border-left: 0.1em solid var(--accent);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.lead { font-size: 1.1rem; color: var(--muted); }

.resume { 
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0;
  text-decoration: none;
 }

/* #experience { scroll-margin-top: 65px; } */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  margin: 16px 0;
}

.card .meta { color: var(--muted); font-size: 0.92rem; margin: 2px 0 10px; }
.card ul { margin: 8px 0 0; padding-left: 20px; }
.card li { margin: 6px 0; }

.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  background: #e6f2f0;
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.9rem;
}

.skills dt { font-weight: 600; margin-top: 0px; }
.skills dd { margin: 6px 0 0; color: var(--muted); }
.skills-logo { margin-right: 6px; vertical-align: middle; }

figure.hobby { margin: 0; }
figure.hobby img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  background: #eceff1;
}
figure.hobby figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }

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

footer { color: var(--muted); font-size: 0.88rem; padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--border); }

/* ---------- Skills logos ---------- */
.skills-logo {
  flex: none;
  width: 36px;
  height: 36px;
  object-fit: contain;
}

/* ---------- Profile intro ---------- */
.intro { display: flex; align-items: flex-start; gap: 28px; margin-top: 20px; }
.intro-text > :first-child { margin-top: 0; }
.profile-pic {
  flex: none;
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--surface);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.18);
}
@media (max-width: 640px) {
  .intro { flex-direction: column; align-items: center; }
  .profile-pic { width: 160px; height: 160px; }
}

/* ---------- Organisation logos ---------- */
.card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.card-head .meta { margin: 2px 0 0; }
.org-logo {
  flex: none;
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
}

/* ---------- Load animations ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-down {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes logo-pop {
  0%   { opacity: 0; transform: scale(0.4) rotate(-90deg); }
  70%  { opacity: 1; transform: scale(1.12) rotate(6deg); }
  100% { opacity: 1; transform: none; }
}

header.site .inner { animation: fade-down 0.6s ease-out both; }
.brand .logo { animation: logo-pop 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) 0.15s both; }
.brand:hover .logo { transform: rotate(-8deg) scale(1.06); transition: transform 0.2s ease; }

main > * {
  animation: fade-up 0.7s ease-out both;
  animation-delay: calc(var(--n, 12) * 90ms + 200ms);
}
main > :nth-child(1)  { --n: 0; }
main > :nth-child(2)  { --n: 1; }
main > :nth-child(3)  { --n: 2; }
main > :nth-child(4)  { --n: 3; }
main > :nth-child(5)  { --n: 4; }
main > :nth-child(6)  { --n: 5; }
main > :nth-child(7)  { --n: 6; }
main > :nth-child(8)  { --n: 7; }
main > :nth-child(9)  { --n: 8; }
main > :nth-child(10) { --n: 9; }
main > :nth-child(11) { --n: 10; }

footer { animation: fade-up 0.7s ease-out 1.2s both; }

.card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(15, 118, 110, 0.12); }

.tags li { animation: fade-up 0.5s ease-out both; }
.tags li:nth-child(1) { animation-delay: 1.0s; }
.tags li:nth-child(2) { animation-delay: 1.1s; }
.tags li:nth-child(3) { animation-delay: 1.2s; }
.tags li:nth-child(4) { animation-delay: 1.3s; }

/* ---------- Splash intro (dark, centred typewriter) ----------
   Classes on <html>, managed by the inline script in index.html and script.js:
   splash          – splash screen is active
   splash-ready    – heading has been placed at the centre, so it can be shown
   splash-leaving  – overlay fades out and the name travels back to its place
   splash-done     – splash has finished (heading must not replay its fade-up)  */

html.splash { overflow: hidden; }

/* Dark overlay */
html.splash body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 101;
  background: radial-gradient(ellipse at 50% 45%, #14202b 0%, #0b0f14 65%);
  opacity: 1;
  transition: opacity 0.9s ease;
}
html.splash.splash-leaving body::before {
  opacity: 0;
  pointer-events: none;
}

/* The heading sits above the overlay, in light colours */
html.splash #greet {
  position: relative;
  z-index: 101;
  color: #f5f7fa;
  animation: none;
}
html.splash:not(.splash-ready) #greet { opacity: 0; }
html.splash #greet .cursor::after { border-left-color: #2dd4bf; }

/* Heading travels back to its original spot and takes its normal colours */
html.splash.splash-leaving #greet {
  color: var(--text);
  transition: transform 1s cubic-bezier(0.65, 0, 0.35, 1), color 1s ease;
}
html.splash.splash-leaving #greet .cursor::after {
  border-left-color: var(--accent);
  transition: border-left-color 1s ease;
}
html.splash-done #greet { animation: none; }

/* Rest of the page waits until the name starts moving, then fades in as usual */
html.splash:not(.splash-leaving) header.site .inner,
html.splash:not(.splash-leaving) footer,
html.splash:not(.splash-leaving) main > :not(#greet) {
  animation: none;
  opacity: 0;
}
html.splash:not(.splash-leaving) .tags li { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}