/* Display settings (the "نمایش" panel in the public nav): fonts, text size
   and the panel's own styling.

   User-selectable reading fonts.
   The defaults — IranianSans for Farsi, DroidKufi for Arabic — stay in
   farsi.css / arabi.css; a rule below only applies once the visitor picks
   another font, stored in the font-fa / font-ar cookie and mirrored onto
   <html data-font="..."> by the inline script in layouts/public-app. */

/* Farsi */
@font-face {
    font-family: Vazirmatn;
    font-style: normal;
    font-weight: normal;
    font-display: swap;
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
}
@font-face {
    font-family: Vazirmatn;
    font-style: normal;
    font-weight: bold;
    font-display: swap;
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
}
@font-face {
    font-family: Sahel;
    font-style: normal;
    font-weight: normal;
    font-display: swap;
    src: url('../fonts/Sahel-Regular.woff2') format('woff2');
}
@font-face {
    font-family: Sahel;
    font-style: normal;
    font-weight: bold;
    font-display: swap;
    src: url('../fonts/Sahel-Bold.woff2') format('woff2');
}

/* Arabic */
@font-face {
    font-family: Amiri;
    font-style: normal;
    font-weight: normal;
    font-display: swap;
    src: url('../fonts/Amiri-Regular.woff2') format('woff2');
}
@font-face {
    font-family: Amiri;
    font-style: normal;
    font-weight: bold;
    font-display: swap;
    src: url('../fonts/Amiri-Bold.woff2') format('woff2');
}
@font-face {
    font-family: NotoNaskhArabic;
    font-style: normal;
    font-weight: normal;
    font-display: swap;
    src: url('../fonts/NotoNaskhArabic-Regular.woff2') format('woff2');
}
@font-face {
    font-family: NotoNaskhArabic;
    font-style: normal;
    font-weight: bold;
    font-display: swap;
    src: url('../fonts/NotoNaskhArabic-Bold.woff2') format('woff2');
}

html[data-font="vazirmatn"] body {
    font-family: Vazirmatn, IranianSans, Geneva, sans-serif;
}
html[data-font="sahel"] body {
    font-family: Sahel, IranianSans, Geneva, sans-serif;
}
html[data-font="amiri"] body {
    font-family: Amiri, DroidKufi, Geneva, sans-serif;
}
html[data-font="noto-naskh"] body {
    font-family: NotoNaskhArabic, DroidKufi, Geneva, sans-serif;
}

/* Text size. Bootstrap sizes are rem-based, so scaling the root scales the
   whole page; body is pinned to 1rem because farsi.css / arabi.css set it to
   the absolute keyword "medium", which would ignore the root. "md" is the
   default and sets no attribute. */
html[data-font-size="sm"]  { font-size: 90%; }
html[data-font-size="lg"]  { font-size: 115%; }
html[data-font-size="xl"]  { font-size: 130%; }
html[data-font-size="2xl"] { font-size: 150%; }
html[data-font-size] body  { font-size: 1rem; }

/* The panel itself. Sized in px so it stays put while the text size changes. */
.display-panel {
    --dp-bg: #212529;
    --dp-text: #f8f9fa;
    --dp-muted: #adb5bd;
    --dp-border: #495057;
    --dp-accent: #20c997;
    --dp-accent-bg: rgba(32, 201, 151, 0.15);
    width: 320px;
    max-width: calc(100vw - 24px);
    padding: 0;
    overflow: hidden;
    font-size: 14px;
    text-align: right;
    color: var(--dp-text);
    background-color: var(--dp-bg);
    border: 1px solid var(--dp-border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.light-mode .display-panel {
    --dp-bg: #ffffff;
    --dp-text: #212529;
    --dp-muted: #6c757d;
    --dp-border: #dee2e6;
    --dp-accent: #198754;
    --dp-accent-bg: rgba(25, 135, 84, 0.1);
}
.display-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-weight: bold;
    border-bottom: 1px solid var(--dp-border);
}
.display-reset {
    padding: 0;
    font-size: 12px;
    color: var(--dp-accent);
    background: none;
    border: 0;
}
.display-reset:hover {
    text-decoration: underline;
}
.display-panel-body {
    padding: 4px 16px 16px;
}
.display-legend {
    display: flex;
    justify-content: space-between;
    margin: 14px 0 8px;
    font-size: 12px;
    color: var(--dp-muted);
}
.display-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.display-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 8px 4px;
    color: var(--dp-text);
    background: none;
    border: 1px solid var(--dp-border);
    border-radius: 10px;
    transition: border-color 0.15s, background-color 0.15s;
}
.display-option:hover {
    border-color: var(--dp-accent);
}
.display-option.active {
    font-weight: bold;
    background-color: var(--dp-accent-bg);
    border-color: var(--dp-accent);
}
.display-option-label {
    font-size: 11px;
    color: var(--dp-muted);
}
.display-option.active .display-option-label {
    color: var(--dp-text);
}
.display-swatch {
    width: 100%;
    height: 24px;
    border: 1px solid var(--dp-border);
    border-radius: 6px;
}
.display-swatch-dark  { background-color: black; }
.display-swatch-light { background-color: white; }
.display-swatch-gray  { background-color: gray; }
.display-font-sample {
    font-size: 18px;
    font-weight: normal;
    line-height: 1.4;
    white-space: nowrap;
}
.display-size {
    display: flex;
    align-items: center;
    gap: 8px;
}
.display-size-btn {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    font-family: Arial, sans-serif;
    color: var(--dp-text);
    background: none;
    border: 1px solid var(--dp-border);
    border-radius: 8px;
}
.display-size-btn:hover:enabled {
    border-color: var(--dp-accent);
}
.display-size-btn:disabled {
    opacity: 0.4;
}
.display-size-steps {
    display: flex;
    flex: 1;
    gap: 4px;
}
.display-size-steps button {
    flex: 1;
    height: 8px;
    padding: 0;
    background-color: var(--dp-border);
    border: 0;
    border-radius: 999px;
}
.display-size-steps button.filled {
    background-color: var(--dp-accent);
}
.display-preview {
    margin-top: 16px;
    padding: 0 12px 10px;
    border: 1px solid var(--dp-border);
    border-radius: 10px;
}
.display-preview .display-legend {
    margin-top: 8px;
    margin-bottom: 4px;
}
.display-preview p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.8;
}
