/* ============================================================
   style.css  —  Project-wide custom styles.
   Tailwind handles layout/spacing; this file handles
   custom components Tailwind doesn't cover out of the box.
   ============================================================ */

/* ── Flash / Alert Messages ───────────────────────────────── */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    border-width: 1px;
    border-style: solid;
}
.alert--success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}
.alert--error {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.alert--warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
.alert--info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}
.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    color: #4f46e5;
    border: 1px solid #e0e7ff;
    background: #ffffff;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.pagination a:hover {
    background: #eef2ff;
}
.pagination a.active {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
    font-weight: 600;
    pointer-events: none;
}

/* ── Line Clamp (for post excerpts) ───────────────────────── */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Prose (blog post body) ───────────────────────────────── */
.prose h1, .prose h2, .prose h3 { font-weight: 700; color: #111827; margin: 1.5em 0 0.5em; }
.prose h1 { font-size: 1.875rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose p  { margin-bottom: 1.125em; line-height: 1.75; }
.prose a  { color: #4f46e5; text-decoration: underline; }
.prose ul, .prose ol { padding-left: 1.5em; margin-bottom: 1em; }
.prose li { margin-bottom: 0.25em; }
.prose pre { background: #1e1e2e; color: #cdd6f4; padding: 1rem; border-radius: 0.5rem;
             overflow-x: auto; font-size: 0.875rem; margin-bottom: 1rem; }
.prose code { background: #f3f4f6; padding: 0.1em 0.35em; border-radius: 0.25rem;
              font-size: 0.875em; color: #4f46e5; }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose blockquote { border-left: 4px solid #4f46e5; padding-left: 1rem;
                    color: #6b7280; font-style: italic; margin: 1.5em 0; }
.prose img { max-width: 100%; border-radius: 0.75rem; margin: 1.5rem 0; }

/* ── Focus visible (accessibility) ───────────────────────── */
:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* ── Page Preloader ───────────────────────────────────────── */
#page-preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background-color: #0f172a;
    overflow: hidden;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

/* Subtle grid overlay — matches site background */
#page-preloader::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.06;
    background-image:
        linear-gradient(to right,  rgba(139,92,246,0.5) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(139,92,246,0.5) 1px, transparent 1px);
    background-size: 48px 48px;
    z-index: 0;
}

/* No orbs in preloader */

/* Spinner and label sit above background layers */
#page-preloader .loader,
#page-preloader .preloader-text {
    position: relative;
    z-index: 1;
}
#page-preloader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none;
}
#page-preloader .preloader-text {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(196,181,253,0.5);
}
.loader {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,0.08);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-sizing: border-box;
    animation: spin 1s linear infinite;
}
.loader::after {
    content: '';
    box-sizing: border-box;
    position: absolute;
    inset: -3px;
    border: 3px solid transparent;
    border-top-color: #9333ea;
    border-right-color: rgba(147,51,234,0.3);
    border-radius: 50%;
    animation: spin 0.65s linear infinite reverse;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Button / inline loaders ──────────────────────────────── */
.btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-sizing: border-box;
    animation: rotation 0.8s linear infinite;
    vertical-align: middle;
}
.btn-loader::after {
    content: '';
    box-sizing: border-box;
    position: absolute;
    left: 0;
    top: 0;
    background: #fff;
    width: 6px;
    height: 6px;
    transform: translate(-50%, 50%);
    border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════════
   Mobile Responsiveness & Visual Polish
   ═══════════════════════════════════════════════════════════ */

/* ── Smooth mobile menu transition ──────────────────────── */
#mobile-menu {
    transition: opacity 0.2s ease, transform 0.2s ease;
}
#mobile-menu.hidden {
    display: none !important;
}

/* ── Back-to-top button polish ───────────────────────────── */
#back-to-top {
    transition: opacity 0.3s, transform 0.3s;
}
#back-to-top:hover { transform: translateY(-3px); }

