/* ============================================================
   אילפא — Design System
   dark #131314 · gold #ffe397 · orange #ffb77b
   Frank Ruhl Libre (serif, מקורות) + Assistant (UI)
   RTL · Dark mode only (MVP)
   ============================================================ */

:root {
  --bg: #131314;
  --bg-deep: #0c0c0d;
  --card: #1a1a1c;
  --card-2: #1d1d21;
  --card-3: #17171a;
  --gold: #ffe397;
  --orange: #ffb77b;
  --text: #f2efe8;
  --text-2: #c9c4b8;
  --muted: #9b968a;
  --line: rgba(255, 255, 255, .08);
  --line-soft: rgba(255, 255, 255, .06);
  --gold-line: rgba(255, 227, 151, .18);
  --gold-line-strong: rgba(255, 227, 151, .3);
  --gold-soft: rgba(255, 227, 151, .1);
  --serif: 'Frank Ruhl Libre', serif;
  --sans: 'Assistant', system-ui, sans-serif;
  --r-card: 26px;
  --r-inner: 20px;
}

* { box-sizing: border-box; }

html { direction: rtl; }

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100dvh; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 60px rgba(0, 0, 0, .5);
}

.page {
  padding: 22px 18px 120px;
  animation: fade .25s ease;
}

.page--flush { padding: 0 0 120px; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- typography ---------- */
h1, .h1 { font-size: 22px; font-weight: 700; margin: 0; }
.serif { font-family: var(--serif); }
.kicker {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--orange);
}
.quote {
  font-family: var(--serif);
  color: var(--gold);
  line-height: 1.45;
}
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }

a { color: var(--gold); text-decoration: none; }

/* ---------- cards ---------- */
.card {
  border-radius: var(--r-card);
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card--gold { border-color: var(--gold-line); }
.card--link { cursor: pointer; transition: border-color .15s, transform .15s; }
.card--link:active { transform: scale(.985); }
.card--link:hover { border-color: var(--gold-line-strong); }

/* ---------- chips ---------- */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--text-2);
  background: none;
  font-family: var(--sans);
  cursor: pointer;
  white-space: nowrap;
}
.chip.on {
  background: var(--gold);
  color: var(--bg);
  font-weight: 700;
  border-color: var(--gold);
}
.chip--tag {
  padding: 3px 12px;
  font-size: 11.5px;
  background: var(--gold-soft);
  color: var(--gold);
  border: none;
  cursor: default;
}
.chip--select {
  background: rgba(255, 227, 151, .14);
  border: 1px solid rgba(255, 227, 151, .4);
  color: var(--gold);
}
.chip--ghost { border-style: dashed; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn--ghost {
  background: none;
  color: var(--text-2);
  border: 1px solid rgba(255, 255, 255, .14);
}
.btn--icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: none;
  border: 1px solid var(--gold-line-strong);
  color: var(--gold);
  font-size: 15px;
  display: grid;
  place-items: center;
  flex: none;
}
.btn--icon.on { background: var(--gold-soft); }

/* ---------- header row ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #232326;
  border: 1px solid rgba(255, 227, 151, .2);
  display: grid;
  place-items: center;
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
  flex: none;
  cursor: pointer;
}

/* ---------- home: stacked atmosphere layers ---------- */
.layer {
  position: relative;
  overflow: hidden;
  border-radius: 40px 40px 0 0;
  box-shadow: 0 -18px 32px rgba(0, 0, 0, .55);
  padding: 24px 22px 44px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  text-align: center;
}
.layer + .layer { margin-top: -28px; }
.layer > * { position: relative; }

