body {
    margin: 0;
    font-family: 'Open Sans', sans-serif;
    background-color: #26619C;
    color: #000;
}

/* GLOBAL FIX: include padding in width calculations */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* HEADER */
header {
    background-color: #26619C;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    flex-wrap: wrap;
}

.portrait {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portrait a {
    display: block;
    width: 100%;
    height: 100%;
}
.portrait a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: white;
    padding: 0 20px;
}

.header-center h1 {
    font-family: 'Merriweather', serif;
    font-size: 5em;
    font-weight: bold;
    margin: 0;
}

.header-center h1 a {
    text-decoration: none;
    color: inherit;
}
.header-center h1 a:hover {
    text-decoration: none;
}

.stars {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 700px;
    margin: 15px auto;
}

.stars span {
    display: inline-block;
    width: 35px;
    height: 35px;
    background-color: white;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%,
                       68% 57%, 79% 91%, 50% 70%,
                       21% 91%, 32% 57%, 2% 35%,
                       39% 35%);
}

nav {
    margin-top: 10px;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    font-weight: bold;
    font-size: 1.2em;
}

nav a:hover {
    text-decoration: underline;
}

nav a.active {
    text-decoration: underline;
}

.cta-button {
    background-color: #D3212D;
    color: white;
    padding: 16px 24px;
    font-weight: bold;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1.2em;
    flex-shrink: 0;
}

.cta-button:hover {
    background-color: #b81b25;
}

.red-divider {
    background-color: #D3212D;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 15px 15px 0 0;
}

.red-divider.top { height: 5px; }
.red-divider.bottom { height: 2px; }

main {
    background-color: white;
    max-width: 1200px;
    margin: auto;
}

.main-inner {
    padding: 30px;
}

.contact-info {
    background-color: #26619C;
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 30px;
    font-size: 1.2em;
}

.contact-info .phone {
    background-color: rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

h2 {
    color: #26619C;
    margin-top: 0;
    font-family: 'Merriweather', serif;
}

section {
    margin-bottom: 40px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

section:nth-child(even) { flex-direction: row-reverse; }

section img {
    flex: 0 0 45%;
    max-width: 45%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

section .text-content {
    flex: 0 0 55%;
    max-width: 55%;
    text-align: left;
}

/* FOOTER */
footer {
    background-color: white;
    max-width: 1200px;
    margin: auto;
    border-radius: 0 0 15px 15px;
    position: relative;
    z-index: 1;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    gap: 20px;
}

.footer-logos img { height: 40px; margin: 0; }

.disclaimer {
    font-size: 0.8em;
    color: #555;
    text-align: left;
}

body::after {
    content: "© Tom Caldwell 2025 - " attr(data-year);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    background-color: #26619C;
    width: 100%;
    color: black;
    font-size: 0.9em;
    text-align: center;
}

@media (max-width: 1000px) {
    header { flex-direction: column; text-align: center; }
    .header-center { padding: 20px 0; }
    .portrait { width: 200px; height: 200px; margin-bottom: 15px; }
    .header-center h1 { font-size: 3em; }
    .stars span { width: 25px; height: 25px; }
    .cta-button { margin-top: 10px; }
    section { flex-direction: column !important; align-items: flex-start; }
    section img, section .text-content { width: 100%; max-width: 100%; }
    section .text-content { text-align: center; }
    .main-inner > section:first-of-type > div:last-child {
        width: 100% !important; text-align: center;
    }
    .footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        padding: 10px 20px;
    }
}

/* Headings & seminar blocks */
.h2-paragraph {
    font-family: 'Merriweather', serif;
    font-weight: bold;
    font-size: 1.5em;
    line-height: 1.2;
    color: #000;
    margin: 0.5rem 0 0;
}
.h3-paragraph {
    font-family: 'Merriweather', serif;
    font-weight: bold;
    font-size: calc(1.5em - 5pt);
    line-height: 1.2;
    color: #000;
    background-color: #FFFF00;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0.25rem 0 0;
    text-align: left;
}
.h3-paragraph.blue {
    background-color: #26619C;
    color: #fff;
    text-align: left;
}
.text-content h3.h3-paragraph {
    background-color: transparent !important;
    padding: 0 !important;
}

/* FHA, VA, USDA logo sizing */
.main-inner img[alt="FHA Program"],
.main-inner img[alt="VA Program"],
.main-inner img[alt="USDA Program"] {
    max-width: 302px !important;
    width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.logo-slot {
    max-width: 302px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
.no-reverse { flex-direction: row !important; }

@media (max-width: 1000px) {
  .main-inner > section.no-reverse {
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: stretch !important;
  }
  .main-inner > section.no-reverse img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    align-self: center !important;
    flex: 0 0 auto !important;
  }
  .main-inner > section.no-reverse .text-content {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    text-align: left;
  }
}

/* === Mobile nav layout: 2 / 1 / About+Contact centered with gap === */
@media (max-width: 1000px) {
  header nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  header nav a {
    display: block;
    margin: 0;
    text-align: center;
    white-space: nowrap;
  }
  /* Row 1 */
  header nav a:nth-child(1),
  header nav a:nth-child(2) { flex: 1 1 45%; }
  /* Row 2 */
  header nav a:nth-child(3) { flex: 1 1 100%; }
  /* Row 3: About & Contact — content width, centered with spacing */
  header nav a:nth-child(4),
  header nav a:nth-child(5) {
    flex: 0 0 auto;
    margin: 0 10px; /* controls spacing between About & Contact */
  }
}

/* Text alignment on mobile */
@media (max-width: 1000px) {
  .main-inner .text-content p,
  .main-inner .text-content ul,
  .main-inner .text-content ol,
  .main-inner .text-content li,
  .main-inner .text-content h3.h3-paragraph {
    text-align: left !important;
  }
  .main-inner .image-column p,
  .main-inner .image-column ul,
  .main-inner .image-column ol,
  .main-inner .image-column li,
  .main-inner .image-column h3.h3-paragraph {
    text-align: left !important;
  }
  .main-inner .text-content h2,
  .main-inner .image-column h2 {
    text-align: inherit !important;
  }
}

/* Contact page phone/email */
@media (max-width: 1000px) {
  .main-inner .text-content p[style*="font-size"] {
    font-size: clamp(1rem, 4.6vw, 1.2rem) !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    max-width: 100% !important;
  }
  .main-inner .text-content p[style*="font-size"] a {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
}

/* About page image */
@media (max-width: 1000px) {
  .main-inner img[src$="tom-caldwell-about.jpg"] {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    align-self: center !important;
  }
}

.tom-caldwell-img {
    max-width: 280px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    flex: 0 0 auto;
}
