/* =========================================================
   Home: "Building with AI" (GitHub graph) and
   "I talk about AI and design" (screenshots of my own posts).
   Sits inside .bw-panel, uses the site teal, sand and pencil card style.
   ========================================================= */

/* the lede sits a little lower than the shared -8px so it clears the big title */
.ab-section .ot-lede,
.tk-section .ot-lede {
    margin-top: 10px;
}

/* ---------- Building with AI ---------- */
.ab-section {
    --ab-gap: 4px;
    --ab-l0: #EEEAE2;
    --ab-l1: #BFDCD8;
    --ab-l2: #7DB8B2;
    --ab-l3: #266268;
    --ab-l4: #14545E;
}

.ab-graph {
    padding: 22px 22px 16px;
    background: var(--bg-paper, #FFFCF6);
    border: 0.5px solid var(--line, #E5E1D8);
    border-radius: 16px;
}

.ab-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.ab-scroll:focus-visible {
    outline: 2px solid var(--color-highlight, #266268);
    outline-offset: 4px;
    border-radius: 6px;
}

.ab-months,
.ab-grid {
    display: grid;
    grid-template-columns: repeat(var(--ab-weeks, 53), minmax(11px, 1fr));
    column-gap: var(--ab-gap);
    min-width: calc(var(--ab-weeks, 53) * 15px);
}

.ab-months {
    margin-bottom: 8px;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    color: #6B6B66;
    white-space: nowrap;
}

.ab-months span {
    min-width: 0;
    overflow: visible;
}

.ab-grid {
    grid-template-rows: repeat(7, auto);
    grid-auto-flow: column;
    row-gap: var(--ab-gap);
}

.ab-grid > span,
.ab-grid button {
    display: block;
    aspect-ratio: 1;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 3px;
}

.ab-grid button {
    background: var(--ab-l0);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ab-grid .l1,
.ab-legend .l1 { background: var(--ab-l1); }
.ab-grid .l2,
.ab-legend .l2 { background: var(--ab-l2); }
.ab-grid .l3,
.ab-legend .l3 { background: var(--ab-l3); }
.ab-grid .l4,
.ab-legend .l4 { background: var(--ab-l4); }
.ab-legend .l0 { background: var(--ab-l0); }

.ab-grid button:hover {
    transform: scale(1.25);
}

.ab-grid button.is-on,
.ab-grid button:focus-visible {
    outline: 2px solid var(--text-pencil, #1A1A18);
    outline-offset: 1px;
}

/* key days get a small ring so people find them */
.ab-grid button.has-note {
    box-shadow: 0 0 0 2px #F6BE3B;
}

.ab-foot {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 24px;
    margin-top: 14px;
}

.ab-info {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    color: #3B3934;
    min-height: 42px;
}

.ab-info-main {
    display: block;
    font-weight: 600;
}

.ab-info-note {
    display: block;
    color: #6B6B66;
}

.ab-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
    margin: 0;
    font-family: var(--font-ui);
    font-size: 12px;
    color: #6B6B66;
}

.ab-legend i {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.ab-legend i:first-of-type { margin-left: 4px; }
.ab-legend i:last-of-type { margin-right: 4px; }

.ab-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 40px;
    list-style: none;
    margin: 24px 0 0;
    padding: 0;
    font-family: var(--font-ui);
}

.ab-stats li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #55554F;
    font-size: 0.95rem;
}

.ab-stats strong {
    font-family: var(--font-sketch);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-accent-ink, #14545E);
}

/* ---------- I talk about AI and design ---------- */
.tk-links {
    display: flex;
    gap: 10px;
    flex: none;
}

.tk-btn-line {
    background: transparent;
    color: var(--color-highlight-dark, #1B4A4F);
    border: 1px solid var(--color-highlight-dark, #1B4A4F);
}

.tk-btn-line:hover {
    background: var(--text-pencil, #1A1A18);
    border-color: var(--text-pencil, #1A1A18);
    color: #fff;
}

.tk-feed {
    position: relative;
    padding: 28px;
    background: #F4EFE6;
    border-radius: 16px;
}

.tk-list {
    columns: 2 300px;
    column-gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tk-post {
    break-inside: avoid;
    margin: 0 0 24px;
}

.tk-post a {
    display: block;
    border-radius: 12px;
    transition: transform 0.25s var(--ease-polish, ease), box-shadow 0.25s var(--ease-polish, ease);
}

.tk-post img {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
    border: 0.5px solid var(--line, #E5E1D8);
    border-radius: 12px;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.1);
}

.tk-post a:hover {
    transform: translateY(-3px);
}

.tk-post a:focus-visible {
    outline: 3px solid var(--color-highlight, #266268);
    outline-offset: 4px;
}

.tk-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 2px 0;
    font-family: var(--font-ui);
    font-size: 13px;
    color: #6B6B66;
}

.tk-src {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.tk-li { background: #0A66C2; }
.tk-x { background: #1A1A18; }

/* collapsed: show the first rows, fade out the rest */
.tk-feed.is-collapsed {
    max-height: 1500px;
    overflow: hidden;
}

.tk-feed.is-collapsed::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 220px;
    border-radius: 0 0 16px 16px;
    background: linear-gradient(to bottom, rgba(244, 239, 230, 0), #F4EFE6 85%);
    pointer-events: none;
}

.tk-more {
    display: block;
    margin: 20px auto 0;
    height: 44px;
    padding: 0 22px;
    border: 0.5px solid var(--line, #E5E1D8);
    border-radius: 999px;
    background: #fff;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-pencil, #1A1A18);
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.1);
    transition: background 0.2s ease, color 0.2s ease;
}

.tk-more:hover {
    background: var(--text-pencil, #1A1A18);
    color: #fff;
}

.tk-more:focus-visible {
    outline: 3px solid var(--color-highlight, #266268);
    outline-offset: 3px;
}

.tk-more[hidden] {
    display: none;
}

@media (max-width: 1000px) {
    .tk-feed.is-collapsed {
        max-height: 1400px;
    }
}

@media (max-width: 640px) {
    .ab-graph {
        padding: 16px 14px 12px;
    }

    .ab-foot {
        flex-direction: column;
    }

    .ab-stats {
        gap: 10px 24px;
    }

    .ab-stats strong {
        font-size: 1.6rem;
    }

    .tk-links {
        flex-wrap: wrap;
    }

    .tk-feed {
        padding: 16px;
    }

    .tk-list {
        columns: 1;
    }

    .tk-feed.is-collapsed {
        max-height: 1500px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ab-grid button,
    .tk-post a {
        transition: none;
    }

    .ab-grid button:hover,
    .tk-post a:hover {
        transform: none;
    }
}

/* ---------- I build tools with AI (#other): one compact card ---------- */
.bw-panel.ib-section {
    padding: 28px;
}

.ib-card {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: center;
    gap: 40px;
    color: inherit;
    text-decoration: none;
}

.ib-media {
    display: block;
    overflow: hidden;
    border: 0.5px solid var(--line, #E5E1D8);
    border-radius: 14px;
    background: #F4EFE6;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.3s var(--ease-polish, ease), box-shadow 0.3s var(--ease-polish, ease);
}

.ib-media img,
.ib-media video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.ib-card:hover .ib-media {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.12);
}

.ib-body {
    display: block;
    padding-right: 12px;
}

.ib-eyebrow {
    margin: 0 0 10px;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6B6B66;
}

.ib-name {
    margin: 0;
    font-family: var(--font-sketch);
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--color-accent-ink, #14545E);
}

.ib-desc {
    margin: 12px 0 0;
    max-width: 40ch;
    font-family: var(--font-ui);
    font-size: 1.02rem;
    line-height: 1.55;
    color: #55554F;
}

.ib-stat {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 18px 0 22px;
    font-family: var(--font-ui);
    font-size: 0.92rem;
    line-height: 1.4;
    color: #55554F;
}

.ib-stat strong {
    flex: none;
    font-family: var(--font-sketch);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-pencil, #1A1A18);
}

.ib-card:focus-visible {
    outline: 3px solid var(--color-highlight, #266268);
    outline-offset: 6px;
    border-radius: 16px;
}

@media (max-width: 700px) {
    .ib-card {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .ib-body {
        padding: 0 4px 4px;
    }
}

@media (max-width: 640px) {
    .bw-panel.ib-section {
        padding: 16px;
    }

    .ib-name {
        font-size: 1.65rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ib-media {
        transition: none;
    }

    .ib-card:hover .ib-media {
        transform: none;
    }
}

/* Selected work: title on the left, "See all my work" on the right of the same row */
.bw-head-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
}

.bw-head-row .rw-btn {
    flex: none;
    margin-top: 0;
}

/* InlineAI card: number row, same markup and look as the QuickServe stats on work.html
   (.highlight-stats in styles.css) (asked 2026-10-04) */
.ib-stats { margin: 18px 0 24px; gap: 2.5rem; }

/* Desktop (mouse): the glass "Read case study" cursor already says it on hover,
   so the card has no button and the stats close the text block. Touch keeps the button. */
@media (hover: hover) and (pointer: fine) {
    /* !important: type.css sets every .rw-btn to inline-flex !important */
    .ib-card .rw-btn {
        display: none !important;
    }

    .ib-card .ib-stats {
        margin-bottom: 0;
    }
}

/* InlineAI card on phones (4 Oct 2026): the three stats sit in one row of equal columns,
   tighter spacing, and a full width Read case study button like the Selected work cards.
   !important because styles.css sets .highlight-stats and .stat-number with !important on phones. */
@media (max-width: 760px) {
    .ib-card .ib-eyebrow {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .ib-card .ib-desc {
        margin-top: 8px;
    }

    .ib-card .ib-stats {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px !important;
        margin: 20px 0 0 !important;
        padding-top: 16px;
        border-top: 0.5px solid var(--line, #E5E1D8);
    }

    .ib-card .ib-stats .stat-item {
        min-width: 0;
    }

    .ib-card .ib-stats .stat-number {
        font-size: 20px !important;
        line-height: 1.2 !important;
    }

    .ib-card .ib-stats .stat-label {
        display: block;
        margin-top: 4px;
        font-size: 13px !important;
        line-height: 1.35 !important;
        color: #5c5c56;
    }

    .ib-card .rw-btn {
        width: 100%;
        justify-content: center;
        margin-top: 20px;
    }
}

/* Building with AI: the second View GitHub (inside .ab-body) is for phones only */
#building .ab-body .ab-cta {
    display: none !important;
}

/* Building with AI on phones, like Selected work: title and lede sit on the page, centred,
   the graph, numbers and a full width View GitHub sit in one white card below */
@media (max-width: 760px) {
    #building.bw-panel {
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    #building .wr-cards-head {
        display: block;
        margin-bottom: 24px;
        padding: 0 4px;
        text-align: center;
    }

    #building .wr-cards-head > .wr-all-btn {
        display: none !important;
    }

    #building .ab-body {
        padding: 16px;
        background: #FFFFFF;
        border: 0.5px solid var(--line, #E5E1D8);
        border-radius: 18px;
        box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.06);
    }

    #building .ab-stats {
        justify-content: center;
    }

    #building .ab-body .ab-cta {
        display: flex !important;
        width: 100%;
        margin-top: 24px;
    }
}

/* I talk about AI and design on phones, like Building with AI: title, lede and the
   LinkedIn / X buttons sit on the page, centred; the posts sit in one white card below */
@media (max-width: 760px) {
    #talks.bw-panel {
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    #talks .wr-cards-head {
        align-items: center;
        margin-bottom: 24px;
        padding: 0 4px;
        text-align: center;
    }

    #talks .tk-links {
        justify-content: center;
    }

    /* no white card and no sand box: the posts sit on the page at full width */
    #talks .tk-feed {
        padding: 0;
        background: transparent;
        border-radius: 0;
    }

    #talks .tk-feed.is-collapsed::after {
        border-radius: 0;
        background: linear-gradient(to bottom, rgba(255, 252, 246, 0), #FFFCF6 85%);
    }

    /* !important: the one stroke rule in styles.css clears image strokes inside a panel */
    #talks .tk-post img {
        border-color: var(--line, #E5E1D8) !important;
    }
}
