/* ==================== */
/* Reset & Variables    */
/* ==================== */

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

:root {
    /* Color Palette - Lavender & Purple */
    --primary-color: #9382AD;
    --primary-dark: #76688A;
    --primary-darker: #5f5370;
    --hero-start: #85749F;
    --hero-end: #66597A;
    --accent-color: #8f6636;
    --accent-hover: #7f5a2e;

    --text-dark: #3d4a5f;
    --text-light: #5d6a7d;
    --text-muted: #6b7588;
    --text-on-dark: rgba(255, 255, 255, 0.92);

    --bg-white: #ffffff;
    --bg-light: #f9f7fc;

    --border-color: #e3ddef;
    --input-border: #9a8bb2;

    --success-text: #155724;
    --success-bg: #d4edda;
    --success-border: #c3e6cb;
    --error-text: #721c24;
    --error-bg: #f8d7da;
    --error-border: #f5c6cb;
    --invalid-color: #c0392b;

    --shadow-sm: 0 2px 4px rgba(147, 130, 173, 0.08);
    --shadow-md: 0 4px 6px rgba(147, 130, 173, 0.12);
    --shadow-lg: 0 10px 20px rgba(147, 130, 173, 0.15);

    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Typography */
    --font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-heading: 'Georgia', serif;

    /* Spacing */
    --section-padding: 80px 0;
    --container-width: 1200px;
    --nav-height: 92px; /* 60px logo + 2 × 1rem padding */
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
    scrollbar-gutter: stable; /* short pages (404) keep the same centring as scrolling ones */
}

body {
    font-family: var(--font-primary);
    color: var(--text-dark);
    line-height: 1.7;
    background-color: var(--bg-white);
}

/* ==================== */
/* Typography           */
/* ==================== */

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    line-height: 1.3;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-darker);
}

/* Links inside running text get an underline, so colour isn't the only cue */
.legal-page p a,
.legal-page li a,
.form-consent a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ==================== */
/* Layout               */
/* ==================== */

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

section {
    padding: var(--section-padding);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.divider {
    width: 60px;
    height: 3px;
    background-color: var(--accent-color);
    margin: 0 auto;
}

.section-intro {
    max-width: 640px;
    margin: 1.5rem auto 0;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 1001;
    padding: 0.75rem 1.25rem;
    background-color: var(--bg-white);
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.skip-link:focus {
    top: 1rem;
}

/* ==================== */
/* Navigation           */
/* ==================== */

.navbar {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: opacity 0.3s ease;
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-logo {
    height: 60px;
    width: 60px;
    object-fit: contain;
}

.nav-brand-name {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1.3;
    color: var(--primary-color);
    margin: 0;
}

.nav-brand .subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 3px 0;
    background-color: var(--text-dark);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Bars sit 9px apart (3px height + 2 × 3px margin), so ±9px stacks them into an X */
.nav-toggle.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ==================== */
/* Hero Section         */
/* ==================== */

.hero {
    background: linear-gradient(135deg, var(--hero-start) 0%, var(--hero-end) 100%);
    color: white;
    text-align: center;
    padding: 120px 0;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.05)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,138.7C960,139,1056,117,1152,96C1248,75,1344,53,1392,42.7L1440,32L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h2 {
    font-size: 3rem;
    color: white;
    margin-bottom: 1.5rem;
}

.hero-text {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: white;
}

/* ==================== */
/* Buttons              */
/* ==================== */

.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white; /* beats a:hover on the hero <a> */
}

.btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ==================== */
/* About Section        */
/* ==================== */

.about {
    background-color: var(--bg-white);
}

.about-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 4rem;
    align-items: start;
}

.about-image {
    position: sticky;
    top: calc(var(--nav-height) + 8px);
}

.portrait-wrapper {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    display: block;
}

.about-text h3 {
    color: var(--primary-color);
    margin-top: 2rem;
}

.about-text h3:first-child {
    margin-top: 0;
}

.credentials {
    list-style: none;
}

.credentials li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    color: var(--text-light);
}

.credentials li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

.credentials-note {
    margin-top: 1rem;
    font-size: 0.95em;
    font-style: italic;
}

/* ==================== */
/* Services Section     */
/* ==================== */

.services {
    background-color: var(--bg-light);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* equal columns even with long words */
    gap: 2rem;
}

/* Icon beside the title, description below */
.service-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    align-content: start;
    column-gap: 1rem;
    background-color: var(--bg-white);
    padding: 1.75rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-top: 3px solid var(--primary-color);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.service-icon {
    color: var(--primary-color);
}

.service-icon svg {
    display: block;
    width: 36px;
    height: 36px;
}

.service-card h3 {
    margin-bottom: 0;
    padding-top: 4px; /* centres the first text line on the 36px icon */
    font-size: 1.3rem;
    line-height: 1.3;
    color: var(--primary-color);
    overflow-wrap: break-word;
}

.service-card p {
    grid-column: 1 / -1;
    margin: 0.9rem 0 0;
    line-height: 1.6;
}

/* ==================== */
/* Contact Section      */
/* ==================== */

