/* ============================================================
   jonathanhainguyen.info · v2 personal blog
   PALETTE: matched với linhnam.vn (Maroon · Gold · Cream · Dark)
   ============================================================ */

:root {
  /* ── Linhnam.vn brand palette ── */
  --maroon:    #8B1A1A;
  --maroon-2:  #6e1414;
  --maroon-3:  #2d0f0f;
  --maroon-4:  #1a0808;
  --gold:      #C9A84C;
  --gold-2:    #D4B96A;       /* light gold */
  --gold-3:    #A88A38;
  --cream:     #F5F0E8;
  --dark:      #1A1A1A;

  /* ── Background gradient (matches linhnam.vn body) ── */
  --bg:        #0a0a0a;
  --panel:     rgba(45,15,15,0.85);
  --border:    rgba(201,168,76,0.22);

  /* ── Text on dark (cream-based per linhnam.vn) ── */
  --text:      #F5F0E8;
  --text-2:    rgba(245,240,232,0.78);
  --text-3:    rgba(245,240,232,0.55);
  --text-4:    rgba(245,240,232,0.35);

  /* ── Legacy aliases (avoid breaking existing rules) ── */
  --navy:      var(--maroon);
  --navy-2:    var(--maroon-2);
  --navy-3:    var(--maroon-4);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 500; margin: 0 0 0.5em; line-height: 1.15; }
h1 { font-size: clamp(40px, 6vw, 64px); letter-spacing: -1px; }
h2 { font-size: clamp(28px, 4vw, 42px); }
h3 { font-size: clamp(20px, 3vw, 28px); }
p { margin: 0 0 1em; }
a { color: var(--gold); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--gold-2); }
::selection { background: var(--maroon); color: var(--cream); }

/* ── Background layer (matched với linhnam.vn maroon gradient) ── */
.bg-layer {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a0808 30%, #2d0f0f 60%, #0a0a0a 100%);
}
.bg-layer::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(201,168,76,0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139,26,26,0.18) 0%, transparent 60%);
  pointer-events: none;
}

/* ── Top navigation ── */
nav.topnav {
  position: sticky; top: 0; z-index: 100;
  padding: 16px 32px;
  display: flex; justify-content: space-between; align-items: center;
  backdrop-filter: blur(12px);
  background: rgba(10,10,10,0.85);
  border-bottom: 1px solid rgba(201,168,76,0.14);
}
.nav-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px; letter-spacing: 1.5px;
  color: var(--gold); font-weight: 600;
  text-decoration: none;
}
.nav-brand:hover { color: var(--gold-2); }
.nav-menu {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.nav-menu a {
  color: var(--text-2);
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  padding: 6px 14px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.5px;
  position: relative;
}
.nav-menu a:hover, .nav-menu a.active {
  color: var(--gold);
}
.nav-menu a.active::after {
  content: ''; position: absolute;
  left: 14px; right: 14px; bottom: -2px;
  height: 1px; background: var(--gold);
}
.nav-lang {
  display: flex; gap: 8px; align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 11px; letter-spacing: 1px;
}
.nav-lang a {
  color: var(--text-3); padding: 4px 8px; border-radius: 3px; cursor: pointer;
}
.nav-lang a.active, .nav-lang a:hover { color: var(--gold); background: rgba(201,168,76,0.06); }
.nav-lang span { color: var(--text-4); opacity: 0.5; }

/* Mobile menu toggle */
.mobile-toggle {
  display: none;
  background: transparent; border: 0; color: var(--gold);
  font-size: 24px; cursor: pointer; padding: 4px;
}

/* ── Container ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}
.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ── Hero ── */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}
.hero .lede {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 28px);
  color: var(--text-2);
  max-width: 720px;
  margin: 0 auto 24px;
  line-height: 1.5;
}

/* ── Section headings ── */
.section-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 14px;
  background: rgba(201,168,76,0.10);
  border: 1px solid var(--border);
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
}
.section-tag .icon { font-size: 14px; }

