/* import fonts */
@font-face {
  font-family: 'Electrolize'; 
  src: url('../../fonts/Electrolize-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
/* Main */
:root {
    --bg-color: #0f2f00;
    --line-color: #004704;
    --accent-color: #00ffcc;
    /* Terminal Green or Cyan */
    --text-color: #cbd5e1;
}

body {
    font-family: 'Electrolize', sans-serif;
    margin: 0;
    display: flex;
    flex-direction: row;
    background-color: var(--bg-color);
    background-image:
        linear-gradient(var(--line-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-color) 1px, transparent 1px);
    background-size: 30px 30px;
    color: var(--text-color);
    overflow-x: hidden;
}

.image-full {
    width: 45%;
}

.mobile-only {
    display: none;
    /* Hidden by default, shown on mobile */
}

/* Latex (mostly because the math overflows on mobile) */
.equation-container {
    width: 100%;
    overflow-x: auto;
    /* Adds the scrollbar when needed */
    overflow-y: hidden;
    /* Prevents awkward vertical shifts */
    padding: 10px 0;
    /* Gives the equation some breathing room */
}


/* TABLE STYLING */
table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
}

.table-header {
    background-image: url('../../images/Table.jpg');
    color: white;
    text-align: center;
    padding: 12px;
    border: 1px solid white;
    font-size: 1.2em;
}

td {
    border: 1px solid white;
    padding: 8px;
    text-align: left;
}

/* Optional: Making the first column slightly bold */
td:first-child {
    font-weight: normal;
}

/* Columns (used for pdf files) */
.row-container {
    display: flex;
    gap: 20px;
    /* Space between items */
    flex-direction: row;
    /* Side-by-side on desktop */
}

/* Sections */
section {
    margin-bottom: 4rem;
    max-width: 800px;
    margin: auto;
    font-size: larger;
}

/* When the screen is 768px or smaller (Mobile/Tablet) */
@media (max-width: 768px) {
    body {
        flex-direction: column-reverse;
    }

    .row-container {
        flex-direction: column;
        /* Stacks items vertically */
    }

    .desktop-only {
        display: none;
        /* Hides desktop-specific elements */
    }

    .mobile-only {
        display: block;
        /* Shows mobile-specific elements */
    }

    .image-full {
        width: 100%;
    }
}

/* Navigation Bar */
.sidebar {
    width: 280px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    z-index: 100;
}

.toc-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toc-link {
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 8px;
    white-space: nowrap;
    transition: 0.2s;
}

.toc-link.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
}

/* --- Responsive Magic (Mobile) --- */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 10%;
        padding: 0.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        /* Allow side-swiping the menu */
        -webkit-overflow-scrolling: touch;
    }

    .sidebar h2 {
        display: none;
    }

    /* Hide title to save space */

    .toc-list {
        flex-direction: row;
        gap: 1rem;
    }
}

.main-content {
    flex: 1;
    padding: 4rem;
    min-width: 0;
}

section {
    margin-bottom: 4rem;
    max-width: 800px;
    margin: auto;
}

/* Add scroll margin on mobile to prevent sidebar overlap */
@media (max-width: 768px) {
    section {
        scroll-margin-top: 120px;
    }

    .main-content {
        padding: 1.5rem;
    }

    section {
        max-width: 100%;
        margin: 0;
    }

    .sidebar {
        background-color: #081900;
        /* Solid background for better readability on mobile */
    }
}

/* Cards and project grid */
.card {
    display: block;
    max-width: 320px;
    padding: 16px;
    border-radius: 12px;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.08),
            rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.02);
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card-title {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.card-description {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: var(--muted);
}

.card-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 9px;
    color: var(--muted);
}

/* Card Files */
.card-file-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.card-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    min-width: 250px;
    background: rgba(0, 115, 17, 0.5);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: #ffffff;
    font-weight: 500;
    transition: all 0.2s ease;
}

.card-file img {
    height: 45px;
}

.card-file:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Image Carousel (default view) */
.carousel {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    display: block;
}

/* Image Carousel grid layout */
.layout-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Left side is twice as wide as right */
    gap: 5px;
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
}

.right-stack {
    display: flex;
    flex-direction: column;
    /* Stacks the 3 boxes vertically */
    gap: 10px;
}

.left-box,
.small-box {
    border: none;
}

/* Mobile: Switch to one single column */
@media (max-width: 768px) {
    .layout-container {
        grid-template-columns: 1fr;
    }
}

/* Expandable Summary Block */
:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --accent: #00d4ff;
}

/* The Wrapper */
.summary-card {
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Custom Header (The Summary) */
.summary-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.3s;
}

