/*
Theme Name: Motherhood Nest
Theme URI: https://motherhoodnest.com
Author: Motherhood Nest
Author URI: https://motherhoodnest.com
Description: A lightweight, mobile-first WordPress blog theme for motherhood content. Clean editorial design, built-in ad spaces, and PWA install support with offline caching. No frameworks, no webfonts, no jQuery.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: motherhoodnest
Tags: blog, news, two-columns, right-sidebar, custom-logo, custom-menu, featured-images, translation-ready, block-styles, wide-blocks
*/

/* =========================================================
   1. Design tokens
   ========================================================= */
:root {
  /* Warm nest palette — ivory, clay, warm charcoal */
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-alt: #f4ede4;
  --text: #2b2118;
  --text-muted: #75695c;
  --text-faint: #a09487;
  --accent: #b4532a;
  --accent-strong: #963f1d;
  --accent-soft: #f7e6da;
  --accent-contrast: #ffffff;
  --border: #e9e0d4;
  --border-strong: #d9cbb8;
  --ok: #4a7c59;
  --shadow-card: 0 1px 2px rgba(43, 33, 24, 0.05);

  /* Type — system stacks only, zero webfont requests */
  --font-serif: "Iowan Old Style", "Palatino Linotype", Charter, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Scale */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.625rem;
  --fs-2xl: 2rem;

  /* Space — 4px base */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Shape + motion */
  --radius: 14px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1512;
    --surface: #241e19;
    --surface-alt: #2d251f;
    --text: #ece4da;
    --text-muted: #b3a698;
    --text-faint: #7d7266;
    --accent: #d97a4e;
    --accent-strong: #e8926b;
    --accent-soft: #3a271d;
    --border: #38302a;
    --border-strong: #4a3f36;
    --ok: #7fb894;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* =========================================================
   2. Reset + base
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img,
video {
  max-width: 100%;
  height: auto;
}

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

a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--sp-2) var(--sp-4);
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
  color: var(--accent-contrast);
}

/* =========================================================
   3. Typography
   ========================================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 var(--sp-3);
  text-wrap: balance;
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p {
  margin: 0 0 var(--sp-4);
}

.entry-content {
  font-size: var(--fs-md);
  line-height: 1.75;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin-top: var(--sp-12);
}

.entry-content > *:first-child {
  margin-top: 0;
}

blockquote {
  margin: var(--sp-8) 0;
  padding: var(--sp-4) var(--sp-6);
  border-inline-start: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

code,
pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}

code { padding: 0.15em 0.4em; }
pre {
  padding: var(--sp-4);
  overflow-x: auto;
}

/* =========================================================
   4. Layout
   ========================================================= */
.mhn-container {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: var(--sp-4);
}

.site-main {
  padding-block: var(--sp-8);
  min-height: 50vh;
}

/* Desktop: content + sidebar */
@media (min-width: 1024px) {
  .mhn-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--sp-12);
    align-items: start;
  }
}

/* =========================================================
   5. Header + navigation
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: var(--header-h);
}

.site-branding {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.custom-logo {
  max-height: 40px;
  width: auto;
}

.site-title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
}

.site-title a {
  color: var(--text);
}

.site-title a:hover {
  text-decoration: none;
  color: var(--accent);
}

.site-description {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

@media (max-width: 479px) {
  .site-description { display: none; }
}

/* Nav toggle */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--surface-alt);
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
  stroke: var(--text);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
.nav-toggle[aria-expanded="false"] .nav-toggle__close { display: none; }

@media (min-width: 768px) {
  .nav-toggle { display: none; }
}

/* Mobile nav drawer */
.main-navigation {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.main-navigation.is-open {
  display: block;
}

@media (min-width: 768px) {
  .main-navigation {
    display: block;
    border-top: 0;
  }
}

.main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-navigation a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: var(--sp-3) var(--sp-4);
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .main-navigation ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
  }

  .main-navigation a {
    min-height: 40px;
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 0;
    border-radius: var(--radius-sm);
  }

  .main-navigation a:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
    text-decoration: none;
  }
}

