/* Small additions to Bootstrap. Keep this file short. */

/* Single-column pages (log-in, sign-up, account forms). */
.narrow {
  max-width: 28rem;
}

/* allauth renders password rules as a list inside the help text. */
.form-text ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

/* Wider single column for longer forms. */
.narrow-lg {
  max-width: 44rem;
}

/* The signed-in home page, so cards don't stretch across a wide screen. */
.narrow-xl {
  max-width: 66rem;
}

/* Mastery and daily goal bars. */
.progress-thin {
  height: 0.375rem;
}

/* A fixed width, so bars in the topic tree line up. */
.mastery-label {
  min-width: 7.5rem;
  text-align: end;
}

/* New questions with AI: a topic's description in a popover, keeping its line breaks. */
.topic-description-popover .popover-body {
  white-space: pre-line;
}
.topic-info:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

/* Practice with auto-advance: a darker fill sweeps across "Next question",
   and site.js clicks it when the sweep ends. Pause freezes the sweep. */
.auto-advance {
  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  animation: auto-advance-fill var(--auto-advance-duration, 2s) linear forwards;
}
.auto-advance.paused {
  animation-play-state: paused;
}
@keyframes auto-advance-fill {
  to {
    background-size: 100% 100%;
  }
}

/* Topics from a syllabus: the PDF's pages as tickable thumbnails. */
.pdf-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
  max-height: 24rem;
  overflow-y: auto;
}
.pdf-pages:empty {
  display: none;
}
.pdf-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  font-size: 0.8rem;
}
.pdf-page:has(input:checked) {
  border-color: var(--bs-primary);
  outline: 2px solid var(--bs-primary);
}
.pdf-page:has(input:disabled) .pdf-page-label {
  opacity: 0.5;
}
.pdf-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.pdf-page-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}
.pdf-page-label .form-check-input {
  margin: 0;
}
.pdf-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--bs-border-color);
  background: #fff;
}
.pdf-thumb canvas {
  width: 100%;
  height: auto;
  background: #fff;
}

/* Topics from a syllabus, the review page: descriptions grow with their
   text where the browser can (field-sizing), between about 4 and 16 lines. */
textarea.outline-description {
  field-sizing: content;
  min-height: 6.5em;
  max-height: 24em;
}

/* "Continue with Google", to Google's sign-in branding guidelines: white with
   a #747775 border (dark: #131314 with #8E918F), 14/20 medium text, 12px
   before the 18px "G", 10px after it and 12px after the text, 40px tall.
   Hover and press darken by 8% and 12% of the text colour (Material). */
.btn-google {
  --bs-btn-padding-x: 12px;
  --bs-btn-padding-y: 9px;
  --bs-btn-font-family: "Google Sans", Roboto, system-ui, sans-serif;
  --bs-btn-font-size: 14px;
  --bs-btn-font-weight: 500;
  --bs-btn-line-height: 20px;
  --bs-btn-border-radius: 4px;
  --bs-btn-color: #1f1f1f;
  --bs-btn-bg: #fff;
  --bs-btn-border-color: #747775;
  --bs-btn-hover-color: #1f1f1f;
  --bs-btn-hover-bg: #ededed;
  --bs-btn-hover-border-color: #747775;
  --bs-btn-active-color: #1f1f1f;
  --bs-btn-active-bg: #e4e4e4;
  --bs-btn-active-border-color: #747775;
  --bs-btn-focus-shadow-rgb: 116, 119, 117;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
[data-bs-theme="dark"] .btn-google {
  --bs-btn-color: #e3e3e3;
  --bs-btn-bg: #131314;
  --bs-btn-border-color: #8e918f;
  --bs-btn-hover-color: #e3e3e3;
  --bs-btn-hover-bg: #242425;
  --bs-btn-hover-border-color: #8e918f;
  --bs-btn-active-color: #e3e3e3;
  --bs-btn-active-bg: #2c2c2d;
  --bs-btn-active-border-color: #8e918f;
  --bs-btn-focus-shadow-rgb: 142, 145, 143;
}

/* Badges (templates/achievements/). The art is an inline SVG sprite. */
.badge-art {
  --badge-bg: #eef2ff;
  overflow: visible;
}
[data-bs-theme="dark"] .badge-art {
  --badge-bg: #2a2d48;
}
.badge-bg {
  fill: var(--badge-bg);
}
.badge-locked {
  filter: grayscale(1);
  opacity: 0.4;
}
.badge-question {
  font: 700 34px system-ui, sans-serif;
  fill: #3c3c3c;
}
.celebrate {
  background: linear-gradient(135deg, #fff0f6, #eef2ff 60%, #f0fff4);
  border: 2px dashed #e8a3b8;
}
[data-bs-theme="dark"] .celebrate {
  background: linear-gradient(135deg, #3a2533, #262a45 60%, #1f3328);
}
.badge-pop {
  display: inline-block;
  animation: badge-pop 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes badge-pop {
  0% { transform: scale(0) rotate(-25deg); }
  60% { transform: scale(1.18) rotate(8deg); }
  80% { transform: scale(0.95) rotate(-4deg); }
  100% { transform: scale(1) rotate(0); }
}
.badge-wiggle:hover {
  animation: badge-wiggle 0.5s ease-in-out;
}
@keyframes badge-wiggle {
  25% { transform: rotate(-8deg) scale(1.06); }
  75% { transform: rotate(8deg) scale(1.06); }
}
.pond {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  gap: 1rem;
  text-align: center;
}
.pond-progress {
  background: linear-gradient(90deg, #9d92cc, #e8a3b8);
}
.badge-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2000;
}
.confetti i {
  position: absolute;
  top: -1rem;
  width: 0.5rem;
  height: 0.8rem;
  border-radius: 2px;
  animation: confetti-fall var(--fall, 2.4s) cubic-bezier(0.3, 0.6, 0.6, 1) forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--drift, 0), 105vh) rotate(var(--spin, 540deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-pop,
  .badge-wiggle:hover {
    animation: none;
  }
}
/* The pond: badges earned today glow, with a "New today" tag. */
.pond-today {
  background: linear-gradient(135deg, #fff0f6, #eef2ff);
  border: 2px dashed #e8a3b8;
}
[data-bs-theme="dark"] .pond-today {
  background: linear-gradient(135deg, #3a2533, #262a45);
}
.pond-new {
  border-color: #e8a3b8;
}
.pond-badge-new .badge-art {
  border-radius: 50%;
  animation: pond-glow 2s ease-in-out infinite;
}
@keyframes pond-glow {
  0%, 100% { box-shadow: 0 0 0.4rem 0.1rem rgba(255, 126, 182, 0.45); }
  50% { box-shadow: 0 0 1rem 0.35rem rgba(255, 200, 61, 0.6); }
}
.pond-new-tag {
  position: absolute;
  bottom: -0.3rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #ff7eb6;
  color: #fff;
  font-size: 0.65rem;
}
@media (prefers-reduced-motion: reduce) {
  .pond-badge-new .badge-art {
    animation: none;
    box-shadow: 0 0 0.6rem 0.2rem rgba(255, 126, 182, 0.5);
  }
}

/* The free vs. AI tokens table on the home and About pages: the one row
   that differs stands out. */
.plans-table th[scope="col"]:not(:first-child),
.plans-table td {
  width: 30%;
}

.plans-table .plans-table-different > * {
  background-color: var(--bs-primary-bg-subtle);
}

/* "More" under a topic's description on a public study guide's page. */
.topic-more summary {
  color: var(--bs-link-color);
  width: fit-content;
}
