/* ==========================================================
   pretorius.no — anime møter grindhouse
   Farger og fonter samlet i variabler, lett å justere.
   ========================================================== */

:root {
  --ink: #0b0b0c;
  --ink-2: #16161a;
  --paper: #f4efe6;
  --yellow: #ffd400;
  --blood: #e3122b;
  --muted: #9a958c;

  --font-display: 'Anton', 'Impact', sans-serif;
  --font-jp: 'Dela Gothic One', 'Hiragino Sans', sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--yellow);
  color: var(--ink);
}

/* ---------- Filmkorn ---------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}

@keyframes grain {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-3%, 2%);
  }
  40% {
    transform: translate(2%, -3%);
  }
  60% {
    transform: translate(-2%, -1%);
  }
  80% {
    transform: translate(3%, 3%);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* ---------- 404 ---------- */
.hero {
  position: relative;
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px var(--gutter) 80px;
  overflow: hidden;
  isolation: isolate;
}

/* Den røde sola */
.sun {
  position: absolute;
  z-index: -2;
  right: -10vmin;
  top: 50%;
  width: 70vmin;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #ff3348, var(--blood) 60%, #8a0a19);
  transform: translateY(-50%);
  box-shadow: 0 0 120px rgba(227, 18, 43, 0.45);
  animation: rise 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes rise {
  from {
    transform: translateY(-20%);
    opacity: 0;
  }
  to {
    transform: translateY(-50%);
    opacity: 1;
  }
}

/* Vertikal japansk tekst */
.kanji {
  position: absolute;
  z-index: -1;
  right: var(--gutter);
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--font-jp);
  font-size: clamp(2.5rem, 8vw, 6rem);
  line-height: 1;
  color: var(--ink);
  letter-spacing: 0.05em;
  opacity: 0.85;
}

/* Tarantino-kapitteltittel */
.chapter {
  margin: 0 0 12px;
  font-size: clamp(0.8rem, 1.6vw, 1rem);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  animation: fadeUp 0.8s 0.2s both;
}
.chapter span {
  display: inline-block;
  padding: 2px 10px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
}

/* Hovedtittel */
.title {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.5rem, 15vw, 13rem);
  line-height: 0.9;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--yellow);
  text-shadow: 6px 6px 0 var(--blood);
  animation: slam 0.7s 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.title .dot {
  color: var(--paper);
}

/* Glitch-effekt ved hover */
.title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--paper);
  text-shadow: none;
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}
.title:hover::after {
  animation: slice 0.5s steps(4) both;
}

@keyframes slice {
  0% {
    clip-path: inset(10% 0 70% 0);
    transform: translateX(-6px);
  }
  33% {
    clip-path: inset(50% 0 30% 0);
    transform: translateX(6px);
  }
  66% {
    clip-path: inset(75% 0 5% 0);
    transform: translateX(-3px);
  }
  100% {
    clip-path: inset(0 0 100% 0);
    transform: none;
  }
}

