/* ============================================================
   finance-studio.com — canonical chrome stylesheet
   ============================================================ */

:root {
  --primary: #0a2540;
  --secondary: #1a73e8;
  --accent: #00d4aa;
  --accent-hover: #00b894;
  --accent-fg: #0a2540;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --surface: #f8fafc;
  --surface-alt: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --gradient-primary: linear-gradient(135deg, #0a2540 0%, #1a4a7a 100%);
  --gradient-accent: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
  --shadow-sm: 0 1px 3px rgba(10, 37, 64, 0.08);
  --shadow-md: 0 4px 12px rgba(10, 37, 64, 0.12);
  --shadow-lg: 0 8px 32px rgba(10, 37, 64, 0.16);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

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

a:hover {
  color: var(--accent);
}

h1, h2, h3, h4 {
  line-height: 1.2;
  color: var(--primary);
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

p { margin-bottom: 1rem; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 2rem;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

.header__logo img {
  width: 44px;
  height: 44px;
}

/* Scope nav rules to `header nav` so in-article <nav class="toc"> /
   <nav class="breadcrumbs"> are NOT affected by flex/position rules. */
.header nav.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header .nav__link {
  color: var(--text);
  font-weight: 500;
  position: relative;
  padding: 0.5rem 0;
}

.header .nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.header .nav__link:hover::after,
.header .nav__link--active::after {
  width: 100%;
}

.header .nav__link:hover {
  color: var(--primary);
}

/* Dropdown */
.header .nav__dropdown {
  position: relative;
}

.header .nav__dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text);
  font-weight: 500;
  padding: 0.5rem 0;
  cursor: pointer;
  background: none;
  border: none;
  font-size: inherit;
  font-family: inherit;
}

.header .nav__dropdown-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}

.header .nav__dropdown:hover .nav__dropdown-toggle svg,
.header .nav__dropdown:focus-within .nav__dropdown-toggle svg {
  transform: rotate(180deg);
}

.header .nav__dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 200;
}

.header .nav__dropdown:hover .nav__dropdown-menu,
.header .nav__dropdown:focus-within .nav__dropdown-menu {
  opacity: 1;
  visibility: visible;
}

.header .nav__dropdown-menu a {
  display: block;
  padding: 0.625rem 1.25rem;
  color: var(--text);
  font-size: 0.9375rem;
  transition: background var(--transition);
}

.header .nav__dropdown-menu a:hover {
  background: var(--bg);
  color: var(--primary);
}

.header .nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.header .nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--primary);
  transition: var(--transition);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn--primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: #fff;
}

.btn--accent {
  background: var(--gradient-accent);
  color: var(--accent-fg);
}

.btn--accent:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: var(--accent-fg);
}

.btn--outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

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

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--primary);
  color: #fff;
  padding: 4rem 0 2rem;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer__brand .header__logo {
  color: #fff;
}

.footer__brand p {
  opacity: 0.7;
  margin-top: 1rem;
  font-size: 0.9375rem;
  max-width: 320px;
}

