@font-face { font-family: "Lora"; src: url("/assets/fonts/lora.woff") format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/assets/fonts/lato-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/assets/fonts/lato-700.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/assets/fonts/lato-400i.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  color-scheme: light;
  --deep: #2e1f35;      /* đêm trên vịnh */
  --aub: #5d4366;       /* tím cà */
  --plum: #754b73;
  --brand: #a8436f;     /* hồng thương hiệu, nút chính */
  --brand-h: #963a63;
  --rose: #d46c93;
  --ink: #2a2230;
  --sub: #5a5060;
  --line: #e6dce4;
  --page: #f7f4f7;      /* trắng ngả tím, cùng họ màu logo */
  --white: #fff;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Lato", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 17px/1.6 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; color: var(--aub); }
p { margin: 0; }
:focus-visible { outline: 3px solid rgba(212, 108, 147, .55); outline-offset: 3px; border-radius: 6px; }

/* ---------- đầu trang: vịnh Hạ Long ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(120% 90% at 85% 0%, #6b4a72 0%, var(--aub) 38%, var(--deep) 100%);
  padding: 56px 24px 0;
}
.hero-in { position: relative; z-index: 2; max-width: 1040px; margin: 0 auto; padding-bottom: clamp(170px, 24vw, 300px); }
.logo { width: 210px; margin-bottom: 64px; }
.hero h1 {
  color: #fff; font-size: clamp(40px, 6.4vw, 76px); line-height: 1.04; letter-spacing: -.01em; font-weight: 500;
  max-width: 16ch;
}
.nb { white-space: nowrap; }
.lead { margin-top: 22px; max-width: 46ch; color: rgba(255, 255, 255, .8); font-size: 18px; }
.dl { margin-top: 36px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.dl-meta { color: rgba(255, 255, 255, .66); font-size: 15px; }

.bay { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: clamp(170px, 24vw, 320px); z-index: 1; }
.bay .k3 { fill: #57405f; opacity: .7; }
.bay .k2 { fill: #3d2a46; }
.bay .k1 { fill: #2e1f35; }
.bay .water rect { fill: var(--rose); opacity: .5; }
.bay .water rect:nth-child(2) { opacity: .32; }
.bay .water rect:nth-child(3) { opacity: .18; }
/* chân hero nối liền với nền trang */
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--page); z-index: 1; }

/* ---------- nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 26px; border-radius: 14px; border: 0; cursor: pointer;
  font: 700 16px/1 var(--sans); text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, transform .1s ease;
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-main { background: var(--brand); color: #fff; }
.btn-main:hover { background: var(--brand-h); }
.btn-main:active { transform: scale(.98); }
.hero .btn-main { background: #fff; color: var(--brand-h); box-shadow: 0 10px 30px rgba(20, 8, 24, .35); }
.hero .btn-main:hover { background: #fbeef3; }
.btn-sm { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-soft { background: #f3e7ee; color: var(--brand-h); height: 44px; padding: 0 18px; font-size: 15px; }
.btn-soft:hover { background: #ecd9e4; }
.btn[disabled] { opacity: .6; cursor: default; }
.link { background: none; border: 0; padding: 4px 2px; font: 700 15px var(--sans); color: var(--brand-h); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link-mute { color: var(--sub); font-weight: 400; }

main { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* ---------- ba bước ---------- */
.steps { padding: 72px 0 24px; }
.steps h2, .books h2 { font-size: clamp(28px, 3.4vw, 38px); }
.steps ol { list-style: none; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; counter-reset: s; }
.steps li { counter-increment: s; padding: 0 28px 0 0; position: relative; }
.steps li + li { padding-left: 28px; border-left: 1px solid var(--line); }
.steps li::before {
  content: counter(s); display: block; font: 500 56px/1 var(--serif); color: var(--rose); margin-bottom: 18px;
}
.steps h3 { font-size: 21px; margin-bottom: 8px; }
.steps li p { color: var(--sub); font-size: 16px; }
.aside { margin-top: 40px; padding: 16px 20px; border-left: 3px solid var(--rose); background: #fff; color: var(--sub); font-size: 16px; border-radius: 0 10px 10px 0; max-width: 70ch; }

/* ---------- sổ ---------- */
.books { padding: 64px 0 96px; }
.sub { margin-top: 10px; color: var(--sub); }
.shelf { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.book { display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: start; }
.cover {
  display: block; position: relative; border-radius: 3px 8px 8px 3px; overflow: hidden;
  box-shadow: -1px 0 0 rgba(255, 255, 255, .25) inset, 0 1px 2px rgba(46, 31, 53, .2), 0 14px 28px -10px rgba(46, 31, 53, .45);
  transition: transform .2s ease;
}
/* gáy sách */
.cover::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 10px; background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,0)); z-index: 1; }
a.cover:hover { transform: translateY(-4px); }
.cover-lock img { filter: saturate(.6) brightness(.82); }
.lock {
  position: absolute; z-index: 2; inset: 0; display: grid; place-items: center;
}
.lock svg { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: rgba(255, 255, 255, .92); fill: none; stroke: var(--aub); stroke-width: 1.8; stroke-linecap: round; box-sizing: content-box; }
.book.unlocked .cover-lock img { filter: none; }
.book.unlocked .lock { display: none; }
.book h3 { font-size: 24px; }
.book-body > p { margin-top: 8px; color: var(--sub); font-size: 16px; }
.acts { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }

.login { margin-top: 20px; display: grid; gap: 6px; max-width: 320px; }
.login label { font-size: 14px; font-weight: 700; color: var(--ink); margin-top: 6px; }
.login input {
  height: 46px; padding: 0 14px; border: 1px solid #d9ccd5; border-radius: 12px; background: #fff; font: 16px var(--sans); color: var(--ink);
}
.login input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(168, 67, 111, .2); }
.login .btn { margin-top: 12px; justify-self: start; }
.err { color: #b42318; font-size: 14px; margin-top: 4px; }

/* ---------- chân trang ---------- */
.foot { background: var(--deep); color: rgba(255, 255, 255, .6); padding: 36px 24px 44px; display: flex; flex-direction: column; align-items: center; gap: 10px; font: 15px var(--serif); }

/* ---------- đọc sổ ---------- */
.reader { width: min(1100px, 96vw); height: 92vh; max-height: none; padding: 0; border: 0; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 30px 80px rgba(20, 8, 24, .5); }
.reader::backdrop { background: rgba(30, 18, 36, .66); }
.reader[open] { display: flex; flex-direction: column; }
.reader-bar { display: flex; align-items: center; gap: 18px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--line); }
.reader-bar h2 { flex: 1; font-size: 18px; }
.reader iframe { flex: 1; width: 100%; border: 0; background: #e9e4ea; }
.x { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; display: grid; place-items: center; }
.x:hover { background: #f3e7ee; }
.x svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }

/* ---------- màn nhỏ ---------- */
@media (max-width: 900px) {
  .shelf { grid-template-columns: 1fr; gap: 56px; }
  .steps ol { grid-template-columns: 1fr; gap: 28px; }
  .steps li, .steps li + li { padding: 0 0 0 64px; border: 0; }
  .steps li::before { position: absolute; left: 0; top: -4px; font-size: 44px; }
}
@media (max-width: 520px) {
  .hero { padding-top: 36px; }
  .logo { width: 170px; margin-bottom: 44px; }
  .book { grid-template-columns: 112px 1fr; gap: 18px; }
  .hero .btn-main { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
