/*
Theme Name: Castle Corner Brokers
Theme URI: https://example.com
Author: Your Agency
Author URI: https://example.com
Description: A bold, confident WordPress theme built for financial brokerage, advisory, and wealth management firms. Asymmetric hero, alternating service rows, and a single orchestrated stat count-up rather than scattered card animations.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: castle-brokers
*/

/* ==========================================================================
   1. Design tokens
   ========================================================================== */

:root {
  --ink: #0b1f3a;          /* deep navy - primary dark surface */
  --ink-soft: #14294a;     /* slightly lighter navy for gradients/panels */
  --cobalt: #1e4fff;       /* primary action / link color */
  --cobalt-dark: #143bd1;
  --amber: #ffaa00;        /* stat highlights, secondary accent */
  --paper: #f4f5f7;        /* light section background */
  --white: #ffffff;
  --charcoal: #1a1d23;     /* body text */
  --muted: #5b6472;        /* secondary text */
  --line: #e1e4ea;         /* hairline borders */

  --font-display: 'Space Grotesk', 'Arial Narrow', sans-serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --container: 1180px;
  --radius: 4px;
}

/* ==========================================================================
   2. Reset & base
   ========================================================================== */

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

html { scroll-behavior: smooth; }
@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;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--charcoal);
  background: var(--white);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.12;
  margin: 0 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); }

p { max-width: 62ch; margin: 0 0 1.2em; color: var(--muted); }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* ==========================================================================
   3. Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.9em 1.7em;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--amber);
  color: var(--ink);
}
.btn-primary:hover { background: #ffb733; color: var(--ink); }

.btn-outline {
  background: transparent;
  border-color: currentColor;
  color: var(--white);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); color: var(--white); }

.btn-outline.on-light {
  color: var(--ink);
}
.btn-outline.on-light:hover { background: rgba(11,31,58,0.06); }

/* ==========================================================================
   4. Site header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.2s ease;
}
.site-header.is-scrolled { box-shadow: 0 4px 18px rgba(11,31,58,0.08); }

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  max-width: var(--container);
  margin: 0 auto;
}

.site-branding a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-branding img { max-height: 42px; width: auto; }
.site-branding .brand-mark {
  width: 34px; height: 34px;
  background: var(--ink);
  color: var(--amber);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.main-navigation ul {
  list-style: none;
  display: flex;
  gap: 30px;
  margin: 0;
  padding: 0;
}
.main-navigation a {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a {
  border-bottom-color: var(--amber);
  color: var(--ink);
}

.header-cta { display: flex; align-items: center; gap: 20px; }
.header-cta .btn { padding: 0.7em 1.4em; font-size: 0.92rem; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 40px; height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}
.menu-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .menu-toggle { display: flex; }
  .main-navigation {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .main-navigation.is-open { max-height: 400px; }
  .main-navigation ul { flex-direction: column; gap: 0; padding: 10px 28px 20px; }
  .main-navigation li { border-top: 1px solid var(--line); }
  .main-navigation a { display: block; padding: 14px 0; }
  .header-cta .btn-label { display: none; }
}

/* ==========================================================================
   5. Hero
   ========================================================================== */

