:root {
  --paper: #f3f0e8;
  --ink: #181816;
  --yellow: #f4c900;
  --red: #e63b25;
  --line: #252520;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans JP", sans-serif;
  cursor: crosshair;
}

body::before {
  position: fixed;
  z-index: -2;
  inset: 0;
  content: "";
  background-image:
    linear-gradient(rgba(24, 24, 22, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 24, 22, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}

.noise {
  position: fixed;
  z-index: 20;
  inset: 0;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

.site-header {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 2px solid var(--line);
  background: var(--paper);
  position: relative;
  z-index: 10;
  transform-origin: center;
}

.brand {
  width: fit-content;
  color: var(--ink);
  text-decoration: none;
  font-family: "Archivo Black", sans-serif;
  font-size: 24px;
}

.brand span {
  color: var(--red);
}

nav {
  display: flex;
  gap: clamp(20px, 4vw, 56px);
}

nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
}

.header-status {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-family: "Archivo Black", sans-serif;
  font-size: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  background: #38a350;
  border-radius: 50%;
}

.hero {
  padding: 28px clamp(20px, 4vw, 64px) 70px;
}

.hero-kicker {
  display: flex;
  justify-content: space-between;
  font: 700 10px/1 "Noto Sans JP", sans-serif;
  letter-spacing: 0.08em;
}

.title-wrap {
  position: relative;
  max-width: 1400px;
  margin: 24px auto 34px;
  transform-origin: 50% 0;
}

h1 {
  margin: 0;
  font-family: "Archivo Black", "Noto Sans JP", sans-serif;
  font-size: clamp(52px, 9vw, 142px);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: 0;
}

h1 span {
  display: block;
  width: fit-content;
}

h1 span:nth-child(2) {
  margin-left: 13vw;
}

h1 span:nth-child(3) {
  margin-left: auto;
  color: var(--paper);
  -webkit-text-stroke: 3px var(--ink);
}

.title-mark {
  position: absolute;
  right: 2%;
  top: -14%;
  color: var(--red);
  font: 400 clamp(70px, 11vw, 170px)/1 "Noto Sans JP", sans-serif;
  transform: rotate(9deg);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(420px, 1.55fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: end;
  max-width: 1400px;
  margin: 0 auto;
}

.intro {
  padding-bottom: 8px;
}

.lead {
  margin: 0 0 28px;
  font-size: clamp(16px, 1.45vw, 22px);
  line-height: 1.85;
}

.intro > p:not(.lead) {
  max-width: 420px;
  margin: 0;
  font-size: 12px;
  line-height: 2;
}

.click-prompt {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
}

.prompt-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  font-size: 27px;
  animation: nudge 1.5s ease-in-out infinite;
}

.click-prompt b,
.click-prompt small {
  display: block;
}

.click-prompt b {
  font-size: 13px;
}

.click-prompt small {
  margin-top: 3px;
  color: #625f58;
  font-size: 10px;
}

.feature-image {
  position: relative;
  height: clamp(310px, 42vw, 600px);
  margin: 0;
  border: 2px solid var(--ink);
  background: #d8d3ca;
  overflow: visible;
}

.image-slice {
  position: absolute;
  inset: 0;
  background-image: url("assets/demolition-editorial.png");
  background-size: cover;
  background-position: center;
  transition: filter 0.3s;
  will-change: transform, opacity;
}

.slice-1 { clip-path: polygon(0 0, 52% 0, 44% 47%, 0 62%); }
.slice-2 { clip-path: polygon(52% 0, 100% 0, 100% 43%, 44% 47%); }
.slice-3 { clip-path: polygon(0 62%, 44% 47%, 57% 100%, 0 100%); }
.slice-4 { clip-path: polygon(44% 47%, 100% 43%, 100% 100%, 57% 100%); }

figcaption {
  position: absolute;
  right: -2px;
  bottom: -32px;
  left: -2px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 700;
}

.rules {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 40px;
  padding: 38px clamp(20px, 4vw, 64px) 74px;
  border-top: 2px solid var(--line);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
}

.rules ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules li {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  min-height: 60px;
  border-top: 1px solid var(--line);
}

.rules li:last-child {
  border-bottom: 1px solid var(--line);
}

.rules li span {
  font: 400 10px/1 "Archivo Black", sans-serif;
}

.rules li b {
  font-size: clamp(18px, 2.2vw, 32px);
}

.rules li em {
  color: #68645c;
  font-size: 11px;
  font-style: normal;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 64px);
  color: var(--paper);
  background: var(--ink);
  font-size: 9px;
}

.damage-meter {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: auto 96px 38px;
  gap: 8px;
  align-items: center;
  padding: 9px 11px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font: 700 9px/1 "Noto Sans JP", sans-serif;
  box-shadow: 4px 4px 0 var(--ink);
}

.meter-track {
  height: 7px;
  border: 1px solid var(--ink);
}

.meter-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--red);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.damage-meter strong {
  text-align: right;
}

