@layer t2.plugin {
/* Path: T2Editor/plugin/file/file.css */
/* Rationale: file 선택자는 플러그인 루트 아래로 제한하고 공개 본문 표현이 필요하면 css/content.css도 함께 수정한다. */

/* 이 모달은 data-t2-modal-surface="custom" 이라 공식 밴드·인셋 규칙의 대상이
   아니다 — 폭과 여백을 여기서 갖는 것이 맞다(link 모달은 standard 라 다르다). */
.t2-file-editor-modal { padding: var(--t2-s6); width: 480px; max-width: 90vw; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui; }
.t2-file-editor-modal h3 { font-size: 20px; margin: 0 0 var(--t2-s5) 0; }
/* 드롭존의 기하(안쪽 여백·표적 원의 지름·글리프 크기)는 공통 어휘가 소유한다
   — css/t2-visual-system.css 의 .t2-upload-container 와 그 compact 변형이다.
   여기서 다시 적으면 t2.plugin 레이어가 t2.product 를 조용히 이겨서, 36px 짜리
   표적 원 안에 48px 글리프가 들어가 클립되었다(재서 확인: 12px 씩 넘침).
   이 플러그인이 소유하는 것은 거동과 색뿐이다. */
.t2-file-upload-area { text-align: center; cursor: pointer; transition: color 0.2s, background-color 0.2s, border-color 0.2s, opacity 0.2s, transform 0.2s; margin-bottom: var(--t2-s5); position: relative; }
.t2-file-upload-area .t2-upload-container__text { font-size: 15px; margin-bottom: var(--t2-s1); }
.t2-file-upload-area .t2-upload-container__hint { font-size: 13px; }
.t2-file-upload-area input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.t2-file-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--t2-s4); margin: var(--t2-s5) 0; max-height: 300px; overflow-y: auto; padding: var(--t2-s1); }
.t2-file-preview-item { position: relative; display: flex; flex-direction: column; align-items: center; padding: var(--t2-s3); border-radius: var(--t2-radius-control); transition: color 0.2s, background-color 0.2s, border-color 0.2s, opacity 0.2s, transform 0.2s; }
.t2-file-preview-item:hover { background: var(--t2-product-wash); }
.t2-file-preview-icon { width: 48px; height: 60px; background-color: var(--t2-warning); border-radius: var(--t2-radius-control); margin-bottom: var(--t2-s2); position: relative; overflow: hidden; }
.t2-file-preview-icon::before { content: ''; position: absolute; top: 0; right: 0; width: 16px; height: 16px; background: var(--t2-surface); }
.t2-file-preview-icon::after { content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0; border-style: solid; border-width: 8px; border-color: #fff #fff transparent transparent; }
.t2-file-preview-name { font-size: 13px; text-align: center; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 var(--t2-s1); }
.t2-file-preview-remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; background: rgba(0,0,0,.5); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity 0.2s; }
.t2-file-preview-item:hover .t2-file-preview-remove,
.t2-file-preview-item:focus-within .t2-file-preview-remove { opacity: 1; }
.t2-file-preview-remove:hover { background: rgba(0,0,0,.7); }
.t2-file-preview-remove .material-icons { font-size: 14px; }
@media (hover: none), (pointer: coarse) {
  .t2-file-preview-remove { opacity: 1; }
}
.t2-btn-group { display: flex; justify-content: flex-end; gap: var(--t2-s3); margin-top: var(--t2-s6); }
.t2-btn[data-action="cancel"] { color: var(--t2-ink-muted); background: var(--t2-product-wash); }
.t2-btn[data-action="cancel"]:hover { background: var(--t2-inset); }
.t2-btn[data-action="upload"] { color: var(--t2-plugin-on-action); background: transparent; border-bottom:2px solid var(--t2-plugin-product, var(--t2-product)); }
.t2-btn[data-action="upload"]:hover:not(:disabled) { background: var(--t2-plugin-product-soft, var(--t2-product-wash)); color: var(--t2-plugin-on-action); }
.t2-btn[data-action="upload"]:disabled { background: transparent; color: var(--t2-ink-faint); border-bottom-color: var(--t2-line-strong); cursor: not-allowed; }

