/* دیوان — neoform — ink atelier */
:root {
  --bg: #0c0e12;
  --bg-elev: #141820;
  --bg-card: #1a1f2a;
  --ink: #ebe4d8;
  --muted: #9a9286;
  --line: rgba(235, 228, 216, 0.1);
  --copper: #c4784a;
  --copper-soft: rgba(196, 120, 74, 0.18);
  --sage: #7a9e8a;
  --danger: #d66a6a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --dock-h: 68px;
  --top-h: 58px;
  --font: Tahoma, "Segoe UI", "IranSans", "Vazirmatn", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
[v-cloak] { display: none !important; }
.seo-crawl {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.1rem 2rem;
  line-height: 1.9;
  color: var(--ink);
}
.seo-crawl a { color: var(--copper); }
.seo-crawl h1 { font-size: 1.45rem; margin: 0.5rem 0 0.75rem; }
.seo-crawl ul { padding-right: 1.2rem; }
body.js-app .seo-crawl[hidden],
body.js-app .seo-crawl { display: none !important; }
a { color: var(--copper); text-decoration: none; }
button, input { font: inherit; color: inherit; }
button {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  outline: none;
  color: var(--ink);
}
input[type="search"]:focus {
  border-color: rgba(196, 120, 74, 0.55);
  box-shadow: 0 0 0 3px var(--copper-soft);
}
input[type="search"]::placeholder { color: var(--muted); }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(196, 120, 74, 0.14), transparent 55%),
    radial-gradient(700px 420px at -10% 20%, rgba(122, 158, 138, 0.09), transparent 50%),
    #0c0e12;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 1.5rem);
}

/* Top */
.shell-top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--top-h);
  padding: 0.55rem 1rem;
  padding-top: calc(0.55rem + env(safe-area-inset-top));
  backdrop-filter: blur(14px);
  background: rgba(12, 14, 18, 0.78);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-align: right;
}
.brand-orb {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(196, 120, 74, 0.95), rgba(122, 158, 138, 0.55)),
    var(--bg-card);
  box-shadow: 0 8px 24px rgba(196, 120, 74, 0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-text em { font-style: normal; font-size: 0.72rem; color: var(--muted); }
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--ink);
}

.search-bar {
  display: none;
  gap: 0.55rem;
  padding: 0.65rem 1rem 0.85rem;
  background: rgba(12, 14, 18, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: calc(var(--top-h) + env(safe-area-inset-top));
  z-index: 35;
}
.search-bar.open { display: flex; align-items: center; }
.pill {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: 999px;
  background: var(--copper);
  color: #1a120c;
  font-weight: 700;
}
.pill.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.pill:disabled { opacity: 0.35; cursor: not-allowed; }

.stage { position: relative; min-height: 40vh; }
.stage.dim { opacity: 0.72; transition: opacity 0.15s linear; }
.top-progress {
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 2px;
  z-index: 5;
  background: linear-gradient(90deg, transparent, var(--copper), transparent);
  animation: prog 0.9s linear infinite;
}
@keyframes prog {
  from { transform: translateX(40%); opacity: 0.3; }
  to { transform: translateX(-40%); opacity: 1; }
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0.75rem 1rem 1rem;
  display: grid;
  gap: 1rem;
}
.rail { display: none; }

.hero {
  margin: 0.4rem 0 1.1rem;
  animation: rise 0.55s var(--ease) both;
}
.hero h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.55rem, 5.5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.7;
  max-width: 36ch;
}

.filter-chip {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.poet-grid {
  display: grid;
  gap: 0.65rem;
}
.poet-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: right;
  padding: 0.9rem 1rem;
  min-height: 76px;
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(26, 31, 42, 0.95), rgba(20, 24, 32, 0.9));
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s var(--ease), border-color 0.25s, background 0.25s;
}
.poet-card:active { transform: scale(0.985); }
.poet-card:hover {
  border-color: rgba(196, 120, 74, 0.35);
  background: linear-gradient(165deg, rgba(32, 38, 50, 0.98), rgba(22, 26, 34, 0.95));
}
.poet-initial {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: #1a120c;
  background: linear-gradient(145deg, #d08a5a, #9bb5a6);
}
.poet-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.poet-body strong {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poet-body small { color: var(--muted); font-size: 0.78rem; }
.poet-body em {
  font-style: normal;
  color: var(--sage);
  font-size: 0.78rem;
  font-weight: 500;
}
.chev { color: var(--muted); font-size: 1.25rem; opacity: 0.7; }

.poet-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 0.5rem 0 1rem;
  animation: rise 0.45s var(--ease) both;
}
.poet-badge {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a120c;
  background: linear-gradient(145deg, #d08a5a, #9bb5a6);
  flex-shrink: 0;
}
.poet-head h1 { margin: 0; font-size: 1.45rem; font-weight: 800; }
.stats { margin: 0.25rem 0 0; color: var(--sage); font-size: 0.88rem; }
.muted { color: var(--muted); margin: 0.15rem 0 0; }
.desc {
  color: var(--muted);
  line-height: 1.85;
  font-size: 0.92rem;
  margin: 0 0 1.25rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  max-height: 9rem;
  overflow: auto;
}
.sec-title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.cat-list { display: grid; gap: 0.5rem; }
.cat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: right;
  min-height: 56px;
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--line);
  transition: border-color 0.2s;
}
.cat-row:hover { border-color: rgba(122, 158, 138, 0.45); }
.cat-row strong { font-weight: 700; }
.cat-row em {
  font-style: normal;
  min-width: 2.2rem;
  text-align: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--copper-soft);
  color: var(--copper);
  font-size: 0.82rem;
  font-weight: 700;
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.85rem;
}
.crumb a { color: var(--sage); }
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.list-head h1 { margin: 0; font-size: 1.35rem; font-weight: 800; }
.count { color: var(--muted); font-size: 0.85rem; }

