@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital@0;1&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Work+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ================================================================
   1. EDIT THESE SETTINGS
   Main colours, sizes, spacing, and animation speeds live here.
   ================================================================ */
:root {
  --color-ink: #2a2b2f;
  --color-paper: #f9f9fa;
  --color-magenta: magenta;
  --color-blue: #000fff;
  --color-divider: #bebebf;
  --font-body: 'Work Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-pixel: 'Press Start 2P', cursive;
  --nav-height: 30px;
  --sidebar-width: 25%;
  --page-padding: 2rem;
  --carousel-gap: 3rem;
  --carousel-width: clamp(680px, 42vmin, 52rem);
  --bubble-size: 540px;
  --page-speed: 0.5s;
  --marquee-speed: 4s;
  --bubble-speed: 2s;
}

/* ================================================================
   2. RESET + BASIC TEXT
   ================================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  min-height: 100vh;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  cursor: cell;
  scroll-behavior: smooth;
}

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

p + p {
  margin-top: 1em;
}

h2 {
  margin-bottom: 0.5em;
}

/* ================================================================
   3. SITE FRAME
   Desktop first; mobile version follows immediately.
   ================================================================ */
.site-layout {
  display: grid;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr var(--nav-height);
}

.page-view {
  grid-column: 1 / span 3;
  grid-row: 1;
  display: flex;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-30px);
  transition: opacity var(--page-speed) ease, transform var(--page-speed) ease;
}

.page-view.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.page-view main {
  display: grid;
  width: 100%;
  min-height: 0;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-areas: 'sidebar content';
  font-family: var(--font-mono);
}

.sidebar {
  grid-area: sidebar;
  overflow: hidden;
  padding: 0 1em;
  background-color: var(--color-paper);
  background-image:
    linear-gradient(to right, magenta 0.5px, transparent 1px),
    linear-gradient(to bottom, magenta 0.5px, transparent 1px);
  background-size: 3px 3px;
  border-right: 2px solid var(--color-magenta);
  color: var(--color-ink);
  font-family: var(--font-pixel);
}

.content {
  grid-area: content;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: auto;
  padding: var(--page-padding);
}

