/* Theme: modern, with Sadu weaving (red / black / white / orange) and desert sand. */
:root {
  --bg: #f6efe3;
  --bg-deep: #ecdfc9;
  --surface: #ffffff;
  --ink: #1b1411;
  --muted: #6b5b50;
  --line: #e2d3bc;
  --brand: #a81e22;
  --brand-ink: #ffffff;
  --link: #a81e22;
  --accent: #b5531a;
  --night: #1b1411;
  --night-2: #2a1d18;
  --night-ink: #f6efe3;
  --night-muted: #cdbba6;
  --sadu-orange: #e08a2c;
  --radius: 6px;
  --font-body: "Readex Pro", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Noto Kufi Arabic", "Readex Pro", "Segoe UI", sans-serif;
  --font-verse: "Amiri", "Traditional Arabic", Georgia, serif;

  /* Sadu bands, drawn as repeating SVG tiles */
  --sadu-wide: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='40'%3E%3Crect width='48' height='40' fill='%231b1411'/%3E%3Crect width='48' height='2' fill='%23f6efe3'/%3E%3Cpath d='M0 18L12 4L24 18ZM24 18L36 4L48 18Z' fill='%23a81e22'/%3E%3Cpath d='M12 9l3 3.5-3 3.5-3-3.5zM36 9l3 3.5-3 3.5-3-3.5z' fill='%23f6efe3'/%3E%3Cpath d='M24 5l3 3.5-3 3.5-3-3.5zM0 5l3 3.5-3 3.5zM48 5l-3 3.5 3 3.5z' fill='%23e08a2c'/%3E%3Crect y='20' width='48' height='2' fill='%23e08a2c'/%3E%3Cpath d='M6 24l6 6-6 6-6-6zM30 24l6 6-6 6-6-6z' fill='%23f6efe3'/%3E%3Cpath d='M18 24l6 6-6 6-6-6zM42 24l6 6-6 6-6-6z' fill='%23a81e22'/%3E%3Crect y='38' width='48' height='2' fill='%23f6efe3'/%3E%3C/svg%3E");
  --sadu-thin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12'%3E%3Crect width='24' height='12' fill='%231b1411'/%3E%3Cpath d='M0 12L12 1L24 12Z' fill='%23a81e22'/%3E%3Cpath d='M12 5l2.5 3-2.5 3-2.5-3z' fill='%23f6efe3'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14100e;
    --bg-deep: #1d1613;
    --surface: #221a16;
    --ink: #f3eadb;
    --muted: #b9a998;
    --line: #3b2e27;
    --link: #f29488;
    --accent: #e9a15a;
    --night: #0d0a09;
    --night-2: #1d1613;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.85;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.5; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--sadu-orange); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
.sadu { height: 40px; background: var(--sadu-wide) repeat-x center / 48px 40px; }
.sadu-thin { height: 12px; background: var(--sadu-thin) repeat-x center / 24px 12px; }

/* ---------- Header ---------- */
.site-header { background: var(--night); color: var(--night-ink); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: 14px; min-height: 64px; }
.brand { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--night-ink); text-decoration: none; margin-inline-end: auto; display: flex; align-items: center; gap: 10px; }
.brand::before { content: ""; width: 14px; height: 14px; background: var(--brand); transform: rotate(45deg); box-shadow: 0 0 0 3px var(--night), 0 0 0 5px var(--sadu-orange); margin-inline: 6px 4px; flex: none; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a, .more-btn {
  font: inherit; font-family: var(--font-display); font-size: .88rem; font-weight: 600;
  color: var(--night-muted); background: none; border: 0; cursor: pointer;
  text-decoration: none; padding: 8px 12px; border-radius: 4px; white-space: nowrap;
}
.nav a:hover, .more-btn:hover { color: #fff; }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--brand); border-radius: 0; }
.more { position: relative; }
.more-list {
  display: none; position: absolute; inset-inline-end: 0; top: 100%; min-width: 190px;
  background: var(--night-2); border: 1px solid #44332b; border-radius: var(--radius); padding: 6px; flex-direction: column;
}
.more.open .more-list { display: flex; }
.lang-btn, .menu-btn {
  font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer;
  background: transparent; color: var(--night-ink);
  border: 1px solid #5a463b; border-radius: 4px; padding: 5px 14px;
}
.lang-btn:hover, .menu-btn:hover { border-color: var(--sadu-orange); }
.menu-btn { display: none; padding: 5px 10px; }
@media (max-width: 900px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; position: absolute; inset-inline: 0; top: 100%; background: var(--night); flex-direction: column; align-items: stretch; padding: 8px 20px 18px; border-top: 1px solid #44332b; }
  .site-header.open .nav { display: flex; }
  .nav a { padding: 10px 6px; font-size: 1rem; border-bottom: 1px solid #33261f; border-radius: 0; }
  .nav a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--brand); padding-inline-start: 14px; }
  [dir="rtl"] .nav a[aria-current="page"] { box-shadow: inset -4px 0 0 var(--brand); }
  .more-btn { display: none; }
  .more-list { display: flex; position: static; border: 0; padding: 0; background: none; }
}

/* ---------- Home ---------- */
.hero { background: var(--night); color: var(--night-ink); padding-block: 64px 72px; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset-inline-end: -90px; top: 50%; width: 360px; height: 360px;
  transform: translateY(-50%) rotate(45deg); opacity: .5;
  background:
    linear-gradient(var(--night), var(--night)) center / 34% 34% no-repeat,
    linear-gradient(var(--sadu-orange), var(--sadu-orange)) center / 42% 42% no-repeat,
    linear-gradient(var(--night), var(--night)) center / 62% 62% no-repeat,
    linear-gradient(var(--brand), var(--brand)) center / 74% 74% no-repeat,
    linear-gradient(var(--night), var(--night)) center / 90% 90% no-repeat,
    var(--night-ink);
}
.hero .wrap { position: relative; z-index: 1; }
.hero-grid.has-photo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 56px; align-items: center; }
.portrait { margin: 0; width: min(340px, 34vw); position: relative; }
/* Cut-out portrait standing in front of a red panel, with a Sadu band at its base. */
.portrait::before { content: ""; position: absolute; inset: 24% 0 0 0; background: var(--brand); }
.portrait::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 12px; background: var(--sadu-thin) repeat-x center / 24px 12px; }
.portrait img { display: block; width: 100%; height: auto; position: relative; }
.hero:has(.portrait)::after { opacity: .22; }
@media (max-width: 760px) {
  .hero:has(.portrait)::after { display: none; }
  .hero-grid.has-photo { grid-template-columns: 1fr; gap: 34px; }
  .portrait { order: -1; width: min(240px, 62vw); margin-inline-start: 16px; }
}
.kicker { font-family: var(--font-display); font-weight: 600; font-size: .95rem; color: var(--sadu-orange); margin-block-end: 10px; }
.hero h1 { font-weight: 800; font-size: clamp(2.3rem, 7vw, 4.4rem); line-height: 1.35; max-width: 14ch; }
.hero .bio { color: var(--night-muted); max-width: 56ch; margin-block: 16px 28px; font-size: 1.05rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero .btn.ghost { color: var(--night-ink); border-color: #6a5346; }
.hero .btn.ghost:hover { border-color: var(--sadu-orange); }

.stats { background: var(--brand); color: #fff; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: 22px 12px; text-align: center; border-inline-start: 1px solid rgba(255, 255, 255, .22); }
.stat:first-child { border-inline-start: 0; }
.stat strong { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .9rem; font-weight: 400; opacity: .92; }
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(odd) { border-inline-start: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, .22); }
}

.band { padding-block: 60px; }
.band.deep { background: var(--bg-deep); }
.band-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-block-end: 26px; flex-wrap: wrap; }
.band-head h2 { font-weight: 800; font-size: clamp(1.6rem, 4vw, 2.2rem); position: relative; padding-inline-start: 26px; }
.band-head h2::before { content: ""; position: absolute; inset-inline-start: 2px; top: 50%; width: 12px; height: 12px; background: var(--brand); transform: translateY(-50%) rotate(45deg); }
.band-head a { font-family: var(--font-display); font-weight: 600; font-size: .9rem; text-decoration: none; }
.band-head a:hover { text-decoration: underline; }

