@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/PlayfairDisplay-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/PlayfairDisplay-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/PlayfairDisplay-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/PlayfairDisplay-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Rozha One';
    src: url('fonts/RozhaOne-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Arya';
    src: url('fonts/Arya-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --bg-color: #F9F7F2;
    --card-bg: #FFFFFF;
    --text-primary: #2D2D2D;
    --text-secondary: #666666;
    --accent-gold: #B45309;
    --accent-light: #FFF7ED;
    --font-english: 'Playfair Display', serif;
    --font-logo: 'Rozha One', serif;
    --font-sanskrit-heading: 'Arya', sans-serif;
    --font-sanskrit-body: 'Arya', sans-serif;
    --font-footer: 'Inter', sans-serif;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 50px -10px rgba(0, 0, 0, 0.12);
}

html {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body::-webkit-scrollbar {
    display: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-english);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    font-family: var(--font-logo);
    font-size: 1.5rem;
    color: var(--text-primary);
}

.nav-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-english);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.02em;
    padding: 0.5rem 0;
    transition: all 0.1s ease;
    width: 115px;
    text-align: center;
    display: inline-block;
    border-bottom: 1px solid var(--text-secondary);
}

.nav-link:hover{
    color: var(--accent-gold);
    border-bottom: 1px solid var(--accent-gold)
}
.nav-link.active {
    color: var(--accent-gold);
    border-bottom: 1px solid var(--accent-gold);
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    transition: opacity 0.1s ease;
}

.verse-card {
    text-align: center;
    position: relative;
    width: 100%;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 5vh;
}

#verse-content {
    width: 100%;
}

.verse-meta {
    display: flex;
    justify-content: center;
}

#verse-reference,
.verse-pill {
    background-color: var(--accent-light);
    color: var(--accent-gold);
    font-family: var(--font-english);
    padding: 0.6rem 1.2rem;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 700;
    font-style: italic;
    border: 1px solid rgba(180, 83, 9, 0.1);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    cursor: pointer;
    transition: all 0.2s ease;

    outline: none;
    line-height: 1;
}

#verse-reference:hover,
.verse-pill:hover {
    background-color: rgba(180, 83, 9, 0.15);
    transform: translateY(-1px);
}

.verse-pill.loading {
    opacity: 0.7;
    cursor: wait;
}

.share-icon-inline {
    width: 16px;
    height: 16px;
    stroke-width: 2.5px;
    margin-bottom: 2px;
}

#sanskrit-text {
    font-family: var(--font-sanskrit-heading);
    font-size: 2.5rem;
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 400;
    max-width: 800px;
    margin: 2rem auto;
    white-space: pre-wrap;
    text-align: center;
    word-wrap: break-word;
    padding: 0 10px;
}

#translation-text,
.chapter-translation {
    font-family: var(--font-english);
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 700px;
    margin: 0 auto;
    font-style: italic;
    white-space: pre-line;
    text-align: center;

    cursor: pointer;
    user-select: none;

    padding: 5px 0 10px 0;

    opacity: 1;
    filter: blur(0px);
    transform: scale(1);
    transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease;
}

.fading-out {
    opacity: 0 !important;
    filter: blur(8px) !important;
    transform: scale(0.98);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
}

.chapter-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: none;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.03);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chapter-card:hover {
    transform: translateY(-8px);
    box-shadow: none;
    border-color: var(--accent-light);
}

.chapter-card h3 {
    font-family: var(--font-sanskrit-body);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.chapter-card p {
    font-style: italic;
    color: var(--text-secondary);
}

#reader-content h2 {
    font-family: var(--font-sanskrit-heading);
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
    color: var(--text-primary);
}

.back-link {
    background: none;
    border: none;
    color: var(--accent-gold);
    font-family: var(--font-logo);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    padding: 0;
    margin-bottom: 1rem;
    line-height: 1;
    display: inline-block;
    opacity: 0.5;
    width: fit-content;
}

.back-link:hover {
    opacity: 1;
}

.verse-block {
    padding-bottom: 4rem;
    text-align: center;
    max-width: 750px;
    
    /* margin: 0 auto; must come before specific margin overrides */
    margin: 0 auto; 
    margin-bottom: 6rem; /* Increased gap and placed after shorthand */
    
    scroll-margin-top: 20vh; 
}

