/* ============================================================
   Warm workshop, Jack Sleath portfolio.
   Light + dark via prefers-color-scheme.
============================================================ */

:root {
    /* Dark (default), warm charcoal + amber */
    --bg:            #1a1612;
    --surface:       #221c17;
    --surface-2:     #2a221c;
    --text:          #f3e9da;
    --muted:         #a89684;
    --faint:         #6b5d50;
    --accent:        #e08a4b;
    --accent-dim:    #b86a30;
    --accent-soft:   rgba(224, 138, 75, 0.14);
    --border:        #3a2e25;
    --border-strong: #4d3f33;
    --ring:          rgba(224, 138, 75, 0.32);
    --shadow:        0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-lift:   0 20px 50px rgba(0, 0, 0, 0.55);

    --skill-tint:    #c9986b;
    --type-tint:     #d6a766;

    --radius-xl: 14px;
    --radius-lg: 10px;
    --radius-md: 8px;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg:            #f4ece0;
        --surface:       #fdf6e9;
        --surface-2:     #ebe1cf;
        --text:          #1f1812;
        --muted:         #6b5b48;
        --faint:         #a89684;
        --accent:        #b8602a;
        --accent-dim:    #8a4519;
        --accent-soft:   rgba(184, 96, 42, 0.10);
        --border:        #d8c8ae;
        --border-strong: #bfa884;
        --ring:          rgba(184, 96, 42, 0.3);
        --shadow:        0 8px 24px rgba(100, 70, 30, 0.10);
        --shadow-lift:   0 16px 40px rgba(100, 70, 30, 0.16);

        --skill-tint:    #8a6437;
        --type-tint:     #a07229;
    }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

/* Subtle paper/grain glow at top-left */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 500px at 8% -10%, var(--accent-soft), transparent 60%),
        radial-gradient(700px 400px at 100% 0%, var(--accent-soft), transparent 70%);
    z-index: 0;
}

.wrap {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

/* ------------------------------------------------------------
   Header / brand
------------------------------------------------------------ */
.site-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: clamp(22px, 2.6vw, 30px);
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text);
}

    .brand-dot {
        width: 11px;
        height: 11px;
        border-radius: 999px;
        background: var(--accent);
        box-shadow: 0 0 0 4px var(--accent-soft);
        flex-shrink: 0;
    }

    .brand-sep {
        color: var(--faint);
        font-weight: 400;
    }

    .brand-page {
        color: var(--muted);
        font-weight: 600;
    }

.site-nav {
    display: inline-flex;
    align-items: center;
    gap: 22px;
    padding-top: 6px;
}

    .site-nav a {
        position: relative;
        color: var(--muted);
        text-decoration: none;
        font-weight: 600;
        font-size: 14px;
        padding-bottom: 4px;
        transition: color .15s ease;
    }

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

        .site-nav a[aria-current="page"] {
            color: var(--text);
        }

        .site-nav a[aria-current="page"]::after {
            content: "";
            position: absolute;
            left: 0; right: 0; bottom: -2px;
            height: 2px;
            background: var(--accent);
            border-radius: 2px;
        }

.tagline {
    margin: 6px 0 24px;
    color: var(--muted);
    font-size: 15px;
    max-width: 60ch;
}

.rule {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0 0 24px;
}

/* ------------------------------------------------------------
   Tools row (search + actions)
------------------------------------------------------------ */
.tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.search {
    position: relative;
    flex: 1 1 280px;
}

    .search input {
        width: 100%;
        padding: 11px 14px 11px 40px;
        border-radius: var(--radius-lg);
        border: 1px solid var(--border);
        background: var(--surface);
        color: var(--text);
        font-family: inherit;
        font-size: 14px;
        outline: none;
        transition: border-color .15s ease, box-shadow .15s ease;
    }

        .search input::placeholder {
            color: var(--faint);
        }

        .search input:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--ring);
        }

    .search svg {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
        color: var(--muted);
        pointer-events: none;
    }

.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 9px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

    .btn:hover {
        border-color: var(--border-strong);
        color: var(--accent);
    }

    .btn.ghost {
        background: transparent;
    }

    .btn:focus-visible {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--ring);
    }

/* ------------------------------------------------------------
   Collapsibles (About / Filters)
------------------------------------------------------------ */
details.block {
    margin: 0 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    overflow: hidden;
    transition: border-color .15s ease;
}

    details.block[open] {
        border-color: var(--border-strong);
    }

    details.block > summary {
        list-style: none;
        cursor: pointer;
        user-select: none;
        padding: 14px 18px;
        display: flex;
        align-items: center;
        gap: 12px;
        font-weight: 700;
        font-size: 15px;
    }

        details.block > summary::-webkit-details-marker { display: none; }

        details.block > summary:hover .caret { color: var(--accent); }

