/* mod_tasi3ahome 9.0.0 — « أربعة أبواب »
   A limewashed wall with four arched doors, as in the old streets of Tunis and Monastir.
   The figures of the maths lesson are drawn once, in ink: ○ ادخل  □ العب  △ شوف,
   and the fourth door, in gold, opens on the free books given for the soul of Bahija: ✧ اقرا.
   One file, no image, no script, no library. Loaded on the home page only. */

@font-face { font-family: "Amiri T3"; font-weight: 700; font-display: swap; src: url(../fonts/amiri-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Amiri T3"; font-weight: 400; font-display: swap; src: url(../fonts/amiri-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Amiri T3"; font-weight: 400; font-display: swap; src: url(../fonts/amiri-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Amiri T3"; font-weight: 700; font-display: swap; src: url(../fonts/amiri-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Tajawal T3"; font-weight: 500; font-display: swap; src: url(../fonts/tajawal-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Tajawal T3"; font-weight: 700; font-display: swap; src: url(../fonts/tajawal-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Tajawal T3"; font-weight: 500; font-display: swap; src: url(../fonts/tajawal-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Tajawal T3"; font-weight: 700; font-display: swap; src: url(../fonts/tajawal-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }

/* ------------------------------------------------------------------
   The template (tpl_tasi3a) on the home page: the notebook becomes a limewashed wall.
   ------------------------------------------------------------------ */
:root:has(body.tsa.is-home) { color-scheme: light; }
body.tsa.is-home {
  --t-brand: #1b3a68;
  --t-brand-ink: #1b3a68;
  --t-bg: #f4f5f1;
  --t-surface: #fbfbf9;
  --t-ink: #17223d;
  --t-ink-2: #4b5571;
  --t-line: #dcdfd6;
  --t-line-strong: #c6cabe;
  --t-brand-soft: #e6eaf2;
  --t-shadow: 0 1px 2px rgb(23 34 61 / .06), 0 10px 26px -14px rgb(23 34 61 / .25);
  background: #f4f5f1;
  background-image: none;
}
body.tsa.is-home .tsa-main { padding-bottom: 0; }
body.tsa.is-home .tsa-footer { border-top: 1px solid var(--t-line); }

/* ------------------------------------------------------------------ the wall */
.t3x {
  --paper: #f4f5f1;
  --door: #fbfbf9;
  --ink: #17223d;
  --ink-2: #4b5571;
  --ink-3: #6f7690;
  --line: #d3d6cc;
  --navy: #1b3a68;
  --gold: #a07e3c;
  --gold-ink: #7b5e25;
  --serif: "Amiri T3", "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --sans: "Tajawal T3", "Tajawal", "Segoe UI", Tahoma, system-ui, sans-serif;
  --math: "Amiri T3", "Cambria Math", Cambria, "Times New Roman", serif;
  position: relative;
  max-width: 1240px;
  margin-inline: auto;
  padding: clamp(1.6rem, 1rem + 3vw, 3.6rem) clamp(1rem, .5rem + 2.5vw, 2.5rem) clamp(2.6rem, 2rem + 3vw, 4.5rem);
  font-family: var(--sans);
  color: var(--ink);
}
.t3x *, .t3x *::before, .t3x *::after { box-sizing: border-box; }
:where(.t3x) :where(h1, h2, p) { margin: 0; }
.t3x a { text-decoration: none; }
body:not(.tsa.is-home) .t3x { background: var(--paper); border-radius: 6px; }
.t3x-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.t3x-head { margin-bottom: clamp(1.6rem, 1.2rem + 1.8vw, 2.8rem); text-align: center; }
.t3x-head h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.25rem + 2vw, 2.7rem);
  line-height: 1.6;
  color: var(--ink);
  text-wrap: balance;
}

/* ------------------------------------------------------------------ the four doors */
.t3x-doors {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.9rem, .5rem + 1.4vw, 1.8rem);
}
.t3x-door {
  --c: var(--ink);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(1.1rem, .8rem + 1vw, 1.6rem) clamp(1rem, .7rem + .9vw, 1.5rem) clamp(1.2rem, 1rem + .6vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: 999px 999px 4px 4px;    /* scaled down by the browser: a perfect half circle on top */
  background: var(--door);
  transition: border-color .25s, box-shadow .3s, transform .3s cubic-bezier(.2, .8, .2, 1);
}
.t3x-door::before {                       /* the inner reveal of the arch, one line inside */
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid transparent;
  border-radius: inherit;
  pointer-events: none;
  transition: border-color .25s;
}
.t3x-door.is-book { --c: var(--gold-ink); border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.t3x-door.is-book::before { border-color: color-mix(in srgb, var(--gold) 30%, transparent); }

.t3x-door:hover, .t3x-door:focus-within {
  border-color: var(--ink);
  box-shadow: 0 18px 36px -24px rgb(23 34 61 / .45);
  transform: translateY(-3px);
}
.t3x-door.is-book:hover, .t3x-door.is-book:focus-within { border-color: var(--gold); }
.t3x-door:hover::before, .t3x-door:focus-within::before { border-color: var(--line); }
.t3x-door.is-book:hover::before, .t3x-door.is-book:focus-within::before { border-color: color-mix(in srgb, var(--gold) 50%, transparent); }

.t3x-arch { display: grid; place-items: center; padding-top: clamp(.6rem, .3rem + 1vw, 1.4rem); }
.t3x-fig { display: block; width: min(78%, 210px); height: auto; overflow: visible; }

/* the ink */
.t3x-ln { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.t3x-ln.is-faint { stroke: var(--ink-3); stroke-width: 1; opacity: .6; }
.t3x-ln.is-gold { stroke: var(--gold); stroke-width: 1.4; }
.t3x-pt { fill: var(--ink); }
.t3x-tx { font: italic 400 15px/1 var(--math); fill: var(--ink-2); }
.t3x-me { font: 700 24px/1 var(--sans); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.t3x-me-disc { fill: var(--door); stroke: var(--ink); stroke-width: 1.2; }

/* drawn once when the page opens: the doors one after the other, right to left */
.t3x-ln.is-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: t3x-draw 1.5s cubic-bezier(.5, 0, .2, 1) both; animation-delay: var(--d, 0s); }
.t3x .is-late { animation: t3x-in .6s ease-out both; animation-delay: calc(var(--d, 0s) + 1.1s); }
.t3x-door.is-circle   { --d: .05s; }
.t3x-door.is-cube     { --d: .3s; }
.t3x-door.is-triangle { --d: .55s; }
.t3x-door.is-book     { --d: .8s; }
@keyframes t3x-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes t3x-in { from { opacity: 0; } }
.t3x-ln.is-faint.is-late { animation-name: t3x-in-faint; }
@keyframes t3x-in-faint { from { opacity: 0; } to { opacity: .6; } }

/* the words */
.t3x-copy { display: flex; flex-direction: column; flex: 1; margin-top: clamp(.6rem, .4rem + .6vw, 1rem); text-align: center; }
.t3x-copy h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 1.5rem + 1.8vw, 2.9rem);
  line-height: 1.5;
}
.t3x-link { color: var(--c) !important; }
.t3x-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }  /* the whole door is the link */
.t3x-link:focus-visible { outline: none; }
.t3x-door:has(.t3x-link:focus-visible) { outline: 2px solid var(--navy); outline-offset: 4px; }
.t3x-copy > p:not(.t3x-plate) { margin-top: .2rem; font-size: 1rem; line-height: 1.75; color: var(--ink-2); text-wrap: balance; }

.t3x-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  margin-top: auto;
  padding-top: 1.1rem;
}
.t3x-go {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: .45rem 1.2rem;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font: 700 .98rem/1.2 var(--sans);
  transition: background-color .2s;
}
.t3x-door:hover .t3x-go { background: var(--navy); }
.t3x-door.is-book .t3x-go { background: transparent; color: var(--gold-ink); box-shadow: inset 0 0 0 1px var(--gold); }
.t3x-door.is-book:hover .t3x-go { background: var(--gold-ink); color: #fff; box-shadow: none; }
.t3x-soc {
  position: relative;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
}
.t3x-soc:hover { border-color: var(--ink); }
.t3x-soc:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.t3x-soc svg { width: 20px; height: 20px; }

.t3x-plate { margin-top: .8rem; min-height: 1.5em; font-size: .88rem; color: var(--ink-3); }
.t3x-plate a { position: relative; z-index: 2; color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .3em; }
.t3x-plate a:hover { text-decoration-color: var(--ink); }
.t3x-plate a:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 2px; }
.t3x-door.is-book .t3x-plate { font-family: var(--serif); font-size: 1.05rem; color: var(--gold-ink); }
.t3x-plate bdi { font-family: var(--math); font-style: italic; }

/* ------------------------------------------------------------------ tablet: two by two */
@media (max-width: 980px) {
  .t3x-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; margin-inline: auto; }
}

