/* ebadollah.ir shell: one bar over the sites (قرآن، جلسات، دانشنامه، کتابخانه، پژوهش), each shown in its own frame.
   Colours follow the wiki's (Shangarf: paper, navy-slate ink, gold hairlines; one pigment per site). */
@font-face { font-family: "VazirDigits"; src: url(fonts/Vazir-Regular-FD.woff2) format("woff2"); unicode-range: U+0030-0039; font-display: swap; }
@font-face { font-family: "Estedad"; font-weight: 400; src: url(fonts/Estedad-Regular.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Estedad"; font-weight: 500; src: url(fonts/Estedad-Medium.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Estedad"; font-weight: 700; src: url(fonts/Estedad-Bold.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Estedad"; font-weight: 800; src: url(fonts/Estedad-ExtraBold.woff2) format("woff2"); font-display: swap; }

:root {
  color-scheme: light;
  --paper: #FBF6EC; --paper-deep: #F3EAD8; --paper-high: #FFFCF4;
  --ink: #2B3148; --ink-soft: #5A6079; --ink-faint: #666878;
  --line: rgba(176,132,52,.30); --line-strong: rgba(176,132,52,.52);
  --zar: #B08434; --zar-line: #CAA052;
  --shadow: 0 1px 2px rgba(38,33,25,.05), 0 8px 28px -12px rgba(38,33,25,.14);
  --focus: #2F5391;
  --bar: 50px;
  --ff: "VazirDigits", "Estedad", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  /* one pigment per site: deep (text), tint (border), wash (ground) */
  --quran: #00556C;   --quran-tint: #94C3C8;   --quran-wash: #D1E4E1;
  --sessions: #214981; --sessions-tint: #B3BED0; --sessions-wash: #DEE1E5;
  --wiki: #7C2E41;    --wiki-tint: #D6B4B6;    --wiki-wash: #EDDDD9;
  --library: #63420F; --library-tint: #CCBBA2; --library-wash: #E9E0D1;
  --research: #235323; --research-tint: #B1C2A9; --research-wash: #DEE3D4;
}
:root[data-theme="sepia"] {
  --paper: #F4E9D2; --paper-deep: #E9DBBE; --paper-high: #FAF2E1;
  --ink: #2A3044; --ink-soft: #565C74;
  --line: rgba(150,110,40,.34); --line-strong: rgba(150,110,40,.56);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #131722; --paper-deep: #0F131C; --paper-high: #1A1F2C;
  --ink: #E6E4DC; --ink-soft: #AFB3C2; --ink-faint: #8D93A7;
  --line: rgba(202,160,82,.26); --line-strong: rgba(202,160,82,.44);
  --zar: #CAA052; --zar-line: #8A6B2A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  --focus: #8FB0E8;
  --quran: #7CC7CF;   --quran-tint: #2C5A61;   --quran-wash: #16292D;
  --sessions: #9DB4E0; --sessions-tint: #34476B; --sessions-wash: #182133;
  --wiki: #E0A3B0;    --wiki-tint: #6A3442;    --wiki-wash: #2A1A20;
  --library: #D9B98A; --library-tint: #5E4A2C; --library-wash: #261F15;
  --research: #9FCB97; --research-tint: #3A5A36; --research-wash: #18241A;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 400 15px/1.8 var(--ff); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the bar ---- */
.ebar { position: relative; z-index: 50; height: var(--bar); display: flex; align-items: center; gap: 10px; padding-inline: 14px;
  background: var(--paper-high); border-bottom: 1px solid var(--line-strong); }
.ebar .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16.5px; white-space: nowrap; padding: 4px 6px; border-radius: 9px; }
.ebar .brand img { width: 28px; height: 28px; border-radius: 7px; }
.ebar .brand:hover { color: var(--zar); }
.sites { display: flex; align-items: center; gap: 2px; min-width: 0; height: 100%; overflow-x: auto; scrollbar-width: none; }
.sites::-webkit-scrollbar { display: none; }
.sites a.site { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px; font-size: 14.5px; font-weight: 500;
  color: var(--ink-soft); white-space: nowrap; border: 1px solid transparent; flex: none; height: 38px; }
.sites a.site .ic { width: 18px; height: 18px; color: var(--c); }
.sites a.site:hover { background: var(--paper-deep); color: var(--ink); }
.sites a.site[aria-current] { color: var(--c); background: var(--w); border-color: var(--t); font-weight: 700; }
/* the open site's sections ride on its tab: one tinted run, tab + sections */
.sites a.site[aria-current]:has(+ .secs) { border-start-end-radius: 0; border-end-end-radius: 0; border-inline-end-color: transparent; }
.secs { display: flex; align-items: center; gap: 1px; padding: 2px 4px; margin-inline-end: 6px; flex: none;
  border: 1px solid var(--t); border-inline-start: 0; border-radius: 0 9px 9px 0; background: color-mix(in srgb, var(--w) 45%, transparent); height: 38px; }
[dir="rtl"] .secs { border-radius: 9px 0 0 9px; }
.secs .sec { display: flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 7px; border: 0; background: none; font: inherit; font-size: 13.5px;
  color: var(--ink-soft); white-space: nowrap; cursor: pointer; }
.secs .sec .ic { width: 16px; height: 16px; }
.secs .sec .chev { width: 13px; height: 13px; margin-inline-start: -2px; }
.secs .sec:hover { background: var(--paper-high); color: var(--ink); }
.secs .sec[aria-current] { color: var(--c); background: var(--paper-high); font-weight: 700; box-shadow: 0 0 0 1px var(--t); }
.tight .sites a.site:not([aria-current]) span { display: none; }
.tight .sites a.site:not([aria-current]) { padding-inline: 9px; }
.compact .secs .sec span { display: none; }
.compact .secs .sec[aria-current] span { display: inline; }
.compact .secs .sec { padding: 4px 7px; }
.secmenu { position: fixed; z-index: 60; min-width: 200px; max-height: 70vh; overflow: auto; padding: 6px; border-radius: 12px;
  background: var(--paper-high); border: 1px solid var(--line-strong); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1px; }
.secmenu[hidden] { display: none; }
.secmenu .sec { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 14px; color: var(--ink-soft); }
.secmenu .sec .ic { width: 17px; height: 17px; }
.secmenu .sec:hover { background: var(--paper-deep); color: var(--ink); }
.secmenu .sec[aria-current] { color: var(--c); font-weight: 700; }
/* the open site's tools: info, buttons, search (stand-ins; the site runs the real control) */
.stools { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; min-width: 0; flex: none; }
.stools:empty { display: none; }
.stools .info { font-size: 13px; color: var(--ink-faint); white-space: nowrap; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
.stools .tool { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--t, var(--line)); background: var(--paper-high);
  font-size: 13.5px; color: var(--ink); white-space: nowrap; max-width: 15rem; }
.stools .tool span { overflow: hidden; text-overflow: ellipsis; }
.stools .tool .ic { width: 17px; height: 17px; color: var(--c, var(--ink-soft)); }
.stools .tool:hover { background: var(--w, var(--paper-deep)); }
.stools .tool .count { font-size: 11px; background: var(--c); color: var(--paper-high); border-radius: 999px; padding: 0 6px; }
.ssearch { display: flex; align-items: center; gap: 6px; height: 36px; width: 15rem; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); }
.ssearch .ic { width: 16px; height: 16px; color: var(--ink-faint); }
.ssearch input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--ink); outline: none; }
.ssearch:focus-within { border-color: var(--zar); box-shadow: 0 0 0 3px color-mix(in srgb, var(--zar-line) 25%, transparent); }
.small .stools .info { display: none; }
.small .stools .tool:not(.wide) span { display: none; }
.small .stools .tool { padding: 0 10px; }
.small .ssearch { width: 10rem; }
.etools { margin-inline-start: 6px; display: flex; gap: 4px; align-items: center; }
.tbtn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 0; background: none; color: var(--ink-soft); }
.tbtn:hover { background: var(--paper-deep); color: var(--ink); }
.s-quran { --c: var(--quran); --t: var(--quran-tint); --w: var(--quran-wash); }
.s-sessions { --c: var(--sessions); --t: var(--sessions-tint); --w: var(--sessions-wash); }
.s-wiki { --c: var(--wiki); --t: var(--wiki-tint); --w: var(--wiki-wash); }
.s-library { --c: var(--library); --t: var(--library-tint); --w: var(--library-wash); }
.s-research { --c: var(--research); --t: var(--research-tint); --w: var(--research-wash); }