/* ── Alert colours in dark theme ────────────────────────── */
.dark .alert--success { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.dark .alert--error   { background: rgba(239,68,68,0.12);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.dark .alert--warning { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); color: #fde68a; }
.dark .alert--info    { background: rgba(99,102,241,0.12); border-color: rgba(99,102,241,0.3); color: #a5b4fc; }

/* ── Pagination — dark theme variant ────────────────────── */
.dark .pagination a {
    background: rgba(255,255,255,0.05);
    border-color: rgba(139,92,246,0.2);
    color: rgba(196,181,253,0.7);
}
.dark .pagination a:hover {
    background: rgba(139,92,246,0.2);
    color: #c4b5fd;
}
.dark .pagination a.active {
    background: linear-gradient(135deg,#9333ea,#c026d3);
    border-color: transparent;
    color: #fff;
}

/* ── Responsive images ───────────────────────────────────── */
img { max-width: 100%; height: auto; }

/* ── Main content padding on small screens ───────────────── */
@media (max-width: 640px) {
    main.flex-1 { padding-left: 1rem; padding-right: 1rem; padding-top: 1.25rem; }
    .max-w-6xl.mx-auto { padding-left: 1rem; padding-right: 1rem; }
}

/* ── Horizontal scroll for overflow tables on mobile ─────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Nav link active underline ───────────────────────────── */
.nav-link.active {
    position: relative;
}
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 50%;
    transform: translateX(-50%);
    width: 60%; height: 2px;
    background: linear-gradient(90deg, #9333ea, #c026d3);
    border-radius: 9999px;
}

/* ── Card hover lift effect ──────────────────────────────── */
.card-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(147,51,234,0.2);
}

/* ── Section headings gradient ───────────────────────────── */
.heading-gradient {
    background: linear-gradient(135deg, #c084fc, #f0abfc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Glow dividers ───────────────────────────────────────── */
.glow-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(147,51,234,0.4), transparent);
    margin: 2rem 0;
}

/* ── Blog/project cards on mobile ───────────────────────── */
@media (max-width: 480px) {
    .grid.grid-cols-2 { grid-template-columns: 1fr; }
    .grid.sm\:grid-cols-2 { grid-template-columns: 1fr; }
}

/* ── Floating label inputs (optional enhancement) ────────── */
.input-group { position: relative; }

/* ── Smooth page transitions ─────────────────────────────── */
body { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ════════════════════════════════════════════════════════════
   SCENE BACKGROUND — devgreg-style floating orbs + grid
   ════════════════════════════════════════════════════════════ */
.scene-bg-wrapper {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.scene-bg-grid {
  position: absolute; inset: 0; opacity: 0.13;
  background-image:
    linear-gradient(to right,  rgba(255,255,255,0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.10) 1px, transparent 1px);
  background-size: 50px 50px;
}
.scene-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.11;
}
.scene-orb-1 {
  width:700px;height:700px;top:-15%;left:-5%;
  background:radial-gradient(circle,#7c3aed 0%,transparent 75%);
  animation:floatOrb1 25s ease-in-out infinite;
}
.scene-orb-2 {
  width:600px;height:600px;bottom:-10%;right:-5%;
  background:radial-gradient(circle,#3b82f6 0%,transparent 75%);
  animation:floatOrb2 30s ease-in-out infinite;
}
.scene-orb-3 {
  width:500px;height:500px;top:40%;right:15%;
  background:radial-gradient(circle,#8b5cf6 0%,transparent 75%);
  animation:floatOrb3 22s ease-in-out infinite;
}
.scene-orb-4 {
  width:450px;height:450px;bottom:25%;left:10%;
  background:radial-gradient(circle,#2563eb 0%,transparent 75%);
  animation:floatOrb1 28s ease-in-out reverse infinite;
}
.scene-orb-5 {
  width:400px;height:400px;top:10%;right:35%;
  background:radial-gradient(circle,#6366f1 0%,transparent 75%);
  animation:floatOrb2 20s ease-in-out reverse infinite;
}
.scene-bg-vignette {
  position:absolute;inset:0;
  background:radial-gradient(circle at center,transparent 0%,rgba(2,5,16,0.45) 100%);
}
@keyframes floatOrb1 {
  0%,100%{ transform:translate(0,0) scale(1); }
  33%    { transform:translate(120px,-60px) scale(1.15); }
  66%    { transform:translate(-80px,90px) scale(0.9); }
}
@keyframes floatOrb2 {
  0%,100%{ transform:translate(0,0) scale(1); }
  50%    { transform:translate(-100px,110px) scale(1.12); }
}
@keyframes floatOrb3 {
  0%,100%{ transform:translate(0,0) scale(1); }
  40%    { transform:translate(80px,120px) scale(1.08); }
  80%    { transform:translate(-120px,-70px) scale(0.95); }
}

/* ── 50px squared grid ─────────────────────────────────────── */
.scene-bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.13;
  background-image:
    linear-gradient(to right,  rgba(255,255,255,0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.10) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* ── Orbs ──────────────────────────────────────────────────── */
.scene-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.13;
}

.scene-orb-1 {
  width: 700px; height: 700px;
  top: -15%; left: -5%;
  background: radial-gradient(circle, #7c3aed 0%, transparent 75%);
  animation: sceneFloat1 25s ease-in-out infinite;
}
.scene-orb-2 {
  width: 600px; height: 600px;
  bottom: -10%; right: -5%;
  background: radial-gradient(circle, #3b82f6 0%, transparent 75%);
  animation: sceneFloat2 30s ease-in-out infinite;
}
.scene-orb-3 {
  width: 500px; height: 500px;
  top: 40%; right: 15%;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 75%);
  animation: sceneFloat3 22s ease-in-out infinite;
}
.scene-orb-4 {
  width: 450px; height: 450px;
  bottom: 25%; left: 10%;
  background: radial-gradient(circle, #2563eb 0%, transparent 75%);
  animation: sceneFloat1 28s ease-in-out reverse infinite;
}
.scene-orb-5 {
  width: 400px; height: 400px;
  top: 10%; right: 35%;
  background: radial-gradient(circle, #6366f1 0%, transparent 75%);
  animation: sceneFloat2 20s ease-in-out reverse infinite;
}

/* ── Vignette ──────────────────────────────────────────────── */
.scene-bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(2,5,16,0.45) 100%);
}

@keyframes sceneFloat1 {
  0%,100% { transform: translate(0,0) scale(1); }
  33%     { transform: translate(120px,-60px) scale(1.15); }
  66%     { transform: translate(-80px,90px) scale(0.9); }
}
@keyframes sceneFloat2 {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(-100px,110px) scale(1.12); }
}
@keyframes sceneFloat3 {
  0%,100% { transform: translate(0,0) scale(1); }
  40%     { transform: translate(80px,120px) scale(1.08); }
  80%     { transform: translate(-120px,-70px) scale(0.95); }
}
