/* ============================================================
   Morne Du Plooy - Portfolio
   ============================================================ */

:root {
  --bg: #1a1a1a;          /* warm near-black */
  --bg-soft: #202020;
  --fg: #f4f4f2;
  --muted: #8f8f8a;
  --line: #2c2c2c;
  --accent: #f5a623;      /* amber / orange accent */
  --font-display: "Montserrat", system-ui, sans-serif;
  --font-mono: "Montserrat", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---- Animated ambient background (drifting glows + scroll parallax) ---- */
.bg-anim {
  position: fixed;
  inset: -20%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(calc(var(--scrollY, 0px) * 0.05));
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}
.b1 {
  width: 55vmax; height: 55vmax;
  top: -14%; left: -8%;
  opacity: .16;
  background: radial-gradient(circle, #f5a623, transparent 62%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.b2 {
  width: 48vmax; height: 48vmax;
  bottom: -16%; right: -6%;
  opacity: .14;
  background: radial-gradient(circle, #2f6df6, transparent 62%);
  animation: drift2 32s ease-in-out infinite alternate;
}
.b3 {
  width: 42vmax; height: 42vmax;
  top: 38%; left: 45%;
  opacity: .10;
  background: radial-gradient(circle, #ff7a45, transparent 62%);
  animation: drift3 29s ease-in-out infinite alternate;
}
@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(12vw, 8vh) scale(1.15); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-10vw, -7vh) scale(1.1); }
}
@keyframes drift3 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-9vw, 9vh) scale(1.2); }
}

/* ---- Grain / noise overlay ---- */
.noise {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Custom cursor (desktop only) ---- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 32px; height: 32px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width .25s var(--ease), height .25s var(--ease), background .25s var(--ease);
  mix-blend-mode: difference;
  display: none;
}
.cursor.hover { width: 56px; height: 56px; background: rgba(230,255,58,.15); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem clamp(1.2rem, 4vw, 3rem);
  mix-blend-mode: difference;
}
.brand {
  font-weight: 800;
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: .02em;
  color: var(--fg);
}
.nav { display: flex; gap: 2.6rem; }
.nav a {
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--fg);
  transition: color .2s var(--ease);
}
.nav a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .nav { display: none; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem clamp(1.2rem, 4vw, 3rem);
  position: relative;
}
.hero-inner {
  width: min(900px, 100%);
}
.hero-greet {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-bottom: 1.4rem;
}
.hero-greet span:first-child {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .04em;
  white-space: nowrap;
}
.hero-greet .rule {
  flex: 1;
  height: 2px;
  background: var(--accent);
}
.hero-name {
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.hero-role {
  margin-top: 1rem;
  text-align: right;
  font-size: clamp(1.1rem, 2.4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* stacked social icons, lower-left */
.hero-socials {
  position: absolute;
  left: clamp(1.2rem, 3vw, 2.4rem);
  bottom: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.hero-socials a {
  color: var(--muted);
  transition: color .2s var(--ease), transform .2s var(--ease);
  display: inline-flex;
}
.hero-socials a:hover { color: var(--accent); transform: translateY(-2px); }

/* vertical "Scroll", lower-right */
.scroll-cue {
  position: absolute;
  right: clamp(.6rem, 2vw, 1.6rem);
  bottom: 3.5rem;
  writing-mode: vertical-rl;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .25em;
  color: var(--muted);
  transition: color .2s var(--ease);
}
.scroll-cue:hover { color: var(--fg); }

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee-wrap {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 1.4rem 0;
}
.marquee {
  display: flex;
  white-space: nowrap;
  width: max-content;
  animation: scroll-x 22s linear infinite;
}
.marquee span {
  position: relative;
  font-size: clamp(2rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1px var(--muted);
  animation: glitch-skew 5s infinite;
}
/* chromatic RGB-split glitch layers */
.marquee span::before,
.marquee span::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  mix-blend-mode: screen;
  pointer-events: none;
}
.marquee span::before {
  -webkit-text-stroke: 1px #f5a623;
  animation: glitch-a 2.6s infinite linear alternate-reverse;
}
.marquee span::after {
  -webkit-text-stroke: 1px #3ad2ff;
  animation: glitch-b 3.4s infinite linear alternate-reverse;
}
@keyframes scroll-x { to { transform: translateX(-33.33%); } }

@keyframes glitch-a {
  0%   { clip-path: inset(0 0 85% 0);   transform: translate(-3px, -2px); }
  15%  { clip-path: inset(30% 0 50% 0); transform: translate(3px, 1px); }
  30%  { clip-path: inset(10% 0 70% 0); transform: translate(-4px, 0); }
  45%  { clip-path: inset(55% 0 20% 0); transform: translate(2px, 2px); }
  60%  { clip-path: inset(20% 0 60% 0); transform: translate(-2px, -1px); }
  75%  { clip-path: inset(70% 0 10% 0); transform: translate(4px, 1px); }
  100% { clip-path: inset(40% 0 40% 0); transform: translate(-3px, 0); }
}
@keyframes glitch-b {
  0%   { clip-path: inset(70% 0 10% 0); transform: translate(3px, 2px); }
  20%  { clip-path: inset(15% 0 60% 0); transform: translate(-3px, -1px); }
  40%  { clip-path: inset(45% 0 30% 0); transform: translate(2px, 1px); }
  60%  { clip-path: inset(5% 0 80% 0);  transform: translate(-4px, 0); }
  80%  { clip-path: inset(60% 0 25% 0); transform: translate(3px, -2px); }
  100% { clip-path: inset(25% 0 55% 0); transform: translate(-2px, 1px); }
}
/* occasional skew "jump" on the whole line */
@keyframes glitch-skew {
  0%, 86%, 100% { transform: none; }
  88% { transform: skewX(14deg) translateX(-3px); }
  90% { transform: skewX(-16deg) translateX(2px); }
  92% { transform: skewX(7deg); }
  95% { transform: skewX(-4deg) translateX(1px); }
}

/* ============================================================
   SECTIONS (shared)
   ============================================================ */
.section {
  padding: clamp(4rem, 10vw, 9rem) clamp(1.2rem, 4vw, 3rem);
  max-width: 1400px;
  margin: 0 auto;
}
.section-head { margin-bottom: 3.5rem; position: relative; }
.section-index {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--accent);
  letter-spacing: .1em;
}
.section-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: .6rem;
}
.section-title.big {
  font-size: clamp(2rem, 6vw, 5rem);
  line-height: 1.05;
  max-width: 16ch;
  text-transform: uppercase;
}
.section-sub {
  color: var(--muted);
  margin-top: 1rem;
  max-width: 48ch;
  font-size: 1rem;
}

/* ============================================================
   TECH STACK
   ============================================================ */
.stack.section { max-width: 1500px; }

/* experience badge (top-left) */
.exp-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 4rem;
}
.exp-num {
  font-size: clamp(3.5rem, 7vw, 5.5rem);
  font-weight: 800;
  color: var(--accent);
  line-height: .9;
  letter-spacing: -0.02em;
}
.exp-plus { font-size: .5em; vertical-align: super; }
.exp-text {
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 500;
  color: var(--fg);
  line-height: 1.25;
}

.stack-title {
  text-align: center;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 3rem;
}

/* columns cluster, centered like the reference */
.stack-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem 1rem;
}
.stack-col {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  width: 190px;
}
.stack-col h3 {
  text-align: center;
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: .3rem;
}
.stack-col ul { list-style: none; display: flex; flex-direction: column; gap: .7rem; }

