/*
Theme Name: WesterBlog
Theme URI: https://westerman.photo
Author: John Westerman
Description: A modern, personal blog theme. Clean, warm, and low-key — built around a life fully lived.
Version: 1.0.3
Requires at least: 6.0
Tested up to: 6.5
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: westerblog
Tags: blog, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* =============================================
   CSS VARIABLES
   ============================================= */
:root {
  --cream:       #F7F4EF;
  --parchment:   #EDE8DF;
  --sand:        #C8BCA8;
  --warm-dark:   #2C2420;
  --mid:         #6B5D52;
  --accent:      #8B6F5C;
  --accent-lite: rgba(139,111,92,0.12);
  --white:       #FDFCFA;
  --ink:         #1E1916;

  --font-head: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'Courier Prime', monospace;

  --max:     1080px;
  --narrow:  660px;
  --r-sm:    6px;
  --r-md:    14px;
  --r-lg:    28px;
  --shadow:  0 2px 16px rgba(44,36,32,0.07);
  --trans:   all 0.28s cubic-bezier(0.4,0,0.2,1);
}

/* =============================================
   RESET
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: var(--trans); }
a:hover { color: var(--warm-dark); }

/* =============================================
   BASE TYPOGRAPHY
   ============================================= */
body {
  background: var(--cream);
  color: var(--warm-dark);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.75;
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

h1 { font-size: clamp(2rem,5vw,3.2rem); }
h2 { font-size: clamp(1.5rem,3vw,2.2rem); }
h3 { font-size: clamp(1.2rem,2vw,1.6rem); }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1.4em; }
p:last-child { margin-bottom: 0; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 0 0.75rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--mid);
  font-size: 1.1rem;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--parchment);
  border-radius: var(--r-sm);
}
code { padding: 0.1em 0.4em; }
pre { padding: 1.25rem; overflow-x: auto; margin: 1.75rem 0; }

hr { border: none; border-top: 1px solid var(--parchment); margin: 2.5rem 0; }

ul, ol { padding-left: 1.5rem; margin-bottom: 1.4em; }
li { margin-bottom: 0.35em; }

/* =============================================
   LAYOUT
   ============================================= */
.site { display: flex; flex-direction: column; min-height: 100vh; }
.site-content { flex: 1; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }
.narrow { max-width: var(--narrow); margin: 0 auto; }

/* =============================================
   HEADER
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(247,244,239,0.93);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--parchment);
  transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
  flex-wrap: nowrap;
}

/* Branding */
.site-branding a {
  display: flex;
  flex-direction: column;
  color: var(--ink);
}
.site-branding a:hover { color: var(--accent); }

.site-title {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: inherit;
}

.site-tagline {
  font-size: 0.72rem;
  font-family: var(--font-body);
  color: var(--sand);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Nav toggle (hamburger) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--warm-dark);
  border-radius: var(--r-sm);
  transition: var(--trans);
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--parchment); }
.nav-toggle svg { display: block; }

/* Primary nav */
.primary-nav {
  display: flex;
  align-items: center;
}

/* Top level menu only as flex row */
.primary-nav > ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
}

/* All nested sub-menus as block */
.primary-nav .sub-menu {
  list-style: none;
  display: none;
}

/* Every li with children is a positioning context */
.primary-nav li.menu-item-has-children {
  position: relative;
}

.primary-nav > ul > li > a {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mid);
  padding: 0.35rem 0.5rem;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: var(--trans);
}

.primary-nav > ul > li > a:hover,
.primary-nav > ul > li.current-menu-item > a,
.primary-nav > ul > li.current-menu-parent > a {
  color: var(--ink);
  background: var(--parchment);
}

/* Dropdown arrow */
.primary-nav > ul > li.menu-item-has-children > a::after {
  content: ' ▾';
  font-size: 0.65rem;
  opacity: 0.5;
  vertical-align: middle;
}

/* Level 2 dropdown panel */
.primary-nav > ul > li > .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  border: 1px solid var(--parchment);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  min-width: 220px;
  padding: 0.5rem;
  z-index: 300;
}

/* Level 3 dropdown panel */
.primary-nav .sub-menu .sub-menu {
  position: absolute;
  top: 0;
  left: 100%;
  background: var(--white);
  border: 1px solid var(--parchment);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  min-width: 200px;
  padding: 0.5rem;
  z-index: 400;
}

/* Show when JS adds .open class */
.primary-nav .sub-menu.open {
  display: block;
}

