/* ===================================
   STYLES.CSS
   Single stylesheet for CNES website.

   Order:
     1. Fonts & tokens  (raw values)
     2. Base            (element defaults)
     3. Layout          (page structure, hero, page-bg)
     4. Nav             (header, hamburger, dropdowns)
     5. Components      (buttons, social, video)
     6. Utilities       (single-purpose helpers)
     7. Pages           (per-page overrides)
   =================================== */


/* ============================================================
   1. FONTS & TOKENS
   ============================================================ */

@font-face {
    font-family: RubicMonoOne;
    src: url('../assets/fonts/Rubik_Mono_One/RubikMonoOne-Regular.woff2') format('woff2'),
         url('../assets/fonts/Rubik_Mono_One/RubikMonoOne-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: Montserrat;
    src: url('../assets/fonts/Montserrat/Montserrat-VariableFont_wght.woff2') format('woff2'),
         url('../assets/fonts/Montserrat/Montserrat-VariableFont_wght.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Brand colors */
    --cnes-darkred: #570300;
    --cnes-red: #88243B;
    --cnes-yellow: #dda900;
    --cnes-white: #EFEFEF;
    --cnes-light: #B7B7B7;
    --cnes-dark: #2A2829;
    /* Typography */
    --font-display: "RubicMonoOne", Impact, sans-serif;
    --font-serif: "Montserrat", system-ui, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, monospace;
    --font-size-base: 16px;
    --line-height-base: 1.6;
    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 2rem;
    /* Layout */
    --max-width: 72rem;
    --radius-sm: 4px;
    --radius-md: 8px;
}


/* ============================================================
   2. BASE — Reset, element defaults
   ============================================================ */

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

h1, h2, h3, h4, p, a, li, span {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    font-family: var(--font-serif);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--cnes-light);
    background-color: var(--cnes-dark);
}

h1 {
    font-family: var(--font-display);
    font-weight: normal;
    color: var(--cnes-white);
    font-size: clamp(2.5rem, 8vw, 4rem);
    line-height: 1.1;
    margin: 0;
}

    h1.cnes-title {
        padding-bottom: 1rem;
    }

h2 {
    font-family: var(--font-display);
    font-weight: normal;
    color: var(--cnes-white);
    font-size: clamp(2rem, 6vw, 3.5rem);
    line-height: 1.1;
    margin: 0;
}

h3 {
    font-family: var(--font-display);
    color: var(--cnes-white);
    font-weight: normal;
}

p {
    color: var(--cnes-white);
}


/* ============================================================
   3. LAYOUT — Page structure, hero, below, page-bg
   ============================================================ */

.page-content {
    flex: 1;
}

/* --- Hero section --- */

.hero {
    min-height: auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.hero-center img,
.hero-center h1 {
    margin: 0;
}

/* --- Logo (index page) --- */

.logo {
    width: 300px;
    max-width: 80%;
    height: auto;
    margin-bottom: 1rem;
}

/* --- Text containers --- */

.text-box {
    max-width: 600px;
    margin: 0 auto;
}

.text-box-lg {
    max-width: 600px;
    margin: 0 auto;
    color: var(--cnes-white);
    font-size: 1.2rem;
}

/* --- Below-hero content band --- */

.below {
    padding: 3rem 1rem;
    text-align: center;
    background: var(--cnes-dark);
    width: 100%;
    position: relative;
    z-index: 2;
}

footer {
    background: var(--cnes-dark);
    width: 100%;
    position: relative;
    z-index: 2;
}

/* --- Page background — fixed image, no overlay ---
   Usage: <section class="page-bg [bg-wrap-*]">
   Each page sets --page-bg-image on its modifier class.
   =================================== */

.page-bg {
    position: relative;
    background: none;
}

.page-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--page-bg-image, url("/assets/images/backgrounds/bg-other.jpg")) center / cover no-repeat;
    z-index: -1;
}

