/*
Theme Name: Little One Handbook
Theme URI: https://littleonehandbook.com
Author: Tanvir
Description: Custom classic theme built for Little One Handbook — a baby & parenting content site. No premium tier, no locked features, full control.
Version: 1.1.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: little-one-handbook
*/

/* ---------- Design tokens ---------- */
:root {
  --loh-bg: #F2F6FA;
  --loh-card: #FFFFFF;
  --loh-ink: #000000;
  --loh-ink-soft: #444444;
  --loh-line: #DCE7E1;
  --loh-blue: #1E4F8C;
  --loh-blue-dark: #1E4F8C;
  --loh-accent: #5AA9E6;
  --loh-accent-dark: #3D8BC7;
  --loh-accent-soft: #E8F3FC;
  --loh-site-width: 90%;
  --loh-site-max-width: 1600px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--loh-bg);
  color: var(--loh-ink);
  font-family: "Nunito Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--loh-blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { font-family: "Manrope", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-weight: 800; line-height: 1.25; margin: 0 0 0.5em; color: var(--loh-blue-dark); }
p { margin: 0 0 1.2em; color: var(--loh-ink); }

.loh-container {
  width: var(--loh-site-width);
  max-width: var(--loh-site-max-width);
  margin: 0 auto;
}

/* Generic buttons — orange fill */
.btn {
  display: inline-block;
  background: var(--loh-accent);
  color: #fff;
  padding: 11px 22px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.btn:hover { background: var(--loh-accent-dark); text-decoration: none; color: #fff; }

/* Skip link (accessibility) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--loh-blue-dark);
  color: #fff;
  padding: 10px 16px;
  z-index: 10000;
  border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

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

/* Row 1: logo left, contact button right, hamburger (mobile only) right */
.site-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
}
.site-branding { display: flex; align-items: center; gap: 12px; flex: none; }
.site-branding img { max-height: 42px; width: auto; }
.site-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--loh-blue-dark);
  margin: 0;
}
.site-title a { color: inherit; }
.site-title a:hover { text-decoration: none; }

.header-contact-desktop { flex: none; }

/* Row 2: nav centered, same container width as row 1 */
.primary-navigation {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
}
.primary-navigation ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.primary-navigation li { position: relative; }
.primary-navigation a {
  display: block;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--loh-blue);
  color: var(--loh-blue);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  background: transparent;
}
.primary-navigation a:hover {
  border-color: var(--loh-blue-dark);
  text-decoration: none;
}
.primary-navigation .current-menu-item > a {
  background: var(--loh-blue);
  border-color: var(--loh-blue);
  color: #fff;
}

/* Hamburger toggle — hidden on desktop */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  background: var(--loh-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  flex: none;
}
.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  margin: 0 auto;
  border-radius: 2px;
}

/* Slide-in drawer (mobile/tablet) */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  max-width: 85vw;
  height: 100vh;
  background: var(--loh-card);
  z-index: 1001;
  padding: 24px 20px;
  overflow-y: auto;
  transition: right .28s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
}
.mobile-drawer.is-open { right: 0; }
.drawer-close {
  display: block;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--loh-blue-dark);
  cursor: pointer;
  padding: 4px 8px;
  margin: 0 0 16px auto;
  display: block;
}
.drawer-navigation ul { list-style: none; margin: 0 0 24px; padding: 0; }
.drawer-navigation a {
  display: block;
  padding: 12px 6px;
  color: var(--loh-ink);
  font-weight: 600;
  font-size: 16px;
  border-bottom: 1px solid var(--loh-line);
}
.drawer-navigation .current-menu-item > a { color: var(--loh-blue-dark); }
.drawer-contact { width: 100%; text-align: center; }

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1000;
}
.drawer-overlay.is-open { display: block; }

@media (max-width: 860px) {
  .header-contact-desktop { display: none; }
  .mobile-menu-toggle { display: flex; }
  .primary-navigation { display: none; }
}