.feature { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 36px; align-items: center; }
.feature-verse { background: var(--night); color: var(--night-ink); border-radius: var(--radius); padding: 36px 28px; text-align: center; font-family: var(--font-verse); font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 2.1; position: relative; overflow: hidden; direction: rtl; }
.feature-verse::before, .feature-verse::after { content: ""; position: absolute; inset-inline: 0; height: 12px; background: var(--sadu-thin) repeat-x center / 24px 12px; }
.feature-verse::before { top: 0; transform: scaleY(-1); }
.feature-verse::after { bottom: 0; }
.feature-verse span { display: block; }
.feature-text h3 { font-weight: 800; font-size: 1.7rem; }
.feature-text p { color: var(--muted); margin-block: 8px 18px; }
@media (max-width: 760px) { .feature { grid-template-columns: 1fr; } }

.shelf { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.shelf a { text-decoration: none; color: var(--ink); display: block; }
.shelf a:hover .cover { transform: translateY(-4px); }
.shelf h3 { font-size: .95rem; font-weight: 600; margin-block-start: 10px; }
.shelf small { color: var(--muted); }

.cover {
  aspect-ratio: 3 / 4; border-radius: 3px; padding: 18px 14px 26px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; line-height: 1.6; color: #fff;
  background: var(--cover, var(--brand)); transition: transform .18s;
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, .18), 0 6px 16px rgba(27, 20, 17, .18);
}
[dir="rtl"] .cover { box-shadow: inset -6px 0 0 rgba(0, 0, 0, .18), 0 6px 16px rgba(27, 20, 17, .18); }
.cover::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 12px; background: var(--sadu-thin) repeat-x center / 24px 12px; }
.cover.c0 { --cover: #a81e22; }
.cover.c1 { --cover: #1b1411; }
.cover.c2 { --cover: #b5531a; }
.cover.c3 { --cover: #5c1418; }
.cover.c4 { --cover: #3c3a2e; }

.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.tile .ico { flex: none; width: 46px; height: 46px; display: grid; place-items: center; background: var(--night); color: var(--sadu-orange); border-radius: 4px; }
.tile svg { width: 24px; height: 24px; }
.tile h3 { font-size: 1.05rem; font-weight: 800; }
.tile p { color: var(--muted); font-size: .9rem; line-height: 1.6; }

/* ---------- Inner pages ---------- */
main { flex: 1; }
main.inner { padding-block: 0 64px; }
.page-head { background: var(--night); color: var(--night-ink); padding-block: 40px 44px; margin-block-end: 0; }
.page-head h1 { font-weight: 800; font-size: clamp(1.9rem, 5vw, 2.9rem); }
.page-head p { color: var(--night-muted); max-width: 62ch; margin-block-start: 6px; }
.page-head .kicker { margin: 0 0 4px; }
.page-body { padding-block-start: 36px; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 20px 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; position: relative; overflow: hidden;
}
.card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 12px; background: var(--sadu-thin) repeat-x center / 24px 12px; transform: scaleY(-1); }
.card h3 { font-size: 1.2rem; font-weight: 800; }
.card .meta { color: var(--muted); font-size: .88rem; }
.card .actions { margin-block-start: auto; padding-block-start: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-top { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.card.wide { grid-column: 1 / -1; }
.card.book { flex-direction: row; gap: 16px; align-items: stretch; }
.card.book .cover { flex: none; width: 108px; align-self: flex-start; font-size: .78rem; padding: 10px 8px 18px; }
.card.book .book-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }

.btn {
  display: inline-block; font: inherit; font-family: var(--font-display); font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none;
  background: var(--brand); color: var(--brand-ink); border: 2px solid var(--brand);
  border-radius: 4px; padding: 6px 20px;
}
.btn.ghost { background: transparent; color: var(--link); border-color: currentColor; }
.btn:hover { filter: brightness(1.12); }
.chip { font-size: .8rem; color: var(--muted); border: 1px dashed var(--muted); border-radius: 4px; padding: 1px 10px; white-space: nowrap; }
.badge { font-size: .72rem; font-weight: 500; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 8px; white-space: nowrap; font-family: var(--font-body); }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; }

.form-frame { width: 100%; height: 75vh; min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-block-start: 10px; }
.lessons { margin: 4px 0 0; padding-inline-start: 22px; }
.lessons li { padding-block: 2px; }
.lessons .chip { margin-inline-start: 8px; }
.search { width: 100%; max-width: 440px; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 4px; padding: 9px 14px; margin-block-end: 22px; }
.search:focus { border-color: var(--brand); outline: none; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0 12px; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Poetry */
.opening { font-family: var(--font-verse); font-size: 1.2rem; line-height: 1.9; }
.opening span { display: block; }
.poem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 44px 20px 30px; text-align: center; position: relative; overflow: hidden; }
.poem::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 12px; background: var(--sadu-thin) repeat-x center / 24px 12px; transform: scaleY(-1); }
.poem h2 { font-weight: 800; font-size: 1.9rem; }
.poem .meta { color: var(--muted); font-size: .9rem; margin-block: 4px 22px; }
.verses { font-family: var(--font-verse); font-size: 1.45rem; line-height: 2.2; direction: rtl; }
.verse { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; max-width: 780px; margin-inline: auto; }
.verse span { text-align: center; }
.verse.free { display: block; text-align: center; }
.verse-gap { height: 1.2em; }
@media (max-width: 640px) {
  .verse { grid-template-columns: 1fr; gap: 0; margin-block-end: 14px; }
  .verse span:last-child { color: var(--muted); }
}
.poem-source { text-align: center; font-size: .9rem; margin-block-start: 22px; font-family: var(--font-body); }
.back { margin-block-end: 16px; }
.back a { text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: .9rem; }

/* Books */
.book-group { margin-block-end: 36px; }
.book-group h2 { font-size: 1.5rem; font-weight: 800; margin-block-end: 14px; }

/* Resume */
.cv-section { margin-block-end: 34px; }
.cv-section h2 { font-size: 1.4rem; font-weight: 800; padding-block-end: 6px; margin-block-end: 12px; border-bottom: 3px solid var(--ink); position: relative; }
.cv-section h2::after { content: ""; position: absolute; inset-inline-start: 0; bottom: -3px; width: 64px; height: 3px; background: var(--brand); }
.cv-item { display: grid; grid-template-columns: 1fr auto; gap: 0 16px; padding-block: 9px; border-bottom: 1px solid var(--line); }
.cv-item h3 { font-family: var(--font-body); font-size: 1.02rem; font-weight: 600; }
.cv-item .period { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv-item .where { color: var(--accent); font-weight: 400; }
.cv-item .desc { grid-column: 1 / -1; color: var(--muted); }
.cv-list { margin: 0; padding-inline-start: 26px; text-align: start; }
.cv-list li { padding-block: 5px; line-height: 1.7; font-size: .95rem; overflow-wrap: anywhere; }
.cert-link { font-family: var(--font-display); font-weight: 600; font-size: .82rem; white-space: nowrap; }
.cv-list li::marker { color: var(--brand); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: var(--night); color: var(--night-muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding-block: 22px; }
.site-footer a { color: var(--night-ink); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .site-header, .site-footer, .no-print, .sadu { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .page-head { background: none; color: #000; padding: 0 0 12px; }
  .page-head p { color: #333; }
}