/* Submenu links */
.primary-nav .sub-menu a {
  display: block;
  font-size: 0.85rem;
  color: var(--mid);
  padding: 0.45rem 0.75rem;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: var(--trans);
}
.primary-nav .sub-menu a:hover {
  background: var(--parchment);
  color: var(--ink);
}

/* =============================================
   HERO — MINIMAL INTRO
   ============================================= */
.site-hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--parchment);
}

.hero-text {
  max-width: 600px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero-eyebrow::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-bio {
  font-size: 1.05rem;
  color: var(--mid);
  max-width: 520px;
  line-height: 1.7;
}

/* =============================================
   INTEREST PILLS (categories)
   ============================================= */
.interest-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.interest-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mid);
  background: var(--parchment);
  border-radius: var(--r-lg);
  padding: 0.35rem 0.85rem;
  transition: var(--trans);
  border: 1px solid transparent;
}

.interest-pill:hover {
  background: var(--accent-lite);
  color: var(--accent);
  border-color: var(--accent);
}

.interest-pill .pill-icon {
  font-size: 0.9rem;
}

/* =============================================
   POST FEED
   ============================================= */
.post-feed {
  padding: 3rem 0 4rem;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.feed-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sand);
}

.feed-all-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.feed-all-link::after { content: '→'; transition: transform 0.2s ease; }
.feed-all-link:hover::after { transform: translateX(3px); }

/* Post cards */
.posts-list {
  display: grid;
  gap: 1px;
  background: var(--parchment);
  border: 1px solid var(--parchment);
  border-radius: var(--r-md);
  overflow: hidden;
}

.post-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 1rem;
  background: var(--white);
  padding: 1.4rem 1.5rem;
  transition: var(--trans);
  color: inherit;
  cursor: pointer;
  position: relative;
}

.post-row-title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.post-row:hover {
  background: var(--cream);
}

.post-row-title a {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  text-decoration: none;
  transition: var(--trans);
}

.post-row:hover .post-row-title a {
  color: var(--accent);
}

.post-row-cat {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.post-row-title {
  margin-bottom: 0.3rem;
}

.post-row-excerpt {
  font-size: 0.88rem;
  color: var(--mid);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-row-meta {
  font-size: 0.75rem;
  color: var(--sand);
  white-space: nowrap;
  padding-top: 0.2rem;
  text-align: right;
  flex-shrink: 0;
}

.post-row-thumb {
  display: none;
}

/* With thumbnail variant */
@media (min-width: 600px) {
  .post-row.has-thumb {
    grid-template-columns: 80px 1fr auto;
  }

  .post-row.has-thumb .post-row-thumb {
    display: block;
    width: 80px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--r-sm);
    flex-shrink: 0;
    background: var(--parchment);
    align-self: center;
  }
}

/* =============================================
   SINGLE POST / PAGE
   ============================================= */
.entry-wrap {
  padding: 2.5rem 0 4rem;
}
  margin-bottom: 2rem;
}

.entry-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.entry-title {
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.82rem;
  color: var(--sand);
  flex-wrap: wrap;
}

.entry-thumbnail {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--r-md);
  margin: 2rem 0;
}

.entry-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.entry-content h2 { margin: 2.25rem 0 0.75rem; }
.entry-content h3 { margin: 2rem 0 0.6rem; }
.entry-content img {
  border-radius: var(--r-sm);
  margin: 1.5rem 0;
  max-width: 100%;
  height: auto;
}
.entry-content a {
  text-decoration: underline;
  text-decoration-color: var(--parchment);
  text-underline-offset: 3px;
}
.entry-content a:hover {
  text-decoration-color: var(--accent);
}
.entry-content figure { margin: 2rem 0; }
.entry-content figcaption {
  font-size: 0.82rem;
  color: var(--sand);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* Post nav */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0;
  border-top: 1px solid var(--parchment);
  margin-top: 2rem;
}

.post-nav-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mid);
  max-width: 45%;
}
.post-nav-link:hover { color: var(--accent); }
.post-nav-link span {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--sand);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* =============================================
   ARCHIVE / CATEGORY PAGE
   ============================================= */
.archive-header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--parchment);
  margin-bottom: 2rem;
}

.archive-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.archive-title {
  font-size: clamp(1.8rem,4vw,2.8rem);
}

/* =============================================
   SIDEBAR (minimal, only appears on blog)
   ============================================= */
.content-area {
  display: block;
  padding: 2.5rem 0 4rem;
}

