:root {
  --brown: #664F0B;
  --cream: #EDDEB2;
  --lilac: #DDC5F0;
  --purple: #902ADE;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Sora', sans-serif;
  color: var(--brown);
  background: var(--lilac);
}

section {
  background: var(--section-bg, var(--lilac));
}

/* ---------- Scroll progress ---------- */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--purple);
  z-index: 1000;
  pointer-events: none;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem clamp(1.5rem, 6vw, 6rem);
}

.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: var(--hero-line-y, 70%);
  height: 2px;
  background: var(--cream);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(2rem, 6vw, 6rem);
  width: 100%;
}

.hero-photo {
  position: relative;
  flex: 0 0 auto;
  width: clamp(154px, 19.6vw, 266px);
  aspect-ratio: 1125 / 1846;
}

.hero-photo::before {
  content: '';
  position: absolute;
  background: var(--cream);
  pointer-events: none;
  bottom: 0;
  right: 0;
  width: 2px;
  height: 150vh;
}

.hero-photo canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
  touch-action: none;
}

.scratch-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: var(--purple);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  animation: hint-pulse 1.8s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.scratch-hint.hidden {
  opacity: 0;
  animation: none;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.hero-text {
  flex: 1 1 480px;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
}

.hero-name {
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
}

.hero-line {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 400;
  margin: 0.75rem 0 0;
  min-height: 2.4em;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.hero-line.fade {
  opacity: 0;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  border: 2px solid var(--brown);
  color: var(--brown);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.btn-primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(0.88);
}

.btn-secondary {
  background: transparent;
}

.btn-secondary:hover {
  border-color: var(--purple);
  color: var(--purple);
}

/* ---------- Work ---------- */

.work {
  background: var(--lilac);
}

.work-band {
  background: var(--cream);
  padding: 3.5rem clamp(1.5rem, 6vw, 6rem);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.6s cubic-bezier(0.65, 0, 0.35, 1);
}

.work.in-view .work-band {
  clip-path: inset(0 0 0 0);
}

.work-title {
  margin: 0;
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.5s;
}

.work.in-view .work-title {
  clip-path: inset(0 0 0 0);
}

.work-content {
  padding: 2rem 0 4rem;
}

/* ---------- Projects ---------- */

.project {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2.5rem, 6vw, 6rem);
  padding: 5rem clamp(1.5rem, 6vw, 6rem);
}

.project[data-side="right"] {
  flex-direction: row-reverse;
}

.project-media {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(60px) scale(1);
  padding: clamp(2rem, 4vw, 3.5rem);
  border-radius: 1.75rem;
  background: var(--lilac);
  box-shadow: 0 0 0 rgba(94, 27, 144, 0);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.9s ease, box-shadow 0.4s ease;
}

.project.media-in .project-media {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.project.media-in .project-media:hover {
  transform: translateY(0) scale(1.05);
  box-shadow: 0 2.5rem 4.5rem rgba(94, 27, 144, 0.4);
}

.project-text {
  flex: 1 1 480px;
  max-width: 560px;
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.9s ease;
}

.project[data-side="left"] .project-text {
  transform: translateX(70px);
}

.project[data-side="right"] .project-text {
  transform: translateX(-70px);
}

.project.text-in .project-text {
  opacity: 1;
  transform: translateX(0);
}

.project-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 700;
  color: var(--purple);
}

.project-tagline {
  margin: 0 0 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brown);
  opacity: 0.65;
}

.project-desc {
  margin: 0 0 1.5rem;
  line-height: 1.55;
}

.project-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--brown);
  font-weight: 700;
  text-decoration: none;
}

.project-link:hover {
  text-decoration: underline;
}

.project-primary-link {
  margin: 0 0 1.25rem;
}

.store-badges {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1.25rem;
}

/* ---------- Chips: role & tools ---------- */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1.25rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brown);
  white-space: nowrap;
}

.chip-role {
  background: rgba(255, 255, 255, 0.55);
}

.chip-tool {
  background: var(--cream);
}

.chip-icon {
  display: inline-flex;
  flex: none;
  color: var(--brown);
  opacity: 0.75;
}

.chip-icon svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.chip-label {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--purple);
}

.project-divider {
  height: 1px;
  background: rgba(102, 79, 11, 0.15);
  margin: 0.5rem 0 1.25rem;
}

/* ---------- Footer row: stat, CTA, tags ---------- */

.project-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.1rem 1.5rem;
  margin-top: 0.5rem;
}

.project-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.project-stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--purple);
}

