/*
Theme Name: Fairfield Archive
Theme URI: https://fairfield.mainemacabre.com/
Author: Macabre Media
Author URI: https://mainemacabre.com/
Description: A custom archival theme built for Greetings From Fairfield, Maine — a community history project preserving old photos, postcards, news clippings, and local sports history. Warm paper tones, a vintage masthead feel, and card-based archive browsing for Posts and Categories.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: fairfield-archive
Tags: blog, news, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, two-columns

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned.
*/

/* =========================================================
   0. CSS Custom Properties
   ========================================================= */
:root{
  --bg: #f3eee3;
  --bg-alt: #ece4d3;
  --surface: #fffdf9;
  --ink: #2b241d;
  --ink-soft: #6b6055;
  --ink-faint: #948a7c;
  --border: #ddd0b8;
  --accent: #8a2e2e;       /* oxblood — headings/accents */
  --accent-dark: #5f1f1f;
  --link: #274a7a;         /* deep archive-navy for links */
  --link-hover: #8a2e2e;
  --evergreen: #2f5233;    /* echoes the site's original footer rule */
  --gold: #a97b2f;
  --teal: #2c5f5a;
  --shadow: 0 2px 4px rgba(43, 36, 29, 0.12);
  --shadow-lift: 0 6px 18px rgba(43, 36, 29, 0.16);
  --radius: 3px;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --container: 1160px;
}

/* =========================================================
   1. Reset & Base
   ========================================================= */
*, *::before, *::after{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }
body{
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(rgba(43,36,29,0.035) 1px, transparent 1px);
  background-size: 3px 3px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img{ max-width: 100%; height: auto; display: block; }
a{ color: var(--link); text-decoration: none; }
a:hover, a:focus{ color: var(--link-hover); text-decoration: underline; }
ul, ol{ padding-left: 1.2em; }
figure{ margin: 0; }
table{ border-collapse: collapse; width: 100%; }
input, textarea, select, button{ font-family: inherit; font-size: 1rem; }
.screen-reader-text{
  border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
  height: 1px; width: 1px; overflow: hidden; position: absolute !important;
  word-wrap: normal !important;
}
.screen-reader-text:focus{
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lift);
  clip: auto !important; clip-path: none; color: var(--ink); display: block;
  height: auto; left: 5px; line-height: normal; padding: 12px 16px;
  text-decoration: none; top: 5px; width: auto; z-index: 100000;
}

.container{
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4, h5, h6{
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1{ font-size: clamp(1.9rem, 1.6rem + 1.4vw, 2.6rem); }
h2{ font-size: clamp(1.5rem, 1.3rem + 0.9vw, 1.9rem); }
h3{ font-size: 1.3rem; }
p{ margin: 0 0 1.2em; }

.eyebrow{
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--accent);
  padding: 3px 9px 2px;
  border-radius: var(--radius);
}
.eyebrow a{ color: inherit; }
.eyebrow a:hover{ color: inherit; text-decoration: none; opacity: .85; }

/* category accent colors, keyed by slug — falls back to --accent */
.cat-historic-photos, .cat-historic-photos a{ background: var(--accent); }
.cat-historic-videos, .cat-historic-videos a{ background: var(--teal); }
.cat-in-the-news, .cat-in-the-news a{ background: var(--evergreen); }
.cat-postcards, .cat-postcards a{ background: var(--gold); }
.cat-sports, .cat-sports a{ background: var(--link); }

/* =========================================================
   2. Skip link
   ========================================================= */
.skip-link{ position: absolute; top: -60px; left: 0; z-index: 999999; }
.skip-link:focus{ top: 0; }

/* =========================================================
   3. Site Header
   ========================================================= */
.site-header{
  background: var(--surface);
  border-bottom: 4px solid var(--accent);
}
.site-header-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 18px;
  flex-wrap: wrap;
}
.site-branding{ display: flex; align-items: center; gap: 14px; }
.site-branding img.custom-logo{ max-height: 68px; width: auto; }
.site-title{
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  margin: 0;
}
.site-title a{ color: var(--ink); }
.site-title a:hover{ color: var(--accent); text-decoration: none; }
.site-description{
  margin: 2px 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-style: italic;
}

.header-search{ min-width: 220px; }
.header-search .search-form{ display: flex; }
.header-search input[type="search"]{
  flex: 1;
  border: 1px solid var(--border);
  border-right: none;
  background: var(--bg);
  padding: 9px 12px;
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--ink);
}
.header-search button{
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  padding: 0 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
}
.header-search button:hover{ background: var(--accent); border-color: var(--accent); }

