/* ============================================================
   Victor Odunsi - portfolio
   Tokens and rationale live in DESIGN.md
   ============================================================ */

:root {
  --ink:          #07070C;
  --ink-raised:   #0D0D15;
  --gold:         #D9B36C;
  --gold-bright:  #F0D493;
  --cream:        #ECE7DD;
  --muted:        #8E8A7C;
  --line:         rgba(217, 179, 108, 0.14);
  --line-soft:    rgba(236, 231, 221, 0.08);

  --display: "Sora", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --sans:    "Manrope", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  /* Shared so the first section head lines up with the rail eyebrow */
  --top-pad: clamp(64px, 10vh, 104px);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Faint ruled grid over the ground, borrowed from the reference atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 20%, transparent 100%);
  opacity: 0.5;
}

img { max-width: 100%; display: block; }

a { color: var(--gold); text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--gold);
  color: var(--ink);
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 13px;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------- Background layers ---------- */

#field {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
}

#glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle closest-side,
              rgba(217, 179, 108, 0.10),
              rgba(217, 179, 108, 0.04) 45%,
              transparent 70%);
  transition: opacity 500ms var(--ease);
  will-change: transform;
}

/* ---------- Shell ---------- */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(22px, 5vw, 80px);
}

@media (min-width: 1024px) {
  .shell {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(40px, 6vw, 96px);
  }
}

/* ---------- Left rail ---------- */

.rail {
  padding: var(--top-pad) 0 40px;
}

@media (min-width: 1024px) {
  .rail {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: clamp(48px, 8vh, 80px);
  }
}

.portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 0 26px;
  border: 1px solid var(--line);
  box-shadow: 0 0 0 4px rgba(217, 179, 108, 0.05), 0 10px 30px rgba(0, 0, 0, 0.5);
  filter: saturate(0.88);
  transition: filter 320ms var(--ease), box-shadow 320ms var(--ease);
}
.portrait:hover {
  filter: none;
  box-shadow: 0 0 0 4px rgba(217, 179, 108, 0.14), 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* The rail is a fixed 100vh column, so on short laptop screens the portrait
   would push the socials off the bottom. Shrink it back instead. */
@media (min-width: 1024px) and (max-height: 820px) {
  .portrait { width: 58px; height: 58px; margin-bottom: 18px; }
  .nav { margin-top: 34px; }
  .nav a { padding: 8px 0; }
}

.eyebrow {
  margin: 0 0 22px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.name {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  /* Smaller than the serif was: bold geometric sans carries far more weight
     per pixel, so matching the old size would shout. */
  font-size: clamp(42px, 6.2vw, 62px);
  line-height: 0.94;
  letter-spacing: -0.04em;
  color: var(--cream);
}

.role {
  margin: 18px 0 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--cream);
}

.tagline {
  margin: 14px 0 0;
  max-width: 34ch;
  font-size: 15px;
  color: var(--muted);
}

/* ---------- Nav ---------- */

.nav { margin-top: 52px; display: none; }
@media (min-width: 1024px) { .nav { display: block; } }

.nav ul { list-style: none; margin: 0; padding: 0; }

.nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  color: var(--muted);
  transition: color 220ms var(--ease);
}

.nav .rule {
  display: block;
  width: 32px;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
  transition: width 240ms var(--ease), opacity 240ms var(--ease);
}

.nav .label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav a:hover,
.nav a:focus-visible { color: var(--cream); }
.nav a:hover .rule,
.nav a:focus-visible .rule { width: 62px; opacity: 1; }

.nav a.active { color: var(--gold); }
.nav a.active .rule { width: 62px; opacity: 1; }

/* ---------- Socials ---------- */

.socials {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 44px 0 0;
  padding: 0;
}

@media (min-width: 1024px) { .socials { margin-top: 0; } }

.socials a {
  color: var(--muted);
  display: block;
  transition: color 200ms var(--ease), transform 200ms var(--ease);
}
.socials a:hover { color: var(--gold); transform: translateY(-2px); }