@media (max-width: 600px) {
  :root {
    --sidebar-width: 100%;
    --page-padding: 1rem;
  }

  .page-view main {
    grid-template-columns: 1fr;
    grid-template-rows: 0.5fr 1fr;
    grid-template-areas: 'sidebar' 'content';
  }

  .sidebar {
    position: relative;
    z-index: 10;
    overflow: auto;
    border-right: 0;
    border-bottom: 2px solid var(--color-magenta);
  }

  .content {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ================================================================
   4. CUSTOM CURSOR LAYER
   ================================================================ */
.cursor-canvas {
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: difference;
}

/* ================================================================
   5. BOTTOM NAVIGATION
   ================================================================ */
.site-nav {
  grid-column: 1 / span 3;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.site-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-top: 2px solid magenta;
  border-right: 1px solid magenta;
  background: var(--color-ink);
  box-shadow: inset 0 2px 6px rgba(0, 15, 255, 0.35), 0 -2px 8px rgba(0, 15, 255, 0.45);
  color: var(--color-paper);
  font-family: inherit;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background 0.4s, color 0.4s, padding-left 0.2s;
}

.site-nav-link:last-child {
  border-right: 0;
}

.site-nav-link.is-active {
  padding-left: 10px;
  background: var(--color-paper);
  box-shadow: inset 0 2px 6px rgba(0, 15, 255, 0.25), 0 -2px 8px rgba(0, 15, 255, 0.35);
  color: var(--color-ink);
}

/* ================================================================
   6. SIDEBAR CONTENT
   Shared neon type, Home marquee, and Works title list.
   ================================================================ */
.neon-text {
  color: #ffffff;
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  text-shadow:
    -0.2rem -0.2rem 1rem #fff,
    0.2rem 0.2rem 1rem #fff,
    1px 1px 1px rgba(0, 30, 255, 0.746),
    1px 2px 1px rgba(0, 30, 255, 0.746),
    1px 3px 1px rgba(0, 30, 255, 0.746),
    1px 4px 1px rgba(0, 30, 255, 0.746),
    1px 5px 1px rgba(0, 30, 255, 0.746),
    1px 6px 1px rgba(0, 30, 255, 0.746),
    1px 7px 1px rgba(0, 30, 255, 0.746),
    1px 8px 1px rgba(0, 30, 255, 0.746),
    1px 9px 1px rgba(0, 30, 255, 0.746),
    1px 10px 1px rgba(0, 30, 255, 0.746);
}

.scrolling-intro {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.scrolling-intro-track {
  animation: sidebar-marquee var(--marquee-speed) linear infinite alternate;
}

.scrolling-intro p {
  margin: 0;
  font-size: 1.5em;
  line-height: 2em;
  user-select: none;
}

.work-list {
  width: 100%;
}

.work-link {
  display: block;
  padding: 1em 0;
  border-bottom: 5px dotted var(--color-magenta);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  text-decoration: none;
}

.work-link:hover,
.work-link.is-active {
  border-bottom-color: var(--color-blue);
  color: var(--color-blue);
}

@keyframes sidebar-marquee {
  from { transform: translateY(-30%); }
  to { transform: translateY(10%); }
}

/* ================================================================
   7. HOME + CONTACT WINDOWS
   Window structure follows its visual order: frame, title, body, controls.
   ================================================================ */
.desktop-window {
  z-index: 10;
  background: linear-gradient(rgba(233, 233, 233, 1), rgba(178, 178, 178, 1) 21px, #ededed 21px, #ededed 23px);
  border-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.3), 0 0 150px #9ec0ffe6, 0 22px 70px 4px #9ec0ffe6;
}

.biography-window {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 720px);
  height: auto;
  max-height: 80vh;
  margin: 0 auto;
}

.window-title {
  position: relative;
  z-index: 2;
  color: #3c3c3c;
  font-size: 13px;
  line-height: 21px;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 1px 1px #e7e7e7;
  text-transform: capitalize;
}

.window-body {
  position: relative;
  flex: 1 1 auto;
  max-height: calc(80vh - 40px);
  overflow-y: auto;
  border-top: 1px solid #656565;
}

.window-content {
  position: relative;
  padding: 28px 36px;
  color: #2a2a2a;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.7;
  text-align: left;
}

.window-content h2 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--color-paper);
  font-family: var(--font-pixel);
  font-size: 0.85rem;
}

.window-content h2:first-child {
  margin-top: 0;
}

.window-content p {
  margin-bottom: 1em;
}

.feature-window {
  align-self: flex-start;
  width: min(100%, 250px);
  max-height: none;
  margin: 0 0 1.5rem;
}

.feature-window .window-body {
  max-height: none;
}

.feature-window .window-content {
  padding: 18px 18px 16px;
  line-height: 1.4;
}

.feature-window .window-title {
  font-size: 11px;
  letter-spacing: 0.04em;
}

.window-controls {
  position: absolute;
  top: 3px;
  left: 5px;
  z-index: 10;
  height: 19px;
}

.window-controls a {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 12px;
  margin: 2px 0 3px 1px;
  border-radius: 100%;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  text-indent: -9999px;
}

.window-controls a::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 100%;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.8);
}

.window-controls a::after {
  content: '';
  position: absolute;
  inset: 2px 1px 1px;
  border-radius: 100%;
  background: linear-gradient(white, rgba(255, 255, 255, 0.9) 2%, white, rgba(255, 255, 255, 0.4) 16%, transparent 43%, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.7) 122%);
}

