/* Import Google Fonts */
/* barlow-semi-condensed-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/barlow-semi-condensed-v16-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* barlow-semi-condensed-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/barlow-semi-condensed-v16-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* space-mono-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/space-mono-v17-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* space-mono-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/space-mono-v17-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* space-grotesk-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/space-grotesk-v22-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* space-grotesk-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/space-grotesk-v22-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

:root {
    /* Font Variables */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-data: 'Barlow Semi Condensed', sans-serif;
    --font-mono: 'Space Mono', monospace; /* <--- ADD THIS */
    --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-color: #0284c7;
    /* Use this for effects requiring opacity (shadows, glows) 
     Calculated from #0284c7 -> 2, 132, 199 */
    --accent-rgb: 2, 132, 199;
    --border-color: #e2e8f0;
    --table-header: #f1f5f9;
    --badge: #e2e8f0;
    --badge-inv: #475569;
}
/* Automatically switch variables if System is set to Dark */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --card-bg: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --accent-color: #38bdf8;
        /* The RGB (for transparent shadows/glows) */
        --accent-rgb: 56, 189, 248;
        --border-color: #334155;
        --table-header: rgba(15, 23, 42, 0.5);
        --badge: #475569;
        --badge-inv: #e2e8f0;
    }
}
h1 {
    font-family: var(--font-heading);

}
body {
    font-family: var(--font-body);
    background: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    /* Add these two lines */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

header h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.controls {
    display: flex;
    gap: 10px;
    white-space: nowrap;    
    align-items: center;
}
.card.controls{
    padding: 10px;
    margin-bottom: 0px;
}
/* Cards & Sections */
.card {
    background: var(--card-bg);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;  
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.title {
  align-items: center;
  display: flex;
  justify-content: center;
  gap: 5px;
}
/* Specific Components */
.stat-box {
    flex: 1;
    background:  var(--card-bg);    
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;  
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    min-width: 150px;
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease;

}

.stat-box:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.stat-val { 
  font-family: var(--font-data);
  font-size: 1.5rem; 
  font-weight: 700;
  margin: 5px 0;   
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-label {   
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-sub {   
  font-family: var(--font-data);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chart-box {
    height: 300px; /* Essential for Chart.js */
    width: 100%;
}

.nav-chart-box {
    height: 50px; /* Essential for Chart.js */
    width: 100%;
    background-color: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 5px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}
.right { text-align: right; }

/* Utilities */
.loading {
    background:  var(--card-bg); padding: 20px; text-align: center; border: 1px solid var(--border-color);
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.hidden { display: none; }

.region.mobile {
  display: none;
}

.sector.mobile {
  display: none;
}
.name-break {
  display:none;
}

.value.mobile {
  display: none;
}
.separator {
  opacity: 0.3;
}
.mobile {  
  font-size: 0.75rem;
  color: var(--text-secondary);
}
th {
  font-family: var(--font-heading);
}
.name {
  margin-left:2px;
  font-family: var(--font-heading);
}
td.value {
  font-family: var(--font-mono);
  font-size: 0.75rem; /* Monospace tends to look slightly larger; adjust as needed */
  letter-spacing: -0.05em; /* Space Mono is wide; this tightens it up for tables */
}
td.sector{
  font-family: var(--font-body);
  font-size: 0.75rem;
}
td.subsector{
  font-family: var(--font-body);
  font-size: 0.75rem;
}
td.amount {
  font-family: var(--font-mono);
  font-size: 0.9rem; /* Monospace tends to look slightly larger; adjust as needed */
  letter-spacing: -0.05em; /* Space Mono is wide; this tightens it up for tables */
}
h3 {
  font-family: var(--font-heading);
}
tr {
  position: relative;
}
tr:hover {
    /* 1. Background Change */
    background-color: var(--table-header); 
}
.row-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  border-bottom: 0px;
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  flex-direction: column;
}
footer code {
  font-family: var(--font-mono);
  color: #f06292 !important;
  background: rgba(240, 98, 146, 0.08);
    background-color: rgba(240, 98, 146, 0.08);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  word-break: break-all;
  max-width: 90%;
  transition: background 0.2s ease;
}
/* Link Styles */
a {
    color: var(--accent-color);
    text-decoration: none;
    /* Create a smooth invisible border for hover states */
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

a:hover {
    /* On hover, the underline fades in nicely */
    border-bottom-color: var(--accent-color);
    opacity: 0.9;
}

a:active {
    opacity: 0.7;
    transform: translateY(1px); /* Subtle press effect */
}

/* Optional: Neutral Links for Headers */
/* Prevents your main title from looking like a data link */
header a {
    color: var(--text-primary);
    border-bottom: none;
}

header a:hover {
    color: var(--accent-color);
}

@media (max-width: 975px) {
    .subsector {
        display: none;
    }
    
}

@media (max-width: 900px) {
    .sector {
        display: none;
    }
    
    .sector.mobile {
      display: inline;
    }
    .subsector.mobile {
      display: inline;
    }
}

@media (max-width: 825px) {
    .region {
        display: none;
    }
    
    .region.mobile {
      display: inline;
    }
}
@media (max-width: 775px) {
    .value {
        display: none;
    }
    .controls {
      order:1 ;
      flex-grow: 1;
      margin-top: 10px;
    }
}
@media (max-width: 700px) {
  .name-break {
    display:inline;
  }

}
/* --- Profile Page Additions --- */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.badges {
    display: flex;
    gap: 8px;
    margin-top: 5px;
      flex-wrap: wrap;
}

.badge-gray {
    background: var(--badge);
    color: var(--badge-inv);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.description {
    margin-top: 15px;
    color: var(--text-primary);
}


/* Helper for negative numbers in table */
.negative { color: #ef4444; }
.positive { color: #10b981; }
.back-link {
    text-decoration: none;
    color: var(--accent-color);
      letter-spacing: 0.05em;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: var(--font-data);
    text-transform: uppercase;
}


select {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  width: 100%;
  font-family: var(--font-data);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-primary);
  transition: border-color 0.3s;
}
/* The Active Class */
.glowing {
  /* Solid border using the Hex variable */
  border-color: var(--accent-color);
  animation: pulse-accent 2s infinite;
}

/* The Animation */
@keyframes pulse-accent {
  0% {
    /* 70% opacity using the RGB variable */
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.7);
  }
  70% {
    /* Fade out to 0% opacity */
    box-shadow: 0 0 0 10px rgba(var(--accent-rgb), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0);
  }
}

