/* ==========================================================================
   hungcd.com — design system (ADR-014, ADR-020)
   Bootstrap 5.3 (wwwroot/lib) + lớp tuỳ biến này. Không SASS, không Node.
   Ý tưởng chủ đạo: hải đồ — đường đẳng sâu. Chỉ hero và chân trang dùng hoạ tiết.
   Chuẩn thiết kế: docs/design/prototype/ — phần layout bài/danh sách khác sẽ chuyển sang ở Phase 8–11.

   Thứ tự: token → ánh xạ sang Bootstrap → nền tảng → đầu/chân trang → hero
           → danh sách bài → bài viết → bình luận → admin.
   ========================================================================== */

/* ---------- Token: màu (sáng) ---------- */
:root,
[data-bs-theme="light"] {
  --sea-shallow:   #F3F8FB;   /* nền trang */
  --sea-foam:      #FFFFFF;   /* bề mặt: ô nhập, panel */
  --sea-tint:      #E4F2F9;   /* nền nhấn nhẹ, chân trang, tag */
  --sea-line:      #CFE3EE;   /* đường kẻ, viền */
  --sea-wave:      #6BB8DC;   /* đường đẳng sâu, viền nhấn — không dùng cho chữ */
  --sea:           #0369A1;   /* link, nút chính — 5.9:1 trên trắng */
  --sea-rgb:       3, 105, 161;
  --sea-strong:    #075985;   /* hover */
  --sea-strong-rgb: 7, 89, 133;
  --abyss:         #0B2A3C;   /* chữ chính */
  --drift:         #557083;   /* chữ phụ — 5.2:1 trên nền trang */
  --on-sea:        #FFFFFF;   /* chữ trên nền --sea */
  --danger:        #B42318;
  --ph-bg:         #DDEEF7;
  --ph-lines:      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520' viewBox='-260 -260 520 520'%3E%3Cg fill='none' stroke='%23A9D3EA' stroke-width='1.4'%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(.45)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(.9) rotate(6)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(1.4) rotate(12)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(1.95) rotate(18)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(2.55) rotate(24)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3C/g%3E%3C/svg%3E");
  --footer-lines:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='56' viewBox='0 0 600 56'%3E%3Cg fill='none' stroke='%239BCDE6' stroke-width='1.2'%3E%3Cpath d='M0 50C100 44 200 54 300 48S500 42 600 50'/%3E%3Cpath opacity='.7' d='M0 36C120 28 220 40 300 34S480 24 600 36'/%3E%3Cpath opacity='.45' d='M0 22C90 16 210 26 300 20S510 12 600 22'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Token: màu (tối — đêm trên biển) ---------- */
[data-bs-theme="dark"] {
  --sea-shallow:   #0A1D28;
  --sea-foam:      #0F2734;
  --sea-tint:      #12303F;
  --sea-line:      #1F4253;
  --sea-wave:      #3E8FB5;
  --sea:           #7DCCF0;   /* 9.7:1 trên nền tối */
  --sea-rgb:       125, 204, 240;
  --sea-strong:    #A8DDF5;
  --sea-strong-rgb: 168, 221, 245;
  --abyss:         #E2F0F7;
  --drift:         #8FAEBF;   /* 7.4:1 trên nền tối */
  --on-sea:        #06202D;
  --danger:        #F97066;
  --ph-bg:         #12303F;
  --ph-lines:      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520' viewBox='-260 -260 520 520'%3E%3Cg fill='none' stroke='%232A5B72' stroke-width='1.4'%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(.45)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(.9) rotate(6)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(1.4) rotate(12)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(1.95) rotate(18)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3Cpath vector-effect='non-scaling-stroke' transform='scale(2.55) rotate(24)' d='M-6-98C52-112 118-70 112-8 106 48 70 104 2 100-58 96-120 58-112-6-104-64-62-86-6-98Z'/%3E%3C/g%3E%3C/svg%3E");
  --footer-lines:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='56' viewBox='0 0 600 56'%3E%3Cg fill='none' stroke='%232C5E75' stroke-width='1.2'%3E%3Cpath d='M0 50C100 44 200 54 300 48S500 42 600 50'/%3E%3Cpath opacity='.7' d='M0 36C120 28 220 40 300 34S480 24 600 36'/%3E%3Cpath opacity='.45' d='M0 22C90 16 210 26 300 20S510 12 600 22'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Token: chữ, khoảng, bo góc ---------- */
:root {
  --font-sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ja:   "Noto Sans JP", "Be Vietnam Pro", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;

  /* Thang cỡ chữ cổ điển: 14 · 16 · 18 · 21 · 24 · 36 · 48 · 72+ */
  --fs-sm:      .875rem;
  --fs-ui:      1rem;
  --fs-body:    1.125rem;
  --fs-lead:    1.3125rem;
  --fs-h1:      clamp(2.25rem, 1.6rem + 2.4vw, 3rem);
  --fs-display: clamp(3.5rem, 1.4rem + 8vw, 6.5rem);

  --measure:      680px;    /* vùng đọc ~68 ký tự */
  --measure-wide: 960px;
  --page:         1180px;

  --r-sm: 6px;              /* chip, nút, ô nhập */
  --r-md: 10px;             /* ảnh trong bài, khối code */
  --r-lg: 18px;             /* ảnh lớn, video */
}

/* ---------- Ánh xạ token sang biến của Bootstrap ---------- */
:root,
[data-bs-theme] {
  --bs-body-font-family: var(--font-sans);
  --bs-body-bg: var(--sea-shallow);
  --bs-body-color: var(--abyss);
  --bs-emphasis-color: var(--abyss);
  --bs-heading-color: var(--abyss);
  --bs-secondary-color: var(--drift);
  --bs-secondary-bg: var(--sea-foam);
  --bs-tertiary-bg: var(--sea-tint);
  --bs-border-color: var(--sea-line);
  --bs-primary: var(--sea);
  --bs-primary-rgb: var(--sea-rgb);
  --bs-link-color: var(--sea);
  --bs-link-color-rgb: var(--sea-rgb);
  --bs-link-hover-color: var(--sea-strong);
  --bs-link-hover-color-rgb: var(--sea-strong-rgb);
  --bs-focus-ring-color: rgba(var(--sea-rgb), .4);
  --bs-code-color: var(--sea-strong);
  --bs-border-radius: var(--r-sm);
  --bs-border-radius-lg: var(--r-md);
}

.btn { font-weight: 600; }

.btn-primary {
  --bs-btn-color: var(--on-sea);
  --bs-btn-bg: var(--sea);
  --bs-btn-border-color: var(--sea);
  --bs-btn-hover-color: var(--on-sea);
  --bs-btn-hover-bg: var(--sea-strong);
  --bs-btn-hover-border-color: var(--sea-strong);
  --bs-btn-active-color: var(--on-sea);
  --bs-btn-active-bg: var(--sea-strong);
  --bs-btn-active-border-color: var(--sea-strong);
  --bs-btn-disabled-color: var(--on-sea);
  --bs-btn-disabled-bg: var(--sea);
  --bs-btn-disabled-border-color: var(--sea);
  --bs-btn-focus-shadow-rgb: var(--sea-rgb);
}

.btn-outline-primary,
.btn-ghost {
  --bs-btn-color: var(--sea);
  --bs-btn-border-color: var(--sea-line);
  --bs-btn-hover-color: var(--on-sea);
  --bs-btn-hover-bg: var(--sea);
  --bs-btn-hover-border-color: var(--sea);
  --bs-btn-active-color: var(--on-sea);
  --bs-btn-active-bg: var(--sea-strong);
  --bs-btn-active-border-color: var(--sea-strong);
  --bs-btn-disabled-color: var(--drift);
  --bs-btn-disabled-border-color: var(--sea-line);
  --bs-btn-focus-shadow-rgb: var(--sea-rgb);
}

.btn-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--danger);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--danger);
  --bs-btn-hover-border-color: var(--danger);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--danger);
  --bs-btn-active-border-color: var(--danger);
}