/* ── Cards / Article list ── */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
  margin: 40px 0;
}
.article-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: 0.3s;
  display: flex; flex-direction: column;
}
.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.article-card .cover {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--maroon-3), var(--maroon-4));
  background-size: cover; background-position: center;
  position: relative;
}
.article-card .cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.article-card .cover .cat-pill {
  position: absolute; top: 12px; left: 12px;
  background: rgba(10,10,10,0.85);
  color: var(--gold);
  padding: 4px 10px; border-radius: 12px;
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  border: 1px solid var(--gold);
}
.article-card .body { padding: 20px 22px 24px; flex: 1; display: flex; flex-direction: column; }
.article-card h3 {
  font-size: 22px; line-height: 1.25; margin: 0 0 10px;
  color: var(--text);
}
.article-card .excerpt {
  color: var(--text-2);
  font-size: 14px; line-height: 1.55;
  margin: 0 0 14px;
  flex: 1;
}
.article-card .meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-3);
  letter-spacing: 0.5px;
}
.article-card a { color: inherit; text-decoration: none; display: block; height: 100%; }
.article-card a:hover h3 { color: var(--gold); }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 80px 20px;
  color: var(--text-3);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 24px; color: var(--gold); margin-bottom: 8px; }

/* ============================================================
   Phase 99.1 · Magazine layout + refined cards
   ============================================================ */

/* Category hero — replaces simple .hero on category pages */
.cat-hero {
  padding: 80px 0 40px;
  text-align: center;
  position: relative;
}
.cat-hero .icon-large {
  font-size: clamp(48px, 7vw, 80px);
  display: block; margin-bottom: 12px;
  filter: drop-shadow(0 4px 16px rgba(201,168,76,0.3));
}
.cat-hero h1 {
  font-size: clamp(48px, 7vw, 80px);
  margin: 0 0 12px;
  letter-spacing: -2px;
}
.cat-hero h1 em { color: var(--gold); font-weight: 400; }
.cat-hero .subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(18px, 2.4vw, 24px);
  color: var(--text-2);
  max-width: 580px;
  margin: 0 auto 20px;
  line-height: 1.5;
}
.cat-hero .stats-row {
  display: flex; justify-content: center; gap: 32px; flex-wrap: wrap;
  font-size: 12px; letter-spacing: 1.5px; color: var(--text-3); text-transform: uppercase;
  margin-top: 16px;
}
.cat-hero .stats-row span { white-space: nowrap; }
.cat-hero .stats-row strong { color: var(--gold); font-weight: 600; }
.cat-hero .accent-rule {
  width: 80px; height: 1px; background: var(--gold);
  margin: 24px auto 0;
}

/* ── Magazine grid (1 hero + 2 medium + N small) ── */
.magazine-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 28px;
  margin: 48px 0;
}
.magazine-grid .card-hero {
  grid-column: 1 / -1;
}
.magazine-grid .card-medium { /* 2 in row */ }
.magazine-grid .card-small {
  /* fall-through for grid: small cards in 4 cols */
}
.magazine-grid .smalls-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

/* ── Refined article card v2 ── */
.article-card-v2 {
  background: rgba(245,240,232,0.025);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column;
  position: relative;
  isolation: isolate;
}
.article-card-v2::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cat-color, var(--gold));
  opacity: 0;
  transition: 0.3s;
  z-index: 2;
}
.article-card-v2:hover {
  transform: translateY(-6px);
  border-color: var(--cat-color, var(--gold));
  box-shadow: 0 24px 56px rgba(0,0,0,0.5);
}
.article-card-v2:hover::before { opacity: 1; }
.article-card-v2 a {
  color: inherit; text-decoration: none;
  display: flex; flex-direction: column; height: 100%;
}
.article-card-v2 .cover {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--maroon-3), var(--maroon-4));
  background-size: cover; background-position: center;
  position: relative;
  overflow: hidden;
}
.article-card-v2 .cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.6s ease;
}
.article-card-v2:hover .cover img { transform: scale(1.06); }
.article-card-v2 .cover-tint {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(10,10,10,0.7) 100%);
  pointer-events: none;
}
.article-card-v2 .cat-chip {
  position: absolute; top: 14px; left: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(8px);
  color: var(--cat-color, var(--gold));
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
  font-weight: 600;
  border: 1px solid var(--cat-color, var(--gold));
}
.article-card-v2 .read-time-chip {
  position: absolute; bottom: 14px; right: 14px;
  background: rgba(10,10,10,0.75);
  backdrop-filter: blur(6px);
  color: var(--cream);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px; letter-spacing: 0.5px;
  font-weight: 500;
}
.article-card-v2 .body {
  padding: 24px 26px 28px;
  flex: 1; display: flex; flex-direction: column;
}
.article-card-v2 h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--text);
  transition: color 0.2s;
}
.article-card-v2:hover h3 { color: var(--cat-color, var(--gold)); }
.article-card-v2 .excerpt {
  color: var(--text-2);
  font-size: 14px; line-height: 1.65;
  margin: 0 0 16px;
  flex: 1;
}
.article-card-v2 .tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px;
}
.article-card-v2 .tag {
  font-size: 10px; letter-spacing: 0.5px;
  padding: 3px 9px;
  background: rgba(245,240,232,0.05);
  color: var(--text-3);
  border-radius: 4px;
  border: 1px solid rgba(201,168,76,0.10);
}
.article-card-v2 .meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-3);
  letter-spacing: 0.5px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.article-card-v2 .meta .author { color: var(--gold-2); font-weight: 500; }
