@font-face {
  font-family: Vazirmatn;
  src: url('/fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #142d43;
  --muted: #536675;
  --border: #d8e2ea;
  --canvas: #f3f6fa;
  --accent: #176961;
  --accent-light: #e6f2f0;
  --danger: #a12d3e;
  font: 15px/1.85 Vazirmatn, Tahoma, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
a { color: var(--accent); text-underline-offset: 4px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #2d83bd;
  outline-offset: 2px;
}
h1, h2, h3, p { margin-block-start: 0; }
h1 { font-size: clamp(1rem, 2.8vw, 1.35rem); margin: 0; }
h2 { font-size: 1.35rem; margin-block-end: 14px; }
h3 { font-size: 1.1rem; margin-block-end: 10px; }
.skip-link { position: absolute; inset: 8px auto auto 8px; padding: 6px 15px; background: white; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); z-index: 10; }
.site-header { background: #fff; border-block-end: 1px solid var(--border); }
.header-content, .container { width: min(1170px, calc(100% - 42px)); margin-inline: auto; }
.header-content { min-height: 78px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand, .header-actions, .account { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand img { object-fit: contain; }
.header-actions { justify-content: flex-end; font-size: .88rem; }
.account { color: var(--muted); }
.account:not(:empty) { border-inline-start: 1px solid var(--border); padding-inline-start: 14px; }
.container { padding-block: 30px 62px; }
.loading { text-align: center; color: var(--muted); margin-block: 60px; }
.notice { padding: 12px 17px; margin-block-end: 18px; border: 1px solid #c3dfd8; background: var(--accent-light); border-radius: 9px; color: #17554e; overflow-wrap: anywhere; }
.notice.error { color: var(--danger); background: #fdf0f2; border-color: #efcbd1; }
.panel, dialog { background: #fff; border: 1px solid var(--border); border-radius: 13px; padding: 24px; }
.login { width: min(480px, 100%); margin: clamp(10px, 7vw, 70px) auto 0; }
.login p, .hint { color: var(--muted); font-size: .86rem; }
.nav { display: flex; align-items: end; flex-wrap: wrap; column-gap: 20px; border-block-end: 1px solid var(--border); margin-block-end: 23px; }
.nav button, .nav a { background: transparent; border: 0; border-block-end: 2px solid transparent; padding: 10px 3px; margin-block-end: -1px; color: var(--muted); text-decoration: none; }
.nav button[aria-current="page"] { border-color: var(--accent); color: var(--accent); font-weight: 750; }
.nav a { margin-inline-start: auto; color: var(--accent); }
.workspace { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.7fr); align-items: start; gap: 20px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-block-end: 15px; }
.panel-heading h2, .panel-heading h3 { margin: 0; }
.items { display: grid; gap: 8px; }
.item { width: 100%; text-align: start; background: #fff; padding: 12px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--ink); overflow-wrap: anywhere; }
.item:hover { background: #f5f9fc; }
.item[aria-pressed="true"] { border-color: #73ac9e; background: var(--accent-light); }
.item strong { display: block; font-weight: 670; }
.item-meta { display: block; color: var(--muted); font-size: .79rem; margin-block-start: 3px; }
.field { display: grid; gap: 5px; font-weight: 600; margin: 0; }
.fields { display: grid; gap: 14px; }
.inline-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.taxonomy-fields, .structured-fields { display: grid; gap: 11px; min-inline-size: 0; margin: 0; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: 9px; }
.taxonomy-fields { background: #f8fafc; }
.taxonomy-fields legend, .structured-fields legend { padding-inline: 6px; color: var(--ink); font-weight: 700; }
.taxonomy-controls { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.destination { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.destination-path, .entry-placement { color: var(--accent); font-weight: 650; }
.destination p, .taxonomy-fields .hint, .structured-fields .hint { margin: 0; }
.destination a { flex-shrink: 0; font-size: .86rem; }
.taxonomy-controls [hidden], .entry-editor-fields[hidden], .structured-fields[hidden] { display: none; }
.entry-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; }
.entry-details dt { color: var(--muted); font-size: .84rem; }
.entry-details dd { margin: 0; }
input:not([type="checkbox"]), select, textarea {
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  color: var(--ink);
  border: 1px solid #bbcbd7;
  border-radius: 7px;
  background: #fff;
  font-weight: 400;
}
input:is(:disabled, :read-only), textarea:read-only { background: #f5f7fa; }
textarea { resize: vertical; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 6px 14px; min-height: 40px; border-radius: 7px; border: 1px solid var(--border); color: var(--ink); background: white; text-decoration: none; font-size: .89rem; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.danger { color: var(--danger); border-color: #ecc4ca; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-block-start: 3px; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; background: #eef2f7; color: #3e596a; font-size: .78rem; }
.tag[data-state="published"] { color: #145846; background: #e2f3eb; }
.tag[data-state="submitted"] { color: #764200; background: #fff0d7; }
.empty { color: var(--muted); margin-block: 10px 3px; }
.entry-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-main-media[hidden], .studio-video-fields [hidden], .studio-video-fields[hidden] { display: none; }
.studio-media-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.studio-media-layout .media-fields { background: #f8fafc; }
.studio-video-fields { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 12px; border: 1px solid #b9d4d2; border-radius: 10px; background: #f5faf9; }
.studio-video-fields legend { padding-inline: 6px; font-weight: 750; }
.studio-video-fields p { margin: 0; }
.studio-video-preview { display: grid; gap: 9px; min-width: 0; }
.studio-video-empty { display: grid; place-items: center; min-height: 100px; padding: 14px; border: 1px dashed #9dbdbb; border-radius: 7px; color: var(--muted); text-align: center; }
.studio-video-preview .media-preview, .media-preview.studio-review-video { width: 100%; aspect-ratio: 16 / 9; margin-block: 0; background: #101e2a; object-fit: contain; }
.studio-video-file { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.studio-video-file bdi { min-width: 0; overflow-wrap: anywhere; font-size: .86rem; }
.media-fields { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.media-fields[hidden], .body-media-list[hidden], .cover-preview:empty { display: none; }
.media-fields > .button { justify-self: start; }
.file-picker { display: grid; gap: 6px; }
.file-picker .upload-notice { margin: 0; }
.file-picker .upload-progress { width: 100%; height: 9px; accent-color: var(--accent); }
.file-picker [hidden] { display: none; }
.media-preview { display: block; max-width: 100%; max-height: 24rem; margin-block: 8px; border-radius: 8px; }
.cover-preview .media-preview { max-height: 12rem; }
.thumbnail-editor { min-width: 0; margin: 2px 0 0; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.thumbnail-editor[hidden] { display: none; }
.thumbnail-editor legend { font-weight: 700; padding-inline: 5px; }
.thumbnail-editor > .hint { margin-block: 0 10px; }
.thumbnail-editor-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; }
.thumbnail-frame { position: relative; width: min(100%, 124px); aspect-ratio: 1; flex: none; overflow: hidden; border-radius: 8px; background: #eaf1f6; cursor: grab; touch-action: none; }
.thumbnail-frame:active { cursor: grabbing; }
.thumbnail-frame img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; object-position: center; user-select: none; pointer-events: none; }
.thumbnail-controls { display: grid; gap: 6px; flex: 1 1 160px; min-width: 0; }
.thumbnail-controls input[type="range"] { width: 100%; padding: 0; min-height: 24px; }
.thumbnail-controls > .button { justify-self: start; }
.thumbnail-controls .hint { min-height: 1.5em; margin: 0; }
.body-media-list { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; }
.body-media-row { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.body-media-row > bdi { flex: 1; min-width: 0; }
.body-media-row .media-preview { width: 46px; height: 46px; object-fit: contain; margin: 0; }
.body-media-row .compact { padding: 4px 8px; }
.review-panel { border-block-start: 1px solid var(--border); padding-block-start: 16px; margin-block-start: 20px; }
.review-note { padding: 10px 13px; border-inline-start: 3px solid #c18438; background: #fff8ed; white-space: pre-wrap; }
.check { display: flex; align-items: center; gap: 8px; margin-block: 7px; }
.check input { inline-size: 16px; block-size: 16px; accent-color: var(--accent); }
dialog { width: min(460px, calc(100% - 30px)); color: var(--ink); }
dialog::backdrop { background: #0a223480; }
dialog form { margin-block-start: 15px; }

@media(max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .studio-media-layout { grid-template-columns: 1fr; }
  .header-content, .container { width: calc(100% - 26px); }
  .header-content { padding-block: 11px; align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .nav { column-gap: 12px; }
  .panel { padding: 17px; }
  .items { max-height: 17rem; overflow-y: auto; }
}

@media(max-width: 430px) {
  .inline-fields, .taxonomy-controls, .entry-details { grid-template-columns: 1fr; }
  .nav a { margin-inline-start: 0; }
}