/* =========================================================
   6. Post cards
   ========================================================= */
.post-grid {
  display: grid;
  gap: var(--sp-6);
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 768px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .has-sidebar .post-grid {
    grid-template-columns: 1fr;
  }
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(43, 33, 24, 0.09);
}

@media (prefers-reduced-motion: reduce) {
  .post-card { transform: none; }
}

.post-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-alt);
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.post-card:hover .post-card__media img {
  transform: scale(1.04);
}

.post-card__body {
  padding: var(--sp-4) var(--sp-4) var(--sp-6);
}

.post-card__title {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}

.post-card__title a {
  color: var(--text);
}

.post-card__title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-card__excerpt {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Category chip */
.entry-cats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  list-style: none;
  padding: 0;
}

.entry-cats a {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.entry-cats a:hover {
  background: var(--accent);
  color: var(--accent-contrast);
  text-decoration: none;
}

/* Entry meta */
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.entry-meta svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  vertical-align: -2px;
  margin-inline-end: 4px;
}

/* =========================================================
   7. Single post / page
   ========================================================= */
.entry-header {
  margin-bottom: var(--sp-6);
}

.entry-header .entry-title {
  font-size: var(--fs-2xl);
  margin: var(--sp-3) 0 var(--sp-4);
  text-wrap: balance;
}

@media (min-width: 768px) {
  .entry-header .entry-title {
    font-size: 2.375rem;
    line-height: 1.15;
  }
}

.entry-thumbnail img {
  width: 100%;
  border-radius: var(--radius);
}

.entry-content a:not(.wp-block-button__link) {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}

.entry-content a:hover {
  text-decoration-color: var(--accent);
}

/* Author box */
.author-box {
  display: flex;
  gap: var(--sp-4);
  margin-top: var(--sp-12);
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.author-box img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
}

.author-box__name {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-md);
}

.author-box__bio {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Post navigation */
.post-nav {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-8);
}

@media (min-width: 768px) {
  .post-nav {
    grid-template-columns: 1fr 1fr;
  }
}

.post-nav a {
  display: block;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text);
}

.post-nav a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.post-nav__label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-1);
}

.post-nav__next {
  text-align: end;
}

/* =========================================================
   8. Archive header + pagination
   ========================================================= */
.page-header {
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: var(--fs-xl);
  margin: 0;
}

.archive-description {
  margin: var(--sp-2) 0 0;
  color: var(--text-muted);
}

.pagination,
.navigation.pagination {
  margin-top: var(--sp-12);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
}

.nav-links a,
.nav-links .current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--fs-sm);
  background: var(--surface);
}

.nav-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.nav-links .current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* =========================================================
   9. Sidebar + widgets
   ========================================================= */
.site-sidebar {
  margin-top: var(--sp-12);
}

@media (min-width: 1024px) {
  .site-sidebar {
    position: sticky;
    top: calc(var(--header-h) + var(--sp-6));
    margin-top: 0;
  }
}

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.widget-title {
  font-size: var(--fs-md);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.widget ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget li {
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed var(--border);
  font-size: var(--fs-sm);
}

.widget li:last-child {
  border-bottom: 0;
}

.widget li a {
  color: var(--text);
}

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

/* Search form */
.search-form {
  display: flex;
  gap: var(--sp-2);
}

.search-form input[type="search"] {
  flex: 1;
  min-width: 0;
}

input[type="search"],
input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: var(--sp-3);
  font-size: 1rem; /* prevents iOS zoom */
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

input[type="search"]:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px dashed var(--accent);
  outline-offset: 1px;
}

.search-form .search-submit {
  flex-shrink: 0;
}

/* =========================================================
   10. Ad slots
   ========================================================= */
.mhn-ad {
  margin: var(--sp-8) auto;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
}

.mhn-ad__label {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--sp-2);
}

.mhn-ad .widget {
  padding: 0;
  border: 0;
  background: transparent;
  margin: 0;
  text-align: center;
}

