:root {
  color-scheme: dark;
  --key-height: clamp(320px, calc(100svh - 230px), 640px);
  --key-gap: clamp(8px, 1.25vw, 20px);
  --key-width: min(
    calc(var(--key-height) * 0.333333),
    calc((100vw - 36px - (7 * var(--key-gap))) * 0.125)
  );
}

@font-face {
  font-family: "SF Gothican";
  src: url("assets/font/SF-Gothican.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Disintegrate";
  src: url("assets/font/DISINTEG.TTF") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: #10120f;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.dream-copy {
  color: #f1ead8;
  font-family: "SF Gothican", "Cooper Black", Georgia, serif;
  font-synthesis: weight;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow:
    0 3px 8px rgba(0, 0, 0, 0.62),
    0 0 1px rgba(255, 255, 255, 0.28);
}

.site-url {
  color: #fff;
  font-family: "Disintegrate", "Cooper Black", Georgia, serif;
  font-synthesis: none;
  font-weight: 400;
  letter-spacing: 0;
  text-shadow:
    0 3px 4px rgba(0, 0, 0, 0.48),
    0 0 1px rgba(255, 255, 255, 0.35);
}

.dream-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  min-height: 100svh;
  padding: clamp(128px, 23svh, 190px) clamp(18px, 4vw, 72px) clamp(84px, 12svh, 150px);
  isolation: isolate;
}

.dream-stage::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("assets/img/background.jpg") center / cover no-repeat;
  content: "";
}

.dream-stage::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 46%, transparent 0 42%, rgba(0, 0, 0, 0.18) 70%),
    linear-gradient(180deg, rgba(7, 8, 7, 0.18), rgba(7, 8, 7, 0.42));
  content: "";
  pointer-events: none;
}

.dream-copy {
  position: absolute;
  top: clamp(28px, 6.6svh, 72px);
  left: clamp(22px, 4vw, 62px);
  right: clamp(22px, 4vw, 62px);
  z-index: 2;
  pointer-events: none;
  text-align: right;
}

.dream-quote {
  max-width: 1480px;
  margin: 0;
  margin-left: auto;
  font-size: clamp(1.38rem, 2.28vw, 2.92rem);
  line-height: 1.02;
  text-align: right;
}

.dream-quote span {
  display: block;
  overflow-wrap: anywhere;
  text-wrap: balance;
  white-space: normal;
}

.key-strip {
  display: grid;
  grid-template-columns: repeat(8, var(--key-width));
  gap: var(--key-gap);
  align-items: end;
  justify-content: center;
  width: min-content;
  max-width: calc(100vw - 36px);
  overflow-x: visible;
  overflow-y: visible;
  padding: 0;
  z-index: 1;
}

.dream-key {
  position: relative;
  display: block;
  width: var(--key-width);
  height: var(--key-height);
  min-height: 0;
  flex: 0 0 auto;
  overflow: hidden;
  border: 0;
  background: #111;
  box-shadow:
    0 24px 36px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0.92;
  outline: none;
  transform: translateY(calc((var(--i) - 3.5) * 0.5px));
  transition:
    box-shadow 180ms ease,
    filter 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.dream-key::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.18) 0%,
      rgba(0, 0, 0, 0.3) 18%,
      rgba(0, 0, 0, 0.44) 34%,
      rgba(0, 0, 0, 0.54) 46%,
      rgba(0, 0, 0, 0.54) 54%,
      rgba(0, 0, 0, 0.44) 66%,
      rgba(0, 0, 0, 0.3) 82%,
      rgba(0, 0, 0, 0.18) 100%
    );
  content: "";
  pointer-events: none;
}

.dream-key::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.02) 42%, rgba(0, 0, 0, 0.18)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.22));
  content: "";
  pointer-events: none;
}

.dream-key img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.key-label {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  color: #fff;
  font-family: "SF Gothican", "Cooper Black", Georgia, serif;
  font-synthesis: weight;
  font-size: min(clamp(1.5rem, 3.18vw, 3.4rem), calc(var(--key-height) * 0.1));
  font-weight: 700;
  line-height: 1;
  padding: 0.12em 0.18em 0.2em;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.9),
    1px -1px 0 rgba(0, 0, 0, 0.9),
    -1px 1px 0 rgba(0, 0, 0, 0.9),
    1px 1px 0 rgba(0, 0, 0, 0.9),
    0 0 12px rgba(255, 244, 194, 0.36);
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
  pointer-events: none;
}

