/* Kids Stories — storybook layout */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --ink: #2b2340;
    --muted: #6e647c;
    --paper: #f7f1e6;
    --card: #fffdf8;
    --coral: #e86a45;
    --coral-deep: #cf5533;
    --teal: #147f7a;
    --gold: #e2a322;
    --line: #efe4d2;
    --shadow: 0 14px 34px rgba(70, 42, 24, 0.08);
    --header-h: 76px;
}

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

body {
    font-family: 'Cairo', sans-serif;
    direction: inherit;
    text-align: start;
    background:
        radial-gradient(circle at 12% -10%, rgba(255, 196, 120, 0.45), transparent 36%),
        radial-gradient(circle at 100% 0%, rgba(126, 196, 214, 0.35), transparent 32%),
        var(--paper);
    min-height: 100vh;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    line-height: 1.7;
}

img {
    max-width: 100%;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 253, 248, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.navbar {
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.35rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--ink);
    line-height: 1.2;
    white-space: nowrap;
}

.logo::before {
    content: "📚";
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #fff1e8;
    font-size: 1.35rem;
}

.nav-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-inline-start: auto;
}

.lang-switch {
    display: flex;
    gap: 0.15rem;
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.15rem;
}

.lang-switch a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.82rem;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.lang-switch a.active {
    background: #fff1e8;
    color: var(--coral-deep);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    padding: 10px;
}

.nav-toggle-bar {
    display: block;
    height: 2px;
    margin: 5px 0;
    background: var(--ink);
    border-radius: 2px;
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-menu a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    white-space: nowrap;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: #fff1e8;
    color: var(--coral-deep);
}

/* Main */
.main-content {
    flex: 1;
    padding: 1.75rem 0 3rem;
}

.hero-section {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 3.2rem 1.5rem 2.2rem;
    border-radius: 28px;
    margin-bottom: 2.5rem;
    color: white;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 214, 140, 0.55), transparent 28%),
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.22), transparent 24%),
        linear-gradient(145deg, #f08a4b 0%, #e15b64 46%, #7c5cdb 100%);
    box-shadow: var(--shadow);
}

.hero-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 0.75rem;
    color: white;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.94);
    max-width: 680px;
    margin: 0 auto 1.5rem;
}

.section-title {
    text-align: center;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    color: var(--ink);
    margin-bottom: 1.4rem;
    font-weight: 800;
}

.categories-section,
.featured-section,
.recent-section {
    margin-bottom: 3rem;
}

/* Search */
.search-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 0 auto 1.5rem;
    max-width: 560px;
}

.search-form,
.newsletter-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    background: white;
    border-radius: 999px;
    padding: 0.35rem;
    box-shadow: 0 10px 24px rgba(43, 35, 64, 0.12);
}

.search-input,
.newsletter-form input,
.filter-group input,
.filter-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: white;
}

.search-input {
    border: 0;
    background: transparent;
    padding-inline: 1.1rem;
}

.search-input:focus,
.newsletter-form input:focus,
.filter-group input:focus,
.filter-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--teal);
}

.search-btn,
.btn,
.newsletter-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    font-weight: 800;
    color: white;
    background: var(--coral);
    border-radius: 999px;
    padding: 0.75rem 1.25rem;
    transition: background 0.2s ease, transform 0.2s ease;
}

.search-btn:hover,
.btn:hover,
.newsletter-form button:hover {
    background: var(--coral-deep);
}

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-secondary:hover {
    background: white;
}

.btn-like {
    background: #e15b64;
}

.btn-like.is-liked {
    background: #9d3040;
    box-shadow: inset 0 0 0 2px #fff;
}

.btn-share {
    background: var(--teal);
}

/* Stats */
.stats-container,
.stories-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    max-width: 680px;
    margin: 0.5rem auto 0;
}

.stories-stats {
    max-width: 420px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 18px;
    padding: 0.85rem 0.4rem;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
    color: white;
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.92rem;
}

.page-header .stat-item,
.stories-stats .stat-item {
    background: white;
    border-color: var(--line);
}

.page-header .stat-number,
.stories-stats .stat-number,
.page-header .stat-label,
.stories-stats .stat-label {
    color: var(--ink);
}