.footer__social {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.footer__social a {
  color: #fff;
  opacity: 0.8;
  transition: opacity var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.footer__social a:hover {
  opacity: 1;
  color: var(--accent);
}

.footer__col h4 {
  color: var(--accent);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer__links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9375rem;
  transition: color var(--transition);
}

.footer__links a:hover {
  color: var(--accent);
}

.footer__bottom {
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
  opacity: 0.7;
  text-align: center;
}

/* ============================================================
   FIXED/STICKY NAV COMPENSATION
   The .header is position: sticky with top:0 — blog templates
   don't need padding-top, but we apply it for safety so hash
   anchors don't hide beneath the chrome.
   ============================================================ */
body.pbn-blog-page > main {
  padding-top: 24px;
}

/* ============================================================
   ARTICLE / BLOG CONTENT
   ============================================================ */
.article-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.article-container h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  color: var(--primary);
  margin-bottom: 1rem;
  line-height: 1.15;
}

.article-container .meta {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.article-container .featured-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.article-container .content {
  color: var(--text);
  line-height: 1.75;
  font-size: 1.0625rem;
}

.article-container .content h2 {
  font-size: 1.75rem;
  color: var(--primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.article-container .content h3 {
  font-size: 1.35rem;
  color: var(--primary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-container .content h4 {
  font-size: 1.125rem;
  color: var(--primary);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.article-container .content p {
  margin-bottom: 1.25rem;
}

.article-container .content ul,
.article-container .content ol {
  margin: 0 0 1.25rem 1.5rem;
  padding-left: 0.5rem;
}

.article-container .content li {
  margin-bottom: 0.5rem;
}

.article-container .content img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

.article-container .content blockquote {
  border-left: 4px solid var(--accent);
  background: var(--bg);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}

.article-container .content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 1.5rem 0;
}

.article-container .content code {
  background: var(--bg);
  color: var(--primary);
  padding: 0.15em 0.4em;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

.article-container .content pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.article-container .content a {
  color: var(--secondary);
  text-decoration: underline;
}

.article-container .content a:hover {
  color: var(--accent);
}

.article-container .content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}

.article-container .content th,
.article-container .content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

.article-container .content th {
  background: var(--bg);
  color: var(--primary);
  font-weight: 700;
}

/* ============================================================
   TOC — scoped static so header nav fixed rules don't cascade
   ============================================================ */
nav.toc {
  position: static;
  z-index: auto;
  width: auto;
  top: auto;
  left: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0 2rem;
  box-shadow: var(--shadow-sm);
  display: block;
}

nav.toc h2,
nav.toc .toc__title {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

nav.toc ol,
nav.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav.toc li {
  margin: 0.375rem 0;
  padding-left: 0;
}

nav.toc a {
  color: var(--secondary);
  font-size: 0.9375rem;
  text-decoration: none;
}

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

/* ============================================================
   BREADCRUMBS — also scoped static
   ============================================================ */
nav.breadcrumbs {
  position: static;
  z-index: auto;
  width: auto;
  top: auto;
  left: auto;
  padding: 1.25rem 0;
  font-size: 0.875rem;
  background: transparent;
  display: block;
}

nav.breadcrumbs ol,
nav.breadcrumbs ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav.breadcrumbs li:not(:last-child)::after {
  content: '/';
  margin-left: 0.5rem;
  opacity: 0.5;
  color: var(--text-muted);
}

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

nav.breadcrumbs a:hover {
  color: var(--secondary);
}

/* ============================================================
   TAGS
   ============================================================ */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.tag:hover {
  background: var(--gradient-accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* ============================================================
   SHARE BUTTONS (bottom inline row)
   ============================================================ */
.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin: 2rem 0;
  align-items: center;
}

.share-buttons__label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 0.5rem;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition);
  border: none;
  cursor: pointer;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: #fff;
}

.share-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.share-btn-x  { background: #000000; }
.share-btn-fb { background: #1877F2; }
.share-btn-li { background: #0A66C2; }
.share-btn-wa { background: #25D366; }
.share-btn-tg { background: #229ED9; }

/* ============================================================
   SHARE POPOVER (BBC-style top share)
   ============================================================ */
.share-popover-wrap {
  position: relative;
  display: inline-block;
}

.share-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.share-toggle:hover {
  border-color: var(--accent);
  color: var(--primary);
}

.share-toggle svg {
  width: 14px;
  height: 14px;
}

.share-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.share-popover[hidden] {
  display: none;
}

.share-pop-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background var(--transition);
}

.share-pop-item:hover {
  background: var(--bg);
}

.share-pop-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.share-pop-x  { color: #000000; }
.share-pop-fb { color: #1877F2; }
.share-pop-li { color: #0A66C2; }
.share-pop-wa { color: #25D366; }
.share-pop-tg { color: #229ED9; }

/* ============================================================
   RELATED POSTS
   ============================================================ */
.related-posts {
  max-width: 1200px;
  margin: 3rem auto 0;
  padding: 3rem 1.5rem 0;
  border-top: 1px solid var(--border);
}

.related-posts h2 {
  font-size: 1.75rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.related-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
  display: block;
  text-decoration: none;
  color: inherit;
}

.related-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  color: inherit;
}

.related-card img {
  width: 100%;
  aspect-ratio: 2/1;
  object-fit: cover;
}

.related-card__body {
  padding: 1rem 1.25rem;
}

.related-card__title {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 700;
  line-height: 1.35;
}

/* ============================================================
   BLOG LIST — posts grid + cards
   ============================================================ */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin: 2rem 0;
}

@media (max-width: 1024px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .posts-grid { grid-template-columns: 1fr; gap: 20px; }
  .related-grid { grid-template-columns: 1fr; }
}

.post-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  color: inherit;
}

.post-card-image {
  width: 100%;
  aspect-ratio: 2/1;
  overflow: hidden;
  background: var(--bg);
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-card-image img {
  transform: scale(1.05);
}

.post-card-image-fallback {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(0, 212, 170, 0.2) 0%, transparent 50%),
    var(--gradient-primary);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 1rem;
  position: relative;
}

.post-card-image-fallback::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0,212,170,0.15) 0%, transparent 45%);
  pointer-events: none;
}

.post-card-image-fallback .ph-cat {
  position: relative;
  z-index: 1;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(10, 37, 64, 0.7);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.post-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.cat-link {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.cat-link:hover {
  color: var(--accent-hover);
}

.post-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  margin: 0;
}

.post-card-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.post-card-excerpt {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   CATEGORY CHIPS (pill nav above grid)
   ============================================================ */
.categories {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.categories::-webkit-scrollbar {
  height: 4px;
}

.categories::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
}

.cat-chip:hover {
  border-color: var(--accent);
  color: var(--primary);
}

.cat-chip.active {
  background: var(--gradient-accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 3rem 0 2rem;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: all var(--transition);
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--primary);
}

.pagination .current,
.pagination [aria-current="page"] {
  background: var(--gradient-accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .header nav.nav {
    position: fixed;
    top: 69px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    border-bottom: 1px solid var(--border);
  }

  .header nav.nav--open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .header .nav-toggle {
    display: flex;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .article-container {
    padding: 2rem 1.25rem 3rem;
  }

  .article-container h1 {
    font-size: 1.75rem;
  }
}

@media (max-width: 480px) {
  .share-buttons {
    gap: 0.5rem;
  }
}