/* ---------- Main content ---------- */
.site-main { padding: 48px 0; min-height: 50vh; }
.entry-title { font-size: 34px; }
.entry-meta { color: var(--loh-ink-soft); font-size: 14px; margin-bottom: 24px; }
.entry-content { font-size: 17px; }
.entry-content h2 { font-size: 26px; margin-top: 1.4em; }
.entry-content h3 { font-size: 21px; margin-top: 1.2em; }

.post-thumbnail { margin-bottom: 24px; border-radius: 12px; overflow: hidden; }

/* Archive / category listing */
.archive-title { font-size: 30px; margin-bottom: 8px; }
.archive-description { color: var(--loh-ink-soft); margin-bottom: 32px; }
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.post-card {
  background: var(--loh-card);
  border: 1px solid var(--loh-line);
  border-radius: 12px;
  padding: 22px;
}
.post-card h2 { font-size: 21px; margin-bottom: 6px; }
.post-card h2 a { color: var(--loh-blue-dark); }
.post-card .entry-meta { margin-bottom: 10px; }
.post-card p { margin: 0; color: var(--loh-ink-soft); }

.latest-articles { margin-top: 48px; }

/* Pagination */
.loh-pagination { margin-top: 32px; display: flex; gap: 10px; flex-wrap: wrap; }
.loh-pagination a, .loh-pagination span {
  padding: 8px 14px;
  border: 1px solid var(--loh-line);
  border-radius: 8px;
  font-size: 14px;
}
.loh-pagination .current { background: var(--loh-blue); color: #fff; border-color: var(--loh-blue); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--loh-card);
  border-top: 1px solid var(--loh-line);
  padding: 32px 0;
  margin-top: 48px;
}
.footer-navigation ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin: 0 0 16px;
  padding: 0;
}
.footer-navigation a { color: var(--loh-ink-soft); font-size: 14px; }
.site-footer .footer-bottom {
  text-align: center;
  color: var(--loh-ink-soft);
  font-size: 14px;
}

/* ---------- Search / 404 ---------- */
.loh-search-form { display: flex; gap: 8px; margin: 24px 0; max-width: 420px; }
.loh-search-form input[type="search"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--loh-line);
  border-radius: 8px;
  font-size: 15px;
}
.loh-search-form button {
  background: var(--loh-accent);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
}
.loh-search-form button:hover { background: var(--loh-accent-dark); }

/* ---------- Author section (single posts) ---------- */
.author-section {
  margin: 40px 0;
}
.author-section-title {
  font-size: 22px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--loh-line);
  color: var(--loh-blue-dark);
}
.author-box {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  background: var(--loh-card);
  border: 1px solid var(--loh-line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .06);
}
.author-avatar { flex: none; }
.author-avatar img {
  border-radius: 16px;
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
}
.author-info { flex: 1; min-width: 0; }
.author-name {
  font-size: 19px;
  margin: 0 0 8px;
}
.author-name a { color: var(--loh-blue-dark); }
.author-bio {
  font-size: 15px;
  color: var(--loh-ink-soft);
  margin: 0;
  line-height: 1.65;
}
@media (max-width: 600px) {
  .author-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 22px;
  }
}

/* ---------- Table of contents (single posts) ---------- */
.loh-toc {
  background: var(--loh-accent-soft);
  border: 1px solid var(--loh-line);
  border-left: 4px solid var(--loh-blue);
  border-radius: 14px;
  padding: 24px 28px;
  margin: 28px 0 32px;
}
.loh-toc-title {
  font-size: 19px;
  margin: 0;
  color: var(--loh-blue-dark);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  user-select: none;
}
.loh-toc-title::-webkit-details-marker { display: none; }
.loh-toc-title::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--loh-blue);
  border-bottom: 2px solid var(--loh-blue);
  transform: rotate(45deg);
  transition: transform .2s ease;
  margin-top: -4px;
}
.loh-toc[open] .loh-toc-title::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}
.loh-toc-title:hover { color: var(--loh-accent-dark); }
.loh-toc[open] .loh-toc-list {
  margin-top: 16px;
}
.loh-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: loh-toc;
}
.loh-toc-item {
  margin: 0 0 8px;
  line-height: 1.5;
}
.loh-toc-item a {
  color: var(--loh-blue-dark);
  text-decoration: none;
  font-size: 15px;
}
.loh-toc-item a:hover {
  text-decoration: underline;
}
.loh-toc-h2 {
  counter-increment: loh-toc;
  padding-left: 30px;
  position: relative;
}
.loh-toc-h2 > a::before {
  content: counter(loh-toc) ".";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--loh-accent-dark);
}
.loh-toc-h3 {
  padding-left: 52px;
  font-size: 14px;
}
.loh-toc-h3 a {
  font-size: 14px;
  color: var(--loh-ink-soft);
}
.loh-toc-h3 > a::before {
  content: "\2013";
  position: absolute;
  left: 34px;
  color: var(--loh-line);
}

