/* MAT 189 stylesheet — customized by Ajoonee */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600&family=Inter:wght@400;500&family=IBM+Plex+Mono:wght@300;400&display=swap');

* { box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: #232220;
  background: transparent;
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
}

/* Full-viewport backdrop layers, color set by JS as the page scrolls */
.bg-color-layer {
  position: fixed;
  inset: 0;
  z-index: -4;
  background-color: #0a0c1a;
  transition: background-color 0.15s linear;
  pointer-events: none;
}
.bg-stars {
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
  background-repeat: repeat;
  background-size: 260px 240px;
  background-image:
    radial-gradient(2.2px 2.2px at 24px 38px, rgba(255,255,255,1), transparent 65%),
    radial-gradient(1.4px 1.4px at 96px 14px, rgba(255,255,255,0.8), transparent 60%),
    radial-gradient(2px 2px at 150px 92px, rgba(255,255,255,0.95), transparent 65%),
    radial-gradient(1.2px 1.2px at 200px 150px, rgba(255,255,255,0.65), transparent 60%),
    radial-gradient(1.8px 1.8px at 58px 170px, rgba(255,255,255,0.9), transparent 60%),
    radial-gradient(1.2px 1.2px at 232px 46px, rgba(255,255,255,0.7), transparent 60%),
    radial-gradient(2.4px 2.4px at 12px 210px, rgba(255,255,255,1), transparent 70%),
    radial-gradient(1.2px 1.2px at 130px 220px, rgba(255,255,255,0.6), transparent 60%),
    radial-gradient(1.6px 1.6px at 178px 8px, rgba(255,255,255,0.85), transparent 60%),
    radial-gradient(1.4px 1.4px at 40px 110px, rgba(255,255,255,0.7), transparent 60%);
}

