/* ============================================================
 * Studio 페이지 셸
 * ------------------------------------------------------------
 * 계획서: docs/0.기획/20260717-ui-renewal-계획서.html §3
 *
 * 여기에는 "DS 컴포넌트가 아닌 것"만 둔다 — 페이지 골격(캔버스/폭/섹션 헤더).
 * 버튼·카드·모달·테이블·배지 등은 전부 seraph-components.css 의 .st-* 를 쓴다.
 *
 * 규칙: 색·치수는 하드코딩 금지, 전부 var(--st-*).
 *       여기 있는 것이 재사용 가능한 컴포넌트가 되면 DS 로 승격한다(§3 규칙 1).
 * ============================================================ */

/* 상단바(48px) 고정 + 본문이 남은 높이를 채우고 푸터는 항상 바닥.
   page(bodyClass='st-app studio-body') 로 사용한다. */
.studio-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.studio-main {
    flex: 1;
    background: var(--st-bg-canvas);
}

/* 콘텐츠 최대 폭 1080px (계획서 §4-①) */
.studio-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: var(--st-space-6) var(--st-space-4) var(--st-space-8);
}

/* 앱 생성 등 단일 폼 화면 (§10.1) */
.studio-wrap--narrow {
    max-width: 560px;
}

/* 섹션 헤더: [제목] [건수] ···· [검색] [정렬] [뷰토글]
   구 .page-head(h1 + 설명문)가 화면 상단 200px 를 먹던 것을 한 줄로 대체한다. */
.studio-section-head {
    display: flex;
    align-items: center;
    gap: var(--st-space-2);
    margin-bottom: var(--st-space-3);
    flex-wrap: wrap;
}

.studio-section-head h1,
.studio-section-head h2 {
    font-size: var(--st-text-heading-medium-size);
    line-height: var(--st-text-heading-medium-lh);
    font-weight: var(--st-font-weight-strong);
    margin: 0;
}

.studio-section-head .studio-count {
    color: var(--st-text-tertiary);
}

.studio-section-head .studio-spacer {
    flex: 1;
}

/* 홈 히어로 (§4) — 페이지당 heading-large 1개 */
.studio-hero {
    margin-bottom: var(--st-space-5);
}

.studio-hero h1 {
    font-size: var(--st-text-heading-large-size);
    line-height: var(--st-text-heading-large-lh);
    letter-spacing: -0.288px;
    font-weight: var(--st-font-weight-strong);
    margin: 0 0 var(--st-space-1);
}

.studio-hero p {
    margin: 0;
    color: var(--st-text-secondary);
    font-size: var(--st-text-body-large-size);
    line-height: var(--st-text-body-large-lh);
}

/* 홈 도구 카드 (§4-③) — 그라데이션 원색 타일 대신 라인 아이콘 + .st-card */
.studio-tools {
    display: grid;
    /* 카드 3개(Apps·쿼리·테마)가 한 줄에 들어가는 폭 — 302px * 3 + gap 16px * 2 */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--st-space-4);
    max-width: 940px;
}

.studio-tool {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--st-duration-normal) var(--st-easing);
}

.studio-tool:hover {
    box-shadow: var(--st-elevation-100);
}

.studio-tool-head {
    display: flex;
    align-items: center;
    gap: var(--st-space-2);
    margin-bottom: var(--st-space-1);
}

.studio-tool-head svg {
    width: 16px;
    height: 16px;
    color: var(--st-icon-brand);
    flex: none;
}

.studio-tool-head b {
    font-weight: var(--st-font-weight-strong);
    font-size: var(--st-text-body-large-size);
}

.studio-tool p {
    margin: 0;
    color: var(--st-text-secondary);
}

.studio-tool-meta {
    display: flex;
    gap: var(--st-space-1);
    margin-top: var(--st-space-3);
    min-height: 18px; /* 배지 로드 전 레이아웃 점프 방지 */
}

/* 툴바 컨트롤 폭 (검색/정렬) */
.studio-search {
    width: 200px;
}

.studio-sort {
    width: auto;
}

/* 카드 hover ⋯ 다크 메뉴 (§5-③).
   DS .st-menu 는 팝오버 표면만 정의하고 위치·표시는 소비자 몫이다.
   PDF 편집기(templates.html)의 .tb-menu 와 같은 방식으로 맞춘다. */
.studio-menu {
    position: fixed;
    display: none;
    z-index: 200;
    min-width: 180px;
}

/* 토스트 위치 (DS .st-toast 는 표면만 정의) */
.studio-toast-host {
    position: fixed;
    left: 50%;
    bottom: var(--st-space-8);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: var(--st-space-2);
    z-index: 300;
    align-items: center;
}

