/* Hand-written CSS, served raw (not processed by Tailwind) and loaded after the
 * bundles by Layouts/head/global-head.ctp. Keep this to things Tailwind cannot
 * express: @font-face, document-level defaults, and the handful of base element
 * rules the design applies globally.
 *
 * Anything expressible as a utility belongs in the views instead; anything that
 * is specific to one layout belongs in that layout's entry under _v2/css/src/.
 */

/* ─── Vazirmatn (self-hosted; see _v2/fonts) ──────────────────────────────
   The design references the jsDelivr build — we ship it locally so there is no
   third-party request and the preload in global-head.ctp actually hits.
   All six weights the design uses (400/500/600/700/800/900) are declared;
   without them the browser synthesises fake bolds and the headings drift off
   the approved design. */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/_v2/fonts/Vazirmatn-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/_v2/fonts/Vazirmatn-Medium.woff2") format("woff2");
}

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/_v2/fonts/Vazirmatn-SemiBold.woff2") format("woff2");
}

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/_v2/fonts/Vazirmatn-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/_v2/fonts/Vazirmatn-ExtraBold.woff2") format("woff2");
}

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/_v2/fonts/Vazirmatn-Black.woff2") format("woff2");
}

/* ─── Document defaults ───────────────────────────────────────────────────
   Applied to bare elements so every page inherits the design's typography
   without repeating font/color utilities on <body>. */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Vazirmatn", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  /* ss01 swaps in the Persian letterforms the design was set in */
  font-feature-settings: "ss01";
  color: #41485a;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Form controls do not inherit the family on their own. */
input,
button,
select,
textarea {
  font-family: inherit;
}

/* ─── Scroll progress ─────────────────────────────────────────────────────
   Rendered by Elements/header.ctp on every layout and driven by
   _v2/js/main.js. Sticks directly under the 74px masthead, so it reads as the
   header's bottom border filling in as the page scrolls. Values are the
   design's (chabok-src/article.css); the inner span is scaled rather than
   resized so the browser keeps it off the main thread. */
.progress {
  position: sticky;
  top: 74px;
  z-index: 40;
  height: 3px;
  background: transparent;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--color-accent);
  transform: scaleX(0);
  /* RTL: the bar grows from the right edge */
  transform-origin: right;
  transition: transform 0.05s linear;
}

/* Persian digits are proportional by default, which makes numeric columns
   (prices, dates, ticker values) jitter. `.num` locks them to tabular and turns
   ss01 off, since it otherwise substitutes the digit forms. */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "ss01" off;
}

/* ─── Feed load-more (FRONT_D) ──────────────────────────────────────────────
   Rows appended by the feedLoadMore module in _v2/js/main.js fade up into place
   instead of snapping in, so it reads as "more arrived" rather than a reflow.
   These live here rather than in Tailwind because the class is added by JS —
   custom.css is served raw, so no safelisting is involved.

   `both` keeps the row invisible through its stagger delay; without it a
   delayed row would flash at full opacity before the animation starts. */
@keyframes feed-row-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.feed-row-in {
  animation: feed-row-in 0.38s ease-out both;
}

/* While a batch is in flight the control dims and shows a progress cursor. */
[data-feed-more][aria-busy="true"] {
  opacity: 0.65;
  cursor: progress;
}

/* Readers who ask for less motion get the content, not the choreography. */
@media (prefers-reduced-motion: reduce) {
  .feed-row-in {
    animation: none;
  }
}

/* ─── FRONT_ALOCHABOK promo («الو چابک») ──────────────────────────────────
   The design's `.promo` verbatim (chabok-src/home.css:74-86), kept as raw
   classes so the element's markup mirrors the design 1:1 instead of a utility
   wall. It is a shared sidebar component (home, landing, tag, archive), so it
   lives here (global) rather than a single layout entry. Tokens are the
   project's — `--color-navy` / `--color-accent`; the design's `--radius` is 10px. */
.promo {
  display: block;
  position: relative;
  overflow: hidden;
  padding: 26px 24px;
  border-radius: 10px;
  background: var(--color-navy);
  color: #fff;
}

.promo::after {
  content: "";
  position: absolute;
  left: -30px;
  bottom: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0.18;
}

.promo__k {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent);
}

.promo__t {
  display: block;
  margin-bottom: 16px;
  font-size: 16px;
  line-height: 1.7;
  font-weight: 500;
}

