/* ==========================================================================
   The Mortgage Project: shared stylesheet
   Brand palette pulled from the current themortgageproject.ca (Wix) site:
   cream section background, navy text, warm gold script accent.
   Fonts: Montserrat (self-hosted variable font) + Moon Time (script accent).
   ========================================================================== */

@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/Montserrat-VariableFont_wght.ttf') format('truetype-variations'),
       url('../fonts/Montserrat-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/Montserrat-Italic-VariableFont_wght.ttf') format('truetype-variations'),
       url('../fonts/Montserrat-Italic-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Moon Time';
  src: url('../fonts/MoonTime-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #e9e8e5;
  --cream-soft: #f4f3f1;
  --white: #ffffff;
  --navy: #304254;
  --navy-soft: #4a5b6c;
  --gold: #c8a876;
  --gold-soft: #e4d3ae;
  --gold-deep: #9c7a45;
  --sage: #88b0a0;
  --sage-deep: #5f7d6e;
  --border: #d8d6d1;
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Safety net: no image or video should ever be able to force the page
   wider than its container, on any screen size. */
img, video { max-width: 100%; height: auto; }

body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--navy);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--navy);
}

h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

a { color: inherit; text-decoration: none; }

.accent {
  font-family: 'Moon Time', cursive;
  color: var(--gold);
  font-size: 1.3em;
  font-weight: 400;
  line-height: 1.15;
  display: inline-block;
}

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

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

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.logo {
  font-family: 'Montserrat', serif;
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.5px;
  color: var(--navy);
}

.logo span { color: var(--gold); }

.logo-img {
  height: 64px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--navy);
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
}

.nav-cta-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-cta {
  border: 1px solid var(--navy);
  padding: 10px 22px;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-cta:hover { background: var(--navy); color: var(--white); }

.nav-cta-primary {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--white);
}

.nav-cta-primary:hover { background: transparent; color: var(--gold); }

/* "Apply Now" surfaced inside the mobile menu too, since the desktop
   nav-cta-group is hidden below the 860px breakpoint. Hidden here in the
   desktop nav-links list (it already has its own header buttons); shown
   again inside the mobile menu, see the max-width:860px block below. */
.nav-links-apply {
  display: none;
  color: var(--gold);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--navy);
}

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-wrap { padding: 14px 20px; }
  .logo-img { height: 46px; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    flex-direction: column;
    gap: 0;
    display: none;
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links li { border-top: 1px solid var(--border); }
  .nav-links a { display: block; padding: 16px 24px; }
  .nav-links-apply { display: block; }
  .nav-cta-group { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 100px 24px 70px;
  text-align: right;
}

.hero .container { text-align: right; }

.hero h1 { margin-bottom: 0.3em; }

.hero .btn { margin-top: 24px; }

.hero-sub {
  color: var(--navy-soft);
  font-size: 1.05rem;
  max-width: 480px;
  margin-left: auto;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--navy);
  padding: 14px 32px;
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn:hover { background: var(--navy); color: var(--white); }

.btn-gold {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--white);
}

.btn-gold:hover { background: transparent; color: var(--gold); }

/* ---------- Sections ---------- */
section { padding: 80px 0; }

.section-alt { background: var(--cream-soft); }

.section-label {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 12px;
  display: block;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; gap: 32px; }
  .hero, .hero .container { text-align: left; }
  .hero-sub { margin-left: 0; }
  .hero { padding: 56px 24px 48px; }
}

.img-placeholder {
  background: linear-gradient(135deg, var(--cream) 0%, var(--border) 100%);
  border-radius: 4px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-soft);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-align: center;
  padding: 20px;
}

/* Real photo dropped into an img-placeholder box */
.img-placeholder.has-photo {
  padding: 0;
  overflow: hidden;
  background: none;
}
.img-placeholder.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

/* Inside a photo-card, the placeholder has no rounded corners of its own
   (the card itself clips), and its height comes from the flex layout,
   not a fixed min-height. */
.photo-card .img-placeholder.has-photo img {
  border-radius: 0;
}

/* Real logo dropped into an img-placeholder box */
.img-placeholder.has-logo {
  background: var(--white);
  padding: 40px;
}
.img-placeholder.has-logo img {
  max-width: 60%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}

/* ---------- Cards ---------- */
.card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
}

.card-grid .card {
  flex: 1 1 300px;
  max-width: 360px;
}

/* Fixed 4-per-row grid so every full row has the same number of boxes.
   align-items stays at its default (stretch), and every card shares the
   same min-height below, so every box in the grid is the same size --
   not just within a row, but across the whole grid. */
