/*
Theme Name:   Aging Families
Theme URI:    https://agingfamilies.com
Description:  GeneratePress child theme for agingfamilies.com — clean, readable, content-focused
Author:       Aging Families
Version:      0.2.1
Template:     generatepress
Text Domain:  agingfamilies
*/

/* ==========================================================================
   1. DESIGN TOKENS — all colors, scale, and layout live here only.
      Change brand colors in this block; nothing else needs editing.
   ========================================================================== */

:root {
  /* ----- Colors: Midnight & Ember ----- */
  --color-primary:        #1a2332;   /* links, active nav, focus rings      */
  --color-primary-hover:  #0f1822;
  --color-accent:         #c0713a;   /* secondary accent, tags, highlights  */
  --color-accent-hover:   #a85e2d;

  --color-text:           #1c1917;   /* body copy                           */
  --color-text-muted:     #6b6055;   /* dates, captions, secondary labels   */
  --color-heading:        #0f172a;

  --color-bg:             #faf9f7;
  --color-bg-alt:         #f0ede8;   /* alternating row, code blocks        */
  --color-border:         #e0d9d0;
  --color-border-dark:    #cec5bb;

  --color-header-bg:      #1a2332;
  --color-header-border:  #0f1822;

  --color-footer-bg:      #1a2332;
  --color-footer-text:    #c9c2bc;
  --color-footer-link:    #e0b896;   /* warm tone readable on dark bg       */

  --color-card-bg:        #ffffff;
  --color-card-shadow:    rgba(0, 0, 0, 0.06);
  --color-card-shadow-hover: rgba(0, 0, 0, 0.12);

  --color-focus:          #c0713a;   /* focus ring — accent on dark header  */

  /* ----- Typography ----- */
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;
  --font-heading: 'Fraunces', Georgia, serif;
  --font-mono:    ui-monospace, "Cascadia Code", "Fira Code", Consolas, monospace;

  --text-sm:      0.875rem;   /* 14px */
  --text-base:    1.125rem;   /* 18px — larger for readability */
  --text-lg:      1.25rem;    /* 20px */
  --text-xl:      1.5rem;     /* 24px */
  --text-2xl:     1.875rem;   /* 30px */
  --text-3xl:     2.25rem;    /* 36px */
  --text-4xl:     3rem;       /* 48px */

  --lh-body:      1.75;
  --lh-heading:   1.2;
  --lh-loose:     1.9;

  /* ----- Spacing ----- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ----- Layout ----- */
  --content-max:  740px;    /* readable line length for article body */
  --wide-max:    1140px;    /* full site container                   */
  --sidebar-w:    300px;    /* right rail width                      */
  --gap:          2rem;

  /* ----- Decoration ----- */
  --radius:       0.5rem;
  --radius-sm:    0.25rem;
  --radius-lg:    0.75rem;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10);
  --transition:   150ms ease;
}

/* ==========================================================================
   2. BASE RESET
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  line-height: var(--lh-heading);
  font-weight: 700;
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

/* Entry title on single posts — override parent theme sizing */
.entry-title {
  font-size: var(--text-3xl);
  margin-top: 0;
  margin-bottom: var(--space-4);
}

p {
  margin-top: 0;
  margin-bottom: var(--space-6);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

a:hover,
a:focus {
  color: var(--color-primary-hover);
}

a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: var(--space-6);
  padding-left: var(--space-8);
}

li {
  margin-bottom: var(--space-2);
}

/* Blockquote */
blockquote {
  margin: var(--space-8) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 4px solid var(--color-primary);
  background: var(--color-bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  font-style: italic;
}

blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-style: normal;
  color: var(--color-text-muted);
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
}

pre {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-6);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* ==========================================================================
   4. LAYOUT — override GeneratePress container and content area
   ========================================================================== */

/* Main GP grid container — caps full site width */
.grid-container {
  max-width: var(--wide-max);
  padding-left: var(--gap);
  padding-right: var(--gap);
  margin-left: auto;
  margin-right: auto;
}

/* Top-level site wrapper — .site also carries .grid-container, which our
   base rule gives horizontal padding. Use two-class specificity (0,2,0) to
   beat .grid-container (0,1,0) even inside media queries: the site wrapper
   itself has no gutters; each child section (header, article, footer) owns
   its own horizontal padding. */
.site.grid-container,
.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-left: 0;
  padding-right: 0;
}

/* GP content + sidebar flex row */
.site-content {
  flex: 1;
}

.content-area {
  /* GP handles flex width based on layout class;
     we clamp the max so long lines stay readable */
}