/* individual tech chip - light pill, dark content (matches reference) */
.tech {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .9rem;
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 12px;
  background: #f3f3f1;
  font-size: .88rem;
  line-height: 1.2;
  color: #161616;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
}
.tech:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
}
.tech-ic {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}
.tech-ic img { width: 22px; height: 22px; object-fit: contain; }
.tech-mono {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: .6rem;
  font-weight: 700;
  color: #161616;
  border: 1px solid rgba(0, 0, 0, .4);
  border-radius: 5px;
  letter-spacing: -0.02em;
}
.tech-mono.aws {
  border: none;
  color: #232f3e;
  font-weight: 800;
  font-size: .72rem;
}

@media (max-width: 520px) {
  .stack-col { width: 100%; max-width: 320px; }
}

/* ============================================================
   WORK / PROJECTS
   ============================================================ */
.projects-head { text-align: center; margin-bottom: 3.5rem; }
.projects-kicker {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.projects-headline {
  font-size: clamp(1.8rem, 4.5vw, 3.4rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--muted);
  max-width: 20ch;
  margin: 0 auto;
}

.projects { display: flex; flex-direction: column; gap: 2.5rem; }
.projects[hidden] { display: none; }

/* Company / Personal toggle - sticks to bottom while scrolling the section */
.proj-toggle-row {
  position: sticky;
  bottom: 1.5rem;
  z-index: 50;
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
  pointer-events: none;
}
.proj-toggle {
  pointer-events: auto;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .7);
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  background: #232323;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.pt-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  padding: .55rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.pt-btn:hover { color: var(--fg); }
.pt-btn.active { background: var(--accent); color: #1a1a1a; }
.pt-btn.active:hover { color: #1a1a1a; }

.project {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(2rem, 4vw, 3.5rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, .02), transparent 60%);
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.project:hover { border-color: rgba(255, 255, 255, .22); transform: translateY(-3px); }

.project-open {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  color: var(--muted);
  display: inline-flex;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.project-open:hover { color: var(--accent); transform: translate(2px, -2px); }

.project-badge {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: .25rem .7rem;
}

.project-cat {
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.1rem;
}
.project-title {
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.project-rule {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--accent);
  margin: 1.3rem 0;
}
.project-desc {
  color: var(--muted);
  font-size: 1rem;
  max-width: 46ch;
}

/* ---- preview mockup (placeholder for a real screenshot) ---- */
.project-media { display: flex; justify-content: center; }
.project-shot {
  width: 100%;
  max-width: 560px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 30px 80px -20px color-mix(in srgb, var(--pc, #f5a623) 45%, transparent);
}
.media-mock {
  position: relative;
  width: 100%;
  max-width: 560px;
  border-radius: 14px;
  overflow: hidden;
  background: #0e0e0e;
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 30px 80px -20px color-mix(in srgb, var(--pc, #f5a623) 45%, transparent);
}
.mock-bar {
  display: flex;
  gap: .5rem;
  padding: .8rem 1rem;
  background: #151515;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.mock-bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a3a3a; }
.mock-bar span:first-child { background: #ff5f57; }
.mock-bar span:nth-child(2) { background: #febc2e; }
.mock-bar span:nth-child(3) { background: #28c840; }
.mock-body {
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--pc, #f5a623) 22%, #101010),
      color-mix(in srgb, var(--pc2, #ff7a45) 12%, #0c0c0c));
  position: relative;
}
/* abstract "content" per project so previews look distinct */
.mock-dash::before {
  content: "";
  position: absolute; inset: 12% 8%;
  background:
    linear-gradient(rgba(255,255,255,.9), rgba(255,255,255,.9)) 0 0 / 34% 14% no-repeat,
    linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)) 0 26% / 60% 8% no-repeat,
    linear-gradient(rgba(255,255,255,.6), rgba(255,255,255,.6)) 0 55% / 24% 45% no-repeat,
    linear-gradient(rgba(255,255,255,.6), rgba(255,255,255,.6)) 38% 55% / 24% 45% no-repeat,
    linear-gradient(rgba(255,255,255,.6), rgba(255,255,255,.6)) 76% 55% / 24% 45% no-repeat;
  border-radius: 6px;
}
.mock-chat::before {
  content: "";
  position: absolute; inset: 14% 10%;
  background:
    linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,.85)) 0 0 / 55% 16% no-repeat,
    linear-gradient(rgba(255,255,255,.4), rgba(255,255,255,.4)) 45% 30% / 55% 16% no-repeat,
    linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,.85)) 0 60% / 45% 16% no-repeat,
    linear-gradient(rgba(255,255,255,.4), rgba(255,255,255,.4)) 55% 82% / 45% 16% no-repeat;
  border-radius: 20px;
}
.mock-flow::before {
  content: "";
  position: absolute; inset: 18% 12%;
  background:
    linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,.85)) 0 40% / 22% 20% no-repeat,
    linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,.85)) 39% 40% / 22% 20% no-repeat,
    linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,.85)) 78% 40% / 22% 20% no-repeat,
    linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.3)) 22% 48% / 17% 4% no-repeat,
    linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.3)) 61% 48% / 17% 4% no-repeat;
  border-radius: 6px;
}
.mock-grid::before {
  content: "";
  position: absolute; inset: 12% 8%;
  background:
    linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7)) 0 0 / 30% 30% no-repeat,
    linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7)) 35% 0 / 30% 30% no-repeat,
    linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7)) 70% 0 / 30% 30% no-repeat,
    linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)) 0 40% / 30% 30% no-repeat,
    linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)) 35% 40% / 30% 30% no-repeat,
    linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)) 70% 40% / 30% 30% no-repeat,
    linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)) 0 80% / 30% 20% no-repeat,
    linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)) 35% 80% / 30% 20% no-repeat,
    linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)) 70% 80% / 30% 20% no-repeat;
  border-radius: 4px;
}