.form-control,
.form-select {
  background-color: var(--sea-foam);
  border-color: var(--sea-line);
  color: var(--abyss);
}
.form-control:focus,
.form-select:focus { border-color: var(--sea); background-color: var(--sea-foam); color: var(--abyss); }
.form-control::placeholder { color: var(--drift); opacity: .8; }
.form-label { font-weight: 600; font-size: .9375rem; }
.form-text { color: var(--drift); }

.dropdown-menu {
  --bs-dropdown-bg: var(--sea-foam);
  --bs-dropdown-border-color: var(--sea-line);
  --bs-dropdown-link-color: var(--abyss);
  --bs-dropdown-link-hover-bg: var(--sea-tint);
  --bs-dropdown-link-hover-color: var(--abyss);
  --bs-dropdown-link-active-bg: var(--sea);
  --bs-dropdown-link-active-color: var(--on-sea);
  --bs-dropdown-border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgb(6 30 44 / 12%);
}

/* ---------- Nền tảng ---------- */
html { scroll-padding-top: 88px; }

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Font theo ngôn ngữ, đặt tại chỗ khai báo lang: nội dung tiếng Việt trong giao diện tiếng Nhật phải về
   lại Be Vietnam Pro (P-25). Dùng [lang|=…] chứ không :lang(…) — :lang() khớp mọi phần tử con và đè
   cả font monospace của <code>, <pre>. */
[lang|="ja"] { font-family: var(--font-ja); }
[lang|="vi"],
[lang|="en"] { font-family: var(--font-sans); }

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a {
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
}

:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 3px;
}
/* FocusOnNavigate (Routes.razor) đưa focus vào h1 sau mỗi lần điều hướng để trình đọc màn hình đọc
   tiêu đề mới — tiêu đề không phải phần tử tương tác nên không vẽ khung focus. */
h1:focus,
h1:focus-visible { outline: none; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 1100;
  padding: .5rem 1rem;
  border-radius: var(--r-sm);
  background: var(--sea);
  color: var(--on-sea);
  font-weight: 600;
}
.skip-link:focus { top: .5rem; }

.container { max-width: var(--page); }
.text-drift, .muted { color: var(--drift) !important; }
.tabular { font-variant-numeric: tabular-nums; }
.empty { color: var(--drift); padding: 2.5rem 0; }
.block { display: block; }
.grow { flex: 1 1 320px; }

/* Ảnh bìa hoặc hoạ tiết thay thế khi bài chưa có ảnh: tông nước + đường đẳng sâu. */
.ph,
.cover-img {
  display: block;
  width: 100%;
  aspect-ratio: var(--ratio, 16 / 10);
  border-radius: var(--r-lg);
}
.ph { background: var(--ph-lines) var(--ph-x, 72%) var(--ph-y, 38%) / var(--ph-size, 560px) no-repeat, var(--ph-bg); }
.cover-img { object-fit: cover; background: var(--sea-tint); }

/* ---------- Đầu trang ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: color-mix(in srgb, var(--sea-shallow) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--sea-line); }
.site-header .navbar { padding-block: .75rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--abyss);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand:hover { color: var(--abyss); }
.brand-mark { width: 30px; height: 30px; color: var(--sea); flex: none; }
.brand-tld { color: var(--drift); font-weight: 500; }

.site-nav .nav-link {
  color: var(--abyss);
  font-weight: 500;
  padding-inline: .85rem !important;
}
.site-nav .nav-link:hover,
.site-nav .nav-link.show { color: var(--sea); }
.site-nav .nav-link[aria-current="page"] {
  color: var(--sea);
  box-shadow: inset 0 -2px 0 var(--sea);
}

.header-tools { display: flex; align-items: center; gap: .35rem; }

.header-search { position: relative; margin-left: auto; }
.header-search .bi {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--drift);
  pointer-events: none;
}
.header-search input {
  width: 15rem;
  padding-left: 2.2rem;
  border-radius: 999px;
  font-size: .9375rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--abyss);
  font-size: 1.15rem;
}
.icon-btn:hover { background: var(--sea-tint); color: var(--sea); }

/* Nút sáng/tối: icon chọn bằng CSS theo data-bs-theme, không cần JS đổi icon. */
[data-bs-theme="dark"] .theme-icon-to-dark,
[data-bs-theme="light"] .theme-icon-to-light { display: none; }

