/* ============================================
   LedgerLine Theme — Style
   Visual DNA: Finanza (deep navy + vivid blue,
   geometric sans, bordered containers, label badges,
   generous spacing, dark footer)
   ============================================ */

/* --- CSS Variables (Finanza palette adapted) --- */
:root {
  --primary: #355EFC;
  --primary-rgb: 53, 94, 252;
  --secondary: #E93C05;
  --dark: #011A41;
  --dark-rgb: 1, 26, 65;
  --light: #DFE4FD;
  --light-rgb: 223, 228, 253;
  --text: #444;
  --text-light: #777;
  --white: #fff;
  --border: rgba(53, 94, 252, 0.12);
  --radius: 8px;
  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1160px;
  --gap: 2rem;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.7;
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--primary); text-decoration: none; transition: color .3s; }
a:hover { color: var(--dark); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--dark);
  line-height: 1.25;
}
h1 { font-weight: 700; }
h2 { font-weight: 700; }
h3 { font-weight: 600; }
h4 { font-weight: 600; }
h5 { font-weight: 500; }

/* --- Utilities --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* Label badge (Finanza distinctive feature) */
.label-badge {
  display: inline-block;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  color: var(--primary);
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 0.2em 0.85em;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

/* Filled button (Finanza-style) */
.btn {
  display: inline-block;
  background: var(--primary);
  color: var(--light);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75em 2em;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .35s, transform .2s;
  text-align: center;
}
.btn:hover {
  background: var(--dark);
  color: var(--white);
  transform: translateY(-1px);
}

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

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--primary);
  color: var(--white);
  padding: 0.5em 1em;
  border-radius: var(--radius);
  z-index: 10000;
  font-size: 0.875rem;
}
.skip-link:focus { top: 1rem; color: var(--white); }

/* ============================
   HEADER / NAVBAR
   ============================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .3s;
}
.site-header.scrolled {
  box-shadow: 0 2px 16px rgba(var(--dark-rgb), 0.08);
}

/* Top bar (adapted from Finanza top-bar) */
.top-bar {
  display: none;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-light);
  padding: 0.5rem 0;
}
@media(min-width:992px) {
  .top-bar { display: flex; justify-content: space-between; align-items: center; }
}
.top-bar a { color: var(--primary); font-weight: 500; }

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  min-height: 64px;
}

.navbar__brand {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.navbar__brand img {
  height: 36px;
  width: auto;
}

.navbar__links {
  display: none;
  list-style: none;
  gap: 0;
}
.navbar__links a {
  display: block;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color .3s;
}
.navbar__links a:hover,
.navbar__links a.active {
  color: var(--primary);
}
@media(min-width:768px) {
  .navbar__links {
    display: flex;
    align-items: center;
  }
}

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--dark);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media(min-width:768px) {
  .hamburger { display: none; }
}

/* Mobile menu */
.mobile-menu {
  display: none;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  padding: 0.65rem 1.25rem;
  color: var(--text);
  font-weight: 500;
  font-size: 1rem;
}
.mobile-menu a:hover { color: var(--primary); }
@media(min-width:768px) {
  .mobile-menu { display: none !important; }
}

/* ============================
   HERO
   ============================ */
.hero {
  position: relative;
  background: var(--dark);
  color: var(--white);
  overflow: hidden;
}
.hero__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  padding: 3.5rem 1.25rem 3rem;
  max-width: var(--container);
  margin: 0 auto;
  align-items: center;
}
@media(min-width:768px) {
  .hero__inner {
    grid-template-columns: 1.1fr 0.9fr;
    padding: 5rem 1.25rem 4.5rem;
  }
}
.hero__content { position: relative; z-index: 2; }
.hero__label {
  display: inline-block;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius);
  color: var(--primary);
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 0.2em 0.85em;
  margin-bottom: 1.25rem;
  letter-spacing: 0.04em;
  background: rgba(var(--primary-rgb), 0.12);
}
.hero h1 {
  color: var(--white);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  margin-bottom: 1rem;
  line-height: 1.2;
}
.hero__subtitle {
  color: rgba(255,255,255,.72);
  font-size: 1.05rem;
  line-height: 1.65;
  margin-bottom: 1.75rem;
  max-width: 520px;
}
.hero__subtitle p { margin-bottom: 0.5em; }
.hero__subtitle p:last-child { margin-bottom: 0; }
.hero .btn { font-size: 1rem; }