/* Single posts: constrain the prose column for readability */
.single .entry-content,
.page .entry-content {
  max-width: var(--content-max);
}

/* ==========================================================================
   5. SITE HEADER
   ========================================================================== */

.site-header {
  background-color: var(--color-header-bg);
  border-bottom: 1px solid var(--color-header-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

/* GP's actual inner wrapper — .inside-header, not .grid-container */
.inside-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 64px;
  padding: var(--space-3) var(--gap);
  max-width: var(--wide-max);
  margin: 0 auto;
}

.site-branding {
  flex-shrink: 0;
}

/* Injected logo — PHP adds .af-site-logo via generate_inside_navigation at priority 1.
   margin-right: auto pushes search + nav links to the right side of the nav bar. */
.af-site-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: auto;
  order: -1;
}

.af-site-logo a {
  display: block;
  line-height: 0;
}

.af-site-logo img {
  height: 44px;
  width: auto;
  display: block;
}

.af-site-logo a:hover {
  opacity: 0.85;
}

/* GP uses .main-title, not .site-title */
.main-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1;
}

.main-title a {
  display: block;
  width: 190px;
  height: 44px;
  font-size: 0;           /* hide text visually; screen readers still read the link */
  color: transparent;
  text-decoration: none;
  background-image: url('/wp-content/themes/agingfamilies-theme/assets/img/agingfamilies_logo_dark.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
}

.main-title a:hover {
  opacity: 0.85;
}

.site-description {
  margin: 0;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
}

/* Logo image if set */
.custom-logo {
  height: 48px;
  width: auto;
}

/* ==========================================================================
   6. PRIMARY NAVIGATION
   ========================================================================== */

/* GP's primary nav element */
#site-navigation {
  flex: 1;
  min-width: 0;
}

/* GP's inline-generated CSS sets .main-navigation and .inside-article to #fff.
   Clear both so the dark header and warm page background show through. */
.main-navigation,
.separate-containers .inside-article,
.separate-containers .page-header {
  background: transparent;
}

/* GP's inner nav wrapper */
.inside-navigation {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: 0;
  max-width: none;
  margin: 0;
  background: transparent;
}

/* Menu items list */
.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.main-nav ul li {
  margin: 0;
  position: relative;
}

/* Match GP's inline CSS specificity (.main-navigation .main-nav ul li a) so our
   color wins. Without .main-navigation prefix our 0,2,1 loses to GP's 0,3,1. */
.main-navigation .main-nav ul li a,
.main-navigation .menu-toggle {
  font-family: var(--font-body);
}

/* Hamburger icon must be white on the dark header. GP sets color via
   .main-navigation .menu-toggle { color: var(--contrast) } at 0,2,1 specificity.
   We match that and load after parent, so this wins. */
.main-navigation .menu-toggle {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.3);
}

.main-navigation button.menu-toggle:hover,
.main-navigation button.menu-toggle:focus {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.6);
}

.main-navigation .main-nav ul li a {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background-color var(--transition);
}

/* li.menu-item:hover > a adds the .menu-item class to reach specificity 0,4,3,
   matching GP's li:not([class*="current-menu-"]):hover rule so ours wins (last). */
.main-navigation .main-nav ul li a:hover,
.main-navigation .main-nav ul li.menu-item:hover > a,
.main-navigation .main-nav ul li.current-menu-item > a,
.main-navigation .main-nav ul li.current-menu-ancestor > a {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Dropdown menus */
.main-nav ul ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 200;
  min-width: 200px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  flex-direction: column;
  gap: 0;
  padding: var(--space-2) 0;
}

.main-nav ul li:hover > ul,
.main-nav ul li:focus-within > ul {
  display: flex;
}

.main-nav ul ul a {
  border-radius: 0;
  padding: var(--space-2) var(--space-4);
  font-weight: 400;
}

/* Hamburger toggle buttons — do NOT set display here.
   GP's main.css sets .menu-toggle { display: none } on desktop and
   reveals it on mobile. Overriding display at the same specificity
   with a later stylesheet would break that hiding. */
.menu-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  align-items: center;
  gap: var(--space-2);
  line-height: 1;
  transition: border-color var(--transition), color var(--transition);
}

.menu-toggle:hover {
  border-color: rgba(255, 255, 255, 0.6);
  color: #ffffff;
}

/* ==========================================================================
   6b. NAVIGATION SEARCH — injected into .inside-navigation via hook
       GP's own CSS keeps .navigation-search visible on mobile even when
       the hamburger menu is closed.
   ========================================================================== */

