/* ============================================================
   Ape's Console — reimagined portfolio (standalone prototype)
   ============================================================ */

:root {
  --bg:        #0a0a0b;
  --bg-2:      #101013;
  --bg-3:      #16161a;
  --surface:   #1b1b20;
  --line:      rgba(255, 255, 255, 0.08);
  --line-2:    rgba(255, 255, 255, 0.14);
  --text:      #ece9e4;
  --muted:     #9a978f;
  --faint:     #6b6862;
  --grad:      linear-gradient(120deg, #a855f7, #ec4899);
  --grad-soft: linear-gradient(120deg, rgba(168,85,247,.18), rgba(236,72,153,.18));
  --serif: "Archivo", system-ui, sans-serif;   /* display grotesque */
  --sans:  "Inter", system-ui, -apple-system, sans-serif;
  --mono:  "Space Mono", ui-monospace, "Courier New", monospace;
  --maxw: 1280px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

::selection { background: rgba(236, 72, 153, .35); color: #fff; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--grad); z-index: 200; transition: width .1s linear;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background .4s var(--ease), border-color .4s var(--ease), backdrop-filter .4s;
  border-bottom: 1px solid transparent;
  /* readability scrim so nav stays legible over the bright hero */
  background: linear-gradient(180deg, rgba(6,6,8,.78) 0%, rgba(6,6,8,.32) 60%, rgba(6,6,8,0) 100%);
}
.site-header.scrolled {
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 18px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-badge {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--grad);
  display: grid; place-items: center;
  font-weight: 600; color: #fff; font-size: 1.1rem;
  box-shadow: 0 6px 22px rgba(168, 85, 247, .35);
}
.brand-name {
  font-family: var(--mono); font-size: .82rem;
  letter-spacing: .32em; font-weight: 500;
}

.nav-desktop { display: flex; gap: 6px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 0;
  font-size: .9rem; font-weight: 500; color: rgba(236, 233, 228, 0.88);
  transition: color .3s var(--ease), background .3s var(--ease);
  position: relative;
}
.nav-link:hover { color: #fff; background: var(--grad-soft); }
.nav-ico { font-size: .8rem; opacity: .8; }

.menu-btn {
  display: none; background: none; border: 1px solid var(--line-2);
  color: var(--text); border-radius: 0; padding: 7px; cursor: pointer;
}

.nav-mobile {
  display: none; flex-direction: column; gap: 4px;
  padding: 12px 20px 20px;
  background: rgba(10, 10, 11, 0.95);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-mobile.open { display: flex; }
.nav-mobile .nav-link { padding: 12px 14px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; height: 100svh; min-height: 620px;
  display: flex; align-items: center;
  overflow: hidden;
}
.hero-media {
  position: absolute; inset: 0; overflow: hidden; z-index: 0;
  transform: scale(1.06);
  animation: heroZoom 18s var(--ease) forwards;
  background: #0a0a0a;
}
@keyframes heroZoom { to { transform: scale(1); } }

/* animated "inked → painted" portrait strip */
.hero-strip { position: absolute; inset: 0; display: flex; gap: 2px; }
.hero-panel { position: relative; flex: 1 1 0; overflow: hidden; background: #0a0a0a; }
.hero-panel .layer {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 38%; will-change: transform;
}
.hero-panel .ink { filter: grayscale(1) contrast(1.07) brightness(.98); }
.hero-panel .colour {
  -webkit-mask-image: linear-gradient(100deg, #000 var(--a,0%), transparent var(--b,8%));
          mask-image: linear-gradient(100deg, #000 var(--a,0%), transparent var(--b,8%));
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.hero-panel .swap {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 38%;
  opacity: 0; transition: opacity .8s var(--ease); z-index: 3;
}
@keyframes heroKb { 0%{transform:scale(1.05) translate(0,0)} 50%{transform:scale(1.11) translate(-1.2%,-1%)} 100%{transform:scale(1.05) translate(0,0)} }
.hero-strip.kb .hero-panel .layer { animation: heroKb 16s var(--ease) infinite; animation-delay: calc(var(--i) * -2.2s); }
.hero-sheen {
  position: absolute; top: 0; bottom: 0; width: 80px; z-index: 1; pointer-events: none;
  transform: translateX(-120px);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.14) 45%, rgba(255,255,255,.24) 50%, rgba(255,255,255,.14) 55%, transparent);
  mix-blend-mode: soft-light; opacity: 0; transition: opacity .3s linear;
}
@media (prefers-reduced-motion: reduce) {
  .hero-media { animation: none; transform: none; }
  .hero-sheen { display: none; }
  .hero-strip.kb .hero-panel .layer { animation: none; }
}
.hero-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,10,11,.55) 0%, rgba(10,10,11,.2) 35%, rgba(10,10,11,.85) 100%),
    radial-gradient(60% 60% at 20% 80%, rgba(168,85,247,.22), transparent 70%);
}
/* v2: banner starts dark; black vertical strips fling away horizontally
   (random direction + speed) and fade, dramatically exposing the background */
.hero-reveal {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: #000; overflow: hidden;
}
.reveal-strip {
  position: absolute; top: -2%; bottom: -2%;
  background: #000; will-change: transform, opacity;
}
@media (prefers-reduced-motion: reduce) {
  .hero-reveal { display: none; }
}
.hero-content {
  position: relative; z-index: 2;
  max-width: var(--maxw); width: 100%; margin: 0 auto;
  padding: 0 28px;
}
.hero-kicker {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .18em;
  color: rgba(245, 240, 236, 0.92); margin-bottom: 22px; text-transform: uppercase;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.65);
}
.hero-title {
  font-family: var(--serif); font-weight: 900; text-transform: uppercase;
  font-size: clamp(3rem, 10vw, 8rem); line-height: .9;
  letter-spacing: -.02em;
  text-shadow: 0 12px 60px rgba(0,0,0,.5);
}
/* v3: title splits into 3 segments that drift vertically as you scroll */
.hero-seg { display: inline-block; will-change: transform; }
.hero-sub {
  margin-top: 26px; max-width: 46ch;
  font-size: clamp(1rem, 1.6vw, 1.2rem); color: #d7d3cc;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 34px; padding: 14px 26px; border-radius: 0;
  background: var(--grad); color: #fff; font-weight: 500; font-size: .95rem;
  box-shadow: 0 10px 34px rgba(236, 72, 153, .3);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 16px 44px rgba(236, 72, 153, .45); }
.hero-cta span { transition: transform .3s var(--ease); }
.hero-cta:hover span { transform: translateX(4px); }

.hero-scroll {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%);
  width: 26px; height: 42px; border: 1px solid var(--line-2); border-radius: 14px;
  display: grid; place-items: start center; padding-top: 7px; z-index: 2;
}
.hero-scroll-dot {
  width: 4px; height: 8px; border-radius: 2px; background: var(--text);
  animation: scrollDot 1.6s var(--ease) infinite;
}
@keyframes scrollDot { 0%{opacity:0;transform:translateY(0)} 30%{opacity:1} 100%{opacity:0;transform:translateY(14px)} }

.hero-controls {
  position: absolute; right: 28px; bottom: 28px; z-index: 3;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}
.hero-ctrl {
  font-family: var(--mono); font-size: .76rem; color: var(--text);
  background: rgba(10, 10, 11, 0.5); border: 1px solid var(--line-2);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 8px 14px; border-radius: 0; cursor: pointer;
  transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.hero-ctrl:hover { color: #fff; border-color: #b476f0; background: rgba(168,85,247,.14); }
.hero-ctrl.is-on { color: #e9c2ff; border-color: rgba(180, 118, 240, 0.5); }
@media (max-width: 560px) {
  .hero-controls { right: 16px; bottom: 16px; }
  .hero-ctrl { font-size: .7rem; padding: 7px 11px; }
}

/* ---------- Section scaffold ---------- */
.section {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(72px, 11vw, 140px) 28px;
  scroll-margin-top: 84px;
}
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 44px; flex-wrap: wrap;
}
.eyebrow {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .22em;
  text-transform: uppercase; color: #b476f0; margin-bottom: 14px;
}
.section-title {
  font-family: var(--serif); font-weight: 800; text-transform: uppercase;
  font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.02; letter-spacing: -.015em;
}
.showing {
  font-family: var(--mono); font-size: .8rem; color: var(--muted);
  display: flex; align-items: baseline; gap: 8px;
}
.showing-cat { color: var(--text); }
.showing-count { color: var(--faint); }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px; }
.filter-pill {
  padding: 9px 20px; border-radius: 0; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent;
  color: var(--muted); font-family: var(--sans); font-size: .86rem;
  transition: color .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease), transform .2s var(--ease);
}
.filter-pill:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-1px); }
.filter-pill.active {
  background: var(--grad); border-color: transparent; color: #fff; font-weight: 500;
  box-shadow: 0 8px 22px rgba(168, 85, 247, .28);
}

