/* ==========================================================================
   BLUE SEA SYSTEM — Technical Maritime Editorial Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.01em;
}

body[dir="ltr"] {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.arabic-text {
    text-rendering: optimizeLegibility;
    font-feature-settings: "calt" 1, "liga" 1;
}

.dark body {
    background-color: #04131f;
    color: #e8eef4;
}

/* --------------------------------------------------------------------------
   Technical label / section index helpers
   -------------------------------------------------------------------------- */
.tech-label {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #00A3E0;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.tech-label::before {
    content: "";
    width: 2.25rem;
    height: 1px;
    background: currentColor;
    opacity: 0.7;
}

[dir="ltr"] .tech-label::before {
    margin-left: 0;
}

.section-index {
    font-family: 'Inter', -apple-system, sans-serif;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    color: #00A3E0;
}

.thin-rule {
    border: none;
    height: 1px;
    background: #d4d9de;
}

.dark .thin-rule {
    background: #0A436C;
}

/* --------------------------------------------------------------------------
   Header / Navigation
   -------------------------------------------------------------------------- */
.bs-header {
    transition: all 0.3s ease;
}

.bs-header.scrolled {
    background-color: rgba(255, 255, 255, 0.97);
    box-shadow: 0 1px 0 rgba(0, 43, 73, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dark .bs-header.scrolled {
    background-color: rgba(4, 19, 31, 0.97);
    box-shadow: 0 1px 0 rgba(10, 67, 108, 0.4);
}

.bs-header.scrolled .bs-header-inner {
    height: 4rem;
}

.bs-header-inner {
    height: 5.5rem;
    transition: height 0.3s ease;
}

/* Nav link treatment */
.nav-link {
    position: relative;
    padding: 0.5rem 0;
    font-weight: 700;
    font-size: 0.82rem;
    color: #374151;
    transition: color 0.2s ease;
    letter-spacing: 0.02em;
}

.dark .nav-link {
    color: #d1d9e2;
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: 0.25rem;
    right: 0;
    left: 0;
    height: 2px;
    background: #00A3E0;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.25s ease;
}

[dir="ltr"] .nav-link::after {
    transform-origin: left;
}

.nav-link:hover {
    color: #002B49;
}

.nav-link:hover::after {
    transform: scaleX(1);
}

.dark .nav-link:hover {
    color: #00A3E0;
}

.lang-btn {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
}

.lang-btn.active {
    background-color: #002B49;
    color: #fff;
}

.dark .lang-btn.active {
    background-color: #00A3E0;
}

/* Primary / secondary header actions */
.theme-btn {
    transition: all 0.2s ease;
}

.theme-btn:active {
    transform: scale(0.92);
}

.pdf-link {
    transition: all 0.2s ease;
}

.pdf-link:hover {
    color: #002B49;
}

.dark .pdf-link:hover {
    color: #00A3E0;
}

.cta-link {
    transition: all 0.25s ease;
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero-section {
    position: relative;
    background-color: #001a2d;
    color: #fff;
    overflow: hidden;
}

.hero-grid-overlay {
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.hero-vline {
    width: 1px;
    background: rgba(255, 255, 255, 0.18);
}

.hero-coordinate {
    font-family: 'Inter', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.5);
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

[dir="ltr"] .hero-coordinate {
    writing-mode: vertical-rl;
}

/* --------------------------------------------------------------------------
   Section spacing / shared
   -------------------------------------------------------------------------- */
.bs-section {
    padding: 5.5rem 0;
}

@media (max-width: 768px) {
    .bs-section {
        padding: 3.5rem 0;
    }
}

/* Scroll reveal (used by JS) */
.fade-in-section {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .fade-in-section {
        opacity: 1;
        transform: none;
    }
}

/* Image reveal */
.img-reveal {
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 43, 73, 0.15);
    position: relative;
}

.dark .img-reveal {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.img-reveal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 163, 224, 0.1) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

.img-reveal img {
    transform: scale(1.05);
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.6s ease;
    filter: brightness(0.95);
}

.img-reveal.is-visible img {
    transform: scale(1);
    filter: brightness(1);
}

.img-reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    transform: translateX(-100%);
    z-index: 2;
    pointer-events: none;
}

.img-reveal.is-visible::after {
    animation: shimmer 1.5s ease-out;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Zoom on hover for project images */
.zoom-img {
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.zoom-img:hover {
    transform: scale(1.03);
}

/* --------------------------------------------------------------------------
   Capability list (editorial numbered rows)
   -------------------------------------------------------------------------- */
.capability-row {
    border-bottom: 1px solid #dfe4e9;
    padding: 1.75rem 0.5rem;
    transition: background-color 0.25s ease, padding 0.25s ease;
}

.dark .capability-row {
    border-color: #0A436C;
}

.capability-row:last-child {
    border-bottom: none;
}

.capability-row:hover {
    background-color: #f4f7fa;
    padding-left: 1rem;
    padding-right: 1rem;
}

.dark .capability-row:hover {
    background-color: rgba(10, 67, 108, 0.15);
}

.capability-text {
    transition: transform 0.25s ease, color 0.25s ease;
}

.capability-row:hover .capability-text {
    transform: translateX(0.5rem);
    color: #002B49;
}

[dir="ltr"] .capability-row:hover .capability-text {
    transform: translateX(-0.5rem);
}

.dark .capability-row:hover .capability-text {
    color: #e8eef4;
}

.capability-arrow {
    opacity: 0;
    transform: translateX(-0.5rem);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

[dir="ltr"] .capability-arrow {
    transform: translateX(0.5rem);
}

.capability-row:hover .capability-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* --------------------------------------------------------------------------
   Projects grid — corporate professional portfolio
   -------------------------------------------------------------------------- */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 0.5rem;
}

.dark .projects-grid {
    gap: 2rem;
}

.project-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 43, 73, 0.08);
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s ease;
    transition-delay: calc(var(--stagger, 0) * 90ms);
    cursor: pointer;
}

.dark .project-card {
    background: #001A2D;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.project-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover {
    box-shadow: 0 12px 32px rgba(0, 43, 73, 0.18);
    transform: translateY(-6px);
}

.dark .project-card:hover {
    box-shadow: 0 12px 32px rgba(0, 163, 224, 0.25);
}

.project-card-media {
    position: relative;
    width: 100%;
    min-height: 320px;
    max-height: 380px;
    overflow: hidden;
    background: #f4f7fa;
}

.dark .project-card-media {
    background: #0A436C;
}

.project-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1);
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .project-card-media img {
    transform: scale(1.12);
}

.project-card-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0, 26, 45, 0.92) 100%);
    pointer-events: none;
}

