:root {
    --bg: #f4f4f4;
    --text: #333;
    --muted: #555;
    --card: #fff;
    --accent: #ffffff; /* requested white accent */
    --accent-contrast: #00722f; /* slightly darker green for visibility */
    --accent-2: #009f47; /* used for headings and accents that sit on light backgrounds */
    --border: #e5e5e5;
    --shadow: 0 2px 6px rgba(0,0,0,0.1);
}

body.dark-mode {
    --bg: #121212;
    --text: #e0e0e0;
    --muted: #a0a0a0;
    --card: #1e1e1e;
    --accent: #ffffff;
    --accent-contrast: #008f42;
    --accent-2: #00b157;
    --border: #333;
    --shadow: 0 2px 8px rgba(0,0,0,0.35);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

header {
    background: linear-gradient(135deg, #00722f 0%, #009f47 100%);
    color: #fff;
    padding: 50px 18px 40px;
    text-align: center;
}

header h1 { font-size: 2.4em; margin-bottom: 12px; }
header p { font-size: 1.2em; opacity: 0.95; max-width: 820px; margin: 0 auto 16px; }

.header-links { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: all 0.2s ease;
}
.header-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.28); }

nav {
    background-color: #333;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-toggle { display: none; }

nav a {
    display: block;
    color: #fff;
    text-decoration: none;
    padding: 15px 25px;
    transition: background-color 0.3s;
    font-weight: 600;
}

nav a:first-child i {
    margin-right: 6px;
}

nav a:hover { background-color: #008f42; }

.dark-mode-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1em;
    cursor: pointer;
    padding: 15px 25px;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    line-height: 1.6;
}

.dark-mode-btn:hover { background-color: #008f42; }
.mode-label { font-size: 0.95em; font-weight: 600; }


.container { max-width: 1200px; margin: 0 auto; padding: 40px 20px 60px; }

section {
    background: var(--card);
    margin-bottom: 40px;
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

section h2 {
    font-size: 1.9em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-2);
}

section h3 { margin-bottom: 8px; }

.features-grid,
.stage-cards,
.results-grid { display: grid; gap: 25px; }

.features-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin: 30px 0; }
.stage-cards { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 25px 0; }
.results-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 10px; gap: 20px; }

.feature-card,
.result-card,
.stage-card,
.specs-box,
.metrics-box,
.architecture-box,
.media-card {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    transition: all 0.3s ease;
}

body.dark-mode .feature-card,
body.dark-mode .result-card,
body.dark-mode .stage-card,
body.dark-mode .specs-box,
body.dark-mode .metrics-box,
body.dark-mode .architecture-box,
body.dark-mode .media-card {
    background-color: #2a2a2a;
    border-color: #3a3a3a;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.feature-card:hover,
.result-card:hover,
.stage-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 25px rgba(0, 114, 47, 0.35);
    border-color: #00722f;
}

body.dark-mode .feature-card:hover,
body.dark-mode .result-card:hover,
body.dark-mode .stage-card:hover {
    box-shadow: 0 12px 25px rgba(0, 143, 69, 0.25);
    border-color: #008f42;
}

