/* jamesabryan.com — one small stylesheet, no framework.
   Warm paper light theme / soft charcoal dark theme, follows system preference. */

:root {
    --bg: #faf7f2;
    --bg-raised: #ffffff;
    --ink: #2a2622;
    --muted: #6f675e;
    --line: #e5ddd2;
    --accent: #b4501e;
    --accent-soft: #f6e8dd;
    --code-bg: #f1ece4;
    --max-prose: 44rem;
    --max-wide: 68rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1a18;
        --bg-raised: #262320;
        --ink: #e9e4dc;
        --muted: #a89e92;
        --line: #3a352f;
        --accent: #e8934f;
        --accent-soft: #3a2c20;
        --code-bg: #2d2925;
    }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    font-size: 1.05rem;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Header & nav ---------- */

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

.site-name {
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    color: var(--ink);
    letter-spacing: 0.01em;
}

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

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

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

.site-nav a[aria-current="page"] {
    color: var(--ink);
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
}

/* ---------- Layout ---------- */

main {
    max-width: var(--max-prose);
    margin: 0 auto;
    padding: 1rem 1.25rem 4rem;
}

main.wide { max-width: var(--max-wide); }

a { color: var(--accent); }

h1, h2, h3 {
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h1 { font-size: 2rem; margin: 1.5rem 0 0.75rem; }
h2 { font-size: 1.45rem; margin-top: 2.25rem; }
h3 { font-size: 1.15rem; margin-top: 1.75rem; }

hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 2.5rem 0;
}

blockquote {
    margin: 1.5rem 0;
    padding: 0.75rem 1.25rem;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 8px 8px 0;
}

blockquote p { margin: 0.25rem 0; }

img { max-width: 100%; height: auto; border-radius: 8px; }

/* ---------- Home sections ---------- */

.hero {
    margin: 1.5rem auto 3rem;
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.hero-portrait {
    width: 13rem;
    height: 13rem;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.hero-text { max-width: var(--max-prose); }

.hero h1 { font-size: 2.4rem; margin: 0 0 1rem; }

.hero .lede {
    font-size: 1.15rem;
    color: var(--muted);
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 3rem 0 1rem;
}

.section-head h2 { margin: 0; }

.section-head a { font-size: 0.9rem; white-space: nowrap; }

/* ---------- Post list ---------- */

.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: var(--max-prose);
}

.post-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--line);
}

.post-list a {
    text-decoration: none;
    color: var(--ink);
    font-weight: 550;
}

.post-list a:hover { color: var(--accent); }

.post-list time {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ---------- Cards ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.card {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

.card h3 { margin: 0; font-size: 1.1rem; }

.card .card-emoji { font-size: 1.6rem; line-height: 1; }

.card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    flex-grow: 1;
}

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.card-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.pill {
    font-size: 0.72rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.pill.hobby { filter: hue-rotate(120deg); }

.card a { font-size: 0.9rem; white-space: nowrap; }

/* ---------- Posts ---------- */

.post-header h1 { margin-bottom: 0.25rem; }

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

.post-end { margin-top: 3rem; }

.comments-pending { color: var(--muted); }

/* Code */

code {
    font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 5px;
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    line-height: 1.55;
}

pre code { background: none; padding: 0; font-size: 0.85rem; }

/* Minimal Prism token colors (both themes) */
.token.comment { color: var(--muted); font-style: italic; }
.token.keyword, .token.operator { color: var(--accent); }
.token.string { color: #4a7a4a; }
.token.function { color: #4a6a9a; }
.token.number { color: #8a5aa0; }
@media (prefers-color-scheme: dark) {
    .token.string { color: #9fce9f; }
    .token.function { color: #9ab8e8; }
    .token.number { color: #cba6de; }
}

/* ---------- Picture-in-picture site preview ---------- */

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pip-launch {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: 1.5px solid var(--accent);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    cursor: pointer;
}

.pip-launch:hover { background: var(--accent-soft); }

.pip-window {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 100;
    width: min(480px, calc(100vw - 2rem));
    height: min(420px, calc(100vh - 4rem));
    min-width: 260px;
    min-height: 200px;
    resize: both;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.pip-window[hidden] { display: none; }

.pip-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    background: var(--code-bg);
    border-bottom: 1px solid var(--line);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.pip-bar:active { cursor: grabbing; }

.pip-dots { display: flex; gap: 5px; }

.pip-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--line);
}

.pip-dots i:nth-child(1) { background: #e0655a; }
.pip-dots i:nth-child(2) { background: #e0b04f; }
.pip-dots i:nth-child(3) { background: #7bbf6a; }

.pip-domain {
    flex: 1;
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    background: var(--bg);
    border-radius: 6px;
    padding: 0.1rem 0.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pip-btn {
    font: inherit;
    font-size: 0.9rem;
    line-height: 1;
    color: var(--muted);
    background: none;
    border: none;
    padding: 0.2rem 0.35rem;
    cursor: pointer;
    text-decoration: none;
    border-radius: 6px;
}

.pip-btn:hover { color: var(--accent); background: var(--bg); }

.pip-window iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

.pip-hint {
    margin: 0;
    padding: 0.3rem 0.75rem;
    font-size: 0.7rem;
    color: var(--muted);
    background: var(--code-bg);
    border-top: 1px solid var(--line);
}

/* ---------- Forms (contact) ---------- */

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 32rem;
}

.contact-form label {
    font-weight: 600;
    font-size: 0.92rem;
    display: block;
    margin-bottom: 0.3rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--bg-raised);
    color: var(--ink);
    font: inherit;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.contact-form textarea { min-height: 8rem; resize: vertical; }

.button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.5rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.button:hover { filter: brightness(1.08); }

/* ---------- Footer ---------- */

.site-footer {
    max-width: var(--max-wide);
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.footer-fine { font-size: 0.8rem; }

@media (max-width: 600px) {
    .hero { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
    .hero-portrait { width: 9rem; height: 9rem; }
    .hero h1 { font-size: 1.8rem; }
    .post-list li { flex-direction: column; gap: 0.1rem; }
}