@keyframes slam {
  from {
    transform: scale(1.6) rotate(-3deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes fadeUp {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.tagline {
  max-width: 34ch;
  margin: 28px 0 36px;
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--paper);
  animation: fadeUp 0.8s 0.8s both;
}

.cta {
  align-self: flex-start;
  display: inline-flex;
  gap: 12px;
  align-items: center;
  padding: 14px 28px;
  border: 2px solid var(--yellow);
  color: var(--ink);
  background: var(--yellow);
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 5px 5px 0 var(--blood);
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    background 0.15s,
    color 0.15s;
  animation: fadeUp 0.8s 1s both;
}
.cta:hover,
.cta:focus-visible {
  transform: translate(-3px, -3px);
  box-shadow: 8px 8px 0 var(--blood);
  outline: none;
}
.cta:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--blood);
}

/* ---------- Startsiden: én scene ---------- */
.scene {
  --horizon: 30%;
  --ground: #060607;
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 480px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 90% 60% at 50% 70%, rgba(227, 18, 43, 0.55), transparent 70%),
    linear-gradient(#0b0b0c 0%, #1c0710 45%, #4a0a17 70%);
}

/* Anime-fartslinjer som stråler ut fra sola */
.scene-speedlines {
  position: absolute;
  z-index: -2;
  inset: -50%;
  background: repeating-conic-gradient(
    from 0deg at 50% 58%,
    rgba(255, 212, 0, 0.07) 0deg 1.4deg,
    transparent 1.4deg 9deg
  );
  mask-image: radial-gradient(circle at 50% 58%, transparent 12%, #000 45%);
  -webkit-mask-image: radial-gradient(circle at 50% 58%, transparent 12%, #000 45%);
  animation: spin 160s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Sola går ned bak horisonten, med striper som en gammel filmplakat */
.scene-sun {
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: calc(var(--horizon) - min(17vmin, 150px));
  width: min(78vmin, 680px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(#ffe14d 0%, #ffb000 28%, #ff4a1c 58%, var(--blood) 80%);
  box-shadow:
    0 0 80px rgba(255, 74, 28, 0.55),
    0 0 220px rgba(227, 18, 43, 0.45);
  transform: translateX(-50%);
  animation: sunrise 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.scene-sun::after {
  content: '';
  position: absolute;
  inset: 48% 0 0;
  background: repeating-linear-gradient(transparent 0 16px, #2a0710 16px 22px);
}

@keyframes sunrise {
  from {
    transform: translate(-50%, 25%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* Beaglen: rå siluett mot sola */
.beagle {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: calc(var(--horizon) - 2px);
  width: min(72vmin, 640px);
  height: auto;
  transform: translateX(-50%);
  overflow: visible;
  filter: drop-shadow(0 0 1.5px rgba(255, 212, 0, 0.55));
  animation: stalk 1.2s 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.beagle-body {
  fill: var(--ink);
}
.beagle-ear {
  transform-box: fill-box;
  transform-origin: 30% 5%;
  animation: sway 2.4s ease-in-out infinite alternate;
}
.beagle-tail,
.beagle-tip {
  fill: none;
  stroke: var(--ink);
}
.beagle-tip {
  stroke: var(--paper);
}
.beagle-scarf,
.beagle-eye {
  fill: var(--yellow);
}
.scarf-tail {
  transform-box: fill-box;
  transform-origin: 100% 50%;
  animation: flutter 0.9s ease-in-out infinite alternate;
}

@keyframes stalk {
  from {
    transform: translate(-50%, 12%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes sway {
  from {
    transform: rotate(-4deg);
  }
  to {
    transform: rotate(6deg);
  }
}

@keyframes flutter {
  from {
    transform: skewY(-6deg) scaleX(0.94);
  }
  to {
    transform: skewY(5deg) scaleX(1.04);
  }
}

/* Bakken med røde refleksstriper */
.horizon {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  height: var(--horizon);
  border-top: 2px solid var(--blood);
  background:
    repeating-linear-gradient(transparent 0 10px, rgba(227, 18, 43, 0.12) 10px 12px),
    linear-gradient(rgba(227, 18, 43, 0.25), transparent 60%), var(--ground);
  box-shadow: 0 -1px 24px rgba(227, 18, 43, 0.6);
}

/* Tittelen ligger på bakken */
.scene-title {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: calc(var(--horizon) / 2);
  margin-bottom: -0.45em;
  padding: 0 16px;
  font-size: clamp(3rem, 16vw, 10.5rem);
  text-align: center;
  white-space: nowrap;
}
.scene-title::after {
  padding: 0 16px;
}

/* Kirsebærblomster som driver forbi */
.petals {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}
.petals i {
  position: absolute;
  top: -5%;
  width: 10px;
  height: 7px;
  border-radius: 100% 0;
  background: #ff9ec0;
  opacity: 0.85;
  animation: drift 11s linear infinite;
}
.petals i:nth-child(1) {
  left: 8%;
  animation-delay: -1s;
}
.petals i:nth-child(2) {
  left: 18%;
  animation-duration: 14s;
  animation-delay: -6s;
}
.petals i:nth-child(3) {
  left: 30%;
  animation-duration: 9s;
  animation-delay: -3s;
}
.petals i:nth-child(4) {
  left: 44%;
  animation-duration: 13s;
  animation-delay: -9s;
}
.petals i:nth-child(5) {
  left: 55%;
  animation-delay: -5s;
}
.petals i:nth-child(6) {
  left: 66%;
  animation-duration: 15s;
  animation-delay: -2s;
}
.petals i:nth-child(7) {
  left: 74%;
  animation-duration: 10s;
  animation-delay: -7s;
}
.petals i:nth-child(8) {
  left: 83%;
  animation-duration: 12s;
  animation-delay: -4s;
}
.petals i:nth-child(9) {
  left: 92%;
  animation-duration: 9s;
  animation-delay: -8s;
}
.petals i:nth-child(10) {
  left: 98%;
  animation-duration: 16s;
  animation-delay: -11s;
}

@keyframes drift {
  from {
    transform: translate(0, 0) rotate(0deg);
  }
  to {
    transform: translate(-30vw, 110vh) rotate(720deg);
  }
}

/* ---------- Mobil ---------- */
@media (max-width: 640px) {
  .sun {
    width: 90vw;
    right: -35vw;
    top: 30%;
    opacity: 0.9;
  }
  .kanji {
    font-size: 2.5rem;
    top: 28%;
  }
  .title {
    text-shadow: 4px 4px 0 var(--blood);
  }
  .scene {
    --horizon: 34%;
  }
  .beagle {
    width: 86vw;
  }
}

/* ---------- Respekter redusert bevegelse ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