.caret {
    width: 16px;
    height: 16px;
    color: var(--muted);
    transition: transform .18s ease, color .15s ease;
    flex-shrink: 0;
}

    .caret::before {
        content: "";
        display: block;
        width: 7px;
        height: 7px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(-45deg);
        margin: 3px 0 0 2px;
    }

details[open] .caret { transform: rotate(90deg); }

.summary-meta {
    margin-left: auto;
    font-weight: 500;
    color: var(--muted);
    font-size: 13px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
}

.block-body {
    padding: 0 18px 18px;
}

/* ------------------------------------------------------------
   About blurb
------------------------------------------------------------ */
.about-text {
    margin: 4px 0 14px;
    color: var(--text);
    line-height: 1.6;
}

.about-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ------------------------------------------------------------
   Filter groups & chips
------------------------------------------------------------ */
.filters {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

@media (min-width: 820px) {
    .filters {
        grid-template-columns: repeat(3, 1fr);
    }
}

.group h3 {
    margin: 0 0 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--faint);
    font-weight: 700;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    appearance: none;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

    .chip:hover {
        color: var(--accent);
        border-color: var(--border-strong);
    }

    .chip[aria-pressed="true"] {
        background: var(--accent-soft);
        color: var(--accent);
        border-color: var(--accent);
    }

    .chip:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px var(--ring);
        border-color: var(--accent);
    }

/* ------------------------------------------------------------
   Grid + tiles
------------------------------------------------------------ */
.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    margin-top: 22px;
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    overflow: hidden;
    transition: transform .15s ease, border-color .15s ease, box-shadow .2s ease;
}

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

    .tile:focus-visible {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--ring);
    }

.thumb {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6%;
    padding: 12%;
    background:
        radial-gradient(ellipse at center,
            color-mix(in srgb, var(--tile-tint, var(--accent)) 28%, transparent) 0%,
            color-mix(in srgb, var(--tile-tint, var(--accent)) 8%, transparent) 55%,
            transparent 100%),
        var(--surface);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    /* Fallback sizing if Twemoji fails to load and OS emoji is shown */
    font-size: clamp(48px, 11vw, 88px);
    line-height: 1;
    text-align: center;
}

    /* Twemoji renders each emoji as <img class="emoji">. Two per thumb, side by side, scaling to fill. */
    .thumb img.emoji {
        height: 100%;
        width: auto;
        max-width: calc(50% - 3%);
        max-height: 100%;
        object-fit: contain;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.28));
    }

    .thumb > svg {
        width: 40%;
        height: 40%;
        color: var(--faint);
        opacity: 0.7;
    }

@media (prefers-color-scheme: light) {
    .thumb img.emoji {
        filter: drop-shadow(0 3px 6px rgba(100, 70, 30, 0.20));
    }
}

.tile-inner {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.tile h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text);
}

.desc {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
}

.badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    line-height: 1.4;
    white-space: nowrap;
}

    .badge--skill {
        color: var(--skill-tint);
        border-color: color-mix(in srgb, var(--skill-tint) 35%, var(--border));
    }

    .badge--type {
        color: var(--type-tint);
        border-color: color-mix(in srgb, var(--type-tint) 35%, var(--border));
    }

    .badge--more-toggle {
        appearance: none;
        cursor: pointer;
        border-style: dashed;
        color: var(--faint);
    }

    .badge--more-toggle:hover {
        color: var(--accent);
        border-color: var(--accent);
    }

.people {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.person {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: border-color .15s ease;
}

    .person:hover {
        border-color: var(--border-strong);
    }

.avatar {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: border-color .15s ease, color .15s ease;
}

    .link:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

    .link svg {
        width: 14px;
        height: 14px;
    }

.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
    font-size: 15px;
}

    .empty code {
        font-family: var(--font-mono);
        font-size: 13px;
        background: var(--surface-2);
        padding: 1px 6px;
        border-radius: 4px;
        border: 1px solid var(--border);
    }

footer {
    margin: 36px 0 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

    footer kbd {
        display: inline-block;
        font-family: var(--font-mono);
        font-size: 11px;
        padding: 1px 6px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-bottom-width: 2px;
        border-radius: 4px;
        color: var(--text);
    }

/* ------------------------------------------------------------
   Inline text link (for prose)
------------------------------------------------------------ */
.text-link {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: .08em;
    text-underline-offset: 3px;
    transition: color .15s ease;
}

    .text-link:hover {
        color: var(--accent);
    }

    .text-link.external::after {
        content: " ↗";
        color: var(--accent);
    }

/* ------------------------------------------------------------
   Toast
------------------------------------------------------------ */
.toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    background: var(--surface);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lift);
    font-size: 13px;
    font-weight: 600;
    z-index: 9999;
}