.mhn-ad .widget-title {
  display: none;
}

/* Ad placeholder shown only to admins when slot is empty */
.mhn-ad--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-faint);
  font-size: var(--fs-xs);
}

/* =========================================================
   11. Footer
   ========================================================= */
.site-footer {
  margin-top: var(--sp-16);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-12) var(--sp-8);
}

.site-footer__grid {
  display: grid;
  gap: var(--sp-8);
}

@media (min-width: 768px) {
  .site-footer__grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.site-footer h2,
.site-footer .widget-title {
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: var(--sp-3);
  border-bottom: 0;
}

.site-footer a {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

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

.site-footer .widget {
  background: transparent;
  border: 0;
  padding: 0;
}

.site-footer .widget li {
  border-bottom: 0;
  padding: var(--sp-1) 0;
}

.site-footer__bottom {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
}

/* =========================================================
   12. Comments
   ========================================================= */
.comments-area {
  margin-top: var(--sp-12);
}

.comment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.comment-list ol.children {
  list-style: none;
  padding-inline-start: var(--sp-6);
}

.comment-body {
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.comment-author img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-inline-end: var(--sp-2);
  vertical-align: middle;
}

.comment-metadata {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: var(--sp-1) 0 var(--sp-2);
}

.comment-reply-link {
  font-size: var(--fs-xs);
  font-weight: 700;
}

.comment-form {
  display: grid;
  gap: var(--sp-4);
}

.comment-form p {
  margin: 0;
}

.comment-form label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-1);
}

.comment-form .submit {
  justify-self: start;
}

/* =========================================================
   13. Buttons
   ========================================================= */
button,
.button,
.wp-block-button__link,
input[type="submit"],
.comment-form .submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: var(--sp-3) var(--sp-6);
  background: var(--accent);
  color: var(--accent-contrast);
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

button:hover,
.button:hover,
input[type="submit"]:hover,
.wp-block-button__link:hover {
  background: var(--accent-strong);
  color: var(--accent-contrast);
  text-decoration: none;
  transform: translateY(-1px);
}

button:active,
.button:active {
  transform: translateY(0);
}

/* =========================================================
   14. PWA install banner
   ========================================================= */
.mhn-install-banner {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 90;
  padding: var(--sp-2) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(43, 33, 24, 0.12);
  display: none;
  align-items: center;
  gap: var(--sp-3);
  animation: mhn-slide-up 0.35s var(--ease);
}

.mhn-install-banner.is-visible {
  display: flex;
}

@keyframes mhn-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mhn-install-banner {
    animation: none;
  }
}

.mhn-install-banner__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.mhn-install-banner__text {
  flex: 1;
  min-width: 0;
}

.mhn-install-banner__text strong {
  display: block;
  font-size: var(--fs-sm);
  line-height: 1.3;
}

.mhn-install-banner__text span {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.mhn-install-banner__close {
  min-height: 40px;
  min-width: 40px;
  padding: 0 var(--sp-2);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-md);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 0;
}

.mhn-install-banner__close:hover {
  background: var(--surface-alt);
  color: var(--text);
  transform: none;
}

.mhn-install-banner .mhn-install-btn {
  min-height: 40px;
  padding: 0 var(--sp-4);
  flex-shrink: 0;
}

/* =========================================================
   15. Misc
   ========================================================= */
.alignwide {
  max-width: min(1000px, 100%);
  margin-inline: auto;
}

.alignfull {
  max-width: 100vw;
  margin-inline: calc(50% - 50vw);
}

.sticky .post-card__title::before {
  content: "★";
  color: var(--accent);
  margin-inline-end: var(--sp-1);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}

@media (min-width: 768px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gallery-caption {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
}

.wp-caption-text {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--sp-2);
}

/* 404 */
.error-404 {
  text-align: center;
  padding-block: var(--sp-16);
}

.error-404 .error-code {
  font-family: var(--font-serif);
  font-size: 5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--sp-4);
}