/* Categories and stories */
.categories-grid,
.stories-grid {
    display: grid;
    gap: 1rem;
}

.categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.stories-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.category-card,
.story-card,
.story-detail,
.comments-section,
.page-header,
.filters-section,
.newsletter-section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.category-card {
    display: flex;
    flex-direction: column;
    padding: 1.15rem 0.8rem 1rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-card.has-cover {
    padding: 0;
}

.category-cover {
    width: 100%;
    height: 148px;
    object-fit: cover;
    display: block;
}

.category-card-body {
    padding: 0.9rem 0.95rem 1rem;
}

.categories-page .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.categories-page .category-cover {
    height: 168px;
}

.categories-page .category-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.45rem;
}

.categories-page .story-count {
    color: white;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.categories-page .category-title {
    margin-bottom: 0.35rem;
}

.categories-page .category-description {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 0.7rem;
}

.categories-page .category-footer {
    display: flex;
    justify-content: space-between;
    color: var(--coral-deep);
    font-weight: 800;
}

.category-page .breadcrumbs {
    margin-bottom: 1rem;
}

.category-hero {
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 5px solid var(--category-color, var(--coral));
    border-radius: 26px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 1.75rem;
}

.category-hero-cover {
    position: relative;
    height: 240px;
    background: color-mix(in srgb, var(--category-color, var(--coral)) 18%, white);
}

.category-hero-cover img,
.category-hero-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.category-hero-fallback {
    display: grid;
    place-items: center;
    font-size: 4rem;
}

.category-hero-badge {
    position: absolute;
    inset-inline-start: 1.25rem;
    bottom: -22px;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    background: white;
    border-radius: 18px;
    border: 3px solid color-mix(in srgb, var(--category-color, var(--coral)) 40%, white);
    box-shadow: 0 10px 20px rgba(70, 42, 24, 0.12);
    font-size: 1.7rem;
}

.category-hero-body {
    padding: 2.15rem 1.4rem 1.35rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--category-color, var(--coral)) 9%, white), var(--card) 78px);
}

.category-hero-body h1 {
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    line-height: 1.3;
    margin-bottom: 0.35rem;
}

.category-hero-description {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 0.95rem;
    max-width: 42rem;
}

.category-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-hero-stat {
    background: white;
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 0.28rem 0.8rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.92rem;
}

.stories-section {
    margin-bottom: 0.5rem;
}

.stories-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stories-toolbar h2 {
    font-size: 1.35rem;
    color: var(--ink);
}

.stories-count {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.92rem;
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.32rem 0.85rem;
    white-space: nowrap;
}

.category-page .no-stories {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.category-page .empty-state {
    text-align: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 2.4rem 1.4rem;
    max-width: 520px;
}

.category-page .empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.6rem;
}

.category-page .empty-state h3 {
    color: var(--ink);
    font-size: 1.35rem;
    margin-bottom: 0.4rem;
}

.category-page .empty-state p {
    color: var(--muted);
    margin-bottom: 1.2rem;
}

.category-page .empty-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}

.category-page .pagination-section {
    margin-top: 1.6rem;
    display: flex;
    justify-content: center;
}

.category-card:hover,
.story-card:hover,
.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(70, 42, 24, 0.12);
}

.related-categories {
    margin-top: 2.75rem;
    padding: 1.5rem 1.15rem 1.35rem;
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 196, 120, 0.28), transparent 42%),
        var(--card);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.related-categories .section-title {
    margin-bottom: 1.15rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.related-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    background: #fffdf8;
    border: 1px solid var(--line);
    border-top: 4px solid var(--related-color, var(--coral));
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-cover {
    position: relative;
    display: block;
    height: 138px;
    background: color-mix(in srgb, var(--related-color, #e86a45) 18%, white);
}

.related-cover img,
.related-cover-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.related-cover-fallback {
    display: grid;
    place-items: center;
    font-size: 2.6rem;
}

.related-badge {
    position: absolute;
    inset-inline-start: 0.75rem;
    bottom: -15px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(70, 42, 24, 0.12);
    font-size: 1.15rem;
}

.related-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem 0.95rem 0.95rem;
}

.related-name {
    font-weight: 800;
    color: var(--ink);
    font-size: 1.05rem;
    line-height: 1.45;
}

.related-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.related-count {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.88rem;
}

.related-count::before {
    content: "";
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-inline-end: 0.35rem;
    border-radius: 50%;
    background: var(--related-color, var(--coral));
    vertical-align: 0.05em;
}

.related-go {
    color: var(--related-color, var(--coral-deep));
    font-weight: 800;
}

.category-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.35rem;
}

.category-title,
.story-title {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.45;
    color: var(--ink);
}

.category-count,
.story-summary,
.page-description {
    color: var(--muted);
}

.story-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    min-height: 100%;
    position: relative;
}

