/* Shayari Sansaar - light editorial theme
 * Palette and motion are adapted from the reference site's measured values:
 * base #ECECEB, ink #111111, muted #5C5C5C, accent green #1F9D55,
 * pill buttons, short 0.15-0.3s transitions, rise-in and shine keyframes.
 */
:root {
  --bg: #ECECEB;
  --surface: #FFFFFF;
  --surface-2: #F3F3F2;
  --ink: #111111;
  --muted: #5C5C5C;
  --subtle: #8A8A8A;
  --line: rgba(17, 17, 17, 0.09);
  --accent: #1F9D55;
  --accent-ink: #FFFFFF;
  --radius: 18px;
  --pill: 999px;
  --display: "Tasa Orbiter", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --text: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  overflow-x: hidden;
}
body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(236, 236, 235, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 32px; height: 32px; border-radius: 9px; }
.brand-name { font-family: var(--display); font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--pill);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink); cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn[data-action="back"] svg { fill: none; }
.badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--pill);
  background: var(--accent); color: var(--accent-ink);
  font-size: 0.68rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.badge:empty, .badge[data-zero="1"] { display: none; }

/* Main & views */
main { padding: 16px 16px 24px; max-width: 560px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.view.active > * { animation: os-rise 0.18s ease-out both; }
.view.active > *:nth-child(2) { animation-delay: 0.03s; }
.view.active > *:nth-child(3) { animation-delay: 0.06s; }
@keyframes os-rise {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: none; }
}

/* Surface card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Hero */
.hero { padding: 22px 20px 20px; margin-bottom: 18px; }
.hero-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent);
  background: rgba(31, 157, 85, 0.1);
  padding: 5px 10px; border-radius: var(--pill);
  margin-bottom: 14px;
}
.hero-label::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.hero-text {
  font-family: var(--display);
  font-size: 1.3rem; line-height: 1.5; letter-spacing: -0.01em;
  white-space: pre-line; min-height: 96px;
}
.hero-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* Buttons (pill, like the reference site) */
.pill {
  position: relative; overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: var(--pill);
  font: inherit; font-size: 0.88rem; font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.pill:active { transform: scale(0.97); }
.pill-light {
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.pill-accent { background: var(--accent); border-color: var(--accent); }
/* Shine sweep (adapted from the reference site's bf-shine effect) */
.pill-shine::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,0.35) 50%, transparent 65%) no-repeat;
  background-size: 250% 100%;
  animation: bf-shine 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes bf-shine {
  0% { background-position: 120% 0; }
  50%, 100% { background-position: -20% 0; }
}

/* Marquee of categories (adapted from the reference site's fmt-scroll ticker) */
.ticker {
  overflow: hidden;
  margin: 0 -16px 18px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.ticker-track {
  display: flex; gap: 28px; width: max-content;
  animation: fmt-scroll 26s linear infinite;
  font-family: var(--display); font-size: 0.95rem; color: var(--muted);
  white-space: nowrap;
}
@keyframes fmt-scroll {
  100% { transform: translate(-25%); }
}

.section-title {
  font-family: var(--display);
  font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em;
  margin: 8px 4px 12px;
}

/* Category grid */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat-card {
  position: relative; overflow: hidden;
  min-height: 124px; padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink); text-align: left; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: os-rise 0.18s ease-out both;
}
.cat-card:hover { border-color: rgba(17,17,17,0.2); box-shadow: 0 8px 20px rgba(0,0,0,0.06); }
.cat-card:active { transform: scale(0.97); }
.cat-card .emoji {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  background: var(--tile, var(--surface-2));
}
.cat-card .name { font-family: var(--display); font-size: 1.05rem; font-weight: 600; margin-top: 12px; }
.cat-card .count { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.footnote { text-align: center; color: var(--subtle); font-size: 0.78rem; margin-top: 20px; }

/* List view */
.list-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.list-title { font-family: var(--display); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.list-sub { font-size: 0.84rem; color: var(--muted); margin-top: 2px; }

.search-wrap { margin-bottom: 14px; }
.search-wrap input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-wrap input::placeholder { color: var(--subtle); }
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,157,85,0.15); }

