/* ════════════════════════════════════════════════════════════════════════
   study-artifacts.css — the Artifacts library, the "new artifact" sheet, and
   one artifact open with the tutor beside it (public/js/study/study-artifacts.js).
   Tokens and the tactile buttons come from /css/shared/khio-ui.css, the
   landing's design language, so this reads like the landing, not old Study.
   The tutor is the exception: it is a chat, so it wears Ask AI's look.
   Layout is the same on laptop and wide desktop but for the tutor's width;
   narrow windows and phones are at the bottom, in max-width queries.
   While an artifact is open the shell's chats panel steps aside
   (study-rail.css).
   ════════════════════════════════════════════════════════════════════════ */

#view-artifacts { flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; background: var(--k-paper); color: var(--k-ink); font-family: var(--k-sans); -webkit-font-smoothing: antialiased; }
#view-artifacts * { box-sizing: border-box; }
#view-artifacts button { font-family: inherit; }
#view-artifacts svg { flex: none; }

/* ── The library ──────────────────────────────────────────────────────── */
.art-lib { width: 100%; max-width: 1160px; margin: 0 auto; padding: 52px clamp(20px, 4vw, 56px) 96px; animation: k-rise .6s var(--k-ease) both; }
.art-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.art-h1 { font-family: var(--k-display); font-weight: 500; font-size: clamp(42px, 4.4vw, 62px); line-height: 1; letter-spacing: -.028em; margin: 0; }
.art-sub { margin: 12px 0 0; max-width: 58ch; font-size: 16.5px; line-height: 1.5; color: var(--k-ink-2); }
.art-new { flex: none; }

.art-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.art-search { display: flex; align-items: center; gap: 8px; height: 40px; width: min(360px, 100%); padding: 0 14px; border-radius: 999px; background: var(--k-surface); border: 1px solid var(--k-line); color: var(--k-ink-3); transition: border-color .2s ease, box-shadow .2s ease; }
.art-search:focus-within { border-color: var(--k-blue); box-shadow: 0 0 0 3px rgba(10, 132, 255, .14); }
.art-search svg { width: 16px; height: 16px; }
.art-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: 15px var(--k-sans); color: var(--k-ink); }
/* study-themes.css dresses every light-theme field as a grey pill with an
   orange focus ring, which drew a second box inside this one and lit it
   orange on a click (James 2026-09-30). The pill around it is the field. */
#view-artifacts .art-search input,
#view-artifacts .art-search input:focus { height: auto; padding: 0; border: 0 !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; outline: 0 !important; color: var(--k-ink) !important; font-family: var(--k-sans) !important; }
.art-count { font-size: 13.5px; color: var(--k-ink-3); }

.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 18px; }
.art-none { color: var(--k-ink-3); }
.art-error { margin: 18px 0 0; color: var(--k-bad); }

/* A card is a small picture of its page: the course line in its colour, the
   title in display type, the chip row, a few lines. */
