/* Kavita Sangrah — mobile first */
:root {
    --text: #1f1f1f;
    --muted: #5f5f5f;
    --faint: #7a7a7a;
    --link: #2d6516;
    --link-hover: #1a3a0a;
    --visited: #6b4f9a;
    --line: #ececec;
    --tap: #f4fae9;
    --bg: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    font-family: 'Noto Sans Devanagari', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

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

/* ── Top bar ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    min-height: 56px;
}
.brand { font-weight: 700; font-size: 1rem; color: var(--text); }
.back {
    font-size: 0.92rem;
    font-weight: 500;
    padding: 10px 0 10px 12px;   /* bigger tap area */
}

.wrap { padding: 24px 16px 48px; }

.page-title { font-size: 1.75rem; font-weight: 700; line-height: 1.3; }
.page-sub { color: var(--muted); font-size: 0.95rem; margin: 2px 0 16px; }

/* ── List: "#N Title" with one gray preview line ── */
.list { list-style: none; }
.list li + li { border-top: 1px solid var(--line); }

.item {
    display: grid;
    grid-template-columns: 2.5rem 1fr;
    align-items: baseline;
    padding: 14px 4px;
    color: inherit;
    border-radius: 8px;
}
.item:active { background: var(--tap); }

.num { font-size: 1.1rem; color: var(--muted); }
.item-body { min-width: 0; }
.item-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--link);
}
.item:visited .item-title { color: var(--visited); }
.item-first {
    display: block;
    font-size: 0.92rem;
    color: var(--faint);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Single poem page ── */
.poem .num { display: block; font-size: 0.95rem; margin-bottom: 2px; }
.poem-title {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 24px;
    text-wrap: balance;
}

.stanza { margin-bottom: 24px; font-size: 1.12rem; line-height: 1.8; }
/* each verse line: wrapped part gets a hanging indent */
.stanza .l {
    display: block;
    padding-left: 1.2em;
    text-indent: -1.2em;
    overflow-wrap: break-word;
}

.sign {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.98rem;
}

/* ── Previous / next ── */
.prevnext {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 32px;
}
.pn {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 16px;
}
.pn:active { background: var(--tap); }
.pn-label { display: block; font-size: 0.82rem; color: var(--muted); }
.pn-title { display: block; font-size: 1.05rem; font-weight: 600; color: var(--link); }
.pn.next { text-align: right; }

.foot {
    border-top: 1px solid var(--line);
    padding: 20px 16px 28px;
    font-size: 0.82rem;
    color: var(--muted);
    text-align: center;
}

/* ── Larger screens ── */
@media (min-width: 640px) {
    .topbar { padding: 0 max(24px, calc((100% - 780px) / 2)); min-height: 64px; }
    .brand { font-size: 1.05rem; }
    .wrap { max-width: 780px; margin: 0 auto; padding: 40px 24px 64px; }
    .page-title { font-size: 2.1rem; }
    .page-sub { margin-bottom: 24px; }
    .item { grid-template-columns: 3.2rem 1fr; padding: 14px 8px; }
    .num { font-size: 1.3rem; }
    .item-title { font-size: 1.35rem; }
    .item-first { font-size: 1rem; }
    .poem-title { font-size: 2.1rem; }
    .stanza { font-size: 1.2rem; line-height: 1.9; }
    .prevnext { flex-direction: row; justify-content: space-between; }
    .pn { flex: 0 1 48%; }
    .pn.next { margin-left: auto; }
}

@media (hover: hover) {
    a:hover { color: var(--link-hover); }
    .item:hover { background: var(--tap); }
    .item:hover .item-title { text-decoration: underline; }
    .pn:hover { background: var(--tap); }
}