.shayari-list { display: flex; flex-direction: column; gap: 10px; }
.shayari-card {
  padding: 18px 18px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  animation: os-rise 0.18s ease-out both;
}
.shayari-text { font-family: var(--display); font-size: 1.04rem; line-height: 1.6; white-space: pre-line; }
.shayari-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line);
}
.shayari-no { font-size: 0.74rem; color: var(--subtle); }
.act-row { display: flex; gap: 6px; }
.act {
  width: 36px; height: 36px; border-radius: var(--pill);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.act:active { transform: scale(0.92); }
.act svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.act.liked { color: #fff; background: var(--accent); border-color: var(--accent); }
.act.liked svg { fill: #fff; }
.act.pop { animation: heart-pop 0.3s ease-out; }
@keyframes heart-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.empty { text-align: center; color: var(--muted); padding: 40px 10px; line-height: 1.6; }
.loading-box { text-align: center; color: var(--muted); padding: 30px; }

/* About */
.about-card { padding: 20px; line-height: 1.7; display: flex; flex-direction: column; gap: 12px; color: var(--muted); }
.about-card a { color: var(--ink); text-underline-offset: 3px; }

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(236, 236, 235, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav-item {
  background: none; border: none; color: var(--subtle); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; font: inherit; font-size: 0.7rem; font-weight: 500;
  transition: color 0.15s ease;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--ink); }
.nav-item.active svg { color: var(--accent); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: var(--pill);
  font-size: 0.86rem; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Reduced motion: respect the user's OS setting */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 360px) {
  .cat-grid { gap: 10px; }
  .cat-card { min-height: 112px; padding: 14px 12px; }
  .hero-text { font-size: 1.15rem; }
}

/* ===== v2 premium layer ===== */
/* Card lift with layered shadow (pattern from reference cards) */
.shayari-card, .cat-card {
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.32s cubic-bezier(0.2, 0.7, 0.3, 1), border-color 0.2s ease;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.04), 0 14px 30px -20px rgba(0,0,0,0.35);
}
.shayari-card { cursor: pointer; }
.shayari-card:hover, .cat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.05), 0 22px 40px -22px rgba(0,0,0,0.4);
}
.shayari-card:active { transform: scale(0.985); }

/* Skeleton shimmer while content loads (pattern: os-shimmer) */
.skeleton {
  border-radius: var(--radius); min-height: 124px;
  background: linear-gradient(100deg, #f1f1f0 30%, #ffffff 50%, #f1f1f0 70%);
  background-size: 200% 100%;
  animation: os-shimmer 1.4s linear infinite;
  border: 1px solid var(--line);
}
@keyframes os-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}

/* Bottom sheet for full-screen reading (pattern: os-sheet-in / os-backdrop-in) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(17,17,17,0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-width: 560px; margin: 0 auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,0.35);
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.sheet.open { transform: translateY(0); }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 16px; }
.sheet-cat { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.sheet-text { font-family: var(--display); font-size: 1.35rem; line-height: 1.5; white-space: pre-line; min-height: 110px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.sheet-actions .pill { flex: 1 1 auto; }

/* Staggered reveal for list items */
.shayari-card:nth-child(n) { animation: os-rise 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both; }

/* Playful wobble for the favorites nav when something is saved */
.badge.bump { animation: heart-pop 0.35s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .skeleton, .sheet, .sheet-backdrop { animation: none !important; transition: none !important; }
}

.dot-sep { color: var(--subtle); margin: 0 -10px; }
.cat-card .emoji img { display: block; }

/* Website graphics v3 */
.hero { position: relative; overflow: hidden; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.hero > *:not(.hero-art) { position: relative; z-index: 1; }
.state-box { text-align: center; padding: 28px 16px; color: var(--muted); }
.state-box img { width: 140px; height: auto; display: block; margin: 0 auto 12px; }
.state-box strong { display: block; color: var(--ink); font-family: var(--display); font-size: 1.05rem; margin-bottom: 4px; }
.state-box button { margin-top: 12px; }
