/* Color CSS variables */

:root {
  --fg: #ffffff;
  --fg-dim: rgba(255, 255, 255, 0.75);
  --fg-faint: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.85);
  --line-soft: rgba(255, 255, 255, 0.35);
  --overlay: rgba(10, 14, 30, 0.68);
  --surface: rgba(8, 11, 22, 0.45);
  --hover: rgba(255, 255, 255, 0.12);
  --hover-soft: rgba(255, 255, 255, 0.06);
  --track: rgba(255, 255, 255, 0.15);
  --dot-bg: #0b0f1e;
  --bar-bg: rgba(7, 10, 20, 0.75);
  --veil: #06080f;
  --bg-image: url("images/bg.jpg");
  --tracking: 0.35em;
}

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

/* Root type scale: grows gently with viewport width so ultrawide
   monitors get proportionally larger type and cards (everything
   below is sized in rem). 1920px → ~16.8px, 3440px → ~18.6px. */
html {
  font-size: clamp(16px, 14.5px + 0.12vw, 19px);
  scroll-behavior: smooth;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  ::-webkit-scrollbar { display: none;} /* Chrome, safari, edge */
  background: #0b1026; /* overscroll colour */
}

body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-weight: 300;
  color: var(--fg);

}

/* Background lives on a fixed layer, not background-attachment: fixed —
   iOS Safari doesn't support fixed attachment with cover sizing, but a
   position: fixed element works on every platform. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(var(--overlay), var(--overlay)),
    var(--bg-image) center / cover no-repeat,
    linear-gradient(160deg, #0b1026 0%, #101b3a 45%, #0a0f22 100%);
}

/* ---------- Hero (first viewport) ---------- */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  position: relative;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Fixed width: the title's letter-spacing animation changes its own
     width every frame; without this the shrink-wrapped column resizes
     and re-centres the 1px lines each frame (visible jitter). */
  width: min(35rem, 82vw);
  will-change: transform, opacity;
}

.hero p {
  font-weight: 600;
}

.scroll-hint {
  position: absolute;
  bottom: 2.2rem;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--fg-faint);
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50%      { transform: translateY(7px); opacity: 1; }
}

.socials { display: flex; gap: 1.2rem; align-items: center; }

.avatar {
  width: 88px;
  height: 88px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--fg);
  transition: background 0.25s ease;
}
.avatar:hover { background: var(--hover); }
.avatar svg { width: 42px; height: 42px; fill: currentColor; }
/* LinkedIn's square glyph reads optically larger — size it down a touch */
.avatar.linkedin svg { width: 34px; height: 34px; }

/* Personal monogram: sits centre of the socials row, a touch larger to
   read as the identity mark rather than a third link */
.avatar.brand { width: 100px; height: 100px; cursor: default; }
.avatar.brand:hover { background: transparent; }
.avatar.brand img { width: 46px; height: auto; display: block; }

.stem { width: 1px; height: 56px; background: var(--line); }
.crossbar { width: 100%; height: 1px; background: var(--line); }

h1 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 600;
  letter-spacing: var(--tracking);
  text-indent: var(--tracking);
  margin: 2.2rem 0 1.4rem;
  text-transform: uppercase;
  /* One line always — wrapping mid-animation would cause a vertical jump */
  white-space: nowrap;
}

.tagline {
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 2.4rem;
}

nav.hero-nav {
  display: flex;
  justify-content: center;
  border: 1px solid var(--line);
  /* Size to content, never wrap: the hero column is width-pinned (see
     .hero-content), but a centred flex child wider than its parent
     overflows symmetrically — so the nav keeps one row at any width. */
  flex-wrap: nowrap;
  width: max-content;
  max-width: calc(100vw - 2rem);
}

nav.hero-nav a {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  border-left: 1px solid var(--line);
  padding: 1rem 1.6rem;
  white-space: nowrap;
  transition: background 0.25s ease;
}
nav.hero-nav a:first-child { border-left: 0; }
nav.hero-nav a:hover, nav.hero-nav a:focus-visible { background: var(--hover); outline: none; }