@media (max-width: 820px) {
  .project { grid-template-columns: 1fr; }
  .project-media { order: 2; }
  .project-text { order: 1; }
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.contact > * { margin: 0; }
.contact-eyebrow {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: .05em;
  margin-top: .8rem;
}
.contact-mail {
  display: block;
  max-width: 100%;
  font-size: clamp(2rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 1.5rem 0;
  color: var(--fg);
  transition: color .3s var(--ease);
  word-break: break-word;
}
.contact-mail:hover { color: var(--accent); }
.contact-note { color: var(--muted); font-family: var(--font-mono); font-size: .9rem; }
.contact-socials {
  margin-top: 2.5rem;
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}
.contact-socials a {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--muted);
  letter-spacing: .05em;
  padding-bottom: .2rem;
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.contact-socials a:hover { color: var(--fg); border-color: var(--accent); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 2rem clamp(1.2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .05em;
}
.site-footer > :first-child { justify-self: start; }
.site-footer > :nth-child(2) { justify-self: center; text-align: center; }
.site-footer > :last-child { justify-self: end; }
.site-footer .version { color: var(--accent); }

@media (max-width: 600px) {
  .site-footer { grid-template-columns: 1fr; text-align: center; }
  .site-footer > :first-child,
  .site-footer > :nth-child(2),
  .site-footer > :last-child { justify-self: center; }
}

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bg-anim { transform: none !important; }
  .marquee span::before, .marquee span::after { display: none; }
}