.widget-area {
  position: sticky;
  top: 80px;
}

.widget {
  margin-bottom: 2rem;
}

.widget-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sand);
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--parchment);
}

.widget ul { list-style: none; padding: 0; }
.widget ul li {
  padding: 0.3rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(200,188,168,0.3);
}
.widget ul li:last-child { border-bottom: none; }

/* =============================================
   SEARCH FORM
   ============================================= */
.search-form {
  display: flex;
  border: 1px solid var(--parchment);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--white);
  transition: border-color 0.2s ease;
}
.search-form:focus-within { border-color: var(--accent); }
.search-field {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.55rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
}
.search-field:focus { outline: none; }
.search-submit {
  background: var(--accent);
  border: none;
  padding: 0.55rem 1rem;
  color: white;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-body);
  transition: background 0.2s;
}
.search-submit:hover { background: var(--warm-dark); }

/* =============================================
   COMMENTS
   ============================================= */
.comments-area {
  padding: 2.5rem 0;
  border-top: 1px solid var(--parchment);
}
.comments-title { margin-bottom: 1.5rem; font-size: 1.3rem; }
.comment-list { list-style: none; padding: 0; }
.comment {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--parchment);
}
.comment-author .avatar { border-radius: 50%; float: left; margin-right: 0.875rem; }
.comment-author .fn { font-weight: 700; font-size: 0.9rem; font-family: var(--font-body); }
.comment-date { font-size: 0.78rem; color: var(--sand); display: block; margin-bottom: 0.5rem; }
.comment-content { font-size: 0.95rem; }
.comment-reply-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.5rem;
  display: inline-block;
}

.comment-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mid);
  margin-bottom: 0.3rem;
  letter-spacing: 0.03em;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--parchment);
  border-radius: var(--r-sm);
  padding: 0.65rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}
.comment-form input:focus,
.comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form textarea { height: 140px; resize: vertical; }
.comment-form input[type="submit"] {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--r-lg);
  padding: 0.65rem 1.75rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
.comment-form input[type="submit"]:hover { background: var(--warm-dark); }

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.375rem;
  padding: 2.5rem 0;
}
.pagination .page-numbers {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: var(--r-sm);
  background: var(--parchment);
  color: var(--mid);
  transition: var(--trans);
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover { background: var(--accent); color: white; }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  background: var(--warm-dark);
  color: var(--sand);
  padding: 2rem 0 1.5rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.footer-brand .site-title { color: var(--cream); font-size: 1.05rem; }
.footer-brand p { font-size: 0.85rem; margin-top: 0.25rem; opacity: 0.65; }

.footer-social {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.footer-social a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sand);
  opacity: 0.75;
  transition: var(--trans);
}
.footer-social a:hover { color: var(--cream); opacity: 1; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 1.25rem;
  font-size: 0.78rem;
  opacity: 0.45;
}

/* =============================================
   UTILITY
   ============================================= */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
  .content-area { grid-template-columns: 1fr; }
  .widget-area { position: static; }
}

@media (max-width: 768px) {
  /* Show hamburger, hide inline nav */
  .nav-toggle { display: flex; align-items: center; justify-content: center; }

  .primary-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--parchment);
    box-shadow: var(--shadow);
    padding: 0.75rem 1rem 1rem;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }

  .primary-nav.open { display: block; }

  .primary-nav ul {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .primary-nav > ul > li > a {
    display: block;
    padding: 0.6rem 0.5rem;
    border-radius: var(--r-sm);
    font-size: 0.95rem;
  }

  /* Mobile dropdowns: show inline when open */
  .primary-nav .sub-menu {
    display: none;
    position: static;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0 0 0.25rem 1rem;
    min-width: 0;
  }

  .primary-nav .sub-menu.open {
    display: block;
  }

  .primary-nav .sub-menu a {
    font-size: 0.85rem;
    color: var(--mid);
    padding: 0.35rem 0.5rem;
  }

  .primary-nav .sub-menu .sub-menu {
    padding-left: 1rem;
  }

  /* Hide 3rd-level on mobile to keep it clean */
  .primary-nav .sub-menu .sub-menu {
    display: none !important;
  }

  .site-hero { padding: 2.5rem 0 2rem; }
  .footer-inner { flex-direction: column; gap: 1.5rem; }
  .footer-bottom { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 480px) {
  .post-row { grid-template-columns: 1fr; }
  .post-row-meta { text-align: left; }
}
