/*
Theme Name: Maine Realtor David
Theme URI: https://realtormaine.net/blog/
Author: David Haydym
Description: Blog theme for realtormaine.net. Carries the main site's palette (navy, pine, stone, cream, rust), its Playfair Display / Lato pairing, and its fixed navy navigation, so /blog reads as the same site rather than a bolted-on WordPress install.
Version: 1.1.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mrd
Tags: blog, one-column, right-sidebar, custom-menu, featured-images, threaded-comments
*/

/* ==========================================================================
   Tokens — lifted verbatim from index.html so the two halves cannot drift.
   ========================================================================== */
:root {
  --navy:  #1a2a3a;
  --pine:  #2e5339;
  --fog:   #e8ede9;
  --stone: #c9c0b0;
  --cream: #f5f0e8;
  --rust:  #b84c2b;
  --white: #ffffff;
  --ink:   #4a5568;
  --muted: #718096;

  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans:  'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --shadow-card:  0 4px 24px rgba(26, 42, 58, 0.08);
  --shadow-lift:  0 12px 40px rgba(26, 42, 58, 0.15);
  --wrap: 1200px;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.75;
  background: var(--cream);
  color: var(--navy);
  overflow-x: hidden;
}

img, video, iframe, embed, object { max-width: 100%; height: auto; }
figure { margin: 32px 0; }
a { color: var(--rust); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #9e3e22; }

/* Keyboard users must be able to see where they are. */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--rust); color: var(--white);
  padding: 12px 20px; font-size: 0.85rem; letter-spacing: 1.5px; text-transform: uppercase;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   NAV — same geometry, colours and blur as the main site's fixed bar.
   ========================================================================== */
.site-nav {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 48px;
  background: rgba(26, 42, 58, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.nav-logo {
  font-family: var(--serif);
  font-size: 1.2rem; letter-spacing: 1px;
  flex-shrink: 0;
}
.nav-logo a { color: var(--cream); text-decoration: none; }
.nav-logo a:hover { color: var(--white); }

.nav-links { display: flex; gap: 28px; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--stone); text-decoration: none; font-size: 0.8rem;
  letter-spacing: 1.5px; text-transform: uppercase;
  transition: color 0.25s; white-space: nowrap;
}
.nav-links a:hover { color: var(--white); }
.nav-links .current-menu-item > a,
.nav-links .nav-current > a { color: var(--white); }

.hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; background: none; border: none; padding: 4px;
}
.hamburger span {
  display: block; width: 25px; height: 2px;
  background: var(--cream); border-radius: 2px; transition: all 0.3s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(26, 42, 58, 0.98);
  flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  list-style: none; margin: 0; padding: 0;
}
.mobile-menu.open { display: flex; }
/* The overlay is a <div> wrapping a <ul> (wp_nav_menu always emits a list), so
   the list itself has to be flattened too. */
.mobile-menu-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.mobile-menu a {
  color: var(--stone); text-decoration: none; font-size: 1rem;
  letter-spacing: 3px; text-transform: uppercase; padding: 14px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  width: 240px; text-align: center; display: block; transition: color 0.2s;
}
.mobile-menu a:hover { color: var(--white); }

/* ==========================================================================
   PAGE HEADER — the main site opens on a 100vh hero; a blog cannot afford
   that on every page, so this is the same treatment compressed to a band.
   ========================================================================== */
.page-hero {
  margin-top: var(--nav-h);
  padding: 96px 48px 72px;
  text-align: center;
  background:
    linear-gradient(to bottom, rgba(26,42,58,0.78) 0%, rgba(26,42,58,0.62) 60%, rgba(26,42,58,0.85) 100%),
    url('https://images.unsplash.com/photo-1542273917363-3b1817f69a2d?w=1600&q=80') center/cover no-repeat;
}
.page-hero .eyebrow {
  font-weight: 300; letter-spacing: 5px; text-transform: uppercase;
  color: var(--stone); font-size: 0.75rem; margin: 0 0 16px;
}
.page-hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.4rem);
  color: var(--white); line-height: 1.15; margin: 0;
  font-weight: 400;
}
.page-hero h1 em { color: var(--stone); font-style: italic; }
.page-hero .hero-sub {
  margin: 20px auto 0; max-width: 560px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1rem; line-height: 1.7; font-weight: 300;
}
.pine-divider { height: 6px; background: linear-gradient(to right, var(--navy), var(--pine), var(--navy)); }

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.site-main { padding: 80px 48px; }
.wrap { max-width: var(--wrap); margin: 0 auto; }
.with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; align-items: start; }