/* ---------- Author archive page ---------- */
.author-archive {
  max-width: 1200px;
  margin: 0 auto;
}
.author-header {
  display: flex;
  gap: 24px;
  align-items: center;
  background: var(--loh-card);
  border: 1px solid var(--loh-line);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 40px;
  box-shadow: 0 2px 14px rgba(0,0,0,.06);
}
.author-header img {
  border-radius: 50%;
  width: 120px;
  height: 120px;
  object-fit: cover;
  flex: none;
}
.author-header h1 {
  font-size: 28px;
  margin: 0 0 8px;
}
.author-description {
  font-size: 15px;
  color: var(--loh-ink-soft);
  margin: 0;
  line-height: 1.6;
}
.author-archive .post-collage {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 1024px) {
  .author-archive .post-collage {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .author-header {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }
  .author-header h1 {
    font-size: 24px;
  }
  .author-archive .post-collage {
    grid-template-columns: 1fr;
  }
}

/* Offset anchored headings so the sticky-ish header doesn't cover them. */
.entry-content h2,
.entry-content h3 {
  scroll-margin-top: 90px;
}

/* ---------- Author social links ---------- */
.loh-social-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
}
.loh-social-links li { margin: 0; }
.loh-social-links a {
  display: inline-block;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--loh-blue);
  background: var(--loh-accent-soft);
  border: 1px solid var(--loh-line);
  border-radius: 999px;
  text-decoration: none;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.loh-social-links a:hover {
  background: var(--loh-blue);
  border-color: var(--loh-blue);
  color: #fff;
  text-decoration: none;
}
@media (max-width: 600px) {
  .loh-social-links { justify-content: center; }
}

/* ---------- Related posts (single posts) ---------- */
.related-posts {
  margin: 56px 0 64px;
}

.related-title {
  font-size: 24px;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--loh-line);
  color: var(--loh-blue-dark);
}
.related-posts .post-collage {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 1024px) {
  .related-posts .post-collage {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .related-posts .post-collage {
    grid-template-columns: 1fr;
  }
}

/* ---------- Footer newsletter form ---------- */
.lo-news-wrap {
  max-width: 440px;
  margin: 28px auto;
  padding: 22px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(30, 79, 140, .10);
  box-sizing: border-box;
}
.lo-news-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--loh-blue-dark);
}
.lo-news-sub {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--loh-ink-soft);
}
.lo-news-form {
  display: flex;
  gap: 8px;
}
.lo-news-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--loh-line);
  border-radius: 8px;
  background: var(--loh-bg);
  font-family: inherit;
  font-size: 15px;
  color: var(--loh-ink);
  box-sizing: border-box;
}
.lo-news-form input:focus {
  outline: none;
  border-color: var(--loh-accent);
  background: #ffffff;
}
.lo-news-form button {
  padding: 11px 20px;
  border: none;
  border-radius: 8px;
  background: var(--loh-accent);
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s ease;
}
.lo-news-form button:hover {
  background: var(--loh-accent-dark);
}
.lo-news-form button:disabled {
  background: var(--loh-accent);
  opacity: .6;
  cursor: default;
}
.lo-news-status {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  display: none;
}
.lo-news-status.success {
  color: var(--loh-blue-dark);
  display: block;
}
.lo-news-status.error {
  color: #b3261e;
  display: block;
}
.lo-news-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--loh-ink-soft);
}
@media (max-width: 480px) {
  .lo-news-form { flex-direction: column; }
}