/* ------------------------------------------------------------
   Reduced motion
------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ============================================================
   TOOL PAGES (body.page-tool)
============================================================ */
body.page-tool .wrap {
    max-width: 920px;
}

.tool {
    margin-top: 4px;
}

.field {
    display: block;
    margin: 0 0 18px;
}

.field-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--faint);
    margin: 0 0 6px;
}

.field-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 6px 0 0;
    line-height: 1.5;
}

    .field-hint code {
        font-family: var(--font-mono);
        font-size: 12px;
        background: var(--surface-2);
        padding: 1px 5px;
        border-radius: 4px;
        border: 1px solid var(--border);
    }

textarea,
input[type="text"],
input[type="file"],
select {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
    min-height: 180px;
    resize: vertical;
}

textarea[readonly] {
    background: var(--surface-2);
    color: var(--muted);
}

input[type="text"],
input[type="file"],
select {
    font-family: var(--font-sans);
    font-size: 14px;
}

input[type="file"] {
    padding: 9px 12px;
    cursor: pointer;
}

textarea:focus,
input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

textarea::placeholder,
input::placeholder {
    color: var(--faint);
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 14px 0 18px;
}

.status {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    margin-left: 4px;
}

.btn-primary {
    background: var(--accent);
    color: #1a1612;
    border-color: var(--accent);
}

    .btn-primary:hover {
        background: var(--accent-dim);
        border-color: var(--accent-dim);
        color: #1a1612;
    }

/* Demo Code: editor + preview side by side */
.code-pen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    min-height: 70vh;
}

@media (max-width: 760px) {
    .code-pen {
        grid-template-columns: 1fr;
        min-height: 0;
    }
}

.code-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

    .code-editor .field {
        margin: 0;
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
    }

        .code-editor .field textarea {
            flex: 1 1 auto;
            min-height: 80px;
        }

    .code-editor .row {
        margin: 4px 0 0;
        flex: 0 0 auto;
    }

.code-preview {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #ffffff;
    min-height: 320px;
}

    .code-preview iframe {
        width: 100%;
        height: 100%;
        min-height: 320px;
        border: 0;
        display: block;
    }

.preview-fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity .15s ease, color .15s ease, border-color .15s ease;
}

    .preview-fullscreen-btn:hover,
    .preview-fullscreen-btn:focus-visible {
        opacity: 1;
        color: var(--accent);
        border-color: var(--accent);
        outline: none;
    }

    .preview-fullscreen-btn svg {
        width: 16px;
        height: 16px;
    }

    .preview-fullscreen-btn .icon-collapse {
        display: none;
    }

.code-preview.is-fullscreen,
.code-preview:fullscreen {
    border-radius: 0;
    border: none;
    background: #ffffff;
}

    .code-preview.is-fullscreen iframe,
    .code-preview:fullscreen iframe {
        width: 100%;
        height: 100%;
    }

    .code-preview.is-fullscreen .preview-fullscreen-btn .icon-expand,
    .code-preview:fullscreen .preview-fullscreen-btn .icon-expand {
        display: none;
    }

    .code-preview.is-fullscreen .preview-fullscreen-btn .icon-collapse,
    .code-preview:fullscreen .preview-fullscreen-btn .icon-collapse {
        display: block;
    }

/* ============================================================
   ABOUT PAGE (body.page-writing)
============================================================ */
body.page-writing .wrap {
    max-width: 920px;
}

.section {
    margin: 0 0 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    overflow: hidden;
}

.media-row {
    display: grid;
    gap: 18px;
    align-items: center;
    grid-template-columns: 1fr;
    padding: 18px;
}

@media (min-width: 760px) {
    .media-row {
        grid-template-columns: 1.1fr 0.9fr;
        padding: 22px;
        gap: 24px;
    }

        .media-row.reverse {
            grid-template-columns: 0.9fr 1.1fr;
        }
}

.media-card.prose h2 {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.media-card.prose p {
    margin: 0 0 12px;
    color: var(--text);
    line-height: 1.65;
}

.media-card.prose p:last-child { margin-bottom: 0; }

.prose-card {
    padding: 22px;
}

.prose-card h2 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 800;
}

.prose-card p {
    margin: 0 0 12px;
    line-height: 1.65;
}

.prose-card .muted {
    color: var(--muted);
}

.media {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
}

    .media img {
        display: block;
        width: 100%;
        height: auto;
    }

    .media .cap {
        padding: 8px 12px;
        font-size: 12px;
        color: var(--muted);
        border-top: 1px solid var(--border);
        width: 100%;
        text-align: center;
    }

.media--fixed img {
    width: 300px;
    height: 300px;
    object-fit: contain;
    padding: 20px;
}

figure {
    margin: 0;
}

figcaption {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding-top: 6px;
}

.full-image {
    display: block;
    width: 100%;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
}
