/* =========================================================
   PhoneWise VN — GEO-optimized product-comparison stylesheet
   Mobile-first, dependency-free, semantic-first CSS.
   ========================================================= */

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f5f7fa;
  --color-text: #16202e;
  --color-text-muted: #5b6577;
  --color-border: #e2e6ee;
  --color-navy: #12294d;
  --color-navy-dark: #0b1c38;
  --color-primary: #c2410c;
  --color-primary-dark: #9a3412;
  --color-accent-blue: #2563eb;
  --color-accent-green: #16a34a;
  --color-code-bg: #f1f0fb;
  --radius: 10px;
  --max-width: 1120px;
  --max-width-narrow: 820px;
  --font-sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #10141c;
    --color-bg-alt: #171c27;
    --color-text: #e9edf3;
    --color-text-muted: #a2aabb;
    --color-border: #2a3140;
    --color-navy: #16305c;
    --color-navy-dark: #0b1c38;
    --color-primary: #fb923c;
    --color-primary-dark: #fdba74;
    --color-accent-blue: #60a5fa;
    --color-accent-green: #4ade80;
    --color-code-bg: #1c2230;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1.5px;
}

a:hover {
  color: var(--color-primary-dark);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

/* ---------- Layout helpers ---------- */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--color-text);
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-navy), var(--color-primary));
  color: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-updated {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.btn-cta {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-cta:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

/* ---------- Sticky tab bar ---------- */
.tab-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-navy);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.tab-bar-scroll {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tab-bar-scroll::-webkit-scrollbar {
  display: none;
}

.tab-bar a {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.9rem 0.1rem;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab-bar a:hover {
  color: #fff;
}

.tab-bar a.active,
.tab-bar a:focus-visible {
  color: #fff;
  border-bottom-color: var(--color-primary);
}

/* ---------- Article hero ---------- */
.article-hero {
  padding: 2rem 0;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
}

.hero-grid {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}

.breadcrumb {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
}

.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.category-badge {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  margin-bottom: 0.9rem;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 0 0 0.9rem;
  letter-spacing: -0.01em;
}

@media (min-width: 640px) {
  h1 {
    font-size: 2.3rem;
  }
}

.deck {
  font-size: 1.02rem;
  color: var(--color-text-muted);
  margin: 0 0 1.25rem;
  max-width: 65ch;
}

.meta-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.meta-chips li {
  margin: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ---------- Quick verdict sidebar ---------- */
.quick-verdict {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(18, 41, 77, 0.08);
}

.quick-verdict h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.quick-verdict dl {
  margin: 0;
  display: grid;
  gap: 0.9rem;
}

.quick-verdict-row {
  border-left: 3px solid var(--color-primary);
  padding-left: 0.75rem;
}

.quick-verdict-row dt {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 0.15rem;
}

.quick-verdict-row dd {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.quick-verdict-row dd a {
  color: var(--color-text);
  text-decoration: none;
}

.quick-verdict-row dd a:hover {
  color: var(--color-primary);
}

/* ---------- Article body ---------- */
main .wrap > section,
main .wrap > .author-box {
  max-width: var(--max-width-narrow);
}

#top5,
#so-sanh,
#cau-hinh {
  max-width: none;
}

article {
  padding-bottom: 2rem;
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  margin-right: 0.5rem;
  vertical-align: middle;
}

h2 {
  font-size: 1.4rem;
  margin: 2.75rem 0 0.9rem;
  letter-spacing: -0.01em;
  scroll-margin-top: 4.5rem;
  display: flex;
  align-items: center;
}

h3 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.6rem;
  scroll-margin-top: 4.5rem;
}

p {
  margin: 0 0 1.05rem;
}

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

li {
  margin: 0.4rem 0;
}

li::marker {
  color: var(--color-primary);
}

strong {
  color: var(--color-text);
}

code {
  background: var(--color-code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  font-size: 0.9em;
}

/* ---------- Product grid (Top 5) ---------- */
.product-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 1fr;
  margin: 1.5rem 0;
}

@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1020px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.product-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--color-accent-blue);
  border-radius: var(--radius);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
}

.product-card--blue {
  border-top-color: var(--color-accent-blue);
}

.product-card--green {
  border-top-color: var(--color-accent-green);
}

.product-card--orange {
  border-top-color: var(--color-primary);
}

.product-card--blue .product-badge {
  color: var(--color-accent-blue);
}

.product-card--green .product-badge {
  color: var(--color-accent-green);
}

.product-card--orange .product-badge {
  color: var(--color-primary);
}

.product-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}

.product-card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
}

.product-price {
  font-weight: 800;
  color: var(--color-primary);
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.product-card ul {
  margin: 0 0 0.9rem;
  padding-left: 1.1rem;
  font-size: 0.86rem;
  color: var(--color-text-muted);
  flex-grow: 1;
}

.product-card li {
  margin: 0.3rem 0;
}

.product-link {
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

/* ---------- Comparison table ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 0.9rem;
}

caption {
  text-align: left;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: 0.75rem 1rem 0;
  caption-side: top;
}

th,
td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

thead th {
  background: var(--color-navy);
  color: #fff;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody th[scope="row"] {
  font-weight: 700;
  background: var(--color-bg-alt);
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--color-bg-alt);
}

/* ---------- Detail reviews ---------- */
.detail-review {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
}

.detail-review:last-child {
  border-bottom: none;
}

.detail-review h3 {
  margin-top: 0;
}

/* ---------- Strategy list / numbered cards ---------- */
.strategy-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  display: grid;
  gap: 0.9rem;
}

.strategy-list li {
  margin: 0;
  display: flex;
  gap: 0.9rem;
  padding: 1rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.strategy-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.strategy-list h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.strategy-list p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--color-text-muted);
}

/* ---------- FAQ ---------- */
.faq-list {
  margin: 1.25rem 0;
  display: grid;
  gap: 0.6rem;
}

.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-alt);
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 0.95rem 1.1rem;
  font-weight: 700;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--color-primary);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item .faq-answer {
  padding: 0 1.1rem 1.1rem;
  color: var(--color-text-muted);
}

.faq-item .faq-answer p {
  margin: 0;
}

/* ---------- Author box ---------- */
.author-box {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin: 2.25rem auto;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-blue), var(--color-navy));
  flex-shrink: 0;
}

.author-box .avatar {
  width: 52px;
  height: 52px;
}

.author-box h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.author-box p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

/* ---------- References ---------- */
.references {
  margin: 1rem 0 0;
  padding-left: 1.35rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.references li {
  margin: 0.55rem 0;
}

.references cite {
  font-style: normal;
  color: var(--color-text);
  font-weight: 600;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  margin-top: 2rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  align-items: center;
}

.site-footer nav {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-primary);
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ---------- Reading progress ---------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-blue));
  z-index: 60;
  transition: width 0.1s linear;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .back-to-top,
  .faq-item summary::after {
    transition: none;
  }
}