.sanskrit-verse-line {
    font-family: var(--font-sanskrit-heading);
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.5;
    margin-top: 2rem;
    margin-bottom: 0.25rem; /* Changed from 1rem to 0 to match the top spacing */
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

footer {
    text-align: center;
    padding: 3rem 1rem;
    margin-top: auto;
    font-family: var(--font-footer);
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
    letter-spacing: -0.01em;
}

footer a {
    color: var(--accent-gold);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.1s ease;
}

footer a:hover {
    border-bottom-style: solid;
    opacity: 0.7;
}

.hidden {
    display: none !important;
}

.share-button.icon-only {
    background-color: transparent;
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
    padding: 0.8rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.share-button:active {
    background-color: rgba(180, 83, 9, 0.1);
}

.share-button.loading {
    opacity: 0.5;
    cursor: wait;
}

.share-button.icon-only:hover {
    background-color: rgba(180, 83, 9, 0.05);
}

#shareable-card-wrapper {
    background-color: var(--bg-color);
    padding: 3rem 2rem 0rem 2rem;
    border-radius: 0px;
    border: 2px solid transparent;
    width: 100%;
}

.card-footer {
    font-family: var(--font-logo);
    color: var(--accent-gold);
    font-size: 1.25rem;
    margin-top: 3rem;
    opacity: 0.7;
    display: none;
}

#btn-install-action {
    background-color: var(--accent-gold);
    color: var(--accent-light);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 100px;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(180, 83, 9, 0.3);
    transition: transform 0.2s ease;
    font-family: var(--font-english);
    font-size: 1.2rem;
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.02em;
}

#btn-install-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(180, 83, 9, 0.4);
}

.war-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    z-index: 9999;
    overflow: hidden;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.war-arrow {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 12px;
    opacity: 1;
    offset-rotate: auto;
    transform-origin: center center;
    will-change: transform, offset-path;
}

.war-arrow svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.arrow-left {
    color: var(--text-secondary);
}

.arrow-right {
    color: var(--accent-gold);
}

.arrow-hero {
    filter: drop-shadow(0 0 3px var(--accent-gold));
}

.reader-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
    margin: 0 auto 2rem auto;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.reader-header::before {
    content: "";
    position: absolute;
    top: 0;
    height: 100%;
    left: 0;
    width: 100%;
    z-index: -1;
    background-color: var(--bg-color);
    border-bottom: 1px solid rgba(180, 83, 9, 0.15);
    transition:
        background-color 0.4s ease,
        border-bottom-color 0.4s ease,
        box-shadow 0.4s ease,
        backdrop-filter 0.4s ease,
        -webkit-backdrop-filter 0.4s ease,
        top 0.4s ease,
        height 0.4s ease;
}

.reader-header.stuck::before {
    background-color: var(--bg-color);
    border-bottom: 1px solid rgba(180, 83, 9, 0.15);
    top: -100px;
    height: calc(100% + 100px);
}

.reader-header.stuck {
    background: transparent;
    box-shadow: none;
    border: none;
}

.reader-header-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.reader-header-sub {
    font-family: var(--font-english);
    color: var(--accent-gold);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reader-header-title {
    font-family: var(--font-sanskrit-heading);
    color: var(--text-primary);
    font-size: 1.5rem;
    line-height: 1.2;
    margin: 0;
}

.reader-header .back-link {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding-right: 10px;
    font-size: 1.8rem;
    z-index: 101;
    line-height: 1;
}

#btn-reader-back {
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.reader-header.stuck #btn-reader-back {
    transform: translateY(-50%) rotate(90deg);
}

#btn-chapters-back {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.reader-header.stuck #btn-chapters-back {
    opacity: 0.5;
    pointer-events: auto;
}

.reader-header.stuck #btn-chapters-back:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem 1.5rem 5rem 1.5rem;
    }

    .verse-block,
    #reader-content {
        width: 88% !important;
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }

    .reader-header {
        padding: 1rem 1rem;
        margin: 0 auto 2rem auto;
        width: 100% !important;
        max-width: 100%;
    }

    .reader-header .back-link {
        left: 1rem;
    }

    .reader-header-title {
        font-size: 1.3rem;
    }

    #sanskrit-text,
    .verse-block p {
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
    }

    #sanskrit-text {
        font-size: 2.2rem;
        margin-top: 5rem;
    }

    #reader-content h2 {
        font-size: 2.5rem;
    }

    .sanskrit-verse-line {
        font-size: 2.2rem;
    }

    footer {
        padding-bottom: 2rem;
        font-size: 0.85rem;
    }

    nav {
        justify-content: center;
        gap: 1.5rem;
        flex-direction: column;
        padding: 1.5rem 1rem;
    }

    .logo {
        margin-bottom: 0.5rem;
    }
}