.article-card-v2 .meta .read-arrow {
  color: var(--cat-color, var(--gold));
  font-weight: 600;
  transition: 0.3s;
}
.article-card-v2:hover .meta .read-arrow { transform: translateX(4px); }

/* Hero card variant — bigger, side-by-side image */
.article-card-v2.card-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: stretch;
}
.article-card-v2.card-hero .cover {
  aspect-ratio: auto;
  height: 100%;
  min-height: 320px;
}
.article-card-v2.card-hero a {
  display: contents;
}
.article-card-v2.card-hero .body {
  padding: 40px 44px 36px;
  display: flex; flex-direction: column; justify-content: center;
}
.article-card-v2.card-hero h3 {
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1.15;
  margin-bottom: 16px;
}
.article-card-v2.card-hero .excerpt {
  font-size: 15px;
  line-height: 1.7;
}
.article-card-v2.card-hero .featured-badge {
  display: inline-block;
  background: var(--cat-color, var(--gold));
  color: var(--maroon-4);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 14px;
  align-self: flex-start;
}

/* Mobile responsive for magazine grid */
@media (max-width: 900px) {
  .magazine-grid { grid-template-columns: 1fr; gap: 20px; }
  .article-card-v2.card-hero { grid-template-columns: 1fr; }
  .article-card-v2.card-hero .cover { min-height: 200px; }
  .article-card-v2.card-hero .body { padding: 28px; }
  .article-card-v2.card-hero h3 { font-size: 26px; }
}

/* ── About page sections ── */
.about-hero {
  padding: 80px 0 40px;
  text-align: center;
}
.about-hero .portrait-frame {
  display: inline-block;
  padding: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-3));
  margin-bottom: 28px;
  box-shadow: 0 16px 48px rgba(201,168,76,0.20);
}
.about-hero .portrait {
  width: 200px; height: 200px;
  border-radius: 50%;
  display: block;
  border: 4px solid var(--maroon-4);
  object-fit: cover;
}
.about-hero .name {
  font-size: clamp(40px, 6vw, 64px);
  margin: 0 0 8px;
}
.about-hero .name .gold { color: var(--gold); font-style: italic; font-weight: 400; }
.about-hero .alias {
  color: var(--text-3); font-size: 14px;
  font-family: 'Inter', sans-serif;
  letter-spacing: 1px;
  margin-bottom: 20px;
}
.about-hero .roles {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 24px auto;
  max-width: 800px;
}
.about-hero .role-pill {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 16px;
  font-size: 12px; color: var(--text-2);
}
.about-hero .role-pill .position { color: var(--gold); margin-right: 6px; font-weight: 600; }

.about-section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}
.about-section h2 {
  color: var(--gold);
  text-align: center;
  margin-bottom: 32px;
}
.about-section .section-icon {
  display: block; text-align: center; font-size: 32px; margin-bottom: 8px;
}