.key-label--with-icon,
.key-label--constellation {
  display: inline-flex;
  align-items: center;
  gap: 0.44em;
}

.key-label:has(.key-icon--blog) {
  gap: 0.58em;
}

.key-icon,
.key-constellation-orbit {
  position: relative;
  flex: 0 0 auto;
  width: 0.78em;
  height: 0.78em;
}

.key-icon {
  color: #fff0a6;
  filter: drop-shadow(0 0 9px rgba(255, 240, 166, 0.42));
}

.key-icon::before,
.key-icon::after {
  position: absolute;
  content: "";
}

.key-icon--blog {
  border: 0.055em solid rgba(255, 240, 166, 0.82);
  border-radius: 0.1em;
  background:
    linear-gradient(currentColor 0 0) 0.14em 0.24em / 0.34em 0.045em no-repeat,
    linear-gradient(currentColor 0 0) 0.14em 0.4em / 0.5em 0.045em no-repeat,
    rgba(255, 240, 166, 0.07);
  animation: key-quill-css 4s ease-in-out infinite;
}

.key-icon--blog::before {
  right: 0.08em;
  top: -0.14em;
  width: 0.14em;
  height: 0.74em;
  border-radius: 80% 80% 45% 45%;
  background:
    linear-gradient(118deg, transparent 0 44%, rgba(17, 18, 15, 0.58) 45% 54%, transparent 55%),
    currentColor;
  box-shadow: 0 0 0.24em rgba(255, 240, 166, 0.28);
  transform: rotate(43deg);
  transform-origin: center bottom;
}

.key-icon--blog::after {
  right: 0.06em;
  top: 0.55em;
  width: 0.25em;
  height: 0.055em;
  border-radius: 0.04em;
  background: #d99a64;
  transform: rotate(-38deg);
}

.key-icon--about {
  border: 0.06em solid rgba(255, 240, 166, 0.78);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, currentColor 0 0.08em, transparent 0.09em);
  box-shadow:
    inset 0 0 0 0.05em rgba(255, 240, 166, 0.1),
    0 0 0.18em rgba(255, 240, 166, 0.18);
  animation: key-profile-css 4.6s ease-in-out infinite;
}

.key-icon--about::before {
  inset: 0.14em;
  background: currentColor;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.key-icon--about::after {
  left: 50%;
  top: 50%;
  width: 0.12em;
  height: 0.12em;
  border-radius: 50%;
  background: #d99a64;
  transform: translate(-50%, -50%);
}

.key-icon--book {
  border-bottom: 0.07em solid currentColor;
  animation: key-shelf-css 4.2s ease-in-out infinite;
}

.key-icon--book::before,
.key-icon--book::after {
  bottom: 0.08em;
  border-radius: 0.04em 0.04em 0.01em 0.01em;
  background: currentColor;
}

.key-icon--book::before {
  left: 0.05em;
  width: 0.13em;
  height: 0.55em;
  box-shadow:
    0.17em 0.04em 0 -0.01em #d99a64,
    0.34em -0.02em 0 0 rgba(255, 240, 166, 0.88),
    0.52em 0.07em 0 -0.02em rgba(156, 246, 200, 0.9);
}

.key-icon--book::after {
  right: 0.06em;
  width: 0.14em;
  height: 0.5em;
  background: rgba(255, 240, 166, 0.72);
  transform: rotate(-7deg);
  transform-origin: bottom center;
}

.key-icon--audio::before {
  left: 50%;
  top: 0.08em;
  width: 0.28em;
  height: 0.48em;
  border-radius: 999px;
  background: currentColor;
  transform: translateX(-50%);
  transform-origin: center bottom;
  animation: key-mic-head-pulse 2.45s ease-in-out infinite;
}

.key-icon--audio::after {
  left: 50%;
  bottom: 0.08em;
  width: 0.48em;
  height: 0.34em;
  border: 0.06em solid currentColor;
  border-top: 0;
  border-radius: 0 0 50% 50%;
  box-shadow: 0 0.22em 0 -0.1em currentColor;
  transform: translateX(-50%);
}

.key-icon--media {
  border: 0.06em solid currentColor;
  border-radius: 0.12em;
  animation: key-screen-flicker 3.4s ease-in-out infinite;
}

.key-icon--media::before {
  left: 0.31em;
  top: 0.22em;
  width: 0;
  height: 0;
  border-top: 0.16em solid transparent;
  border-bottom: 0.16em solid transparent;
  border-left: 0.25em solid currentColor;
}

.key-icon--media::after {
  left: 50%;
  bottom: -0.16em;
  width: 0.32em;
  height: 0.06em;
  border-radius: 999px;
  background: currentColor;
  transform: translateX(-50%);
}

.key-icon--award {
  animation: key-award-twinkle 2.8s ease-in-out infinite;
}

.key-icon--award::before {
  inset: 0.04em;
  background: currentColor;
  clip-path: polygon(50% 0, 62% 35%, 100% 35%, 69% 57%, 80% 96%, 50% 72%, 20% 96%, 31% 57%, 0 35%, 38% 35%);
}

.key-icon--award::after {
  left: 50%;
  bottom: -0.08em;
  width: 0.38em;
  height: 0.2em;
  border: 0.06em solid #d99a64;
  border-top: 0;
  border-radius: 0 0 0.08em 0.08em;
  transform: translateX(-50%);
}

.key-icon--contact {
  border: 0.07em solid currentColor;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, currentColor 0 0.12em, transparent 0.13em);
  animation: key-contact-simple 3.8s ease-in-out infinite;
}