.t2-file-block { margin: var(--t2-s2) 0; }
.file-container { width: 100%; min-width: 280px; max-width: 360px; aspect-ratio: 4/1; padding: 0 var(--t2-s5); display: flex; align-items: center; font-family: 'Roboto', Arial, sans-serif; transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease; box-sizing: border-box; cursor: pointer; }
.t2-file-block .file-container:hover { transform: translateY(-1px); background-color: var(--t2-product-wash); box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.t2-file-block .file-icon { position: relative; width: 42px; height: 52px; background-color: var(--t2-warning); border-radius: var(--t2-radius-control); margin-right: var(--t2-s5); flex-shrink: 0; overflow: hidden; }
.t2-file-block .file-icon::before { content: ''; position: absolute; top: 0; right: 0; width: 14px; height: 14px; background: var(--t2-surface); }
.t2-file-block .file-icon::after { content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0; border-style: solid; border-width: 7px; border-color: #fff #fff transparent transparent; }
.t2-file-block .file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.t2-file-block .file-name { font-size: 17px; margin: 0 0 var(--t2-s1) 0; letter-spacing: .15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.t2-file-block .file-details { font-size: 12px; line-height: 1.5; letter-spacing: .25px; display: flex; gap: var(--t2-s3); }
.t2-file-block .file-details span { display: inline-block; white-space: nowrap; }
.t2-file-block:hover .t2-media-controls { display: flex; }

.audio-file-container { width: 100%; min-width: 240px; max-width: 380px; aspect-ratio: 4/1; padding: 0 var(--t2-s5); display: flex; align-items: center; font-family: 'Roboto', Arial, sans-serif; transition: opacity 0.2s ease; box-sizing: border-box; padding-right: var(--t2-s3); }
.audio-file-container:hover { opacity: .95; }
.audio-file-icon { width: 36px; height: 45px; background-color: var(--t2-product); border-radius: var(--t2-radius-control); margin-right: var(--t2-s5); position: relative; flex-shrink: 0; overflow: hidden; }
.audio-file-icon::before { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 20px; height: 20px; background: #fff; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z'/%3E%3C/svg%3E") center/contain no-repeat; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z'/%3E%3C/svg%3E") center/contain no-repeat; opacity: .9; }
.audio-file-icon::after { content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0; border-style: solid; border-width: 7px; border-color: #fff #fff transparent transparent; }
.audio-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.audio-file-name { font-size: 17px; margin: 0 0 var(--t2-s1) 0; letter-spacing: .15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.audio-file-details { font-size: 12px; line-height: 1.5; letter-spacing: .25px; display: flex; gap: var(--t2-s3); }
.audio-file-details span { display: inline-block; white-space: nowrap; }
.audio-duration { font-weight: 500; min-width: 45px; text-align: right; margin-left: auto; }
.audio-player { display: none; }

/* Dark Mode */
html[data-t2editor-theme="dark"] .t2-file-editor-modal { background-color: var(--t2-surface); color: var(--t2-ink); box-shadow: 0 4px 24px rgba(0,0,0,.3); border-color: var(--t2-line); }
html[data-t2editor-theme="dark"] .t2-file-editor-modal h3 { color: var(--t2-ink); }
html[data-t2editor-theme="dark"] .t2-file-preview-item { background-color: var(--t2-surface); border-color: var(--t2-line); }
html[data-t2editor-theme="dark"] .t2-file-preview-item:hover { background-color: var(--t2-surface); }
html[data-t2editor-theme="dark"] .t2-file-preview-remove { background-color: rgba(0,0,0,.6); }
html[data-t2editor-theme="dark"] .t2-file-preview-remove:hover { background-color: rgba(0,0,0,.8); }
html[data-t2editor-theme="dark"] .t2-file-preview-name { color: var(--t2-ink); }
html[data-t2editor-theme="dark"] .file-container { background-color: var(--t2-surface); border-color: var(--t2-line); color: var(--t2-ink); }
html[data-t2editor-theme="dark"] .t2-file-block .file-container:hover { background-color: var(--t2-surface); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
html[data-t2editor-theme="dark"] .t2-file-block .file-name { color: rgba(255,255,255,.87); }
html[data-t2editor-theme="dark"] .t2-file-block .file-details { color: rgba(255,255,255,.6); }
html[data-t2editor-theme="dark"] .audio-file-container { background-color: var(--t2-surface); border-color: var(--t2-line); color: var(--t2-ink); }

/* T2Editor Coding-Agent Rule: Write only concise, high-value comments. Preserve "Path: T2Editor/..." comments; update them when files move—never delete them. */

/* T2Editor /law official plugin design alignment */
/* Shared --t2-plugin-* tokens are owned by css/t2-foundation.css. */
.t2-dsc-service-brand {
  letter-spacing: -0.01em;
}
.t2-product-brand { white-space: nowrap; }

.t2-file-editor-modal { color: var(--t2-plugin-text); background: var(--t2-plugin-surface); border: 1px solid var(--t2-plugin-border); border-radius: var(--t2-plugin-radius-surface); box-shadow: var(--t2-plugin-shadow); }
.t2-file-editor-modal h3 { color: var(--t2-plugin-text); font-weight: 800; }
/* 드롭존의 면·경계·상태색도 공통 어휘가 소유한다. 여기서 다시 적으면 1.5px
   파선이 1px 로 돌아가 표면의 경계선과 구별되지 않고, 표적 원의 hover/focus
   잉크 전환이 고정색에 막힌다 — 둘 다 재서 확인했다. */
.t2-file-preview-name { color: var(--t2-plugin-text); }
.t2-file-preview-item { background: var(--t2-plugin-surface-raised); border: 1px solid var(--t2-plugin-border); box-shadow: none; }
.t2-file-preview-remove, .t2-file-editor-modal .t2-btn { min-width: 44px; min-height: 44px; border-radius: var(--t2-plugin-radius-control); }
.t2-file-editor-modal .t2-btn[data-action="upload"] { color: var(--t2-plugin-on-action); background: var(--t2-plugin-action); font-weight: 750; }
.t2-file-editor-modal .t2-btn[data-action="cancel"] { color: var(--t2-plugin-text); background: var(--t2-plugin-surface-muted); border: 1px solid var(--t2-plugin-border); }
.file-container, .audio-file-container { color: var(--t2-plugin-text); background: var(--t2-plugin-surface); border: 1px solid var(--t2-plugin-border); border-radius: var(--t2-plugin-radius-island); box-shadow: none; }
.t2-file-block .file-name, .audio-file-name { color: var(--t2-plugin-text); font-weight: 700; }
.t2-file-block .file-details, .audio-file-details { color: var(--t2-plugin-text-muted); }
.t2-file-block .file-icon, .audio-file-icon { background: var(--t2-plugin-product); }
.audio-duration{ color: var(--t2-plugin-product); }
@media (max-width: 640px) {
  .t2-file-editor-modal { width: calc(100vw - 16px); max-width: none; max-height: calc(100dvh - 16px - env(safe-area-inset-bottom)); padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .t2-file-editor-modal input, .t2-file-editor-modal select, .t2-file-editor-modal textarea { font-size: 16px; } /* [iOS⚠️] */
}

/* =========================================================================
   T2Editor /law 706 — plugin scroll and native-control hardening
   ========================================================================= */
:is([class^="t2-file-"], [class*=" t2-file-"]):not([data-t2-modal-surface]) {
  max-width: 100%;
}
:is(:is([class^="t2-file-"], [class*=" t2-file-"]) :is(button, input, textarea, select), button[class^="t2-file-"], button[class*=" t2-file-"], input[class^="t2-file-"], input[class*=" t2-file-"], textarea[class^="t2-file-"], textarea[class*=" t2-file-"], select[class^="t2-file-"], select[class*=" t2-file-"]) {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
:is(:is([class^="t2-file-"], [class*=" t2-file-"]) button, button[class^="t2-file-"], button[class*=" t2-file-"]) {
  -webkit-appearance: none;
  appearance: none;
}
:is(:is([class^="t2-file-"], [class*=" t2-file-"]) :is(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="tel"], input[type="number"], input[type="password"], textarea, select), input:not([type])[class^="t2-file-"], input:not([type])[class*=" t2-file-"], input[type="text"][class^="t2-file-"], input[type="text"][class*=" t2-file-"], input[type="search"][class^="t2-file-"], input[type="search"][class*=" t2-file-"], input[type="email"][class^="t2-file-"], input[type="email"][class*=" t2-file-"], input[type="url"][class^="t2-file-"], input[type="url"][class*=" t2-file-"], input[type="tel"][class^="t2-file-"], input[type="tel"][class*=" t2-file-"], input[type="number"][class^="t2-file-"], input[type="number"][class*=" t2-file-"], input[type="password"][class^="t2-file-"], input[type="password"][class*=" t2-file-"], textarea[class^="t2-file-"], textarea[class*=" t2-file-"], select[class^="t2-file-"], select[class*=" t2-file-"]) {
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}
:is(:is([class^="t2-file-"], [class*=" t2-file-"]) :is(button, input, textarea, select), button[class^="t2-file-"], button[class*=" t2-file-"], input[class^="t2-file-"], input[class*=" t2-file-"], textarea[class^="t2-file-"], textarea[class*=" t2-file-"], select[class^="t2-file-"], select[class*=" t2-file-"]):focus {
  outline: none;
}
:is(:is([class^="t2-file-"], [class*=" t2-file-"]) :is(button, input, textarea, select), button[class^="t2-file-"], button[class*=" t2-file-"], input[class^="t2-file-"], input[class*=" t2-file-"], textarea[class^="t2-file-"], textarea[class*=" t2-file-"], select[class^="t2-file-"], select[class*=" t2-file-"]):focus-visible {
  outline: 1px solid var(--t2-plugin-product, var(--t2-product));
  outline-offset: 2px;

}

.t2-file-preview-grid {
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  touch-action: pan-y pinch-zoom;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.t2-file-preview-grid::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* T2Editor /law 706 — plugin select indicator after native appearance reset */
:is(:is([class^="t2-file-"], [class*=" t2-file-"]) select, select[class^="t2-file-"], select[class*=" t2-file-"]):not([multiple]):not([size]) {
  padding-inline-end: max(32px, 2.25em);
  background: var(--t2-surface);
  background-position:
    calc(100% - 14px) calc(50% - 1px),
    calc(100% - 9px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
/* Custom drag surfaces own pointer movement and must not trigger native text/image selection. */
:where([data-t2-drag-surface], [draggable="true"], input[type="range"], [role="slider"],
  [class*="drag-handle"], [class*="resize-handle"], [class*="resizer"],
  [class*="crop-handle"], [class*="trim-handle"], [class*="seek-bar"],
  [class*="slider-thumb"], [class*="range-thumb"]) {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
:where([data-t2-drag-surface], [draggable="true"], input[type="range"], [role="slider"],
  [class*="drag-handle"], [class*="resize-handle"], [class*="resizer"],
  [class*="crop-handle"], [class*="trim-handle"], [class*="seek-bar"],
  [class*="slider-thumb"], [class*="range-thumb"]) img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}
html.t2-drag-selection-active, html.t2-drag-selection-active body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

}
