/* ===========================================================
   أَسْمَى — asmastory.cc
   Fixed warm literary theme (no light/dark toggle)
   =========================================================== */

:root {
  color-scheme: light;

  --paper:      #f3ead6;
  --paper-2:    #eee1c7;
  --surface:    #fbf6ea;
  --surface-2:  #f6eeda;
  --surface-3:  #f0e6cf;

  --ink:        #2a2017;
  --ink-soft:   #574838;
  --muted:      #8a7962;
  --line:       #e4d6ba;
  --line-soft:  #ede1c6;

  --gold:       #b58a4b;
  --gold-2:     #d7b573;
  --gold-deep:  #9a7236;

  --iraqi:      #9c2f37;
  --iraqi-deep: #7c2027;
  --iraqi-soft: #f2e0dd;
  --fusha:      #1f6b5c;
  --fusha-deep: #164e43;
  --fusha-soft: #dcebe5;

  --shadow-sm:  0 2px 8px rgba(74, 54, 30, .08);
  --shadow:     0 16px 40px -18px rgba(60, 42, 18, .38);
  --shadow-lg:  0 30px 70px -28px rgba(60, 42, 18, .5);

  --r:    16px;
  --r-lg: 24px;
  --r-sm: 10px;

  --font-display: 'Aref Ruqaa', 'Amiri', serif;
  --font-serif:   'Noto Naskh Arabic', 'Amiri', serif;
  --font-label:   'Reem Kufi', 'Tajawal', sans-serif;
  --font-ui:      'Tajawal', system-ui, sans-serif;

  --wrap: 1160px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 85% -10%, #f7efdd 0%, transparent 60%),
    radial-gradient(900px 500px at 0% 0%, #f6ecd6 0%, transparent 55%),
    var(--paper);
  background-attachment: fixed;
  line-height: 1.7;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }

.ic { width: 1.05em; height: 1.05em; vertical-align: -0.18em; flex: none; }
.orn { width: 200px; max-width: 60%; height: auto; color: var(--gold); }

/* ---------------- buttons ---------------- */
.btn {
  --bg: var(--ink); --fg: #fff;
  display: inline-flex; align-items: center; gap: .55em;
  font-family: var(--font-ui); font-weight: 700; font-size: 1rem;
  padding: .78em 1.35em; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .16s ease, box-shadow .2s ease, background .2s ease, color .2s;
  background: var(--bg); color: var(--fg); white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary {
  --fg: #fff8ea;
  background: linear-gradient(135deg, var(--iraqi) 0%, var(--iraqi-deep) 100%);
  box-shadow: 0 10px 24px -12px rgba(124, 32, 39, .7);
}
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-soft { background: var(--surface-2); color: var(--ink-soft); border-color: var(--line); }
.btn-soft:hover { background: var(--surface-3); }
.btn-read { background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%); color: #fff8ea; margin-top: 14px; }
.btn-danger { background: #fff; color: var(--iraqi); border-color: #eccdcd; }
.btn-danger:hover { background: var(--iraqi); color: #fff; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 74px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(140deg, #223a4d, #16283a); color: var(--gold-2);
  box-shadow: var(--shadow-sm); font-size: 1.15rem;
}
.brand-mark .ic { width: 1.3em; height: 1.3em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-ar { font-family: var(--font-display); font-size: 1.7rem; color: var(--ink); }
.brand-sub { font-family: var(--font-label); font-size: .62rem; letter-spacing: .32em; color: var(--gold-deep); text-transform: uppercase; }
.site-nav { display: flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-weight: 600; }
.site-nav > a { padding: .5em .9em; border-radius: 999px; color: var(--ink-soft); transition: background .2s, color .2s; }
.site-nav > a:hover { background: var(--surface-2); color: var(--ink); }
.nav-admin { display: inline-flex; align-items: center; gap: .4em; color: var(--gold-deep) !important; border: 1px solid var(--line); }
.nav-admin.subtle { padding: .5em .6em; }

/* ---------------- hero ---------------- */
.hero { position: relative; padding: clamp(28px, 5vw, 64px) 0 22px; }
.hero-inner { display: grid; grid-template-columns: 1.05fr 1.15fr; gap: clamp(24px, 4vw, 60px); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-label); font-size: .82rem; letter-spacing: .04em;
  color: var(--gold-deep); background: var(--surface-2);
  padding: .5em 1em; border-radius: 999px; border: 1px solid var(--line);
}
.eyebrow .ic { color: var(--iraqi); }
.hero-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.7rem, 6vw, 4.6rem); line-height: 1.18; margin: .35em 0 .3em;
  color: var(--ink); letter-spacing: -0.01em;
}
.hero-lede { font-size: clamp(1.08rem, 1.6vw, 1.3rem); color: var(--ink-soft); max-width: 44ch; margin: 0 0 1.6em; }
.hero-lede strong { color: var(--iraqi); font-weight: 700; }
.hero-lede strong:last-of-type { color: var(--fusha); }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { position: relative; }
.hero-art svg { width: 100%; height: auto; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.hero-orn { display: flex; justify-content: center; padding: 30px 0 6px; }

/* ---------------- stories grid ---------------- */
.stories { padding: 30px 0 60px; }
.section-head { text-align: center; margin-bottom: 34px; }
.section-title { font-family: var(--font-display); font-size: clamp(2rem, 3.6vw, 2.9rem); margin: 0 0 .15em; color: var(--ink); }
.section-sub { color: var(--muted); font-size: 1.05rem; margin: 0; }

.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 26px; }
.story-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s;
}
.story-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--gold-2); }
.card-cover { position: relative; aspect-ratio: 20 / 13; overflow: hidden; background: var(--surface-3); }
.card-cover-media, .card-cover-media svg, .card-cover-media img { width: 100%; height: 100%; object-fit: cover; }
.card-glaze { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(30,20,12,.16)); }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-family: var(--font-display); font-size: 1.6rem; margin: 0; color: var(--ink); line-height: 1.25; }
.card-sub { font-family: var(--font-label); font-size: .8rem; color: var(--gold-deep); margin: -2px 0 0; }
.card-ex { color: var(--ink-soft); font-size: .96rem; margin: 2px 0 6px; line-height: 1.6; }
.card-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.card-arrow {
  position: absolute; inset-inline-start: 18px; bottom: 18px; width: 34px; height: 34px;
  display: grid; place-items: center; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--line); color: var(--iraqi); opacity: 0; transform: translateX(6px);
  transition: opacity .2s, transform .2s;
}
.story-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