/* ---------- Masonry gallery ---------- */
.masonry { columns: 3; column-gap: 16px; }
@media (max-width: 900px) { .masonry { columns: 2; } }
@media (max-width: 560px) { .masonry { columns: 1; } }

.tile {
  position: relative; break-inside: avoid; margin-bottom: 16px;
  border-radius: 0; overflow: hidden; cursor: pointer;
  background: var(--bg-3);
  opacity: 0; transform: translateY(18px);
  transition: transform .5s var(--ease), opacity .5s var(--ease), box-shadow .4s var(--ease);
}
.tile.in { opacity: 1; transform: none; }
.tile img {
  width: 100%; height: auto; display: block;
  transition: transform .6s var(--ease), filter .5s var(--ease);
  filter: saturate(.92);
}
.tile::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(10,10,11,.55));
  opacity: 0; transition: opacity .4s var(--ease);
}
.tile:hover { box-shadow: 0 22px 50px rgba(0, 0, 0, .5); }
.tile:hover img { transform: scale(1.06); filter: saturate(1.05); }
.tile:hover::after { opacity: 1; }
.tile-num {
  position: absolute; left: 12px; bottom: 10px; z-index: 2;
  font-family: var(--mono); font-size: .72rem; color: #fff;
  opacity: 0; transform: translateY(6px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.tile:hover .tile-num { opacity: .9; transform: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(6, 6, 8, 0); backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px);
  display: flex; align-items: center; justify-content: center; padding: 4vw;
  opacity: 0; pointer-events: none;
  transition: opacity .5s var(--ease), background .6s var(--ease), backdrop-filter .6s var(--ease);
}
.lightbox.open {
  opacity: 1; pointer-events: auto;
  background: rgba(6, 6, 8, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.lb-figure {
  max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; align-items: center; gap: 12px;
  opacity: 0; transform: scale(.9) translateY(18px); transform-origin: center;
  transition: opacity .55s var(--ease), transform .6s var(--ease);
  will-change: transform, opacity;
}
.lightbox.open .lb-figure { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .lightbox, .lb-figure { transition-duration: .01ms; }
  .lb-figure { transform: none; }
}
.lb-img {
  max-width: 92vw; max-height: 82vh; width: auto; height: auto;
  border-radius: 0; box-shadow: 0 30px 80px rgba(0,0,0,.6);
  object-fit: contain;
}
.lb-caption { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.lb-close, .lb-nav {
  position: absolute; z-index: 2; background: rgba(255,255,255,.06); border: 1px solid var(--line-2);
  color: var(--text); cursor: pointer; border-radius: 0;
  display: grid; place-items: center; transition: background .3s var(--ease), transform .2s var(--ease);
}
.lb-close { top: 22px; right: 24px; width: 46px; height: 46px; font-size: 1.6rem; line-height: 1; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 54px; height: 54px; font-size: 2rem; line-height: 1; }
.lb-prev { left: 20px; } .lb-next { right: 20px; }
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.16); }
.lb-nav:hover { transform: translateY(-50%) scale(1.06); }

/* ---------- Videos ---------- */
.videos { background: linear-gradient(180deg, transparent, rgba(255,255,255,.015)); }
.video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 40px; }
@media (max-width: 860px) { .video-grid { grid-template-columns: 1fr; } }
.video-frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.4);
  background: #000;
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-title { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; margin: 22px 0 10px; }
.video-desc { color: var(--muted); font-size: .98rem; line-height: 1.75; }

