/* =====================================================================
   Learnify — styles that Tailwind utilities can't express on their own.
   Everything else lives in the markup as utility classes.
   ===================================================================== */

:root {
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --ink-800:   #1b1a3d;
  --surface:   #f6f6fb;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow-x: hidden;                 /* never allow sideways scroll */
  font-feature-settings: 'cv11', 'ss01';
}

*, *::before, *::after { min-width: 0; }

/* --- Focus: always visible for keyboard users -------------------- */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 6px;
}
:focus:not(:focus-visible) { outline: none; }

/* --- Scrollbars -------------------------------------------------- */
.scrollbar-thin { scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.35) transparent; }
.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(148,163,184,.35); border-radius: 99px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }

/* --- Sidebar drawer state --------------------------------------- */
[data-sidebar].is-open { transform: translateX(0); }
body.nav-locked { overflow: hidden; }

/* --- Entrance animation ----------------------------------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise .45s cubic-bezier(.22,.9,.3,1) both; }
.rise-1 { animation-delay: .04s; }
.rise-2 { animation-delay: .08s; }
.rise-3 { animation-delay: .12s; }
.rise-4 { animation-delay: .16s; }

@keyframes pop {
  0%   { opacity: 0; transform: scale(.94); }
  60%  { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}
.pop { animation: pop .35s cubic-bezier(.22,.9,.3,1) both; }

/* --- 3D flashcard flip ------------------------------------------ */
.perspective { perspective: 1600px; }
.flip-inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4,.15,.2,1);
}
.flip-inner.is-flipped { transform: rotateY(180deg); }
.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip-face--back { transform: rotateY(180deg); }

/* --- Circular progress ring ------------------------------------- */
.ring-track { stroke: #e9e8f5; }
.ring-value {
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(.22,.9,.3,1);
}

/* --- Notes editor ----------------------------------------------- */
.note-editor[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}
.note-editor h1 { font-size: 1.75rem; font-weight: 700; margin: 1.25rem 0 .5rem; color: #0f172a; }
.note-editor h2 { font-size: 1.35rem; font-weight: 700; margin: 1.1rem 0 .45rem; color: #0f172a; }
.note-editor h3 { font-size: 1.1rem;  font-weight: 600; margin: 1rem 0 .4rem;   color: #1e293b; }
.note-editor p  { margin: .6rem 0; line-height: 1.75; }
.note-editor ul, .note-editor ol { margin: .7rem 0 .7rem 1.4rem; line-height: 1.75; }
.note-editor ul { list-style: disc; }
.note-editor ol { list-style: decimal; }
.note-editor blockquote {
  border-left: 3px solid var(--brand-400, #818cf8);
  padding-left: 1rem;
  margin: .9rem 0;
  color: #475569;
  font-style: italic;
}
.note-editor a { color: var(--brand-600); text-decoration: underline; }

/* Rendered note previews reuse the same rhythm */
.note-body h1, .note-body h2, .note-body h3 { font-weight: 700; color: #0f172a; margin: .8rem 0 .4rem; }
.note-body p { margin: .5rem 0; line-height: 1.7; }
.note-body ul { list-style: disc; margin-left: 1.3rem; }
.note-body ol { list-style: decimal; margin-left: 1.3rem; }

/* --- Dropzone --------------------------------------------------- */
.dropzone.is-dragging {
  border-color: var(--brand-500);
  background-color: #eef2ff;
  transform: scale(1.01);
}

/* --- Toasts ----------------------------------------------------- */
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast { animation: toast-in .3s cubic-bezier(.22,.9,.3,1) both; pointer-events: auto; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all .25s ease; }

/* --- Quiz option states ----------------------------------------- */
.option-tile { transition: border-color .15s, background-color .15s, box-shadow .15s; }
.option-tile:has(input:checked) {
  border-color: var(--brand-500);
  background-color: #eef2ff;
  box-shadow: 0 0 0 1px var(--brand-500) inset;
}

/* --- Line clamp fallback ---------------------------------------- */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Print ------------------------------------------------------ */
@media print {
  [data-sidebar], header, .no-print { display: none !important; }
  main { padding: 0 !important; }
}

/* --- Respect reduced motion ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
