/* Clipy theme — matches clipy.online's Flash design system.
   Tokens mirror /home/deploy/codebase/clipy/styles/globals.css and
   /home/deploy/codebase/clipy/tailwind.config.js. Hand-written CSS, no
   build step — what's here is what ships.

   Header/footer are deliberately a 1:1 port of components/Header.tsx and
   components/Footer.tsx so the blog feels like the same product. */

:root {
    /* Surface palette (dark) */
    --bg-canvas:          #0A0D16;
    --bg-surface:         #11151F;
    --bg-surface-raised:  #1A1F2D;
    --text-primary:       #EEF0F5;
    --text-secondary:     #9CA3B5;
    --text-muted:         #7B8192;
    --border-subtle:      #252B3A;
    --border-strong:      #363D4E;

    /* Flash brand */
    --flash-50:  #FFF1EC;
    --flash-100: #FFDFD2;
    --flash-400: #FF7352;
    --flash-500: #FF4D29;
    --flash-600: #E63C1C;
    --flash-700: #BF2F12;

    --gradient-flash: linear-gradient(135deg, #FF4D29 0%, #FF2778 55%, #9B1EFF 100%);
    --gradient-flash-soft: radial-gradient(60% 60% at 50% 30%, rgba(255,77,41,0.35), transparent 70%);

    --shadow-1: 0 1px 2px rgba(10,13,22,0.08);
    --shadow-2: 0 6px 20px rgba(10,13,22,0.16);
    --shadow-glow: 0 0 0 4px rgba(255,77,41,0.18), 0 8px 32px rgba(255,77,41,0.32);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --ease-flash: cubic-bezier(0.2, 0.8, 0.2, 1);
    --duration-120: 120ms;
    --duration-220: 220ms;

    --max-content: 800px;
    --max-feed:    1080px;
    --max-nav:     1200px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Gabarito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(255, 77, 41, 0.28);
    color: var(--text-primary);
}

:focus-visible {
    outline: 2px solid var(--flash-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

a {
    color: var(--flash-500);
    text-decoration: none;
    transition: color var(--duration-120) var(--ease-flash);
}
a:hover { color: var(--flash-400); }

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
}

img, video, svg {
    max-width: 100%;
    height: auto;
}

/* ============================================================ */
/* Site header — port of components/Header.tsx                   */
/* ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(10, 13, 22, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.site-nav {
    max-width: var(--max-nav);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Brand group: clipy mark+wordmark | divider | "by Codersera" */
.brand-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    /* gap = ClipyWordmark gap, computed Math.round(40 * 0.08) = 3 */
    gap: 3px;
    color: var(--text-primary);
}
.brand:hover { color: var(--text-primary); }
.brand svg {
    flex-shrink: 0;
}

/* "clipy" wordmark: ClipyWordmark size=40 → fontSize Math.round(40*0.82)=33px */
.brand .wordmark {
    font-weight: 800;
    font-size: 33px;
    line-height: 1;
    letter-spacing: -0.045em;
    color: var(--text-primary);
}
.brand .wordmark-c { color: var(--flash-500); }

/* "by Codersera" attribution — hidden below 640px (sm: in Tailwind) */
.by-attribution {
    display: none;
    align-items: center;
    gap: 8px;
    padding-left: 12px;
    margin-left: 4px;
    border-left: 1px solid var(--border-subtle);
}
.by-text {
    /* text-body-sm text-muted */
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
}

.codersera-mark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    transition: opacity var(--duration-120) var(--ease-flash);
}
.codersera-mark:hover {
    color: var(--text-primary);
    opacity: 0.8;
}
.codersera-mark img {
    width: 21px;
    height: 18px;
    flex-shrink: 0;
}
.codersera-mark span {
    /* CoderseraWordmark size=18 → fontSize 18*0.82 ≈ 15px, font-bold tracking-tight */
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1;
}

@media (min-width: 640px) {
    .by-attribution { display: inline-flex; }
}

