/* حكايات دافية قبل النوم — standalone PWA styles.
   Ports the instinct-files design language (ds-* palette) plus the original style.css. */

:root {
    --ds-ink: #4d3533;
    --ds-ink-2: rgb(77 53 51 / .7);
    --ds-ink-3: rgb(77 53 51 / .5);
    --ds-ink-4: rgb(77 53 51 / .2);
    --ds-hairline: rgb(77 53 51 / .1);
    --ds-page: #f4efec;
    --ds-card: #fdfcfb;
    --ds-muted: #f6f2ef;
    --ds-teal: #73a89a;
    --ds-success-wash: rgb(115 168 154 / .12);
    --ds-radius: 12px;
    --ds-ring: 0 0 0 1px rgb(77 53 51 / .05);
    --ds-lift: 0 1px 2px rgb(77 53 51 / .05);
    --ds-font-display: Georgia, 'Times New Roman', serif;
    --ds-font-text: -apple-system, 'Segoe UI', Tahoma, 'Helvetica Neue', Arial, sans-serif;
}

html, body { margin: 0; min-height: 100%; }
body {
    background: var(--ds-page);
    color: var(--ds-ink);
    font-family: var(--ds-font-text);
    -webkit-font-smoothing: antialiased;
}

.file-card {
    box-sizing: border-box;
    max-width: 640px;
    margin: 24px auto 48px;
    background: var(--ds-card);
    border-radius: var(--ds-radius);
    box-shadow: var(--ds-ring), var(--ds-lift);
    padding: 24px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
@media (max-width: 680px) {
    .file-card { margin: 0 auto; border-radius: 0; min-height: 100dvh; padding: 16px 18px 40px; }
}

/* Top nav */
.file-nav { display: flex; flex-wrap: wrap; gap: 20px; border-bottom: 1px solid var(--ds-hairline); }
.file-nav a { padding: 10px 0; color: var(--ds-ink-2); text-decoration: none; font-size: 15px; }
.file-nav a[aria-current="page"] { color: var(--ds-ink); box-shadow: inset 0 -1px 0 var(--ds-ink); }
@media (max-width: 600px) { .file-nav a { display: inline-flex; align-items: center; min-height: 44px; } }

/* Header block */
.hk-header { display: flex; flex-direction: column; gap: 10px; }
.hk-title {
    font-family: var(--ds-font-display);
    font-size: 30px;
    font-weight: 400;
    line-height: 1.35;
    margin: 0;
}
.hk-fact {
    align-self: flex-start;
    font-size: 13px;
    color: var(--ds-ink-2);
    background: var(--ds-muted);
    border-radius: 999px;
    padding: 4px 12px;
}
.hk-intro { margin: 0; font-size: 15px; line-height: 1.9; color: var(--ds-ink-2); }

/* Groups */
.hk-group { display: flex; flex-direction: column; gap: 10px; }
.hk-group.is-heading { border-top: 1px solid var(--ds-hairline); padding-top: 16px; }
.hk-group-label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ds-ink-3);
}

.hk-para { margin: 0; font-size: 16px; line-height: 1.9; color: var(--ds-ink); }
.hk-caption { margin: 0; font-size: 13px; line-height: 1.7; color: var(--ds-ink-3); }

/* Callout */
.hk-callout {
    background: var(--ds-success-wash);
    border-radius: var(--ds-radius);
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.85;
    color: var(--ds-ink);
}
.hk-callout strong { display: block; margin-bottom: 4px; font-size: 15px; }
.hk-callout p { margin: 0; }

/* Photo */
.hk-photo { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.hk-photo img { width: 100%; border-radius: var(--ds-radius); display: block; }

/* Buttons */
.file-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border-radius: var(--ds-radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    box-sizing: border-box;
}
.file-button.is-compact { min-height: 40px; padding: 0 16px; font-size: 14px; }
.file-button.pill { border-radius: 999px; }
.file-button[data-variant="primary"] { background: var(--ds-ink); color: #fdfcfb; }
.file-button[data-variant="secondary"] { background: transparent; color: var(--ds-ink); border-color: var(--ds-ink-4); }
.file-button[data-variant="ghost"] { background: transparent; color: var(--ds-ink-2); border-color: transparent; }
.file-button:disabled { opacity: .5; cursor: default; }
.file-button:not(:disabled):active { transform: translateY(1px); }

.file-hover-underline { text-decoration: none; }
a:hover .file-hover-underline { text-decoration: underline; text-underline-offset: 3px; }

/* Story index list */
.hekayat-list { display: flex; flex-direction: column; }
.hekayat-story {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 48px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--ds-hairline);
    color: var(--ds-ink);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.6;
}
.hekayat-story:last-child { border-bottom: none; }
.hekayat-story-num {
    flex: none;
    min-width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--ds-hairline);
    color: var(--ds-teal);
    font-weight: 600;
    font-size: 14px;
}

/* Reading view */
.hekayat-body { margin: 8px 0 4px; }
.hekayat-para {
    font-size: 18px;
    line-height: 2.05;
    margin: 0 0 20px;
    color: var(--ds-ink);
    overflow-wrap: break-word;
}
@media (max-width: 480px) {
    .hekayat-para { font-size: 17px; line-height: 1.95; }
}
.hekayat-end {
    text-align: center;
    color: var(--ds-ink-2);
    font-size: 15px;
    margin: 28px 0 8px;
    letter-spacing: 0.02em;
}

/* Call to action row */
.hekayat-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hekayat-cta .file-button { min-height: 44px; }

/* Previous / next navigation */
.hekayat-navrow {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-top: 1px solid var(--ds-hairline);
    padding-top: 16px;
    margin-top: 8px;
}
.hekayat-navrow .file-button { min-height: 44px; }

/* Recorder */
.hekayat-rec { display: flex; flex-direction: column; gap: 10px; }
.hekayat-rec-row { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.hekayat-rec-row .file-button { min-height: 44px; }
.hekayat-rec-status { display: inline-flex; align-items: center; gap: 8px; color: var(--ds-ink-2); font-size: 14px; }
.hekayat-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ds-teal);
    animation: hekayat-pulse 1.2s ease-in-out infinite;
}
@keyframes hekayat-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}
.hekayat-timer { font-variant-numeric: tabular-nums; }
.hekayat-audio { direction: ltr; }

/* Goodnight page */
.hekayat-goodnight { text-align: center; padding: 12px 0 4px; }
.hekayat-goodnight .hekayat-para { margin-bottom: 14px; }
.hekayat-moon { font-size: 40px; margin: 0 0 16px; color: var(--ds-ink-2); }

/* Closing line */
.hk-closing {
    border-top: 1px solid var(--ds-hairline);
    padding-top: 14px;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--ds-ink-3);
}
