:root {
    /* Material Design 3 Color Tokens (Israeli Flag Theme) */
    --md-sys-color-primary: #0038B8;
    /* Israeli flag blue */
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #D9E3FF;
    /* Light blue tint */
    --md-sys-color-on-primary-container: #001440;
    /* Dark blue */

    --md-sys-color-secondary: #4A5C92;
    /* Muted blue-grey */
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #D9E3FF;
    --md-sys-color-on-secondary-container: #0B1E4A;

    --md-sys-color-background: #FAFCFF;
    /* Very light blue-white */
    --md-sys-color-on-background: #1A1C1E;

    --md-sys-color-surface: #FAFCFF;
    --md-sys-color-surface-container: #EEF2F6;
    /* Slightly darker than surface */
    --md-sys-color-on-surface: #1A1C1E;
    --md-sys-color-surface-variant: #E0E2EC;
    --md-sys-color-on-surface-variant: #43474E;

    --md-sys-color-outline: #74777F;
    --md-sys-color-outline-variant: #CAC4D0;
    /* M3 Standard Outline Variant */

    --md-sys-color-inverse-surface: #313033;
    --md-sys-color-inverse-on-surface: #F4EFF4;

    /* Typography Tokens */
    --md-sys-typescale-display-large-font: 'Roboto', sans-serif;
    --md-sys-typescale-display-large-size: 57px;
    --md-sys-typescale-display-large-weight: 400;

    --md-sys-typescale-headline-medium-font: 'Roboto', sans-serif;
    --md-sys-typescale-headline-medium-size: 28px;
    --md-sys-typescale-headline-medium-weight: 400;

    --md-sys-typescale-body-large-font: 'Roboto', sans-serif;
    --md-sys-typescale-body-large-size: 16px;
    --md-sys-typescale-body-large-weight: 400;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    display: flex;
    flex-direction: row;
    /* Changed to row for Nav Rail */
    min-height: 100vh;
}

/* Top App Bar (M3 Expressive) */
header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Changed from default to space-between */
    padding: 0 16px;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-app-bar-title {
    font-size: 22px;
    line-height: 28px;
    font-weight: 400;
}

/* Prevent CLS by fixing icon size and hiding overflow */
.material-symbols-outlined {
    display: inline-block;
    width: 1em;
    height: 1em;
    overflow: hidden;
    white-space: nowrap;
    direction: ltr;
    vertical-align: bottom;
    /* Align with text baseline */
}

.language-dropdown {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 20px;
    padding: 6px 12px;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.lang-btn:hover {
    background-color: rgba(29, 25, 43, 0.08);
}

.lang-menu {
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    /* Logical property for RTL support */
    background-color: var(--md-sys-color-surface-container);
    border-radius: 12px;
    /* Increased radius */
    box-shadow: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    /* Elevation 2 */
    padding: 8px;
    /* 8px padding around items */
    min-width: 180px;
    /* Wider to accommodate content */
    display: none;
    /* Hidden by default */
    flex-direction: column;
    gap: 4px;
    /* Space between items */
    z-index: 200;
    margin-top: 4px;
}

.lang-menu.show {
    display: flex;
}

.lang-option {
    text-decoration: none;
    color: var(--md-sys-color-on-surface);
    padding: 0 12px;
    /* 12px horizontal padding */
    height: 48px;
    /* Min height 48px */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Align start */
    gap: 12px;
    /* Space between icon and text */
    font-size: 14px;
    /* Label Large */
    font-weight: 500;
    border-radius: 12px;
    /* Pill shape 12px radius */
    transition: background-color 0.2s;
}

.lang-option:hover {
    background-color: rgba(29, 25, 43, 0.08);
    /* State Layer */
}

.lang-option.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.lang-option.active:hover {
    background-color: var(--md-sys-color-secondary-container);
    /* Keep active color on hover */
    opacity: 0.9;
}

.check-icon {
    font-size: 24px;
    /* Standard icon size */
    color: inherit;
    /* Inherit from parent */
}

/* Navigation Rail */
.navigation-rail {
    width: 80px;
    /* Collapsed width */
    background-color: var(--md-sys-color-surface-container);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centered in collapsed mode */
    padding: 12px 0;
    /* Top padding for menu button */
    height: 100vh;
    position: sticky;
    top: 0;
    box-sizing: border-box;
    /* border-right: 1px solid var(--md-sys-color-outline); */
    transition: width 0.3s cubic-bezier(0.2, 0.0, 0, 1.0);
    /* Standard Easing */
    overflow: hidden;
    /* Hide content during transition */
    z-index: 10;
}

.navigation-rail.expanded {
    width: 250px;
    /* Expanded width */
    align-items: flex-start;
    /* Left align in expanded mode */
    padding-inline-start: 12px;
    /* Padding for expanded mode */
    padding-inline-end: 12px;
}

.menu-btn-container {
    width: 100%;
    display: flex;
    justify-content: center;
    /* Center in collapsed */
    margin-bottom: 24px;
    height: 48px;
    align-items: center;
}

.navigation-rail.expanded .menu-btn-container {
    justify-content: flex-start;
    /* Left align in expanded */
    padding-inline-start: 12px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: rgba(29, 25, 43, 0.08);
}

.nav-items {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center items in collapsed */
}

.navigation-rail.expanded .nav-items {
    align-items: stretch;
    /* Stretch items in expanded */
}

.nav-item {
    display: flex;
    flex-direction: column;
    /* Stack icon and label in collapsed */
    align-items: center;
    justify-content: center;
    width: 56px;
    /* Fixed width in collapsed */
    height: 56px;
    margin-bottom: 12px;
    border-radius: 0;
    /* Restored to original */
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    /* Ensure ripple is clipped */
}

.navigation-rail.expanded .nav-item {
    flex-direction: row;
    /* Row in expanded */
    width: calc(100% - 24px);
    /* Reduced width to add right margin */
    height: 56px;
    border-radius: 28px;
    /* Pill shape for entire item in expanded */
    justify-content: flex-start;
    padding-inline-start: 16px;
    margin-bottom: 4px;
    /* Tighter spacing in drawer */
    margin-inline-end: 12px;
    /* Add right margin for spacing */
}

/* Active Indicator - pill around icon when collapsed, full item when expanded */
.nav-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 32px;
    border-radius: 16px;
    transition: background-color 0.2s;
    margin-bottom: 4px;
    /* Space for label in collapsed */
    position: relative;
    overflow: hidden;
    /* Clip ripple to icon container */
}

