:root {
  --paper: #f5f5f0;
  --paper-deep: #ddddd4;
  --white: #ffffff;
  --black: #080808;
  --soft-black: #2b2b2b;
  --muted: #6d6d6d;
  --line: rgba(8, 8, 8, 0.3);
  --shadow: rgba(8, 8, 8, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--black);
  background:
    url("assets/paper-texture.png"),
    linear-gradient(115deg, #ffffff, var(--paper) 48%, #e7e7df);
  background-size: 520px 520px, auto;
  background-blend-mode: luminosity, normal;
  font-family: "Space Grotesk", Arial, sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(8, 8, 8, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 8, 8, 0.025) 1px, transparent 1px);
  background-size: 52px 52px, 52px 52px;
  mix-blend-mode: multiply;
  z-index: -2;
}

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  z-index: -1;
  background-image:
    radial-gradient(circle, rgba(8, 8, 8, 0.2) 0 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 255, 255, 0.6) 0 1px, transparent 1px);
  background-size: 17px 19px, 29px 31px;
  animation: grain-shift 7s steps(2) infinite;
}

.topbar {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 20;
  width: min(1180px, calc(100% - 24px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border: 2px solid var(--black);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  box-shadow: 7px 7px 0 var(--black);
}

.brand,
.topbar a {
  color: var(--black);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  padding: 6px;
  border: 2px solid var(--black);
  background: var(--white);
  box-shadow: 3px 3px 0 var(--black);
  transform: rotate(-4deg);
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 16px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  letter-spacing: 0;
}

.topbar nav a {
  position: relative;
  padding: 2px 0;
}

.topbar nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--black);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}

.topbar nav a:hover::after,
.topbar nav a:focus-visible::after,
.topbar nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

main {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
}

.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 150px 0 72px;
}

.hero-copy {
  position: relative;
  max-width: 940px;
  z-index: 2;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  font-family: "Caveat", "Segoe Script", cursive;
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Bebas Neue", Impact, sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(6rem, 19vw, 14rem);
  line-height: 0.78;
  text-shadow: 4px 4px 0 var(--white), 8px 8px 0 var(--black);
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.9;
}

h3 {
  margin-bottom: 9px;
  font-size: 2.2rem;
}

