/* --------------------------------------------------------------------------
   Hamed Sadeghi — personal academic website
   Design, code and content copyright (c) 2026 Hamed Sadeghi. All rights reserved.
   Original: http://sharif.edu/~hsadeghi/

   Not licensed for reuse, redistribution or derivative works without written
   permission. Reading this file is expected — it was sent to your browser so it
   could be used. Republishing it is not.

   build-id: hs-geotech-2026-6f3ad1
   -------------------------------------------------------------------------- */
/* =============================================================================
   farsi.css — the protected zone
   -----------------------------------------------------------------------------
   THIS FILE EXISTS TO STOP THE REST OF THE SITE FROM TOUCHING THE PERSIAN
   PUBLICATIONS. Read this header before editing anything in it.

   ── Why ─────────────────────────────────────────────────────────────────────
   The Persian publication list is set in BZar at sizes that were arrived at by
   eye and are considered final.  Everything else on the site is open to
   redesign.  Those two facts are in tension: the Persian block sits *inside*
   `.entry`, so any change to the article column's type scale would drag it
   along.

   The block used to inherit its size relatively:

       .entry  { font-size: 0.8125rem }        13px
       .rtl    { font-size: 1.1em     }        → 14.3px
       .rtl .pub__title { font-size: 1.2em }   → 17.16px

   Three multiplications deep.  Nudge `.entry` from 13px to 14px while
   modernising the design and every Persian line silently grows with it.

   ── How ─────────────────────────────────────────────────────────────────────
   This file pins the same computed values as ABSOLUTE rem, cutting the
   inheritance chain.  The numbers below are not new design decisions — each one
   is the measured computed value from before the redesign, converted at the
   16px root:

       14.3px  ÷ 16 = 0.89375rem
       17.16px ÷ 16 = 1.0725rem

   rem rather than px on purpose: the site scales its root font-size above
   1600px so the whole page grows on 4K/6K displays, and the Persian block
   should keep doing that exactly as it did before.  A px value would freeze it
   at 14.3px on a 6K screen while everything around it grew.

   ── Rules for future edits ──────────────────────────────────────────────────
   1. This file is loaded LAST, after every other stylesheet.  Keep it there.
   2. Nothing outside this file may set font-family, font-size, line-height,
      letter-spacing, word-spacing or direction on `.rtl` or anything inside it.
      If you need a Persian typography change, make it HERE.
   3. The `!important` flags are not laziness — they are the boundary.  They
      make the protection hold even if someone later writes a more specific
      selector elsewhere (`.entry .pubs .pub__title`, say).
   4. Colour, spacing, borders and backgrounds are deliberately NOT locked.
      Those follow the site theme, so the Persian block still switches to dark
      mode and still picks up the modernised card styling — it just keeps its
      own letterforms and measure.

   ── What counts as "Farsi" ──────────────────────────────────────────────────
   Two places, both marked in the markup rather than guessed at:
     • `.rtl`            — the Persian publications block. Emitted by
                           assets/js/pages/publications.js for any section in
                           data/publications.json with `"rtl": true`.
     • `.masthead__fa`   — «حامد صادقی» beside the site title.
   Add `"rtl": true` to a new section in the data file and it lands inside this
   protection automatically; nothing else needs changing.
   ========================================================================== */

/* -----------------------------------------------------------------------------
   1. Locked metrics
   The four values every rule below is built from.  If a Persian typography
   change is ever genuinely wanted, change it here and nowhere else.
   -------------------------------------------------------------------------- */
:root {
  --fa-font:        "BZar", "Segoe UI", Tahoma, Arial, Helvetica, Verdana, sans-serif;
  --fa-size-block:  0.89375rem;  /* 14.3px — the block's base size            */
  --fa-size-line:   1.0725rem;   /* 17.16px — title / authors / venue lines   */
  --fa-lh-block:    1.5;         /* 21.45px at the block size                 */
  --fa-lh-line:     1.385;       /* 23.77px at the line size                  */
}

/* -----------------------------------------------------------------------------
   2. The block itself
   -------------------------------------------------------------------------- */
.rtl {
  font-family: var(--fa-font) !important;
  font-size: var(--fa-size-block) !important;
  line-height: var(--fa-lh-block) !important;
  font-weight: normal !important;
  font-style: normal !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  text-transform: none !important;
  font-variant-numeric: normal !important;
  font-feature-settings: normal !important;
  direction: rtl !important;
  text-align: right !important;
}

/* Every descendant inherits the family — including any markup that arrives
   later inside a data file (a <b>, a nested <span class="ordinal">, a link). */
.rtl *,
.rtl *::before,
.rtl *::after {
  font-family: var(--fa-font) !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  font-feature-settings: normal !important;
  font-variant-numeric: normal !important;
}

/* The list itself keeps the block size; the three text lines step up. */
.rtl .pubs,
.rtl .pubs > li {
  font-size: var(--fa-size-block) !important;
}
.rtl .pubs { line-height: var(--fa-lh-block) !important; }
.rtl .pubs > li { line-height: var(--fa-lh-line) !important; }

.rtl .pub__title,
.rtl .pub__authors,
.rtl .pub__details {
  font-size: var(--fa-size-line) !important;
  line-height: var(--fa-lh-line) !important;
  text-align: justify !important;
}

/* Weight is pinned separately because it is the one property a redesign is most
   likely to touch site-wide.  The 2026 refresh moved Latin headings from 700 to
   600; without this rule the Persian titles would have followed.  They were 700
   and they stay 700. */
.rtl .pub__title,
.rtl .pub__title a { font-weight: 700 !important; }
.rtl .pub__authors,
.rtl .pub__details { font-weight: 400 !important; }

/* Links inside the block must not pick up a different face or size either. */
.rtl .pub__title a,
.rtl .pub__authors a,
.rtl .pub__details a {
  font-size: inherit !important;
  line-height: inherit !important;
}

/* Bold runs (the author's own name) keep BZar's weight, not a synthetic bold
   from a fallback face. */
.rtl b,
.rtl strong { font-weight: bold !important; }

/* Superscript ordinals inside Persian text — the one size that is deliberately
   smaller, exactly as it was. */
.rtl .ordinal {
  font-size: 0.7rem !important;
  vertical-align: super !important;
}

/* -----------------------------------------------------------------------------
   3. The masthead name
   Same font, its own size, unchanged from the original.
   -------------------------------------------------------------------------- */
.masthead__fa {
  font-family: var(--fa-font) !important;
  font-size: 0.75rem !important;   /* 12px */
  line-height: 1.5 !important;
  font-weight: normal !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  direction: rtl !important;
  /* The body sets an Inter stylistic set; it must not reach a Persian face. */
  font-feature-settings: normal !important;
  font-variant-numeric: normal !important;
}

/* -----------------------------------------------------------------------------
   4. Guardrails
   Two rules that catch mistakes rather than style anything.
   -------------------------------------------------------------------------- */

/* Any element that declares itself Persian gets the face, even if someone adds
   `lang="fa"` markup somewhere new and forgets the `.rtl` class. */
[lang="fa"] { font-family: var(--fa-font) !important; }

/* Narrow screens.  components.css turns justified text ragged-right below 34rem
   because short lines justify badly, and the Persian block has always followed
   that rule too.  It is restated here so the behaviour belongs to this file:
   change it here if it should ever differ, not in components.css. */
@media (max-width: 34rem) {
  .rtl .pub__title,
  .rtl .pub__authors,
  .rtl .pub__details { text-align: right !important; }
}