@media (max-width: 991.98px) {
  .site-nav { padding-top: .75rem; }
  .site-nav .nav-link[aria-current="page"] { box-shadow: inset 2px 0 0 var(--sea); }
  .header-search { margin: .75rem 0 .25rem; }
  .header-search input { width: 100%; }
}

/* ---------- Chân trang ---------- */
.site-footer {
  position: relative;
  margin-top: 7rem;
  padding: 3.5rem 0 2.5rem;
  background: var(--sea-tint);
}
.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 56px;
  transform: translateY(-100%);
  background: var(--footer-lines) left bottom / 600px 56px repeat-x;
  pointer-events: none;
}
.site-footer h2 { font-size: var(--fs-ui); font-weight: 700; margin-bottom: .85rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: .4rem; }
.site-footer a { color: var(--abyss); text-decoration: none; }
.site-footer a:hover { color: var(--sea); text-decoration: underline; }
.footer-about { max-width: 34ch; color: var(--drift); }

/* Link mạng xã hội (site_settings): hero trang chủ, hero giới thiệu, chân trang. */
.socials { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.socials a {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--drift);
  font-size: 1.15rem;
  text-decoration: none;
}
.socials a:hover { color: var(--sea); background: var(--sea-foam); }
.site-footer .socials li + li { margin-top: 0; }
.hero-actions + .socials { margin-top: 1.5rem; margin-left: -.6rem; }
.footer-about + .socials { margin-left: -.6rem; }
.footer-bottom {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--sea-line);
  color: var(--drift);
  font-size: var(--fs-sm);
}

/* ---------- Hero trang chủ: hải đồ ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 9vw, 8rem) 0 clamp(3rem, 7vw, 6rem);
}
.hero-chart {
  position: absolute;
  inset: -4% -12% -4% 28%;
  width: auto;
  height: auto;
  color: var(--sea-wave);
  pointer-events: none;
  /* Mờ dần ở đáy để hải đồ không bị cắt thành một đường ngang cứng. */
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent 96%);
          mask-image: linear-gradient(to bottom, #000 62%, transparent 96%);
}
.hero-inner { position: relative; }
.hero-name {
  font-size: var(--fs-display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: .95;
  margin: 0 0 1.75rem;
}
.hero-lead {
  max-width: 36ch;
  font-size: var(--fs-lead);
  line-height: 1.55;
  margin-bottom: 2rem;
}
.hero-lead > :last-child { margin-bottom: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-actions .btn { padding: .7rem 1.25rem; }

.isobath .ring { fill: none; stroke: currentColor; stroke-width: 1.25; }
.isobath .ring--minor { stroke-width: .9; opacity: .55; }
.isobath .sounding {
  font: 500 12px var(--font-sans);
  fill: var(--drift);
  paint-order: stroke;
  stroke: var(--sea-shallow);
  stroke-width: 5px;
  stroke-linejoin: round;
  font-variant-numeric: tabular-nums;
}

/* Khoảnh khắc chuyển động duy nhất: các vòng hiện dần từ ngoài vào trong — đi xuống chỗ sâu. */
@media (prefers-reduced-motion: no-preference) {
  .isobath .ring-group { opacity: 0; animation: chart-in .9s ease-out forwards; animation-delay: calc(var(--i, 0) * 110ms); }
  .isobath .sounding { opacity: 0; animation: chart-in .6s ease-out forwards; animation-delay: 1.1s; }
}
@keyframes chart-in { to { opacity: 1; } }

@media (max-width: 991.98px) {
  .hero-chart { inset: -10% -45% -10% -5%; opacity: .4; }
}

/* ---------- Giới thiệu (layout landing) ---------- */
.profile-hero { position: relative; overflow: hidden; padding: clamp(3rem, 8vw, 6.5rem) 0 clamp(3rem, 6vw, 5rem); }
/* Ảnh đại diện nằm ở tâm vùng đẳng sâu — "điểm sâu nhất" của hải đồ. */
.profile-hero .hero-chart { inset: 0 0 0 40%; }
.profile-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
/* Chưa có ảnh thì khung hiện chữ (About.PortraitText). Cỡ chữ = đường kính / số ký tự, có trần,
   để "TONY" hay một tên dài hơn vẫn nằm gọn trong vòng tròn. */
.portrait {
  --portrait-size: 240px;
  --portrait-max-font: 4.5rem;
  justify-self: center;
  display: grid;
  place-items: center;
  width: var(--portrait-size);
  height: var(--portrait-size);
  border-radius: 50%;
  object-fit: cover;
  background: var(--sea-foam);
  box-shadow: 0 0 0 10px var(--sea-shallow), 0 0 0 11px var(--sea-wave);
  color: var(--sea);
  font-size: min(var(--portrait-max-font), calc(var(--portrait-size) * .9 / var(--chars, 2)));
  font-weight: 800;
  letter-spacing: -0.02em;
}
.profile-role { font-size: var(--fs-lead); font-weight: 600; color: var(--sea-strong); margin: -.75rem 0 1rem; }
@media (max-width: 991.98px) { .profile-hero .hero-chart { inset: 0 -30% 0 10%; opacity: .4; } }
@media (max-width: 767.98px) {
  .profile-grid { grid-template-columns: 1fr; }
  .portrait { --portrait-size: 140px; --portrait-max-font: 2.75rem; order: -1; justify-self: start; box-shadow: 0 0 0 6px var(--sea-shallow), 0 0 0 7px var(--sea-wave); }
}

/* Nội dung trang "gioi-thieu": admin viết các <section class="band"> (ProfileTemplate). Phần nào không nằm
   trong band thì vẫn được giữ trong khổ trang. */
.profile-content > :not(.band) { max-width: var(--page); margin-inline: auto; padding-inline: calc(var(--bs-gutter-x, 1.5rem) * .5); }
.band { padding: clamp(3rem, 6vw, 5rem) 0; }
.band--tint { background: var(--sea-tint); }
.band h2 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 2rem; }

.skill-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem 3rem; }
.skill-groups h3 { font-size: var(--fs-ui); font-weight: 700; margin-bottom: .75rem; }
.skill-list { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.skill-list li { padding: .3rem .7rem; border-radius: var(--r-sm); background: var(--sea-foam); border: 1px solid var(--sea-line); font-size: .9375rem; font-weight: 500; }
.skill-list a { color: var(--abyss); text-decoration: none; }
.skill-list a:hover { color: var(--sea); }
.band--tint .skill-list li { background: var(--sea-shallow); }
@media (max-width: 767.98px) { .skill-groups { grid-template-columns: 1fr; } }

/* Kinh nghiệm: đúng là một trình tự thời gian nên dùng timeline. */
.timeline { list-style: none; margin: 0; padding: 0; max-width: 820px; }
.timeline li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 2rem; position: relative; padding-bottom: 2.25rem; }
.timeline li::before { content: ""; position: absolute; left: calc(9rem + 1rem); top: .55rem; bottom: -.35rem; width: 1px; background: var(--sea-line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: calc(9rem + 1rem - 5px); top: .45rem; width: 11px; height: 11px; border-radius: 50%; background: var(--sea-shallow); border: 2px solid var(--sea); }
.timeline .when { color: var(--drift); font-variant-numeric: tabular-nums; padding-top: .1rem; }
.timeline .what { padding-left: 1.5rem; }
.timeline h3 { font-size: 1.25rem; margin-bottom: .3rem; }
.timeline p { color: var(--drift); margin: 0; }
@media (max-width: 575.98px) {
  .timeline li { grid-template-columns: 1fr; gap: .25rem; padding-left: 1.5rem; }
  .timeline li::before { left: 5px; }
  .timeline li::after { left: 0; }
  .timeline .what { padding-left: 0; }
}

.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
.project { padding-top: 1.25rem; border-top: 2px solid var(--abyss); }
.project h3 { font-size: 1.375rem; margin-bottom: .5rem; }
.project p { color: var(--drift); }
.stack { display: flex; flex-wrap: wrap; gap: .35rem 1rem; list-style: none; padding: 0; margin: 0; color: var(--sea-strong); font-size: .9375rem; font-weight: 600; }
@media (max-width: 991.98px) { .projects { grid-template-columns: 1fr; } }

.cert-list { list-style: none; padding: 0; margin: 0; max-width: 820px; }
.cert-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--sea-line); }
.cert-list li span:last-child { color: var(--drift); font-variant-numeric: tabular-nums; }