/* ---------- About ---------- */
.about { border-top: 1px solid var(--line); }
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: start; }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; gap: 40px; } }
.about-text .section-title { margin-bottom: 26px; }
.body-p { color: #c9c5bd; font-size: 1.02rem; line-height: 1.85; margin-bottom: 22px; }
.body-p strong { color: var(--text); font-weight: 600; letter-spacing: .02em; }
.about-media { position: sticky; top: 100px; }
.about-media img {
  width: 100%; height: auto; border-radius: 0; border: 1px solid var(--line);
  box-shadow: 0 26px 60px rgba(0,0,0,.5);
  filter: grayscale(.15);
}

/* ---------- Contact ---------- */
.contact {
  max-width: none; margin: 0;
  background:
    radial-gradient(70% 90% at 85% 10%, rgba(168,85,247,.14), transparent 60%),
    var(--bg-2);
  border-top: 1px solid var(--line);
}
.contact-inner { max-width: var(--maxw); margin: 0 auto; position: relative; }
.contact-left .section-title { margin-bottom: 34px; }
.contact-list { list-style: none; display: flex; flex-direction: column; gap: 20px; max-width: 640px; }
.contact-row { display: flex; align-items: center; gap: 16px; }
.contact-row a {
  color: #d3cfc7; font-size: 1.02rem;
  transition: color .3s var(--ease); position: relative;
}
.contact-row a:hover { color: #fff; }
.contact-ico {
  flex: none; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 600; font-size: .95rem;
  border: 1px solid var(--line-2); font-family: var(--mono);
}
.ico-google   { color: #f26d5b; }
.ico-insta    { color: #ec4899; }
.ico-github   { color: #e6e6e6; }
.ico-linkedin { color: #4a9df0; font-size: .8rem; }
.contact-watermark {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0;
  font-family: var(--mono); font-weight: 500; letter-spacing: .3em;
  font-size: clamp(1rem, 3vw, 2rem); color: rgba(255,255,255,.16);
  pointer-events: none;
  opacity: .12;   /* resolves toward full as the segments assemble at the footer */
}
/* v3: the 3 vertical segments stack into ONE column (APESCONSOLE),
   scattered while scrolling and converging seamlessly at the footer */
.wm-seg { writing-mode: vertical-rl; display: block; will-change: transform; }
@media (max-width: 720px) { .contact-watermark { display: none; } }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-family: var(--mono); font-size: .82rem; color: #34d399;
  padding: 22px 28px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px; text-align: center;
}
.foot-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dim { color: var(--faint); }
.accent-purple { color: #b476f0; }
.accent-blue { color: #4a9df0; transition: color .3s var(--ease); }
.accent-blue:hover { color: #fff; }

/* ---------- Responsive header ---------- */
@media (max-width: 800px) {
  .nav-desktop { display: none; }
  .menu-btn { display: inline-flex; }
}

/* ============================================================
   Responsive refinements — phones, tablets, short & large screens
   ============================================================ */

/* Tablets */
@media (max-width: 1024px) {
  .header-inner { padding: 16px 22px; }
  .about-grid { gap: 40px; }
}

/* Collapse sticky portrait once About stacks to one column */
@media (max-width: 900px) {
  .about-media { position: static; top: auto; }
  .about-media img { max-width: 520px; margin: 0 auto; }
}

/* Phones */
@media (max-width: 640px) {
  .header-inner { padding: 13px 16px; gap: 12px; }
  .brand-badge { width: 34px; height: 34px; font-size: 1rem; }
  .brand-name { font-size: .72rem; letter-spacing: .2em; }

  .hero { min-height: 560px; }
  .hero-content { padding: 0 20px; }
  .hero-kicker { margin-bottom: 16px; font-size: .72rem; letter-spacing: .14em; }
  .hero-title { font-size: clamp(2.4rem, 13vw, 4.2rem); }
  .hero-sub { margin-top: 18px; }
  .hero-cta { margin-top: 26px; padding: 12px 20px; }

  .section { padding: clamp(52px, 15vw, 90px) 20px; }
  .section-head { margin-bottom: 30px; gap: 16px; }
  .filters { gap: 8px; margin-bottom: 30px; }

  .lb-close { top: 12px; right: 12px; width: 40px; height: 40px; font-size: 1.4rem; }
  .lb-nav { width: 42px; height: 42px; font-size: 1.5rem; }
  .lb-prev { left: 10px; } .lb-next { right: 10px; }

  .site-footer { padding: 20px 16px; }
}

/* Very small phones: hide the scroll cue so it can't collide with the controls */
@media (max-width: 480px) {
  .hero-scroll { display: none; }
  .hero-controls { left: 16px; right: 16px; bottom: 14px; justify-content: center; }
}

/* Short / landscape screens: don't force a tall hero */
@media (max-height: 620px) {
  .hero { min-height: 440px; }
  .hero-scroll { display: none; }
}

/* Large screens: give the content a touch more room */
@media (min-width: 1700px) {
  :root { --maxw: 1440px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .tile { opacity: 1; transform: none; }
}