.hero__visual {
  position: relative;
  display: none;
}
@media(min-width:768px) {
  .hero__visual { display: block; }
}
.hero__deco {
  width: 100%;
  aspect-ratio: 1;
  max-width: 380px;
  margin-left: auto;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  border-radius: var(--radius);
  background: rgba(var(--primary-rgb), 0.06);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
}
.hero__deco-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border: 1px solid rgba(var(--primary-rgb), 0.15);
}
.hero__deco-cell span {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}
.hero__deco-cell small {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,.5);
  margin-top: 0.25rem;
  text-align: center;
}

/* Decorative background shapes */
.hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.07);
  z-index: 0;
}

/* ============================
   SECTIONS — shared
   ============================ */
.section {
  padding: 4rem 0;
}
.section--light {
  background: rgba(var(--light-rgb), 0.35);
}
.section--dark {
  background: var(--dark);
  color: rgba(255,255,255,.8);
}
.section__header {
  margin-bottom: 2.5rem;
}
.section__header h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 0;
}

/* ============================
   LATEST POSTS (prominent)
   ============================ */
.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media(min-width:600px) {
  .posts-grid { grid-template-columns: 1fr 1fr; }
}
@media(min-width:960px) {
  .posts-grid--home { grid-template-columns: 1fr 1fr 1fr; }
}

.post-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .3s, transform .25s;
  background: var(--white);
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
}
.post-card__img {
  aspect-ratio: 16/10;
  overflow: hidden;
}
.post-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.post-card:hover .post-card__img img {
  transform: scale(1.04);
}
.post-card__body {
  padding: 1.25rem 1.35rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.post-card__date {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}
.post-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  line-height: 1.35;
}
.post-card__title a { color: var(--dark); }
.post-card__title a:hover { color: var(--primary); }
.post-card__excerpt {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  flex: 1;
}
.post-card__excerpt p { margin-bottom: 0; }
.post-card__link {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--primary);
}
.post-card__link::after { content: ' \2192'; }

/* Featured (first) post — larger on home */
@media(min-width:960px) {
  .posts-grid--home .post-card:first-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
  }
  .posts-grid--home .post-card:first-child .post-card__img {
    aspect-ratio: auto;
    min-height: 280px;
  }
  .posts-grid--home .post-card:first-child .post-card__body {
    padding: 2rem 2.25rem;
    justify-content: center;
  }
  .posts-grid--home .post-card:first-child .post-card__title {
    font-size: 1.4rem;
  }
}

/* ============================
   TOPICS
   ============================ */
.topics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}
@media(min-width:600px) {
  .topics-grid { grid-template-columns: 1fr 1fr; }
}
@media(min-width:960px) {
  .topics-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.topic-item {
  background: var(--white);
  padding: 1.75rem 1.5rem;
  transition: background .3s;
}
.topic-item:hover {
  background: rgba(var(--light-rgb), 0.5);
}
.topic-item h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--dark);
  position: relative;
  padding-left: 1rem;
}
.topic-item h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 4px;
  height: 1em;
  background: var(--primary);
  border-radius: 2px;
}
.topic-item__desc {
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.6;
}
.topic-item__desc p { margin-bottom: 0; }

/* ============================
   FAQ
   ============================ */
.faq-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media(min-width:768px) {
  .faq-list { grid-template-columns: 1fr 1fr; gap: 0 2.5rem; }
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}
.faq-item__q {
  font-weight: 600;
  font-size: 0.975rem;
  color: var(--dark);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  line-height: 1.4;
  padding: 0;
}
.faq-item__q::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform .3s;
  line-height: 1;
}
.faq-item.open .faq-item__q::after {
  content: '\2212';
}
.faq-item__a {
  display: none;
  padding-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.65;
}
.faq-item__a p { margin-bottom: 0.5em; }
.faq-item__a p:last-child { margin-bottom: 0; }
.faq-item.open .faq-item__a { display: block; }