/* ---------- Slim fixed nav (appears once you leave the hero) ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  background: var(--bar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
  transform: translateY(-100%);
  transition: transform 0.4s ease;
}
body.scrolled .topbar { transform: none; }

.topbar a {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.85rem 1rem;
  transition: color 0.25s ease, background 0.25s ease;
}
.topbar a:hover, .topbar a:focus-visible { color: var(--fg); background: var(--hover-soft); outline: none; }
.topbar a.home { font-weight: 600; color: var(--fg); }

/* ---------- Scroll sections ---------- */

section {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1rem;
}

.card {
  max-width: 42rem;          /* rem-based: grows with the root type scale */
  width: min(100%, 92vw);
  border: 1px solid var(--line);
  padding: 2.4rem 2.2rem;
  background: var(--surface);
  backdrop-filter: blur(7px);
  opacity: 0;
  transform: translateY(60px) scale(0.97);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}
.card.in-view { opacity: 1; transform: none; }

/* Wider still on very large displays */
@media (min-width: 2000px) {
  .card { max-width: 48rem; }
  .hero-content { width: min(40rem, 82vw); }
}

.drift { will-change: transform; }

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.9rem;
  margin-bottom: 1.4rem;
}

.card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 1.3rem 0 0.3rem;
}
.card h3:first-of-type { margin-top: 0; }

.card p, .card li { font-size: 0.92rem; line-height: 1.65; color: var(--fg-dim); }

.card ul { list-style: none; }
.card li { padding-left: 1.1em; position: relative; }
.card li::before { content: "—"; position: absolute; left: 0; color: var(--fg-faint); }

.meta {
  font-size: 0.72rem !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint) !important;
  margin-bottom: 0.4rem;
}

.card a { color: var(--fg); }

/* ---------- Projects: hoverable sub-cards + tech chips ---------- */

.project {
  border: 1px solid var(--line-soft);
  padding: 1.4rem 1.3rem;
  margin-top: 1.4rem;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.35s ease, background 0.35s ease;
}
.project:hover {
  transform: translateY(-5px);
  border-color: var(--line);
  background: var(--hover-soft);
}
.project h3 { margin-top: 0; }

.chips { margin-top: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips span {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-indent: 0.15em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border: 1px solid var(--line-soft);
  padding: 0.3rem 0.55rem;
}

.ghost-link {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.7rem 1.4rem;
  margin-top: 1.5rem;
  transition: background 0.25s ease;
}
.ghost-link:hover, .ghost-link:focus-visible { background: var(--hover); outline: none; }

/* ---------- Skills: line meters that draw in on reveal ---------- */

.skill { margin: 0.9rem 0; }
.skill-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.35rem;
}
.skill-name {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.skill-note {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-align: right;
}
.meter { height: 2px; background: var(--track); overflow: hidden; }
.meter i {
  display: block;
  height: 100%;
  background: var(--line);
  transform: scaleX(0);
  transform-origin: left;
}
.card.in-view .meter i {
  transform: scaleX(var(--w));
  transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}
.card.in-view .skill:nth-of-type(2) .meter i { transition-delay: 0.12s; }
.card.in-view .skill:nth-of-type(3) .meter i { transition-delay: 0.24s; }
.card.in-view .skill:nth-of-type(4) .meter i { transition-delay: 0.36s; }

/* ---------- Timeline (Experience & Education) ---------- */

.timeline { position: relative; padding-left: 28px; margin-top: 0.4rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--line-soft);
}
.tl-item { position: relative; margin-top: 1.5rem; }
.tl-item:first-child { margin-top: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 0.35em;
  width: 9px;
  height: 9px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--dot-bg);
}
.tl-item h3 { margin: 0 0 0.3rem; }