/* Main nav */
.nav-links {
    display: none;
    align-items: center;
    gap: 32px;
}
.nav-links a,
.nav-links .nav-tools-trigger {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
    transition: color var(--duration-120) var(--ease-flash);
    cursor: pointer;
}
.nav-links a:hover,
.nav-links .nav-tools-trigger:hover { color: var(--text-primary); }
.nav-links a.active { color: var(--text-primary); }

/* Tools dropdown — pure CSS hover/focus */
.nav-tools {
    position: relative;
    outline: none;
}
.nav-tools-menu {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 12px;
    width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity var(--duration-220) var(--ease-flash),
                visibility var(--duration-220) var(--ease-flash),
                transform var(--duration-220) var(--ease-flash);
    z-index: 50;
}
.nav-tools:hover .nav-tools-menu,
.nav-tools:focus-within .nav-tools-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-tools-menu a {
    display: block;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 15px;
}
.nav-tools-menu a:hover {
    color: var(--text-primary);
    background: var(--bg-surface-raised);
}

.cta {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--flash-500);
    color: #FFFFFF !important;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    transition: all var(--duration-220) var(--ease-flash);
    box-shadow: var(--shadow-1);
}
.cta:hover {
    background: var(--flash-600);
    box-shadow: var(--shadow-glow);
    color: #FFFFFF !important;
}
.cta-lg {
    padding: 14px 24px;
    font-size: 16px;
}

@media (min-width: 768px) {
    .nav-links { display: inline-flex; }
    .cta { display: inline-flex; }
}

/* ============================================================ */
/* Hero (list pages, taxonomy pages)                             */
/* ============================================================ */
.hero {
    padding: 96px 24px 48px;
    text-align: left;
}

.hero-inner {
    max-width: var(--max-feed);
    margin: 0 auto;
}

.hero-overline {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--flash-500);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.hero-title {
    font-size: clamp(2.5rem, 4vw + 1rem, 5rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
}

.hero-subtitle {
    margin-top: 16px;
    max-width: 640px;
    font-size: clamp(1.0625rem, 0.25vw + 1rem, 1.25rem);
    line-height: 1.55;
    color: var(--text-secondary);
}

.gradient-text {
    background: var(--gradient-flash);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.author-hero { text-align: center; }
.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 16px;
    border: 2px solid var(--border-subtle);
}
.author-hero .hero-overline,
.author-hero .hero-title,
.author-hero .hero-subtitle { display: block; }
.author-hero .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================ */
/* Post feed (cards)                                             */
/* ============================================================ */
.post-feed-wrap {
    max-width: var(--max-feed);
    margin: 0 auto;
    padding: 24px 24px 96px;
}

.post-feed {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 720px) {
    .post-feed { grid-template-columns: repeat(2, 1fr); }
    .post-feed > .post-card:first-child { grid-column: 1 / -1; }
    .post-feed > .post-card:first-child .post-card-image-wrap {
        aspect-ratio: 21 / 9;
    }
}

@media (min-width: 1024px) {
    .post-feed { grid-template-columns: repeat(3, 1fr); }
    .post-feed > .post-card:first-child { grid-column: 1 / -1; }
}

.post-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--duration-220) var(--ease-flash),
                border-color var(--duration-220) var(--ease-flash),
                box-shadow var(--duration-220) var(--ease-flash);
}

.post-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-2);
}

.post-card-link {
    display: block;
    color: inherit;
}
.post-card-link:hover { color: inherit; }

.post-card-image-wrap {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-surface-raised);
}

.post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 420ms var(--ease-flash);
}

.post-card:hover .post-card-image { transform: scale(1.03); }

.post-card-body { padding: 24px; }

.post-card-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--flash-500);
    margin-bottom: 12px;
}

.post-card-title {
    font-size: clamp(1.25rem, 0.5vw + 1rem, 1.5rem);
    line-height: 1.25;
    letter-spacing: -0.005em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
    transition: color var(--duration-120) var(--ease-flash);
}

.post-card:hover .post-card-title { color: var(--flash-500); }

