/* Hiểu mụn để hết mụn - bản web đọc sách | O2 SKIN
   Bảng màu và chữ lấy đúng từ bản in: Nunito, xanh #285aa2, xanh nhạt #4cc5f3. */

:root {
  --blue-900: #12315c;
  --blue-800: #1d4680;
  --blue-700: #285aa2;
  --blue-600: #3a72c0;
  --blue-100: #dbe9fa;
  --blue-050: #eef5fd;
  --cyan-500: #29b6e8;
  --cyan-400: #4cc5f3;
  --cyan-100: #e4f6fe;
  --coral: #ef6a5e;
  --amber: #f0a830;
  --amber-bg: #fdf3e0;
  --ink: #22334d;
  --ink-soft: #4a5d78;
  --muted: #7387a1;
  --line: #e2eaf3;
  --paper: #ffffff;
  --bg: #f2f7fc;
  --shadow: 0 1px 2px rgba(18, 49, 92, .06), 0 8px 24px -12px rgba(18, 49, 92, .18);
  --radius: 14px;
  --measure: 42rem;
  --rail: 17.5rem;
  --header-h: 3.5rem;
  --fs: 1.0625rem;
  --lh: 1.78;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue-900: #cfe2fb; --blue-800: #b9d5f7; --blue-700: #8fbdf0; --blue-600: #7db2ec;
    --blue-100: #1e3050; --blue-050: #17263e;
    --cyan-500: #4cc5f3; --cyan-400: #6ed3f7; --cyan-100: #12293c;
    --ink: #dde7f4; --ink-soft: #b3c3d6; --muted: #8ba0b8;
    --line: #24344b; --paper: #131e2d; --bg: #0d1725;
    --amber-bg: #2e2415;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --blue-900: #cfe2fb; --blue-800: #b9d5f7; --blue-700: #8fbdf0; --blue-600: #7db2ec;
  --blue-100: #1e3050; --blue-050: #17263e;
  --cyan-500: #4cc5f3; --cyan-400: #6ed3f7; --cyan-100: #12293c;
  --ink: #dde7f4; --ink-soft: #b3c3d6; --muted: #8ba0b8;
  --line: #24344b; --paper: #131e2d; --bg: #0d1725;
  --amber-bg: #2e2415;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Nunito, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: var(--fs);
  line-height: var(--lh);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-600); }