.featured-badge {
    position: absolute;
    top: 0.7rem;
    inset-inline-start: 0.7rem;
    z-index: 1;
    background: #fff4d8;
    color: #8a5a00;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

.story-image,
.placeholder-image {
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: linear-gradient(160deg, #ffe7c2, #f7c1b0 55%, #d7c4f5);
}

.placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-text {
    font-size: 3rem;
}

.story-card .story-content {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1rem 1rem 1.1rem;
    flex: 1;
}

.story-category {
    display: inline-flex;
    align-self: flex-start;
    background: var(--teal);
    color: white;
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.story-card .story-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3rem;
}

.story-card .story-summary {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.6;
}

.story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    margin-top: auto;
    color: var(--muted);
    font-size: 0.84rem;
}

.age-group {
    background: #fff4d8;
    color: #8a5a00;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-weight: 700;
}

.section-footer {
    text-align: center;
    margin-top: 1.4rem;
}

/* Inner pages */
.page-header {
    text-align: center;
    padding: 2rem 1.2rem;
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    margin-bottom: 0.4rem;
}

.filters-section {
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.filter-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span,
.page-link,
.page-current {
    min-width: 40px;
    padding: 0.4rem 0.75rem;
    border-radius: 12px;
    text-decoration: none;
    text-align: center;
    background: white;
    color: var(--ink);
    border: 1px solid var(--line);
}

.pagination .current,
.page-current {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
}

/* Story reading */
.story-detail-container {
    display: grid;
    gap: 1rem;
}

.breadcrumbs {
    color: var(--muted);
    font-size: 0.92rem;
}

.breadcrumbs a {
    color: var(--teal);
    text-decoration: none;
    font-weight: 700;
}

.story-header {
    text-align: center;
}

.story-header .story-title {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    margin: 0.6rem 0;
}

.story-detail,
.comments-section {
    padding: 1.4rem;
}

.story-main-image,
.story-main-image-container img {
    width: min(100%, 760px);
    height: auto;
    max-height: 440px;
    object-fit: cover;
    border-radius: 18px;
    display: block;
    margin: 0 auto;
}

.story-text {
    font-size: 1.12rem;
    line-height: 2;
    color: #3a3148;
}

.story-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.story-images img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 14px;
}

.story-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.form-group {
    margin-bottom: 0.9rem;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

/* Newsletter */
.newsletter-section {
    max-width: 720px;
    margin: 0.5rem auto 0;
    padding: 1.8rem 1.2rem;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255, 244, 230, 0.9), #fffdf8);
}

.newsletter-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.newsletter-content p {
    color: var(--muted);
    margin-bottom: 1rem;
}

.newsletter-form {
    max-width: 480px;
    margin: 0 auto;
}

.newsletter-form input {
    border: 0;
    background: transparent;
}

/* Footer */
.footer {
    background: #241c33;
    color: #f4efe6;
    padding: 2rem 0 1.4rem;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-logo {
    font-size: 1.2rem;
    font-weight: 800;
}

.footer-links,
.social-links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.1rem;
}

.footer-links a,
.social-link {
    color: #d9d0c4;
    text-decoration: none;
    font-size: 0.92rem;
}

.footer-links a:hover,
.social-link:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    color: #b7adbe;
    font-size: 0.85rem;
}

.footer-bottom p {
    margin: 0.15rem 0;
}

.alert {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    font-weight: 700;
}

.alert-success {
    background: #e7f7ef;
    color: #146c43;
}

