/* ==========================================================================
   Design System — Robel Mulugeta Personal Site
   ========================================================================== */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=Caveat:wght@400;700&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #F4F1EA;
  --text: #111111;
  --text-light: rgba(17, 17, 17, 0.5);
  --text-subtle: rgba(17, 17, 17, 0.25);
  --mono: 'Courier Prime', 'Courier New', 'Courier', monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
}

::selection {
  background: rgba(17, 17, 17, 0.08);
}

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

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

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  right: 0;
  padding: 2.5rem 3rem;
  z-index: 100;
  display: flex;
  gap: 2.5rem;
}

.nav a {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  transition: color 0.3s ease;
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--text);
  transition: width 0.3s ease;
}

.nav a:hover {
  color: var(--text);
}

.nav a:hover::after {
  width: 100%;
}

.nav a.active {
  color: var(--text);
}

/* --- Home Page --- */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0;
}

/* --- Photo Section — ALD-style image-first hero --- */
.home__photos {
  width: 100%;
  max-width: 900px;
  margin: 8rem auto 0;
  padding: 0 4rem;
  display: flex;
  gap: 2.5rem;
  justify-content: center;
  align-items: flex-start;
}

.polaroid {
  background: #fff;
  padding: 10px 10px 40px 10px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
  flex: 0 1 340px;
}

.polaroid:nth-child(1) {
  transform: rotate(-2deg);
  margin-top: 2rem;
}

.polaroid:nth-child(2) {
  transform: rotate(1.5deg);
}

.polaroid:hover {
  transform: rotate(0deg) scale(1.02);
  transition: transform 0.4s ease;
}

.polaroid img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.05);
}

/* --- Text Section — centered quote below photos --- */
.home__text {
  max-width: 600px;
  margin: 0 auto;
  padding: 6rem 2rem 8rem;
  text-align: center;
}

.home__quote {
  font-family: var(--mono);
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  line-height: 2;
  color: var(--text);
  opacity: 0.7;
}

.home__attribution {
  display: block;
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.35;
  letter-spacing: 0.02em;
}

.home__attribution em {
  font-style: italic;
}

/* --- About Page --- */
.about {
  max-width: 320px;
  margin: 0;
  padding: 2.5rem 3rem;
  min-height: 100vh;
}

.about__text {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.9;
  color: var(--text);
  opacity: 0.8;
}

.about__text p {
  margin-bottom: 0;
}

.about__photo {
  margin-top: 3.5rem;
  display: flex;
  justify-content: flex-start;
}

.about__photo .polaroid-container {
  perspective: 800px;
  flex: 0 1 220px;
  cursor: pointer;
}

.about__photo .polaroid-flipper {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.about__photo .polaroid-flipper.flipped {
  transform: rotateY(180deg);
}

.about__photo .polaroid-front,
.about__photo .polaroid-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.about__photo .polaroid-front {
  position: relative;
}

.about__photo .polaroid-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotateY(180deg);
  background: #fff;
  padding: 10px 10px 40px 10px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.about__photo .polaroid-back-text {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  line-height: 1.6;
  color: #222;
  text-align: left;
  padding: 0.8rem;
  font-weight: 700;
  transform: rotate(-2deg);
}

.about__photo .polaroid {
  padding: 6px 6px 24px 6px;
  position: relative;
}

.about__signature {
  margin-top: 1.5rem;
  text-align: left;
  font-size: 1rem;
  opacity: 0.2;
  letter-spacing: 0.05em;
  line-height: 1.6;
}

.sonics-counter {
  position: fixed;
  top: 6%;
  left: 26%;
  transform: none;
  text-align: center;
  z-index: 10;
  cursor: grab;
}
.sonics-counter.dragging {
  cursor: grabbing;
}

.sonics-counter__title {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text);
  opacity: 0.8;
  letter-spacing: 0.02em;
  margin-bottom: 1.2rem;
}

.sonics-counter__boxes {
  display: flex;
  gap: 0.6rem;
}

.sonics-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.2rem;
  padding: 0.6rem 0.5rem;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 3px;
}

.sonics-box__number {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.7;
  line-height: 1;
}

.sonics-box__label {
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 400;
  color: var(--text);
  opacity: 0.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 0.35rem;
}

.about__principles {
  position: fixed;
  top: 6%;
  left: 56%;
  transform: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.9;
  color: var(--text);
  opacity: 0.8;
  white-space: pre;
  text-align: left;
  z-index: 10;
  cursor: grab;
}
.about__principles.dragging {
  cursor: grabbing;
}