/* ============================
   BLOG INDEX
   ============================ */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media(min-width:600px) {
  .blog-grid { grid-template-columns: 1fr 1fr; }
}
@media(min-width:960px) {
  .blog-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  transition: background .25s, color .25s, border-color .25s;
}
.pagination a:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.pagination a.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  pointer-events: none;
}

/* ============================
   POST / PAGE — article
   ============================ */
.article-header {
  padding: 3.5rem 0 2rem;
  background: var(--dark);
  color: var(--white);
}
.article-header .label-badge {
  border-color: rgba(255,255,255,.3);
  color: rgba(255,255,255,.65);
}
.article-header h1 {
  color: var(--white);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  margin-bottom: 0.5rem;
}
.article-header__date {
  font-size: 0.85rem;
  color: rgba(255,255,255,.5);
}
.article-header__excerpt {
  margin-top: 1rem;
  font-size: 1.05rem;
  color: rgba(255,255,255,.7);
  max-width: 700px;
  line-height: 1.65;
}
.article-header__excerpt p { margin-bottom: 0; }

.article-cover {
  margin: -1.5rem auto 0;
  max-width: 860px;
  padding: 0 1.25rem;
  position: relative;
  z-index: 2;
}
.article-cover img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.article-body {
  max-width: 760px;
  margin: 2.5rem auto 4rem;
  padding: 0 1.25rem;
  font-size: 1.05rem;
  line-height: 1.8;
}
.article-body h2 { font-size: 1.5rem; margin: 2rem 0 0.75rem; }
.article-body h3 { font-size: 1.25rem; margin: 1.75rem 0 0.6rem; }
.article-body p { margin-bottom: 1.15rem; }
.article-body ul, .article-body ol { margin-bottom: 1.15rem; padding-left: 1.5rem; }
.article-body li { margin-bottom: 0.4rem; }
.article-body img { border-radius: var(--radius); margin: 1.5rem 0; }
.article-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-light);
  font-style: italic;
}
.article-body a { color: var(--primary); text-decoration: underline; }
.article-body a:hover { color: var(--dark); }

/* Page template (simpler header) */
.page-header-simple {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
}
.page-header-simple h1 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
}

/* ============================
   FOOTER
   ============================ */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,.65);
  padding: 3.5rem 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media(min-width:600px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr; }
}
@media(min-width:960px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
}

.footer-col h4 {
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.footer-col p { font-size: 0.9rem; line-height: 1.65; }
.footer-col a {
  color: rgba(255,255,255,.6);
  font-size: 0.9rem;
  transition: color .25s;
}
.footer-col a:hover { color: var(--primary); }

.footer-nav {
  list-style: none;
}
.footer-nav li { margin-bottom: 0.45rem; }
.footer-nav a { position: relative; padding-left: 0.85rem; }
.footer-nav a::before {
  content: '\203A';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

.footer-bottom {
  margin-top: 2.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 0.8125rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.footer-bottom a { color: rgba(255,255,255,.5); }
.footer-bottom a:hover { color: var(--primary); }

/* ============================
   BACK TO TOP
   ============================ */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 800;
  transition: background .3s, opacity .3s;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}
.back-to-top:hover { background: var(--dark); }
.back-to-top.visible { display: flex; }

/* ============================
   CONTENT-HTML DEFAULTS
   ============================ */
.content-html h2 { font-size: 1.45rem; margin: 1.75rem 0 0.65rem; }
.content-html h3 { font-size: 1.2rem; margin: 1.5rem 0 0.55rem; }
.content-html p { margin-bottom: 1rem; }
.content-html ul, .content-html ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.content-html img { border-radius: var(--radius); margin: 1rem 0; }

/* ============================
   FOCUS / A11Y
   ============================ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