.alert-error {
    background: #fdecea;
    color: #9d2c2c;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 160px;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #f3e7d8;
    border-top-color: var(--coral);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
    .stories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filters-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .nav-toggle {
        display: inline-block;
    }

    .navbar {
        gap: 0.6rem;
    }

    .logo {
        min-width: 0;
        font-size: 1.12rem;
    }

    .logo::before {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 1.15rem;
        flex-shrink: 0;
    }

    .logo-text {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-tools {
        flex-shrink: 0;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: calc(var(--header-h) - 6px);
        right: 16px;
        left: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 0.6rem;
        background: white;
        border: 1px solid var(--line);
        border-radius: 18px;
        box-shadow: var(--shadow);
    }

    .nav-menu.is-open {
        display: flex;
    }

    .nav-menu a {
        display: block;
        padding: 0.7rem 0.9rem;
    }

    .header {
        position: sticky;
    }

    .navbar {
        position: relative;
    }
}

@media (max-width: 400px) {
    .logo {
        font-size: 1rem;
    }

    .lang-switch a {
        font-size: 0.75rem;
        padding: 0.22rem 0.42rem;
    }
}

@media (max-width: 340px) {
    .logo::before {
        display: none;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(1120px, calc(100% - 20px));
    }

    .hero-section {
        padding: 2.2rem 1rem 1.5rem;
        border-radius: 22px;
    }

    .stats-container,
    .stories-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .categories-grid,
    .stories-grid,
    .related-grid,
    .filters-form {
        grid-template-columns: 1fr;
    }

    .related-card {
        flex-direction: row;
        align-items: stretch;
    }

    .related-cover {
        width: 112px;
        height: auto;
        min-height: 92px;
        flex-shrink: 0;
    }

    .related-badge {
        inset-inline-start: 0.4rem;
        bottom: 0.4rem;
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }

    .related-body {
        justify-content: center;
        padding: 0.75rem 0.85rem;
    }

    .category-hero-cover {
        height: 180px;
    }

    .category-hero-badge {
        width: 48px;
        height: 48px;
        bottom: -18px;
        font-size: 1.35rem;
        border-radius: 14px;
    }

    .category-hero-body {
        padding: 1.7rem 1rem 1.1rem;
    }

    .stories-toolbar {
        align-items: center;
    }

    .search-form,
    .newsletter-form {
        border-radius: 18px;
    }

    .footer-content,
    .footer-links,
    .social-links {
        justify-content: center;
        text-align: center;
    }
}

/* App download */
.app-download {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin: 1.25rem 0;
    padding: 1.1rem 1.2rem;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-inline-start: 6px solid var(--teal);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.app-download img,
.get-app-panel img {
    flex-shrink: 0;
    background: white;
    border-radius: 16px;
    padding: 6px;
    object-fit: contain;
    opacity: 1 !important;
}

.app-download img {
    width: 132px;
    height: 132px;
}

.app-download-copy h3,
.get-app-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.app-download-copy p,
.get-app-lead,
.get-app-note {
    color: var(--muted);
}

.app-download-copy p {
    margin-bottom: 0.75rem;
}

.app-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--coral);
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    font-weight: 800;
    color: white;
    background: var(--coral);
    border-radius: 999px;
    padding: 0.7rem 1.2rem;
}

.app-download-btn:hover {
    background: var(--coral-deep);
    border-color: var(--coral-deep);
    color: white;
}

.app-download-btn-secondary {
    background: transparent;
    color: var(--teal);
    border-color: var(--teal);
}

.app-download-btn-secondary:hover {
    background: var(--teal);
    color: white;
}

.get-app {
    padding: 1.5rem 0 2rem;
}