/* ── 앱 커버 썸네일 (§5-⑤) ─────────────────────────────────────
   구 썸네일은 회색 한 장이었다. 그 회색(--st-bg-secondary)이 캔버스 배경
   (--st-bg-canvas)과 같은 grey-100 이라 카드 위쪽이 배경에 묻혔고, 앱끼리
   구분도 되지 않았다. 스크린 캡처 파이프라인은 아직 없으므로 파일 브라우저의
   표준 대체안인 "콘텐츠 미리보기"를 그린다 — 앱이 가진 화면을 타입별 미니
   지면으로 그려 앱마다 타일이 달라진다(마크업은 apps.html 의 coverHtml).

   색은 DS 규칙 그대로 뉴트럴 + 파랑 하나만 쓴다. 앱마다 다른 색을 주는 방식
   (차트 카테고리 팔레트)은 seraph-charts.css 머리말이 금지한다 —
   "chart-* 색은 UI 컴포넌트에서 쓰지 않는다". 구분은 색이 아니라 내용이 한다. */
.studio-cover {
    display: block;                 /* DS 기본은 flex(아이콘 중앙) — 커버는 면을 꽉 채운다 */
    background: var(--st-blue-200); /* 캔버스(grey-100)·카드(흰색) 어느 쪽과도 겹치지 않는 톤 */
}

.studio-cover-art {
    display: block;
    width: 100%;
    height: 100%;
}

/* SVG 자식은 presentation attribute 에 var() 를 못 쓰므로 색을 여기서 준다. */
.studio-cover-page { fill: var(--st-bg); stroke: var(--st-border); }
.studio-cover-page--empty { fill: none; stroke: var(--st-grey-300); stroke-dasharray: 4 4; }
.studio-cover-title { fill: var(--st-blue-400); }
.studio-cover-title--muted { fill: var(--st-grey-300); }
.studio-cover-line { fill: var(--st-grey-200); }
.studio-cover-line--strong { fill: var(--st-grey-300); }
.studio-cover-bar { fill: var(--st-blue-400); }
.studio-cover-axis { fill: var(--st-grey-300); }
.studio-cover-field { fill: var(--st-bg); stroke: var(--st-grey-300); }
.studio-cover-btn { fill: var(--st-blue-500); }

.studio-cover-more,
.studio-cover-note {
    fill: var(--st-text-secondary);
    text-anchor: middle;
    dominant-baseline: central;
}

/* viewBox 200×150 = 카드 폭 기준 1:1 이라 아래 숫자는 실제 px 로 읽힌다. */
.studio-cover-more { font-size: 13px; font-weight: var(--st-font-weight-strong); }
.studio-cover-note { font-size: 11px; }

/* "새 앱" 타일 (§5-④) — 커버가 생긴 뒤로는 점선 테두리가 "만들기"를 뜻한다.
   면은 반드시 흰색(--st-bg)이다. 투명이면 캔버스(grey-100)가 그대로 비쳐
   배경과 구분이 안 된다 — 구 썸네일이 회색이라 묻혔던 것과 같은 실수다. */
.studio-new-card {
    background: var(--st-bg);
    border-style: dashed;
    border-color: var(--st-grey-300);   /* 점선은 실선보다 얇게 보이므로 한 단계 진하게 */
}

.studio-new-card:hover {
    border-color: var(--st-border-brand-strong);
}

/* 썸네일 면은 파랑 틴트로 둔다 — 흰색이면 바로 아래 .st-file-meta(흰색)와
   같은 면이 되어 커버 영역이 어디까지인지 보이지 않는다.
   구분선(.st-file-thumb 의 border-bottom)도 DS 기본값 그대로 살린다. */
.studio-new-thumb {
    background: var(--st-blue-100);
    color: var(--st-blue-400);
    font-size: 28px;
}

.studio-new-card:hover .studio-new-thumb {
    background: var(--st-blue-200);
    color: var(--st-blue-500);
}

/* 내보내기/불러오기 모달의 테이블 선택 목록.
   구 .table-pick 의 대체 — 체크박스는 DS .st-checkbox 를 쓰고 여기선 컨테이너만. */
.studio-picklist {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-medium);
    padding: var(--st-space-1);
}

.studio-picklist-row {
    display: flex;
    align-items: center;
    gap: var(--st-space-2);
    padding: var(--st-space-1) var(--st-space-2);
    border-radius: var(--st-radius-small);
}

.studio-picklist-row:hover {
    background: var(--st-bg-hover);
}

.studio-picklist-row .studio-picklist-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-picklist-empty {
    padding: var(--st-space-3);
    text-align: center;
    color: var(--st-text-tertiary);
}

/* 목록 보기: 행 전체가 클릭 대상 */
.studio-list-wrap .st-table tbody tr {
    cursor: pointer;
}

@media (max-width: 640px) {
    .studio-wrap {
        padding: var(--st-space-4) var(--st-space-3) var(--st-space-6);
    }
    .studio-tools {
        grid-template-columns: 1fr;
    }
    .studio-search {
        width: 100%;
    }
}