.poem-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.poem-list button {
  width: 100%;
  text-align: right;
  padding: 0.95rem 1rem;
  min-height: 64px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.2s, transform 0.2s;
}
.poem-list button:active { transform: scale(0.99); }
.poem-list button:hover { border-color: rgba(196, 120, 74, 0.4); }
.poem-list strong { font-weight: 700; font-size: 1rem; }
.poem-list .tag {
  color: var(--sage);
  font-size: 0.78rem;
}
.poem-list small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Poem reader */
.view-poem { padding-bottom: 1rem; }
.poem-head {
  text-align: center;
  margin: 0.5rem 0 1.5rem;
  animation: rise 0.5s var(--ease) both;
}
.poet-line {
  margin: 0;
  color: var(--copper);
  font-weight: 700;
  font-size: 0.95rem;
}
.poem-head h1 {
  margin: 0.35rem 0;
  font-size: clamp(1.25rem, 4.5vw, 1.7rem);
  font-weight: 800;
}
.cat-line { margin: 0; color: var(--muted); font-size: 0.85rem; }

.verses {
  display: grid;
  gap: 0.85rem;
  max-width: 38rem;
  margin: 0 auto;
}
.couplet {
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(26, 31, 42, 0.95), rgba(18, 22, 30, 0.88));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.55s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 45ms);
}
.couplet p {
  margin: 0;
  text-align: center;
  line-height: 2.05;
  font-size: clamp(1.02rem, 3.6vw, 1.18rem);
  font-weight: 500;
}
.couplet p + p { margin-top: 0.35rem; color: rgba(235, 228, 216, 0.92); }
.plain {
  white-space: pre-wrap;
  text-align: center;
  line-height: 2.1;
  font-family: inherit;
  max-width: 38rem;
  margin: 0 auto;
  padding: 1.2rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.poem-nav {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  max-width: 38rem;
  margin: 1.5rem auto 0;
}
.poem-nav .pill { width: 100%; }

.state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.state.err, .err-panel { color: var(--danger); }
.state.soft { padding: 1.5rem 0.5rem; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
.err-panel {
  margin: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(214, 106, 106, 0.1);
  border: 1px solid rgba(214, 106, 106, 0.3);
}

.dock {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--dock-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(12, 14, 18, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.dock button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}
.dock button.on { color: var(--copper); }
.dock svg { opacity: 0.9; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.5rem 1rem 0.25rem;
  opacity: 0.7;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Desktop */
@media (min-width: 900px) {
  #app { padding-bottom: 2rem; }
  .dock { display: none; }
  .search-open { display: none; }
  .search-bar {
    display: flex !important;
    position: static;
    background: transparent;
    border: 0;
    padding: 0.85rem 0 0;
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
  }
  .shell {
    grid-template-columns: 240px minmax(0, 1fr);
    padding-top: 1rem;
    gap: 1.5rem;
  }
  .rail {
    display: block;
    position: sticky;
    top: calc(var(--top-h) + 1rem);
    align-self: start;
    padding: 1.1rem;
    border-radius: var(--radius);
    background: var(--bg-elev);
    border: 1px solid var(--line);
  }
  .rail-label {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-transform: uppercase;
  }
  .rail-meta {
    margin: 0.55rem 0 1rem;
    font-size: 0.88rem;
    color: var(--ink);
    line-height: 1.5;
  }
  .rail-nav { display: grid; gap: 0.4rem; }
  .rail-nav button {
    text-align: right;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    color: var(--muted);
    border: 1px solid transparent;
  }
  .rail-nav button.on,
  .rail-nav button:hover {
    color: var(--ink);
    background: var(--copper-soft);
    border-color: rgba(196, 120, 74, 0.25);
  }
  .rail-hint {
    margin-top: 1.2rem;
    font-size: 0.78rem;
    color: var(--sage);
    line-height: 1.6;
  }
  .poet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }
  .poet-card:hover { transform: translateY(-2px); }
  .verses { max-width: 42rem; }
  .couplet p { font-size: 1.22rem; line-height: 2.15; }
  .shell-top {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    border: 0;
    background: transparent;
    backdrop-filter: none;
    padding-inline: 0;
  }
}

@media (min-width: 1100px) {
  .poet-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
