/* Clean personal blog stylesheet — white background, black text, readable typography */
:root {
  --bg: #ffffff;
  --bg-subtle: #f7f7f8;
  --text: #1a1a1a;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --link: #111827;
  --accent: #b91c1c;
  --accent-bg: #fef2f2;
  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --max-width: 760px;
}

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

html {
  overflow-x: clip;
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.78;
}

/* Skip link for keyboard accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 0.75rem;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}

a:hover {
  text-decoration-color: var(--text);
}

.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Simple top blog header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.site-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.site-nav a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.25rem 0;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Article container */
.article {
  padding: 2.25rem 0 3.5rem;
}

.article-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.article-meta span + span::before {
  content: ' · ';
}

h1 {
  font-size: clamp(1.65rem, 3.6vw, 2.25rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
}

.article-lead {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
}

/* Simple Table of Contents box (familiar Vietnamese blog style) */
.toc {
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.toc-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.7;
}

.toc li {
  margin-bottom: 0.2rem;
}

.toc a {
  color: var(--text-secondary);
  text-decoration: none;
}

.toc a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Body Typography */
h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.55rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 2.5rem 0 0.85rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}

h3 {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin: 1.5rem 0 0.6rem;
}

p {
  margin: 0 0 1.1rem;
}

ul, ol {
  margin: 0 0 1.25rem;
  padding-left: 1.35rem;
}

li {
  margin-bottom: 0.45rem;
}

strong {
  font-weight: 600;
  color: var(--text);
}

/* Natural blog blockquote */
blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1.1rem;
  border-left: 3px solid var(--text);
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 1rem;
}

blockquote p {
  margin: 0 0 0.35rem;
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote cite {
  display: block;
  font-style: normal;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Summary info box */
.summary-box {
  margin: 1.25rem 0 1.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle);
  font-size: 0.95rem;
}

.summary-box p {
  margin-bottom: 0.5rem;
}

.summary-box p:last-child {
  margin-bottom: 0;
}

/* Inline Blog Figures & Uncropped Screenshot Grids */
.photo-block {
  margin: 1.5rem 0 1.75rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 1.75rem;
  align-items: start;
}

.photo-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

figure {
  margin: 0;
}

.img-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-subtle);
  overflow: hidden;
  cursor: zoom-in;
}

.img-btn:hover {
  border-color: var(--border-strong);
}

.img-btn img {
  width: 100%;
  height: auto;
}

.photo-single {
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.photo-single--wide {
  max-width: 100%;
}

figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-muted);
  text-align: center;
}

/* Comparison labels (simple, plain blog badges) */
.tag-ok,
.tag-bad {
  display: inline-block;
  margin-bottom: 0.4rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 600;
}

.tag-ok {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid var(--border);
}

.tag-bad {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--border);
}

/* Clean simple HTML comparison table (Google Maps vs Zalo) */
.compare-table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.65;
  border: 1px solid var(--border);
}

.compare-table th,
.compare-table td {
  padding: 0.8rem 0.95rem;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--border);
}

.compare-table thead th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text);
  width: 50%;
}

/* Deferred below-the-fold FAQ section (Modern Web Guidance: defer-rendering-heavy-content) */
.faq-section {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 620px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:first-of-type {
  border-top: 1px solid var(--border);
}

.faq-item summary {
  padding: 0.95rem 0;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item .faq-body {
  padding-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.faq-item .faq-body p:last-child {
  margin-bottom: 0;
}

/* Simple share row at article end */
.pledge-box {
  margin: 1.75rem 0 2rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--text);
  border-radius: 4px;
  background: var(--bg-subtle);
}

.pledge-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.45rem;
  color: var(--text);
}

.pledge-box p:last-child {
  margin-bottom: 0;
}

.share-row {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.btn-plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-plain:hover {
  background: var(--bg-subtle);
  border-color: var(--text);
}

.copy-msg {
  font-size: 0.85rem;
  color: var(--ok);
}

/* Native <dialog> Lightbox (Modern Web Guidance: dialog + prevent-page-scroll-under-modal-dialog) */
dialog#lightbox {
  padding: 0;
  margin: auto;
  max-width: min(94vw, 60rem);
  max-height: 92dvh;
  width: fit-content;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

dialog#lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  overflow: hidden;
  overscroll-behavior: contain;
}

.lb-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.lb-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.lb-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  cursor: pointer;
  white-space: nowrap;
}

.lb-btn:hover {
  background: var(--border);
}

.lb-body {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 0.75rem;
  background: #111111;
}

.lb-body img {
  max-height: 70dvh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lb-cap {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
  background: var(--bg);
}

/* Mobile Responsive */
@media (max-width: 640px) {
  body {
    font-size: 1rem;
  }

  .article {
    padding: 1.5rem 0 2.5rem;
  }

  .photo-grid,
  .photo-grid--3 {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .compare-table,
  .compare-table thead,
  .compare-table tbody,
  .compare-table tr,
  .compare-table th,
  .compare-table td {
    display: block;
    width: 100%;
  }

  .compare-table thead {
    display: none;
  }

  .compare-table tr {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
  }

  .compare-table td {
    border: 0;
    border-bottom: 1px solid var(--border);
  }

  .compare-table td:last-child {
    border-bottom: 0;
  }

  .compare-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
  }

  .lb-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .lb-actions {
    justify-content: flex-end;
  }
}

@media print {
  .site-header,
  .toc,
  .share-row,
  dialog#lightbox {
    display: none !important;
  }

  .faq-section {
    content-visibility: visible;
  }
}