.impact-ring {
  position: fixed;
  z-index: 50;
  width: 20px;
  height: 20px;
  border: 3px solid var(--red);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.impact-ring.hit {
  animation: impact 0.5s ease-out;
}

.debris-field {
  position: fixed;
  z-index: 40;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.debris {
  position: absolute;
  width: var(--size);
  height: var(--size);
  background: var(--color);
  transform: rotate(var(--rot));
  animation: debris-fly 0.75s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}

.repair-button {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 42px;
  display: none;
  align-items: center;
  gap: 13px;
  min-width: 190px;
  padding: 15px 24px;
  color: var(--ink);
  border: 2px solid var(--ink);
  background: var(--yellow);
  font: 900 16px/1 "Noto Sans JP", sans-serif;
  box-shadow: 7px 7px 0 var(--ink);
  cursor: pointer;
  transform: translateX(-50%);
}

.repair-button:hover {
  transform: translate(-50%, -3px);
  box-shadow: 9px 10px 0 var(--ink);
}

.repair-icon {
  font-size: 25px;
}

.final-message {
  position: fixed;
  z-index: 2;
  inset: 0;
  display: grid;
  place-content: center;
  color: rgba(243, 240, 232, 0.08);
  font: 400 clamp(54px, 11vw, 160px)/0.78 "Archivo Black", sans-serif;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

/* Destruction stages */
body.stage-1 .title-wrap {
  animation: heading-fall 1.25s cubic-bezier(0.6, -0.15, 0.86, 0.2) forwards;
}

body.stage-2 .slice-1 { animation: shard-1 1.3s ease-in forwards; }
body.stage-2 .slice-2 { animation: shard-2 1.25s ease-in forwards; }
body.stage-2 .slice-3 { animation: shard-3 1.4s ease-in forwards; }
body.stage-2 .slice-4 { animation: shard-4 1.2s ease-in forwards; }

body.stage-3 .site-header {
  animation: menu-blast 1.15s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}

.falling-char {
  display: inline-block;
  white-space: pre;
  animation: char-fall var(--duration) cubic-bezier(0.55, 0, 0.95, 0.45) var(--delay) forwards;
}

body.stage-5 {
  min-height: 100vh;
  overflow: hidden;
  background: #171715;
}

body.stage-5 #page,
body.stage-5 .site-header,
body.stage-5 .damage-meter,
body.stage-5 .noise {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

body.stage-5 .repair-button {
  display: flex;
  animation: repair-in 0.65s 0.55s both;
}

body.stage-5 .final-message {
  opacity: 1;
  transition: opacity 1s 0.3s;
}

body.repairing::after {
  position: fixed;
  z-index: 200;
  inset: 0;
  content: "";
  background: var(--yellow);
  animation: repair-wipe 0.9s ease-in-out forwards;
}

@keyframes nudge {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(4px, 4px); }
}

@keyframes impact {
  0% { opacity: 1; transform: scale(0.3); }
  100% { opacity: 0; transform: scale(5); }
}

@keyframes debris-fly {
  to {
    opacity: 0;
    transform: translate(var(--x), var(--y)) rotate(calc(var(--rot) + 220deg));
  }
}

@keyframes heading-fall {
  0% { transform: rotate(0) translateY(0); }
  22% { transform: rotate(2deg) translateY(6px); }
  100% { opacity: 0; transform: rotate(13deg) translateY(110vh); }
}

@keyframes shard-1 {
  to { opacity: 0; transform: translate(-38vw, 60vh) rotate(-26deg); }
}

@keyframes shard-2 {
  to { opacity: 0; transform: translate(35vw, 72vh) rotate(32deg); }
}

@keyframes shard-3 {
  to { opacity: 0; transform: translate(-24vw, 88vh) rotate(38deg); }
}

@keyframes shard-4 {
  to { opacity: 0; transform: translate(30vw, 92vh) rotate(-19deg); }
}

@keyframes menu-blast {
  15% { transform: translateX(-8px) rotate(-1deg); }
  100% { opacity: 0; transform: translate(125vw, -40vh) rotate(24deg); }
}

@keyframes char-fall {
  0% { transform: translateY(0) rotate(0); }
  100% { opacity: 0; transform: translateY(115vh) rotate(var(--spin)); }
}

@keyframes repair-in {
  from { opacity: 0; transform: translate(-50%, 35px) rotate(-4deg); }
  to { opacity: 1; transform: translate(-50%, 0) rotate(0); }
}

@keyframes repair-wipe {
  0% { clip-path: inset(100% 0 0 0); }
  50% { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 100% 0); }
}

@media (max-width: 760px) {
  .site-header {
    height: 60px;
    grid-template-columns: 1fr auto;
  }

  nav {
    display: none;
  }

  .hero {
    padding-top: 20px;
  }

  .hero-kicker span:last-child {
    display: none;
  }

  h1 {
    font-size: clamp(45px, 16vw, 84px);
    line-height: 0.92;
  }

  h1 span:nth-child(2) {
    margin-left: 0;
  }

  h1 span:nth-child(3) {
    margin-top: 4px;
    -webkit-text-stroke-width: 1.5px;
  }

  .title-mark {
    top: -18%;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .feature-image {
    height: 62vw;
    min-height: 260px;
    grid-row: 1;
  }

  .intro {
    grid-row: 2;
  }

  .rules {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  footer {
    gap: 20px;
  }

  .damage-meter {
    right: 10px;
    bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
}