.main-navigation{
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.main-navigation .container{ display: flex; align-items: center; justify-content: space-between; }
.main-navigation ul{
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap;
}
.main-navigation li{ position: relative; }
.main-navigation a{
  display: block;
  padding: 13px 16px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.main-navigation a:hover{ color: var(--accent); text-decoration: none; background: var(--bg); }
.main-navigation .sub-menu{
  display: none;
  position: absolute; left: 0; top: 100%;
  min-width: 220px;
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  z-index: 50;
  list-style: none; padding: 0; margin: 0;
}
.main-navigation li:hover > .sub-menu,
.main-navigation li:focus-within > .sub-menu{ display: block; }
.main-navigation .sub-menu a{ padding: 10px 16px; }

.menu-toggle{
  display: none;
  background: var(--ink);
  color: var(--surface);
  border: none;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

/* =========================================================
   4. Layout: content + sidebar
   ========================================================= */
.site-content{ padding: 40px 0 60px; }
.content-wrap{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 44px;
  align-items: start;
}
.content-wrap.no-sidebar{ grid-template-columns: minmax(0, 1fr); }

.archive-header{
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--border);
}
.archive-header .eyebrow{ margin-bottom: 8px; }
.archive-header h1{ margin-bottom: 6px; }
.archive-description{ color: var(--ink-soft); margin: 0; }

/* =========================================================
   5. Post cards (archive / search / index grid)
   ========================================================= */
.post-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px;
}
@media (max-width: 700px){
  .post-grid{ grid-template-columns: 1fr; }
}

.post-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s ease, transform .18s ease;
}
.post-card:hover{ box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.post-card .card-thumb{
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-alt);
}
.post-card .card-thumb img{ width: 100%; height: 100%; object-fit: cover; }
.post-card .card-body{ padding: 18px 18px 20px; flex: 1; display: flex; flex-direction: column; }
.post-card .eyebrow{ align-self: flex-start; margin-bottom: 10px; }
.post-card h2, .post-card h3{ font-size: 1.25rem; margin-bottom: 6px; }
.post-card h2 a, .post-card h3 a{ color: var(--ink); }
.post-card h2 a:hover, .post-card h3 a:hover{ color: var(--accent); text-decoration: none; }
.post-card .entry-excerpt{ color: var(--ink-soft); font-size: 0.94rem; margin-bottom: 10px; }
.post-card .entry-meta{ margin-top: auto; }

.entry-meta{
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}
.entry-meta .byline{ font-weight: 600; color: var(--ink-soft); }
.entry-meta span + span::before{ content: "\2022"; margin: 0 6px; color: var(--border); }

/* =========================================================
   6. Featured / hero post (top of home)
   ========================================================= */
.hero-post{
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 34px;
}
.hero-post .card-thumb{ aspect-ratio: auto; height: 100%; min-height: 260px; }
.hero-post .card-thumb img{ width: 100%; height: 100%; object-fit: cover; }
.hero-post .card-body{ padding: 30px 34px; display: flex; flex-direction: column; justify-content: center; }
.hero-post h2{ font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); margin: 10px 0 12px; }
.hero-post .entry-excerpt{ color: var(--ink-soft); }
@media (max-width: 780px){
  .hero-post{ grid-template-columns: 1fr; }
  .hero-post .card-thumb{ min-height: 200px; }
}

/* =========================================================
   7. Single post
   ========================================================= */