/* Small distant planets, visible only during the space zone */
.bg-planets {
  position: fixed;
  inset: 0;
  z-index: -3;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.planet {
  position: absolute;
  border-radius: 50%;
}
.planet-mars {
  top: 14%;
  left: 10%;
  width: 44px;
  height: 44px;
  background: radial-gradient(circle at 32% 32%, #ffb98a, #e8672f 60%, #9c3a16 100%);
  box-shadow: 0 0 24px rgba(232, 103, 47, 0.35);
}
.planet-neptune {
  top: 66%;
  left: 87%;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle at 32% 32%, #9fe6ff, #2f8fc7 60%, #145273 100%);
  box-shadow: 0 0 18px rgba(47, 143, 199, 0.35);
}
.planet-violet {
  top: 24%;
  left: 80%;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 32% 32%, #e6c8ff, #9a5fd1 60%, #5c3184 100%);
  box-shadow: 0 0 14px rgba(154, 95, 209, 0.3);
}
.planet-ringed {
  top: 80%;
  left: 20%;
  width: 34px;
  height: 34px;
  background: radial-gradient(circle at 32% 32%, #fff3c4, #e0b64a 60%, #a67c1f 100%);
  box-shadow: 0 0 16px rgba(224, 182, 74, 0.3);
}
.planet-ringed::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -38%;
  width: 176%;
  height: 24%;
  border: 2px solid rgba(224, 182, 74, 0.55);
  border-radius: 50%;
  transform: translateY(-50%) rotate(-14deg);
}

/* Glitch fragments behind the Jumbled section — echoes the piece's own
   glitch-art visual, opacity peaks while that project is centered */
.bg-glitch {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: screen;
}
.glitch-bar {
  position: absolute;
  opacity: 0.5;
  height: 6px;
}
.glitch-bar-1 { top: 10%; left: 2%;  width: 52px; background: #c47080; transform: rotate(-2deg); }
.glitch-bar-2 { top: 20%; right: 3%; width: 64px; height: 5px; background: #5e9696; }
.glitch-bar-3 { top: 34%; left: 2%;  width: 46px; height: 5px; background: #c6a052; transform: rotate(1deg); }
.glitch-bar-4 { top: 50%; right: 2%; width: 58px; height: 7px; background: #8c74a8; }
.glitch-bar-5 { top: 64%; left: 3%;  width: 50px; background: #bc7658; transform: rotate(-1.5deg); }
.glitch-bar-6 { top: 78%; right: 4%; width: 40px; height: 5px; background: #6484a2; }
.glitch-bar-7 { top: 90%; left: 4%;  width: 44px; background: #b08cb0; animation: glitch-flicker 4.5s ease-in-out infinite; }
.glitch-bar-8 { top: 44%; left: 1%;  width: 34px; height: 5px; background: #80a276; animation: glitch-flicker 3.2s ease-in-out infinite 1.1s; }

@keyframes glitch-flicker {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.22; }
}

/* No safe margin outside the text column on narrow screens — hide rather
   than let the bars sit on top of the content */
@media (max-width: 800px) {
  .bg-glitch { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .glitch-bar-7, .glitch-bar-8 { animation: none; }
}

/* Text flips to a light palette while the scroll-linked backdrop is dark (space zone) */
body.on-dark header h1,
body.on-dark header p,
body.on-dark .project h2,
body.on-dark .project p:not(.meta) {
  color: #f5f3ee;
  transition: color 0.3s ease;
}
body.on-dark .project .meta,
body.on-dark figcaption {
  color: #c9c5da;
  transition: color 0.3s ease;
}
body.on-dark header {
  border-bottom-color: rgba(245, 243, 238, 0.25);
}
body.on-dark footer {
  color: #c9c5da;
  border-top-color: rgba(245, 243, 238, 0.25);
}

header {
  margin: 3rem 0 5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e2d8;
}
header h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 3.6rem;
  letter-spacing: -0.01em;
  margin: 0;
}
header p {
  color: #7a776d;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0.6rem 0 0;
}

html {
  scroll-behavior: smooth;
}

/* Latest work — minimal index list with a cursor-following image preview,
   inspired by the "latest work" list on jameswilliams.design */
.latest-work {
  margin: 0 0 6rem;
  border-top: 1px solid #e5e2d8;
}
.latest-work-heading {
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8778;
  margin: 1.75rem 0 0.25rem;
}
.work-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid #e5e2d8;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.25s ease;
}
.latest-work:hover .work-row {
  opacity: 0.42;
}
.latest-work .work-row:hover {
  opacity: 1;
}
.work-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.9rem;
  letter-spacing: -0.01em;
  display: inline-block;
  transform-origin: left center;
  transition: transform 0.3s ease;
}
.work-row:hover .work-title {
  transform: scale(1.18);
}
.work-meta {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a8778;
  white-space: nowrap;
}

body.on-dark .latest-work-heading {
  color: #c9c5da;
}
body.on-dark .latest-work,
body.on-dark .work-row {
  border-color: rgba(245, 243, 238, 0.25);
}
body.on-dark .work-title {
  color: #f5f3ee;
}
body.on-dark .work-meta {
  color: #c9c5da;
}

/* Stacked, single-column layout with generous space between projects */
.project {
  margin: 0 0 8rem;
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s ease, transform 0.9s ease, border-color 0.3s ease;
}
.project:last-of-type { margin-bottom: 4rem; }

/* A hairline divider between projects, sitting in the whitespace gap */
.project + .project {
  border-top: 3px solid #e5e2d8;
  padding-top: 4rem;
}
body.on-dark .project + .project {
  border-top-color: rgba(245, 243, 238, 0.25);
}

/* Revealed state, added by JS once the project scrolls into view */
.project.in-view {
  opacity: 1;
  transform: translateY(0);
}

.project h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 2.4rem;
  margin: 0 0 0.35rem;
}
.project .meta {
  color: #8a8778;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
}
.project p:not(.meta) {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 300;
  font-size: 0.95rem;
  line-height: 1.8;
  letter-spacing: 0.01em;
  color: #4a463f;
  max-width: 38rem;
}

figure { margin: 1.5rem 0; }
img, video {
  max-width: 100%;
  display: block;
  border-radius: 4px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #111;
}
.project:hover img,
.project:hover video {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -10px rgba(35, 34, 32, 0.22);
}
audio { width: 100%; }
figcaption {
  color: #8a8778;
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 0.6rem;
}

footer {
  margin: 5rem 0 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e2d8;
  color: #8a8778;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .project {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