.badge {
  display: inline-flex; align-items: center; gap: .45em;
  font-family: var(--font-label); font-size: .76rem; font-weight: 500;
  padding: .4em .8em; border-radius: 999px; border: 1px solid transparent;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-iraqi { color: var(--iraqi-deep); background: var(--iraqi-soft); border-color: #e9cdcb; }
.badge-fusha { color: var(--fusha-deep); background: var(--fusha-soft); border-color: #c9e0d7; }
.badge-soon { color: var(--muted); background: var(--surface-2); border-color: var(--line); }

.empty-state, .empty-card { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-art { display: inline-grid; place-items: center; width: 78px; height: 78px; border-radius: 50%; background: var(--surface-2); color: var(--gold); border: 1px solid var(--line); margin-bottom: 14px; }
.empty-art .ic { width: 2.1em; height: 2.1em; }
.empty-state h3, .empty-card h3 { font-family: var(--font-display); font-size: 1.7rem; color: var(--ink); margin: 0 0 .3em; }

/* ---------------- story page ---------------- */
.story-hero { position: relative; background: linear-gradient(165deg, #1b2f40 0%, #24404f 100%); padding: 30px 0 36px; }
.story-hero-inner { display: grid; grid-template-columns: 210px 1fr; gap: 30px; align-items: center; }
.story-hero-cover { border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-lg); border: 3px solid rgba(255,255,255,.7); aspect-ratio: 20/26; background: var(--surface-3); }
.sh-cover, .sh-cover svg, .sh-cover img { width: 100%; height: 100%; object-fit: cover; }
.story-hero-copy { padding-bottom: 8px; }
.crumb { display: inline-flex; align-items: center; gap: .4em; font-family: var(--font-ui); font-weight: 600; font-size: .92rem; color: var(--gold-deep); margin-bottom: 12px; }
.crumb:hover { color: var(--iraqi); }
.story-hero .crumb { color: #e9d4a6; }
.story-hero .crumb:hover { color: #fff; }
.story-title { font-family: var(--font-display); font-size: clamp(2.3rem, 5vw, 3.7rem); color: #fdf6e6; margin: 0 0 .1em; line-height: 1.2; }
.story-subtitle { font-family: var(--font-label); color: #e7d3a4; font-size: 1.05rem; margin: 0 0 14px; }
.story-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.story-hero .badge { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.18); color: #fdf6e6; }
.story-desc { color: rgba(253, 246, 230, .84); font-size: 1.12rem; line-height: 1.9; max-width: 62ch; margin: 18px 0 0; font-family: var(--font-serif); }

.story-body { padding: 20px 0 60px; }
.version-picker { text-align: center; margin: 30px 0 26px; }
.vp-title { font-family: var(--font-display); font-size: 1.9rem; color: var(--ink); margin: 0 0 6px; }
.orn-mini { display: flex; justify-content: center; }
.orn-mini .orn { width: 150px; }

.versions { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.version-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-sm); border-top: 4px solid var(--gold); }
.version-iraqi { border-top-color: var(--iraqi); }
.version-fusha { border-top-color: var(--fusha); }
.version-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.version-tag { font-family: var(--font-display); font-size: 1.6rem; color: var(--ink); }
.version-iraqi .version-tag { color: var(--iraqi-deep); }
.version-fusha .version-tag { color: var(--fusha-deep); }
.version-count { font-family: var(--font-label); font-size: .8rem; color: var(--muted); }
.toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.toc-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid transparent; transition: background .18s, border-color .18s, transform .18s; }
.toc-item:hover { background: var(--surface-3); border-color: var(--line); transform: translateX(-4px); }
.toc-num { font-family: var(--font-display); font-size: 1.3rem; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--gold-deep); flex: none; }
.toc-body { display: flex; flex-direction: column; flex: 1; }
.toc-t { font-weight: 600; color: var(--ink); }
.toc-min { font-size: .78rem; color: var(--muted); }
.toc-go { color: var(--muted); }
.toc-item:hover .toc-go { color: var(--iraqi); }
.version-empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.version-empty .ic { width: 2em; height: 2em; color: var(--gold); opacity: .6; }
.version-empty p { margin: 8px 0 0; }

/* ---------------- reader ---------------- */
.reader-topbar { position: sticky; top: 74px; z-index: 30; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.reader-topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; width: min(760px, 100% - 40px); margin-inline: auto; }
.switch-link { display: inline-flex; align-items: center; gap: .45em; font-weight: 600; font-size: .9rem; padding: .45em .9em; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }
.switch-link:hover { color: var(--ink); background: var(--surface-3); }

.reader-wrap { width: min(720px, 100% - 40px); margin-inline: auto; padding: 30px 0 70px; }
.reader-head { text-align: center; margin-bottom: 26px; }
.reader-badge { margin-bottom: 14px; }
.reader-kicker { font-family: var(--font-label); color: var(--gold-deep); letter-spacing: .1em; margin: 0 0 6px; font-size: .9rem; }
.reader-title { font-family: var(--font-display); font-size: clamp(2rem, 4.5vw, 3rem); color: var(--ink); margin: 0 0 10px; line-height: 1.25; }
.reader-min { display: inline-flex; align-items: center; gap: .45em; color: var(--muted); font-size: .9rem; margin: 0; }
.reader-min .ic { color: var(--gold); }

/* reading typography */
.reader-content { font-family: var(--font-serif); font-size: 1.32rem; line-height: 2.15; color: #362b20; }
.reader-content p { margin: 0 0 1.3em; text-align: justify; text-justify: inter-word; }
.reader-content .story-h { font-family: var(--font-display); font-size: 1.7rem; color: var(--ink); text-align: center; margin: 1.6em 0 .7em; }
.reader-content .story-quote { border-inline-start: 3px solid var(--gold-2); background: var(--surface-2); margin: 1.4em 0; padding: 1em 1.3em; border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--ink-soft); font-style: italic; }
.reader-content strong { color: var(--ink); font-weight: 700; }
.ornament-divider {
  height: 26px; margin: 2em auto; background: center/contain no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='24' viewBox='0 0 240 24' fill='none' stroke='%23b58a4b' stroke-width='1.6'%3E%3Cpath d='M8 12H92' stroke-opacity='.5'/%3E%3Cpath d='M232 12H148' stroke-opacity='.5'/%3E%3Cpath d='M120 4l10 8-10 8-10-8z'/%3E%3Cpath d='M120 1v22' stroke-opacity='.35'/%3E%3Ccircle cx='99' cy='12' r='2.2' fill='%23b58a4b' stroke='none'/%3E%3Ccircle cx='141' cy='12' r='2.2' fill='%23b58a4b' stroke='none'/%3E%3C/svg%3E");
}
.reader-endorn { display: flex; justify-content: center; margin: 34px 0; }

.reader-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.rnav { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transition: transform .18s, box-shadow .18s, border-color .18s; }
.rnav:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--gold-2); }
.rnav-empty { background: transparent; border: none; }
.rnav-next { text-align: left; }
.rnav-dir { display: inline-flex; align-items: center; gap: .4em; font-weight: 700; color: var(--iraqi); font-size: .9rem; }
.rnav-next .rnav-dir { justify-content: flex-end; color: var(--fusha); }
.rnav-done .rnav-dir { color: var(--gold-deep); }
.rnav-t { font-family: var(--font-serif); font-size: 1.1rem; color: var(--ink); }

/* ---------------- footer ---------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.footer-inner { text-align: center; padding: 44px 0 40px; }
.foot-orn { display: flex; justify-content: center; margin-bottom: 14px; }
.foot-brand { font-size: 2.2rem; color: var(--ink); }
.foot-tag { font-family: var(--font-label); color: var(--gold-deep); margin: 2px 0 14px; }
.foot-copy { color: var(--muted); font-size: .88rem; margin: 0; }
.foot-copy a:hover { color: var(--iraqi); }

/* ---------------- not found ---------------- */
.notfound { text-align: center; padding: 90px 20px; }
.notfound h1 { font-family: var(--font-display); font-size: 2.4rem; color: var(--ink); margin: 10px 0 .2em; }
.notfound p { color: var(--muted); margin-bottom: 22px; }

/* ===========================================================
   ADMIN
   =========================================================== */
body.is-admin { background: #ece3d0; }
.admin { min-height: 100vh; display: flex; font-family: var(--font-ui); }

/* ---- slide-out drawer (mobile-first) ---- */
.admin-drawer {
  width: 272px; flex: none; z-index: 60;
  background: linear-gradient(200deg, #1f3346 0%, #16283a 100%); color: #eadfc9;
  display: flex; flex-direction: column; padding: 16px 14px;
  position: fixed; top: 0; bottom: 0; right: 0;
  transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; box-shadow: -12px 0 44px -12px rgba(0,0,0,.55);
}
.drawer-cb:checked ~ .admin-drawer { transform: translateX(0); }
.drawer-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer-brand { display: flex; align-items: center; gap: 11px; color: #fff; }
.drawer-brand .brand-mark { width: 42px; height: 42px; background: rgba(255,255,255,.12); color: var(--gold-2); }
.drawer-brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.drawer-brand-text b { font-family: var(--font-display); font-weight: 400; font-size: 1.55rem; }
.drawer-brand-text small { font-family: var(--font-label); font-size: .62rem; letter-spacing: .18em; color: var(--gold-2); }
.drawer-x { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; color: #eadfc9; cursor: pointer; }
.drawer-x:hover { background: rgba(255,255,255,.1); }
.drawer-label { font-family: var(--font-label); font-size: .66rem; letter-spacing: .16em; color: #7f97a9; margin: 14px 10px 6px; display: block; }
.drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.dnav { display: flex; align-items: center; gap: 13px; padding: 13px 14px; border-radius: 13px; color: #dcd0b8; font-weight: 600; font-size: 1.02rem; transition: background .16s, color .16s; }
.dnav:hover { background: rgba(255,255,255,.08); color: #fff; }
.dnav.active { background: linear-gradient(135deg, var(--iraqi), var(--iraqi-deep)); color: #fff; box-shadow: 0 10px 20px -12px rgba(0,0,0,.6); }
.dnav-ic { display: grid; place-items: center; width: 24px; }
.dnav-ic .ic { width: 1.3em; height: 1.3em; }
.drawer-logout { margin: 18px 0 0; }
.drawer-logout button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 13px; border-radius: 13px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #eadfc9; font-weight: 700; font-family: var(--font-ui); font-size: 1rem; cursor: pointer; transition: background .16s; }
.drawer-logout button:hover { background: rgba(156,47,55,.45); border-color: transparent; }
.drawer-foot { margin: 14px 10px 4px; font-size: .82rem; color: #7f97a9; }
.drawer-foot b { color: var(--gold-2); }
.drawer-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(15,22,30,.55); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity .28s; }
.drawer-cb:checked ~ .drawer-scrim { opacity: 1; visibility: visible; }

/* ---- shell + top bar ---- */
.admin-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 14px;
  background: color-mix(in srgb, #ece3d0 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.drawer-btn { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); cursor: pointer; flex: none; }
.drawer-btn:hover { background: var(--surface-2); }
.drawer-btn .ic { width: 1.5em; height: 1.5em; }
.admin-bar-title { font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-bar-view { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); color: var(--gold-deep); flex: none; }

.admin-body { padding: 20px 15px 96px; }
.admin-wrap { width: min(920px, 100%); margin-inline: auto; }

/* desktop: drawer docks as a sidebar */
@media (min-width: 900px) {
  .admin-drawer { position: sticky; height: 100vh; align-self: flex-start; transform: none; top: 0; right: auto; box-shadow: none; border-inline-end: 1px solid rgba(255,255,255,.08); }
  .drawer-scrim, .drawer-btn, .drawer-x { display: none; }
  .admin-bar { background: transparent; border-bottom: none; height: 54px; padding-top: 6px; }
  .admin-bar-title { font-size: 1.05rem; color: var(--muted); font-family: var(--font-ui); font-weight: 600; }
  .admin-body { padding: 8px 30px 80px; }
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: 2.3rem; color: var(--ink); margin: 4px 0 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; }

.story-table { display: flex; flex-direction: column; gap: 12px; }
.strow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow-sm); transition: border-color .18s; }
.strow:hover { border-color: var(--gold-2); }
.strow-main { display: flex; flex-direction: column; flex: 1 1 55%; min-width: 0; }
.strow-title { font-family: var(--font-display); font-size: 1.4rem; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.strow-sub { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.strow-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-badge { font-family: var(--font-label); font-size: .74rem; padding: .35em .7em; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }
.mb-iraqi { color: var(--iraqi-deep); background: var(--iraqi-soft); border-color: #e9cdcb; }
.mb-fusha { color: var(--fusha-deep); background: var(--fusha-soft); border-color: #c9e0d7; }
.strow-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; flex-wrap: wrap; }
.strow-actions form { margin: 0; }

.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); cursor: pointer; transition: background .16s, color .16s, border-color .16s; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover { background: var(--iraqi); color: #fff; border-color: var(--iraqi); }
.icon-btn.xs { width: 30px; height: 30px; border-radius: 8px; font-size: .8rem; }
.icon-btn:disabled { opacity: .35; cursor: default; }

.chip { font-family: var(--font-label); font-size: .68rem; padding: .28em .6em; border-radius: 999px; }
.chip-draft { background: #f3e3c2; color: #8a6414; border: 1px solid #e6cf9a; }

.empty-card { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.form-card { padding: 26px; display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2.tight { gap: 12px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-family: var(--font-label); font-size: .84rem; color: var(--ink-soft); }
.input { font-family: var(--font-ui); font-size: 1rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: .75em .9em; width: 100%; transition: border-color .16s, box-shadow .16s, background .16s; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(181,138,75,.18); background: #fffdf7; }
.textarea { resize: vertical; line-height: 1.7; }
select.input { cursor: pointer; }
.field-hint { font-size: .78rem; color: var(--muted); }
.color-row { display: flex; align-items: center; gap: 12px; }
.color-input { width: 54px; height: 44px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.form-actions .inline { margin: 0; }
.hint-line { display: inline-flex; align-items: center; gap: .5em; color: var(--muted); font-size: .92rem; margin-top: 16px; }
.hint-line .ic { color: var(--gold); }
.crumb { }

/* versions in editor */
.versions-admin { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 26px; }
.vadmin { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); border-top: 4px solid var(--gold); }
.vadmin-iraqi { border-top-color: var(--iraqi); }
.vadmin-fusha { border-top-color: var(--fusha); }
.vadmin-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.vadmin-head h2 { font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); margin: 0; }
.vadmin-iraqi .vadmin-head h2 { color: var(--iraqi-deep); }
.vadmin-fusha .vadmin-head h2 { color: var(--fusha-deep); }
.vadmin-count { font-family: var(--font-label); font-size: .78rem; color: var(--muted); }
.vadmin-parts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.padmin { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; }
.padmin:hover { border-color: var(--line); }
.padmin-num { font-family: var(--font-display); font-size: 1.1rem; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--gold-deep); flex: none; }
.padmin-title { flex: 1; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.padmin-title:hover { color: var(--iraqi); }
.padmin-actions { display: flex; align-items: center; gap: 4px; }
.padmin-actions .inline { margin: 0; }
.vadmin-empty { color: var(--muted); text-align: center; padding: 16px; font-size: .92rem; }
.vadmin-add { margin: 0; }

/* editor */
.editor-head { display: flex; align-items: center; justify-content: space-between; }
.editor-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.etab { font-family: var(--font-ui); font-weight: 600; font-size: .88rem; padding: .4em 1em; border-radius: 999px; border: none; background: transparent; color: var(--ink-soft); cursor: pointer; }
.etab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.editor { font-family: var(--font-serif); font-size: 1.15rem; line-height: 2; min-height: 360px; }
.editor-preview { min-height: 360px; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.fmt-help { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; font-size: .9rem; color: var(--ink-soft); }
.fmt-help summary { cursor: pointer; padding: 10px 0; font-weight: 600; display: flex; align-items: center; gap: .5em; }
.fmt-help summary .ic { color: var(--gold); }
.fmt-help ul { margin: 0 0 12px; padding-inline-start: 1.2em; line-height: 1.9; }
.fmt-help code { background: var(--paper); padding: .1em .4em; border-radius: 6px; border: 1px solid var(--line); font-family: ui-monospace, monospace; font-size: .85em; direction: ltr; display: inline-block; }

/* login */
.login-bg { background: linear-gradient(140deg, #1b2f40, #24404f) !important; }
.login-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 40px 34px; text-align: center; border: 1px solid var(--line); }
.login-badge { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(140deg, #223a4d, #16283a); color: var(--gold-2); margin-bottom: 16px; }
.login-badge .ic { width: 1.8em; height: 1.8em; }
.login-card h1 { font-family: var(--font-display); font-size: 1.9rem; color: var(--ink); margin: 0 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 22px; }
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: right; }
.login-form label { display: flex; flex-direction: column; gap: 6px; }
.login-form label span { font-family: var(--font-label); font-size: .82rem; color: var(--ink-soft); }
.login-form .btn { margin-top: 8px; }
.form-error { background: var(--iraqi-soft); color: var(--iraqi-deep); border: 1px solid #e9cdcb; border-radius: 10px; padding: .7em 1em; font-size: .92rem; margin-bottom: 16px; }
.form-ok { display: flex; align-items: center; gap: .5em; background: var(--fusha-soft); color: var(--fusha-deep); border: 1px solid #c9e0d7; border-radius: 10px; padding: .7em 1em; font-size: .95rem; margin-bottom: 16px; }
.settings-card { max-width: 560px; }
.settings-note { display: flex; align-items: center; gap: .5em; font-family: var(--font-label); font-size: .88rem; color: var(--ink-soft); margin: 0; }
.settings-note .ic { color: var(--gold); }
.soft-hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }
.login-back { color: #e9d4a6; font-weight: 600; display: inline-flex; align-items: center; gap: .4em; }
.login-back:hover { color: #fff; }

/* ---------------- uploader + editor tools ---------------- */
.uploader { display: flex; flex-direction: column; gap: 8px; }
.up-row { display: flex; gap: 8px; align-items: stretch; }
.up-row .input { flex: 1; min-width: 0; }
.up-btn { flex: none; white-space: nowrap; }
.up-preview:empty { display: none; }
.up-preview img { width: 116px; height: 148px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.up-msg { font-size: .82rem; color: var(--gold-deep); min-height: 1em; }
.up-msg.err { color: var(--iraqi); }
.editor-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.etool { display: inline-flex; align-items: center; gap: .4em; font-family: var(--font-ui); font-weight: 600; font-size: .86rem; padding: .5em .85em; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); cursor: pointer; }
.etool:hover { background: var(--surface-3); color: var(--ink); }
.etool:disabled { opacity: .5; }

/* ---------------- in-content images ---------------- */
.story-figure { margin: 1.7em 0; text-align: center; }
.story-figure img { border-radius: var(--r); box-shadow: var(--shadow); max-height: 72vh; margin-inline: auto; }
.story-figure figcaption { font-family: var(--font-label); font-size: .84rem; color: var(--muted); margin-top: 8px; }
.story-inline-img { max-width: 100%; border-radius: 8px; vertical-align: middle; }

/* ---------------- footer socials + nav ---------------- */
.foot-social { display: flex; justify-content: center; gap: 10px; margin: 4px 0 14px; flex-wrap: wrap; }
.foot-social a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); color: var(--gold-deep); transition: background .18s, color .18s, transform .18s, border-color .18s; }
.foot-social a:hover { background: var(--iraqi); color: #fff; transform: translateY(-3px); border-color: var(--iraqi); }
.foot-social .ic { width: 1.25em; height: 1.25em; }
.foot-nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; margin: 4px 0 16px; }
.foot-nav a { color: var(--ink-soft); }
.foot-nav a:hover { color: var(--iraqi); }
.foot-nav span { color: var(--line); }
.nav-search { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-soft); }
.nav-search:hover { background: var(--surface-2); color: var(--iraqi); }
.nav-search .ic { width: 1.2em; height: 1.2em; }

/* ---------------- about ---------------- */
.about { padding: 44px 0 60px; }
.about-inner { max-width: 720px; margin-inline: auto; text-align: center; }
.about-badge { display: inline-grid; place-items: center; width: 74px; height: 74px; border-radius: 22px; background: linear-gradient(140deg, #223a4d, #16283a); color: var(--gold-2); margin-bottom: 16px; box-shadow: var(--shadow); }
.about-badge .ic { width: 2em; height: 2em; }
.about-title { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.2rem); color: var(--ink); margin: 0 0 6px; }
.about-body { text-align: right; margin: 26px 0 32px; }

/* ---------------- search ---------------- */
.search-page { padding: 34px 0 60px; }
.search-form { display: flex; gap: 8px; align-items: center; max-width: 620px; margin: 0 auto 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px; box-shadow: var(--shadow-sm); }
.search-form:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(181,138,75,.18); }
.search-ic { color: var(--muted); display: grid; place-items: center; padding-inline-start: 12px; }
.search-input { flex: 1; min-width: 0; border: none; background: transparent; font-family: var(--font-ui); font-size: 1.05rem; color: var(--ink); padding: 11px 6px; outline: none; }
.search-form .btn { flex: none; }
.search-count { text-align: center; color: var(--muted); margin-bottom: 20px; }
.search-hint { text-align: center; color: var(--muted); padding: 20px; }

/* ---------------- confirm modal ---------------- */
.modal-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(15,22,30,.55); backdrop-filter: blur(3px); animation: modalfade .18s ease; }
.modal-overlay[hidden] { display: none; }
@keyframes modalfade { from { opacity: 0 } to { opacity: 1 } }
.modal-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 28px 26px 24px; text-align: center; animation: modalpop .24s cubic-bezier(.34,1.35,.5,1); }
@keyframes modalpop { from { transform: scale(.92) translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-icon { display: inline-grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: var(--iraqi-soft); color: var(--iraqi); margin-bottom: 14px; }
.modal-icon .ic { width: 1.7em; height: 1.7em; }
.modal-title { font-family: var(--font-display); font-size: 1.6rem; color: var(--ink); margin: 0 0 8px; }
.modal-msg { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.7; margin: 0 0 22px; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn { flex: 1; justify-content: center; }
.prev-empty { font-family: var(--font-ui); color: var(--muted); text-align: center; padding: 26px 12px; font-size: .96rem; }

/* ---------------- responsive ---------------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .versions, .versions-admin { grid-template-columns: 1fr; }
  .story-hero-inner { grid-template-columns: 140px 1fr; gap: 18px; }
  .reader-topbar { top: 60px; }
}
@media (max-width: 620px) {
  .header-inner { height: 60px; }
  .brand-ar { font-size: 1.32rem; }
  .brand-sub { font-size: .55rem; letter-spacing: .24em; }
  .site-nav { gap: 2px; }
  .site-nav > a:not(.nav-admin):not(.nav-search) { display: none; }
  .hero { padding-top: 22px; }
  .hero-title { font-size: 2.5rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .reader-nav { grid-template-columns: 1fr; }
  .story-hero-inner { grid-template-columns: 1fr; text-align: center; }
  .story-hero-cover { width: 158px; margin-inline: auto; }
  .story-meta { justify-content: center; }
  .story-desc { margin-inline: auto; }
  .reader-content { font-size: 1.22rem; line-height: 2.06; }
  .reader-wrap { padding-top: 22px; }
  .page-title { font-size: 1.8rem; }
  .story-grid { grid-template-columns: 1fr; }
  .form-card { padding: 18px; }
  .up-preview img { width: 100px; height: 128px; }
}