.summary-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.summary-header h3 {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

/* The Chevron Icon */
.chevron {
    width: 20px;
    height: 20px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- THE MAGIC PART --- */
.summary-content-container {
    display: grid;
    grid-template-rows: 0fr;
    /* Closed state */
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-content-container.is-open {
    grid-template-rows: 1fr;
    /* Open state */
}

.summary-content-inner {
    overflow: hidden;
    /* Vital for the grid trick to work */
}

.summary-content-body {
    padding: 0 20px 20px 20px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Open State Styling */
.is-open+.chevron {
    transform: rotate(180deg);
}

.active-header .chevron {
    transform: rotate(180deg);
    filter: drop-shadow(0 0 5px var(--accent));
}
/* Carousel */
/* outer layout */
    .wrap{
      width: min(1200px, 98%);
      display:flex;
      gap:20px;
      /* allow children to stretch to same height */
      align-items: stretch;
      align-content: stretch;
    }

    /* carousel area */
    .carousel {
      flex: 1 1 65%;
      aspect-ratio: 16/9;
      position: relative;
      border-radius: 12px;
      overflow: hidden;
      background: linear-gradient(180deg,#07112255,#05101855);
      box-shadow: 0 10px 30px rgba(2,6,23,.7), inset 0 1px 0 rgba(255,255,255,.02);
      display:flex;
      align-items:center;
      justify-content:center;
      min-width: 300px;
      /* ensure a consistent min-height so the right panel matches reliably */
      min-height: 320px;
    }

    .slide {
      position:absolute;
      inset:0;
      display:flex;
      align-items:center;
      justify-content:center;
      transition: opacity 420ms cubic-bezier(.2,.9,.2,1), transform 420ms cubic-bezier(.2,.9,.2,1);
      opacity:0;
      transform: scale(.98);
      user-select:none;
      pointer-events:none;
      background: #000;
    }
    .slide.active{
      opacity:1;
      transform: scale(1);
      pointer-events:auto;
    }

    .slide img{
      width:100%;
      height:100%;
      object-fit:cover;
      display:block;
    }

    /* bottom overlay panel inside carousel */
    .panel {
      position:absolute;
      left:12px;
      right:12px;
      bottom:12px;
      display:flex;
      justify-content:space-between;
      gap:12px;
      align-items:center;
      z-index: 5;
    }

    .caption {
      background: rgba(2,6,23,.72);
      padding:10px 14px;
      border-radius:10px;
      font-size:14px;
      max-width:70%;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }

    .btn {
      display:inline-grid;
      place-items:center;
      width:44px;
      height:44px;
      border-radius:999px;
      background: rgba(0,50,0,.5);
      border: 2px solid rgba(255,255,255,.75);
      cursor:pointer;
      color:var(--accent);
    }

    .controls {
      display:flex;
      gap:8px;
      align-items:center;
    }

    .dots {
      display:flex;
      gap:8px;
      align-items:center;
    }

    .dot{
      width:10px;
      height:10px;
      border: 0;
      border-radius: 5px;
      background: rgba(0,0,0,.25);
      cursor:pointer;
    }

    .dot.active{
      transform: scale(1.3);
      background: var(--accent);
    }

    .hint{
      position:absolute;
      top:10px;
      left:12px;
      font-size:12px;
      color:var(--muted);
      background: rgba(2,6,23,.4);
      padding:6px 8px;
      border-radius:8px;
      z-index:5;
    }

    /* right info panel - MATCH HEIGHT */
    .info {
      flex: 0 0 360px;
      background: rgba(47, 165, 0, 0.498);
      border-radius: 12px;
      padding: 18px;
      display:flex;
      flex-direction:column;
      gap:12px;
      min-width:220px;
      box-shadow: 0 8px 20px rgba(0,0,0,.6);
      /* make the info panel stretch to the carousel's height */
      align-self: stretch;
      height: auto;         /* allow flex stretch to control height */
      overflow: hidden;     /* hide overflow at container level; internal desc scrolls */
    }

    .info .title {
      font-size:20px;
      line-height:1.15;
      margin:0;
      color: #fff;
    }
    .info .subtitle {
      font-size:13px;
      color: var(--muted);
      margin:0 0 8px 0;
    }
    .info .desc {
      font-size:15px;
      color: #dfeafb;
      margin:0;
      /* allow description to scroll if content is long */
      flex: 1 1 auto;
      overflow:auto;
      padding-right: 6px; /* room for scrollbar */
    }

    .meta {
      display:flex;
      gap:8px;
      align-items:center;
      justify-content:space-between;
      margin-top:6px;
    }

    .meta .badge {
      font-size:12px;
      color:var(--muted);
      background: rgba(255,255,255,.02);
      padding:6px 8px;
      border-radius:8px;
    }
    /* responsiveness */
    @media (max-width: 880px){
      .wrap{ flex-direction: column; align-items:stretch; }
      .carousel{ width:100%; aspect-ratio: 16/9; min-height: 240px; }
      /* when stacked vertically, let info auto-size under the carousel */
      .info { width:100%; flex: none; align-self: auto; border-radius:10px; }
    }