.services-grid.card-grid .card {
  flex: 0 0 calc(25% - 24px);
  max-width: calc(25% - 24px);
  min-height: 320px;
}

@media (max-width: 900px) {
  .services-grid.card-grid .card {
    flex: 0 0 calc(50% - 16px);
    max-width: calc(50% - 16px);
  }
}

@media (max-width: 600px) {
  .services-grid.card-grid .card {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid transparent;
  padding: 32px;
  border-radius: 4px;
  text-align: left;
}

.card h3 { margin-bottom: 10px; }

.card ul { padding-left: 18px; margin: 0; }
.card li { margin-bottom: 6px; }

/* Text links inside card copy (e.g. the government resources list) need to
   read clearly as links against the card's body text. */
.card a { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 2px; }
.card a:hover { color: var(--gold); }

/* ---------- FAQ accordion inside service cards ---------- */
.faq-toggle {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.faq-toggle summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold-deep);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  list-style: none;
}

.faq-toggle summary::-webkit-details-marker { display: none; }
.faq-toggle summary::after { content: "  \25BE"; }
.faq-toggle[open] summary::after { content: "  \25B4"; }

.faq-toggle summary:hover { color: var(--gold); }

.faq-list {
  margin: 12px 0 0;
  padding: 0;
}

.faq-list dt {
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 14px;
  color: var(--navy);
}

.faq-list dt:first-child { margin-top: 0; }

.faq-list dd {
  margin: 4px 0 0;
  font-size: 0.83rem;
  color: var(--navy-soft);
  line-height: 1.55;
}

/* Category colour-coding for the services grid */
.cat-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
  margin-bottom: 12px;
}

/* Category colours are the two real accent hues from the logo itself --
   the gold house line (var(--gold)) and the sage-teal tree -- each used
   at two depths so four categories stay recognizably on-brand instead
   of introducing unrelated colours. */
.cat-buying { border-top-color: var(--gold); }
.cat-buying-label { background: var(--gold-soft); color: #7a5f2e; }

.cat-refi { border-top-color: var(--sage); }
.cat-refi-label { background: #dcebe5; color: #3f6b58; }

.cat-specialty { border-top-color: var(--gold-deep); }
.cat-specialty-label { background: #e8dcc8; color: #6b5225; }

.cat-transitions { border-top-color: var(--sage-deep); }
.cat-transitions-label { background: #dbe4e0; color: #37493f; }

/* Image-only card used to break up a grid of text cards. It's still a
   flex column internally, but the whole card shares the same min-height
   as its text-card siblings above, and the photo fills whatever space
   is left after the caption -- so every photo square ends up the same
   size as every other card in the grid. */
.photo-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.photo-card .img-placeholder {
  flex: 1;
  min-height: 160px;
  border-radius: 0;
  margin: 0;
}

.photo-card p {
  margin: 0;
  padding: 16px 20px;
  font-family: 'Moon Time', cursive;
  color: var(--gold);
  font-size: 1.7em;
  text-align: center;
}

/* ---------- Featured programs (centered) ---------- */
.featured-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 32px;
  max-width: var(--max-width);
  margin: 36px auto 0;
}

.featured-grid .card {
  flex: 1 1 300px;
  max-width: 360px;
  border-color: var(--gold);
  text-align: left;
  display: flex;
  flex-direction: column;
}

/* ---------- Lender partner carousel ---------- */
.lender-carousel {
  overflow: hidden;
  width: 100%;
  margin-top: 32px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 64px, #000 calc(100% - 64px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 64px, #000 calc(100% - 64px), transparent 100%);
}

.lender-track {
  display: flex;
  width: max-content;
  gap: 16px;
  animation: lender-scroll 45s linear infinite;
}

.lender-carousel:hover .lender-track {
  animation-play-state: paused;
}

.lender-pill {
  flex: 0 0 auto;
  white-space: nowrap;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-soft);
}

@keyframes lender-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .lender-track { animation: none; }
  .lender-carousel { overflow-x: auto; }
}

/* ---------- Team ---------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

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

.team-card { text-align: center; }

.team-photo {
  width: 100%;
  aspect-ratio: 3/4;
  margin-bottom: 18px;
}

.team-card h3 { margin-bottom: 2px; }

.team-title {
  color: var(--gold);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: block;
}

/* ---------- Testimonials ---------- */
.testimonial {
  border-left: 3px solid var(--gold);
  padding-left: 24px;
  margin-bottom: 40px;
}

.testimonial p { font-size: 1.1rem; font-style: italic; }

.testimonial cite {
  font-style: normal;
  color: var(--gold);
  font-weight: 600;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: var(--cream);
  padding: 60px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

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

.site-footer h4 {
  color: var(--white);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.site-footer p, .site-footer a { color: var(--cream); opacity: 0.85; font-size: 0.92rem; }
.site-footer a:hover { opacity: 1; color: var(--gold); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 10px; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 24px;
  font-size: 0.8rem;
  opacity: 0.7;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Contact form ---------- */
.form-row { margin-bottom: 18px; }

.form-status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 0.9rem;
}
.form-status-success {
  background: rgba(136, 176, 160, 0.15);
  border: 1px solid var(--sage);
  color: var(--sage-deep);
}
.form-status-error {
  background: rgba(176, 80, 60, 0.1);
  border: 1px solid #b0503c;
  color: #8a3d2c;
}

label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--navy-soft);
}

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--white);
  color: var(--navy);
}