/* ---------- Tiêu đề mục, bài nổi bật ---------- */
.section { padding-top: clamp(3rem, 6vw, 5rem); }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  margin-bottom: 1.75rem;
}
.section-head h2 { font-size: 1.75rem; margin: 0; }
.section-head a { font-weight: 600; }

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}
.feature h3 { font-size: clamp(1.75rem, 1.2rem + 1.5vw, 2.25rem); letter-spacing: -0.025em; margin: .5rem 0 .85rem; }
.feature h3 a { color: var(--abyss); text-decoration: none; }
.feature h3 a:hover { color: var(--sea); }
.feature p { color: var(--drift); font-size: var(--fs-body); }
@media (max-width: 767.98px) { .feature { grid-template-columns: 1fr; } }

.cat-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--sea);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
}
.cat-link:hover { text-decoration: underline; }

/* Meta bài: nhóm icon + chữ, cách nhau bằng khoảng trắng — không nối bằng dấu chấm giữa. */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--drift);
  font-size: .9375rem;
  font-variant-numeric: tabular-nums;
}
.meta li { display: inline-flex; align-items: center; gap: .4rem; }

/* ---------- Danh sách bài dạng hàng ---------- */
.post-rows { list-style: none; margin: 0; padding: 0; }
.post-row {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: .25rem 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--sea-line);
}
.post-row:last-child { border-bottom: 1px solid var(--sea-line); }
.post-row time { color: var(--drift); font-variant-numeric: tabular-nums; padding-top: .3rem; }
.post-row h3 { font-size: 1.3125rem; margin: .2rem 0 .4rem; }
.post-row h3 a { color: var(--abyss); text-decoration: none; }
.post-row h3 a:hover { color: var(--sea); text-decoration: underline; }
.post-row p { color: var(--drift); margin: 0; max-width: 64ch; }
@media (max-width: 575.98px) { .post-row { grid-template-columns: 1fr; } }

/* ---------- Tag ---------- */
.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.tag {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: var(--r-sm);
  background: var(--sea-tint);
  color: var(--sea-strong);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
}
.tag:hover { background: var(--sea); color: var(--on-sea); }

/* ---------- Danh sách: đầu trang, lưới card, phân trang ---------- */
.list-head { padding: clamp(2.5rem, 6vw, 4.5rem) 0 2.25rem; }
.list-head > .bi { font-size: 1.75rem; color: var(--sea); }
.list-head h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.03em; margin: .75rem 0 .6rem; }
.list-head p { max-width: 52ch; color: var(--drift); font-size: var(--fs-body); margin: 0; }
.list-head .count { margin-top: 1rem; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.list-head .search-form { display: flex; gap: .5rem; max-width: 34rem; margin-top: 1.5rem; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem 2rem; }
.post-card .ph,
.post-card .cover-img { --ratio: 4 / 3; border-radius: var(--r-md); margin-bottom: 1rem; }
.post-card h3 { font-size: 1.25rem; margin: .4rem 0 .45rem; }
.post-card h3 a { color: var(--abyss); text-decoration: none; }
.post-card h3 a:hover { color: var(--sea); text-decoration: underline; }
.post-card p { color: var(--drift); margin-bottom: .6rem; }
.post-card .card-top { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; }
@media (max-width: 991.98px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .card-grid { grid-template-columns: 1fr; } }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sea-line);
  font-weight: 600;
}
.pager-status { color: var(--drift); font-weight: 500; font-variant-numeric: tabular-nums; }

