/* =============================================
   LAYOUT — Header, Footer, Grid, Containers
   ============================================= */

/* ---- TOP BAR ---- */
.site-topbar {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  padding: .4rem 1rem;
}
.site-topbar__inner {
  max-width: var(--max-w);
  margin-inline: auto;
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--secondary);
}
.site-topbar__inner a { color: var(--secondary); }
.site-topbar__inner a:hover { color: var(--primary); }

/* ---- SITE HEADER ---- */
.site-header {
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--gray-100);
}
.site-header__inner {
  max-width: var(--max-w);
  margin-inline: auto;
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Logo */
.site-logo {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.05em;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { color: var(--accent); }
.site-logo span { color: var(--primary); }

/* Primary Nav */
.primary-nav { display: flex; align-items: center; gap: .25rem; }
.primary-nav a, .primary-nav .nav-item-btn {
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--secondary);
  border-radius: var(--radius);
  transition: background .2s, color .2s;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.primary-nav a:hover, .primary-nav .nav-item-btn:hover {
  background: #fff7ed;
  color: var(--primary);
}
.primary-nav .current-menu-item > a { color: var(--primary); }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 200;
  padding: .5rem 0;
}
.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu { display: block; }
.nav-dropdown__menu a {
  display: block;
  padding: .5rem 1rem;
  font-size: .875rem;
  color: var(--secondary);
  border-radius: 0;
}
.nav-dropdown__menu a:hover { background: var(--gray-50); color: var(--primary); }

/* Search icon in nav */
.header-search-btn {
  background: none;
  border: none;
  padding: .5rem;
  color: var(--secondary);
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  transition: color .2s, background .2s;
}
.header-search-btn:hover { background: var(--gray-50); color: var(--primary); }

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.header-signin {
  font-size: .875rem;
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}
.header-signin:hover { color: var(--primary); }

/* Mobile toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: .5rem;
  color: var(--secondary);
  cursor: pointer;
}

/* Mobile nav overlay */
.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 1rem;
  background: var(--white);
  border-top: 1px solid var(--gray-100);
}
.mobile-nav.is-open { display: flex; }
.mobile-nav a {
  padding: .75rem 1rem;
  color: var(--secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-100);
}
.mobile-nav a:last-child { border-bottom: none; }

/* ---- SEARCH OVERLAY ---- */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 500;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6rem;
}
.search-overlay.is-open { display: flex; }
.search-overlay__box {
  background: var(--white);
  width: min(640px, 95vw);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}
.search-overlay__form {
  display: flex;
  gap: .75rem;
}
.search-overlay__input {
  flex: 1;
  padding: .75rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.search-overlay__input:focus { border-color: var(--primary); }
.search-overlay__submit {
  padding: .75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
}
.search-overlay__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #fff;
  line-height: 1;
}

/* ---- MAIN LAYOUT GRID ---- */
.blog-layout {
  max-width: var(--max-w);
  margin-inline: auto;
  padding: 3rem 1rem;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .blog-layout { grid-template-columns: 1fr; }
}

/* Single post — narrower centred content */
.single-layout {
  max-width: var(--content-w);
  margin-inline: auto;
  padding: 1.5rem 1rem 4rem;
}
/* When single post is inside the two-column blog-layout, fill the column */
.blog-layout > .single-layout {
  max-width: none;
  margin: 0;
  padding-inline: 0;
}

/* ---- SIDEBAR ---- */
.sidebar { position: sticky; top: 80px; }
.sidebar-widget {
  margin-bottom: 2.5rem;
}
.sidebar-widget__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}
.sidebar-search {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.sidebar-search input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  outline: none;
  font-size: .9rem;
  transition: border-color .2s;
}
.sidebar-search input:focus { border-color: var(--primary); }
.sidebar-newsletter {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  padding: 2rem;
}
.sidebar-newsletter h3 { color: #fff; margin-bottom: .75rem; font-size: 1.15rem; }
.sidebar-newsletter p { color: var(--gray-400); font-size: .875rem; margin-bottom: 1.25rem; }
.sidebar-newsletter input {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--gray-800);
  border: 1px solid var(--gray-700);
  border-radius: var(--radius);
  color: #fff;
  font-size: .875rem;
  margin-bottom: .75rem;
  outline: none;
}
.sidebar-newsletter button {
  width: 100%;
  padding: .75rem;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: .875rem;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity .2s;
}
.sidebar-newsletter button:hover { opacity: .9; }

/* Tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-cloud a {
  display: inline-block;
  padding: .3rem .75rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--secondary);
  transition: background .2s, color .2s;
}
.tag-cloud a:hover { background: #fff7ed; color: var(--primary); }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 3rem 1rem;
  margin-top: auto;
}
.site-footer__inner {
  max-width: var(--max-w);
  margin-inline: auto;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}
@media (max-width: 768px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 480px) {
  .site-footer__grid { grid-template-columns: 1fr; }
}
.footer-brand h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--accent);
}
.footer-brand p {
  font-size: .875rem;
  color: var(--fg);
  line-height: 1.8;
  max-width: 300px;
  margin-bottom: 1.5rem;
}
.footer-social { display: flex; gap: .75rem; }
.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: var(--secondary);
  border-radius: var(--radius);
  color: #fff;
  transition: opacity .2s;
}
.footer-social a:hover { opacity: .8; }
.footer-social svg { width: 18px; height: 18px; fill: #fff; }
.footer-col h3 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: .75rem; }
.footer-col a { font-size: .875rem; color: var(--fg); }
.footer-col a:hover { color: var(--primary); }

/* Footer newsletter bar */
.footer-newsletter {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.footer-newsletter__text h4 {
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: .25rem;
}
.footer-newsletter__text p { font-size: .875rem; color: var(--fg); margin: 0; }
.footer-newsletter__form { display: flex; gap: .5rem; }
.footer-newsletter__form input {
  padding: .6rem 1rem;
  width: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  outline: none;
}
.footer-newsletter__form input:focus { border-color: var(--primary); }
.footer-newsletter__form button {
  padding: .6rem 1.25rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: .875rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity .2s;
}
.footer-newsletter__form button:hover { opacity: .9; }
@media (max-width: 640px) {
  .footer-newsletter { flex-direction: column; align-items: flex-start; }
  .footer-newsletter__form { width: 100%; }
  .footer-newsletter__form input { flex: 1; width: auto; }
}

/* Footer bottom */
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: .75rem;
  color: var(--fg);
}
.footer-status {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 500;
}
.footer-status__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

/* ---- BREADCRUMBS ---- */
.breadcrumbs {
  max-width: var(--content-w);
  margin-inline: auto;
  padding: 1.5rem 1rem .5rem;
  font-size: .875rem;
  color: var(--gray-500);
}
.breadcrumbs ol {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.breadcrumbs li { display: flex; align-items: center; gap: .5rem; }
.breadcrumbs a { color: var(--gray-500); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .current { color: var(--accent); font-weight: 500; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 3rem;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 .75rem;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: .875rem;
  font-weight: 700;
  border-radius: var(--radius);
  transition: background .2s, color .2s;
}
.pagination a:hover { background: var(--primary); color: #fff; }
.pagination .current { background: var(--primary); color: #fff; }

/* ---- RESPONSIVE HEADER ---- */
@media (max-width: 768px) {
  .primary-nav { display: none; }
  .header-signin { display: none; }
  .header-cta { display: none; }
  .mobile-menu-toggle { display: flex; }
}