.navigation-rail.expanded .nav-icon-container {
    width: 24px;
    /* Just the icon size */
    height: 24px;
    background-color: transparent !important;
    /* Remove pill bg in expanded */
    margin-bottom: 0;
    margin-inline-end: 12px;
}

/* Active States */
.nav-item.active .nav-icon-container {
    background-color: var(--md-sys-color-secondary-container);
    /* Pill in collapsed */
    color: var(--md-sys-color-on-secondary-container);
}

.navigation-rail.expanded .nav-item.active {
    background-color: var(--md-sys-color-secondary-container);
    /* Whole item in expanded */
    color: var(--md-sys-color-on-secondary-container);
}

.nav-item.active {
    color: var(--md-sys-color-on-surface);
    /* Active text color */
    font-weight: 700;
}

.nav-item:hover .nav-icon-container {
    background-color: rgba(29, 25, 43, 0.08);
}

.navigation-rail.expanded .nav-item:hover {
    background-color: rgba(29, 25, 43, 0.08);
}

.navigation-rail.expanded .nav-item:hover .nav-icon-container {
    background-color: transparent;
}

.nav-label {
    font-size: 11px;
    /* Small label in collapsed */
    font-weight: 500;
    line-height: 16px;
    letter-spacing: 0.5px;
    text-align: center;
}

.navigation-rail.expanded .nav-label {
    font-size: 14px;
    /* Larger label in expanded */
    line-height: 20px;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* Top App Bar (M3 Expressive) */
header {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 0 24px;
    height: 64px;
    min-height: 64px;
    /* Ensure minimum height */
    box-sizing: border-box;
    /* Include padding in height calculation */
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space between title and time */
    box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.15), 0 1px 2px 0px rgba(0, 0, 0, 0.30);
    /* Elevation 2 */
    flex-shrink: 0;
    /* Prevent header from shrinking */
    position: sticky;
    /* Stick to top while scrolling */
    top: 0;
    /* Stick at the top */
    z-index: 100;
    /* Ensure it stays above content */
}

.top-app-bar-title {
    font-size: 22px;
    font-weight: 400;
    margin-inline-start: 12px;
}



/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Align to top */
    align-items: center;
    padding: 48px 24px 24px;
    /* More padding at top */
    gap: 48px;
    /* Space between hero and card */
}

/* Hero Section */
.hero {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.hero-title {
    font-family: var(--md-sys-typescale-display-large-font);
    font-size: var(--md-sys-typescale-display-large-size);
    font-weight: 700;
    color: var(--md-sys-color-primary);
    margin: 0 0 16px 0;
    line-height: 1.2;
}

.hero-subtitle {
    font-family: var(--md-sys-typescale-headline-medium-font);
    font-size: var(--md-sys-typescale-headline-medium-size);
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
    line-height: 1.4;
}

.card {
    background-color: var(--md-sys-color-surface);
    border-radius: 12px;
    /* M3 Card Corner Radius */
    padding: 24px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    /* Elevation 1 */
    text-align: center;
}

h1 {
    font-family: var(--md-sys-typescale-display-large-font);
    font-size: var(--md-sys-typescale-headline-medium-size);
    /* Using headline-medium for better fit */
    font-weight: var(--md-sys-typescale-headline-medium-weight);
    color: var(--md-sys-color-primary);
    margin-top: 0;
    margin-bottom: 16px;
}

p {
    font-family: var(--md-sys-typescale-body-large-font);
    font-size: var(--md-sys-typescale-body-large-size);
    font-weight: var(--md-sys-typescale-body-large-weight);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.5;
}

.icon-placeholder {
    font-family: 'Material Symbols Outlined';
    font-size: 48px;
    color: var(--md-sys-color-secondary);
    margin-bottom: 16px;
}

/* M3 Expressive Cards */
/* M3 Expressive Cards */
.services-grid {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    width: 100%;
}

.m3-card {
    background-color: var(--md-sys-color-surface);
    border-radius: 16px;
    /* M3 expressive cards use larger radius */
    padding: 0;
    /* Remove padding - we'll add it to content */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Elevation 1 */
    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    transition: box-shadow 0.3s cubic-bezier(0.2, 0, 0, 1), transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.m3-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    bottom: 0;
    background-color: var(--md-sys-color-primary);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
    pointer-events: none;
}

.m3-card:hover {
    /* Elevation 2 on hover */
    box-shadow: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    transform: translateY(-2px);
}

.m3-card:hover::before {
    opacity: 0.08;
}

.m3-card:active {
    transform: translateY(0);
}

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
    /* Only round top corners to match card */
    margin: 0;
    /* No margins - flush with card edges */
}