.window-controls .close { background: #fd4e4e; }
.window-controls .close:active { background: #c72f2b; }
.window-controls .minimize { background: #f3bb55; }
.window-controls .minimize:active { background: #c7862c; }
.window-controls .maximize { background: #96d16f; }
.window-controls .maximize:active { background: #4a8e33; }

@media (max-width: 600px) {
  .biography-window {
    max-height: 100%;
  }

  .window-body {
    max-height: calc(100vh - var(--nav-height) - 40px);
  }

  .window-content {
    padding: 22px 20px;
  }
}

/* ================================================================
   8. WORKS CAROUSEL
   Desktop horizontal rules, then tablet/mobile vertical rules.
   ================================================================ */
.work-carousel {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.work-carousel-track {
  width: 100%;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  gap: var(--carousel-gap);
  margin: 0;
  padding: 0.5rem 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  list-style: none;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.work-carousel-track::-webkit-scrollbar {
  display: none;
}

.work-card {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 0;
  background: #9ec0ffe6;
  cursor: pointer;
  scroll-snap-align: center;
  text-decoration: none;
  -webkit-mask: radial-gradient(ellipse 130% 105% at 50% 50%, black 30%, transparent 65%);
  mask: radial-gradient(ellipse 130% 105% at 50% 50%, black 30%, transparent 65%);
  transition: transform 0.25s ease;
}

.work-card:hover {
  transform: scale(1.02);
}

.work-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

/* .work-card:hover img {
  opacity: 1;
  transform: scale(1);
} */

@media (max-width: 1100px) {
  :root {
    --carousel-width: clamp(220px, 36vmin, 360px);
  }
}

@media (max-width: 820px) {
  .work-carousel {
    height: 100%;
    padding: 0.5rem;
    place-items: center;
    -webkit-mask:
      radial-gradient(circle at 6% 50%, transparent 0 6%, black 10%) 0 50% / 18% 100% no-repeat,
      linear-gradient(0deg, transparent 0, black 12% 88%, transparent) 50% 0 / calc(100% - 24px) 100% no-repeat,
      linear-gradient(90deg, black, black) 0 50% / 16px 100% no-repeat,
      linear-gradient(90deg, black, black) 100% 50% / 16px 100% no-repeat;
  }

  .work-carousel-track {
    width: var(--carousel-width);
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 0% 0.75rem;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
  }

  .work-card {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    aspect-ratio: 9 / 16;
  }
}

/* ================================================================
   9. HOME BUBBLES
   ================================================================ */
.bubble-stage {
  position: relative;
  width: 100%;
  height: 300px;
  margin: 20px;
  perspective: 1200px;
  perspective-origin: 50% 50%;
}

.bubble {
  position: absolute;
  display: inline-block;
  width: var(--bubble-size);
  height: var(--bubble-size);
  border-radius: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(31, 67, 176, 0), rgba(158, 192, 255, 0.9) 30%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: bubble-pulse var(--bubble-speed) ease-out infinite;
}

.bubble::before {
  content: '';
  position: absolute;
  top: 1%;
  left: 5%;
  z-index: 2;
  width: 40%;
  height: 80%;
  border-radius: 100%;
  background: radial-gradient(circle at 130% 130%, transparent 0 46%, rgba(255, 255, 255, 0.8) 50% 58%, transparent 60% 100%);
  transform: translateX(131%) translateY(58%) rotateZ(168deg) rotateX(0deg);
}

.bubble::after {
  content: '';
  position: absolute;
  top: 5%;
  left: 10%;
  z-index: 2;
  width: 80%;
  height: 80%;
  border-radius: 100%;
  background: radial-gradient(circle at 50% 80%, transparent 0 84%, rgba(255, 255, 255, 0) 100%);
  filter: blur(1px);
  transform: rotateZ(-30deg);
}

@media (min-width: 601px) and (max-width: 900px) {
  :root { --bubble-size: 220px; }
  .content { overflow: visible; }
  .bubble { z-index: 3; }
}

@media (max-width: 600px) {
  :root { --bubble-size: 220px; }
  .bubble { z-index: 1; }
}

@media (max-width: 480px) {
  :root { --bubble-size: 84px; }
}

@media (max-width: 360px) {
  :root { --bubble-size: 56px; }
}

@keyframes bubble-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  20% { transform: translate(-50%, -50%) scaleY(0.95) scaleX(1.05); }
  48% { transform: translate(-50%, -50%) scaleY(1.1) scaleX(0.9); }
  68% { transform: translate(-50%, -50%) scaleY(0.98) scaleX(1.02); }
  80% { transform: translate(-50%, -50%) scaleY(1.02) scaleX(0.98); }
}

/* ================================================================
   10. ACCESSIBILITY
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