.art-card { position: relative; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; background: var(--k-surface); border: 1px solid var(--k-line); cursor: pointer; outline: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03); transition: transform .35s var(--k-ease), box-shadow .35s var(--k-ease), border-color .2s ease; }
.art-card:hover, .art-card:focus-visible { transform: translateY(-3px); box-shadow: var(--k-shadow); border-color: color-mix(in srgb, var(--a, #888) 30%, var(--k-line)); }
.art-card:focus-visible { box-shadow: 0 0 0 3px rgba(10, 132, 255, .25), var(--k-shadow); }
.art-card-page { position: relative; height: 150px; padding: 18px 18px 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden;
    background: linear-gradient(180deg, color-mix(in srgb, var(--a, #888) 9%, var(--k-paper)) 0%, color-mix(in srgb, var(--a, #888) 4%, var(--k-paper)) 100%); border-bottom: 1px solid var(--k-line); }
.art-card-kicker { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--a, var(--k-ink-2)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-theme="dark"] .art-card-kicker { color: color-mix(in srgb, var(--a, #888) 55%, #fff); }
.art-card-h { font-family: var(--k-display); font-weight: 600; font-size: 22px; line-height: 1.02; letter-spacing: -.015em; color: var(--k-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.art-card-chips { display: flex; gap: 5px; margin-top: 2px; }
.art-card-chips i { height: 13px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--a, #888) 30%, transparent); background: var(--k-surface); }
.art-card-chips i:nth-child(1) { width: 38px; } .art-card-chips i:nth-child(2) { width: 52px; } .art-card-chips i:nth-child(3) { width: 30px; } .art-card-chips i:nth-child(4) { width: 44px; }
.art-card-lines { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.art-card-lines i { height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--k-ink) 9%, transparent); }
.art-card-lines i:nth-child(1) { width: 92%; } .art-card-lines i:nth-child(2) { width: 78%; } .art-card-lines i:nth-child(3) { width: 58%; }
.art-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.art-card-title { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.art-card-meta { margin: 0; font-size: 13px; color: var(--k-ink-2); display: flex; align-items: center; gap: 7px; }
.art-card-meta.is-bad { color: var(--k-bad); }
.art-card-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--k-ink-3); }
.art-card-foot > span:first-child { margin-right: auto; }
.art-card-actions { display: flex; gap: 14px; margin-top: 2px; }
.art-card-more { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: var(--k-ink);
    background: color-mix(in srgb, var(--k-surface) 82%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    opacity: 0; transition: opacity .2s ease; }
.art-card-more svg { width: 16px; height: 16px; }
.art-card:hover .art-card-more, .art-card:focus-within .art-card-more { opacity: 1; }
@media (hover: none) { .art-card-more { opacity: 1; } }

.art-card.is-generating .art-card-page::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--k-surface) 70%, transparent) 50%, transparent 80%); background-size: 200% 100%; animation: art-shimmer 1.6s linear infinite; }
.art-card.is-failed .art-card-page { filter: grayscale(.8); opacity: .7; }
.art-card.is-skeleton { cursor: default; }
.art-card.is-skeleton .art-card-page { background: color-mix(in srgb, var(--k-ink) 4%, var(--k-paper)); }
.art-card.is-skeleton .art-card-body i { display: block; height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--k-ink) 7%, transparent); width: 70%; }
.art-card.is-skeleton .art-card-body i + i { width: 45%; }
.art-card.is-skeleton .art-card-page, .art-card.is-skeleton .art-card-body { animation: art-pulse 1.4s ease-in-out infinite; }
@keyframes art-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes art-pulse { 50% { opacity: .55; } }

.art-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--k-ink-2); background: var(--k-hover); white-space: nowrap; }
.art-pill svg { width: 12px; height: 12px; }
.art-pill.is-good { color: var(--k-good); background: color-mix(in srgb, var(--k-good) 12%, transparent); }

.art-link { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; font: 500 14px var(--k-sans); color: var(--k-blue); cursor: pointer; }
.art-link svg { width: 15px; height: 15px; }
.art-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.art-link.is-quiet { color: var(--k-ink-3); }

.art-spinner { width: 13px; height: 13px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--k-ink) 15%, transparent); border-top-color: var(--k-ink); animation: art-spin .8s linear infinite; display: inline-block; }
.art-spinner.is-big { width: 28px; height: 28px; border-width: 3px; }
@keyframes art-spin { to { transform: rotate(360deg); } }

/* ── From your texts: the newest Space pages Khio wrote from someone's texts ─ */
.art-texts { margin: 0 0 30px; }
.art-texts .art-eyebrow { margin-bottom: 10px; }
.art-texts-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.art-text { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border-radius: 16px; background: var(--k-surface); border: 1px solid var(--k-line); color: var(--k-ink); text-decoration: none; outline: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03); transition: transform .35s var(--k-ease), box-shadow .35s var(--k-ease); }
.art-text:hover, .art-text:focus-visible { transform: translateY(-2px); box-shadow: var(--k-shadow); }
.art-text:focus-visible { box-shadow: 0 0 0 3px rgba(10, 132, 255, .25), var(--k-shadow); }
.art-text-ico { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--k-hover); font-size: 20px; line-height: 1; }
.art-text-ico.is-blank { color: var(--k-ink-3); }
.art-text-ico svg { width: 18px; height: 18px; }
.art-text-body { min-width: 0; display: flex; flex-direction: column; }
.art-text-body b { font-size: 15px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-text-body small { font-size: 12.5px; color: var(--k-ink-3); }

/* ── First visit: the page, explained ─────────────────────────────────── */
.art-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 40px; align-items: center; padding: 48px 52px; border-radius: 30px;
    background: var(--k-surface); border: 1px solid var(--k-line); box-shadow: var(--k-shadow); overflow: hidden; transition: border-color .2s ease, box-shadow .2s ease; }
