/* =========================================================================
   CSS variables and Base Reset (Adhering to Custom Design Rules)
   ========================================================================= */

:root {
    /* Colors - Clinical Elegant Theme */
    --color-primary: #0F766E;
    /* Deep Teal */
    --color-primary-rgb: 15, 118, 110;

    --color-accent: #64B5F6;
    /* Soft Blue */

    --color-bg: #FAFAF9;
    /* Warm Off-white */
    --color-bg-rgb: 250, 250, 249;

    --color-surface: #FFFFFF;
    --color-text-primary: #1C1917;
    /* Dark Charcoal */
    --color-text-secondary: #57534E;
    --color-border: #E7E5E4;

    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;

    /* Spacing Grid (8px baseline) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;
    --space-5xl: 128px;

    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows (Contextual Depth) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.16);

    /* Easing curves */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =========================================================================
   Resets and Global Document Styles
   ========================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

/* Fluid Typography using clamp() */
h1 {
    font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
}

h2 {
    font-size: clamp(1.8rem, 3vw + 0.5rem, 3rem);
}

h3 {
    font-size: clamp(1.3rem, 2vw + 0.5rem, 2rem);
}

p {
    font-size: clamp(1rem, 1vw + 0.5rem, 1.125rem);
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--ease-out-expo);
}

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

/* Custom focus ring for accessibility */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* =========================================================================
   Layout & Grid Architecture
   ========================================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.full-bleed {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.grid {
    display: grid;
    gap: var(--space-2xl);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-asymmetric {
    grid-template-columns: 2fr 1fr;
}

@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .grid-asymmetric {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Components (Nav, Buttons, Generic Inputs)
   ========================================================================= */
.nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: var(--space-md) 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(var(--color-bg-rgb), 0.85);
    border-bottom: 1px solid var(--color-border);
    transition: box-shadow 0.3s ease;
}

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

.logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--color-primary);
}

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

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    z-index: 101;
    padding: var(--space-xs);
}

.mobile-menu-toggle .bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-text-primary);
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.nav-links {
    display: flex;
    gap: var(--space-xl);
    font-weight: 600;
    font-size: 15px;
}

.nav-links a:hover {
    color: var(--color-primary);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--color-surface);
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.4s var(--ease-out-expo);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(var(--color-primary-rgb), 0.25);
}

.btn-ghost {
    padding: 14px 28px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text-primary);
    background: transparent;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.4s var(--ease-out-expo);
}

.btn-ghost:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* =========================================================================
   Animations & Depth Layers
   ========================================================================= */

/* Grain Overlay Effect */
.grain-overlay::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

/* Staggered Scroll Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-on-scroll {
    opacity: 0;
    /* Active animation is toggled by JS through .is-visible */
}

.is-visible {
    animation: fadeInUp 0.8s var(--ease-out-expo) forwards;
}

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

/* =========================================================================
   Hero Section
   ========================================================================= */
.hero {
    padding-top: calc(var(--space-5xl) + 80px);
    /* Buffer for fixed nav */
    padding-bottom: var(--space-4xl);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-bg {
    /* Using the mesh gradient structure provided */
    background:
        radial-gradient(ellipse at 20% 50%, rgba(var(--color-primary-rgb), 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(100, 181, 246, 0.1) 0%, transparent 50%),
        /* Subtly injected soft blue accent */
        radial-gradient(ellipse at 50% 80%, rgba(var(--color-primary-rgb), 0.04) 0%, transparent 50%),
        var(--color-bg);
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    justify-content: center;
}

.hero-content h1 span {
    color: var(--color-primary);
    position: relative;
}

/* Subtle accent highlight */
.hero-content h1 span::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 100%;
    height: 8px;
    background-color: var(--color-accent);
    opacity: 0.3;
    z-index: -1;
}

.hero-content p {
    color: var(--color-text-secondary);
    max-width: 90%;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.image-placeholder {
    width: 100%;
    height: min(600px, 80vh);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

@media (max-width: 768px) {
    .hero {
        padding-top: 140px;
        padding-bottom: 80px;
        min-height: auto;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .btn-primary,
    .hero-actions .btn-ghost {
        width: 100%;
        justify-content: center;
    }

    .mobile-menu-toggle {
        display: flex;
        order: 3; /* Push toggle to the right if needed, but flex-items order matters. btn-primary will be pushed */
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--color-surface);
        padding: 100px var(--space-xl) var(--space-xl);
        box-shadow: -5px 0 15px rgba(0,0,0,0.05);
        transition: right 0.4s var(--ease-out-expo);
        z-index: 100;
        gap: var(--space-lg);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-container .btn-primary {
        padding: 10px 16px;
        font-size: 13px;
        order: 2; /* keep btn in middle or right */
        margin-left: auto;
        margin-right: 15px;
    }
}

/* =========================================================================
   Utility Classes
   ========================================================================= */
.section-padding {
    padding: 120px 0;
}

@media (max-width: 768px) {
    .section-padding {
        padding: 80px 0;
    }
}

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

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

.mt-lg {
    margin-top: var(--space-xl);
}

.mt-xl {
    margin-top: var(--space-3xl);
}

.section-header {
    max-width: 600px;
    margin-bottom: var(--space-2xl);
}

.section-header.text-center {
    margin-left: auto;
    margin-right: auto;
}

.section-header h2 {
    margin-bottom: var(--space-md);
}

.section-header h2 span {
    color: var(--color-primary);
}

/* =========================================================================
   Social Proof Section
   ========================================================================= */
.social-proof p {
    color: var(--color-text-secondary);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 14px;
}

.stats-grid {
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-xl) 0;
}

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

.stat-card h3 {
    font-size: clamp(2.5rem, 4vw + 1rem, 3.5rem);
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
    line-height: 1;
}

.stat-card p {
    color: var(--color-text-primary);
    letter-spacing: normal;
    text-transform: none;
    font-size: 16px;
    font-weight: 500;
}

/* =========================================================================
   Cards & Services
   ========================================================================= */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all 0.4s var(--ease-out-expo);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--color-primary-rgb), 0.3);
}