.section-label {
  font-size: 0.75rem; letter-spacing: 4px; text-transform: uppercase;
  color: var(--rust); margin: 0 0 12px;
}
.section-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  color: var(--navy); line-height: 1.2; margin: 0;
}

/* ==========================================================================
   POST CARDS — the .region-card treatment from the main site.
   ========================================================================== */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }

.post-card {
  background: var(--white);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lift); }
.post-card .thumb { display: block; overflow: hidden; background: var(--fog); }
.post-card .thumb img { width: 100%; height: 210px; object-fit: cover; display: block; transition: transform 0.5s; }
.post-card:hover .thumb img { transform: scale(1.04); }
.post-card .card-body { padding: 28px 28px 32px; display: flex; flex-direction: column; flex: 1; }
.post-card .card-meta {
  font-size: 0.7rem; letter-spacing: 2px; text-transform: uppercase;
  color: var(--rust); margin-bottom: 10px;
}
.post-card h2, .post-card h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: 1.35rem; line-height: 1.3; margin: 0 0 12px;
}
.post-card h2 a, .post-card h3 a { color: var(--navy); text-decoration: none; }
.post-card h2 a:hover, .post-card h3 a:hover { color: var(--rust); }
.post-card .excerpt { color: var(--ink); font-size: 0.92rem; line-height: 1.75; margin: 0 0 20px; }
.post-card .read-more {
  margin-top: auto; align-self: flex-start;
  font-size: 0.75rem; letter-spacing: 2px; text-transform: uppercase;
  color: var(--rust); text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px;
}
.post-card .read-more:hover { color: var(--navy); }

/* Sticky/featured post gets the full width and a rust rule. */
.post-card.is-sticky { border-top: 3px solid var(--rust); }

/* ==========================================================================
   SINGLE POST / PAGE
   ========================================================================== */
.entry {
  background: var(--white);
  padding: 56px clamp(24px, 5vw, 72px) 64px;
  box-shadow: var(--shadow-card);
}
.entry-meta {
  font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 28px;
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
}
.entry-meta a { color: var(--rust); text-decoration: none; }
.entry-meta a:hover { text-decoration: underline; }

.entry-featured { margin: 0 0 40px; }
.entry-featured img { width: 100%; display: block; }