.art-hero.is-over { border-color: var(--k-blue); box-shadow: 0 0 0 4px rgba(10, 132, 255, .15), var(--k-shadow); }
.art-eyebrow { margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--k-ink-3); }
.art-hero h2 { margin: 0; font-family: var(--k-display); font-weight: 500; font-size: clamp(32px, 3vw, 44px); line-height: 1.02; letter-spacing: -.025em; }
.art-hero-points { list-style: none; margin: 22px 0 26px; padding: 0; display: grid; gap: 11px; }
.art-hero-points li { display: flex; align-items: center; gap: 12px; font-size: 15.5px; color: var(--k-ink-2); }
.art-hero-points svg { width: 30px; height: 30px; padding: 7px; border-radius: 10px; background: var(--k-hover); color: var(--k-ink); }
.art-hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.art-hint { margin: 14px 0 0; font-size: 13px; color: var(--k-ink-3); }
.art-hero-art { position: relative; display: flex; justify-content: center; }

/* The example page, drawn small: TRAV 116's look. */
.art-mock { position: relative; width: min(360px, 100%); padding: 22px 22px 26px; border-radius: 20px; background: #F3F5F4; color: #17212B; display: flex; flex-direction: column; gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .04), 0 24px 60px rgba(23, 33, 43, .16); transform: rotate(-2deg); animation: art-float 7s ease-in-out infinite; }
.art-mock::before { content: ''; position: absolute; inset: 14px -14px -14px 14px; z-index: -1; border-radius: 20px; background: #E3EDF3; transform: rotate(4deg); }
.art-mock-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: #5A6873; }
.art-mock-h { font-family: 'Barlow Condensed', 'Arial Narrow', var(--k-sans); font-weight: 700; font-size: 30px; line-height: .98; }
.art-mock-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.art-mock-chips i { font-style: normal; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #fff; border: 1px solid #D6DDE0; }
.art-mock-lines { display: grid; gap: 6px; }
.art-mock-lines i { height: 6px; border-radius: 3px; background: #D6DDE0; }
.art-mock-lines i:nth-child(2) { width: 84%; } .art-mock-lines i:nth-child(3) { width: 62%; }
.art-mock-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; border-radius: 12px; background: #fff; border: 1px solid #D6DDE0; }
.art-mock-card b { font-size: 16px; padding: 2px 12px; border-radius: 6px; background: #F2C230; color: #14181C; letter-spacing: .02em; }
.art-mock-card small { font-size: 11px; color: #5A6873; }
.art-mock-q { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid #D6DDE0; font-size: 12.5px; }
.art-mock-q em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #1D5C86; white-space: nowrap; }
@keyframes art-float { 50% { transform: rotate(-1deg) translateY(-6px); } }

/* ── Older sets ───────────────────────────────────────────────────────── */
.art-older { margin-top: 44px; border-top: 1px solid var(--k-line); padding-top: 18px; }
.art-older summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font-weight: 600; font-size: 15px; color: var(--k-ink-2); }
.art-older summary::-webkit-details-marker { display: none; }
.art-older summary svg { width: 17px; height: 17px; }
.art-older summary span { font-weight: 500; font-size: 12.5px; padding: 1px 8px; border-radius: 999px; background: var(--k-hover); }
.art-older summary::after { content: ''; width: 8px; height: 8px; margin-left: 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .2s ease; }
.art-older[open] summary::after { transform: rotate(225deg) translateY(-1px); }
.art-older-note { margin: 12px 0 10px; font-size: 14px; color: var(--k-ink-3); }
.art-older ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.art-older li { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 12px; }
.art-older li:hover { background: var(--k-hover); }
.art-older-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--k-hover); color: var(--k-ink-2); }
.art-older-ico svg { width: 17px; height: 17px; }
.art-older-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.art-older-t b { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-older-t small { font-size: 12.5px; color: var(--k-ink-3); }

/* ── Menu ─────────────────────────────────────────────────────────────── */
.art-menu { position: fixed; z-index: 10050; width: 200px; padding: 6px; border-radius: 14px; background: var(--k-surface); border: 1px solid var(--k-line); box-shadow: var(--k-shadow); font-family: var(--k-sans); animation: k-rise .22s var(--k-ease) both; }
.art-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--k-ink); font: 500 14px var(--k-sans); cursor: pointer; text-align: left; }
.art-menu button:hover { background: var(--k-hover); }
.art-menu button svg { width: 16px; height: 16px; color: var(--k-ink-2); }
.art-menu button.is-bad, .art-menu button.is-bad svg { color: var(--k-bad); }

/* ── The "new artifact" sheet ─────────────────────────────────────────── */
.art-sheet-back { position: fixed; inset: 0; z-index: 10040; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(17, 17, 20, .34); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s ease; font-family: var(--k-sans); color: var(--k-ink); }
.art-sheet-back.is-in { opacity: 1; }
.art-sheet { width: min(580px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 24px 20px; border-radius: 26px; background: var(--k-surface); box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
    transform: translateY(14px) scale(.98); transition: transform .4s var(--k-ease); }
.art-sheet-back.is-in .art-sheet { transform: none; }
.art-sheet * { box-sizing: border-box; }
.art-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.art-sheet-head h2 { margin: 0; font-family: var(--k-display); font-weight: 500; font-size: 32px; letter-spacing: -.02em; }
.art-x { width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--k-hover); color: var(--k-ink-2); cursor: pointer; flex: none; }
.art-x svg { width: 16px; height: 16px; }
.art-x:hover { color: var(--k-ink); }
.art-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 20px; border-radius: 18px; border: 1.5px dashed color-mix(in srgb, var(--k-ink) 22%, transparent); text-align: center; cursor: pointer; transition: border-color .2s ease, background .2s ease; outline: 0; }
.art-drop:hover, .art-drop:focus-visible, .art-drop.is-over { border-color: var(--k-blue); background: color-mix(in srgb, var(--k-blue) 5%, transparent); }
.art-drop-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--k-hover); margin-bottom: 4px; }
.art-drop-ico svg { width: 24px; height: 24px; }
.art-drop b { font-weight: 600; font-size: 15.5px; }
.art-drop u { text-decoration-color: var(--k-blue); color: var(--k-blue); text-underline-offset: 3px; }
.art-drop small { font-size: 13px; color: var(--k-ink-3); }
.art-drop-more { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 2px 0; }
.art-files { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; max-height: 210px; overflow-y: auto; }
.art-files li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--k-hover); font-size: 14px; }
.art-files li > svg { width: 17px; height: 17px; color: var(--k-ink-2); }
.art-files li span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-files li small { color: var(--k-ink-3); font-size: 12.5px; }
.art-files .art-x { width: 26px; height: 26px; background: none; }
.art-paste, .art-input { width: 100%; border: 1px solid var(--k-line); border-radius: 14px; padding: 12px 14px; font: 15px/1.45 var(--k-sans); color: var(--k-ink); background: var(--k-paper); outline: 0; transition: border-color .2s ease, box-shadow .2s ease; }
.art-paste { margin-top: 14px; resize: vertical; min-height: 120px; }
.art-paste:focus, .art-input:focus { border-color: var(--k-blue); box-shadow: 0 0 0 3px rgba(10, 132, 255, .14); }
.art-for { margin: 20px 0 0; padding: 0; border: 0; }
.art-for legend { padding: 0; margin-bottom: 10px; font-weight: 600; font-size: 14.5px; }
.art-seg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.art-seg button { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--k-line); background: var(--k-surface); color: var(--k-ink-2); font: 500 14px var(--k-sans); cursor: pointer; transition: all .2s ease; }
.art-seg button:hover { border-color: color-mix(in srgb, var(--k-ink) 25%, transparent); color: var(--k-ink); }
.art-seg button.is-on { background: var(--k-ink); color: var(--k-paper); border-color: var(--k-ink); }
.art-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--k-line); }
.art-muted { color: var(--k-ink-3); font-size: 13.5px; margin: 0; }