.service-icon {
    font-size: 40px;
    margin-bottom: var(--space-md);
    background: rgba(var(--color-primary-rgb), 0.05);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.service-card p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
    flex-grow: 1;
}

.service-link {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 15px;
    align-self: flex-start;
    position: relative;
    padding-bottom: 4px;
}

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

.service-card:hover .service-link::after {
    width: 100%;
}

/* =========================================================================
   How It Works Process Step
   ========================================================================= */
.process-step {
    position: relative;
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    background: rgba(var(--color-primary-rgb), 0.03);
    border: 1px solid transparent;
    transition: all 0.4s var(--ease-out-expo);
}

.process-step:hover {
    background: var(--color-surface);
    border-color: var(--color-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.step-number {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--color-accent);
    opacity: 0.2;
    margin-bottom: var(--space-md);
    line-height: 1;
    transition: opacity 0.4s ease;
}

.process-step:hover .step-number {
    opacity: 0.6;
}

.process-step h3 {
    font-size: 1.3rem;
    margin-bottom: var(--space-sm);
}

.process-step p {
    color: var(--color-text-secondary);
    font-size: 15.5px;
}

/* =========================================================================
   Testimonials
   ========================================================================= */
.stars {
    color: var(--color-warning);
    font-size: 1.2rem;
    margin-bottom: var(--space-md);
    letter-spacing: 0.2em;
}

.review {
    font-style: italic;
    font-size: 1.05rem;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xl);
    flex-grow: 1;
}

.reviewer {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-lg);
}

.avatar {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    color: var(--color-surface);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    font-family: var(--font-display);
}

.reviewer h4 {
    font-size: 1rem;
    line-height: 1.2;
}

.reviewer span {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* =========================================================================
   FAQ Section
   ========================================================================= */
.faq-intro p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.faq-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.faq-item:hover {
    box-shadow: var(--shadow-sm);
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: var(--space-lg);
    background: transparent;
    border: none;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--color-text-secondary);
    transition: transform 0.4s var(--ease-out-expo);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
    color: var(--color-primary);
}

.faq-answer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s var(--ease-out-expo);
}

.faq-item.active .faq-answer {
    grid-template-rows: 1fr;
}

.faq-answer-inner {
    overflow: hidden;
}

.faq-answer-inner p {
    padding: 0 var(--space-lg) var(--space-lg) var(--space-lg);
    color: var(--color-text-secondary);
}

/* =========================================================================
   Final CTA
   ========================================================================= */
.final-cta h2 {
    margin-bottom: var(--space-md);
}

.final-cta p {
    color: var(--color-text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

/* =========================================================================
   Footer
   ========================================================================= */
.footer {
    background: var(--color-surface);
    padding: var(--space-4xl) 0 var(--space-xl) 0;
    border-top: 1px solid var(--color-border);
}

.footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-3xl);
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
    }
}

.footer-brand p {
    color: var(--color-text-secondary);
}

.footer-links h4 {
    font-size: 1.1rem;
    margin-bottom: var(--space-lg);
}

.footer-links p,
.footer-links a {
    color: var(--color-text-secondary);
    display: block;
    margin-bottom: var(--space-sm);
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-bottom {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-xl);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* =========================================================================
   Inner Pages (Kadro, Tedaviler)
   ========================================================================= */
.page-header {
    padding: 160px 0 80px 0;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.doctor-card {
    overflow: hidden;
    padding: 0;
}

.doctor-img-placeholder {
    width: 100%;
    aspect-ratio: 3/4;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-text-secondary);
}

.doctor-img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}

.doctor-info {
    padding: var(--space-xl);
    text-align: center;
}

.doctor-info h3 {
    margin-bottom: var(--space-xs);
    color: var(--color-primary);
}

.doctor-info span {
    color: var(--color-text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

.treatments-layout {
    display: flex;
    gap: var(--space-2xl);
    align-items: flex-start;
}

.treatments-sidebar {
    flex: 0 0 300px;
    position: sticky;
    top: 120px;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.treatment-tab {
    text-align: left;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--color-border);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--color-text-secondary);
}

.treatment-tab:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.03);
}

.treatment-tab.active {
    background: var(--color-primary);
    color: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.treatments-content {
    flex: 1;
    min-height: 500px;
    background: var(--color-surface);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.treatment-pane {
    display: none;
    animation: scaleIn 0.4s var(--ease-out-expo) forwards;
}

.treatment-pane.active {
    display: block;
}

.treatment-pane h2 {
    color: var(--color-primary);
    margin-bottom: var(--space-md);
    font-size: 2rem;
}

.treatment-pane p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (max-width: 768px) {
    .treatments-layout {
        flex-direction: column;
    }

    .treatments-sidebar {
        flex: none;
        width: 100%;
        position: relative;
        top: 0;
    }
}

/* A11y Preference respects */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}