/* Long-form typography. Measure is capped — 1200px of running text is unreadable. */
.entry-content { max-width: 68ch; color: var(--ink); font-size: 1.02rem; line-height: 1.85; }
.entry-content > * + * { margin-top: 1.3em; }
.entry-content h2, .entry-content h3, .entry-content h4 {
  font-family: var(--serif); font-weight: 400; color: var(--navy); line-height: 1.25;
  margin-top: 2em; margin-bottom: 0.6em;
}
.entry-content h2 { font-size: 1.9rem; }
.entry-content h3 { font-size: 1.45rem; }
.entry-content h4 { font-size: 1.15rem; font-family: var(--sans); font-weight: 700; letter-spacing: 0.3px; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li + li { margin-top: 0.5em; }
.entry-content blockquote {
  margin: 2em 0; padding: 4px 0 4px 28px;
  border-left: 3px solid var(--stone);
  font-family: var(--serif); font-style: italic;
  font-size: 1.2rem; color: var(--navy);
}
.entry-content blockquote cite {
  display: block; margin-top: 12px;
  font-family: var(--sans); font-style: normal; font-size: 0.75rem;
  letter-spacing: 2px; text-transform: uppercase; color: var(--muted);
}
.entry-content code {
  background: var(--fog); padding: 2px 6px; border-radius: 2px;
  font-size: 0.88em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.entry-content pre {
  background: var(--navy); color: var(--fog);
  padding: 20px 24px; overflow-x: auto; border-radius: 2px; font-size: 0.85rem; line-height: 1.6;
}
.entry-content pre code { background: none; padding: 0; color: inherit; }
.entry-content hr { border: 0; border-top: 1px solid var(--stone); margin: 3em 0; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.entry-content th, .entry-content td { border-bottom: 1px solid var(--fog); padding: 10px 12px; text-align: left; }
.entry-content th { color: var(--navy); font-weight: 700; letter-spacing: 0.5px; }

/* WordPress core alignment + caption classes. */
.alignleft  { float: left;  margin: 0.4em 1.6em 1.2em 0; }
.alignright { float: right; margin: 0.4em 0 1.2em 1.6em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.alignwide  { max-width: min(100%, 1000px); margin-left: auto; margin-right: auto; }
.alignfull  { width: 100%; }
.wp-caption-text, .wp-element-caption {
  font-size: 0.78rem; color: var(--muted); text-align: center;
  margin-top: 10px; letter-spacing: 0.4px;
}
.sticky .entry-title::after { content: ' ★'; color: var(--rust); }

.entry-tags { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--fog); }
.entry-tags a {
  display: inline-block; margin: 0 8px 8px 0; padding: 5px 14px;
  background: var(--fog); color: var(--navy); text-decoration: none;
  font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}
.entry-tags a:hover { background: var(--navy); color: var(--cream); }

/* ==========================================================================
   BUTTONS — identical to the main site's .btn-primary / .btn-outline.
   ========================================================================== */
.btn-primary, .btn-outline,
.entry-content .wp-block-button__link,
input[type="submit"], button[type="submit"] {
  display: inline-block; padding: 14px 36px;
  font-family: var(--sans); font-size: 0.85rem;
  letter-spacing: 2px; text-transform: uppercase;
  border-radius: 2px; cursor: pointer; text-decoration: none;
  transition: background 0.25s, border-color 0.25s, transform 0.2s;
}
.btn-primary, .entry-content .wp-block-button__link,
input[type="submit"], button[type="submit"] {
  background: var(--rust); color: var(--white); border: none;
}
.btn-primary:hover, .entry-content .wp-block-button__link:hover,
input[type="submit"]:hover, button[type="submit"]:hover {
  background: #9e3e22; color: var(--white); transform: translateY(-2px);
}
.btn-outline {
  background: transparent; color: var(--navy);
  border: 1px solid var(--stone);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); transform: translateY(-2px); }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar { position: sticky; top: calc(var(--nav-h) + 32px); }
.widget { background: var(--white); padding: 28px; box-shadow: var(--shadow-card); margin-bottom: 28px; }
.widget-title {
  font-size: 0.72rem; letter-spacing: 3px; text-transform: uppercase;
  color: var(--rust); margin: 0 0 18px; padding-bottom: 12px;
  border-bottom: 1px solid var(--fog); font-weight: 700;
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { border-bottom: 1px solid var(--fog); }
.widget li:last-child { border-bottom: 0; }
.widget li a {
  display: block; padding: 10px 0; color: var(--navy);
  text-decoration: none; font-size: 0.9rem; transition: color 0.2s, padding-left 0.2s;
}
.widget li a:hover { color: var(--rust); padding-left: 6px; }

/* The CTA widget — the reason the blog exists is to feed the contact form. */
.widget-cta { background: var(--navy); color: var(--cream); text-align: center; }
.widget-cta .widget-title { color: var(--stone); border-bottom-color: rgba(255,255,255,0.12); }
.widget-cta p { font-size: 0.9rem; line-height: 1.7; color: rgba(255,255,255,0.78); margin: 0 0 20px; }
.widget-cta .btn-primary { padding: 12px 28px; font-size: 0.78rem; }

/* ==========================================================================
   FORMS
   ========================================================================== */
input[type="text"], input[type="email"], input[type="url"],
input[type="search"], input[type="password"], textarea, select {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--stone); border-radius: 2px;
  background: var(--white); color: var(--navy);
  font-family: var(--sans); font-size: 0.95rem;
}
input:focus, textarea:focus, select:focus { border-color: var(--rust); }
label { display: block; font-size: 0.75rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

.search-form { display: flex; gap: 10px; }
.search-form input[type="search"] { flex: 1; }
.search-form button { padding: 12px 20px; letter-spacing: 1px; }

/* ==========================================================================
   COMMENTS
   ========================================================================== */
.comments-area { margin-top: 56px; background: var(--white); padding: 48px clamp(24px, 5vw, 72px); box-shadow: var(--shadow-card); }
.comments-title, .comment-reply-title {
  font-family: var(--serif); font-weight: 400; font-size: 1.6rem; color: var(--navy); margin: 0 0 28px;
}
.comment-list { list-style: none; margin: 0 0 48px; padding: 0; }
.comment-list ol.children { list-style: none; margin: 24px 0 0 0; padding-left: clamp(16px, 4vw, 40px); border-left: 2px solid var(--fog); }
.comment-body { padding: 20px 0; border-bottom: 1px solid var(--fog); }
.comment-author { font-weight: 700; color: var(--navy); font-size: 0.95rem; }
.comment-author img { border-radius: 50%; vertical-align: middle; margin-right: 10px; }
.comment-metadata { font-size: 0.7rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 4px 0 12px; }
.comment-metadata a { color: var(--muted); text-decoration: none; }
.comment-content { color: var(--ink); font-size: 0.95rem; }
.comment-respond { padding-top: 8px; }
.comment-form p { margin-bottom: 18px; }
.comment-notes, .comment-form-cookies-consent label { text-transform: none; letter-spacing: 0; font-size: 0.85rem; color: var(--muted); }
.comment-form-cookies-consent { display: flex; align-items: center; gap: 10px; }
.comment-form-cookies-consent input { width: auto; }

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.pagination { margin-top: 56px; display: flex; justify-content: center; }
.pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; padding: 0 14px;
  background: var(--white); color: var(--navy); text-decoration: none;
  font-size: 0.85rem; letter-spacing: 1px;
  box-shadow: var(--shadow-card); transition: background 0.2s, color 0.2s;
}
.pagination .page-numbers:hover { background: var(--navy); color: var(--cream); }
.pagination .page-numbers.current { background: var(--rust); color: var(--white); }
.pagination .page-numbers.dots { box-shadow: none; background: transparent; }

.post-nav { margin-top: 48px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.post-nav a {
  display: block; background: var(--white); padding: 24px 28px;
  box-shadow: var(--shadow-card); text-decoration: none;
  transition: transform 0.25s, box-shadow 0.25s;
}
.post-nav a:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.post-nav .dir { font-size: 0.7rem; letter-spacing: 2px; text-transform: uppercase; color: var(--rust); }
.post-nav .ttl { display: block; margin-top: 8px; font-family: var(--serif); font-size: 1.1rem; color: var(--navy); line-height: 1.35; }
.post-nav .next { text-align: right; }

/* ==========================================================================
   EMPTY / 404
   ========================================================================== */
.no-results { background: var(--white); padding: 72px 48px; text-align: center; box-shadow: var(--shadow-card); }
.no-results h2 { font-family: var(--serif); font-weight: 400; font-size: 1.8rem; color: var(--navy); margin: 0 0 14px; }
.no-results p { color: var(--ink); max-width: 460px; margin: 0 auto 28px; }
.no-results .search-form { max-width: 420px; margin: 0 auto; }
.error-code { font-family: var(--serif); font-size: clamp(4rem, 14vw, 8rem); color: var(--stone); line-height: 1; margin: 0 0 8px; }

/* ==========================================================================
   FOOTER — matches the main site's footer block.
   ========================================================================== */
.site-footer {
  background: var(--navy); color: var(--stone);
  padding: 64px 48px 56px; text-align: center;
}
.site-footer strong { display: block; color: var(--cream); font-family: var(--serif); font-size: 1.15rem; font-weight: 400; letter-spacing: 0.5px; }
/* `auto` on the horizontal margins, not 0. This rule outranks the
   .footer-counties class selector below it (0,1,1 beats 0,1,0), so a `0` here
   silently cancels that block's centering and pins its 640px box to the left
   edge — text centered inside a box that is itself off to one side. */
.site-footer p { margin: 14px auto 0; font-size: 0.82rem; color: #8b97a3; }
.footer-social { margin-top: 22px; display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.footer-social a {
  color: var(--stone); text-decoration: none; font-size: 0.8rem;
  letter-spacing: 1px; display: inline-flex; align-items: center; gap: 7px; transition: color 0.2s;
}
.footer-social a:hover { color: var(--white); }
/* Scoped to .site-footer so these match the specificity of the `p` rule above
   and actually win their margin-top back. */
.site-footer .footer-counties {
  margin-top: 24px; max-width: 640px;
  font-size: 0.72rem; line-height: 1.7; color: #6b7885;
}
.site-footer .footer-back { margin-top: 28px; }
.footer-back a {
  color: var(--stone); font-size: 0.75rem; letter-spacing: 2px; text-transform: uppercase;
  text-decoration: none; border-bottom: 1px solid rgba(201, 192, 176, 0.4); padding-bottom: 3px;
}
.footer-back a:hover { color: var(--white); border-bottom-color: var(--white); }

/* ==========================================================================
   RESPONSIVE — breakpoints chosen to match the main site's.
   ========================================================================== */
@media (max-width: 1024px) {
  .with-sidebar { grid-template-columns: 1fr; gap: 48px; }
  .sidebar { position: static; }
}
@media (max-width: 860px) {
  .site-nav { padding: 16px 24px; }
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .site-main { padding: 56px 24px; }
  .page-hero { padding: 72px 24px 56px; }
  .entry { padding: 40px 24px 48px; }
  .comments-area { padding: 36px 24px; }
  .site-footer { padding: 48px 24px 40px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
}
@media (max-width: 480px) {
  .post-grid { grid-template-columns: 1fr; }
  .entry-content { font-size: 0.98rem; }
}

/* Respect the OS setting — the card lifts and hero fades are decorative. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .post-card:hover, .post-nav a:hover { transform: none; }
}

@media print {
  .site-nav, .mobile-menu, .sidebar, .site-footer, .comments-area, .pagination, .post-nav { display: none !important; }
  .entry { box-shadow: none; padding: 0; }
  body { background: #fff; }
}