.get-app-kicker {
    color: var(--teal);
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.get-app-lead {
    max-width: 40rem;
    margin-bottom: 0.5rem;
}

.get-app-panel {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.get-app-panel img {
    width: 220px;
    height: 220px;
}

.get-app-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.85rem 0;
}

.get-app-note {
    font-size: 0.92rem;
}

.footer .app-download {
    margin-bottom: 1.2rem;
}

@media (max-width: 640px) {
    .app-download,
    .get-app-panel {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .app-download img,
    .get-app-panel img {
        margin-inline: auto;
    }

    .get-app-actions,
    .app-download-copy {
        justify-content: center;
    }
}

/* Story print sheet — hidden on screen */
.print-only {
    display: none;
}

@media print {
    body.story-page {
        page: story-sheet;
        background: #fff !important;
        color: #111 !important;
        min-height: 0 !important;
    }

    @page story-sheet {
        margin: 14mm 14mm 18mm;
    }

    body.story-page .header,
    body.story-page .footer,
    body.story-page .breadcrumbs,
    body.story-page .story-category,
    body.story-page .story-meta,
    body.story-page .story-actions,
    body.story-page .comments-section,
    body.story-page .related-stories,
    body.story-page .image-modal,
    body.story-page .app-download {
        display: none !important;
    }

    body.story-page .main-content,
    body.story-page .container,
    body.story-page .story-detail-container,
    body.story-page .story-detail,
    body.story-page .story-summary,
    body.story-page .story-content,
    body.story-page .story-images-section {
        background: transparent !important;
        box-shadow: none !important;
        border: 0 !important;
        border-radius: 0 !important;
        max-width: none !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .story-header,
    .story-title,
    .story-text,
    .story-summary,
    .story-summary h3,
    .story-summary p,
    .story-content h3,
    .story-images-section h3 {
        color: #111 !important;
        text-shadow: none !important;
    }

    .story-summary {
        margin-bottom: 1rem !important;
    }

    .story-title {
        font-size: 22pt !important;
        margin: 0 0 0.6rem !important;
    }

    .story-text {
        font-size: 12.5pt !important;
        line-height: 1.85 !important;
    }

    .story-main-image,
    .story-image-item img {
        box-shadow: none !important;
        border-radius: 0 !important;
        max-height: 240px !important;
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }

    .story-main-image-container,
    .story-image-item,
    .print-sheet-header {
        break-inside: avoid;
    }

    .print-only {
        display: flex !important;
    }

    .print-sheet-header {
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        border-bottom: 2px solid #222;
        padding-bottom: 0.55rem;
        margin-bottom: 1.1rem;
    }

    .print-brand {
        display: flex;
        align-items: center;
        gap: 0.65rem;
    }

    .print-logo {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border: 1px solid #ccc;
        border-radius: 12px;
        font-size: 1.35rem;
        background: #fff;
    }

    .print-site-name {
        font-size: 16pt;
        font-weight: 800;
        line-height: 1.2;
        color: #111;
    }

    .print-tagline,
    .print-date,
    .print-sheet-footer {
        font-size: 10pt;
        color: #333 !important;
    }

    .print-date {
        text-align: end;
        white-space: nowrap;
    }

    .print-sheet-footer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        justify-content: space-between;
        gap: 1rem;
        border-top: 1px solid #222;
        padding-top: 0.35rem;
        background: #fff;
    }

    body.story-page .main-content {
        padding-bottom: 12mm !important;
    }

    body.printable-page .story-main-image,
    body.printable-page .story-image-item img {
        max-height: none !important;
        width: 100% !important;
    }

    body.printable-page .story-image-item {
        break-before: page;
    }
}

.printable-page .story-main-image-container {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0.75rem;
    box-shadow: var(--shadow);
}

.printable-page .btn-print {
    background: var(--coral);
}

/* About */
.about-page {
    display: flex;
    flex-direction: column;
    gap: 2.6rem;
}

.about-page .section-title::after {
    content: "";
    display: block;
    width: 52px;
    height: 4px;
    margin: 0.55rem auto 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--coral), var(--gold));
}

.about-intro {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.about-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.75fr);
    gap: 1.5rem;
    align-items: center;
    position: relative;
    overflow: hidden;
    text-align: start;
    padding: 2.4rem 2rem;
    border-radius: 28px;
    color: white;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 214, 140, 0.5), transparent 26%),
        radial-gradient(circle at 92% 8%, rgba(255, 255, 255, 0.2), transparent 22%),
        linear-gradient(145deg, #f08a4b 0%, #e15b64 48%, #7c5cdb 100%);
    box-shadow: var(--shadow);
}