/* ── One artifact ─────────────────────────────────────────────────────── */
.art-viewer { flex: 1; width: 100%; display: flex; flex-direction: column; min-height: 0; }
.art-bar { flex: none; display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 16px; border-bottom: 1px solid var(--k-line);
    background: color-mix(in srgb, var(--k-paper) 88%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); position: relative; z-index: 2; }
.art-back { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 8px; border: 0; border-radius: 10px; background: none; color: var(--k-ink-2); font: 500 14px var(--k-sans); cursor: pointer; }
.art-back:hover { background: var(--k-hover); color: var(--k-ink); }
.art-back svg { width: 17px; height: 17px; }
.art-bar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.art-bar-title b { font-family: var(--k-display); font-weight: 600; font-size: 21px; line-height: 1.1; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-bar-title small { font-size: 12.5px; color: var(--k-ink-3); margin-top: 2px; }
.art-bar-title small.art-unread { color: var(--k-bad); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.art-bar-actions { display: flex; align-items: center; gap: 6px; }
.art-tool { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--k-line); background: var(--k-surface); color: var(--k-ink); font: 500 13.5px var(--k-sans); cursor: pointer; text-decoration: none; transition: background .2s ease, border-color .2s ease; }
.art-tool:hover { border-color: color-mix(in srgb, var(--k-ink) 22%, transparent); }
.art-tool svg { width: 15px; height: 15px; }
.art-tool.is-icon { padding: 0; width: 34px; justify-content: center; }
.art-tool.is-on { background: var(--k-ink); color: var(--k-paper); border-color: var(--k-ink); }
.art-stage { position: relative; flex: 1; min-height: 0; display: flex; }
.art-frame-wrap { flex: 1; min-width: 0; display: flex; }
/* What shows while the page loads: the middle of the six page themes'
   grounds (lib/shared/study-notes.js THEMES), a few steps from each, so no
   theme flashes a different colour first. */
.art-frame { flex: 1; width: 100%; height: 100%; border: 0; background: #F3F4F3; }
html[data-theme="dark"] .art-frame { background: #101315; }

/* Writing: a page drawing itself, and the four steps. */
.art-writing { margin: auto; max-width: 470px; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; animation: k-rise .5s var(--k-ease) both; }
.art-writing h2 { margin: 6px 0 0; font-family: var(--k-display); font-weight: 500; font-size: 32px; line-height: 1.05; letter-spacing: -.02em; }
.art-writing-page { position: relative; width: 150px; height: 190px; padding: 22px 18px; border-radius: 14px; background: var(--k-surface); border: 1px solid var(--k-line); box-shadow: var(--k-shadow); display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.art-writing-page i { height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--k-ink) 12%, transparent); transform-origin: left; animation: art-write 3.2s var(--k-ease) infinite; }
.art-writing-page i:nth-child(1) { width: 70%; height: 11px; background: color-mix(in srgb, var(--k-ink) 22%, transparent); }
.art-writing-page i:nth-child(2) { animation-delay: .3s; } .art-writing-page i:nth-child(3) { width: 86%; animation-delay: .6s; }
.art-writing-page i:nth-child(4) { width: 64%; animation-delay: .9s; } .art-writing-page i:nth-child(5) { width: 78%; animation-delay: 1.2s; }
.art-writing-page b { margin-top: auto; height: 38px; border-radius: 8px; background: #F2C230; opacity: .85; animation: art-pulse 1.6s ease-in-out infinite; }
@keyframes art-write { 0% { transform: scaleX(0); } 45%, 100% { transform: scaleX(1); } }
.art-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; text-align: left; }
.art-steps li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--k-ink-3); transition: color .3s ease; }
.art-steps li span { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; flex: none; }
.art-steps li.is-on { color: var(--k-ink); font-weight: 600; }
.art-steps li.is-on span { border-color: var(--k-ink); border-top-color: transparent; animation: art-spin .9s linear infinite; }
.art-steps li.is-done { color: var(--k-ink-2); }
.art-steps li.is-done span { background: var(--k-good); border-color: var(--k-good); }
.art-steps li.is-done span::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.art-writing-files { margin: 0; font-size: 12.5px; color: var(--k-ink-3); }
.art-writing.is-failed h2 { font-size: 28px; }
.art-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* The tutor: a chat docked beside the page. Its look (Ask AI's canvas, font,
   bubbles and composer, and the --t-* colours) is shared with the Co-Writer
   page chat, so it lives in study-side-chat.css; what is here is where the
   tutor sits and how it opens. Laptop 400px, wide desktop 460px, and the
   edge drags to any width in between (study-artifacts.js sizeTutor). */