/* ---- ⚙ settings ---- */
.setmenu { position: fixed; z-index: 60; top: calc(var(--bar) + 4px); left: 10px; width: min(18rem, calc(100vw - 20px)); padding: 10px; border-radius: 14px;
  background: var(--paper-high); border: 1px solid var(--line-strong); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.setmenu[hidden] { display: none; }
.setmenu .set-h { font-size: 12px; font-weight: 700; color: var(--ink-faint); margin: 6px 4px 2px; }
.setmenu .seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--paper-deep); }
.setmenu .seg button { flex: 1; border: 0; background: none; padding: 6px 0; border-radius: 8px; font-size: 13.5px; color: var(--ink-soft); }
.setmenu .seg button[aria-checked="true"] { background: var(--paper-high); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.setmenu .set-item { display: block; text-align: start; border: 0; background: none; padding: 7px 8px; border-radius: 8px; font-size: 14px; color: var(--ink); }
.setmenu .set-item:hover { background: var(--paper-deep); }
.setmenu .set-note { font-size: 12.5px; color: var(--ink-soft); padding: 2px 8px; }
.setmenu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0 2px; width: 100%; }

/* ---- frames: one per visited site, kept alive so switching back keeps its place ---- */
.frames { position: fixed; inset: var(--bar) 0 0 0; }
.frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--paper); }
.frames iframe[hidden] { display: none; }
.frames .loadbar { position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, transparent, var(--zar-line), transparent);
  background-size: 40% 100%; background-repeat: no-repeat; animation: slide 1.1s linear infinite; z-index: 2; }
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@media (prefers-reduced-motion: reduce) { .frames .loadbar { animation: none; background: var(--zar-line); opacity: .5; } }

