:root {
  /* Tiers of Grey for Depth */
  --color-frame-bg: #1f2937;    /* Tier 1: Darkest (Header/Footer/Logo Area) */
  --color-rail-bg: #374151;     /* Tier 2: Dark (Sidebar) */
  --color-content-bg: #f3f4f6;  /* Tier 3: Light Grey (The "Stage") */
  
  /* Card & Element Layer */
  --color-card-bg: #ffffff;     /* Tier 4: Pure White (The "Floating" Doc) */
  --color-border: #e5e7eb;      
  
  /* Text & Accents */
  --color-text-on-dark: #f9fafb;
  --color-text-main: #111827;
  --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Base Layout */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  color: var(--color-text-main);
  font-family: system-ui, -apple-system, sans-serif;
}

/* --- HEADER & LOGO AREA --- */
header {
  width: 100%;
  background-color: var(--color-frame-bg);
  color: var(--color-text-on-dark);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
  z-index: 20;
}

.top-panel-container {
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.top-panel-table {
  border: none; 
  margin: 0 auto; 
  border-collapse: separate;
}

.logo {
  width: 110px; 
  display: flex; 
  justify-content: center; 
}

.logo img {
  max-height: 80px;
  width: auto;
}

.title-lines {
  display: flex;
  flex-direction: column;
  justify-content: center; 
  padding-left: 20px; /* Gap between logo and text */
}

.title-line-1 { font-size: 20px; opacity: 0.9; }
.title-line-2 { font-size: 28px; font-weight: bold; }

/* --- SIDEBAR & MAIN --- */
/* altered for mobile */
.layout-wrapper {
  display: flex;
  flex-grow: 1;
  align-items: stretch;
}

/* --- DESKTOP NAV PANEL --- */
#navig-rail-container {
  width: 260px;
  flex-shrink: 0;
  background-color: var(--color-rail-bg);
  border-right: 1px solid var(--color-border);
  
  /* Ensure it is visible on Desktop */
  display: block; 
  position: relative; 
  left: 0; 
  height: auto;
  z-index: 10;
}

.navig-rail-container__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem 0;
  list-style: none;
}

#navig-rail-container button {
  width: calc(100% - 2rem);
  margin: 0 1rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--color-text-on-dark);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

#navig-rail-container button.active {
  background-color: #3b82f6; 
  color: white;
}

#content-panel-container {
padding: 1.5rem; /* Tighter padding for small screens */
  background-color: var(--color-content-bg);
  flex-grow: 1;
  overflow-y: auto;
}

/* --- THE GALLERY GRID & CARDS --- */
/* Responsive Gallery Grid */
.doc-gallery {
  justify-items: center;
  display: grid !important;
  width: 100%;
  /* This creates the gap between cards (2.5rem = 40px) */
  gap: 2.5rem; 
  /* Standardises the columns */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  /* Ensures the grid starts from the left so gaps are visible */
  justify-content: start; 
  padding: 1rem 0;
  /* Using 1fr ensures even a single card (CV) stays within its grid track */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  box-sizing: border-box;
  margin: 0 auto;
}

.doc-card {
/* Ensure the card fills the grid cell but doesn't blow out */
  max-width: 320px; 
  
  /* Keep your existing elevation and background styles */
  background-color: var(--color-card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  
  /* Add a little bottom margin as a safety for vertical spacing */
  margin-bottom: 1rem; 
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Clips the image bottom */
  margin: 0;               /* Remove any auto-margins that might center/shrink it */
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    animation: cardFadeIn 0.4s ease-out;
}

.doc-card__preview {
width: 100%;
  /* This creates the 'window' height */
  height: 380px; 
  overflow: hidden;
  position: relative;

  /* This creates a consistent 'window' for all cards */
  aspect-ratio: 3 / 4; 
  background-color: #fff;
  border-bottom: 1px solid var(--color-border); 
}

.doc-card__preview img {
  width: 100%;
  height: 100%;
  /* MAGIC COMBO: 'cover' + 'top' preserves ratio and cuts the bottom */
  object-fit: cover; 
  object-position: top;
  display: block;
 
  /* Positions the image at the very top of the 'window' */
  position: absolute;
  top: 0;
  left: 0;
  
  /* Ensures no stretching occurs */
  object-fit: contain; 
  object-position: top;
}

.doc-card__title {
  font-family: "Georgia", serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0.5rem 0 1.5rem 0;
  flex-grow: 1; /* Pushes buttons to the bottom of the card */
}

.doc-card__actions {
  display: flex;
  gap: 10px;
}

.btn-view, .btn-download {
  height: 40px;
  border-radius: 6px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn-view { flex: 2; background-color: #4a6572; color: white; }
.btn-download { flex: 1.2; background-color: #6d8271; color: white; }

/* --- FOOTER --- */
footer {
  background-color: var(--color-frame-bg);
  color: var(--color-text-on-dark);
  padding: 1rem 2rem;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.1);
}

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

/* Hide hamburger by default (Desktop) */
.menu-toggle {
  display: none; 
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: var(--color-rail-bg);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
}

/* Show only on Mobile (Standard breakpoint) */
@media (max-width: 768px) {
  .menu-toggle {
    display: block; /* Show hamburger */
  }

  .doc-card {
    /* This OVERRIDES the 320px so the card fills the phone screen */
    max-width: 100%; 
    
    /* Optional: reduce padding so the image can be larger on small screens */
    padding: 1rem; 
  }
  
  .doc-gallery {
    /* Switch to a single column so cards aren't squished side-by-side */
    grid-template-columns: 1fr; 
    gap: 1.5rem;
  }

  @media (max-width: 768px) {
  #navig-rail-container {
    /* 1. Hide it off-screen to the left */
    position: fixed;
    left: -280px; 
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 90;
    
    /* 2. Smooth Slide Animation */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 20px rgba(0,0,0,0.2);
  }

  /* 3. The "Show" State (Triggered by JS) */
  #navig-rail-container.mobile-open {
    left: 0;
  }
}
}

