/* Visual system, layout, and responsive styling for the Dadabaze website. */

:root {
  --ink: #15120d;
  --night: #11100f;
  --paper: #fff8e8;
  --paper-deep: #f7e7be;
  --gold: #ffd447;
  --coral: #ff5b49;
  --teal: #075865;
  --aqua: #12b3a8;
  --plum: #6f244a;
  --shadow: rgba(10, 9, 7, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Avenir, "Avenir Next", Inter, "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 17px),
    linear-gradient(128deg, #ffd447 0 16%, #ff5b49 16% 31%, #075865 31% 59%, #fff0c8 59% 75%, #6f244a 75% 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(22deg, transparent 0 46%, rgba(17, 16, 15, 0.2) 46% 48%, transparent 48% 100%),
    radial-gradient(circle, rgba(17, 16, 15, 0.18) 1px, transparent 1.5px);
  background-size: auto, 18px 18px;
  mix-blend-mode: multiply;
  opacity: 0.7;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 248, 232, 0.25), rgba(17, 16, 15, 0.2));
}

.site-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: calc(100vh - 58px);
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 132px;
  color: var(--paper);
  text-shadow: 0 4px 0 rgba(17, 16, 15, 0.22);
}

.brand-mark {
  width: 132px;
  height: 132px;
  object-fit: contain;
  filter: drop-shadow(0 12px 0 rgba(17, 16, 15, 0.22)) drop-shadow(0 22px 30px rgba(17, 16, 15, 0.26));
}

.wordmark {
  display: grid;
  gap: 0;
  line-height: 0.9;
}

.wordmark-name {
  margin: 0;
  font-size: 4.4rem;
  font-weight: 950;
  letter-spacing: 0;
}

.wordmark-domain {
  justify-self: start;
  margin-top: 8px;
  padding: 6px 14px 7px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
  background: var(--gold);
  border: 2px solid var(--ink);
  text-shadow: none;
}

.joke-stage {
  display: grid;
  place-items: center;
  padding: 34px 0 54px;
}

.joke-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  gap: 28px;
  width: min(890px, 100%);
  min-height: 286px;
  padding: 48px 48px 44px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 248, 232, 0.96)),
    var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow:
    14px 14px 0 var(--teal),
    28px 28px 0 rgba(255, 91, 73, 0.78),
    0 32px 85px var(--shadow);
}

.joke-panel::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 48px;
  right: 48px;
  height: 8px;
  background: linear-gradient(90deg, var(--coral) 0 28%, var(--gold) 28% 48%, var(--aqua) 48% 78%, var(--plum) 78% 100%);
  border-radius: 999px;
}

.joke-text {
  margin: 0;
  color: var(--ink);
  font-size: 2.65rem;
  font-weight: 900;
  line-height: 1.13;
  letter-spacing: 0;
  text-wrap: balance;
}

.refresh-button {
  display: inline-grid;
  place-items: center;
  width: 82px;
  height: 82px;
  color: var(--paper);
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 8px 0 var(--gold), 0 16px 26px rgba(17, 16, 15, 0.28);
  cursor: pointer;
  transform: translateY(-4px);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.refresh-button:hover {
  background: var(--teal);
  transform: translateY(-8px) rotate(-7deg);
  box-shadow: 0 12px 0 var(--gold), 0 22px 30px rgba(17, 16, 15, 0.3);
}

.refresh-button:focus-visible {
  outline: 4px solid var(--coral);
  outline-offset: 5px;
}

.refresh-button:active {
  transform: translateY(0) rotate(0deg);
  box-shadow: 0 4px 0 var(--gold), 0 10px 18px rgba(17, 16, 15, 0.24);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.82;
}

.refresh-icon {
  width: 32px;
  height: 32px;
  background-color: currentColor;
  -webkit-mask: url("/icons/refresh-cw.svg") center / contain no-repeat;
  mask: url("/icons/refresh-cw.svg") center / contain no-repeat;
}

.refresh-button.is-loading .refresh-icon {
  animation: spin 680ms linear infinite;
}

.site-footer {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 0 20px 18px;
  color: rgba(255, 248, 232, 0.92);
  font-family: "Times New Roman", Times, serif;
  font-size: 0.95rem;
  text-align: center;
  text-shadow: 0 1px 2px rgba(17, 16, 15, 0.38);
}

.site-footer p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

@media (max-width: 720px) {
  .site-shell {
    width: min(100% - 28px, 560px);
    min-height: calc(100vh - 64px);
    padding-top: 22px;
  }

  .brand {
    flex-direction: column;
    gap: 8px;
    min-height: 178px;
    text-align: center;
  }

  .brand-mark {
    width: 112px;
    height: 112px;
  }

  .wordmark-name {
    font-size: 3.05rem;
  }

  .wordmark-domain {
    justify-self: center;
    font-size: 0.95rem;
  }

  .joke-stage {
    padding: 24px 0 40px;
  }

  .joke-panel {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 330px;
    padding: 44px 24px 34px;
    gap: 26px;
    box-shadow:
      8px 8px 0 var(--teal),
      16px 16px 0 rgba(255, 91, 73, 0.78),
      0 28px 70px var(--shadow);
  }

  .joke-panel::before {
    left: 24px;
    right: 24px;
  }

  .joke-text {
    font-size: 2rem;
    text-align: center;
  }

  .refresh-button {
    width: 74px;
    height: 74px;
  }
}

@media (max-width: 390px) {
  .wordmark-name {
    font-size: 2.55rem;
  }

  .joke-text {
    font-size: 1.72rem;
  }
}

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