.contact {
    background-color: var(--bg-white);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-info h3 {
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.info-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.info-item svg {
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.info-item h4 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.info-item p {
    margin: 0;
}

/* Email and Instagram are the main calls to action on mobile: look tappable, with room to tap */
.info-item a {
    display: inline-block;
    padding: 0.25rem 0;
    font-weight: 500;
}

/* Contact Form */
.contact-form-wrapper h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.form-description {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
}

.form-group input {
    padding: 0.75rem;
    border: 2px solid var(--input-border);
    border-radius: var(--radius-sm);
    font: inherit;
    transition: border-color 0.3s ease;
}

/* Border colour alone barely changes on focus, so add a soft ring */
.form-group input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(147, 130, 173, 0.35);
}

/* :user-invalid only matches after the visitor has interacted with the field */
.form-group input:user-invalid {
    border-color: var(--invalid-color);
}

.form-consent {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: 0.95rem;
    color: var(--text-light);
}

.form-consent input {
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.3rem;
    accent-color: var(--primary-color);
}

.form-note {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-status {
    margin: 0;
    padding: 1rem;
    scroll-margin-bottom: 1rem; /* focus() scrolls it into view with a little room below */
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* Stays rendered (not display: none) so screen readers announce the live region reliably */
.form-status:empty {
    padding: 0;
    border: 0;
}

.form-status:focus {
    outline: none;
}

.form-status.success {
    color: var(--success-text);
    background-color: var(--success-bg);
    border-color: var(--success-border);
}

.form-status.error {
    color: var(--error-text);
    background-color: var(--error-bg);
    border-color: var(--error-border);
}

/* ==================== */
/* Legal Pages          */
/* ==================== */

.legal-page {
    padding: var(--section-padding);
}

.legal-page .container {
    max-width: 800px;
}

.legal-page h1 {
    color: var(--primary-color);
}

.legal-page h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-top: 2.5rem;
}

.legal-page ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.legal-page li {
    margin-bottom: 0.5rem;
}

.legal-updated {
    color: var(--text-muted);
    font-style: italic;
}

/* ==================== */
/* Footer               */
/* ==================== */

.footer {
    background-color: var(--primary-dark);
    padding: 1.5rem 0;
    text-align: center;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-on-dark);
}

.footer a {
    display: inline-block;
    padding: 0.25rem 0;
    color: var(--text-on-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer a:hover {
    color: white;
}

/* ==================== */
/* Scroll to Top Button */
/* ==================== */

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background-color: var(--accent-hover);
    transform: translateY(-3px);
}

/* ==================== */
/* Responsive Design    */
/* ==================== */

/* Three columns can't fit below 1024px: two columns */
@media (max-width: 1023px) {
    .services-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablets: stack the portrait above the about text */
@media (max-width: 900px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-image {
        position: static;
        max-width: 250px;
        margin: 0 auto;
    }

    .contact-content {
        gap: 2.5rem;
    }

    /* Hamburger menu: the full menu wraps under the name on tablets with large text.
       The toggle comes after the <nav>, so space-between keeps it at the right edge. */
    .nav-toggle {
        display: flex;
        order: 1;
    }

    /* Overlay below the navbar, so opening it doesn't push the page content down */
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background-color: var(--bg-white);
        box-shadow: var(--shadow-md);
        max-height: 0;
        overflow: hidden;
        visibility: hidden;
        transition: max-height 0.3s ease, visibility 0.3s ease;
    }

    .nav-menu.open {
        max-height: 30rem;
        visibility: visible;
    }

    .nav-menu li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu a {
        display: block;
        padding: 0.75rem 0;
    }

    .nav-menu a.active {
        color: var(--primary-dark);
        font-weight: 700;
    }

    .nav-menu a::after {
        display: none;
    }
}

/* Phones */
@media (max-width: 700px) {
    :root {
        --section-padding: 60px 0;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }

    .hero {
        padding: 80px 0;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .hero-text {
        font-size: 1.1rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .service-card {
        padding: 1.5rem;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .scroll-to-top {
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .navbar .container {
        gap: 0.5rem;
    }

    .nav-logo {
        width: 48px;
        height: 48px;
    }

    .nav-brand-name {
        font-size: 1.2rem;
    }

    .nav-brand .subtitle {
        font-size: 0.72rem;
    }

    .hero h2 {
        font-size: 1.75rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ==================== */
/* Animations           */
/* ==================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* script.js adds .reveal, so content stays visible if JS doesn't run */
.reveal:not(.revealed) {
    opacity: 0;
}

.revealed {
    animation: fadeIn 0.6s ease-out;
}

/* ==================== */
/* Accessibility        */
/* ==================== */

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.hero :focus-visible,
.footer :focus-visible {
    outline-color: white;
}

/* Skip-link target: focusable so Safari lands on it, but no ring around the page */
main:focus {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal:not(.revealed) {
        opacity: 1; /* no fade-in, so nothing waits to be revealed */
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    .nav-toggle,
    .scroll-to-top,
    .skip-link {
        display: none;
    }

    .reveal {
        opacity: 1 !important;
        animation: none !important;
    }
}