.promo__cta {
  display: inline-block;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* ─── Static content pages: about (64) + contact (65) ─────────────────────
   The design's #about / #contact (chabok-src «پیش‌نمایش», STATIC CONTENT PAGES
   block), scoped under `.cms-page` — the shared base both pages carry
   (page-hero, crumb, info-card, kicker, promo). About adds prose/values/callout/
   license; contact adds the form + map (see the CONTACT block below). These live
   here (built into the served CSS) rather than the CMS content field because the
   panel's editor strips class attributes and <style>. Rendered by
   Elements/pages/about.ctp & contact.ctp via Categories/view.ctp. The grid adapts
   the design's full-bleed hero into a panel that fits blank.ctp's 1200px container. */
.cms-page{ color:#41485a; }
.cms-page :where(h1,h2,h3,p,figure){ margin:0; }

.cms-page .page-hero{
  background:#f6f7f9; border:1px solid #e8eaef; border-radius:14px; padding:40px 34px;
}
.cms-page .kicker{
  display:block; color:#c8430f; font-weight:700; font-size:13px;
  letter-spacing:.02em; margin-bottom:12px;
}
.cms-page .page-hero h1{
  font-size:38px; line-height:1.25; letter-spacing:-.02em; color:#15213c; font-weight:800;
}
.cms-page .page-hero p{
  font-size:17px; line-height:1.9; color:#41485a; max-width:64ch; margin-top:14px;
}

.cms-page .crumb{
  display:flex; align-items:center; gap:8px; font-size:13px; color:#767e8e; margin:22px 2px 0;
}
.cms-page .crumb a{ color:#767e8e; text-decoration:none; transition:color .15s; }
.cms-page .crumb a:hover{ color:#c8430f; }
.cms-page .crumb span{ color:#c9cdd6; }
.cms-page .crumb__now{ color:#15213c; font-weight:600; }

.cms-page .pg-layout{
  display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:54px;
  align-items:start; padding:40px 0 8px;
}
/* Let the sidebar column fill the row height so the sticky info-card has room to
   travel — `align-items:start` above otherwise sizes it to the card, leaving
   nothing for `position:sticky` to scroll within. */
.cms-page .pg-layout > aside{ align-self:stretch; }

.cms-page .prose{ font-size:17px; line-height:2.05; color:#41485a; max-width:74ch; }
.cms-page .prose > * + *{ margin-top:20px; }
.cms-page .prose h2{
  font-size:24px; color:#15213c; font-weight:700; margin-top:40px;
  display:flex; align-items:center; gap:11px;
}
.cms-page .prose h2::before{
  content:""; width:4px; height:21px; background:#ee5a24; border-radius:3px; flex:0 0 auto;
}
.cms-page .prose strong{ color:#15213c; font-weight:700; }

.cms-page .callout{
  background:#fdeee7; border-radius:10px; padding:22px 26px;
  font-size:17px; line-height:1.95; color:#15213c; font-weight:500;
}
.cms-page .callout .kicker{ margin-bottom:8px; }

.cms-page .values{ display:grid; grid-template-columns:repeat(2,1fr); gap:16px; margin-top:8px; }
.cms-page .value{ border:1px solid #e8eaef; border-radius:10px; padding:20px 22px; }
.cms-page .value__t{
  font-size:16px; font-weight:700; color:#15213c; margin-bottom:6px;
  display:flex; align-items:center; gap:9px;
}
.cms-page .value__t svg{ width:20px; height:20px; color:#ee5a24; flex:0 0 auto; }
.cms-page .value__d{ font-size:14.5px; color:#41485a; line-height:1.8; }

.cms-page .license{ margin-top:8px; }
.cms-page .license__ph{
  width:100%; aspect-ratio:5/4; border:1px dashed #d6dae2; border-radius:12px;
  background:#f6f7f9; display:grid; place-items:center; color:#9aa1ae; font-size:14px;
}
.cms-page .license img{ width:100%; border-radius:12px; display:block; }
.cms-page .license figcaption{ font-size:13px; color:#767e8e; margin-top:12px; text-align:center; }

.cms-page .info-card{
  border:1px solid #e8eaef; border-radius:14px; overflow:hidden; position:sticky; top:96px;
}
.cms-page .info-card__head{ background:#1c2b4d; color:#fff; padding:20px 24px; }
.cms-page .info-card__head h3{ color:#fff; font-size:18px; font-weight:700; }
.cms-page .info-card__head p{ font-size:13px; color:rgba(255,255,255,.7); margin-top:4px; }
.cms-page .info-row{
  display:flex; gap:14px; padding:16px 24px; border-bottom:1px solid #f0f1f4; align-items:flex-start;
}
.cms-page .info-row:last-child{ border-bottom:0; }
.cms-page .info-row__ic{
  width:38px; height:38px; border-radius:10px; background:#fdeee7; color:#c8430f;
  display:grid; place-items:center; flex:0 0 auto;
}
.cms-page .info-row__ic svg{ width:18px; height:18px; }
.cms-page .info-row__body{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.cms-page .info-row__label{ font-size:12.5px; color:#767e8e; }
.cms-page .info-row__val{ font-size:15px; font-weight:600; color:#15213c; word-break:break-word; }
.cms-page .info-row__val.ltr{ direction:ltr; text-align:right; }

/* ── Contact page (ارتباط با ما, category 65) — form + map ─────────────── */
.cms-page .contact-layout{
  display:grid; grid-template-columns:1.15fr .85fr; gap:54px; align-items:start; padding:40px 0 8px;
}
/* Contact's sidebar holds the info-card AND the promo, so the card is NOT sticky
   here — a pinned card would overlap the promo scrolling up beneath it. The column
   scrolls as one piece. (The about page keeps sticky: its aside has only the card.) */
.cms-page .contact-layout .info-card{ position:static; }

.cms-page .form-card{
  background:#fff; border:1px solid #e8eaef; border-radius:16px; padding:30px 30px 34px;
}
.cms-page .form-card h2{ font-size:22px; color:#15213c; font-weight:700; margin-bottom:6px; }
.cms-page .form-card > p{ font-size:14.5px; color:#767e8e; margin-bottom:24px; }

.cms-page .contact-form .field{ display:flex; flex-direction:column; gap:7px; margin-bottom:18px; }
.cms-page .contact-form .field label{ font-size:14px; font-weight:600; color:#15213c; }
.cms-page .contact-form .row2{ display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.cms-page .contact-form input,
.cms-page .contact-form textarea,
.cms-page .contact-form select{
  font-family:inherit; font-size:15px; color:#15213c; width:100%;
  border:1px solid #e8eaef; border-radius:10px; padding:13px 15px; background:#fff;
  transition:.15s; resize:vertical;
}
.cms-page .contact-form input:focus,
.cms-page .contact-form textarea:focus,
.cms-page .contact-form select:focus{
  outline:none; border-color:#ee5a24; box-shadow:0 0 0 3px #fdeee7;
}
.cms-page .contact-form .btn--accent{
  margin-top:4px; display:inline-block; border:0; cursor:pointer;
  background:#ee5a24; color:#fff; font-size:15px; font-weight:600;
  border-radius:9px; padding:13px 26px; transition:background .15s;
}
.cms-page .contact-form .btn--accent:hover{ background:#c8430f; }
.cms-page .contact-status{ margin-top:16px; padding:12px 16px; border-radius:10px; font-size:14px; font-weight:600; background:#f6f7f9; color:#15213c; }
.cms-page .contact-status.is-ok{ background:#eaf6f0; color:#2f8f6b; }
.cms-page .contact-status.is-err{ background:#fdeaea; color:#d63b2a; }

.cms-page .map{
  aspect-ratio:16/7; border-radius:14px; overflow:hidden; border:1px solid #e8eaef; margin-top:30px;
  background:linear-gradient(135deg,#eef1f6,#e4e8f0);
  position:relative; display:grid; place-items:center;
}
.cms-page .map__pin{ display:flex; flex-direction:column; align-items:center; gap:8px; color:#1c2b4d; text-align:center; padding:0 16px; }
.cms-page .map__pin svg{ width:34px; height:34px; color:#ee5a24; }
.cms-page .map__pin span{ font-size:14px; font-weight:600; }

@media (max-width:820px){
  .cms-page .page-hero{ padding:30px 22px; }
  .cms-page .page-hero h1{ font-size:28px; }
  .cms-page .pg-layout,
  .cms-page .contact-layout{ grid-template-columns:1fr; gap:34px; padding-top:32px; }
  .cms-page .info-card{ position:static; }
  .cms-page .values,
  .cms-page .contact-form .row2{ grid-template-columns:1fr; }
}

@media print {
  .noprint {
    display: none !important;
  }
}
