/* CodingTricksHub — Custom stylesheet */

/* ─────────────────────────────────────────────────────────
   Typography foundation
   ───────────────────────────────────────────────────────── */

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

body {
    /* Enable OpenType features: kerning, ligatures, contextual alternates */
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent ragged single-word last lines on headings */
h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
    text-rendering: optimizeLegibility;
}

/* ─────────────────────────────────────────────────────────
   Interactive element transitions (a, button)
   ───────────────────────────────────────────────────────── */

a, button {
    transition-property: color, background-color, border-color,
                         opacity, box-shadow, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* ─────────────────────────────────────────────────────────
   Hero dot-grid background
   ───────────────────────────────────────────────────────── */

.hero-grid {
    background-image: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.055) 1px,
        transparent 1px
    );
    background-size: 32px 32px;
}

/* ─────────────────────────────────────────────────────────
   Article prose
   ───────────────────────────────────────────────────────── */

.prose-article {
    font-size: 1.0625rem;   /* 17px — more comfortable for long reads */
    line-height: 1.8;
}

.prose-article h2,
.prose-article h3,
.prose-article h4 {
    letter-spacing: -0.02em;
}

.prose-article pre {
    border-radius: 0.75rem;
    overflow-x: auto;
}

.prose-article blockquote {
    border-left-width: 3px;
    border-color: #6366f1;
    background: #f8f7ff;
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: normal;   /* intentional — blockquotes aren't always quotations */
}

/* ─────────────────────────────────────────────────────────
   Navbar
   ───────────────────────────────────────────────────────── */

.nav-shadow {
    box-shadow: 0 1px 0 0 rgba(255,255,255,0.04),
                0 2px 8px 0 rgba(0,0,0,0.35);
}

/* ─────────────────────────────────────────────────────────
   Topic card hover glow on icon
   ───────────────────────────────────────────────────────── */

.topic-card:hover .topic-icon {
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.10);
}

/* ─────────────────────────────────────────────────────────
   Article card — top accent bar animation
   ───────────────────────────────────────────────────────── */

.card-accent {
    height: 3px;
    opacity: 0.7;
    transition: opacity 200ms;
}

article:hover .card-accent,
.card:hover .card-accent {
    opacity: 1;
}

/* ─────────────────────────────────────────────────────────
   Touch target: mobile menu button
   ───────────────────────────────────────────────────────── */

#mobile-menu-btn {
    min-width:  44px;
    min-height: 44px;
    /* display is controlled by Tailwind (md:hidden / flex) on the element itself */
}

/* ─────────────────────────────────────────────────────────
   Keyboard focus
   ───────────────────────────────────────────────────────── */

:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 3px;
    border-radius: 4px;
}

/* ─────────────────────────────────────────────────────────
   Scrollbar (Webkit)
   ───────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─────────────────────────────────────────────────────────
   Page entrance animation
   ───────────────────────────────────────────────────────── */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-up            { animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.fade-up-delay-1    { animation-delay: 0.06s; }
.fade-up-delay-2    { animation-delay: 0.14s; }
.fade-up-delay-3    { animation-delay: 0.24s; }

/* Respect user's motion preference (WCAG 2.1 SC 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration:        0.01ms !important;
        animation-iteration-count: 1      !important;
        transition-duration:       0.01ms !important;
        scroll-behavior:           auto   !important;
    }
    .fade-up, .fade-up-delay-1, .fade-up-delay-2, .fade-up-delay-3 {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ─────────────────────────────────────────────────────────
   Code block copy button (injected by JS)
   ───────────────────────────────────────────────────────── */

.code-copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #64748b;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 0.375rem;
    cursor: pointer;
    min-height: 28px;
    transition: color 0.15s, background 0.15s;
}

.code-copy-btn:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.14);
}
