/* Font Studio (/font-editor). It wears Video Studio's frame and panels
   (video-studio.css): menus and Export along the top, then the tools, then
   the glyphs, the glyph view and the settings in a row, with the preview or
   kerning panel under the view. On a phone the glyphs and the settings
   become sheets opened from tabs. */

/* ---- Start screen ---- */
.fs-new .st-new-row + .st-new-row { margin-top: 12px; }
.fs-new .st-new-row > .st-field { flex: 0 0 auto; }
.fs-new .st-new-row > .fs-new-name { flex: 1 1 200px; }
.fs-new .seg { flex-wrap: wrap; }

/* ---- The frame ---- */
.fs-work { grid-template-rows: auto auto minmax(0, 1fr); }
.fs-body { grid-template-columns: 252px minmax(0, 1fr) 290px; }
.fs-main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.fs-work.has-dock .fs-main { grid-template-rows: minmax(160px, 1fr) minmax(170px, 32%); }
.fs-menu { max-height: 72vh; overflow-y: auto; scrollbar-width: thin; }
.fs-menu-head { margin: 6px 10px 2px; color: var(--accent-strong); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- The tool bar ---- */
.fs-bar { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.fs-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.fs-bar-gap { flex: none; width: 1px; height: 22px; margin: 0 6px; background: var(--border); }
.fs-glyph-name { min-width: 80px; max-width: 220px; overflow: hidden; color: var(--text); font-family: var(--mono); font-size: 0.78rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.fs-view-btns { display: flex; align-items: center; gap: 2px; flex: none; margin-left: auto; }

/* ---- The glyph view ---- */
.fs-view { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #14111f; }
.fs-canvas { display: block; touch-action: none; outline: none; }
.fs-msg { position: absolute; left: 10px; bottom: 8px; z-index: 2; margin: 0; pointer-events: none; }
.fs-msg:not(:empty) { max-width: calc(100% - 20px); padding: 6px 10px; color: var(--text); white-space: normal; background: rgba(20, 17, 31, 0.86); border: 1px solid var(--border); }
.fs-msg[data-kind="warn"] { border-color: var(--gold); }
.fs-msg[data-kind="ok"] { border-color: #2ec4b6; }

/* ---- The glyphs ---- */
.fs-lib { grid-template-columns: minmax(0, 1fr); }
.fs-lib-body { display: flex; flex-direction: column; min-height: 0; }
.fs-search { width: 100%; margin: 0 0 10px; padding: 7px 10px; font-size: 0.8rem; }
.fs-count { color: var(--faint); }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 4px; }
.fs-cell { display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 0; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; cursor: pointer; transition: border-color 140ms ease, color 140ms ease; }
.fs-cell[hidden] { display: none; }
.fs-cell-pic { display: block; width: 100%; aspect-ratio: 1; background: #14111f; }
.fs-cell-label { padding: 2px 3px; overflow: hidden; font-size: 0.66rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.fs-cell.is-on { color: var(--tint-text); background: var(--tint); border-color: var(--accent-strong); }
.fs-cell:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- Settings ---- */
.fs-text { flex: 1 1 auto; min-width: 0; padding: 5px 9px; font-family: var(--mono); font-size: 0.78rem; }
.fs-tf .vs-numwrap { flex: 1 1 auto; }
.fs-tf .vs-num { width: 64px; }
.fs-work .vs-insp .vs-num { width: 80px; padding: 5px 8px; }

/* ---- The dock under the view ---- */
.fs-dock { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--surface); border-top: 1px solid var(--border); }
.fs-dock-tabs { display: flex; gap: 2px; padding: 3px 6px; }
.fs-dock-tab { padding: 3px 10px; color: var(--muted); background: none; border: 0; border-radius: 0; font: inherit; font-size: 0.74rem; cursor: pointer; }
.fs-dock-tab.is-active { color: var(--tint-text); background: var(--tint); }
.fs-dock-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fs-dock-body { position: relative; min-height: 0; }
.fs-work:not(.has-dock) .fs-dock-body { display: none; }
.fs-dock-pane { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.fs-dock-pane[hidden] { display: none; }

.fs-preview-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 10px 6px; }
.fs-preview-bar .seg { margin: 0; }
.fs-size { width: 140px; }
.fs-kern-check { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.fs-build { color: var(--muted); font-size: 0.76rem; }
.fs-build[data-kind="warn"] { color: var(--gold); }
.fs-type { flex: 1 1 auto; min-height: 0; margin: 0 10px 10px; padding: 8px 12px; color: var(--text); background: #14111f; border: 1px solid var(--border); border-radius: 0; line-height: 1.25; resize: none; outline: none; font-kerning: normal; }
.fs-type:focus-visible { border-color: var(--accent); }

.fs-kern { flex-direction: row !important; gap: 10px; padding: 4px 10px 10px; }
.fs-kern-side { display: flex; flex-direction: column; gap: 8px; flex: 0 0 230px; min-width: 0; }
.fs-kern-row { display: flex; gap: 6px; }
.fs-kern-in { width: 0; flex: 1 1 0; padding: 6px 8px; font-size: 0.9rem; text-align: center; }
.fs-kern-row .vs-num { width: 70px; }
.fs-kern-side .fs-kern-range { flex: none; width: 100%; margin: 4px 0; }
.fs-kern-cv { flex: 1 1 auto; min-width: 0; height: 100%; border: 1px solid var(--border); }
.fs-kern-listbox { display: flex; flex-direction: column; flex: 0 0 170px; min-height: 0; }
.fs-kern-listbox .vs-lib-title { margin: 0 0 6px; }
.fs-kern-list { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.fs-kern-pair { display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; font-family: var(--mono); font-size: 0.74rem; cursor: pointer; }
.fs-kern-v { color: var(--muted); }

/* ---- Dialogs ---- */
.fs-form { display: flex; flex-direction: column; gap: 10px; min-width: min(420px, 80vw); }
.fs-form .input { padding: 9px 12px; }
.fs-info { display: flex; flex-direction: column; gap: 14px; }
.fs-info-set { margin: 0; padding: 0; border: 0; }
.fs-info-set .make-label { margin: 0 0 8px; }
.fs-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.fs-info-grid .is-wide { grid-column: 1 / -1; }
.fs-info-grid .input { width: 100%; padding: 7px 10px; }
.fs-info-area { min-height: 54px; resize: vertical; font: inherit; }
.fs-export { display: flex; flex-direction: column; gap: 12px; }
.fs-formats { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.fs-format-ext { width: 52px; font-family: var(--mono); font-size: 0.7rem; font-weight: 600; }
.fs-note { padding: 8px 10px; color: var(--text); background: var(--surface-2); border-left: 3px solid var(--gold); }
.fs-pick-list { display: flex; flex-direction: column; gap: 8px; }

/* ---- Under the pointer: gold ---- */
@media (hover: hover) {
  :is(.fs-cell, .fs-kern-pair, .fs-dock-tab):hover { color: var(--bg); background: var(--gold); border-color: var(--gold); }
  .fs-cell:hover .fs-cell-pic { outline: 2px solid var(--gold); outline-offset: -2px; }
}
:is(.fs-cell, .fs-kern-pair, .fs-dock-tab):active { color: var(--bg); background: var(--gold); border-color: var(--gold); }

/* ---- Phones ---- */
@media (max-width: 760px) {
  .fs-new .st-new-row > .st-field { flex: 1 1 100%; }
  .fs-work { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .fs-body { grid-template-columns: minmax(0, 1fr); }
  .fs-main { height: 100%; }
  .fs-work.has-dock .fs-main { grid-template-rows: minmax(140px, 1fr) minmax(150px, 40%); }
  .fs-bar { gap: 3px; padding: 3px 6px; overflow-x: auto; scrollbar-width: none; }
  .fs-bar::-webkit-scrollbar { display: none; }
  .fs-bar .vs-ib { width: 36px; height: 36px; flex: none; }
  .fs-glyph-name { min-width: 48px; }
  .fs-bar-gap { margin: 0 2px; }
  .fs-kern { flex-direction: column !important; overflow-y: auto; }
  .fs-kern-side, .fs-kern-listbox { flex: none; }
  .fs-kern-cv { flex: none; height: 120px; }
  .fs-info-grid { grid-template-columns: minmax(0, 1fr); }
}
