:root {
    --text: #1a1a1a;
    --text-muted: #666;
    --bg: #fff;
    --bg-alt: #f8f8f8;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #e5e5e5;
    --max-width: 720px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */

.site-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}

.site-header nav {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.site-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-logo {
    height: 1.6rem;
    width: auto;
}

.site-name:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 1.25rem;
}

.nav-links a {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
}

.nav-links a:hover {
    color: var(--accent);
}

/* ── Main content ── */

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ── Index / Home page ── */

.index-header {
    margin-bottom: 2rem;
}

.index-header .lead {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin: 0;
}

/* App grid */

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.app-card {
    display: block;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.app-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
}

.app-card h3 {
    font-size: 1rem;
    margin: 0 0 0.4rem;
    line-height: 1.3;
}

.app-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

/* App product pages (minimal layout, same typography as rest of site) */

.app-page .app-header {
    margin-bottom: 2rem;
}

.app-page .app-header h1 {
    font-size: 1.8rem;
    margin: 0 0 0.35rem;
    line-height: 1.25;
}

.app-tagline {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
    line-height: 1.5;
}

.app-cta-primary p,
.app-cta-bottom p {
    margin: 0;
}

.app-cta-bottom {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

a.app-cta-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff !important;
    text-decoration: none !important;
    padding: 0.4em 0.95em;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s;
}

a.app-cta-btn:hover {
    background: var(--accent-hover);
    color: #fff !important;
}

.app-page .bookmarklet-link.app-cta-btn {
    cursor: grab;
}

/* Blog CTA on homepage */

.blog-cta {
    margin-top: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-alt);
}

.blog-cta h2 {
    font-size: 1.1rem;
    margin: 0 0 0.25rem;
}

.blog-cta p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.blog-cta a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.blog-cta a:hover {
    text-decoration: underline;
}

/* ── Blog listing (robotwisdom style) ── */

.blog-header {
    margin-bottom: 2rem;
}

.blog-header h1 {
    font-size: 1.6rem;
    margin: 0;
}

.blog-intro {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0.35rem 0 0;
}

.blog-intro a {
    color: var(--accent);
    text-decoration: none;
}

.blog-intro a:hover {
    text-decoration: underline;
}

.blog-feed {
    margin-top: 1.5rem;
    min-height: 8rem;
}

.blog-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.blog-entry {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.blog-entry:last-child {
    border-bottom: none;
}

.blog-entry time {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.blog-entry-content {
    font-size: 0.95rem;
    line-height: 1.65;
}

.blog-entry-content p {
    margin: 0 0 0.5rem;
}

.blog-entry-content p:last-child {
    margin-bottom: 0;
}

.blog-entry-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.blog-entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
}

/* ── Post and page content ── */

.post-header, .page-header {
    margin-bottom: 2rem;
}

.post-header h1, .page-header h1 {
    font-size: 1.8rem;
    margin: 0 0 0.5rem;
    line-height: 1.25;
}

.post-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.post-content, .page-content {
    line-height: 1.75;
}

.post-content h2, .page-content h2 {
    font-size: 1.35rem;
    margin: 2.5rem 0 0.75rem;
    line-height: 1.3;
}

.post-content h3, .page-content h3 {
    font-size: 1.15rem;
    margin: 2rem 0 0.5rem;
    line-height: 1.3;
}

.post-content p, .page-content p {
    margin: 0 0 1.25rem;
}

.post-content a, .page-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.post-content a:hover, .page-content a:hover {
    color: var(--accent-hover);
}

.post-content ul, .page-content ul,
.post-content ol, .page-content ol {
    padding-left: 1.5rem;
    margin: 0 0 1.25rem;
}

.post-content li, .page-content li {
    margin-bottom: 0.4rem;
}

.post-content img, .page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1rem 0;
}

.post-content blockquote, .page-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1.5rem 0;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    background: var(--bg-alt);
    border-radius: 0 4px 4px 0;
}

.post-content code, .page-content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-alt);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.post-content pre, .page-content pre {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: pre;
    word-wrap: normal;
}

.post-content pre code, .page-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    word-break: break-all;
    white-space: pre-wrap;
}

/* ── Bookmarklet install links ── */

.bookmarklet-link {
    display: inline-block;
    background: var(--accent);
    color: #fff !important;
    text-decoration: none !important;
    padding: 0.35em 0.85em;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    cursor: grab;
    transition: background 0.15s;
}

.bookmarklet-link:hover {
    background: var(--accent-hover);
    color: #fff !important;
}

/* ── Video embeds ── */

.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 1.5rem 0;
    border-radius: 6px;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 6px;
}

/* ── Audio player ── */

.audio-player {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-alt);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.audio-player audio {
    width: 100%;
}

/* ── Post/page footer (back link) ── */

.post-footer, .page-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.post-footer a, .page-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.post-footer a:hover, .page-footer a:hover {
    color: var(--accent);
}

/* ── Site footer ── */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.site-footer p {
    margin: 0;
}

/* ── Responsive ── */

@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    main {
        padding: 1.5rem 1rem 3rem;
    }

    .index-header h1 {
        font-size: 1.6rem;
    }

    .post-header h1, .page-header h1 {
        font-size: 1.5rem;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }
}