.navigation-search {
  display: flex;
  align-items: center;
  margin-left: var(--space-2);
}

.navigation-search .search-form {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  flex-wrap: nowrap; /* never let button drop to a new line */
}

/* GP's nav search input rule uses [type="search"] (specificity 0,2,1).
   Adding input.search-field (also 0,2,1) lets our later-loaded CSS win. */
.navigation-search .search-field,
.navigation-search input.search-field {
  padding: 0 var(--space-3);
  height: 36px;
  width: 160px;
  min-width: 0;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transition: border-color var(--transition), width var(--transition), background var(--transition);
}

.navigation-search .search-field::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.navigation-search .search-field:focus,
.navigation-search input.search-field:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.15);
  width: 220px;
}

.navigation-search .search-submit {
  height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--transition);
}

.navigation-search .search-submit:hover {
  background: var(--color-accent-hover);
}

/* The WP HTML5 search form wraps button label in .screen-reader-text.
   Make it visible so the button has content. */
.navigation-search .search-submit .screen-reader-text {
  position: static;
  clip: auto;
  clip-path: none;
  height: auto;
  width: auto;
  overflow: visible;
  word-wrap: normal;
}

/* ==========================================================================
   7. SITE CONTENT AREA — padding and spacing
   ========================================================================== */

/* GP's outer wrapper for the page body */
.site-content {
  padding-top: var(--space-12);
  padding-bottom: var(--space-16);
}

/* ==========================================================================
   8. RIGHT RAIL SIDEBAR
   ========================================================================== */

/* GP renders the sidebar as .widget-area.sidebar.is-right-sidebar */
.widget-area.is-right-sidebar {
  min-width: 0;
}

/* Sticky rail — stays in view while scrolling long articles */
.widget-area .inside-right-sidebar {
  position: sticky;
  top: calc(64px + var(--space-6));
}

/* Individual widget */
.widget {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
}

.widget:last-child {
  margin-bottom: 0;
}

.widget-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-heading);
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-primary);
}