.tag-cloud { padding-top: clamp(3rem, 6vw, 5rem); }

.error-page { padding: clamp(4rem, 10vw, 8rem) 0; max-width: var(--measure); }
.error-page h1 { font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.04em; color: var(--sea); line-height: 1; }
.error-page p { font-size: var(--fs-lead); }

/* ---------- Bài viết (layout default) ---------- */
.post-head { max-width: var(--measure); margin: clamp(2.5rem, 6vw, 4.5rem) auto 2.25rem; }
.post-head h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.03em; margin: .75rem 0 1rem; }
.post-head .post-summary { font-size: var(--fs-lead); color: var(--drift); line-height: 1.5; margin-bottom: 1.25rem; }
.post-cover { max-width: var(--measure-wide); margin: 0 auto 3rem; }
.post-cover .cover-img { --ratio: 16 / 8; }

/* Nội dung bài và trang tĩnh (body_html sinh từ Markdown, có class Bootstrap do Markdig UseBootstrap()). */
.prose {
  max-width: var(--measure);
  margin-inline: auto;
  font-size: var(--fs-body);
  line-height: 1.75;
}
.prose > * + * { margin-top: 1.25em; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose h2 { font-size: 1.75rem; margin-top: 2.25em; margin-bottom: 0; letter-spacing: -0.02em; }
.prose h3 { font-size: 1.3125rem; margin-top: 2em; margin-bottom: 0; }
.prose li + li { margin-top: .35em; }
.prose img { max-width: 100%; height: auto; border-radius: var(--r-md); }
.prose :not(pre) > code {
  padding: .12em .38em;
  border-radius: 4px;
  background: var(--sea-tint);
  color: var(--abyss);
  font-family: var(--font-code);
  font-size: .85em;
}
.prose blockquote {
  margin-inline: 0;
  padding: .25rem 0 .25rem 1.5rem;
  border-left: 3px solid var(--sea-wave);
  font-size: 1.3125rem;
  line-height: 1.55;
  color: var(--abyss);
}
.prose blockquote > :last-child { margin-bottom: 0; }
.prose figure { margin-inline: 0; }
.prose figcaption { margin-top: .6rem; color: var(--drift); font-size: .9375rem; }
/* Bảng rộng hơn vùng đọc thì cuộn ngang thay vì làm vỡ trang. */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 1rem;
}
.prose .table { --bs-table-bg: transparent; --bs-table-color: var(--abyss); --bs-table-border-color: var(--sea-line); width: auto; min-width: 100%; }
.prose th, .prose td { padding: .6rem .75rem; border-bottom: 1px solid var(--sea-line); text-align: left; }
.prose thead th { border-bottom: 2px solid var(--abyss); font-weight: 700; white-space: nowrap; }

/* Khối code: nền biển sâu ở cả hai chế độ. Nút sao chép do site.js chèn (chỉ trong bài viết). */
.prose pre {
  margin: 0;
  padding: 1rem 1.25rem 1.15rem;
  border-radius: var(--r-md);
  background: #0B2A3C;
  color: #D7EAF4;
  font-family: var(--font-code);
  font-size: .875rem;
  line-height: 1.65;
  overflow-x: auto;
}
[data-bs-theme="dark"] .prose pre { background: #06161F; }
.code-block { position: relative; }
.code-copy {
  position: absolute;
  top: .5rem;
  right: .5rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .55rem;
  border: 0;
  border-radius: 4px;
  background: rgb(255 255 255 / 8%);
  color: #9FBDCD;
  font-size: .8125rem;
}
.code-copy:hover,
.code-copy:focus-visible { background: rgb(255 255 255 / 16%); color: #fff; }

/* Facade YouTube (MarkdownService): ảnh + nút play, iframe chỉ nạp khi bấm. */
.yt-facade {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #06202D;
  cursor: pointer;
}
.yt-facade img,
.yt-facade iframe { display: block; width: 100%; height: 100%; border: 0; object-fit: cover; border-radius: 0; }
.yt-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 92%);
  transform: translate(-50%, -50%);
  transition: transform .15s ease;
}
.yt-play::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #0369A1;
  transform: translate(-35%, -50%);
}
.yt-facade:hover .yt-play,
.yt-play:focus-visible { transform: translate(-50%, -50%) scale(1.08); }

/* Tô màu code (highlight.js, ADR-021). Khối code luôn nền tối ở cả hai theme nên chỉ cần một bộ màu — lấy theo bảng màu
   hải đồ thay cho theme có sẵn của thư viện (không nạp file CSS nào của highlight.js). */
