:root {
    /* CNX Color Palette - CNX Deep Navy */
    --color-navy: #0c2b5c;
    --color-light-paper: #f7f8fb;
    --color-harbor-gray: #59647a;
    --color-lavender: #76235f;
    --color-ink: #1a1a1a;
    --color-white: #ffffff;
    --color-border: #e0e0e0;
    --mesh-color-rgba: rgba(118, 35, 95, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Trirong', Georgia, serif;
    color: var(--color-ink);
    line-height: 1.7;
    background: var(--color-light-paper);
    font-size: 1.05rem;
    font-weight: 400;
}

/* Thai Language - Larger Font Sizes */
html[lang="th"] body {
    font-size: 1.3rem;
}

html[lang="th"] p {
    font-size: 1.3rem;
}

html[lang="th"] h1 {
    font-size: 3.75rem;
}

html[lang="th"] h2 {
    font-size: 2.5rem;
}

html[lang="th"] h3 {
    font-size: 1.9rem;
}

html[lang="th"] .subtitle {
    font-size: 1.25rem;
    font-style: normal;
}

html[lang="th"] nav a {
    font-size: 1.15rem;
}

html[lang="th"] nav .wordmark {
    font-size: 2.4rem;
}

html[lang="th"] .hero .subheadline {
    font-size: 1.5rem;
}

/* Typography Hierarchy */
h1 {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-navy);
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-navy);
    margin: 3rem 0 1rem;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-navy);
    margin: 2rem 0 1rem;
}

.subtitle {
    font-size: 1rem;
    font-weight: 400;
    font-style: italic;
    color: var(--color-harbor-gray);
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

p {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: var(--color-ink);
    max-width: 70ch;
}

.wordmark {
    font-family: 'Trirong', Georgia, serif;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--color-navy);
}

/* Palette Selector */
.palette-selector {
    position: fixed;
    top: 4px;
    right: 4px;
    z-index: 1000;
}

.palette-selector select {
    font-family: 'Trirong', Georgia, serif;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border: 1px dotted var(--color-border);
    background: var(--color-white);
    color: var(--color-ink);
    border-radius: 2px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.palette-selector select:hover {
    border-color: var(--color-lavender);
}

.palette-selector select:focus {
    outline: none;
    border-color: var(--color-lavender);
}

/* Navigation */
nav {
    position: sticky;
    top: 0;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem 0;
    z-index: 100;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

nav .wordmark {
    font-size: 2rem;
    color: var(--color-navy);
    text-decoration: none;
    border: none;
    padding: 0;
}

nav .wordmark:hover {
    color: var(--color-navy);
    border: none;
}

nav .nav-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--color-ink);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    transition: color 0.2s, border-top 0.2s;
    border-top: 3px solid transparent;
}

nav a:hover,
nav a:focus {
    color: var(--color-lavender);
    border-top: 3px solid var(--color-lavender);
}

/* Language Switcher */
.language-switcher {
    position: relative;
    display: inline-block;
}