.card-icon {
    font-size: 40px;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.card-title {
    font-family: var(--md-sys-typescale-headline-medium-font);
    font-size: 20px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin: 16px 24px 8px 24px;
    /* Top margin for spacing from image, side padding */
    position: relative;
    z-index: 1;
}

.card-description {
    font-family: var(--md-sys-typescale-body-large-font);
    font-size: 14px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.6;
    margin: 0 24px 24px 24px;
    /* Side and bottom padding */
    position: relative;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .services-grid {
        gap: 24px;
    }
}

/* M3 Divider */
.m3-divider {
    height: 1px;
    background-color: var(--md-sys-color-outline-variant);
    border: none;
    margin: 48px 0;
    width: 100%;
    max-width: 1200px;
}

/* Detail Sections */
.details-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 64px;
    margin-bottom: 64px;
}

.detail-section {
    display: flex;
    align-items: center;
    gap: 48px;
    scroll-margin-top: 80px;
    /* For sticky header */
}

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

.detail-image {
    flex: 1;
    max-width: 50%;
    height: auto;
    border-radius: 24px;
    object-fit: cover;
    aspect-ratio: 16/9;
    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
}

.detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.detail-title {
    font-family: var(--md-sys-typescale-headline-medium-font);
    font-size: 32px;
    font-weight: 400;
    color: var(--md-sys-color-primary);
    margin: 0 0 24px 0;
}

.detail-text {
    font-family: var(--md-sys-typescale-body-large-font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 24px;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.m3-btn-filled {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 24px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: 20px;
    text-decoration: none;
    font-family: var(--md-sys-typescale-body-large-font);
    font-size: 14px;
    font-weight: 500;
    transition: box-shadow 0.2s, background-color 0.2s;
    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
}

.m3-btn-filled:hover {
    box-shadow: 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
    background-color: rgba(0, 56, 184, 0.92);
    /* Slightly lighter/transparent primary */
}

.back-to-top {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    text-decoration: none;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
}

.back-to-top:hover {
    background-color: var(--md-sys-color-primary-container);
}

.m3-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    margin-bottom: 8px;
    padding: 4px 8px;
    background-color: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    border-radius: 4px;
    font-family: var(--md-sys-typescale-body-large-font);
    font-size: 11px;
    font-weight: 500;
    line-height: 16px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1), transform 0.2s cubic-bezier(0.2, 0, 0, 1);
    z-index: 10;
}

.back-to-top {
    position: relative;
    /* Ensure tooltip is positioned relative to button */
}

.back-to-top:hover .m3-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

@media (max-width: 768px) {
    .detail-section {
        flex-direction: column;
        gap: 24px;
    }

    .detail-section:nth-child(even) {
        flex-direction: column;
    }

    .detail-image {
        max-width: 100%;
    }
}

/* Footer */
footer {
    background-color: var(--md-sys-color-on-primary-container);
    /* Dark blue */
    color: #FFFFFF;
    padding: 48px 24px 24px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto 32px;
}

.footer-section h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 16px 0;
    color: var(--md-sys-color-primary-container);
    /* Light blue */
}

.footer-section p {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--md-sys-color-primary-container);
    /* Light blue on hover */
}

/* M3 Ripple Effect (State Layer) */
.ripple {
    position: absolute;
    border-radius: 50%;
    background-color: var(--md-sys-color-primary);
    opacity: 0.16;
    /* Reduced initial opacity for smoother effect */
    transform: scale(0);
    animation: ripple-animation 800ms cubic-bezier(0.4, 0, 0.2, 1);
    /* Longer, smoother easing */
    pointer-events: none;
}

@keyframes ripple-animation {
    0% {
        transform: scale(0);
        opacity: 0.16;
    }

    30% {
        opacity: 0.12;
    }

    60% {
        opacity: 0.08;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Ensure ripple container positioning */
.m3-card,
.nav-item {
    position: relative;
    overflow: hidden;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 24px;
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}