.layer--sky {
  border-radius: 0;
  background: linear-gradient(195deg, #1d2136 0%, #171a28 55%, #141520 100%);
  padding-top: 14px;
  box-shadow: none;
}
.layer--candle {
  background: radial-gradient(120% 100% at 50% 115%, rgba(255, 183, 123, .16), transparent 55%), #1a1817;
}
.layer--dusk {
  background: linear-gradient(180deg, #201c1a 0%, #181514 100%);
}

.moon-wrap { position: absolute; inset: 0; pointer-events: none; }
.moon-glow {
  position: absolute;
  top: 74px; inset-inline-end: 15%;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe397 0%, rgba(255, 227, 151, .45) 45%, transparent 72%);
  filter: blur(1px);
}
.moon {
  position: absolute;
  top: 72px; inset-inline-end: calc(15% + 2px);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #f5e2b3;
  box-shadow: 0 0 34px 10px rgba(255, 227, 151, .3);
}
.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle 1.2px at 15% 22%, #fff 40%, transparent 60%),
    radial-gradient(circle 1px at 42% 12%, #fff 40%, transparent 60%),
    radial-gradient(circle 1.4px at 68% 28%, #ffe397 40%, transparent 60%),
    radial-gradient(circle 1px at 86% 14%, #fff 40%, transparent 60%),
    radial-gradient(circle 1px at 28% 40%, #ffe397 40%, transparent 60%),
    radial-gradient(circle 1px at 58% 45%, #fff 40%, transparent 60%);
}
.candle-glow {
  position: absolute;
  bottom: -30px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 183, 123, .35), transparent 70%);
  filter: blur(8px);
}
.dune {
  position: absolute;
  border-radius: 50%;
  filter: blur(14px);
}

/* ---------- bottom pill nav ---------- */
.nav {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 36px), 444px);
  z-index: 50;
}
.nav-pill {
  border-radius: 999px;
  background: rgba(29, 29, 33, .92);
  border: 1px solid rgba(255, 255, 255, .09);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.nav-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-btn.on { background: rgba(255, 227, 151, .16); }
.nav-btn svg { stroke: var(--muted); }
.nav-btn.on svg { stroke: var(--gold); }
.nav-plus {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold);
  display: grid;
  place-items: center;
  color: var(--bg);
  font-size: 26px;
  border: 3px solid var(--bg);
  transform: translateY(-22px);
  box-shadow: 0 10px 24px rgba(255, 227, 151, .28);
  cursor: pointer;
  flex: none;
}
.nav-plus:active { transform: translateY(-22px) scale(.95); }

/* ---------- journal write ---------- */
.write-area {
  width: 100%;
  min-height: 180px;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  padding: 0;
}
.write-area::placeholder { color: var(--muted); }

.spark-banner {
  border-radius: var(--r-inner);
  padding: 12px 14px;
  background: rgba(255, 227, 151, .06);
  border: 1px solid rgba(255, 227, 151, .16);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
}
.input:focus { border-color: var(--gold-line-strong); }

/* ---------- bento grid (library) ---------- */
.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  grid-auto-rows: min-content;
}
.bento .span-2 { grid-column: 1 / -1; }

.hero-card {
  background:
    radial-gradient(110% 90% at 85% -10%, rgba(255, 183, 123, .2), transparent 55%),
    var(--card);
  border: 1px solid var(--gold-line);
}

/* ---------- misc ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.divider { height: 1px; background: var(--line-soft); border: none; margin: 4px 0; }

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.play-pill {
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}
.play-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-size: 12px;
  flex: none;
}
.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* onboarding */
.onboard {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 32px 26px;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(29, 33, 54, .8), transparent 60%),
    var(--bg);
}

.fade-list > * { animation: fade .3s ease both; }
.fade-list > *:nth-child(2) { animation-delay: .05s; }
.fade-list > *:nth-child(3) { animation-delay: .1s; }
.fade-list > *:nth-child(4) { animation-delay: .15s; }

@media (min-width: 520px) {
  .app-shell { border-inline: 1px solid var(--line-soft); }
}

/* ---------- admin (ממשק ניהול) ---------- */
.admin-page { padding: 22px 18px 60px; display: flex; flex-direction: column; gap: 14px; animation: fade .25s ease; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.field .help { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
textarea.input { resize: vertical; min-height: 74px; line-height: 1.6; }
select.input { appearance: none; }
.badge { font-size: 10.5px; border-radius: 999px; padding: 3px 10px; white-space: nowrap; flex: none; }
.badge--draft { background: rgba(255, 183, 123, .15); color: var(--orange); }
.badge--pub { background: rgba(143, 214, 163, .12); color: #8fd6a3; }
.badge--owner { background: rgba(255, 227, 151, .15); color: var(--gold); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.list-row:hover { background: rgba(255, 255, 255, .02); }
.admin-stat { flex: 1; text-align: center; padding: 14px 8px; }
.admin-stat .num { font-size: 26px; font-weight: 700; color: var(--gold); }
.admin-stat .lbl { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.err { color: #e08f6a; font-size: 13px; }
.preview-pane { border: 1px dashed var(--gold-line-strong); border-radius: var(--r-card); padding: 6px; }
.preview-label { font-size: 10.5px; letter-spacing: 2px; color: var(--muted); text-align: center; padding: 4px 0 8px; }