.language-switcher-trigger {
    color: var(--color-ink);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    transition: color 0.2s, border-top 0.2s;
    border-top: 3px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.language-switcher-trigger i {
    font-size: 0.9em;
    opacity: 1;
    color: inherit;
    font-weight: 900 !important;
    font-family: "Font Awesome 7 Free" !important;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

.language-switcher-trigger i::before {
    display: inline-block !important;
    font-family: "Font Awesome 7 Free" !important;
    font-weight: 900 !important;
    color: inherit;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

.language-switcher-trigger:hover,
.language-switcher-trigger:focus {
    color: var(--color-lavender);
    border-top: 3px solid var(--color-lavender);
}

.language-switcher-trigger:hover i,
.language-switcher-trigger:focus i {
    opacity: 1;
    color: inherit;
}

.language-switcher-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--color-lavender);
    width: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 1000;
    margin-top: 3px;
}

.language-switcher-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-switcher-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    color: var(--color-ink);
    text-decoration: none;
    border-top: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.language-switcher-dropdown a i {
    font-size: 0.9em;
    opacity: 1;
    color: inherit;
    width: 1em;
    text-align: center;
    font-weight: 900 !important;
    font-family: "Font Awesome 7 Free" !important;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

.language-switcher-dropdown a i::before {
    display: inline-block !important;
    font-family: "Font Awesome 7 Free" !important;
    font-weight: 900 !important;
    color: inherit;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

.language-switcher-dropdown a:hover,
.language-switcher-dropdown a:focus {
    background: var(--color-light-paper);
    color: var(--color-lavender);
    border-top: none;
}

.language-switcher-dropdown a:hover i,
.language-switcher-dropdown a:focus i {
    opacity: 1;
    color: inherit;
}

.language-switcher-dropdown a.active {
    color: var(--color-lavender);
    font-weight: 600;
    background: var(--color-light-paper);
    cursor: default;
}

.language-switcher-dropdown a.active i {
    opacity: 1;
    color: inherit;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section */
section.hero {
    padding: 4rem 0 0 0;
    background: var(--color-navy) !important;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-text {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero h1 {
    margin-bottom: 0.5rem;
    color: var(--color-white);
}

.hero .subheadline {
    font-size: 1.2rem;
    color: var(--color-white);
    opacity: 0.9;
    font-weight: 400;
    margin-bottom: 1rem;
}

.hero p {
    color: var(--color-white);
    opacity: 0.95;
}

.hero-image-container {
    position: relative;
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Section Accent Divider */
.section-accent {
    height: 6px;
    background: var(--color-lavender);
    width: 100%;
    position: relative;
    z-index: 2;
    scroll-margin-top: 103px;
}

@media (max-width: 768px) {
    .section-accent {
        scroll-margin-top: 137px;
    }
}

/* Sections */
section {
    padding: 6rem 0;
    background: var(--color-light-paper);
    position: relative;
    z-index: 2;
}

section:nth-child(even) {
    background: var(--color-white);
}

section h2:first-of-type {
    margin-bottom: 3rem;
}

.section-content {
    max-width: 70ch;
}

/* Approach Section */
.approach-subsection {
    margin-bottom: 4rem;
}

.approach-subsection:last-child {
    margin-bottom: 0;
}

/* Services Section */
.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3rem;
    margin-top: 3rem;
}

.service-card {
    background: var(--color-light-paper);
    padding: 2rem;
    border: 1px solid var(--color-border);
}

.service-card h2 {
    margin-top: 0;
    font-size: 1.5rem;
}

/* Team Section */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 4rem;
    margin-top: 3rem;
    align-items: start;
}

.team-member {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.team-photo {
    width: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}


.team-member-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-member h2 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.8rem;
}

.team-member-title {
    font-weight: 600;
    color: var(--color-navy);
    margin: 0;
}

.team-member p {
    margin: 0;
}

/* Contact Form Section - Full Width Blue */
.contact-form-section {
    width: 100%;
    background: var(--color-navy);
    padding: 4rem 0;
    margin: 0;
}

.contact-form-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.contact-form {
    max-width: 800px;
}

.contact-form {
    width: 100%;
}

.contact-form h2 {
    color: var(--color-white);
    margin-top: 0;
    margin-bottom: 2rem;
}

.contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-white);
    font-weight: 600;
}

.contact-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.contact-form-row-full {
    grid-column: 1 / -1;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    background: var(--color-white);
    font-family: 'Trirong', Georgia, serif;
    font-size: 1rem;
    color: var(--color-ink);
    margin-bottom: 0;
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-form button {
    padding: 1rem 2rem;
    background: var(--color-white);
    color: var(--color-navy);
    border: none;
    font-family: 'Trirong', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin-top: 1rem;
}

.contact-form button:hover {
    background: var(--color-light-paper);
    color: var(--color-navy);
}

.contact-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.contact-form p {
    color: var(--color-white);
    opacity: 0.9;
    margin-top: 2rem;
}

/* Links */
a {
    color: var(--color-lavender);
    text-decoration: none;
    border-bottom: 1px solid var(--color-lavender);
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}

a:hover {
    color: var(--color-navy);
    border-bottom-color: var(--color-navy);
}

/* Footer */
footer {
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
    padding: 4rem 0 2rem;
    margin-top: 0;
}

footer .container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: start;
}

footer .copyright {
    grid-column: 1 / -1;
    border-top: 1px solid var(--color-border);
    padding-top: 2rem;
    margin-top: 2rem;
    text-align: left;
}

footer .container > div {
    display: flex;
    flex-direction: column;
    height: 100%;
}

footer h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    margin-top: 0;
    min-height: 2.4rem;
    vertical-align: bottom;
}

footer .container > div:first-child .wordmark {
    margin-bottom: 1rem;
}

footer .container > div .links-section {
    margin-top: auto;
}

footer p {
    font-size: 0.95rem;
    color: var(--color-harbor-gray);
    margin-bottom: 0.75rem;
}

footer .wordmark {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

footer nav {
    position: static;
    background: transparent;
    border: none;
    padding: 0;
}

footer nav a {
    color: var(--color-harbor-gray);
    border: none;
    padding: 0;
}

footer nav a:hover {
    color: var(--color-lavender);
    border: none;
}

/* Icon styles */
footer .fa-solid,
footer .fa-brands {
    color: var(--color-harbor-gray);
    margin-right: 10px;
    font-size: 1.8rem;
    text-align: center;
    text-decoration: none;
    vertical-align: -0.1em;
}

/* Links section - improved spacing for mobile tap targets */
footer .links-section p {
    line-height: 2;
    margin-bottom: 1rem;
    padding: 0.25rem 0;
}

/* Presence links - responsive multi-column layout */
#presence-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 2rem;
}

@media (max-width: 768px) {
    #presence-links {
        grid-template-columns: 1fr;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Thai Language - Tablet Font Sizes */
    html[lang="th"] body {
        font-size: 1.25rem;
    }
    
    html[lang="th"] p {
        font-size: 1.25rem;
    }
    
    html[lang="th"] h1 {
        font-size: 3.25rem;
    }
    
    html[lang="th"] h2 {
        font-size: 2.25rem;
    }
    
    html[lang="th"] h3 {
        font-size: 1.75rem;
    }
}

    @media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .palette-selector {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .palette-selector select {
        font-size: 0.65rem;
        padding: 0.25rem 0.4rem;
    }
    
    section {
        padding: 4rem 0;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    /* Thai Language - Mobile Font Sizes */
    html[lang="th"] body {
        font-size: 1.2rem;
    }
    
    html[lang="th"] p {
        font-size: 1.2rem;
    }
    
    html[lang="th"] h1 {
        font-size: 2.5rem;
    }
    
    html[lang="th"] h2 {
        font-size: 1.9rem;
    }
    
    html[lang="th"] h3 {
        font-size: 1.55rem;
    }
    
    html[lang="th"] .subtitle {
        font-size: 1.15rem;
        font-style: normal;
    }
    
    html[lang="th"] nav a {
        font-size: 1.05rem;
    }
    
    html[lang="th"] nav .wordmark {
        font-size: 1.2rem;
    }
    
    html[lang="th"] .hero .subheadline {
        font-size: 1.3rem;
    }
    
    nav .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav .wordmark {
        font-size: 1rem;
    }
    
    /* Thai Language - Mobile Logo Size */
    html[lang="th"] nav .wordmark {
        font-size: 1.1rem;
    }
    
    nav .nav-links {
        gap: 1rem;
    }
    
    nav a {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-form-wrapper {
        padding: 0 1.5rem;
    }
    
    .contact-form-section {
        padding: 3rem 0;
    }
    
    .team-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .contact-form input,
    .contact-form select,
    .contact-form textarea {
        margin-bottom: 1.5rem;
    }
    
    footer .container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .building-divider {
        height: 300px;
    }
    
    .contact-form {
        padding: 2rem 1.5rem;
    }
}

/* Placeholder for missing images */
.image-placeholder {
    width: 100%;
    height: 400px;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-harbor-gray);
    font-style: italic;
}

/* Building Image Sections */
.building-divider {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    margin: 0;
}

.building-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
    transition: opacity 1s ease-in-out;
}

.building-divider.at-top .building-image {
    opacity: 1;
}

.building-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, var(--color-navy) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0.6;
}

/* Pixel mesh effect - visible from start, reduces contrast */
.pixel-mesh {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 1px, var(--mesh-color-rgba) 1px, var(--mesh-color-rgba) 2px),
        repeating-linear-gradient(90deg, transparent, transparent 1px, var(--mesh-color-rgba) 1px, var(--mesh-color-rgba) 2px);
    background-size: 15px 15px;
    pointer-events: none;
    opacity: 1;
    animation: meshMove 6s infinite linear;
    z-index: 5;
    transition: opacity 1s ease-in-out;
}