.prose pre code.hljs { display: block; padding: 0; background: none; color: inherit; overflow-x: visible; }
.hljs-comment, .hljs-quote { color: #7F9CAD; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in, .hljs-doctag { color: #7DCCF0; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-string { color: #A8E6A1; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #F5C882; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #FFE9A3; }
.hljs-title.class_, .hljs-type { color: #9DE0D0; }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-params, .hljs-variable, .hljs-template-variable { color: #D7EAF4; }
.hljs-name, .hljs-tag, .hljs-selector-id, .hljs-selector-class { color: #8FD3F5; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #C3B1F5; }
.hljs-deletion { color: #F2A3AE; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

.post-foot {
  max-width: var(--measure);
  margin: 3rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sea-line);
}

.related { max-width: var(--measure-wide); margin: 4rem auto 0; }
.related h2 { font-size: 1.5rem; margin-bottom: 1.25rem; }
.related-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 2rem; list-style: none; padding: 0; margin: 0; }
.related-list li { padding-top: 1rem; border-top: 2px solid var(--abyss); }
.related-list a.related-title { display: block; margin: .4rem 0; color: var(--abyss); font-weight: 600; font-size: 1.0625rem; line-height: 1.4; text-decoration: none; }
.related-list a.related-title:hover { color: var(--sea); text-decoration: underline; }
.related-list time { color: var(--drift); font-size: var(--fs-sm); }
@media (max-width: 767.98px) { .related-list { grid-template-columns: 1fr; gap: 1.5rem; } }

/* ---------- Layout bài: wide, toc, cover, video, landing (Phase 9) ----------
   Chuẩn: docs/design/prototype/post-*.html. Danh mục layout và component: Components/Layouts/LayoutRegistry.cs. */
.layout-wide .post-head,
.layout-wide .prose,
.layout-wide .post-foot { max-width: var(--measure-wide); }
/* Bảng, code, ảnh dùng hết 960 px; đoạn văn vẫn giữ ~68 ký tự mỗi dòng cho dễ đọc. */
.layout-wide .prose > :is(p, ul, ol, blockquote) { max-width: var(--measure); }

.toc-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) 15rem;
  justify-content: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}