.art-viewer { --art-tutor-w: 400px; }
body.khio-desktop-wide .art-viewer { --art-tutor-w: 460px; }
.art-tutor { position: relative; flex: none; display: none; flex-direction: column; min-height: 0; width: clamp(320px, var(--art-tutor-w), calc(100% - 400px)); border-left: 1px solid var(--t-line); }
.art-viewer.tutor-open .art-tutor { display: flex; animation: art-tutor-in .3s var(--k-ease) both; }
@keyframes art-tutor-in { from { opacity: 0; transform: translateX(14px); } }
.art-viewer.is-sizing { cursor: col-resize; user-select: none; }
.art-viewer.is-sizing .art-frame { pointer-events: none; }
.art-grip { position: absolute; z-index: 2; top: 0; bottom: 0; left: -5px; width: 10px; cursor: col-resize; outline: 0; }
.art-grip::after { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background .15s ease; }
.art-grip:hover::after, .art-grip:focus-visible::after, .art-viewer.is-sizing .art-grip::after { background: var(--t-me); }

.art-kbd { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--t-ink); color: var(--t-bg); font-size: 12.5px; font-weight: 700; }
.art-added { align-self: flex-start; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--t-soft); color: var(--t-ink); font-size: 13.5px; line-height: 1.4; }
.art-added.is-none { background: none; padding: 0; color: var(--t-muted); }
.art-added > svg { width: 15px; height: 15px; color: var(--t-muted); }
.art-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.art-quick button { height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--t-line); background: var(--t-field); color: var(--t-ink); font: 600 13px/1 Manrope, Inter, -apple-system, sans-serif; cursor: pointer; transition: background .15s ease; }
.art-quick button:hover:not(:disabled) { background: var(--t-soft); }
.art-quick button:disabled { opacity: .45; cursor: default; }