.principles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px;
  margin-top: 32px;
}
.principles .principle {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  position: relative;
}
.principles .principle .num {
  position: absolute; top: -12px; left: 24px;
  background: var(--gold); color: var(--maroon-4);
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700; font-size: 18px;
  box-shadow: 0 4px 12px rgba(201,168,76,0.3);
}
.principles .principle h4 {
  font-size: 18px; color: var(--gold-2);
  margin: 8px 0 8px;
}
.principles .principle p { font-size: 14px; color: var(--text-2); margin: 0; line-height: 1.5; }

.values {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  margin: 24px 0;
}
.values .value-pill {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  color: var(--gold);
  padding: 10px 22px;
  background: rgba(201,168,76,0.06);
  border: 1px solid var(--border);
  border-radius: 28px;
  font-style: italic;
}

.contact-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
  margin-top: 24px;
}
.contact-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}
.contact-card .icon { font-size: 24px; color: var(--gold); }
.contact-card .label { font-size: 11px; letter-spacing: 1.5px; color: var(--text-3); text-transform: uppercase; margin: 8px 0 4px; }
.contact-card .value { color: var(--text); font-size: 14px; word-break: break-all; }
.contact-card a { color: var(--text); }
.contact-card a:hover { color: var(--gold); }

/* ── Article detail ── */
.article-detail {
  padding: 56px 0;
}
.article-detail .breadcrumb {
  font-size: 12px; color: var(--text-3); margin-bottom: 24px;
  letter-spacing: 0.5px;
}
.article-detail .breadcrumb a { color: var(--text-3); }
.article-detail .breadcrumb a:hover { color: var(--gold); }
.article-detail .title {
  font-size: clamp(32px, 5vw, 56px);
  margin-bottom: 16px;
}
.article-detail .meta {
  color: var(--text-3); font-size: 13px; letter-spacing: 0.5px;
  margin-bottom: 32px;
  display: flex; gap: 16px; flex-wrap: wrap;
}
.article-detail .hero-img {
  width: 100%; max-height: 480px; object-fit: cover;
  border-radius: 14px; margin: 32px 0;
}
.article-content {
  font-size: 17px; line-height: 1.8;
  color: var(--text);
}
.article-content h2, .article-content h3 { color: var(--gold); margin-top: 1.4em; }
.article-content p { margin-bottom: 1.2em; text-align: justify; }
.article-content a { border-bottom: 1px dotted var(--gold); }
.article-content blockquote {
  border-left: 3px solid var(--gold);
  padding-left: 20px; margin: 1.5em 0;
  color: var(--text-2); font-style: italic;
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; line-height: 1.5;
}
.article-content img { max-width: 100%; border-radius: 10px; margin: 1em 0; }

/* ── Related posts ── */
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
  margin-top: 40px;
}
.related-card {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; transition: 0.2s;
}
.related-card:hover { border-color: var(--gold); }
.related-card a { color: var(--text); text-decoration: none; }
.related-card .cat { font-size: 10px; letter-spacing: 1.5px; color: var(--gold); text-transform: uppercase; }
.related-card h4 { font-family: 'Cormorant Garamond', serif; font-size: 18px; margin: 6px 0 0; line-height: 1.25; }

/* ── Footer ── */
footer.site-footer {
  margin-top: 80px;
  padding: 40px 0 32px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(15,40,71,0.4) 0%, transparent 100%);
}
footer.site-footer .footer-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-3); letter-spacing: 0.5px;
  flex-wrap: wrap; gap: 16px;
}
footer.site-footer .social { display: flex; gap: 16px; }
footer.site-footer .social a { color: var(--text-3); }
footer.site-footer .social a:hover { color: var(--gold); }

/* ── Loader ── */
.loader {
  text-align: center; padding: 60px 20px; color: var(--gold);
  font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 18px;
}
.spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 2px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px; vertical-align: -6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 900px) {
  nav.topnav { padding: 12px 20px; }
  .container, .container-narrow { padding: 0 20px; }
  .nav-menu { display: none; }
  .nav-menu.open {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(10,10,10,0.98);
    padding: 16px; gap: 0;
    border-bottom: 1px solid var(--border);
    align-items: stretch;
  }
  .nav-menu.open a { padding: 12px 16px; border-radius: 6px; }
  .mobile-toggle { display: block; }
  .nav-lang { display: none; }
  .about-hero .portrait { width: 160px; height: 160px; }
}