/* ------------------------------------------------------------------ phone: the doors lie down, one under the other */
@media (max-width: 560px) {
  .t3x-head { margin-bottom: 1.2rem; }
  .t3x-doors { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .t3x-door {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: .9rem;
    padding: .8rem .9rem;
    border-radius: 4px;
  }
  .t3x-door::before { display: none; }
  .t3x-arch {
    padding: 8px 6px 4px;
    border: 1px solid var(--line);
    border-radius: 999px 999px 3px 3px;
    background: var(--paper);
  }
  .t3x-door.is-book .t3x-arch { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
  .t3x-fig { width: 100%; }
  .t3x-copy { margin: 0; text-align: start; }
  .t3x-copy h2 { font-size: 1.75rem; line-height: 1.35; }
  .t3x-copy > p:not(.t3x-plate) { font-size: .92rem; line-height: 1.6; text-wrap: pretty; }
  .t3x-foot { justify-content: flex-start; padding-top: .55rem; gap: .45rem; }
  .t3x-go { min-height: 38px; padding: .35rem .9rem; font-size: .9rem; }
  .t3x-soc { width: 38px; height: 38px; }
  .t3x-plate { margin-top: .35rem; font-size: .82rem; }
  .t3x-plate:empty, .t3x-door.is-cube .t3x-plate, .t3x-door.is-triangle .t3x-plate { display: none; }
  .t3x-door:hover, .t3x-door:focus-within { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .t3x-ln.is-draw, .t3x .is-late { animation: none; }
  .t3x-door { transition: border-color .2s; }
  .t3x-door:hover, .t3x-door:focus-within { transform: none; }
}