.key-icon--contact::before {
  inset: -0.12em;
  border: 0.06em solid currentColor;
  border-radius: 50%;
  opacity: 0;
  animation: key-contact-ring 2.4s ease-out infinite;
}

.key-icon--contact::after {
  right: 0.02em;
  top: 0.02em;
  width: 0.15em;
  height: 0.15em;
  border-radius: 50%;
  background: #d99a64;
}

.key-constellation-orbit {
  border: 1px solid rgba(255, 240, 166, 0.62);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 240, 166, 0.28);
}

.key-constellation-orbit::before,
.key-constellation-orbit::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.key-constellation-orbit::before {
  inset: 28%;
  background: #fff0a6;
  box-shadow:
    0 0 10px rgba(255, 240, 166, 0.72),
    0.42em -0.22em 0 -0.17em #d99a64,
    -0.32em 0.32em 0 -0.17em #9cf6c8;
}

.key-constellation-orbit::after {
  inset: 2px;
  border: 1px solid rgba(156, 246, 200, 0.52);
  transform: rotate(28deg) scaleX(1.42);
  animation: key-constellation-orbit 4.8s linear infinite;
}

@keyframes key-constellation-orbit {
  to {
    transform: rotate(388deg) scaleX(1.42);
  }
}

@keyframes key-quill-css {
  50% {
    transform: translateY(-0.05em) rotate(3deg);
    filter: drop-shadow(0 0 0.42em rgba(255, 240, 166, 0.6));
  }
}

@keyframes key-profile-css {
  50% {
    transform: translateY(-0.04em);
    box-shadow: 0 0 0.48em rgba(255, 240, 166, 0.28);
  }
}

@keyframes key-shelf-css {
  50% {
    transform: translateY(-0.04em) rotate(1deg);
  }
}

@keyframes key-mic-head-pulse {
  0%,
  100% {
    background: #fff0a6;
    box-shadow: 0 0 0.18em rgba(255, 240, 166, 0.28);
    transform: translateX(-50%) scale(0.96, 0.98);
  }

  50% {
    background: #f0c383;
    box-shadow: 0 0 0.34em rgba(240, 195, 131, 0.48);
    transform: translateX(-50%) scale(1.08, 1.1);
  }
}

@keyframes key-screen-flicker {
  0%,
  100% {
    box-shadow: inset 0 0 0 rgba(255, 240, 166, 0), 0 0 0.12em rgba(255, 240, 166, 0.18);
  }

  45%,
  52% {
    box-shadow: inset 0 0 0.28em rgba(255, 240, 166, 0.22), 0 0 0.32em rgba(255, 240, 166, 0.34);
  }
}

@keyframes key-award-twinkle {
  50% {
    transform: rotate(10deg) scale(1.08);
    filter: drop-shadow(0 0 0.42em rgba(255, 240, 166, 0.7));
  }
}

@keyframes key-contact-simple {
  50% {
    transform: translateY(-0.05em);
    filter: drop-shadow(0 0 0.48em rgba(255, 240, 166, 0.58));
  }
}