.project-stat-label {
  font-size: 0.78rem;
  color: var(--brown);
  opacity: 0.7;
}

.project-tags {
  margin: 0 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brown);
  opacity: 0.5;
}

.store-badge {
  display: inline-flex;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.store-badge:hover {
  transform: translateY(-2px);
  opacity: 0.85;
}

.store-badge img {
  display: block;
  height: 2.5rem;
  width: auto;
}

/* ---------- Device mockups ---------- */

.device {
  background: var(--brown);
}

.device-screen {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lilac);
  overflow: hidden;
}

.photo-fade {
  position: relative;
  width: 100%;
  height: 100%;
}

.photo-fade-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.1s ease;
}

.photo-fade-img.is-active {
  opacity: 1;
}

.device-phone {
  width: clamp(160px, 20vw, 220px);
  aspect-ratio: 9 / 19.5;
  padding: 0.28rem;
  border-radius: 1.6rem;
}

.device-phone .device-screen {
  border-radius: 1.3rem;
}

.device-laptop {
  width: clamp(260px, 34vw, 460px);
  aspect-ratio: 16 / 10;
  padding: 0.3rem;
  border-radius: 0.5rem;
  position: relative;
}

.device-laptop .device-screen {
  border-radius: 0.2rem;
}

.device-laptop::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -0.85rem;
  transform: translateX(-50%);
  width: 30%;
  height: 0.85rem;
  background: var(--brown);
  border-radius: 0 0 0.4rem 0.4rem;
}

/* ---------- About ---------- */

.about {
  background: var(--cream);
}

.about-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: start;
  column-gap: clamp(2rem, 5vw, 5rem);
  padding: 6rem clamp(1.5rem, 6vw, 6rem);
}

.about-lead {
  grid-column: 1;
  grid-row: 1;
}

.about-rest {
  grid-column: 1;
  grid-row: 2;
}

.about-text {
  max-width: 640px;
}

.about-title {
  margin: 0 0 1.5rem;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
}

.about-text p {
  margin: 0 0 1.25rem;
  line-height: 1.65;
}

.about-rest p:last-child {
  margin-bottom: 0;
}

.about-text em {
  font-style: italic;
  font-weight: 600;
  color: var(--purple);
}

.about-media {
  grid-column: 2;
  grid-row: 1 / 3;
  width: clamp(200px, 26vw, 320px);
  aspect-ratio: 979 / 1606;
  position: sticky;
  top: 6rem;
}

.about-draw-svg {
  width: 100%;
  height: 100%;
  color: var(--brown);
  overflow: visible;
}

.about-draw-svg path {
  fill: none;
}

.about-title.typing::after,
.about-text p.typing::after {
  content: '';
  display: inline-block;
  width: 0.09em;
  height: 1em;
  margin-left: 0.1em;
  background: var(--purple);
  vertical-align: -0.1em;
  animation: caret-blink 0.85s steps(1) infinite;
}

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

/* ---------- Contact ---------- */

.contact {
  background: var(--lilac);
}

.contact-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 6rem clamp(1.5rem, 6vw, 6rem);
  text-align: center;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.contact.in-view .contact-inner {
  opacity: 1;
  transform: translateY(0);
}

.contact-title {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--brown);
}

.contact-text {
  margin: 0 0 2.5rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--brown);
}

.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

/* ---------- Footer ---------- */

.back-to-top-wrap {
  background: var(--lilac);
  padding: 3.5rem 0;
  display: flex;
  justify-content: center;
}

.back-to-top {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px);
  transition: background 0.25s ease, opacity 0.8s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.25s ease;
}

.back-to-top-wrap.in-view .back-to-top {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  filter: brightness(0.88);
  transform: translateY(-4px);
}

/* ---------- Responsive ---------- */

@media (max-width: 800px) {
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .hero-photo {
    width: min(70vw, 320px);
    align-self: center;
  }

  .hero-text {
    flex: none;
    justify-content: flex-start;
  }

  .project,
  .project[data-side="right"] {
    flex-direction: column;
    text-align: left;
  }

  .project[data-side="left"] .project-text,
  .project[data-side="right"] .project-text {
    transform: translateY(40px);
  }

  .about-inner {
    display: flex;
    flex-direction: column;
  }

  .about-media {
    position: static;
    width: min(55vw, 260px);
    align-self: center;
    margin: 1.5rem auto;
    order: 2;
  }

  .about-lead {
    order: 1;
  }

  .about-rest {
    order: 3;
  }
}