.about-hero::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    inset-inline-end: -50px;
    bottom: -70px;
    pointer-events: none;
}

.about-hero-copy,
.about-book {
    position: relative;
    z-index: 1;
}

.about-hero .hero-title,
.about-hero .hero-subtitle {
    text-align: start;
    margin-inline: 0;
}

.about-hero .hero-subtitle {
    max-width: 36rem;
    margin-bottom: 1.25rem;
}

.about-book {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    min-height: 210px;
    border-radius: 6px 18px 18px 6px;
    overflow: hidden;
    color: var(--ink);
    background: #fffdf8;
    box-shadow: 0 18px 36px rgba(43, 35, 64, 0.22);
    transform: rotate(-7deg);
}

.about-book-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.7rem;
    padding: 1.3rem 0.9rem;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent,
            transparent 26px,
            rgba(226, 163, 34, 0.45) 27px
        );
}

.about-book-page > span:not(.about-book-mark) {
    display: block;
    height: 7px;
    border-radius: 999px;
    background: rgba(43, 35, 64, 0.12);
}

.about-book-page > span:nth-child(2) { width: 86%; }
.about-book-page > span:nth-child(3) { width: 72%; }
.about-book-page > span:nth-child(4) { width: 58%; }

.about-book-page-front {
    align-items: flex-start;
    justify-content: center;
    gap: 0.25rem;
    padding: 1.2rem 1rem;
    background: #fff7ee;
    border-inline-start: 3px solid #ead4b4;
}

.about-book-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    margin-bottom: 0.35rem;
    border-radius: 14px;
    background: #fff1e8;
    font-size: 1.4rem;
}

.about-book-page-front strong {
    font-size: 1.15rem;
    line-height: 1.3;
}

.about-book-page-front em {
    font-style: normal;
    font-weight: 700;
    color: var(--coral-deep);
}

.about-kicker {
    font-weight: 800;
    color: var(--coral-deep);
    margin-bottom: 0.35rem;
}

.about-kicker-light {
    color: #ffe7c2;
}

.about-actions {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.about-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 800;
    border-radius: 999px;
    padding: 0.75rem 1.25rem;
    background: white;
    color: var(--coral-deep);
}

.about-btn:hover {
    background: #fff6ef;
}

.about-btn-line {
    background: transparent;
    color: white;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.65);
}

