/* Sách tài liệu Học Viện Phong Thủy Thiên Sơn — phong cách khổ A4 sang trọng */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Be+Vietnam+Pro:wght@300;400;500;600;700&display=swap');

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

html, body {
  background:
    radial-gradient(ellipse at top, #2a1f10 0%, #0d0a06 60%),
    #07060a;
  background-attachment: fixed;
  color: #2a2419;
  font-family: 'Be Vietnam Pro', sans-serif;
  min-height: 100vh;
  padding: 40px 16px 80px;
}

.doc-topbar {
  max-width: 900px;
  margin: 0 auto 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e7c97a;
  font-family: 'Cormorant Garamond', serif;
}
.doc-topbar a {
  color: #e7c97a;
  text-decoration: none;
  border: 1px solid rgba(231,201,122,0.4);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all 0.3s;
}
.doc-topbar a:hover { background: rgba(231,201,122,0.12); border-color: #e7c97a; }
.doc-topbar .doc-title-top {
  font-size: 20px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* === Trang A4 === */
.page {
  width: 210mm;
  min-height: 297mm;
  max-width: 100%;
  margin: 0 auto 40px;
  background:
    radial-gradient(ellipse at top left, #fbf4e1 0%, #f3e8c8 70%, #ead9a8 100%);
  position: relative;
  padding: 22mm 20mm 24mm;
  box-shadow:
    0 0 0 1px rgba(180, 140, 60, 0.25),
    0 30px 80px -20px rgba(0,0,0,0.7),
    0 10px 30px rgba(0,0,0,0.4);
  color: #2a2114;
  overflow: hidden;
}

/* Vân giấy cổ */
.page::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(150,110,40,0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(150,110,40,0.05) 0%, transparent 40%),
    repeating-linear-gradient(135deg, rgba(180,140,60,0.015) 0 2px, transparent 2px 6px);
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* Khung viền vàng đôi */
.page::after {
  content: '';
  position: absolute;
  inset: 12mm;
  border: 1.5px solid #b78b3a;
  outline: 1px solid rgba(183,139,58,0.35);
  outline-offset: 4px;
  pointer-events: none;
  border-radius: 1px;
}

/* Góc trang trí */
.corner {
  position: absolute;
  width: 36px; height: 36px;
  border: 2px solid #a07a2e;
  pointer-events: none;
  z-index: 2;
}
.corner.tl { top: 10mm; left: 10mm; border-right: none; border-bottom: none; }
.corner.tr { top: 10mm; right: 10mm; border-left: none; border-bottom: none; }
.corner.bl { bottom: 10mm; left: 10mm; border-right: none; border-top: none; }
.corner.br { bottom: 10mm; right: 10mm; border-left: none; border-top: none; }
.corner::before {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  background: radial-gradient(circle, #d4a64a, #8b6420);
  border-radius: 50%;
}
.corner.tl::before { top: -5px; left: -5px; }
.corner.tr::before { top: -5px; right: -5px; }
.corner.bl::before { bottom: -5px; left: -5px; }
.corner.br::before { bottom: -5px; right: -5px; }

/* Header */
.page-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(160,120,40,0.4);
  margin-bottom: 22px;
  position: relative; z-index: 1;
}
.page-header img {
  width: 56px; height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.page-header .ph-text { flex: 1; }
.page-header .ph-academy {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  letter-spacing: 0.32em;
  color: #8b6420;
  text-transform: uppercase;
}
.page-header .ph-topic {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  color: #5c3f12;
  letter-spacing: 0.04em;
}
.page-header .ph-page-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  letter-spacing: 0.2em;
  color: #8b6420;
  border: 1px solid #b78b3a;
  padding: 6px 12px;
  border-radius: 999px;
}

/* Nội dung */
.page-body { position: relative; z-index: 1; }

.page-body h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 38px;
  font-weight: 700;
  color: #4a2f0a;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.page-body .sub {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: #8b6420;
  font-size: 18px;
  margin-bottom: 24px;
}
.page-body .divider {
  display: block;
  width: 100px; height: 14px;
  margin: 0 auto 22px;
  background:
    radial-gradient(circle, #b78b3a 2px, transparent 2.5px) center/100% 100% no-repeat;
  position: relative;
}
.page-body .divider::before,
.page-body .divider::after {
  content: '';
  position: absolute; top: 50%;
  width: 42px; height: 1px;
  background: linear-gradient(90deg, transparent, #b78b3a, transparent);
  transform: translateY(-50%);
}
.page-body .divider::before { left: -46px; }
.page-body .divider::after  { right: -46px; }

.page-body h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  font-weight: 700;
  color: #5c3f12;
  margin: 22px 0 10px;
  padding-left: 14px;
  border-left: 4px solid #b78b3a;
  letter-spacing: 0.02em;
}
.page-body h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  color: #6b4a17;
  margin: 14px 0 6px;
}
.page-body p,
.page-body li {
  font-size: 14.5px;
  line-height: 1.75;
  color: #2f2616;
  text-align: justify;
  margin-bottom: 8px;
}
.page-body ul, .page-body ol { padding-left: 22px; margin-bottom: 10px; }
.page-body li { margin-bottom: 4px; }
.page-body strong { color: #5c3f12; }

.page-body .drop::first-letter {
  font-family: 'Cormorant Garamond', serif;
  font-size: 64px;
  font-weight: 700;
  float: left;
  line-height: 0.9;
  padding: 6px 10px 0 0;
  color: #8b6420;
}

.fig {
  margin: 16px 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(160,120,40,0.4);
  box-shadow: 0 8px 20px -8px rgba(0,0,0,0.25);
  position: relative;
}
.fig img {
  width: 100%; height: 220px;
  object-fit: cover;
  display: block;
  filter: sepia(0.18) saturate(0.95);
}
.fig figcaption {
  background: rgba(74, 47, 10, 0.92);
  color: #f3e8c8;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  text-align: center;
  font-size: 13px;
  padding: 8px 12px;
  letter-spacing: 0.05em;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }

.quote {
  background: linear-gradient(135deg, rgba(183,139,58,0.10), rgba(183,139,58,0.04));
  border: 1px solid rgba(160,120,40,0.4);
  border-left: 4px solid #b78b3a;
  padding: 14px 18px;
  margin: 14px 0;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17px;
  color: #4a2f0a;
  border-radius: 2px;
}

.table-elegant {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13.5px;
}
.table-elegant th, .table-elegant td {
  border: 1px solid #b78b3a;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.table-elegant th {
  background: rgba(183,139,58,0.18);
  font-family: 'Cormorant Garamond', serif;
  color: #5c3f12;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Footer */
.page-footer {
  position: absolute;
  left: 20mm; right: 20mm; bottom: 14mm;
  display: flex; justify-content: space-between;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: #8b6420;
  font-size: 12px;
  letter-spacing: 0.12em;
  border-top: 1px solid rgba(160,120,40,0.35);
  padding-top: 8px;
  z-index: 1;
}

@media (max-width: 800px) {
  body { padding: 16px 8px 40px; }
  .page { padding: 14mm 10mm 18mm; }
  .page::after { inset: 6mm; }
  .corner.tl, .corner.tr { top: 5mm; }
  .corner.bl, .corner.br { bottom: 5mm; }
  .corner.tl, .corner.bl { left: 5mm; }
  .corner.tr, .corner.br { right: 5mm; }
  .page-body h1 { font-size: 28px; }
  .page-body h2 { font-size: 20px; }
  .row2 { grid-template-columns: 1fr; }
  .page-footer { left: 10mm; right: 10mm; bottom: 6mm; }
}

@media print {
  body { background: white; padding: 0; }
  .doc-topbar { display: none; }
  .page { box-shadow: none; margin: 0; page-break-after: always; }
}