.toc-main .post-head,
.toc-main .post-cover,
.toc-main .prose,
.toc-main .post-foot { margin-left: 0; margin-right: 0; }
.toc-grid.toc-off { grid-template-columns: minmax(0, var(--measure)); }
.toc {
  position: sticky;
  top: 96px;
  align-self: start;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  font-size: .9375rem;
}
.toc h2 { font-size: var(--fs-ui); font-weight: 700; margin-bottom: .75rem; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--sea-line); }
.toc a {
  display: block;
  margin-left: -1px;
  padding: .3rem 0 .3rem 1rem;
  border-left: 2px solid transparent;
  color: var(--drift);
  text-decoration: none;
  line-height: 1.4;
}
.toc a:hover { color: var(--sea); }
.toc a[aria-current="true"] { color: var(--sea); border-left-color: var(--sea); font-weight: 600; }
.toc-mobile { display: none; }
.read-progress {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1040;
  width: 100%;
  height: 3px;
  background: var(--sea);
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  pointer-events: none;
}
@media (max-width: 991.98px) {
  .toc-grid { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mobile {
    display: block;
    max-width: var(--measure);
    margin: 0 0 2rem;
    padding: .75rem 1rem;
    border: 1px solid var(--sea-line);
    border-radius: var(--r-md);
    background: var(--sea-foam);
  }
  .toc-mobile summary { font-weight: 600; cursor: pointer; }
  .toc-mobile ol { margin: .75rem 0 .25rem; padding-left: 1.25rem; }
  .toc-mobile a { text-decoration: none; }
}

.cover-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(80vh, 720px);
  margin-bottom: 3.5rem;
  color: #fff;
}
.cover-hero > :is(.cover-img, .ph) { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; border-radius: 0; }
.cover-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(6 30 44 / 82%) 0%, rgb(6 30 44 / 35%) 45%, rgb(6 30 44 / 0%) 75%);
}
.cover-hero .container { position: relative; z-index: 1; padding-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.cover-hero .cover-text { max-width: 820px; }
.cover-hero h1 { color: #fff; font-size: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; margin: 1rem 0; }
.cover-hero .post-summary { color: rgb(255 255 255 / 88%); font-size: var(--fs-lead); max-width: 40ch; }
.cover-hero .meta,
.cover-hero .meta .bi { color: rgb(255 255 255 / 82%); }
.cover-hero .meta a { color: #fff; }
.cover-hero .cat-link { color: #fff; padding: .2rem .7rem; border: 1px solid rgb(255 255 255 / 55%); border-radius: 999px; }

.video-stage { background: #06202D; padding: clamp(1.5rem, 4vw, 3rem) 0; }
.video-stage .yt-facade { max-width: 1040px; margin: 0 auto; }
.video-stage .yt-play { width: 84px; height: 84px; }
.layout-video .post-head { margin-top: 2.5rem; }

.landing-hero { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
/* Nội dung landing không nằm trong .prose: tự giới hạn ảnh / video / code để không tràn ngang, và giữ đoạn văn ngoài
   các dải ở bề rộng đọc thoải mái. Dải (<section class="band">) vẫn tràn viền như trang Giới thiệu. */
.profile-content :is(img, video, iframe) { max-width: 100%; height: auto; }
.profile-content pre { overflow-x: auto; }
.layout-landing .profile-content > :not(.band) { max-width: var(--measure); }
.landing-hero h1 { max-width: 20ch; font-size: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; margin-bottom: 1rem; }

/* ---------- Danh sách: magazine, video-grid (Phase 9) ---------- */
.mag-lead {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-bottom: 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--sea-line);
}
/* Chuyên mục chỉ có một bài: không có cột bên cạnh — ảnh trái, chữ phải để ảnh 4:3 không cao quá màn hình. */
.mag-lead--solo { grid-template-columns: minmax(0, 1fr); }
.mag-lead--solo article {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-rows: 1fr auto auto auto 1fr;   /* hai hàng 1fr đệm trên/dưới: khối chữ nằm giữa theo chiều cao ảnh */
  column-gap: clamp(1.5rem, 4vw, 3rem);
}
.mag-lead--solo article > a { grid-row: 1 / -1; }
.mag-lead--solo article > time { grid-area: 2 / 2; }
.mag-lead--solo article > h2 { grid-area: 3 / 2; }
.mag-lead--solo article > p { grid-area: 4 / 2; }
@media (max-width: 991.98px) {
  .mag-lead--solo article { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .mag-lead--solo article > * { grid-area: auto; }
}
.mag-lead :is(.ph, .cover-img) { --ratio: 4 / 3; }
.mag-lead h2 { font-size: clamp(1.75rem, 1.1rem + 2vw, 2.5rem); letter-spacing: -0.03em; margin: .75rem 0 1rem; }
.mag-lead h2 a, .mag-side h3 a, .mag-grid h3 a { color: var(--abyss); text-decoration: none; }
.mag-lead h2 a:hover, .mag-side h3 a:hover, .mag-grid h3 a:hover { color: var(--sea); text-decoration: underline; }
.mag-lead p { color: var(--drift); font-size: var(--fs-body); }
.mag-side { display: grid; gap: 1.75rem; align-content: start; }
.mag-side article { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; }
.mag-side :is(.ph, .cover-img) { --ratio: 1 / 1; border-radius: var(--r-md); }
.mag-side h3 { font-size: 1.125rem; margin: .2rem 0 .35rem; }
.mag-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem 2.5rem; margin-bottom: 1rem; }
.mag-grid :is(.ph, .cover-img) { --ratio: 3 / 2; margin-bottom: 1.1rem; }
.mag-grid h3 { font-size: 1.5rem; letter-spacing: -0.02em; margin: .4rem 0 .5rem; }
.mag-grid p { color: var(--drift); }
@media (max-width: 991.98px) { .mag-lead { grid-template-columns: 1fr; } }
@media (max-width: 575.98px) { .mag-grid { grid-template-columns: 1fr; } }

.video-masonry { columns: 3 300px; column-gap: 1.5rem; }
.video-item { break-inside: avoid; margin: 0 0 2rem; }
.video-thumb { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 9; border-radius: var(--r-md); background: #06202D; }
.video-thumb > :is(img, .ph, .cover-img) { display: block; width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; border-radius: 0; }
.video-thumb .facade-play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgb(255 255 255 / 92%);
  color: #0369A1;
  font-size: 1.75rem;
  transform: translate(-50%, -50%);
  transition: transform .15s ease;
}
.video-thumb:hover .facade-play { transform: translate(-50%, -50%) scale(1.08); }
.video-thumb .platform {
  position: absolute;
  left: .6rem;
  top: .6rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: rgb(6 32 45 / 78%);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
}
.video-item figcaption { margin-top: .75rem; }
.video-item h3 { font-size: 1.125rem; margin: 0 0 .35rem; }
.video-item h3 a { color: var(--abyss); text-decoration: none; }
.video-item h3 a:hover { color: var(--sea); text-decoration: underline; }
.video-item p { color: var(--drift); font-size: .9375rem; margin: 0; }

.preview-note { margin: 1rem 0 0; }

/* ---------- Bình luận ---------- */
.comments { max-width: var(--measure); margin: 4.5rem auto 0; }
.comments > h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.comment-list,
.comment-replies { list-style: none; margin: 0; padding: 0; }
.comment { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: .9rem; padding: 1.25rem 0; border-top: 1px solid var(--sea-line); }
.comment-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sea-tint);
  color: var(--sea-strong);
  font-weight: 700;
}
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; margin-bottom: .3rem; }
.comment-head strong { font-weight: 600; }
.comment-head time { color: var(--drift); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
/* Nội dung bình luận luôn là text (Blazor tự escape) — giữ xuống dòng bằng CSS (P-06). */
.comment-body { margin: 0; white-space: pre-wrap; }
.comment-replies { margin-top: .5rem; padding-left: 1.25rem; border-left: 2px solid var(--sea-line); }
.comment-replies .comment { border-top: 0; padding-bottom: 0; }
.comment-form {
  margin-top: 2rem;
  padding: 1.75rem;
  border-radius: var(--r-md);
  background: var(--sea-foam);
  border: 1px solid var(--sea-line);
}
.comment-form h3 { font-size: 1.25rem; }
/* Honeypot: ẩn khỏi người thật bằng vị trí, không dùng display:none (P-07). */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Thông báo, badge ---------- */
.notice { padding: .75rem 1rem; border-radius: var(--r-sm); font-size: .9375rem; }
.notice-ok { background: var(--sea-tint); color: var(--sea-strong); }
.notice-warn { background: #FFF4DB; color: #6B4A00; }
[data-bs-theme="dark"] .notice-warn { background: #3A2E10; color: #F5D98C; }

.badge-ok { background: var(--sea-tint); color: var(--sea-strong); }
.badge-muted { background: var(--sea-line); color: var(--drift); }

/* ==========================================================================
   Admin — giữ markup hiện có, đổi sang token mới. Giao diện admin làm lại ở Phase 10 và 12.
   Ô nhập trần (<input>, <label>) chỉ được style trong vùng admin và trang đăng nhập.
   ========================================================================== */
.admin-bar { background: var(--abyss); }
.admin-bar .navbar { padding-block: .6rem; }
.admin-bar .brand,
.admin-bar .admin-nav a { color: var(--sea-shallow); }
.admin-bar .brand-mark { color: var(--sea-wave); }
.admin-bar .admin-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.admin-bar .admin-nav a { font-weight: 500; text-decoration: none; opacity: .85; }
.admin-bar .admin-nav a:hover { opacity: 1; text-decoration: underline; }
.admin-bar .icon-btn { color: var(--sea-shallow); }
.admin-bar .icon-btn:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.admin-bar .btn-ghost { --bs-btn-color: var(--sea-shallow); --bs-btn-border-color: rgb(255 255 255 / 25%); }
.admin-bar form { margin: 0; }
.admin-main { padding-block: 2rem 4rem; }

.admin-main label,
.login-card label { display: block; font-size: .9375rem; font-weight: 600; color: var(--abyss); }
.admin-main :is(input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea),
.login-card input {
  display: block;
  width: 100%;
  margin-top: .35rem;
  padding: .55rem .8rem;
  font: inherit;
  font-size: 1rem;
  color: var(--abyss);
  background: var(--sea-foam);
  border: 1px solid var(--sea-line);
  border-radius: var(--r-sm);
}
.admin-main :is(input, select, textarea):focus,
.login-card input:focus { border-color: var(--sea); outline: none; box-shadow: 0 0 0 .2rem rgba(var(--sea-rgb), .25); }
.admin-main textarea { resize: vertical; }

.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.admin-head h1 { margin: 0; font-size: 1.75rem; }
.admin-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.form-hint { margin: 0 0 1rem; color: var(--drift); font-size: .9375rem; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--sea-foam); border-radius: var(--r-md); overflow: hidden; font-size: .9375rem; }
.admin-table th,
.admin-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--sea-line); text-align: left; vertical-align: middle; }
.admin-table th { background: var(--sea-tint); font-size: .875rem; font-weight: 700; color: var(--abyss); }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.row-actions .btn { padding: .3rem .7rem; font-size: .875rem; }

.editor-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.editor-meta > label { flex: 0 1 260px; }
.editor-meta > label.grow { flex: 1 1 320px; }

.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.editor-pane { display: flex; flex-direction: column; background: var(--sea-foam); border: 1px solid var(--sea-line); border-radius: var(--r-md); overflow: hidden; }
.pane-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 1rem;
  background: var(--sea-tint);
  border-bottom: 1px solid var(--sea-line);
  font-size: .875rem;
  font-weight: 700;
}
.pane-head .muted { font-weight: 400; }
.admin-main .md-input {
  margin: 0;
  min-height: 60vh;
  padding: 1.25rem;
  border: 0;
  border-radius: 0;
  font-family: var(--font-code);
  font-size: .875rem;
  line-height: 1.7;
  resize: vertical;
}
.md-preview { min-height: 60vh; padding: 1.25rem; overflow-y: auto; background: var(--sea-shallow); }
.md-preview.prose { max-width: none; margin: 0; font-size: 1rem; }

/* Chọn Markdown / HTML trực quan và editor HTML (Phase 10, ADR-015). TinyMCE vẽ giao diện riêng (skin oxide);
   ở đây chỉ có khung, hai tab và ô mã HTML. */
.format-switch { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: 1.5rem; font-size: .9375rem; font-weight: 600; }
.format-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .75rem; }
.html-editor { margin-top: 1rem; background: var(--sea-foam); border: 1px solid var(--sea-line); border-radius: var(--r-md); }
.editor-tabs { display: flex; align-items: center; gap: .25rem; padding: 0 .75rem; background: var(--sea-tint); border-bottom: 1px solid var(--sea-line); border-radius: var(--r-md) var(--r-md) 0 0; }
.editor-tabs [role="tab"] {
  margin-bottom: -1px;
  padding: .6rem .9rem;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--drift);
  font-size: .875rem;
  font-weight: 700;
}
.editor-tabs [role="tab"].active { color: var(--sea-strong); border-bottom-color: var(--sea); }
.editor-status { margin-left: auto; color: var(--drift); font-size: .8125rem; }
.html-editor .tox-tinymce { border: 0; border-radius: 0 0 var(--r-md) var(--r-md); }
.admin-main .html-code {
  display: block;
  width: 100%;
  min-height: 60vh;
  margin: 0;
  padding: 1.25rem;
  border: 0;
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-family: var(--font-code);
  font-size: .875rem;
  line-height: 1.7;
  resize: vertical;
}