@keyframes key-contact-ring {
  0% {
    opacity: 0.56;
    transform: scale(0.7);
  }

  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.dream-key:hover,
.dream-key:focus-visible {
  box-shadow:
    0 30px 54px rgba(0, 0, 0, 0.48),
    0 0 0 2px rgba(240, 231, 190, 0.72),
    0 0 34px rgba(240, 231, 190, 0.18);
  filter: saturate(1.06) contrast(1.06);
  opacity: 1;
  transform: translateY(-10px);
}

.dream-key.is-disabled {
  cursor: default;
}

.site-url {
  position: absolute;
  left: clamp(22px, 4vw, 62px);
  bottom: clamp(20px, 3.5svh, 40px);
  z-index: 2;
  color: #fff;
  font-size: clamp(1.8rem, 4vw, 4.2rem);
  line-height: 0.95;
  text-decoration: none;
}

.site-url:hover,
.site-url:focus-visible {
  outline: none;
  text-shadow:
    0 3px 4px rgba(0, 0, 0, 0.5),
    0 0 18px rgba(255, 255, 255, 0.32);
}

@media (prefers-reduced-motion: reduce) {
  .key-icon,
  .key-icon::after,
  .key-icon--book::before,
  .key-icon--book::after,
  .key-constellation-orbit::after {
    animation: none !important;
  }
}

@media (max-width: 760px) {
  :root {
    --key-height: auto;
    --key-width: min(clamp(58px, 20vw, 96px), calc((100vw - 46px) * 0.25));
    --key-gap: 10px;
  }

  .dream-stage {
    display: grid;
    align-items: center;
    justify-items: center;
    min-height: 100svh;
    padding: clamp(142px, 24svh, 184px) 16px 92px;
  }

  .dream-copy {
    top: 24px;
    left: 16px;
    right: 16px;
    text-align: center;
  }

  .dream-quote {
    max-width: 100%;
    margin-inline: auto;
    font-size: clamp(1.08rem, 4.08vw, 1.72rem);
    line-height: 1.06;
    text-align: center;
  }

  .key-strip {
    grid-template-columns: repeat(4, var(--key-width));
    row-gap: 14px;
    width: min-content;
    max-width: calc(100vw - 36px);
    overflow: visible;
    padding: 0;
  }

  .dream-key {
    width: auto;
    height: auto;
    aspect-ratio: 1 / 3;
  }

  .key-label {
    font-size: clamp(1.22rem, 5.6vw, 1.78rem);
  }

  .dream-key:nth-child(7) .key-label {
    font-size: clamp(0.92rem, 4.1vw, 1.28rem);
  }

  .site-url {
    left: 16px;
    right: 16px;
    bottom: 24px;
    font-size: clamp(1.55rem, 8vw, 2.4rem);
  }
}

@media (min-width: 761px) and (max-height: 680px) {
  :root {
    --key-height: clamp(300px, calc(100svh - 188px), 500px);
  }

  .dream-stage {
    padding-top: clamp(102px, 18svh, 128px);
    padding-bottom: clamp(62px, 9svh, 84px);
  }

  .dream-copy {
    top: clamp(20px, 4.8svh, 34px);
  }

  .dream-quote {
    font-size: clamp(1.12rem, 1.78vw, 1.94rem);
  }

  .site-url {
    bottom: clamp(14px, 2.8svh, 24px);
    font-size: clamp(1.45rem, 3.2vw, 3.1rem);
  }
}

@media (max-width: 760px) and (max-height: 740px) {
  :root {
    --key-width: min(clamp(50px, 18vw, 74px), calc((100vw - 46px) * 0.25));
  }

  .dream-stage {
    padding-top: clamp(112px, 20svh, 136px);
    padding-bottom: 70px;
  }

  .dream-copy {
    top: 18px;
  }

  .dream-quote {
    font-size: clamp(0.98rem, 3.64vw, 1.32rem);
  }

  .key-strip {
    row-gap: 10px;
  }

  .key-label {
    font-size: clamp(1rem, 4.8vw, 1.42rem);
  }

  .dream-key:nth-child(7) .key-label {
    font-size: clamp(0.8rem, 3.6vw, 1.06rem);
  }

  .site-url {
    bottom: 16px;
    font-size: clamp(1.24rem, 7vw, 1.9rem);
  }
}

@media (max-width: 430px) {
  :root {
    --key-width: min(clamp(54px, 20.5vw, 82px), calc((100vw - 46px) * 0.25));
  }

  .key-strip {
    grid-template-columns: repeat(4, var(--key-width));
  }
}

@media (max-width: 430px) and (max-height: 740px) {
  :root {
    --key-width: min(clamp(50px, 18vw, 74px), calc((100vw - 46px) * 0.25));
  }
}