.about__principles .cursor {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  background: var(--text);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 0.6s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Globe --- */
.globe-container {
  position: fixed;
  top: 38%;
  left: 30%;
  width: 280px;
  height: 280px;
  z-index: 10;
  pointer-events: auto;
  cursor: grab;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.globe-container.dragging {
  cursor: grabbing;
  transition: none;
}

.globe-container.visible {
  opacity: 1;
}

.globe-container canvas {
  width: 100%;
  height: 100%;
}

/* --- Music Page --- */
.music-page {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: relative;
  cursor: crosshair;
}

.music-canvas {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.album-cover {
  position: absolute;
  width: 160px;
  height: 160px;
  pointer-events: none;
  opacity: 0;
  animation: albumFadeIn 0.6s ease forwards;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.15),
    0 4px 8px rgba(0, 0, 0, 0.12),
    0 12px 28px rgba(0, 0, 0, 0.14),
    0 20px 40px rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  will-change: opacity, transform;
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
}

@keyframes albumFadeIn {
  from {
    opacity: 0;
    transform: var(--rotation) scale(0.85);
  }
  to {
    opacity: 1;
    transform: var(--rotation) scale(1);
  }
}

.music-heading {
  position: fixed;
  top: 2.5rem;
  left: 3rem;
  max-width: 320px;
  text-align: left;
  z-index: 50;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.music-heading p {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.9;
  color: var(--text);
  opacity: 0.8;
}

.music-heading cite {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.65rem;
  color: var(--text);
  opacity: 0.4;
  letter-spacing: 0.02em;
}

.music-heading cite em {
  font-style: italic;
}

.music-footer {
  position: fixed;
  bottom: 2.5rem;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 10;
  pointer-events: none;
}

.music-footer p {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.18;
  letter-spacing: 0.01em;
}

/* --- Collage Page --- */
.collage-page {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: relative;
  cursor: crosshair;
}

.collage-heading {
  position: fixed;
  top: 2.5rem;
  left: 3rem;
  max-width: 320px;
  text-align: left;
  z-index: 50;
  pointer-events: none;
}

.collage-heading p {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.9;
  color: var(--text);
  opacity: 0.8;
}

.collage-canvas {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.collage-item {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  animation: collageFadeIn 0.8s ease forwards;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.1),
    0 6px 20px rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  will-change: opacity, transform;
}

.collage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
}

@keyframes collageFadeIn {
  from {
    opacity: 0;
    transform: var(--rotation) scale(0.8);
  }
  to {
    opacity: 1;
    transform: var(--rotation) scale(1);
  }
}

/* --- Misc Page --- */
.misc-page {
  width: 100%;
  min-height: 100vh;
  position: relative;
}

.misc-heading {
  position: fixed;
  top: 2.5rem;
  left: 3rem;
  max-width: 320px;
  text-align: left;
}

.misc-heading p {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.9;
  color: var(--text);
  opacity: 0.8;
}

/* --- Page Transitions --- */
.page-enter {
  animation: pageIn 0.6s ease forwards;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav {
    padding: 1.5rem 1.5rem;
    gap: 1.8rem;
  }

  .nav a {
    font-size: 0.7rem;
  }

  .home__photos {
    margin-top: 6rem;
    padding: 0 2rem;
    gap: 1.5rem;
  }

  .polaroid {
    flex: 0 1 280px;
    padding: 8px 8px 30px 8px;
  }

  .home__text {
    padding: 4rem 1.5rem 6rem;
  }

  .home__quote {
    font-size: 0.9rem;
  }

  .about {
    padding: 4.5rem 1.5rem 2rem;
    max-width: 100%;
    min-height: auto;
  }

  .sonics-counter {
    position: static;
    transform: none;
    margin: 3rem 0 0 1.5rem;
    text-align: left;
  }

  .sonics-counter__title {
    font-size: 0.7rem;
  }

  .sonics-box {
    min-width: 2.8rem;
    padding: 0.5rem 0.4rem;
  }

  .sonics-box__number {
    font-size: 0.95rem;
  }

  .about__principles {
    position: static;
    transform: none;
    margin: 3rem 0 0 1.5rem;
    text-align: left;
  }

  .globe-container {
    position: static;
    width: 160px;
    height: 160px;
    margin: 2.5rem auto 2rem;
    opacity: 1;
    cursor: default;
  }

  .album-cover {
    width: 120px;
    height: 120px;
  }

  .music-heading,
  .collage-heading,
  .misc-heading {
    top: 5.5rem;
    left: 1.5rem;
    max-width: 260px;
  }

  .music-heading p,
  .collage-heading p,
  .misc-heading p {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .nav {
    padding: 1.2rem 1.2rem;
    gap: 1.5rem;
  }

  .nav a {
    font-size: 0.65rem;
  }

  .home__photos {
    margin-top: 5rem;
    padding: 0 1.2rem;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }

  .polaroid {
    flex: none;
    width: 80%;
    max-width: 280px;
  }

  .polaroid:nth-child(1) {
    margin-top: 0;
    transform: rotate(-1.5deg);
  }

  .polaroid:nth-child(2) {
    transform: rotate(1deg);
  }

  .home__text {
    padding: 3rem 1.2rem 5rem;
  }

  .home__quote {
    font-size: 0.85rem;
  }

  .about {
    padding: 4rem 1.2rem 2rem;
  }

  .about__photo .polaroid-container {
    flex: 0 1 180px;
  }

  .sonics-counter__title {
    font-size: 0.6rem;
  }

  .sonics-counter__boxes {
    gap: 0.4rem;
  }

  .sonics-box {
    min-width: 2.4rem;
    padding: 0.4rem 0.3rem;
  }

  .sonics-box__number {
    font-size: 0.85rem;
  }

  .sonics-box__label {
    font-size: 0.45rem;
  }

  .about__principles {
    font-size: 0.65rem;
    margin-top: 2.5rem;
  }

  .globe-container {
    width: 120px;
    height: 120px;
  }

  .album-cover {
    width: 100px;
    height: 100px;
  }

  .music-heading,
  .collage-heading,
  .misc-heading {
    top: 5rem;
    left: 1.2rem;
    max-width: 220px;
  }

  .music-heading p,
  .collage-heading p,
  .misc-heading p {
    font-size: 0.65rem;
  }
}