.post-card-excerpt {
    color: var(--text-secondary);
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}
.post-card-author { color: var(--text-secondary); }
.post-card-dot { color: var(--text-muted); }

/* ============================================================ */
/* Pagination                                                    */
/* ============================================================ */
.pagination {
    margin-top: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: var(--bg-surface);
    transition: all var(--duration-220) var(--ease-flash);
}
.pagination a:hover {
    border-color: var(--flash-500);
    color: var(--text-primary);
}

.pagination .older { margin-left: auto; }

/* ============================================================ */
/* Single post                                                   */
/* ============================================================ */
.post { color: var(--text-primary); }

.post-header { padding: 96px 24px 32px; }

.post-header-inner {
    max-width: var(--max-content);
    margin: 0 auto;
}

.post-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--flash-500);
    margin-bottom: 12px;
}

.post-title {
    font-size: clamp(2rem, 3vw + 1rem, 3.5rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.post-excerpt {
    color: var(--text-secondary);
    font-size: clamp(1.0625rem, 0.25vw + 1rem, 1.25rem);
    line-height: 1.55;
    margin: 0 0 24px;
}

.post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
}
.post-meta-author { color: var(--text-secondary); font-weight: 500; }
.post-meta-dot { color: var(--text-muted); }

.post-feature {
    max-width: 1100px;
    margin: 0 auto 48px;
    padding: 0 24px;
}
.post-feature img {
    width: 100%;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    display: block;
}
.post-feature figcaption {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 12px;
}

.post-content {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 24px 64px;
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.7;
}

.post-content > * + * { margin-top: 1.25em; }

.post-content h2 {
    color: var(--text-primary);
    font-size: clamp(1.5rem, 1vw + 1rem, 2rem);
    line-height: 1.2;
    margin-top: 2em;
    margin-bottom: 0.5em;
    letter-spacing: -0.01em;
}

.post-content h3 {
    color: var(--text-primary);
    font-size: 1.375rem;
    line-height: 1.3;
    margin-top: 1.6em;
    margin-bottom: 0.4em;
}

.post-content h4 {
    color: var(--text-primary);
    font-size: 1.125rem;
    line-height: 1.35;
    margin-top: 1.4em;
    margin-bottom: 0.4em;
}

.post-content p { margin: 1.25em 0; }

.post-content a {
    color: var(--flash-500);
    border-bottom: 1px solid rgba(255,77,41,0.4);
    transition: all var(--duration-120) var(--ease-flash);
}
.post-content a:hover {
    color: var(--flash-400);
    border-bottom-color: var(--flash-400);
}

.post-content strong, .post-content b { color: var(--text-primary); font-weight: 700; }
.post-content em, .post-content i { font-style: italic; }

.post-content ul, .post-content ol {
    padding-left: 1.4em;
    margin: 1.25em 0;
}
.post-content li { margin: 0.5em 0; }
.post-content li::marker { color: var(--flash-500); }

.post-content blockquote {
    margin: 2em 0;
    padding: 4px 0 4px 24px;
    border-left: 3px solid var(--flash-500);
    color: var(--text-primary);
    font-size: 1.125rem;
    font-style: italic;
}

.post-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9em;
    padding: 2px 6px;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--flash-400);
}

.post-content pre {
    margin: 1.5em 0;
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.post-content pre code {
    background: transparent;
    border: 0;
    padding: 0;
    color: inherit;
}

.post-content img,
.post-content figure {
    max-width: 100%;
    margin: 2em auto;
    border-radius: var(--radius-lg);
    display: block;
}
.post-content figure { margin: 2em 0; }
.post-content figure img { margin: 0 auto; border-radius: var(--radius-lg); }
.post-content figcaption {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 12px;
}

.post-content hr {
    border: 0;
    height: 1px;
    background: var(--border-subtle);
    margin: 3em 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 15px;
}
.post-content th,
.post-content td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.post-content th {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--bg-surface);
}

/* Ghost cards — wide/full image sizing.
   Required by gscan; without them wide/full images render unstyled. */