.project-card:not(:has(.project-card-title)) .project-card-media::after {
    display: none;
}

.project-card-media::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 163, 224, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

.project-card-zoom-hint {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 2.75rem;
    height: 2.75rem;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.85) translateY(-8px);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 3;
    box-shadow: 0 4px 12px rgba(0, 43, 73, 0.15);
}

.dark .project-card-zoom-hint {
    background: rgba(0, 43, 73, 0.97);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.project-card-zoom-hint i {
    color: #002B49;
    font-size: 1.1rem;
}

.dark .project-card-zoom-hint i {
    color: #00A3E0;
}

.project-card:hover .project-card-zoom-hint {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.project-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    margin: 0;
    padding: 1.5rem 1.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.project-card-title::before {
    content: '';
    display: block;
    width: 2.5rem;
    height: 3px;
    background: #00A3E0;
    margin-bottom: 0.75rem;
    border-radius: 2px;
}

.project-card:not(:has(.project-card-title)) .project-card-media {
    min-height: 280px;
}

@media (min-width: 640px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-card-media {
        height: 20rem;
    }
}

@media (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .project-card-media {
        height: 22rem;
    }

    .project-card-title {
        font-size: 1.2rem;
        padding: 1.6rem 1.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .project-card {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .project-card-media img,
    .project-card:hover .project-card-media img {
        transform: none;
        transition: none;
    }

    .project-card-zoom-hint {
        opacity: 1;
        transform: scale(1);
    }
}

/* --------------------------------------------------------------------------
   Stats — editorial row, no cards
   -------------------------------------------------------------------------- */
.stat-card {
    position: relative;
    padding: 1rem 0;
    border-top: 1px solid #dfe4e9;
}

.dark .stat-card {
    border-color: #0A436C;
}

.stat-number {
    font-family: 'Inter', sans-serif;
    font-size: 2.75rem;
    font-weight: 800;
    color: #002B49;
    line-height: 1;
    letter-spacing: -0.02em;
}

.dark .stat-number {
    color: #f8fafc;
}

.stat-label {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 600;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.dark .stat-label {
    color: #94a3b8;
}

@media (max-width: 768px) {
    .stat-number {
        font-size: 2rem;
    }
}

/* --------------------------------------------------------------------------
   Departments / Contact — editorial numbered list
   -------------------------------------------------------------------------- */
.department-row {
    border-bottom: 1px solid #dfe4e9;
    padding: 2rem 0;
}

.dark .department-row {
    border-color: #0A436C;
}

.department-row:last-child {
    border-bottom: none;
}

.department-email {
    border-bottom: 1px solid #00A3E0;
    color: #002B49;
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.2s ease, border-color 0.2s ease;
    display: inline-block;
}

.department-email:hover {
    color: #00A3E0;
    border-color: #002B49;
}

.dark .department-email {
    color: #7fd4f5;
}

.dark .department-email:hover {
    color: #ffffff;
    border-color: #00A3E0;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.bs-footer {
    background-color: #001a2d;
    color: #cbd5e1;
}

.footer-section-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #00A3E0;
}

.footer-link {
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #00A3E0;
}

/* --------------------------------------------------------------------------
   Global link underline animation
   -------------------------------------------------------------------------- */
.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: gap 0.2s ease;
}

.link-arrow:hover {
    gap: 0.7rem;
}

/* --------------------------------------------------------------------------
   Misc overrides — remove rounded-card clichés
   -------------------------------------------------------------------------- */
.capability-index {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: #00A3E0;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
}

/* --------------------------------------------------------------------------
   Responsive — mobile keeps the desktop editorial structure, scaled
   -------------------------------------------------------------------------- */

/* Small laptops / tablets portrait */
@media (max-width: 1024px) {
    .bs-section {
        padding: 4rem 0;
    }

    .capability-row {
        gap: 2rem;
    }
}

/* Tablets / large phones */
@media (max-width: 900px) {
    .bs-header-inner {
        height: 4.5rem;
    }
}

/* Phones */
@media (max-width: 768px) {
    .bs-section {
        padding: 3rem 0;
    }

    /* Capability rows — keep number + text side by side, tighten */
    .capability-row {
        gap: 1.25rem;
        padding: 1.5rem 0.25rem;
    }

    .capability-index {
        min-width: 1.5rem;
    }

    .capability-row:hover {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Department rows — keep row structure so it reads like desktop */
    .department-row {
        grid-template-columns: 2.25rem 1fr !important;
        gap: 0.25rem 1rem;
        align-items: start;
    }

    .department-row .section-index {
        grid-column: 1;
        grid-row: 1 / span 2;
        margin-top: 0.35rem;
    }

    .department-row > div:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
    }

    .department-row > div:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
        text-align: right;
    }

    [dir="ltr"] .department-row > div:nth-child(2),
    [dir="ltr"] .department-row > div:nth-child(3) {
        text-align: left;
    }
}

/* --------------------------------------------------------------------------
   Mobile polish — keep the editorial structure close to desktop
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .vision-mission-grid {
        gap: 2.5rem;
    }
}

/* Very small screens — avoid cramping */
@media (max-width: 380px) {
    .hero-section h1 {
        font-size: 1.5rem;
        line-height: 1.35;
    }

    .stat-number {
        font-size: 1.75rem;
    }
}

/* --------------------------------------------------------------------------
   Project Lightbox Modal
   -------------------------------------------------------------------------- */
.project-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 26, 45, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: slideUp 0.4s ease forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    transform: rotate(90deg);
}

.lightbox-caption {
    position: absolute;
    bottom: -3rem;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.lightbox-caption:empty {
    display: none;
}

@media (max-width: 768px) {
    .project-lightbox {
        padding: 1rem;
    }

    .lightbox-content {
        max-width: 95vw;
    }

    .lightbox-close {
        top: -2rem;
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }

    .lightbox-caption {
        font-size: 0.95rem;
        bottom: -2.5rem;
    }
}
