/*
Theme Name: Cape Resource Directory
Theme URI: https://example.com/cape-resource-directory
Author: Your Studio
Author URI: https://example.com
Description: A professional resource-directory theme for real estate and home-services associations, built around a custom "Resources" post type with categories, a searchable hero, and a card-grid directory layout. Inspired by the clean, trust-forward layout conventions of REALTOR association sites.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cape-resource-directory
*/

/* ==========================================================================
   DESIGN TOKENS
   Palette:
     --navy        #0E3A5F  primary / header / headings
     --blue        #1C6EA4  links, secondary accents
     --sand        #D9A441  CTA / accent (Cape Cod dune-grass gold)
     --tide        #E4EEF3  pale blue-grey section backgrounds
     --bg          #F6F8FA  page background
     --white       #FFFFFF
     --ink         #1F2937  body text
     --slate       #5B6670  muted text
     --border      #E2E8F0
   Type:
     Display/Headings: "Libre Franklin" (700/800)
     Body: "Source Sans 3" (400/600)
   ========================================================================== */

:root {
  --navy: #1c5686;
  --navy-dark: #092944;
  --blue: #1C6EA4;
  --sand: #D9A441;
  --sand-dark: #BE8A2E;
  --tide: #e4eef3;
  --bg: #F6F8FA;
  --white: #FFFFFF;
  --ink: #1F2937;
  --slate: #5B6670;
  --border: #E2E8F0;

  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(14, 58, 95, 0.08);
  --shadow-md: 0 6px 20px rgba(14, 58, 95, 0.12);
  --container: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

// for normal screens
@media (min-width: 960px) {

}

.single-resource-content img {
    height: auto;
    max-height: 300px;
    width: auto;
}

body {
  margin: 0;
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Libre Franklin", "Segoe UI", sans-serif;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--sand-dark); }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--sand);
  outline-offset: 2px;
}

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

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

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}
.btn-primary { background: var(--sand); color: var(--navy-dark); }
.btn-primary:hover { background: var(--sand-dark); color: var(--white); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--white); color: var(--white); }
.btn-outline:hover { background: var(--white); color: var(--navy); }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-dark); color: var(--white); }

/* ==========================================================================
   SITE HEADER
   ========================================================================== */

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

.header-top {
  background: var(--navy);
  color: var(--tide);
  font-size: 0.85rem;
}
.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  padding-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.header-top a { color: var(--tide); }
.header-top a:hover { color: var(--sand); }
.header-top-links { display: flex; gap: 20px; }

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 24px;
}

.site-branding { display: flex; align-items: center; gap: 12px; }
.site-title {
  font-family: "Libre Franklin", sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--navy);
  margin: 0;
  letter-spacing: -0.01em;
}
.site-title a { color: var(--navy); }
.site-tagline { font-size: 0.75rem; color: var(--slate); margin: 0; }

.primary-nav ul { display: flex; gap: 4px; align-items: center; }
.primary-nav a {
  display: block;
  padding: 10px 14px;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
}
.primary-nav a:hover { background: var(--tide); color: var(--navy); }
.primary-nav .current-menu-item > a { color: var(--blue); }

.header-cta { display: flex; align-items: center; gap: 12px; }

.menu-toggle {
  display: none;
  background: none;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
}
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--navy);
  position: relative;
  transition: all 0.2s ease;
}
.menu-toggle span::before { content: ""; position: absolute; top: -6px; }
.menu-toggle span::after { content: ""; position: absolute; top: 6px; }

/* ==========================================================================
   HERO + SEARCH
   ========================================================================== */

.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: var(--white);
  padding: 72px 0 0;
  position: relative;
  overflow: hidden;
}
.hero .container { position: relative; z-index: 2; text-align: center; }
.hero-eyebrow {
  display: inline-block;
  background: rgba(217, 164, 65, 0.18);
  color: var(--sand);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero h1 { color: var(--white); max-width: 780px; margin-left: auto; margin-right: auto; }
.hero h1 .accent { color: var(--sand); }
.hero-sub {
  max-width: 620px;
  margin: 0 auto 32px;
  color: var(--tide);
  font-size: 1.1rem;
}

.hero-search {
  max-width: 620px;
  margin: 0 auto 56px;
  display: flex;
  background: var(--white);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--shadow-md);
}
.hero-search input[type="search"] {
  flex: 1;
  border: none;
  background: none;
  padding: 14px 20px;
  font-size: 1rem;
  color: var(--ink);
}
.hero-search input[type="search"]:focus { outline: none; }
.hero-search button {
  background: var(--sand);
  color: var(--navy-dark);
  border: none;
  border-radius: 999px;
  padding: 0 26px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}
.hero-search button:hover { background: var(--sand-dark); color: var(--white); }

.hero-quicklinks {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}
.hero-quicklinks a {
  color: var(--tide);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
}
.hero-quicklinks a:hover { background: rgba(255,255,255,0.12); color: var(--white); }

/* signature tideline divider */
.tideline {
  position: relative;
  width: 100%;
  height: 64px;
  margin-top: 56px;
  line-height: 0;
}
.tideline svg { width: 100%; height: 100%; display: block; }

/* ==========================================================================
   SECTIONS
   ========================================================================== */

.section { padding: 64px 0; }
.section-tide { background: var(--tide); }
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.section-header p { color: var(--slate); margin: 4px 0 0; }
.section-header .view-all { font-weight: 700; white-space: nowrap; }