/* Widget list items */
.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget ul li {
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.widget ul li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

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

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

/* ==========================================================================
   9. ARCHIVE — CARD GRID
   ========================================================================== */

/* 2-column grid for all archive/category/tag/search pages */
.archive .site-main,
.search .site-main,
.home .site-main {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
  align-items: start;
}

/* Each post card */
.archive .post,
.search .post,
.home .post {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.archive .post:hover,
.search .post:hover,
.home .post:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Featured image at card top */
.archive .post-thumbnail,
.search .post-thumbnail,
.home .post-thumbnail {
  margin: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

/* index.php nests an <a> between .post-thumbnail and the <img>. Left inline,
   it gives the image's height:100% nothing to resolve against and the 16:9
   crop silently does nothing. */
.archive .post-thumbnail a,
.search .post-thumbnail a,
.home .post-thumbnail a {
  display: block;
  width: 100%;
  height: 100%;
}

.archive .post-thumbnail img,
.search .post-thumbnail img,
.home .post-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.archive .post:hover .post-thumbnail img,
.search .post:hover .post-thumbnail img,
.home .post:hover .post-thumbnail img {
  transform: scale(1.03);
}

/* Card body — wraps header, content, footer */
.archive .inside-article,
.search .inside-article,
.home .inside-article {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Category tag above title (if GP outputs it) */
.archive .entry-header .cat-links,
.home .entry-header .cat-links {
  display: block;
  margin-bottom: var(--space-2);
}

.archive .cat-links a,
.home .cat-links a {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Card title */
.archive .entry-title,
.search .entry-title,
.home .entry-title {
  font-size: var(--text-xl);
  margin: 0 0 var(--space-3);
  line-height: 1.3;
}

.archive .entry-title a,
.search .entry-title a,
.home .entry-title a {
  color: var(--color-heading);
  text-decoration: none;
}

.archive .entry-title a:hover,
.search .entry-title a:hover,
.home .entry-title a:hover {
  color: var(--color-primary);
}

/* Card meta (date, author) */
.archive .entry-meta,
.search .entry-meta,
.home .entry-meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.archive .entry-meta a,
.search .entry-meta a,
.home .entry-meta a {
  color: var(--color-text-muted);
  text-decoration: none;
}

/* Card excerpt */
.archive .entry-summary,
.search .entry-summary,
.home .entry-summary {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--lh-loose);
  flex: 1;
  margin-bottom: var(--space-4);
}

.archive .entry-summary p,
.search .entry-summary p,
.home .entry-summary p {
  margin-bottom: 0;
}

/* Read more link at card bottom */
.archive .more-link,
.search .more-link,
.home .more-link {
  display: inline-block;
  margin-top: auto;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.archive .more-link:hover,
.search .more-link:hover,
.home .more-link:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* Pagination — sits below the grid, spans full width */
.archive .pagination,
.author .pagination,
.search .pagination {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding-top: var(--space-4);
}

.archive .page-numbers,
.search .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  transition: border-color var(--transition), color var(--transition), background-color var(--transition);
}

.archive .page-numbers:hover,
.search .page-numbers:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.archive .page-numbers.current,
.search .page-numbers.current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ==========================================================================
   10. SINGLE POST / ARTICLE
   ========================================================================== */

.single .site-main {
  min-width: 0; /* prevent flex blowout */
}

/* GP outputs the featured image BEFORE the entry-header in the DOM.
   Use flex column + order to flip the visual order:
   title/date/byline first, then image, then content. */
.single .inside-article {
  display: flex;
  flex-direction: column;
}

.single .entry-header         { order: 1; }
.single .featured-image,
.single .post-thumbnail       { order: 2; }
.single .entry-content        { order: 3; }
.single footer.entry-meta,
.single .entry-footer         { order: 4; }
.single .post-navigation      { order: 5; }

/* Article header */
.single .entry-header {
  margin-bottom: var(--space-6);
}

.single .entry-title {
  font-size: var(--text-3xl);
  line-height: 1.15;
  margin-bottom: var(--space-4);
}

/* Post meta row */
.single .entry-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.single .entry-meta a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.single .entry-meta a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* Featured image on single.
   GP renders it as .featured-image.grid-container — override the grid-container
   max-width so it fills the article column, not the 1200px site max. */
.single .featured-image,
.single .post-thumbnail {
  max-width: none;
  width: 100%;
  margin-bottom: var(--space-8);
  border-radius: var(--radius);
  overflow: hidden;
}

.single .featured-image img,
.single .post-thumbnail img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Post body content */
.single .entry-content {
  font-size: var(--text-base);
  line-height: var(--lh-body);
}

.single .entry-content > * + * {
  /* Consistent vertical rhythm between block-level elements */
}

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

/* Post footer (categories, tags) */
.single .entry-footer {
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.single .entry-footer a {
  color: var(--color-text-muted);
}

.single .entry-footer a:hover {
  color: var(--color-primary);
}

/* Post navigation (prev/next) */
.post-navigation {
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.nav-previous,
.nav-next {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-next {
  text-align: right;
}

.post-navigation .nav-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.post-navigation a {
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.post-navigation a:hover {
  text-decoration: underline;
}

/* Comments permanently off — template replaced with empty file in functions.php */
.comments-area,
#respond {
  display: none !important;
}

/* ==========================================================================
   11. SEARCH PAGE
   ========================================================================== */

.search-form {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.search-form label {
  flex: 1;
}

.search-field {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-body);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition);
}

.search-field:focus {
  outline: none;
  border-color: var(--color-primary);
}

.search-submit {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-family: var(--font-body);
  font-weight: 600;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition);
}

.search-submit:hover {
  background: var(--color-primary-hover);
}

/* Search results header */
.search .page-header {
  margin-bottom: var(--space-8);
  grid-column: 1 / -1;
}

.search .page-title {
  font-size: var(--text-2xl);
}

/* "No results" state */
.no-results .search-form {
  max-width: 520px;
}

/* ==========================================================================
   12. STATIC PAGES
   ========================================================================== */

.page .entry-content {
  font-size: var(--text-base);
  line-height: var(--lh-body);
}

/* ==========================================================================
   13. 404 PAGE
   ========================================================================== */

.error-404 {
  text-align: center;
  padding: var(--space-20) var(--space-8);
}

.error-404 .page-title {
  font-size: var(--text-4xl);
  color: var(--color-primary);
}

.error-404 .page-content p {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.error-404 .search-form {
  justify-content: center;
  max-width: 480px;
  margin: var(--space-8) auto 0;
}

/* ==========================================================================
   14. SITE FOOTER
   ========================================================================== */

/* GP inline CSS sets .site-info and .footer-widgets to #fff — clear them
   so .site-footer's dark background shows through the whole footer. */
.site-info,
.footer-widgets {
  background: transparent;
}

/* Suppress GP/Astra footer widget areas — production had populated widgets
   from the old Astra setup causing a massive footer height. */
.footer-widgets {
  display: none;
}

.site-footer {
  background-color: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: var(--space-10) 0 var(--space-8);
  margin-top: auto;
}

.site-footer .grid-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--color-footer-link);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-credits {
  font-size: var(--text-sm);
  font-family: var(--font-body);
  color: var(--color-footer-text);
}

/* Footer nav */
.nav-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.nav-footer li {
  margin: 0;
}

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

.nav-footer a:hover {
  color: var(--color-footer-link);
}

/* ==========================================================================
   15. UTILITY — buttons, skip-link, screen-reader
   ========================================================================== */

/* Skip to content */
.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-4);
  z-index: 999;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  left: var(--space-4);
}

/* Screen-reader text (used by WordPress/GP) */
.screen-reader-text {
  position: absolute;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  overflow: hidden;
  word-wrap: normal;
}

/* Generic button style */
.button,
button,
input[type="submit"],
input[type="button"] {
  display: inline-block;
  padding: var(--space-3) var(--space-6);
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition);
}

.button:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

/* ==========================================================================
   16. RESPONSIVE
   ========================================================================== */

/* Tablet — shrink sidebar */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 240px;
    --wide-max:  960px;
  }

  h1, .entry-title { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
}

/* Mobile — single column everything */
@media (max-width: 768px) {
  :root {
    --text-base: 1.0625rem; /* 17px on mobile */
    --gap: 1.25rem;
  }

  /* Compact header row */
  .inside-header {
    min-height: 52px;
    padding: var(--space-2) var(--gap);
    gap: var(--space-3);
    flex-wrap: wrap;
  }

  /* Branding fills the row, hamburger sits at end */
  .site-branding {
    flex: 1;
  }

  /* GP forces #site-navigation to flex-basis:100% on mobile via has-inline-mobile-toggle */
  .inside-navigation {
    padding: var(--space-2) 0;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* Search hidden until hamburger opens — then appears below nav links */
  .navigation-search {
    display: none;
    flex-basis: 100%;
    order: 30;
    margin-left: 0;
    padding-top: var(--space-2);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }

  /* GP adds .toggled to #site-navigation when hamburger is tapped */
  #site-navigation.toggled .navigation-search {
    display: flex;
    align-items: center;
  }

  .navigation-search .search-form {
    width: 100%;
    flex-direction: row;
  }

  .navigation-search .search-field {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  /* Nav links appear above search (order: 30).
     Border is white-tinted because we're on the dark header. */
  .main-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    flex-basis: 100%;
    order: 10;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: var(--space-2);
    margin-top: var(--space-2);
  }

  .main-nav ul li a {
    padding: var(--space-3) var(--space-2);
    font-size: var(--text-base);
    border-radius: var(--radius-sm);
  }

  /* Archive: single column */
  .archive .site-main,
  .search .site-main,
  .home .site-main {
    grid-template-columns: 1fr;
  }

  /* GP gives .separate-containers .inside-article padding:40px and
     .site-main margin:20px — together that's 60px each side on mobile.
     Collapse both to 20px total. */
  .separate-containers .inside-article,
  .separate-containers .comments-area,
  .separate-containers .page-header {
    padding: 20px;
  }

  .separate-containers .site-main {
    margin-left: 0;
    margin-right: 0;
  }

  /* Featured image: edge-to-edge on mobile (break out of the 20px article padding) */
  .single .featured-image,
  .single .post-thumbnail {
    margin-left: -20px;
    margin-right: -20px;
    width: calc(100% + 40px);
    border-radius: 0;
  }

  /* Stack sidebar below content — override GP's generated 30%/70% widths */
  .site-content {
    flex-direction: column;
    padding-top: var(--space-8);
    padding-bottom: var(--space-10);
  }

  .site-content .content-area,
  .widget-area.is-right-sidebar {
    width: 100% !important;
  }

  .widget-area .inside-right-sidebar {
    position: static;
  }

  /* Post navigation: stack */
  .post-navigation {
    grid-template-columns: 1fr;
  }

  .nav-next {
    text-align: left;
  }

  /* Single title */
  .single .entry-title {
    font-size: var(--text-2xl);
  }

  /* Footer */
  .site-footer .grid-container {
    flex-direction: column;
    text-align: center;
  }

  .nav-footer ul {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  :root {
    --gap: 1rem;
  }

  h1, .single .entry-title { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }

  .grid-container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .site-content > .grid-container {
    padding-top: var(--space-8);
    padding-bottom: var(--space-10);
  }
}
