/* Fredoka, Copyright 2016 The Fredoka Project Authors. SIL OFL 1.1.
   See assets/fonts/OFL-Fredoka.txt. Used only as the Gugo wordmark. */

@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url("../assets/fonts/fredoka-700-latin.woff2") format("woff2");
}

:root {
  --ink: #241f33;
  --muted: #5c5670;
  --line: #e6dfd4;
  --paper: #ffffff;
  --persimmon: #f04e23;
  --amethyst: #6f46b0;
  --jungle: #08724e;
  --marigold: #c56f00;
  --gold: #f6c445;
  --gold-deep: #e3ac1e;
  --cream: #fff8ee;
  --soft: #f7f4ef;
  --link: #5b348f;
  --sans: "Segoe UI", "Avenir Next", Inter, Cantarell, "Liberation Sans", sans-serif;
  --display: Fredoka, "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  --shadow: 0 10px 30px rgba(36, 31, 51, 0.06);
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}

main {
  flex: 1;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 5;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

.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;
}

.logo {
  margin: 0;
  color: inherit;
  text-decoration: none;
}

.logo-letters {
  display: inline-flex;
  align-items: flex-end;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(4.6rem, 20vw, 8.4rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.logo--small .logo-letters {
  font-size: 2.4rem;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.c-persimmon { color: var(--persimmon); }
.c-amethyst { color: var(--amethyst); }
.c-jungle { color: #0c8f62; }
.c-marigold { color: var(--marigold); }

.logo-letters > span {
  display: inline-block;
  animation: pop 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.logo-letters > span:nth-child(2) { animation-delay: 0.06s; }
.logo-letters > span:nth-child(3) { animation-delay: 0.12s; }
.logo-letters > span:nth-child(4) { animation-delay: 0.18s; }

.logo--small .logo-letters > span {
  animation: none;
}

.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 20px 12px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.tagline {
  margin: 28px 0 22px;
  max-width: 26rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.search-form {
  width: min(100%, 584px);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 16px;
  border-radius: 18px;
  background: #fff;
  border: 2px solid #e0d8cc;
  box-shadow: 0 1px 2px rgba(36, 31, 51, 0.04), 0 10px 28px rgba(36, 31, 51, 0.06);
}

.search:focus-within {
  border-color: var(--amethyst);
  box-shadow: 0 0 0 4px rgba(111, 70, 176, 0.16);
}

.glyph {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.search input:focus {
  outline: none;
}

.search input::placeholder {
  color: #8d879c;
}

.search input::-webkit-search-decoration,
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 584px);
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: #3c3454;
}

.btn-lucky {
  background: var(--gold);
  color: var(--ink);
}

.btn-lucky:hover {
  background: var(--gold-deep);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
}

.btn-ghost:hover {
  background: #fbf8ff;
  border-color: #d3c6ea;
}

.topbar {
  padding: 16px 20px 4px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.topbar-inner {
  width: min(1040px, 100%);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.topbar .search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 280px;
  width: auto;
}

.topbar .search {
  flex: 1 1 220px;
  box-shadow: none;
}

.topbar .actions {
  flex-direction: row;
  width: auto;
  margin-top: 0;
  flex: 1 1 220px;
}

.topbar .actions .btn {
  flex: 1 1 auto;
}

.stage {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px 20px 36px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.parody-flag {
  display: inline-block;
  margin: 0 0 16px;
  padding: 4px 10px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.query-title {
  margin: 0 0 8px;
  font-weight: 650;
}

.query-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 650;
}

.query-term {
  display: inline;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  background-image: linear-gradient(#ffe08a, #ffe08a);
  background-repeat: no-repeat;
  background-position: 0 88%;
  background-size: 100% 0.38em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.stats {
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.suggest {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--cream);
  border: 1.5px solid #f3e2c2;
  font-size: 1.05rem;
}

.suggest p {
  margin: 0;
}

.suggest-label {
  color: var(--muted);
}

.suggest a,
.suggest-alt a {
  color: var(--ink);
  font-weight: 700;
  text-decoration-color: var(--persimmon);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.suggest-alt {
  margin: 8px 0 0;
  color: var(--muted);
}

.hits {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
}

.hit {
  padding: 16px 0;
  border-top: 1px solid #f0ebe3;
  animation: rise 0.45s ease both;
}

.hit:nth-child(1) { animation-delay: 0.02s; }
.hit:nth-child(2) { animation-delay: 0.06s; }
.hit:nth-child(3) { animation-delay: 0.1s; }
.hit:nth-child(4) { animation-delay: 0.14s; }
.hit:nth-child(5) { animation-delay: 0.18s; }
.hit:nth-child(6) { animation-delay: 0.22s; }
.hit:nth-child(7) { animation-delay: 0.26s; }
.hit:nth-child(8) { animation-delay: 0.3s; }

.hit-url {
  margin: 0 0 2px;
  color: var(--jungle);
  font-family: "Cascadia Mono", ui-monospace, "Segoe UI Mono", monospace;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.hit-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.hit-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.hit-toggle:hover .hit-label {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.hit-label {
  overflow-wrap: anywhere;
}

.more {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1.5px solid #e3d8f3;
  border-radius: 999px;
  color: var(--amethyst);
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.hit-toggle[aria-expanded="true"] .more {
  transform: rotate(45deg);
}

.hit-snippet,
.hit-extra {
  margin: 6px 0 0;
  max-width: 65ch;
}

.hit-extra {
  padding: 10px 12px;
  border-left: 3px solid var(--amethyst);
  border-radius: 0 12px 12px 0;
  background: #fbf8ff;
}

.related {
  margin-top: 28px;
}

.related-title,
.share-title {
  margin: 0 0 10px;
  font-size: 1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.chip:hover {
  border-color: #d3c6ea;
  background: #fbf8ff;
}

.share {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.share-note,
.share-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.lucky-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 32px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

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

.confetti i {
  position: absolute;
  top: -24px;
  width: 9px;
  height: 14px;
  border-radius: 3px;
  opacity: 0;
}

.confetti.is-on i {
  animation: fall 1.45s ease-in forwards;
}

.confetti i:nth-child(4n + 1) { background: var(--persimmon); }
.confetti i:nth-child(4n + 2) { background: var(--amethyst); border-radius: 99px; height: 9px; }
.confetti i:nth-child(4n + 3) { background: #0c8f62; }
.confetti i:nth-child(4n + 4) { background: var(--gold); }

.confetti i:nth-child(1) { left: 6%; animation-delay: 0s; }
.confetti i:nth-child(2) { left: 16%; animation-delay: 0.05s; }
.confetti i:nth-child(3) { left: 28%; animation-delay: 0.12s; }
.confetti i:nth-child(4) { left: 38%; animation-delay: 0.02s; }
.confetti i:nth-child(5) { left: 48%; animation-delay: 0.18s; }
.confetti i:nth-child(6) { left: 58%; animation-delay: 0.08s; }
.confetti i:nth-child(7) { left: 70%; animation-delay: 0.14s; }
.confetti i:nth-child(8) { left: 80%; animation-delay: 0.04s; }
.confetti i:nth-child(9) { left: 90%; animation-delay: 0.2s; }
.confetti i:nth-child(10) { left: 12%; animation-delay: 0.22s; }
.confetti i:nth-child(11) { left: 52%; animation-delay: 0.1s; }
.confetti i:nth-child(12) { left: 74%; animation-delay: 0.16s; }

.card {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  padding: 28px 22px 22px;
  border-radius: 28px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(120deg, var(--persimmon), var(--amethyst), #0c8f62, var(--marigold)) border-box;
  border: 3px solid transparent;
  box-shadow: var(--shadow);
  text-align: center;
}

.card.card-replay {
  animation: rise 0.45s ease both;
}

.card-face {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
}

.card-face .eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 5.2s ease-in-out infinite;
}

.kicker {
  margin: 0;
  color: var(--marigold);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card h1 {
  margin: 8px 0 10px;
  font-family: var(--display);
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.joke {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
}

.dedica {
  margin: 14px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.prose {
  width: min(68ch, 100%);
  margin: 0 auto;
  padding: 8px 20px 40px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.prose h1 {
  margin: 8px 0 12px;
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.prose h2 {
  margin: 28px 0 8px;
  font-size: 1.15rem;
}

.prose p,
.prose li {
  font-size: 1.02rem;
}

.prose ul {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}

.prose li + li {
  margin-top: 6px;
}

.prose code {
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.prose .btn {
  margin-top: 20px;
}

.footer {
  margin-top: auto;
  padding: 18px 20px 22px;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  border-top: 1px solid var(--line);
  background: var(--soft);
  text-align: center;
}

.disclaimer {
  margin: 0;
  font-weight: 700;
}

.fine {
  margin: 6px auto 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
}

.footer-nav a,
.prose a {
  color: var(--link);
  font-weight: 700;
}

.footer-nav a {
  text-decoration: none;
}

.footer-nav a:hover,
.prose a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid var(--amethyst);
  outline-offset: 3px;
}

.search:focus-within {
  outline: none;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@keyframes blink {
  0%, 82%, 100% { transform: scaleY(1); }
  88%, 94% { transform: scaleY(0.12); }
}

@keyframes fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(82vh) rotate(200deg);
  }
}

@media (min-width: 720px) {
  .actions {
    flex-direction: row;
  }

  .home .actions .btn,
  .card-actions .btn {
    flex: 1;
  }

  .card-actions {
    flex-direction: row;
  }

  .topbar .actions {
    flex: 0 0 auto;
  }

  .topbar .actions .btn {
    flex: 0 0 auto;
  }
}

@media (max-width: 719px) {
  .topbar .actions .btn {
    padding-inline: 10px;
    font-size: 0.92rem;
  }
}

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