.category-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.category-pill {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  transition: all 0.15s ease;
}
.category-pill:hover, .category-pill.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* ==========================================================================
   RESOURCE CARD GRID
   ========================================================================== */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.resource-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--sand);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.resource-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.resource-card-media {
  aspect-ratio: 16/10;
  background: var(--tide) center/cover no-repeat;
  position: relative;
}
.resource-card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
}

.resource-card-body {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.resource-card-body h3 { margin-bottom: 8px; font-size: 1.15rem; }
.resource-card-body h3 a { color: var(--navy); }
.resource-card-body p {
  color: var(--slate);
  font-size: 0.94rem;
  flex: 1;
}
.resource-card-link {
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}
.resource-card-link::after { content: "\2192"; transition: transform 0.15s ease; }
.resource-card-link:hover::after { transform: translateX(3px); }

/* ==========================================================================
   ARCHIVE / TAXONOMY LAYOUT
   ========================================================================== */

.archive-header {
  background: var(--navy);
  color: var(--white);
  padding: 48px 0;
}
.archive-header h1 { color: var(--white); margin-bottom: 8px; }
.archive-header p { color: var(--tide); max-width: 640px; margin: 0; }
.breadcrumbs { font-size: 0.85rem; color: var(--blue); margin-bottom: 12px; }
.breadcrumbs a { color: var(--blue); text-decoration: underline; }

.archive-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  align-items: start;
}

/* Single resource pages list the main content div first in the markup,
   so this reverses the column split: wide main column first, narrow
   sidebar second (rather than the sidebar-first split used on archive
   and taxonomy listing pages). */
.archive-layout.single-layout {
  grid-template-columns: 1fr 300px;
}

.directory-sidebar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: sticky;
  top: 96px;
}
.directory-sidebar h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  margin-bottom: 14px;
}
.directory-sidebar ul { display: flex; flex-direction: column; gap: 2px; margin-bottom: 24px; }
.directory-sidebar a {
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.94rem;
}
.directory-sidebar a:hover, .directory-sidebar .current a { background: var(--tide); color: var(--navy); font-weight: 700; }
.directory-sidebar a .count { color: var(--slate); font-weight: 400; font-size: 0.85rem; }

.resource-grid.two-col { grid-template-columns: repeat(2, 1fr); }

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}
.pagination a, .pagination span {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--navy);
  font-weight: 600;
  background: var(--white);
}
.pagination .current { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ==========================================================================
   SINGLE RESOURCE
   ========================================================================== */

.single-resource-header { background: var(--white); border-bottom: 1px solid var(--border); padding: 40px 0; }
.single-resource-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.single-resource-meta a {
  background: var(--tide);
  color: var(--navy);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.single-resource-content {
  max-width: 760px;
  background: var(--white);
  padding: 40px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.single-resource-content img { border-radius: var(--radius); margin: 24px 0; }
.single-resource-content h2 { margin-top: 1.4em; }
.contact-card {
  background: var(--tide);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.contact-card h4 { margin-bottom: 10px; }
.contact-card dl { margin: 0; }
.contact-card dt { font-weight: 700; color: var(--navy); font-size: 0.8rem; text-transform: uppercase; margin-top: 10px; }
.contact-card dd { margin: 2px 0 0; color: var(--ink); }

/* ==========================================================================
   CTA BAND
   ========================================================================== */

.cta-band {
  background: var(--sand);
  padding: 48px 0;
  text-align: center;
}
.cta-band h2 { color: var(--navy-dark); margin-bottom: 8px; }
.cta-band p { color: var(--navy-dark); margin-bottom: 24px; }

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer { background: var(--navy-dark); color: var(--tide); padding: 56px 0 24px; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}
.footer-grid h4 { color: var(--white); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 14px; }
.footer-grid ul { display: flex; flex-direction: column; gap: 8px; }
.footer-grid a { color: var(--tide); font-size: 0.92rem; }
.footer-grid a:hover { color: var(--sand); }
.footer-brand p { color: var(--tide); font-size: 0.9rem; max-width: 320px; }
.footer-social { display: flex; gap: 12px; margin-top: 16px; }
.footer-social a {
  width: 36px; height: 36px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: rgba(228,238,243,0.7);
}
.footer-bottom a { color: rgba(228,238,243,0.7); }

/* ==========================================================================
   MISC / WP DEFAULTS
   ========================================================================== */

.no-results { text-align: center; padding: 80px 0; }
.screen-reader-text { position: absolute; left: -9999px; }
.alignwide { max-width: 1000px; margin-left: auto; margin-right: auto; }
.alignfull { max-width: none; }
.wp-caption-text { font-size: 0.85rem; color: var(--slate); text-align: center; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 960px) {
  .archive-layout, .archive-layout.single-layout { grid-template-columns: 1fr; }
  .directory-sidebar { position: static; }
  .resource-grid, .resource-grid.two-col { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .primary-nav { position: fixed; top: 0; right: -100%; height: 100vh; width: 280px; background: var(--white); flex-direction: column; padding: 80px 24px 24px; transition: right 0.25s ease; box-shadow: var(--shadow-md); }
  .primary-nav.is-open { right: 0; }
  .primary-nav ul { flex-direction: column; align-items: flex-start; width: 100%; }
  .menu-toggle { display: block; }
  .header-cta .btn-navy span.long { display: none; }
  .resource-grid, .resource-grid.two-col { grid-template-columns: 1fr; }
  .header-top-links { display: none; }
  .hero { padding-top: 48px; }
  .hero-search { flex-direction: column; border-radius: var(--radius-lg); }
  .hero-search button { margin-top: 6px; border-radius: var(--radius); padding: 12px; }
}