.hero {
  background: var(--ink);
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.hero__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 90px 28px 100px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 60px;
  align-items: center;
  position: relative;
  z-index: 2;
}
.hero__eyebrow {
  color: var(--amber);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.hero h1 { color: var(--white); margin-bottom: 0.4em; }
.hero p.lede {
  color: rgba(255,255,255,0.72);
  font-size: 1.15rem;
  max-width: 46ch;
}
.hero__actions { display: flex; gap: 16px; margin-top: 32px; flex-wrap: wrap; }

.hero__panel {
  background: linear-gradient(155deg, var(--ink-soft) 0%, #0e2545 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 36px 32px;
  position: relative;
}
.hero__panel::before {
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 90px; height: 90px;
  background: var(--amber);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  border-radius: 0 10px 0 0;
}
.hero__panel-label {
  color: rgba(255,255,255,0.55);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.hero__panel-figure {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 22px;
}
.hero__panel-list { list-style: none; margin: 0; padding: 0; }
.hero__panel-list li {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.95rem;
  color: rgba(255,255,255,0.85);
}
.hero__panel-list li span:last-child { color: var(--amber); font-weight: 700; }

@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; padding-top: 60px; }
}

/* ==========================================================================
   6. Stats bar
   ========================================================================== */

.stats {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.stats__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 50px 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.stat__figure {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  font-weight: 700;
  color: var(--ink);
}
.stat__label { color: var(--muted); font-size: 0.92rem; margin-top: 4px; }

@media (max-width: 760px) {
  .stats__inner { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   7. Services - alternating rows
   ========================================================================== */

.services { padding: 100px 0; }
.services__head { max-width: 640px; margin-bottom: 60px; }
.services__head p { max-width: 56ch; }

.service-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 56px 0;
  border-top: 1px solid var(--line);
}
.service-row:last-child { border-bottom: 1px solid var(--line); }
.service-row:nth-child(even) .service-row__media { order: 2; }

.service-row__index {
  font-family: var(--font-display);
  color: var(--line);
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 14px;
}
.service-row h3 { margin-bottom: 0.5em; }
.service-row__media {
  background: var(--ink);
  border-radius: 10px;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.service-row__media span {
  font-family: var(--font-display);
  color: var(--amber);
  font-size: 1rem;
  font-weight: 700;
  z-index: 2;
}
.service-row__media::after {
  content: "";
  position: absolute;
  width: 220%; height: 220%;
  background: radial-gradient(circle at 30% 30%, rgba(30,79,255,0.35), transparent 60%);
}

@media (max-width: 820px) {
  .service-row { grid-template-columns: 1fr; gap: 24px; }
  .service-row:nth-child(even) .service-row__media { order: 0; }
  .service-row__media { min-height: 180px; }
}

/* ==========================================================================
   8. Why us - diagonal section
   ========================================================================== */

.why-us {
  background: var(--ink);
  color: var(--white);
  position: relative;
  clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
  margin: 40px 0;
  padding: 110px 0;
}
.why-us__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 60px;
}
.why-us h2 { color: var(--white); }
.why-us p.lede { color: rgba(255,255,255,0.7); }

.why-us__list { list-style: none; margin: 0; padding: 0; }
.why-us__list li {
  display: flex;
  gap: 18px;
  padding: 22px 0;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.why-us__list li:last-child { border-bottom: 1px solid rgba(255,255,255,0.12); }
.why-us__list .num {
  font-family: var(--font-display);
  color: var(--amber);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.why-us__list h4 { color: var(--white); margin-bottom: 4px; font-size: 1.05rem; }
.why-us__list p { color: rgba(255,255,255,0.65); margin: 0; font-size: 0.95rem; }

@media (max-width: 820px) {
  .why-us__inner { grid-template-columns: 1fr; }
}

/* ==========================================================================
   9. Testimonials
   ========================================================================== */

.testimonials { padding: 100px 0; }
.testimonials__head { max-width: 600px; margin-bottom: 50px; }
.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}
.testimonial {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px;
}
.testimonial blockquote {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
  line-height: 1.4;
}
.testimonial cite {
  font-style: normal;
  display: block;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
}
.testimonial .role { color: var(--muted); font-size: 0.88rem; }

@media (max-width: 900px) {
  .testimonial-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   10. CTA banner
   ========================================================================== */

.cta-banner {
  background: linear-gradient(120deg, var(--cobalt) 0%, var(--cobalt-dark) 100%);
  color: var(--white);
  padding: 80px 0;
}
.cta-banner__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.cta-banner h2 { color: var(--white); margin-bottom: 0.3em; }
.cta-banner p { color: rgba(255,255,255,0.85); margin: 0; }

/* ==========================================================================
   11. Footer
   ========================================================================== */

.site-footer { background: var(--ink); color: rgba(255,255,255,0.75); }
.footer-columns {
  max-width: var(--container);
  margin: 0 auto;
  padding: 80px 28px 50px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-columns h4 {
  color: var(--white);
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.footer-columns ul { list-style: none; margin: 0; padding: 0; }
.footer-columns li { margin-bottom: 10px; }
.footer-columns a { color: rgba(255,255,255,0.65); font-size: 0.94rem; }
.footer-columns a:hover { color: var(--amber); }
.footer-brand .brand-mark { margin-bottom: 16px; }
.footer-brand p { color: rgba(255,255,255,0.55); font-size: 0.9rem; }

.footer-legal {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding: 26px 28px;
}
.footer-legal__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
}
.footer-disclaimer {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px 30px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .footer-columns { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .footer-columns { grid-template-columns: 1fr; }
}

/* ==========================================================================
   12. Generic page / single post content
   ========================================================================== */

.page-hero {
  background: var(--ink);
  color: var(--white);
  padding: 70px 0 60px;
}
.page-hero h1 { color: var(--white); margin: 0; }
.page-hero .breadcrumb { color: rgba(255,255,255,0.5); font-size: 0.9rem; margin-bottom: 10px; }

.entry-content {
  max-width: 760px;
  margin: 60px auto;
  padding: 0 28px;
}
.entry-content h2 { margin-top: 1.4em; }
.entry-content img { border-radius: 8px; margin: 1.5em 0; }
.entry-content blockquote {
  border-left: 3px solid var(--amber);
  padding-left: 20px;
  margin: 2em 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.post-list { max-width: 760px; margin: 60px auto; padding: 0 28px; }
.post-card { padding: 34px 0; border-top: 1px solid var(--line); }
.post-card:last-child { border-bottom: 1px solid var(--line); }
.post-card__date { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
.post-card h2 { margin-bottom: 0.3em; font-size: 1.6rem; }
.post-card h2 a { color: var(--ink); }
.post-card h2 a:hover { color: var(--cobalt); }

.pagination { display: flex; gap: 12px; padding: 0 28px 60px; max-width: 760px; margin: 0 auto; }
.pagination a, .pagination span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.9rem;
  color: var(--ink);
}

.not-found { text-align: center; padding: 120px 28px; }
.not-found .code {
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 700;
  color: var(--line);
  line-height: 1;
}

.stat-counted { transition: none; }