:focus-visible { outline: 2px solid var(--cyan-500); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: .5rem;
  padding: 0 clamp(.75rem, 3vw, 1.25rem);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__home {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 800; color: var(--blue-800); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__home span { font-size: .95rem; letter-spacing: -.01em; }
.topbar__spacer { flex: 1 1 auto; min-width: 0; }
.topbar__now {
  flex: 1 1 auto; min-width: 0; font-size: .85rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
  opacity: 0; transition: opacity .2s;
}
.topbar.is-scrolled .topbar__now { opacity: 1; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  height: 2.25rem; min-width: 2.25rem; padding: 0 .55rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink-soft);
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
}
.iconbtn:hover { border-color: var(--blue-600); color: var(--blue-700); }
.iconbtn svg { width: 1.05rem; height: 1.05rem; }
.iconbtn__label { display: none; }
@media (min-width: 40rem) { .iconbtn__label { display: inline; } }

.progress {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 50;
  width: 0; background: linear-gradient(90deg, var(--cyan-400), var(--blue-600));
  transition: width .1s linear;
}

/* ------------------------------------------------------------------ shell */
.shell { display: block; }
.rail { display: none; }
@media (min-width: 68rem) {
  .shell.has-rail { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
  .rail {
    display: block; position: sticky; top: var(--header-h);
    height: calc(100dvh - var(--header-h)); overflow-y: auto;
    padding: 1.25rem .75rem 3rem 1.25rem; border-right: 1px solid var(--line);
    scrollbar-width: thin;
  }
}
.wrap { width: 100%; max-width: 76rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.reading { max-width: var(--measure); margin: 0 auto; }

/* màn hình rộng: cột chữ dài hơn, chữ to hơn một chút */
@media (min-width: 68rem) {
  :root { --fs: 1.125rem; --measure: 45rem; }
}
@media (min-width: 100rem) {
  :root { --measure: 47rem; }
}

/* -------------------------------------------------------------- mục lục */
.toc__part { margin-bottom: 1.1rem; }
.toc__parthead {
  display: block; font-size: .72rem; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--cyan-500); margin-bottom: .3rem;
}
.toc__parttitle {
  display: block; font-weight: 800; color: var(--blue-800); font-size: .95rem;
  text-decoration: none; margin-bottom: .4rem; line-height: 1.35;
}
.toc__list { list-style: none; margin: 0; padding: 0 0 0 .1rem; }
.toc__list li { margin: 0; }
.toc__link {
  display: flex; gap: .5rem; padding: .3rem .5rem; border-radius: 8px;
  color: var(--ink-soft); text-decoration: none; font-size: .9rem; line-height: 1.4;
}
.toc__link:hover { background: var(--blue-050); color: var(--blue-700); }
.toc__link[aria-current="page"] {
  background: var(--blue-050); color: var(--blue-700); font-weight: 800;
  box-shadow: inset 3px 0 0 var(--cyan-400);
}
.toc__num { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }

/* drawer trên mobile */
.drawer {
  position: fixed; inset: 0; z-index: 60; display: none;
  width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  margin: 0; padding: 0; border: 0; background: transparent; overflow: hidden;
}
.drawer[open] { display: block; }
.drawer::backdrop { background: rgba(12, 26, 45, .45); }
.drawer__panel {
  position: absolute; inset: 0 auto 0 0; width: min(21rem, 88vw);
  background: var(--paper); overflow-y: auto; padding: 1rem 1rem 3rem;
  border-right: 1px solid var(--line);
}
.drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.drawer__title { font-weight: 800; color: var(--blue-800); }

/* ---------------------------------------------------------------- hero */
.hero { padding: clamp(1.5rem, 6vw, 3.5rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
.hero__grid { display: grid; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
@media (min-width: 56rem) { .hero__grid { grid-template-columns: 1fr 20rem; } }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cyan-500); background: var(--cyan-100);
  padding: .3rem .6rem; border-radius: 999px; margin-bottom: .9rem;
}
.hero h1 {
  margin: 0 0 .6rem; font-size: clamp(2rem, 1.1rem + 4.2vw, 3.4rem); line-height: 1.08;
  letter-spacing: -.02em; color: var(--blue-800); font-weight: 800;
}
.hero h1 em { font-style: italic; color: var(--cyan-500); font-weight: 800; }
.hero__lead { font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem); color: var(--ink-soft); margin: 0 0 1.25rem; max-width: 34rem; }
.hero__by { font-size: .95rem; color: var(--muted); margin: 0 0 1.5rem; }
.hero__by strong { color: var(--ink); font-weight: 700; }
.hero__cover { position: relative; }
.hero__cover img { border-radius: 12px; box-shadow: 0 24px 48px -24px rgba(18, 49, 92, .5), 0 2px 6px rgba(18, 49, 92, .12); }

.btnrow { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.15rem; border-radius: 11px; border: 1px solid transparent;
  font-weight: 800; font-size: 1rem; text-decoration: none; cursor: pointer;
  font-family: inherit; line-height: 1.2;
}
.btn--primary { background: var(--blue-700); color: #fff; }
.btn--primary:hover { background: var(--blue-800); color: #fff; }
.btn--ghost { background: var(--paper); color: var(--blue-700); border-color: var(--blue-100); }
.btn--ghost:hover { border-color: var(--blue-600); }
.btn--cta { background: var(--coral); color: #fff; }
.btn--cta:hover { background: #dc5a4f; color: #fff; }
.btn svg { width: 1.1rem; height: 1.1rem; }

.stats { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.stats li { display: flex; flex-direction: column; }
.stats b { font-size: 1.35rem; color: var(--blue-700); line-height: 1.2; font-weight: 800; }
.stats span { font-size: .8rem; color: var(--muted); }

/* --------------------------------------------------------------- sections */
.section { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.section--tint { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section__head { margin-bottom: 1.5rem; }
.section__head h2 { margin: 0 0 .35rem; font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.9rem); color: var(--blue-800); letter-spacing: -.01em; }
.section__head p { margin: 0; color: var(--muted); max-width: 44rem; }

.partgrid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.partcard {
  display: flex; flex-direction: column; gap: .6rem; padding: 1.15rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.partcard:hover { border-color: var(--blue-600); }
.partcard__n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border-radius: 10px; flex: none;
  background: linear-gradient(160deg, var(--blue-600), var(--blue-700));
  color: #fff; font-weight: 800; font-size: 1rem;
}
.partcard h3 { margin: 0; font-size: 1.08rem; color: var(--blue-800); line-height: 1.3; }
.partcard p { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.partcard__meta { font-size: .8rem; color: var(--muted); margin-top: auto; padding-top: .4rem; }

.chapgrid { display: grid; gap: .35rem; }
.chaplink {
  display: grid; grid-template-columns: 2.1rem 1fr auto; gap: .75rem; align-items: baseline;
  padding: .7rem .85rem; border-radius: 11px; text-decoration: none; color: var(--ink);
  border: 1px solid transparent;
}
.chaplink:hover { background: var(--paper); border-color: var(--line); color: var(--blue-700); }
.chaplink__n { font-weight: 800; color: var(--cyan-500); font-variant-numeric: tabular-nums; }
.chaplink__t { font-weight: 700; line-height: 1.35; }
.chaplink__t small { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: .1rem; }
.chaplink__m { font-size: .78rem; color: var(--muted); white-space: nowrap; }

/* ------------------------------------------------------------ bài đọc */
.article { padding: clamp(1.25rem, 4vw, 2.5rem) 0 1rem; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 1.1rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--blue-700); text-decoration: underline; }
.crumbs span { padding: 0 .35rem; opacity: .6; }

.chaphead { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .75rem; }
.chaphead__n {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 3rem; height: 3rem; border-radius: 12px;
  background: linear-gradient(160deg, var(--blue-600), var(--blue-700));
  color: #fff; font-size: 1.4rem; font-weight: 800;
}
.chaphead h1 {
  margin: .1rem 0 0; font-size: clamp(1.5rem, 1.15rem + 1.9vw, 2.35rem); line-height: 1.15;
  color: var(--blue-800); letter-spacing: -.015em; font-weight: 800;
}
.chapmeta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .82rem; color: var(--muted); margin-bottom: 1.75rem; }
.chapmeta__part { color: var(--cyan-500); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .74rem; }

.prose { font-size: var(--fs); }
.prose p { margin: 0 0 1.05em; }
.prose h2 {
  margin: 2.2em 0 .7em; font-size: 1.16em; line-height: 1.35; color: var(--blue-700);
  font-weight: 800; letter-spacing: .005em;
}
.prose h3 { margin: 1.9em 0 .55em; font-size: 1.02em; line-height: 1.4; color: var(--blue-800); font-weight: 800; }
.prose h2 + h3 { margin-top: 1.1em; }
.prose strong { color: var(--blue-800); font-weight: 800; }
.prose em { color: inherit; }
.prose ul { margin: 0 0 1.1em; padding-left: 0; list-style: none; }
.prose li { position: relative; padding-left: 1.4rem; margin-bottom: .5em; }
.prose li::before {
  content: ""; position: absolute; left: .25rem; top: .68em;
  width: .45rem; height: .45rem; border-radius: 50%; background: var(--cyan-400);
}
.prose ol { margin: 0 0 1.1em; padding-left: 1.4rem; }
.prose ol li { padding-left: .25rem; }
.prose ol li::before { display: none; }

.prose figure { margin: 1.8em 0; }
@media (min-width: 76rem) {
  .prose figure, .original { width: calc(100% + 7rem); margin-left: -3.5rem; }
}
.prose figure img {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--line);
  background: #fff;
}
.prose figcaption { margin-top: .5rem; font-size: .82rem; color: var(--muted); text-align: center; }

.callout {
  margin: 1.6em 0; padding: 1rem 1.15rem; border-radius: var(--radius);
  background: var(--cyan-100); border-left: 4px solid var(--cyan-400); color: var(--ink);
}
.callout p:last-child { margin-bottom: 0; }

.pagemark {
  display: flex; align-items: center; gap: .6rem; margin: 2em 0;
  font-size: .72rem; color: var(--muted); letter-spacing: .06em;
}
.pagemark::before, .pagemark::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* trang gốc */
.original { margin: 2.5rem 0 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.original > summary {
  display: flex; align-items: center; gap: .6rem; padding: .9rem 1.1rem;
  font-weight: 800; color: var(--blue-700); cursor: pointer; list-style: none;
}
.original > summary::-webkit-details-marker { display: none; }
.original > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.original[open] > summary::after { content: "▴"; }
.original__body { padding: 0 1.1rem 1.1rem; display: grid; gap: 1rem; }
.original__body img { border: 1px solid var(--line); border-radius: 10px; margin: 0 auto; }
@media (min-width: 48rem) { .original__body { grid-template-columns: 1fr 1fr; } }

/* điều hướng cuối chương */
.chapnav { display: grid; gap: .75rem; margin: 2.5rem 0 0; }
@media (min-width: 40rem) { .chapnav { grid-template-columns: 1fr 1fr; } }
.chapnav a {
  display: flex; flex-direction: column; gap: .2rem; padding: .95rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  text-decoration: none; color: var(--ink);
}
.chapnav a:hover { border-color: var(--blue-600); }
.chapnav small { font-size: .75rem; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.chapnav b { font-weight: 800; color: var(--blue-800); line-height: 1.3; }
.chapnav a.is-next { text-align: right; align-items: flex-end; }

/* ------------------------------------------------------------------- CTA */
.cta {
  margin: 2.5rem 0 0; padding: clamp(1.25rem, 4vw, 2rem); border-radius: 18px;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-800));
  color: #fff;
}
.cta h2 { margin: 0 0 .5rem; font-size: 1.35rem; color: #fff; line-height: 1.25; }
.cta p { margin: 0 0 1.25rem; color: #dce9fb; font-size: .98rem; max-width: 40rem; }
.cta .btnrow .btn--ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.cta .btnrow .btn--ghost:hover { background: rgba(255, 255, 255, .2); }
.cta__note { margin: 1rem 0 0; font-size: .8rem; color: #bcd3f2; }

/* ---------------------------------------------------------------- footer */
.footer { background: var(--paper); border-top: 1px solid var(--line); padding: 2.5rem 0; margin-top: 3rem; font-size: .9rem; }
.footer__grid { display: grid; gap: 1.5rem; }
@media (min-width: 48rem) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer h3 { margin: 0 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: .35rem; }
.footer a { color: var(--ink-soft); text-decoration: none; }
.footer a:hover { color: var(--blue-700); text-decoration: underline; }
.footer__legal { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

/* ---------------------------------------------------------------- search */
.searchbox { position: relative; }
.searchbox input {
  width: 100%; font: inherit; font-size: 1rem; padding: .8rem 1rem .8rem 2.6rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink);
}
.searchbox svg { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); width: 1.15rem; height: 1.15rem; color: var(--muted); }
.results { margin-top: 1.25rem; display: grid; gap: .5rem; }
.result {
  display: block; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper); text-decoration: none; color: inherit;
}
.result:hover { border-color: var(--blue-600); }
.result b { display: block; color: var(--blue-800); font-weight: 800; margin-bottom: .2rem; }
.result small { color: var(--muted); }
.result mark { background: var(--cyan-100); color: var(--blue-800); padding: 0 .1em; border-radius: 3px; }

/* --------------------------------------------------------------- tiện ích */
.resume {
  display: none; align-items: center; gap: .75rem; padding: .85rem 1.1rem; margin-top: 1.5rem;
  background: var(--paper); border: 1px solid var(--blue-100); border-radius: var(--radius);
}
.resume.is-on { display: flex; }
.resume span { flex: 1; min-width: 0; font-size: .9rem; color: var(--ink-soft); }
.resume b { display: block; color: var(--blue-800); }
.note { font-size: .85rem; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: .5rem; z-index: 100; background: var(--paper); padding: .5rem .8rem; border-radius: 8px; }

.faces { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); }
.tile { padding: 1.1rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.tile h3 { margin: 0 0 .35rem; font-size: 1rem; color: var(--blue-800); }
.tile p { margin: 0; font-size: .9rem; color: var(--ink-soft); }

[data-size="l"] { --fs: 1.1875rem; --measure: 42rem; }
[data-size="xl"] { --fs: 1.3125rem; --measure: 44rem; }