textarea { min-height: 130px; resize: vertical; }

.contact-info-item {
  margin-bottom: 24px;
}

.contact-info-item h4 {
  margin-bottom: 4px;
  font-family: 'Montserrat', serif;
  font-weight: 600;
  font-size: 1.05rem;
}

.contact-info-item span {
  color: var(--gold);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---------- Page header (non-home pages) ---------- */
.page-hero {
  padding: 70px 0 50px;
  background: var(--cream);
  text-align: center;
}

/* ---------- Long-form blog post body ---------- */
.post-body h2 {
  margin-top: 2.2em;
  margin-bottom: 0.5em;
  font-size: 1.5rem;
}
.post-body h2:first-of-type { margin-top: 0.4em; }

.post-body h3 {
  margin-top: 1.6em;
  margin-bottom: 0.4em;
  font-size: 1.1rem;
}

.post-body ul, .post-body ol {
  padding-left: 22px;
  margin: 0 0 1.2em;
}
.post-body li { margin-bottom: 8px; }

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 0.92rem;
}
.post-body th, .post-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.post-body th {
  background: var(--cream-soft);
  font-weight: 600;
  color: var(--navy);
}
.post-body td:last-child, .post-body th:last-child { text-align: right; }

@media (max-width: 600px) {
  .post-body table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Callout box for asides, disclaimers, and "worth knowing" notes inside a
   long-form post -- visually distinct from the surrounding paragraphs
   without competing with the accent script headings. */
.post-body .note-box {
  background: var(--cream-soft);
  border-left: 3px solid var(--gold);
  padding: 16px 20px;
  margin: 1.6em 0;
  font-size: 0.95rem;
  color: var(--navy-soft);
}
.post-body .note-box p { margin: 0; }
.post-body .note-box p + p { margin-top: 0.6em; }

/* ---------- Mobile tightening ----------
   The breakpoints above (860/900/700px) already handle layout structure
   (nav, grids, columns). This block tightens vertical spacing and sizing
   that otherwise just makes the site feel like a shrunk-down desktop
   page on a phone, rather than something designed for it. */
@media (max-width: 600px) {
  section { padding: 48px 0; }
  .page-hero { padding: 48px 0 36px; }
  .card { padding: 24px; }
  .featured-grid .card { padding: 24px; }
  .img-placeholder { min-height: 220px; }
  .container { padding: 0 20px; }
}

.page-hero p { max-width: 620px; margin: 0 auto; color: var(--navy-soft); }

/* ---------- Realtor calculator tools ---------- */
.calc-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 32px;
}

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

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

.calc-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 500px) {
  .calc-field-row { grid-template-columns: 1fr; }
}

.calc-toggle-group {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.calc-toggle-group button {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--navy-soft);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}

.calc-toggle-group button.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--navy);
  font-weight: 600;
}

.calc-result {
  background: var(--cream-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
}

.calc-result-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-deep);
  font-weight: 600;
  display: block;
}

.calc-result-figure {
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--navy);
  margin: 4px 0 18px;
}

.calc-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.calc-badge-yes { background: #dcebe5; color: #3f6b58; }
.calc-badge-no { background: rgba(176, 80, 60, 0.12); color: #8a3d2c; }

.calc-steps {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--navy-soft);
}

.calc-steps dt { font-weight: 600; color: var(--navy); margin-top: 10px; }
.calc-steps dt:first-child { margin-top: 0; }
.calc-steps dd { margin: 2px 0 0; }

.calc-result[hidden] { display: none; }