/* ---------- Sticky header (show on scroll up) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--loh-card);
  border-bottom: 1px solid var(--loh-line);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.site-header--hidden {
  transform: translateY(-100%);
}

.site-header--scrolled {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

/* Ensure header stays above content */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Offset for anchor links when header is sticky */
:target::before {
  content: '';
  display: block;
  height: 80px;
  margin-top: -80px;
  visibility: hidden;
}

@media (max-width: 768px) {
  .site-header {
    position: sticky;
    top: 0;
  }
}

/* ---------- Social share buttons (single posts) ---------- */
.loh-share-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 22px 0;
}
.loh-share-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--loh-ink-soft, #6b7a8c);
}
.loh-share-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.loh-share-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--loh-line, #d7e3f0);
  border-radius: 50%;
  background: #ffffff;
  color: var(--loh-blue, #1e4f8c);
  cursor: pointer;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.loh-share-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: currentColor;
}
.loh-share-link:hover,
.loh-share-link:focus-visible {
  background: var(--loh-blue, #1e4f8c);
  border-color: var(--loh-blue, #1e4f8c);
  color: #ffffff;
  transform: translateY(-1px);
  outline: none;
}
.loh-share-copy.copied {
  background: var(--loh-blue, #1e4f8c);
  border-color: var(--loh-blue, #1e4f8c);
  color: #ffffff;
}
.loh-share-section--bottom {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--loh-line, #d7e3f0);
}
@media (max-width: 480px) {
  .loh-share-link {
    width: 34px;
    height: 34px;
  }
}

/* Block editor width helpers */
.alignwide { max-width: 1000px; margin-left: auto; margin-right: auto; }
.alignfull { max-width: 100%; }

/* ---------- Homepage collage layout ---------- */
.post-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  background: var(--loh-card);
  border: 1px solid var(--loh-line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 40px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.post-featured-image {
  min-height: 320px;
  background: var(--loh-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-featured-content {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.post-featured-content h2 {
  font-size: 32px;
  margin-bottom: 12px;
  line-height: 1.2;
}
.post-featured-content .entry-meta {
  font-size: 15px;
  margin-bottom: 16px;
}
.post-featured-content p {
  font-size: 17px;
  color: var(--loh-ink-soft);
  margin-bottom: 24px;
}
.read-more {
  display: inline-block;
  background: var(--loh-accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  align-self: flex-start;
}
.read-more:hover {
  background: var(--loh-accent-dark);
  text-decoration: none;
  color: #fff;
}

/* Collage grid for remaining posts */
.post-collage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.post-collage-item {
  background: var(--loh-card);
  border: 1px solid var(--loh-line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s ease, transform .2s ease;
}
.post-collage-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.post-collage-image {
  margin: -20px -20px 16px;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--loh-accent-soft);
}
.post-collage-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-collage-item h3 {
  font-size: 18px;
  margin-bottom: 8px;
  line-height: 1.3;
}
.post-collage-item .entry-meta {
  font-size: 13px;
  margin-bottom: 10px;
}
.post-collage-item p {
  font-size: 14px;
  color: var(--loh-ink-soft);
  margin: 0;
  flex: 1;
}
.read-more-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--loh-blue);
  text-decoration: none;
}
.read-more-link:hover {
  text-decoration: underline;
  color: var(--loh-blue-dark);
}

/* Responsive */
@media (max-width: 1024px) {
  .post-collage {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .post-featured {
    grid-template-columns: 1fr;
  }
  .post-featured-image {
    min-height: 200px;
  }
  .post-featured-content {
    padding: 24px;
  }
  .post-featured-content h2 {
    font-size: 24px;
  }
  .post-collage {
    grid-template-columns: 1fr;
  }
}