.page-bg > * {
    position: relative;
    z-index: 1;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .logo {
        width: 400px;
    }
}


/* ============================================================
   4. NAV — Site header, hamburger, dropdowns
   ============================================================ */

.site-header {
    background-color: var(--cnes-darkred);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

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

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    position: relative;
}

.nav-logo {
    display: flex;
    align-items: center;
    z-index: 101;
}

.nav-logo img {
    height: 75px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    align-items: center;
}

/* --- Hamburger (hidden on desktop) --- */

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 101;
}

.hamburger span {
    width: 28px;
    height: 3px;
    background-color: var(--cnes-white);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(7px, 7px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }

/* --- Dropdown --- */

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--cnes-darkred);
    padding: var(--space-2) 0;
    list-style: none;
    margin: 0;
    min-width: 200px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu .button {
    width: 100%;
    text-align: left;
    display: block;
    padding: var(--space-2) var(--space-3);
}

/* --- Mobile nav --- */

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        flex-direction: column;
        background-color: var(--cnes-darkred);
        padding: 80px 2rem 2rem 2rem;
        gap: 0;
        align-items: stretch;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        max-height: 100vh;
        overflow-y: auto;
    }

    .nav-links.active {
        transform: translateY(0);
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links .button {
        width: 100%;
        display: block;
        padding: 1rem var(--space-3);
        text-align: left;
    }

    .dropdown-menu {
        position: static;
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        box-shadow: none;
        background-color: var(--cnes-darkred);
    }

    .dropdown.active .dropdown-menu {
        opacity: 1;
        visibility: visible;
        max-height: 500px;
    }

    .dropdown-menu .button {
        padding-left: 2rem;
    }

    .dropdown > .button::after {
        content: '▼';
        margin-left: 8px;
        font-size: 0.7em;
        transition: transform 0.3s ease;
    }

    .dropdown.active > .button::after {
        transform: rotate(180deg);
    }
}

@media (hover: none) and (pointer: coarse) {
    .button:active {
        color: var(--cnes-yellow);
        background-color: rgba(255, 255, 255, 0.1);
    }

    .btn-filled:active {
        opacity: 0.85;
    }
}


/* ============================================================
   5. COMPONENTS — Buttons, social icons, video embed
   ============================================================ */

/* --- Base nav button --- */

.button {
    font-size: 1.25rem;
    padding: var(--space-2) var(--space-3);
    color: var(--cnes-white);
    font-family: var(--font-serif);
    border: none;
}

.button:hover {
    color: var(--cnes-yellow);
}

a.button {
    text-decoration: none;
}

/* --- Filled buttons --- */

.btn-filled {
    display: inline-block;
    padding: 0.25rem 1rem;
    border: 3px solid transparent;
    border-radius: 30px;
    color: var(--cnes-dark);
    font-family: var(--font-serif);
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-decoration: none;
    text-transform: uppercase;
    transition: background 0.2s, border-color 0.2s;
    text-align: center;
}

.btn-filled--white {
    background: var(--cnes-white);
    border-color: var(--cnes-white);
}

.btn-filled--white:hover {
    background: var(--cnes-yellow);
    border-color: var(--cnes-yellow);
}

.btn-filled--yellow {
    background: var(--cnes-yellow);
    border-color: var(--cnes-yellow);
}

.btn-filled--yellow:hover {
    background: var(--cnes-white);
    border-color: var(--cnes-white);
}

/* --- Social icon buttons --- */

.social-buttons {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-bottom: 8rem;
}

.social-buttons a {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.social-buttons a:hover {
    transform: scale(1.05);
}

/* --- Responsive video embed (16:9) --- */

.video-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    width: 100%;
}

.video-container iframe {
    width: 100%;
    max-width: 875px;
    aspect-ratio: 16 / 9;
    border: none;
}


/* ============================================================
   6. UTILITIES
   ============================================================ */