.entry-header{ margin-bottom: 22px; }
.entry-header .eyebrow{ margin-bottom: 12px; }
.entry-header h1{ margin-bottom: 10px; }
.entry-thumbnail{
  margin: 0 0 28px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.entry-content{ font-size: 1.05rem; }
.entry-content > *:last-child{ margin-bottom: 0; }
.entry-content h2, .entry-content h3{ margin-top: 1.6em; }
.entry-content blockquote{
  margin: 1.6em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}
.entry-content figure{ margin: 1.6em 0; }
.entry-content figcaption{
  font-size: 0.85rem; color: var(--ink-faint); margin-top: 8px; font-style: italic;
}
.entry-content img{ border-radius: var(--radius); }
.entry-content a{ text-decoration: underline; text-underline-offset: 2px; }

.entry-footer{
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.tags-links{ font-size: 0.85rem; color: var(--ink-soft); }
.tags-links a{
  display: inline-block;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  padding: 3px 10px;
  border-radius: 30px;
  margin: 2px 4px 2px 0;
  font-size: 0.8rem;
}
.tags-links a:hover{ background: var(--accent); border-color: var(--accent); color: var(--surface); text-decoration: none; }

.post-navigation{
  margin: 40px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.post-navigation .nav-previous, .post-navigation .nav-next{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.post-navigation .nav-next{ text-align: right; }
.post-navigation .nav-subtitle{
  display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint); margin-bottom: 4px;
}
.post-navigation a{ color: var(--ink); font-weight: 600; }
.post-navigation a:hover{ color: var(--accent); text-decoration: none; }
@media (max-width: 560px){ .post-navigation{ grid-template-columns: 1fr; } }

/* =========================================================
   8. Sidebar / widgets
   ========================================================= */
.widget{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px 22px;
  margin: 0 0 24px;
}
.widget:last-child{ margin-bottom: 0; }
.widget-title{
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
}
.widget ul{ list-style: none; margin: 0; padding: 0; }
.widget ul li{
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.92rem;
}
.widget ul li:last-child{ border-bottom: none; }
.widget ul ul{ padding-left: 14px; margin-top: 6px; }
.widget select{ width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.widget .search-form{ display: flex; }
.widget .search-form input[type="search"]{
  flex: 1; border: 1px solid var(--border); border-right: none;
  padding: 9px 10px; border-radius: var(--radius) 0 0 var(--radius);
}
.widget .search-form button{
  border: 1px solid var(--ink); background: var(--ink); color: var(--surface);
  padding: 0 14px; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer;
}
.tagcloud{ display: flex; flex-wrap: wrap; gap: 8px; }
.tagcloud a{
  font-size: 0.78rem !important;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 30px;
  color: var(--ink-soft);
}
.tagcloud a:hover{ background: var(--accent); border-color: var(--accent); color: var(--surface); text-decoration: none; }

/* =========================================================
   9. Pagination
   ========================================================= */
.pagination, .navigation.pagination{ margin: 40px 0 0; }
.pagination .nav-links{
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
}
.pagination a, .pagination span{
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 0.9rem;
}
.pagination a:hover{ background: var(--accent); border-color: var(--accent); color: var(--surface); text-decoration: none; }
.pagination .current{ background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* =========================================================
   10. Comments
   ========================================================= */
.comments-area{ margin-top: 46px; padding-top: 30px; border-top: 2px solid var(--border); }
.comments-title, .comment-reply-title{ font-size: 1.3rem; }
.comment-list{ list-style: none; margin: 0; padding: 0; }
.comment-list .children{ list-style: none; padding-left: 34px; }
.comment-body{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.comment-author{ font-weight: 700; font-size: 0.92rem; }
.comment-metadata{ font-size: 0.78rem; color: var(--ink-faint); margin-bottom: 8px; }
.comment-metadata a{ color: inherit; }
.comment-form label{ display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9rem; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea{
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 14px;
}
.comment-form button, .comment-form input[type="submit"]{
  background: var(--accent); color: var(--surface); border: none;
  padding: 11px 22px; border-radius: var(--radius); font-weight: 700; cursor: pointer;
}
.comment-form button:hover, .comment-form input[type="submit"]:hover{ background: var(--accent-dark); }

/* =========================================================
   11. Misc: 404, search results empty state
   ========================================================= */
.no-results{
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 40px 30px; text-align: center;
}
.no-results h1{ margin-bottom: 10px; }

/* =========================================================
   12. Footer
   ========================================================= */
.site-footer{
  background: var(--ink);
  color: #d9d2c4;
  border-top: 5px solid var(--evergreen);
  margin-top: 60px;
}
.footer-widgets{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  padding: 46px 0 30px;
}
.footer-widgets .widget{
  background: transparent; border: none; box-shadow: none; padding: 0; margin: 0;
}
.footer-widgets .widget-title{ color: var(--surface); border-bottom-color: var(--evergreen); }
.footer-widgets a{ color: #d9d2c4; }
.footer-widgets a:hover{ color: var(--surface); }
.site-info{
  border-top: 1px solid rgba(255,255,255,0.12);
  padding: 18px 0;
  font-size: 0.85rem;
  color: #a79c8a;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.site-info a{ color: #cabfa8; }

/* =========================================================
   13. Responsive nav toggle
   ========================================================= */
@media (max-width: 820px){
  .menu-toggle{ display: inline-block; }
  .main-navigation .container{ flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .main-navigation ul{ display: none; width: 100%; flex-direction: column; }
  .main-navigation.is-open ul{ display: flex; }
  .main-navigation .sub-menu{ position: static; box-shadow: none; display: block; }
  .content-wrap{ grid-template-columns: 1fr; }
  .header-search{ order: 3; width: 100%; }
}