.about-btn-line:hover {
    background: rgba(255, 255, 255, 0.14);
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.about-stats .stat-item {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.about-stats .stat-number {
    color: var(--coral-deep);
}

.about-stats .stat-label {
    color: var(--muted);
}

.about-split {
    display: grid;
    grid-template-columns: 1.35fr 0.85fr;
    gap: 1rem;
    align-items: stretch;
}

.about-panel,
.about-card,
.about-cta {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.about-panel,
.about-card {
    padding: 1.35rem 1.25rem;
}

.about-panel h2,
.about-card h2,
.about-card h3,
.about-cta h2 {
    font-size: 1.35rem;
    line-height: 1.35;
    margin-bottom: 0.55rem;
}

.about-panel p,
.about-card p,
.about-lead,
.about-cta p {
    color: var(--muted);
}

.about-panel p + p {
    margin-top: 0.8rem;
}

.about-story {
    background:
        radial-gradient(circle at 0% 0%, rgba(226, 163, 34, 0.16), transparent 34%),
        var(--card);
}

.about-panel-accent {
    color: white;
    background:
        radial-gradient(circle at 100% 0%, rgba(226, 163, 34, 0.35), transparent 42%),
        #2b2340;
    border-color: #2b2340;
}

.about-panel-accent .about-kicker {
    color: #f0c27a;
}

.about-panel-accent h2,
.about-panel-accent .about-promises li {
    color: white;
}

.about-promises {
    list-style: none;
    display: grid;
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.about-promises li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
    font-weight: 700;
}

.about-promises li span:last-child {
    min-width: 0;
    flex: 1;
}

.about-promises li span:first-child {
    width: 2.1rem;
    height: 2.1rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
}

.about-grid {
    display: grid;
    gap: 0.9rem;
}

.about-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.about-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.about-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.about-card {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

a.about-card:hover {
    border-color: #f0c7b4;
    transform: translateY(-2px);
}

.about-card-warm {
    background:
        radial-gradient(circle at 100% 0%, rgba(232, 106, 69, 0.16), transparent 42%),
        var(--card);
    border-color: #f3d2c2;
}

.about-card-cool {
    background:
        radial-gradient(circle at 0% 100%, rgba(20, 127, 122, 0.14), transparent 46%),
        var(--card);
    border-color: #c9e6e3;
}

.about-path .about-step {
    display: block;
    font-size: 1.8rem;
    line-height: 1;
    margin-bottom: 0.75rem;
    color: var(--coral);
}

.about-age h3 {
    color: var(--teal);
    font-size: 1.45rem;
}

.about-values .about-card:nth-child(3n + 1) { border-top: 4px solid var(--coral); }
.about-values .about-card:nth-child(3n + 2) { border-top: 4px solid var(--teal); }
.about-values .about-card:nth-child(3n) { border-top: 4px solid var(--gold); }

.about-role-index {
    display: block;
    margin-bottom: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--teal);
}

.about-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 0.75rem;
    border-radius: 16px;
    background: #fff1e8;
    font-size: 1.4rem;
}

.about-step {
    display: inline-block;
    margin-bottom: 0.65rem;
    font-weight: 800;
    color: var(--teal);
}

.about-lead {
    text-align: center;
    max-width: 640px;
    margin: -0.6rem auto 1.1rem;
}

.about-cta {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 0;
    overflow: hidden;
    color: var(--ink);
    background: var(--card);
}

.about-cta > div {
    padding: 1.6rem 1.4rem;
}

.about-cta p {
    margin-bottom: 1rem;
}

.about-cta .about-btn {
    background: var(--coral);
    color: white;
}

.about-cta .about-btn:hover {
    background: var(--coral-deep);
}

.about-cta-side {
    color: white;
    background:
        radial-gradient(circle at 12% 20%, rgba(255, 214, 140, 0.35), transparent 28%),
        linear-gradient(145deg, #f08a4b 0%, #e15b64 48%, #7c5cdb 100%);
}

.about-cta-side h2,
.about-cta-side p {
    color: white;
}

.about-cta-side .about-btn {
    background: white;
    color: var(--coral-deep);
    box-shadow: none;
}

.about-cta-side .about-btn:hover {
    background: #fff6ef;
}

@media (max-width: 980px) {
    .about-hero,
    .about-grid-3,
    .about-split,
    .about-cta {
        grid-template-columns: 1fr;
    }

    .about-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .about-book {
        display: none;
    }

    .about-hero,
    .about-hero .hero-title,
    .about-hero .hero-subtitle {
        text-align: center;
    }

    .about-hero .hero-subtitle {
        margin-inline: auto;
    }

    .about-actions {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .about-hero {
        padding: 1.8rem 1.1rem;
        border-radius: 22px;
    }

    .about-stats,
    .about-grid-2,
    .about-grid-4 {
        grid-template-columns: 1fr 1fr;
    }
}

.sheet-page {
    padding-bottom: 2rem;
}

.sheet-article {
    background: #fff;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.sheet-copy h1 {
    margin-bottom: 0.4rem;
}

.sheet-age,
.sheet-copy p {
    color: var(--muted);
}

.sheet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0 1.25rem;
}

.sheet-stage {
    background: #f7f4ef;
    border-radius: 16px;
    overflow: hidden;
}

.sheet-stage img,
.sheet-stage iframe {
    display: block;
    width: 100%;
    min-height: 70vh;
    border: 0;
    background: #fff;
}

.sheet-stage img {
    height: auto;
    min-height: 0;
    object-fit: contain;
}

@media print {
    header,
    footer,
    .breadcrumbs,
    .sheet-actions,
    .stories-section,
    .nav-tools {
        display: none !important;
    }

    body.printable-sheet,
    body.printable-sheet .main-content,
    body.printable-sheet .container,
    .sheet-page,
    .sheet-article,
    .sheet-stage {
        background: #fff !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }

    .sheet-stage img,
    .sheet-stage iframe {
        min-height: 0;
        max-height: none;
    }
}