.text-center { text-align: center; }
.mt-4        { margin-top: var(--space-4); }
.hidden      { display: none; }


/* ============================================================
   7. PAGES — Per-page overrides
   ============================================================ */

.node-map {
    display: block;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 3rem;
}

/* --- About --- */

.hero.team {
    display: block;
}

@media (min-width: 768px) {
    .hero.team {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 4rem;
        row-gap: 3rem;
        align-items: start;
    }

    .hero.team > h2 {
        grid-column: 1 / -1;
    }
}

.team-member {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
    width: 100%;
    max-width: 600px;
    padding: 0.5rem;
    box-sizing: border-box;
}

.photo-wrapper {
    flex-shrink: 0;
}

.photo-wrapper img {
    display: block;
    width: 250px;
    height: auto;
    border-radius: 8px;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-info h3 {
    margin: 0 0 0.5rem 0;
}

.member-info p {
    margin: 0;
}

@media (max-width: 768px) {
    .team-member {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .photo-wrapper img {
        width: 180px;
    }
}

/* --- Projects --- */

.bg-wrap-projects-page {
    --page-bg-image: url("/assets/images/backgrounds/bg-projects.jpg");
}

.projects {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: none;
    margin: 0;
    padding: 0;
}

.project-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 20px 2rem;
    min-height: 200px;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.project-card:nth-child(1) {
    background-image: url('/assets/images/projects-page/cloud-chamber-cloudylabs-fr-wp-aircool.jpg');
}

.project-card:nth-child(2) {
    background-image: url('/assets/images/projects-page/reactor-simulator.avif');
    background-color: #4b5563;
}

.project-card:nth-child(3) {
    background-image: url('/assets/images/projects-page/fusor-image.avif');
    background-color: #7c2d12;
}

.project-info {
    flex: 1;
    max-width: 700px;
    text-align: center;
    position: relative;
    z-index: 2;
    color: white;
}

.project-info h2 {
    margin: 0 0 1rem 0;
    font-size: 3.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.project-info p {
    margin: 0 0 2rem 0;
    line-height: 1.6;
    font-size: 1.3rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .project-card {
        flex-direction: column;
        text-align: center;
        padding: 30px 1.5rem;
        min-height: 200px;
    }

    .project-info h2 {
        font-size: 2.5rem;
    }

    .project-info p {
        font-size: 1.1rem;
    }
}

/* --- Events --- */

.events-section-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 1.5rem;
}

.events-divider {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 2rem;
    border: none;
    border-top: 2px solid var(--cnes-light);
    opacity: 0.4;
}

.event-card {
    max-width: 600px;
    margin: 0 auto 2rem;
    text-align: left;
}

.event-title {
    font-family: var(--font-display);
    color: var(--cnes-yellow);
    font-size: 1.4rem;
    letter-spacing: 1px;
    margin: 0 0 1rem 0;
    text-transform: uppercase;
}

.event-meta {
    list-style: none;
    margin: 0 0 1.5rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.event-meta li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--cnes-white);
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.event-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--cnes-white);
    stroke: var(--cnes-white);
    vertical-align: middle;
}

.event-description p {
    color: var(--cnes-light);
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0 0 0.75rem 0;
}

.event-note {
    font-style: italic;
}

.event-seats {
    font-weight: bold;
    color: var(--cnes-white) !important;
}

.btn-register {
    display: block;
    margin: 1.5rem auto 0;
    padding: 0.85rem 3rem;
    background: var(--cnes-yellow);
    color: var(--cnes-dark);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 30px;
    border: 3px solid var(--cnes-yellow);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    text-align: center;
    max-width: 220px;
}

.btn-register:hover {
    background: transparent;
    color: var(--cnes-yellow);
}

.events-coming-soon {
    font-family: var(--font-display);
    color: var(--cnes-yellow);
    font-size: 1.3rem;
    letter-spacing: 1.5px;
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 2rem;
}
