﻿/* ============================================================
   ط­ط§ط¦ط· ط§ظ„ظ‚طµط§ط¦ط¯ â€” Wall of Poems
   Design system + RTL/LTR
   ============================================================ */

:root {
  --bg: #fbf3dc;
  --bg-2: #f6ebcd;
  --card: rgba(255, 253, 246, .72);
  --card-2: rgba(255, 253, 246, .95);
  --card-border: #dcc493;
  --color-text: #1f1a12;
  --muted: #7c6a4a;
  --accent: #a96030;
  --accent-100: #e8d5b5;
  --accent-2: #a96030;
  --accent-3: #a96030;
  --grad: #a96030;
  --gold: #a96030;
  --danger: #b3402c;
  --success: #3f7d4e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 45px rgba(120, 90, 40, .18);
  --font: 'Figtree', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-heading: 'Caprasimo', 'Lalezar', system-ui, sans-serif;
  --font-poem: 'Amiri', serif;
  --font-arabic: 'Figtree', 'IBM Plex Sans Arabic', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  color: var(--color-text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip;
  background: var(--bg);
}

[dir="rtl"] body { font-family: var(--font-arabic); }

h1, h2, h3, h4, .logo, .section-head h2, .poet-card .who .name, .poem-modal .p-title { font-family: var(--font-heading); font-weight: 400; }

::selection { background: var(--accent); color: #fff8e8; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.container { width: min(1200px, 92vw); margin-inline: auto; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(169, 96, 48, .35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Header ---------- */
header {
  position: sticky; top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}
.nav-wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 12px 0; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; white-space: nowrap; }
.logo .ic {
  width: 42px; height: 42px; border-radius: 13px; background: var(--grad);
  display: grid; place-items: center; font-size: 1.3rem; color: #fff8e8;
}
.logo small { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

nav.main-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
nav.main-nav a {
  padding: 8px 14px; border-radius: 99px; font-weight: 600; font-size: .92rem;
  color: var(--muted); transition: .2s; white-space: nowrap;
}
nav.main-nav a:hover, nav.main-nav a.active { background: var(--card-2); color: var(--color-text); }

.lang-switcher { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.lang-btn {
  border: none; background: var(--card);
  color: var(--color-text); border-radius: 10px; padding: 4px 10px;
  font-size: .82rem; font-weight: 700; transition: .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.lang-btn .l-short {
  font-weight: 800; color: var(--accent);
  border-inline-end: 1px solid var(--card-border); padding-inline-end: 6px;
}
.lang-btn:hover { transform: translateY(-1px); background: var(--card-2); }
.lang-btn.active { background: var(--grad); color: #fff8e8; }
.lang-btn.active .l-short { color: #fff8e8; border-inline-end-color: rgba(255,255,255,.35); }

.auth-btns { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 44px; padding: 10px 18px;
  font-weight: 600; font-size: 14.5px; transition: .22s; white-space: nowrap;
  min-height: 44px;
}
.btn-primary { background: #b0704a; color: #fff8e8; }
.btn-primary:hover { background: #9c5f3c; }
.btn-daily {
  background: #b0704a; color: #fff8e8;
  border-radius: 44px;
  padding: clamp(26px, 4vw, 52px); padding-inline: 20px;
  margin-top: 26px;
  font-family: 'IBM Plex Sans Arabic', 'Figtree', sans-serif;
  font-size: 14.5px; font-weight: 600;
  min-height: 44px;
}
.btn-daily:hover { background: #9c5f3c; }
.btn-ghost { background: transparent; color: #a96030; }
.btn-ghost:hover { background: rgba(169, 96, 48, .1); color: #8a4f28; }
.btn-outline { background: transparent; color: #a96030; }
.btn-outline:hover { background: #a96030; color: #fff8e8; }
.btn-danger { background: rgba(179, 64, 44, .1); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff8e8; }
.btn-sm { padding: 7px 13px; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  position: relative; text-align: center; padding: 90px 0 70px;
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
}
.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 4rem); line-height: 1.15;
  margin-bottom: 18px;
}
.hero h1 .grad-text {
  color: var(--accent);
}
.hero p.sub { max-width: 700px; margin: 0 auto 30px; color: var(--muted); font-size: 1.1rem; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 30px; justify-content: center; flex-wrap: wrap; margin-top: 46px;
}
.hero-stats .stat { text-align: center; }
.hero-stats .stat b { display: block; font-size: 1.9rem; color: var(--gold); }
.hero-stats .stat span { color: var(--muted); font-size: .9rem; }

/* ---------- Section headers ---------- */
section { padding: 60px 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head .eyebrow {
  display: inline-block; padding: 5px 14px; border-radius: 99px;
  background: rgba(169, 96, 48, .12); color: var(--accent);
  font-size: .8rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 12px;
}
.section-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.5rem); margin-bottom: 10px; }
.section-head p { color: var(--muted); max-width: 640px; margin-inline: auto; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-direction: column; gap: 14px; margin-bottom: 34px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.search-input {
  background: var(--card); color: var(--color-text);
  border-radius: 99px; padding: 11px 20px; min-width: 240px; outline: none; transition: .2s;
  border: none;
}
.search-input:focus { box-shadow: 0 0 0 4px rgba(169, 96, 48, .16); }
.chip {
  background: var(--card); color: var(--muted);
  border-radius: 99px; padding: 8px 16px; font-weight: 600; font-size: .88rem; transition: .2s;
  border: none; cursor: pointer; font-family: inherit;
}
.chip:hover { color: var(--color-text); background: var(--card-2); }
.chip.active { background: var(--grad); color: #fff8e8; font-weight: 700; }
select.country-select {
  background: var(--card); color: var(--color-text);
  border-radius: 12px; padding: 10px 14px; outline: none; max-width: 260px;
  border: none;
}
select.country-select option { background: var(--bg-2); color: var(--color-text); }

/* ---------- Language & country walls ---------- */
.walls-langs, .walls-countries { margin-bottom: 26px; }
.walls-group-title {
  font-family: var(--font-heading); font-size: 1.05rem; margin-bottom: 10px;
  color: var(--accent-2);
}
#langWallChips, #countryWallChips { justify-content: flex-start; gap: 8px; }

/* ---------- Poet grid / wall ---------- */
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.poet-card {
  background: var(--card); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 12px; position: relative;
  transition: .25s; overflow: hidden;
}
.poet-card::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: .25s;
  background: radial-gradient(400px 200px at 80% 0%, rgba(169, 96, 48, .06), transparent 70%);
  pointer-events: none;
}
.poet-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.poet-card:hover::after { opacity: 1; }
.poet-card .top { display: flex; align-items: center; gap: 12px; }
.poet-card .flag {
  width: 46px; height: 34px; border-radius: 8px; overflow: hidden;
  display: grid; place-items: center; background: var(--card-2); font-size: 1.6rem; flex-shrink: 0;
}
.poet-card .who { min-width: 0; }
.poet-card .who .name { font-size: 1.05rem; }
.poet-card .who .native { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poet-card .who .own { color: var(--muted); font-size: .78rem; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; }
.poet-card .country-line { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; flex-wrap: wrap; }
.poet-card .country-line .reg { background: var(--card-2); padding: 2px 9px; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.poet-card .excerpt {
  background: var(--bg-2);
  border-radius: 10px; padding: 12px 14px; font-size: 1.02rem;
  font-family: var(--font-poem); color: #3f372c; line-height: 1.8; flex: 1;
  max-height: 150px; overflow: hidden; position: relative;
}
.poet-card .excerpt[dir="rtl"] { text-align: right; }
.poet-card .excerpt[dir="ltr"] { text-align: left; }
.poet-card .actions { display: flex; gap: 8px; }

.count-result { text-align: center; color: var(--muted); margin-bottom: 20px; font-size: .95rem; }
.count-result b { color: var(--gold); }

/* ---------- Great poets (gallery) ---------- */
.great-scroll { display: flex; gap: 18px; overflow-x: auto; padding: 10px 4px 24px; scroll-snap-type: x mandatory; }
.great-card {
  scroll-snap-align: start; flex: 0 0 200px; text-align: center;
  background: var(--card); border-radius: var(--radius);
  padding: 20px 14px; transition: .25s; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.great-card:hover { transform: translateY(-5px); }
.great-card .g-img {
  width: 92px; height: 92px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent);
  background: var(--bg-2); display: grid; place-items: center; font-size: 2rem; color: var(--gold);
}
.great-card .g-name { font-family: var(--font-heading); }
.great-card .g-native { color: var(--muted); font-size: .8rem; }
.great-card .g-own { color: var(--muted); font-size: .75rem; opacity: .8; direction: ltr; text-align: left; }
.great-card .g-bio { color: var(--muted); font-size: .8rem; line-height: 1.5; }

/* ---------- Share sections ---------- */
.share-box { background: var(--card); border-radius: var(--radius); padding: 26px; }
.share-box h3 { margin-bottom: 6px; }
.share-box p { color: var(--muted); margin-bottom: 18px; font-size: .95rem; }
.quill-icon {
  filter: drop-shadow(0 4px 6px rgba(109, 63, 28, 0.28));
  display: inline-block;
  vertical-align: middle;
}
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.share-btn {
  display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: 12px;
  background: var(--card-2); color: var(--color-text);
  font-weight: 700; font-size: .9rem; transition: .2s;
  border: none; cursor: pointer; font-family: inherit; text-align: center;
}
.share-btn:hover { transform: translateY(-3px); }
.share-btn .s-ic {
  font-size: 1.25rem;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  color: #a96030; background: rgba(169, 96, 48, .12);
}
.copy-line { display: flex; gap: 8px; margin-top: 16px; }
.copy-line input { flex: 1; background: var(--bg-2); color: var(--color-text); border-radius: 10px; padding: 11px 14px; outline: none; }

/* ---------- Editor ---------- */
.editor-wrap { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.toolbar {
  display: flex; gap: 4px; flex-wrap: wrap; padding: 10px;
  background: var(--bg-2);
}
.toolbar button, .toolbar select {
  background: var(--card); color: var(--color-text);
  border-radius: 8px; min-width: 34px; height: 34px; padding: 0 8px; font-size: .9rem; transition: .15s;
}
.toolbar button:hover { background: var(--card-2); }
.toolbar .sep { width: 1px; background: var(--card-border); margin: 0 4px; }
.editor-body { padding: 18px; }
.editor-body input[type="text"] {
  width: 100%; background: transparent; border: none; border-bottom: 1px dashed var(--card-border);
  color: var(--color-text); font-family: var(--font-heading); font-size: 1.4rem; padding: 10px 4px; margin-bottom: 14px; outline: none;
}
.editor-body input[type="text"]:focus { border-bottom-color: var(--accent); }
.editor-textarea {
  min-height: 240px; background: transparent; border: none; color: var(--color-text);
  font-family: var(--font-poem); font-size: 1.1rem; line-height: 1.9; width: 100%; padding: 6px 4px; outline: none; resize: vertical;
}
[dir="rtl"] .editor-textarea { text-align: right; }
.editor-preview { display: none; min-height: 240px; padding: 6px 4px; font-size: 1.05rem; line-height: 1.9; white-space: pre-wrap; }
.img-upload { margin-top: 14px; }
.img-upload .up-btn {
  display: inline-flex; align-items: center; gap: 8px; background: var(--card-2);
  border-radius: 12px; padding: 10px 16px; color: var(--muted);
  font-weight: 600; cursor: pointer; transition: .2s;
}
.img-upload .up-btn:hover { color: var(--color-text); }
.img-preview { margin-top: 12px; position: relative; display: none; width: fit-content; }
.img-preview img { border-radius: 12px; max-height: 260px; }
.img-preview .rm-img {
  position: absolute; top: 8px; inset-inline-end: 8px; background: rgba(169, 96, 48, .9);
  color: #fff8e8; border-radius: 50%;
  width: 30px; height: 30px; font-weight: 800;
}
.editor-actions { display: flex; gap: 10px; padding: 14px 18px; flex-wrap: wrap; }

/* ---------- Auth modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  background: rgba(60, 45, 25, .55); backdrop-filter: blur(6px); padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
  width: min(460px, 100%); background: var(--bg-2); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); max-height: 92vh; overflow-y: auto;
}
.modal-card h3 { margin-bottom: 18px; font-size: 1.3rem; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 6px; color: var(--muted); }
.field input {
  width: 100%; background: var(--card); color: var(--color-text);
  border-radius: 11px; padding: 12px 14px; outline: none; transition: .2s;
}
.field input:focus { box-shadow: 0 0 0 4px rgba(169, 96, 48, .16); }
.auth-switch { margin-top: 14px; font-size: .88rem; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--accent); font-weight: 700; cursor: pointer; }
.modal-close {
  position: absolute; top: 12px; inset-inline-end: 12px; background: none; border: none;
  color: var(--muted); font-size: 1.4rem;
}
.modal-close:hover { color: var(--color-text); }
.msg { display: none; padding: 11px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 14px; }
.msg.error { display: block; background: rgba(179, 64, 44, .1); color: var(--danger); }
.msg.success { display: block; background: rgba(63, 125, 78, .12); color: var(--success); }

/* ---------- Info pages ---------- */
#infoModal .modal-card { width: min(640px, 100%); }
.info-page { text-align: center; }
.info-page-icon {
  width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%;
  background: rgba(169, 96, 48, .12); color: #a96030;
  display: flex; align-items: center; justify-content: center;
}
.info-page h3 { margin-bottom: 14px; font-size: 1.45rem; }
.info-page-body { text-align: start; color: var(--muted); font-size: 1rem; line-height: 1.9; }
.info-page-body p { margin-bottom: 12px; }
.info-page-body p:last-child { margin-bottom: 0; }

/* ---------- Member area ---------- */
.member-badge { display: inline-flex; align-items: center; gap: 7px; }
.member-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); }

/* ---------- Toasts ---------- */
#toast {
  position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--bg-2); color: var(--color-text);
  padding: 13px 22px; border-radius: 99px; box-shadow: var(--shadow); z-index: 120;
  transition: .35s; font-weight: 600; font-size: .92rem; max-width: 90vw; text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); }
[dir="rtl"] #toast { transform: translateX(50%) translateY(120px); }
[dir="rtl"] #toast.show { transform: translateX(50%) translateY(0); }

/* ---------- Member poems (my wall) ---------- */
.my-poems { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.my-poem {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 8px;
}
.my-poem h4 { font-size: 1.05rem; }
.my-poem .p-text { color: var(--muted); font-family: var(--font-poem); font-size: .95rem; white-space: pre-wrap; max-height: 130px; overflow: hidden; }
.my-poem img { border-radius: 10px; max-height: 160px; object-fit: cover; }
.my-poem .meta { color: var(--muted); font-size: .78rem; }
.my-poem .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--card-border); background: rgba(251, 243, 220, .7); padding: 50px 0 30px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 30px; margin-bottom: 30px; }
.footer-grid h4 { margin-bottom: 12px; font-size: 1rem; }
.footer-grid a, .footer-grid p { color: var(--muted); font-size: .9rem; display: block; margin-bottom: 8px; }
.footer-grid a:hover { color: var(--color-text); }
.footer-bottom { border-top: 1px solid var(--card-border); padding-top: 20px; text-align: center; color: var(--muted); font-size: .85rem; }
.footer-bottom b { color: var(--gold); }

/* ---------- Poem modal ---------- */
.poem-modal .modal-card { width: min(860px, 100%); }
.poem-modal .p-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.poem-modal .p-head .flag { font-size: 2.4rem; }
.poem-modal .p-title { font-size: 1.5rem; margin-bottom: 4px; }
.poem-modal .p-meta { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }

.poem-block { margin-bottom: 22px; }
.poem-block .poem-index {
  width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff8e8;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; margin-bottom: 8px;
}
.poem-block .poem-title { font-size: 1.2rem; font-family: var(--font-heading); margin-bottom: 2px; }
.poem-block .poem-title-en { color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
.poem-block .poem-translator { color: var(--muted); font-size: .8rem; font-style: italic; margin-bottom: 10px; }

.parallel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.parallel .pp-col { background: var(--bg-2); border-radius: var(--radius-sm); padding: 14px; }
.parallel .pp-label {
  font-size: .75rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--accent-2); margin-bottom: 8px;
}
.poem-modal .poem-text { font-size: 1.1rem; line-height: 2; white-space: pre-wrap; font-family: var(--font-poem); }
.poem-modal .poem-text[dir="rtl"] { text-align: right; }
.poem-modal .poem-text[dir="ltr"] { text-align: left; }
.poem-modal .share-in-modal { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }

@media (max-width: 640px) {
  .parallel { grid-template-columns: 1fr; }
}

/* ---------- Hidden ---------- */
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav-wrap { justify-content: center; }
  .lang-switcher { order: 3; justify-content: center; width: 100%; }
  nav.main-nav { justify-content: center; }
  .hero { padding: 60px 0 50px; }
  .share-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar button { min-width: 32px; height: 32px; }
}
@media (max-width: 460px) {
  .wall-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; }
}

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp .6s ease both; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.float { animation: float 5s ease-in-out infinite; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(160, 106, 26, .4); } 70% { box-shadow: 0 0 0 14px rgba(160, 106, 26, 0); } 100% { box-shadow: 0 0 0 0 rgba(160, 106, 26, 0); } }
.pulse-ring { animation: pulse-ring 2.4s infinite; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