.feature-card i { font-size: 2.5em; color: var(--accent-contrast); margin-bottom: 15px; }
.feature-card h3 { font-size: 1.2em; margin: 10px 0; }
.feature-card p { font-size: 0.95em; color: #666; }
body.dark-mode .feature-card p { color: #b0b0b0; }

.specs-box,
.metrics-box {
    background-color: #f7f7fb;
    border-left: 4px solid var(--accent-contrast);
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
body.dark-mode .specs-box,
body.dark-mode .metrics-box {
    background-color: #1c1c24;
    border-color: var(--accent-contrast);
}

.specs-box:hover,
.metrics-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 18px rgba(0, 114, 47, 0.25);
    border-color: var(--accent-contrast);
}
body.dark-mode .specs-box:hover,
body.dark-mode .metrics-box:hover {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
    border-color: var(--accent-contrast);
}

.specs-box ul,
.metrics-box ul,
.architecture-box ul { list-style: none; padding-left: 0; display: grid; gap: 8px; margin-top: 6px; }
.specs-box ul li,
.metrics-box ul li,
.architecture-box ul li { color: var(--muted); padding: 8px 0; border-bottom: 1px solid #e0e0e0; }
body.dark-mode .specs-box ul li,
body.dark-mode .metrics-box ul li,
body.dark-mode .architecture-box ul li { border-bottom-color: #3a3a3a; }
.specs-box ul li:last-child,
.metrics-box ul li:last-child { border-bottom: none; }

.stage-card {
    background: linear-gradient(135deg, #00722f26 0%, #009f4733 100%);
    border: 2px solid #00722f60;
    position: relative;
    text-align: left;
}
body.dark-mode .stage-card {
    background: linear-gradient(135deg, #008f4233 0%, #00b15744 100%);
    border-color: #008f4288;
}
.stage-number {
    position: absolute;
    top: -15px;
    left: 20px;
    background: linear-gradient(135deg, #00722f 0%, #009f47 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
}

.stage-card h4 { margin: 15px 0 10px 0; color: var(--accent-contrast); font-size: 1.1em; }
body.dark-mode .stage-card h4 { color: var(--accent-contrast); }

.muted { color: var(--muted); font-size: 0.95rem; }

.plain-list {
    margin: 12px 0 0 18px;
    color: var(--muted);
    display: grid;
    gap: 8px;
    list-style: disc;
}

.media-card video {
    width: 75%;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #000;
    box-shadow: var(--shadow);
}

footer { text-align: center; padding: 28px; color: var(--muted); }

/* Media Gallery */

.gallery-viewer {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 26px 64px;
}

.gallery-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
    border: 1px solid var(--border);
        aspect-ratio: 16 / 9;
    min-height: 560px; /* larger minimum */
    max-height: 90vh; /* larger max height for viewer */
    box-shadow: var(--shadow);
}

    /* Optional: make the viewer square when needed */
    .gallery-viewer.square .gallery-media {
        aspect-ratio: 1 / 1;
    }
.gallery-media video,
.gallery-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

.gallery-meta {
    grid-column: 1 / -1;
    margin-top: 8px;
}

.gallery-meta h4 { margin-bottom: 8px; color: var(--accent-2); }
.gallery-meta p { color: var(--muted); }

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #00722f 0%, #009f47 100%);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(0, 114, 47, 0.45);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    z-index: 3;
}

.gallery-nav.prev { left: 12px; }
.gallery-nav.next { right: 12px; }

.gallery-nav:hover { transform: translateY(-50%) translateY(-2px); box-shadow: 0 14px 26px rgba(0, 114, 47, 0.55); }
.gallery-nav:active { transform: translateY(-50%); }

.gallery-thumbs {
    display: flex;
    gap: 14px;
    margin-top: 22px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.gallery-thumbs::-webkit-scrollbar { height: 10px; }
.gallery-thumbs::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.35); border-radius: 6px; }

.gallery-thumb {
    position: relative;
    flex: 0 0 240px; /* match heart page feel */
    aspect-ratio: 16 / 9; /* non-square thumbs */
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: var(--card);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    scroll-snap-align: start;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


.gallery-thumb:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(0, 114, 47, 0.25);
    border-color: #00722f;
}


.gallery-thumb.active {
    border-color: #00722f;
    box-shadow: 0 0 0 3px rgba(0, 114, 47, 0.25);
}

.thumb-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #00722f 0%, #009f47 100%);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.thumb-badge.image {
    background: linear-gradient(135deg, #006028 0%, #00863e 100%);
}

.gallery-media video,
.gallery-media img {
    font-size: 1.02em;
}

/* Reduce focus ring noise for mouse clicks while preserving keyboard focus */
.gallery-media :focus { outline: none; }
.gallery-media :focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

  @media (max-width: 768px) {
      .gallery-viewer { grid-template-columns: 1fr; }
      .gallery-nav { justify-self: center; }
      .gallery-media { aspect-ratio: 16 / 9; max-height: 40vh; min-height: 200px; }
      .gallery-thumb { flex: 0 0 200px; }
  }

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

@media (max-width: 768px) {
    /* Copying Analog mobile nav behavior exactly */
    nav {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
    }

    nav ul {
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: #333;
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        width: 100%;
    }

    nav ul li { width: 100%; }

    nav ul.active { max-height: 500px; }

    .nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: white;
        font-size: 1.5em;
        cursor: pointer;
        padding: 15px 20px;
        margin-left: auto;
    }

    nav a {
        padding: 12px 25px;
        font-size: 0.95em;
        border-bottom: 1px solid #555;
    }

    .dark-mode-btn {
        padding: 12px 25px;
        order: 3;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        text-align: left;
        border-bottom: 1px solid #555;
    }
}