p {
  color: var(--soft-black);
  font-size: clamp(1.02rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.intro {
  max-width: 680px;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700;
}

.scribble {
  pointer-events: none;
}

.hero-scribble {
  position: absolute;
  right: -11%;
  top: 16%;
  width: min(740px, 76vw);
  opacity: 0.72;
  transform: rotate(-4deg);
}

.draw-line,
.draw-on-scroll {
  fill: none;
  stroke: var(--black);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw 2.6s cubic-bezier(0.7, 0, 0.2, 1) forwards;
}

.draw-line.fine,
.draw-on-scroll.thin {
  stroke-width: 4;
}

.delay-1 { animation-delay: 150ms; }
.delay-2 { animation-delay: 650ms; }
.delay-3 { animation-delay: 1050ms; }
.delay-4 { animation-delay: 1350ms; }

.contents,
.section-band {
  position: relative;
  padding: clamp(70px, 11vw, 118px) 0;
  border-top: 2px solid var(--black);
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.toc-grid a,
.work-card,
.project-card,
.contact-button,
.browser-sketch,
.mascot-board,
.photo-note {
  border: 2px solid var(--black);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 8px 8px 0 var(--black);
}

.toc-grid a {
  min-height: 126px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  color: var(--black);
  text-decoration: none;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 0.95;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.toc-grid a:hover,
.work-card:hover {
  transform: translate(-3px, -3px) rotate(-0.5deg);
  box-shadow: 12px 12px 0 var(--black);
}

.toc-grid span {
  font-family: "Caveat", "Segoe Script", cursive;
  font-size: 1.4rem;
}

.about,
.skills,
.showcase {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(290px, 1fr);
  align-items: center;
  gap: clamp(28px, 7vw, 88px);
}

.about-copy p {
  max-width: 700px;
}

.photo-note {
  position: relative;
  width: min(420px, 100%);
  justify-self: center;
  padding: 20px;
  transform: rotate(1.4deg);
}

.profile-sticker {
  position: absolute;
  right: -26px;
  top: 48px;
  z-index: 4;
  width: 122px;
  height: 122px;
  object-fit: contain;
  padding: 22px;
  border: 3px solid var(--black);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 8px 8px 0 var(--black);
  transform: rotate(9deg);
}

.profile-sticker::selection {
  background: transparent;
}

.photo-box {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--black);
  background:
    linear-gradient(135deg, rgba(8, 8, 8, 0.08) 25%, transparent 25% 50%, rgba(8, 8, 8, 0.08) 50% 75%, transparent 75%),
    var(--paper);
  background-size: 20px 20px;
  color: var(--black);
  font-family: "Caveat", "Segoe Script", cursive;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  text-align: center;
  overflow: hidden;
}

.photo-box img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
}

.tape {
  position: absolute;
  width: 150px;
  height: 42px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(8, 8, 8, 0.35);
  box-shadow: 0 5px 12px var(--shadow);
}

.tape-top {
  top: -18px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
}

.tape-bottom {
  right: 18px;
  bottom: -14px;
  transform: rotate(6deg);
}

.corner-scribble {
  position: absolute;
  left: 2%;
  bottom: 18px;
  width: min(230px, 34vw);
  opacity: 0.42;
}

.draw-on-scroll {
  animation: none;
}

.is-visible .draw-on-scroll {
  animation: draw 2.4s cubic-bezier(0.7, 0, 0.2, 1) forwards;
}

.software-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.software-grid span {
  min-height: 58px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 2px solid var(--black);
  background:
    linear-gradient(transparent 58%, rgba(8, 8, 8, 0.12) 58%),
    var(--white);
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  text-align: center;
  transform: rotate(var(--tilt, -1deg));
}

.software-grid span:nth-child(2n) { --tilt: 1deg; }
.software-grid span:nth-child(3n) { --tilt: -1.6deg; }

.showcase-copy {
  align-self: center;
}

.showcase {
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  align-items: start;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.project-card {
  position: relative;
  min-height: 235px;
  display: block;
  overflow: hidden;
  color: var(--black);
  text-decoration: none;
  background: var(--white);
  transform: rotate(var(--tilt, -0.8deg));
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.project-card:nth-child(2n) {
  --tilt: 0.9deg;
}

.project-card:nth-child(3n) {
  --tilt: -1.4deg;
}

.project-card::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  z-index: 2;
  width: 96px;
  height: 31px;
  border: 1px solid rgba(8, 8, 8, 0.32);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 10px var(--shadow);
  transform: translateX(-50%) rotate(-2deg);
}

.project-card::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  height: 8px;
  border-radius: 999px;
  background: var(--black);
  clip-path: inset(0 100% 0 0 round 20px);
  opacity: 0.7;
  animation: scribble-reveal 3.8s ease-in-out infinite;
}

.project-card:hover {
  transform: translate(-3px, -3px) rotate(var(--tilt, -0.8deg));
  box-shadow: 12px 12px 0 var(--black);
}

.project-card img {
  width: 100%;
  height: 100%;
  min-height: 235px;
  display: block;
  object-fit: cover;
  border-bottom: 2px solid var(--black);
  background: var(--paper);
}

.logo-gallery .project-card img,
.mascot-gallery .project-card img {
  object-fit: contain;
  padding: 20px;
}

.web-gallery .project-card img {
  object-fit: contain;
  padding: 0;
  background: #111111;
}

.packaging-gallery .project-card img {
  object-fit: cover;
}

.project-card span {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 24px;
  z-index: 3;
  display: block;
  width: fit-content;
  max-width: calc(100% - 24px);
  padding: 4px 8px 2px;
  border: 2px solid var(--black);
  background: var(--white);
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  line-height: 0.95;
}

.project-card.tall {
  min-height: 360px;
}

.project-card.tall img {
  min-height: 360px;
}

.project-card.wide {
  grid-column: span 2;
}

.work-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.work-card {
  position: relative;
  min-height: 210px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 16px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  text-align: center;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.work-card::before,
.work-card::after {
  content: "";
  position: absolute;
  height: 10px;
  border-radius: 999px;
  background: var(--black);
  transform-origin: left center;
  animation: scribble-reveal 3.2s ease-in-out infinite;
}

.work-card::before {
  width: 72%;
  left: 14%;
  top: 35%;
  transform: rotate(-10deg);
}

.work-card::after {
  width: 54%;
  left: 22%;
  bottom: 31%;
  transform: rotate(13deg);
  animation-delay: 720ms;
}

.work-card.tall {
  min-height: 270px;
}

.work-card.wide {
  grid-column: span 2;
}

.browser-sketch {
  min-height: 330px;
  position: relative;
  padding: 52px 22px 22px;
}

.browser-sketch::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 38px;
  border-bottom: 2px solid var(--black);
  background: var(--white);
}

.browser-sketch span {
  display: block;
  height: 35px;
  margin-bottom: 20px;
  background: var(--black);
  animation: web-lines 3.4s ease-in-out infinite;
}

.browser-sketch span:nth-child(1) { width: 82%; }
.browser-sketch span:nth-child(2) { width: 58%; animation-delay: 280ms; }
.browser-sketch span:nth-child(3) { width: 72%; animation-delay: 560ms; }

.mascot-board {
  min-height: 350px;
  display: grid;
  place-items: center;
}

.face {
  position: relative;
  width: min(230px, 62vw);
  aspect-ratio: 1;
  border: 4px solid var(--black);
  border-radius: 45% 55% 52% 48%;
  animation: wobble 3.3s ease-in-out infinite;
}

.face::before,
.face::after {
  content: "";
  position: absolute;
  top: 34%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--black);
}

.face::before { left: 28%; }
.face::after { right: 28%; }

.contact {
  min-height: 460px;
  display: grid;
  align-content: center;
  gap: 18px;
  padding-bottom: 120px;
}

.contact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.contact-button {
  width: fit-content;
  max-width: 100%;
  padding: 13px 18px;
  color: var(--black);
  text-decoration: none;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  transition: transform 200ms ease, background 200ms ease;
}

.contact-button:hover {
  transform: rotate(-1deg) translateY(-2px);
  background: var(--white);
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes scribble-reveal {
  0%, 100% {
    clip-path: inset(0 100% 0 0 round 20px);
    opacity: 0.7;
  }
  42%, 76% {
    clip-path: inset(0 0 0 0 round 20px);
    opacity: 0.9;
  }
}

@keyframes web-lines {
  0%, 100% {
    transform: scaleX(0.18);
    transform-origin: left;
  }
  45%, 75% {
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes wobble {
  0%, 100% {
    transform: rotate(-2deg) scale(1);
  }
  50% {
    transform: rotate(2deg) scale(1.03);
  }
}

@keyframes grain-shift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-1.5%, 1%); }
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .topbar nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero {
    padding-top: 210px;
  }

  .hero-scribble {
    top: 30%;
    right: -42%;
    width: 128vw;
  }

  .toc-grid,
  .about,
  .skills,
  .showcase {
    grid-template-columns: 1fr;
  }

  .work-slots {
    grid-template-columns: 1fr;
  }

  .work-card.wide,
  .project-card.wide {
    grid-column: auto;
  }

  .project-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  main,
  .topbar {
    width: min(100% - 20px, 1180px);
  }

  .topbar nav a {
    min-width: calc(25% - 12px);
  }

  h1 {
    font-size: clamp(4.8rem, 25vw, 7.5rem);
  }

  .contents,
  .section-band {
    padding: 62px 0;
  }

  .software-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-gallery {
    grid-template-columns: 1fr;
  }
}

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