/* Ô chọn layout bài (Phase 9) — theo docs/design/prototype/admin-editor.html. Đè rule chung .admin-main label. */
.layout-section { margin-top: 2rem; }
.layout-section > h2 { font-size: 1.125rem; margin-bottom: .75rem; }
.layout-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .5rem; }
.layout-option { position: relative; }
.layout-option input { position: absolute; opacity: 0; pointer-events: none; }
.admin-main .layout-option label {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: .85rem;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: .6rem .7rem;
  border: 1px solid var(--sea-line);
  border-radius: var(--r-sm);
  background: var(--sea-foam);
  cursor: pointer;
}
.admin-main .layout-option label:hover { border-color: var(--sea-wave); }
.admin-main .layout-option input:checked + label { border-color: var(--sea); box-shadow: inset 0 0 0 1px var(--sea); background: var(--sea-tint); }
.admin-main .layout-option input:focus-visible + label { outline: 2px solid var(--sea); outline-offset: 2px; }
.layout-option svg { width: 64px; height: 44px; color: var(--sea); }
.layout-option strong { display: block; color: var(--abyss); font-size: .9375rem; }
.layout-option label span span { display: block; color: var(--drift); font-size: .8125rem; font-weight: 400; line-height: 1.35; }
.layout-warning { display: flex; gap: .5rem; margin: .75rem 0 0; padding: .6rem .8rem; border-radius: var(--r-sm); background: #FFF4DB; color: #6B4A00; font-size: .875rem; }
[data-bs-theme="dark"] .layout-warning { background: #3A2E10; color: #F5D98C; }
.admin-main textarea.code-input { font-family: var(--font-code); font-size: .8125rem; }

.danger-zone { display: flex; align-items: center; gap: .75rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--sea-line); }

.moderation-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.moderation-item { padding: 1.25rem; background: var(--sea-foam); border: 1px solid var(--sea-line); border-radius: var(--r-md); }
.moderation-head { display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; font-size: .875rem; color: var(--drift); }
.moderation-head strong { color: var(--abyss); }
.moderation-body { white-space: pre-wrap; }
.moderation-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.admin-newform { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--sea-line); }
.admin-newform h2 { margin-bottom: 1rem; font-size: 1.15rem; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 1.25rem; }
.login-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(380px, 100%);
  padding: 2rem;
  background: var(--sea-foam);
  border: 1px solid var(--sea-line);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgb(6 30 44 / 10%);
}
.login-card h1 { margin: 0; font-size: 1.5rem; }

@media (max-width: 860px) {
  .editor-split { grid-template-columns: 1fr; }
  .admin-main .md-input,
  .md-preview { min-height: 40vh; }
  .admin-table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