/* ---------- Sections ---------- */

.section { padding: 0 0 clamp(80px, 12vh, 128px); }
@media (min-width: 1024px) { .section:first-child { padding-top: var(--top-pad); } }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-head .index {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(25px, 3.6vw, 33px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--cream);
}

/* Mobile gets a sticky section label so you never lose your place */
@media (max-width: 1023px) {
  .section-head {
    position: sticky;
    top: 0;
    z-index: 5;
    margin-inline: calc(clamp(22px, 5vw, 80px) * -1);
    padding-inline: clamp(22px, 5vw, 80px);
    padding-top: 14px;
    background: rgba(7, 7, 12, 0.86);
    backdrop-filter: blur(8px);
  }
}

.prose p { margin: 0 0 18px; max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }
.prose em {
  font-style: normal;
  color: var(--cream);
}

/* ---------- Projects ---------- */

.projects { list-style: none; margin: 0; padding: 0; }

.project {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 22px;
  margin: 0 0 12px -22px;
  width: calc(100% + 44px);
  border: 1px solid transparent;
  border-radius: 6px;
  transition: opacity 260ms var(--ease),
              background-color 260ms var(--ease),
              border-color 260ms var(--ease),
              transform 260ms var(--ease);
}

@media (min-width: 640px) {
  .project { grid-template-columns: 190px minmax(0, 1fr); gap: 26px; }
}

/* The hovered row is the only lit one */
@media (hover: hover) and (min-width: 640px) {
  .projects:hover .project { opacity: 0.42; }
  .projects .project:hover,
  .projects .project:focus-within { opacity: 1; }
}

.project:hover,
.project:focus-within {
  background: var(--ink-raised);
  border-color: var(--line);
  transform: translateY(-2px);
}

/* Full-card click target, sits under the real links */
.project-link { position: absolute; inset: 0; z-index: 1; border-radius: 6px; }

.thumb {
  /* Hug the image. Without this the grid stretches the bordered box to the
     full row height and leaves a tall empty well under short thumbnails. */
  align-self: start;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ink-raised);
}
.thumb img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
  height: auto;
  opacity: 0.72;
  transition: opacity 320ms var(--ease), transform 500ms var(--ease);
}
.project:hover .thumb img,
.project:focus-within .thumb img { opacity: 1; transform: scale(1.03); }

.project-body h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--cream);
  transition: color 200ms var(--ease);
}
.project:hover .project-body h3,
.project:focus-within .project-body h3 { color: var(--gold); }

.arrow {
  display: inline-block;
  margin-left: 8px;
  font-size: 16px;
  transition: transform 220ms var(--ease);
}
.project:hover .arrow { transform: translate(3px, -3px); }

.flag {
  margin: 4px 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}

.project-body p { margin: 0 0 14px; font-size: 15px; }

/* ---------- Tags ---------- */

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
}

.tags li {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--gold);
  background: rgba(217, 179, 108, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
}

.links {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 20px;
  margin: 14px 0 0 !important;
}
.links a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}
.links a:hover { color: var(--gold-bright); border-color: var(--gold-bright); }

/* ---------- Skills ---------- */

.skills { display: grid; gap: 26px; }

.skill-group h3 {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream);
}

/* ---------- Contact ---------- */

.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px !important; }

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 13px 24px;
  border: 1px solid var(--gold);
  border-radius: 3px;
  color: var(--gold);
  transition: background-color 220ms var(--ease), color 220ms var(--ease);
}
.btn:hover { background: var(--gold); color: var(--ink); }
.btn.ghost { border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { background: transparent; border-color: var(--gold); color: var(--gold); }

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

.foot {
  margin-top: clamp(64px, 10vh, 96px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.foot p {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  opacity: 0.75;
}

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 620ms var(--ease), transform 620ms var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

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

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

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal { opacity: 1; transform: none; }
  #glow { display: none; }
  .project:hover { transform: none; }
  .thumb img { opacity: 0.92; }
}