/* ── Narrow windows: one column, the tutor slides over the page ───────── */
@media (max-width: 1023px) {
    .art-lib { padding-top: 32px; }
    .art-head { flex-direction: column; align-items: flex-start; }
    .art-hero { grid-template-columns: 1fr; padding: 32px 26px; }
    .art-hero-art { display: none; }
    .art-bar-actions .art-tool span { display: none; }
    .art-bar-actions .art-tool { padding: 0; width: 34px; justify-content: center; }
    .art-back span { display: none; }
    .art-tutor { position: absolute; top: 0; right: 0; bottom: 0; z-index: 3; width: min(420px, 100%); box-shadow: -20px 0 50px rgba(0, 0, 0, .14); }
    .art-grip { display: none; }
    /* An open page fills the phone. The gutters kept for the bottom tab bar,
       which this view never shows, left a blank strip under it, and the
       body's (premium.css) let "Go to them" scroll the whole shell up 72px. */
    .study-main:has(> #view-artifacts.active > .art-viewer),
    #view-artifacts:has(> .art-viewer) { padding-bottom: 0; }
    body:has(#view-artifacts.active > .art-viewer) { padding-bottom: 0; }
}
/* A phone: the tutor is a full-screen sheet over everything, and the box
   is 16px so iOS does not zoom the page when it takes the caret. */
@media (max-width: 640px) {
    .art-tutor { position: fixed; inset: 0; z-index: 10030; width: auto; border-left: 0; box-shadow: none; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
    .art-viewer.tutor-open .art-tutor { animation-name: art-sheet-in; }
    #view-artifacts .art-compose textarea, #view-artifacts .art-compose textarea:focus { font-size: 16px; }
    /* From your texts is one row you swipe, so it stays small above the artifacts. */
    .art-texts-row { display: flex; margin: 0 -20px; padding: 2px 20px 6px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 20px; scrollbar-width: none; }
    .art-texts-row::-webkit-scrollbar { display: none; }
    .art-text { flex: 0 0 min(78%, 280px); scroll-snap-align: start; }
}
@keyframes art-sheet-in { from { opacity: 0; transform: translateY(24px); } }
