/* ==================================================
   OVERLAY
================================================== */

.overlay{

    position:fixed;

    inset:0;

    background:rgba(0,0,0,.35);

    opacity:0;

    visibility:hidden;

    transition:.25s;

    z-index:998;

}

.overlay.show{

    opacity:1;

    visibility:visible;

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {

    font-family: "Literata", serif;

    background: #f8f8f6;

    color: #333;

    font-size: 17px;

    line-height: 2;

}

/* ==================================================
   DRAWER MENU
================================================== */

.drawer{

    position:fixed;

    top:0;
    left:0;

    transform:translateX(-100%);

    width:280px;
    height:100dvh;

    background:#fff;

    overflow-y:auto;
    -webkit-overflow-scrolling:touch;

    transition:transform .3s;

    box-shadow:4px 0 20px rgba(0,0,0,.12);

    z-index:1000;

    padding:24px;

}

.drawer.open{

    transform:translateX(0);

}

.drawer-header{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin-bottom:20px;

}

.drawer-header button{

    border:none;

    background:none;

    font-size:24px;

    cursor:pointer;

}

.drawer h3{

    font-size:15px;

    color:#666;

    margin:24px 0 12px;

}

.drawer hr{

    border:none;

    border-top:1px solid #eee;

    margin:18px 0;

}
.drawer nav{

    display:flex;

    flex-direction:column;

    gap:8px;

}

.drawer nav a{

    text-decoration:none;

    color:#333;

    padding:8px 10px;

    border-radius:8px;

    transition:

    background .2s,

    color .2s;

}

.drawer nav a:hover{

    background:#eef6f3;

}

.drawer button{

    width:100%;

    padding:10px 12px;

    margin-bottom:8px;

    border:none;

    border-radius:8px;

    background:#f4f4f4;

    cursor:pointer;

    font-size:15px;

}

.drawer button:hover{

    background:#e9e9e9;

}
/* ==================================================
   TOP BAR
================================================== */

.topbar {

    position: sticky;

    top: 0;
	
	left:0;

	right:0;

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 12px 18px;

    background: rgba(248,248,246,.92);

    backdrop-filter: blur(10px);

    border-bottom: 1px solid #e9e9e9;

    z-index: 900;

}

.topbar a {

    color: #2d665d;

    text-decoration: none;

    font-weight: 600;

}

.topbar button {

    background: none;

    border: none;

    font-size: 24px;

    cursor: pointer;

}


/* ==================================================
   KHUNG ĐỌC
================================================== */

.reader{

    width:min(100%,680px);

    margin:auto;

    padding:36px 22px 80px;

	transition:font-size .2s;

}


/* ==================================================
   TÊN SÁCH
================================================== */

.reader h1 {

    font-size: 34px;

    line-height: 1.35;

    margin-bottom: 28px;

    color: #222;

}


/* ==================================================
   FLOATING PROGRESS
================================================== */

.floating-progress{

    position:sticky;

    top:57px;

    display:flex;

    align-items:center;

    gap:14px;

    padding:10px 18px;

    background:rgba(248,248,246,.95);

    backdrop-filter:blur(10px);

    border-bottom:1px solid #ececec;

    z-index:890;


    /* trạng thái ẩn */

    opacity:0;

    visibility:hidden;

    transform:translateY(-100%);

    transition:

        transform .35s cubic-bezier(.4,0,.2,1),

        opacity .25s ease,

        visibility .35s;


}


.floating-progress.show{

    opacity:1;

    visibility:visible;

    transform:translateY(0);

}

.progress-track{

    flex:1;

    height:4px;

    background:#ddd;

    border-radius:99px;

    overflow:hidden;

}

.progress-bar{

    width:0;

    height:100%;

    background:#3d8c73;

    transition:width .15s linear;

}

.progress-text{

    white-space:nowrap;

    font-size:13px;

    color:#666;

    font-weight:600;

}

/* ==================================================
   NỘI DUNG
================================================== */

section {

    margin-bottom: 70px;

    scroll-margin-top: 80px;

}

section h2 {

    font-size: 26px;

    line-height: 1.5;

    color: #222;

    margin-bottom: 28px;

    padding-bottom: 18px;

    border-bottom: 1px solid #ececec;

}

section p {

    margin-bottom: 30px;

}


/* ==================================================
   BLOCKQUOTE
================================================== */

blockquote {

    margin: 40px 0;

    padding: 20px 24px;

    border-left: 4px solid #3d8c73;

    background: #f2f6f4;

    font-style: italic;

}


/* ==================================================
   ẢNH
================================================== */

figure {

    margin: 40px 0;

}

figure img {

    width: 100%;

    border-radius: 8px;

    display: block;

}

figcaption {

    margin-top: 12px;

    text-align: center;

    font-size: 14px;

    color: #888;

}


/* ==================================================
   LINK
================================================== */

a {

    color: #2d665d;

}


/* ==================================================
   KẾT THÚC SÁCH
================================================== */

.end-book {

    text-align: center;

    margin-top: 80px;

    padding-top: 40px;

    border-top: 1px solid #ececec;

}

.end-book h2 {

    border: none;

    margin-bottom: 18px;

}

.end-book p {

    margin-bottom: 20px;

}

.end-book a {

    display: inline-block;

    padding: 12px 22px;

    margin: 6px;

    border-radius: 8px;

    background: #2d665d;

    color: white;

    text-decoration: none;

}


/* ==================================================
   MOBILE
================================================== */

@media (max-width:768px) {

    body {

        font-size: 16.5px;

    }

    .reader {

        padding: 28px 18px 60px;

    }

    .reader h1 {

        font-size: 30px;

    }

    section h2 {

        font-size: 24px;

    }

}


/* ==================================================
   ĐIỆN THOẠI NHỎ
================================================== */

@media (max-width:420px) {

    .reader {

        padding: 24px 16px 50px;

    }

    .reader h1 {

        font-size: 26px;

    }

    section h2 {

        font-size: 22px;

    }

    .topbar {

        padding: 10px 16px;

    }
	
	.floating-progress{

    top:53px;

    padding:8px 16px;

    gap:10px;

}

.progress-text{

    font-size:12px;

}

}
html{

    overflow-y:scroll;

}
html{

    -webkit-text-size-adjust:100%;

}
img{

    max-width:100%;
	display:block;

}
button{

    font:inherit;
}

.drawer nav a.active{

    background:#3d8c73;

    color:#fff;

}