.post-content .kg-width-wide {
    position: relative;
    width: 85vw;
    max-width: 1100px;
    margin-left: 50%;
    transform: translateX(-50%);
}
.post-content .kg-width-full {
    position: relative;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}
.post-content .kg-width-wide img,
.post-content .kg-width-full img {
    width: 100%;
    border-radius: var(--radius-lg);
}
.post-content .kg-width-full img { border-radius: 0; }

.post-content .kg-card { margin: 2em 0; }
.post-content .kg-bookmark-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
}
.post-content .kg-bookmark-container {
    display: flex;
    color: inherit;
    border: 0;
}
.post-content .kg-bookmark-content {
    flex: 1;
    padding: 20px;
}
.post-content .kg-bookmark-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.post-content .kg-bookmark-description {
    color: var(--text-secondary);
    font-size: 14px;
}
.post-content .kg-callout-card {
    padding: 20px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--flash-500);
    border-radius: var(--radius-md);
}
.post-content .kg-image-card,
.post-content .kg-gallery-card { margin: 2em 0; }

/* ============================================================ */
/* Tags + author footer + related                                */
/* ============================================================ */
.post-tags {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 24px 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.post-tag-pill {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 77, 41, 0.1);
    border: 1px solid rgba(255, 77, 41, 0.3);
    color: var(--flash-500);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--duration-220) var(--ease-flash);
}
.post-tag-pill:hover {
    background: rgba(255, 77, 41, 0.18);
    border-color: var(--flash-500);
    color: var(--flash-400);
}

.post-author {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 32px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 16px;
}
.post-author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
}
.post-author-name {
    margin: 0 0 4px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}
.post-author-bio {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.related {
    max-width: var(--max-feed);
    margin: 0 auto;
    padding: 64px 24px 96px;
    border-top: 1px solid var(--border-subtle);
}
.related-title {
    font-size: clamp(1.5rem, 1vw + 1rem, 2rem);
    color: var(--text-primary);
    margin: 0 0 32px;
    letter-spacing: -0.01em;
}

/* ============================================================ */
/* Empty + error                                                 */
/* ============================================================ */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 64px 24px;
}

.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 96px 24px;
}
.error-inner {
    max-width: 640px;
    text-align: center;
}
.error-inner .cta {
    display: inline-flex;
    margin-top: 32px;
}

/* ============================================================ */
/* Footer — port of components/Footer.tsx + FooterLinks.tsx      */
/* ============================================================ */
.site-footer {
    position: relative;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-canvas);
    margin-top: 96px;
}

.footer-hairline {
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        rgba(255,77,41,0) 0%,
        rgba(255,77,41,0.5) 50%,
        rgba(255,77,41,0) 100%
    );
}

.footer-inner {
    max-width: var(--max-nav);
    margin: 0 auto;
    padding: 56px 24px;
}

/* 5-col grid at md+: brand spans 2, then Explore/Tools/Legal fill row 1;
   Products + Contact wrap to row 2 (matches Footer.tsx + FooterLinks.tsx). */
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .footer-brand {
        grid-column: span 2;
    }
}

.footer-brand {
    max-width: 360px;
}
.footer-brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.footer-version {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 999px;
}
.footer-tagline {
    color: var(--text-secondary);
    margin: 16px 0 0;
    font-size: 16px;
    line-height: 1.55;
    max-width: 384px;
}

.footer-col h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col li { margin: 0 0 8px; }

.footer-col a {
    color: var(--text-secondary);
    font-size: 16px;
    transition: color var(--duration-120) var(--ease-flash);
}
.footer-col a:hover { color: var(--text-primary); }

.footer-bottom {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 14px;
}
.footer-bottom p { margin: 0; }
.footer-bottom .powered-by {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 640px) {
    .footer-bottom { flex-direction: row; }
}

/* ============================================================ */
/* Scrollbar                                                     */
/* ============================================================ */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-subtle) transparent;
}
*::-webkit-scrollbar       { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