.tl-item { opacity: 0; transform: translateY(14px); }
.card.in-view .tl-item {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.card.in-view .tl-item:nth-child(2) { transition-delay: 0.15s; }
.card.in-view .tl-item:nth-child(3) { transition-delay: 0.30s; }
.card.in-view .tl-item:nth-child(4) { transition-delay: 0.45s; }

/* ---------- Certification badges (Education) ---------- */

.badges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.badge {
  border: 1px solid var(--line);
  padding: 1rem 0.8rem;
  text-align: center;
  transition: background 0.3s ease, transform 0.3s ease;
}
.badge:hover { background: var(--hover-soft); transform: translateY(-3px); }
.badge strong {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.badge span {
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.badge.pending { border-style: dashed; }

/* ---------- Footer ---------- */

footer {
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* ============================================================
   Breakpoints
   <=400   small phones   — compact avatars
   <=640   phones         — vertical hero nav, stacked skill rows
   <=900   tablets        — tighter nav + section padding
   >=2000  ultrawide      — wider column & cards (see below)
   ============================================================ */

/* ---------- Tablets ---------- */

@media (max-width: 900px) {
  nav.hero-nav a { padding: 0.95rem 1.15rem; }
  section { padding: 4.5rem 1rem; }
}

/* ---------- Phones ---------- */

@media (max-width: 640px) {
  h1 { white-space: normal; }
  body.is-preload h1 { letter-spacing: var(--tracking); text-indent: var(--tracking); }

  /* Compact the vertical rhythm so hero fits shorter viewports */
  .stem { height: 38px; }
  h1 { margin: 1.6rem 0 1rem; }
  .tagline { margin-bottom: 1.8rem; }

  /* Hero nav: horizontal -> vertical stack. Borders rotate with it:
     the left dividers become top dividers. */
  nav.hero-nav { flex-direction: column; width: 100%; }
  nav.hero-nav a {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 0.95rem 1rem;
    text-align: center;
  }
  nav.hero-nav a:first-child { border-top: 0; }

  .card { padding: 1.6rem 1.3rem; }
  section { padding: 3.5rem 1rem; }

  /* Skill name + note read better stacked than squeezed side-by-side */
  .skill-row { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
  .skill-note { text-align: left; }

  .topbar { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
}

/* ---------- Small phones ---------- */

@media (max-width: 400px) {
  .avatar { width: 72px; height: 72px; }
  .avatar svg { width: 34px; height: 34px; }
  .avatar.linkedin svg { width: 28px; height: 28px; }
  .avatar.brand { width: 84px; height: 84px; }
  .avatar.brand img { width: 38px; }
  .socials { gap: 0.9rem; }
}

/* ---------- Intro / preload sequence ---------- */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--veil);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
  z-index: 60;
}
body.is-preload::after { opacity: 1; transition: none; }

.avatar        { transition: opacity 0.7s ease 0.30s, transform 0.7s ease 0.30s, background 0.25s ease; }
.stem-top      { transform-origin: top;    transition: transform 0.45s ease 0.85s; }
.bar-top       { transform-origin: center; transition: transform 0.55s ease 1.10s; }
h1             { transition: opacity 0.9s ease 1.30s, letter-spacing 0.9s ease 1.30s, text-indent 0.9s ease 1.30s; }
.tagline       { transition: opacity 0.7s ease 1.75s; }
.bar-bottom    { transform-origin: center; transition: transform 0.55s ease 1.95s; }
.stem-bottom   { transform-origin: top;    transition: transform 0.45s ease 2.20s; }
nav.hero-nav   { transition: opacity 0.7s ease 2.45s, transform 0.7s ease 2.45s; }
.scroll-hint   { transition: opacity 0.7s ease 2.80s; }

body.is-preload .avatar      { opacity: 0; transform: translateY(-14px); }
body.is-preload .stem-top,
body.is-preload .stem-bottom { transform: scaleY(0); }
body.is-preload .bar-top,
body.is-preload .bar-bottom  { transform: scaleX(0); }
body.is-preload h1           { opacity: 0; letter-spacing: 0.6em; text-indent: 0.6em; }
body.is-preload .tagline     { opacity: 0; }
body.is-preload nav.hero-nav { opacity: 0; transform: translateY(12px); }
body.is-preload .scroll-hint { opacity: 0; animation: none; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::after, .avatar, .stem-top, .bar-top, h1, .tagline,
  .bar-bottom, .stem-bottom, nav.hero-nav, .scroll-hint,
  .card, .topbar, .project, .meter i, .tl-item, .badge { transition: none; }
  .scroll-hint { animation: none; }
  .card { opacity: 1; transform: none; }
  .meter i { transform: scaleX(var(--w)); }
  .tl-item { opacity: 1; transform: none; }
}