.stuck { position: absolute; z-index: 3; inset: 12px 12px auto 12px; max-width: 640px; margin-inline: auto; display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 12px; background: var(--paper-high); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 14px; }
.stuck[hidden] { display: none; }
.stuck a { color: var(--sessions); font-weight: 700; border-bottom: 1px solid var(--sessions-tint); }
.stuck .tbtn { margin-inline-start: auto; width: 32px; height: 32px; }

/* ---- home: cards ---- */
.home { max-width: 1080px; margin: 0 auto; padding: 34px 16px 48px; }
.home[hidden] { display: none; }
.hello { text-align: center; margin: 0 0 26px; }
.hello h1 { margin: 0; font-size: clamp(26px, 4.6vw, 36px); font-weight: 800; letter-spacing: 0; }
.hello p { margin: 4px 0 0; color: var(--ink-soft); }
.orn { display: block; margin: 10px auto 0; width: 120px; height: 10px; color: var(--zar-line); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 18px; border-radius: 16px;
  background: var(--paper-high); border: 1px solid var(--line); box-shadow: var(--shadow); border-top: 4px solid var(--c);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--t); border-top-color: var(--c); }
.card.wide { grid-column: 1 / -1; padding: 28px 30px 22px; background: linear-gradient(160deg, var(--w), var(--paper-high) 70%); }
.card .head { display: flex; align-items: center; gap: 12px; }
.card .badge { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--w); color: var(--c); border: 1px solid var(--t); flex: none; }
.card .badge .ic { width: 26px; height: 26px; }
.card.wide .badge { width: 58px; height: 58px; }
.card.wide .badge .ic { width: 32px; height: 32px; }
.card h2 { margin: 0; font-size: 21px; font-weight: 800; color: var(--c); }
.card.wide h2 { font-size: 26px; }
.card .sub { margin: 0; font-size: 13px; color: var(--ink-faint); }
.card .desc { margin: 0; color: var(--ink-soft); font-size: 14.5px; }
.card .main { position: static; }
.card .main::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* the whole card opens the site */
.card .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.card .chips a { position: relative; z-index: 1; font-size: 13px; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--t); color: var(--c); background: var(--paper-high); }
.card .chips a:hover { background: var(--w); }
.foot { margin-top: 28px; text-align: center; font-size: 13px; color: var(--ink-faint); }
.foot a { color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.foot a:hover { color: var(--zar); }
.pub .cards { grid-template-columns: repeat(2, 1fr); }
.pub .card.wide { grid-column: auto; }

@media (max-width: 820px) {
  .cards, .pub .cards { grid-template-columns: 1fr; }
  .card.wide { padding: 22px; }
}
@media (max-width: 760px) {
  .ebar { gap: 4px; padding-inline: 8px; }
  .ebar .brand span { display: none; }
  .sites a.site { padding: 6px 9px; }
}
@media (max-width: 640px) {
  .stools { gap: 4px; }
  .stools .info { display: none; }
  .stools .tool span { display: none; }
  .stools .tool { padding: 0 10px; }
  .ssearch:not(.open) { width: 38px; padding: 0; justify-content: center; cursor: pointer; }
  .ssearch:not(.open) input { display: none; }
  .ssearch.open { position: absolute; inset-inline: 8px; top: 6px; width: auto; z-index: 3; background: var(--paper-high); }
}
@media (max-width: 520px) {
  .sites a.site span { display: none; }
  .sites a.site[aria-current] span, [data-eb="pub"] .sites a.site span { display: inline; }
}