.building-divider.at-top .pixel-mesh {
    opacity: 0 !important;
}

@keyframes meshMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 15px 15px;
    }
}

/* Caption */
.building-caption {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: var(--color-white);
    font-size: 1rem;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 15;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 2px 6px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    max-width: 400px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.building-divider.at-top .building-caption {
    opacity: 1 !important;
}

.building-caption .caption-text {
    margin-bottom: 0.25rem;
}

.building-caption .caption-copyright {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Form Message Container (near submit button) */
.form-message {
    margin-top: 1rem;
    min-height: 0;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin-top 0.3s ease;
}

.form-message.show {
    opacity: 1;
    max-height: 200px;
    margin-top: 1rem;
}

.form-message-content {
    padding: 0.75rem 1rem;
    background: var(--color-white);
    color: var(--color-ink);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: 'Trirong', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.5;
}

.form-message-success .form-message-content {
    border-left: 4px solid #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.form-message-error .form-message-content {
    border-left: 4px solid #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.form-message-info .form-message-content {
    border-left: 4px solid var(--color-lavender);
    background: rgba(138, 43, 226, 0.1);
}

/* Form Progress Indicator */
.form-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 9999;
    display: none;
}

.form-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: var(--color-lavender);
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        left: -30%;
    }
    100% {
        left: 100%;
    }
}
