/* ===== Colours and sizing: change these to restyle the whole page ===== */
:root {
  --bg: #0b0f17;
  --nav-bg: rgba(11, 15, 23, 0.85);
  --text: #f2f4f8;
  --text-muted: #b7c0cf;
  --accent: #4da3ff;
  --border: rgba(255, 255, 255, 0.18);
  --nav-height: 72px;
  --footer-height: 48px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ===== Navigation bar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  padding: 0 32px;
  /* Photo and name | page buttons (centred) | social links.
     The sides never shrink below their content, so the name is always shown in full;
     on tighter screens the buttons shift slightly off centre instead. */
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  column-gap: 16px;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

/* Photo and name */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  overflow: hidden;
  background: #1c2a44;
  cursor: zoom-in;
  transition: border-color 0.2s, transform 0.2s;
}

.avatar:hover {
  border-color: var(--accent);
  transform: scale(1.06);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-initial {
  display: none;
  place-items: center;
  width: 100%;
  height: 100%;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.avatar.no-photo { cursor: default; }
.avatar.no-photo img { display: none; }
.avatar.no-photo .avatar-initial { display: grid; }

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Enlarged photo */
.photo-viewer {
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-out;
}

.photo-viewer img {
  display: block;
  width: min(420px, 80vw);
  height: min(420px, 80vw);
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.photo-viewer[open] {
  animation: pop 0.25s ease;
}

.photo-viewer::backdrop {
  background: rgba(11, 15, 23, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

.nav-links {
  display: flex;
  gap: 12px;
}

.nav-btn {
  padding: 10px 18px;
  white-space: nowrap; /* "My Journey" stays on one line */
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s, border-color 0.2s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.nav-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.social-links {
  display: flex;
  gap: 12px;
  justify-self: end;
}

.social-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 1.1rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.social-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ===== Hero section ===== */
.hero {
  position: relative;
  /* Full screen height; the navigation bar floats over the top of it */
  height: 100vh;
  height: 100dvh; /* on phones, excludes the address bar */
  min-height: 520px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  /* Bottom: leaves room under the headline box for the scroll arrow, even on short screens */
  padding: 0 16px max(14vh, 96px);
  overflow: hidden;
}

/* Background video */
.video-bg {
  position: absolute;
  inset: 0;
  /* The space around the video, in the navy seen behind the fan blades in the video,
     so the video blends into the page. Change the colour here if the video changes. */
  background: #2d3540;
}

/* The whole video is always visible and scales with the screen, never cropped */
.video-bg video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Tall screens (phones held upright): sit the video higher, clear of the headline box */
@media (orientation: portrait) {
  .video-bg video { object-position: 50% 30%; }
}

/* Laptops and desktops: the video fills the whole hero, edge to edge, with no navy around it.
   Anything that doesn't fit the screen's shape is trimmed evenly, keeping the centre in view. */
@media (min-width: 1024px) and (orientation: landscape) {
  .video-bg video {
    object-fit: cover;
    object-position: center;
  }
}

/* Smaller screens and portrait: the whole video is shown with navy around it, and the
   top and bottom of the picture fade into the navy so the fan blades blend into the page */
@media (max-width: 1023px), (orientation: portrait) {
  /* Lets the video measure the space it sits in (cqw / cqh units below) */
  .video-bg { container-type: size; }

  .video-bg video {
    /* Where the picture actually sits inside the space: 16:9 video, scaled to fit */
    --pic-h: min(100cqh, 100cqw * 9 / 16);
    --pic-top: calc((100cqh - var(--pic-h)) * var(--video-y, 0.5));
    --pic-bottom: calc(var(--pic-top) + var(--pic-h));
    /* How far the fade reaches into the picture, at the top and at the bottom */
    --fade: calc(var(--pic-h) * 0.18);

    -webkit-mask-image: linear-gradient(to bottom,
      transparent var(--pic-top),
      #000 calc(var(--pic-top) + var(--fade)),
      #000 calc(var(--pic-bottom) - var(--fade)),
      transparent var(--pic-bottom));
    mask-image: linear-gradient(to bottom,
      transparent var(--pic-top),
      #000 calc(var(--pic-top) + var(--fade)),
      #000 calc(var(--pic-bottom) - var(--fade)),
      transparent var(--pic-bottom));
  }
}

/* Keeps the fade on the picture's edges in portrait, where the video sits 30% down
   instead of centred (see the portrait rule above) */
@media (orientation: portrait) {
  .video-bg video { --video-y: 0.3; }
}

.overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(11, 15, 23, 0.35) 0%,
    rgba(11, 15, 23, 0.25) 50%,
    rgba(11, 15, 23, 0.8) 100%
  );
}

/* Headline box */
.headline-box {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 820px;
  padding: 36px 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(11, 15, 23, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: rise 0.9s ease both;
  /* Headline on its own row; subtitle and button share the row below */
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 24px;
}

.headline-box h1 {
  grid-column: 1 / -1;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  /* Sized to keep "The sky was never the limit." on one line from desktops down to phones.
     If you change the headline, adjust these: smallest size, how it scales, largest size */
  font-size: clamp(1.2rem, 5.6vw, 3rem);
  text-wrap: balance; /* if it ever wraps (very narrow screens), split it into even lines */
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.subtitle {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--text-muted);
}

/* "Check out my Projects" button, on the subtitle's row at the right edge of the box */
.cta-btn {
  justify-self: end;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.2s;
}

.cta-btn i {
  transition: transform 0.2s;
}

.cta-btn:hover {
  background: #3a8ee6;
  transform: translateY(-2px);
}

.cta-btn:hover i {
  transform: translateX(4px);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Scroll arrow under the headline box ===== */
.scroll-cue {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap; /* always one line, even on narrow phones */
  /* Soft shadow so it stands out over bright parts of the video */
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
  transition: color 0.2s;
}

/* "SCROLL" and the arrow bounce to the same beat; the arrow follows a moment
   after the word and travels a little further, so they move like a wave */
.scroll-cue span {
  animation: cue-bounce-text 1.8s ease-in-out infinite;
}

.scroll-cue i {
  font-size: 1.35rem;
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.7));
  animation: cue-bounce 1.8s ease-in-out 0.15s infinite;
}

.scroll-cue:hover {
  color: var(--accent);
}

@keyframes cue-bounce-text {
  0%, 100% { transform: translateY(0);   opacity: 0.75; }
  50%      { transform: translateY(4px); opacity: 1; }
}

@keyframes cue-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* Clicking the arrow glides down instead of jumping */
html {
  scroll-behavior: smooth;
}

/* ===== LinkedIn recommendations (home page, below the hero) ===== */
.recommendations {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 32px 72px;
  scroll-margin-top: var(--nav-height); /* the scroll arrow stops it just below the nav bar */
}

.rec-header {
  text-align: center;
  margin-bottom: 40px;
}

.rec-header h2 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.rec-header p {
  color: var(--text-muted);
}

/* Up to 3 cards per row on wide screens (2 on tablets, 1 on phones: see below).
   Rows that aren't full are centred, so any number of cards looks balanced. */
.rec-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  --per-row: 3;
}

.rec-card {
  /* Width of one card when --per-row cards share a row (minus the gaps between them) */
  flex: 0 1 calc((100% - (var(--per-row) - 1) * 24px) / var(--per-row));
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s, transform 0.2s;
}

.rec-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.rec-quote-mark {
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: 14px;
}

/* Recommendation text, cut off after 7 lines until "Read more" is clicked */
.rec-text {
  margin: 0 0 20px;
  line-height: 1.65;
  font-size: 0.98rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  line-clamp: 7;
  overflow: hidden;
}

.rec-card.expanded .rec-text {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: none;
}

.rec-more {
  align-self: flex-start;
  margin: -10px 0 20px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.rec-more:hover {
  text-decoration: underline;
}

/* Who wrote it: always lined up along the bottom of the card */
.rec-author {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.rec-photo {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: #1c2a44;
}

.rec-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* No photo: show the initials from data-initials */
.rec-photo.missing img {
  display: none;
}

.rec-photo.missing::after {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

.rec-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.rec-meta strong {
  font-size: 0.95rem;
  color: var(--text);
}

.rec-relation {
  font-size: 0.78rem;
  opacity: 0.75;
}

/* "See all recommendations on LinkedIn" */
.rec-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 36px auto 0;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s, border-color 0.2s;
}

.rec-link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

/* Tablets: 2 per row; an odd card out sits centred underneath */
@media (max-width: 960px) {
  .rec-grid {
    --per-row: 2;
  }
}

/* Phones: 1 per row */
@media (max-width: 640px) {
  .recommendations {
    padding: 56px 16px 48px;
  }

  .rec-grid {
    --per-row: 1;
    gap: 16px;
  }

  .rec-card {
    padding: 22px;
  }
}

/* ===== Copyright footer (every page) =====
   Small and muted, at the very bottom of the page: there for the record, not for attention */
.site-footer {
  height: var(--footer-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: rgba(183, 192, 207, 0.5);
  /* Same background, transparency, blur and edge line as the navigation bar,
     using the same variables so the two always stay in sync */
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}

/* ===== Medium screens: tighten the navigation bar so the full name fits ===== */
@media (max-width: 900px) {
  .navbar { padding: 0 20px; column-gap: 12px; }
  .brand { gap: 10px; }
  .avatar { width: 40px; height: 40px; }
  .brand-name { font-size: 1rem; }
  .nav-links { gap: 6px; }
  .nav-btn { padding: 9px 10px; font-size: 0.85rem; }
  .social-links { gap: 8px; }
  .social-btn { width: 40px; height: 40px; font-size: 1rem; }
}

/* ===== Smaller screens ===== */
@media (max-width: 700px) {
  /* Two rows: photo and name | social links, then the page buttons full width below.
     Fixed at this height so every page knows where its content should start
     (the Resume toolbar and Projects showroom are placed using --nav-height). */
  :root { --nav-height: 108px; }

  .navbar {
    padding: 10px 16px 12px;
    align-content: center;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand social"
      "nav   nav";
    row-gap: 10px;
    column-gap: 12px;
  }
  .brand { grid-area: brand; gap: 10px; }
  .social-links { grid-area: social; gap: 8px; }
  /* Buttons fill the row; each is sized to its own text and the spare room is shared
     equally, so every button has the same space either side of its text */
  .nav-links {
    grid-area: nav;
    display: flex;
    gap: 6px;
  }
  .nav-links .nav-btn { flex: 1 1 auto; }

  .avatar { width: 38px; height: 38px; }
  .brand-name { font-size: 1rem; }
  .social-btn { width: 38px; height: 38px; font-size: 0.95rem; }
  .nav-btn {
    padding: 8px 10px;
    text-align: center;
    font-size: 0.85rem;
  }

  .headline-box {
    padding: 24px 22px;
    grid-template-columns: 1fr;
  }
  .hero { padding-bottom: max(12vh, 88px); }

  /* Drop the button below the subtitle on narrow screens */
  .cta-btn {
    justify-self: start;
    margin-top: 18px;
    font-size: 0.9rem;
    padding: 10px 18px;
  }
}

@media (max-width: 400px) {
  .nav-btn { font-size: 0.78rem; padding: 8px 6px; }

  /* Slightly tighter so "See my Recommendations" fits comfortably on small phones */
  .scroll-cue { font-size: 0.74rem; letter-spacing: 0.1em; }
}

/* Respect users who turn off animation */
@media (prefers-reduced-motion: reduce) {
  .headline-box,
  .photo-viewer[open],
  .scroll-cue span,
  .scroll-cue i { animation: none; }
  html { scroll-behavior: auto; }
}