/* ==========================================================================
   1. VARIABLES & ROOT
   ========================================================================== */
:root {
  --left-width: 180px;
  --right-width: 200px;
  --site-width: 1200px;
  --header-height: 64px;

  /* Typography */
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Montserrat', system-ui, sans-serif;
  --text-base: 16px;
  --text-scale: 1.25;

  /* Spacing */
  --space-x: -0.5rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
}

@font-face {
  font-family: 'Montserrat';
  src: url('/fonts/montserrat-v31-latin-600.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2');
  font-display: swap;
}


/* ==========================================================================
   2. BASE STYLES
   ========================================================================== */
html {
  scrollbar-width: none;
  scroll-behavior: smooth;
  overflow-y: auto;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: #111;
}

p, ul, ol {
  margin-bottom: var(--space-md);
}

ul {
  padding-left: 1.2rem;
}

hr {
  border: none;
  border-top: 1px solid #e6e6e6;
  width: auto;
  margin: var(--space-xl) auto;
}

/* ==========================================================================
   3. TYPOGRAPHY (Headings)
   ========================================================================== */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  scroll-margin-top: calc(var(--header-height) + 16px);
}

h1 {
  font-size: calc(var(--text-base) * var(--text-scale) * var(--text-scale));
  margin-top: var(--space-xs);
  margin-bottom: var(--space-md);
}

h2 {
  font-size: calc(var(--text-base) * var(--text-scale));
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

h3 {
  font-size: calc(var(--text-base) * 1.1);
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
}

h4 {
  font-size: var(--text-base);
  margin-top: var(--space-sm);
  margin-bottom: var(--space-xs);
}

a {
  color: #FF5349;
}
a:active{
  color: #84D574;
}

/* Target the Hugo/Static auto-generated ID directly */
.page-outline #TableOfContents {
    display: block;             /* Ensure it's a block-level element */
    max-height: 60vh;           /* Constrain the visible height */
    overflow-y: auto;           /* Trigger the internal scroll */
    padding-right: 10px;        /* Space for the new scrollbar */
    
    /* Zero Noise Scrollbar for Firefox */
    scrollbar-width: thin;
    scrollbar-color: #d6d6d6 transparent; 
}

/* High-Resolution Scrollbar for Chrome/Safari/Edge */
#TableOfContents::-webkit-scrollbar {
    width: 3px;                 /* Precision thinness */
}

#TableOfContents::-webkit-scrollbar-thumb {
    background-color: #efefef;   /* Your Recursive Blue */
    border-radius: 10px;
}

#TableOfContents::-webkit-scrollbar-track {
    background: transparent;    /* Keep the background invisible for Zero Noise */
}


/* ==========================================================================
   4. LAYOUT COMPONENTS
   ========================================================================== */

/* Main Shell */
.layout {
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr) var(--right-width);
  min-height: 100vh;
  max-width: var(--site-width);
  margin: 0 auto;
  padding-top: var(--header-height);
}

.left, .right {
  padding: 16px 12px;
  height: fit-content;
}


.center {
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
  overflow: visible;
}

/* Header & Logo */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #fff;
  z-index: 1000;
  border-bottom: 1px solid #e6e6e6;
}

.header-inner {
  max-width: var(--site-width);
  margin: 0 auto;
  padding: 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between; /* 🔑 left + right */
}


.logo a {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #000;
}
.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.header-meta .brand-domain {
  font-size: 0.7rem;
  color: #666;
}

.header-meta .brand-tagline {
  font-size: 0.7rem;
  color: #888;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .header-meta {
    display: none;
  }
}



/* ==========================================================================
   5. NAVIGATION (Global & Nested)
   ========================================================================== */
.nav-global {
  font-family: var(--font-body);
  font-size: 0.9rem;
  position: sticky;
  top: 96px;
}

.nav-global ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-global ul li {
  padding-top: 5px;
}
.nav-global a {
  text-decoration: none;
  color: #444;
  transition: color 0.2s;
}

.nav-global a:hover {
  text-decoration: underline;
}

/* Active States */
.nav-global ul.active > a {
  font-weight: 600;
  color: #FF5349;
}

.nav-global ul li.active > a {
  font-weight: 600;
  color: #FF5349;
}

.nav-global li.active::before {
  content: "→";
  margin-right: 6px;
  color: #999;
}

/* Nested Navigation */
.nav-global li > ul,
.nav-global details ul {
  margin-top: var(--space-xs);
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid #e6e6e6;
}

.nav-global li > ul a {
  font-size: 0.85rem;
  color: #555;
}

/* Summary / Details Specifics */
summary {
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

.nav-global summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.nav-global .arrow {
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-right: 1.5px solid #666;
  border-bottom: 1.5px solid #666;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

details[open] .arrow {
  transform: rotate(-135deg);
}

/* ==========================================================================
   6. PAGE OUTLINE (Right Sidebar)
   ========================================================================== */
.page-outline {
  font-size: 0.8rem;
  line-height: 1.6;
  color: #666;
  position: fixed;
  width: 200px;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  overflow-x: hidden;
  align-self: stretch;   /* 🔑 NOT start */
}

.page-outline-root {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 0.75rem;
  padding-top: 0.25rem;
}

.page-outline ul {
  list-style: none;
  padding: 0;
  margin: 0;
  scrollbar-width: thin;
}

.page-outline li {
  margin-bottom: 0.5rem;
}

.page-outline a {
  text-decoration: none;
  color: inherit;
}

.page-outline a:hover {
  color: #000;
}

.page-outline ul ul {
  display: none; /* Hides h3+ levels */
}

/* ==========================================================================
   7. INTERACTIVE ELEMENTS (Back to Top)
   ========================================================================== */
#back-to-top {
  display: none;
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 99;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border: 1px solid #0e0e0e;
  background-color: #ffffff;
  color: #000;
  cursor: pointer;
  border-radius: 20px;
}

#back-to-top:hover {
  background-color: #0e0e0e;
  color: #fff;
  transition: all 0.3s;
}

/* ==========================================================================
   8. MEDIA QUERIES
   ========================================================================== */

/* Tablets / Small Desktops */
@media (max-width: 1024px) {
  :root{
      --header-height: 58px;
  }
  .layout {
    grid-template-columns: 1fr;
  }

  .right {
    display: none;
  }

  /* Mobile Nav Logic */
  .mobile-nav-toggle {
    display: block;
    position: fixed;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 1300;
  }

  .nav-global {
    position: fixed;
    top: calc(var(--header-height) - 5px);
    right: 0;
    width: 100vw;
    height: calc(100vh - var(--header-height));
    margin: 0;
    background: #f7f7f7;
    transform: translateX(100%); 
    transition: transform 0.25s ease;
    z-index: 1200;
  }

/* Restoring Coherence to the Sub-menu */
.nav-menu ul li ul li {
    font-size: 1rem !important; /* Adjust this to match the 'Physics' font size exactly */
    line-height: 1.5;
    font-weight: 400; /* Keeps it clean and non-aggressive */
    padding-left: 10px; /* Maintains the structural indentation */
    -webkit-text-size-adjust: 100%; /* Prevents mobile browsers from auto-inflating the font */
}  
  .nav-global.open {
    transform: translateX(0); /* Note: Usually 'open' would be translateX(0) if it starts off-screen */
    pointer-events: auto;  
  }

  .nav-global ul {
    min-width: 250px;
     padding: 0 26px;
   margin-left: -90vw;
  }

  .nav-global ul ul {
    margin: 0px 0 0 0;
    padding-left: 12px;
    padding-top: 2px;
    overflow-y: auto;
  overflow-x: hidden;
  }
  .nav-global ul li {
    margin-left: 0;
    padding-top: 5px;
  }

  .nav-global summary {
    width: 175px;
  }
  .header-meta {
    display: none;
  }
}

/* Mobile Devices */
@media (max-width: 640px) {
  :root {
    --text-base: 17.5px;
    --text-scale: 1.3;
  }

  .header-inner {
    padding: 14px 20px;
  }

  .logo a {
    font-size: 1.15rem;
  }

  .center {
    padding: 24px 20px;
  }

  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.15rem; }

  p, ul, ol {
    margin-bottom: 1.4rem;
  }

  hr {
    width: 70%;
    margin: 3rem auto;
  }
}

/* Architect page */
.architect-header {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: center;
  margin: 48px 0 64px;
}

.architect-photo img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
}

.architect-name {
  font-size: 1.6rem;
  margin: 0;
}

.architect-role {
  margin: 6px 0;
  font-weight: 500;
}

.architect-location {
  margin: 0 0 12px;
  color: #666;
}

.architect-social a {
  margin-right: 16px;
  text-decoration: none;
  font-size: 0.9rem;
}

.architect-social a:hover {
  text-decoration: underline;
}

/* Mobile */
@media (max-width: 768px) {
  .architect-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .architect-photo img {
    margin: 0 auto;
  }

  .architect-social {
    justify-content: center;
  }
}


/* Dynamic grid for articles */

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 11px;
}

.article-tile {
  display: block;
  padding: 15px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  text-decoration: none;
  background: #fff;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.article-tile:hover {
  border-color: #999;
  transform: translateY(-2px);
}

.article-tile h3 {
  font-size: 1rem;
  line-height: 1.4;
  margin: 0 0 12px;
  /* color: #FF5349; */
  color:#000;
}

.article-domain {
  display: block;
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 6px;
}

.article-date {
  font-size: 0.7rem;
  color: #999;
}

.article-tile {
  display: flex;
  flex-direction: column;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
}

.article-thumb img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.article-meta {
  padding: 16px;
}

.article-meta h3 {
  font-size: 0.95rem;
  margin: 0 0 8px;
  line-height: 1.4;
}

.article-date {
  font-size: 0.7rem;
  color: #999;
}

/* Article controls */
.article-controls {
  display: flex;
  gap: 15px;
  margin: 0px 0;
  align-items: center;
}
.article-controls p {
  font-size: 0.85rem;
}

.article-controls input[type="date"] {
  font-size: 0.9rem;
  border: none;
}

.article-controls button {
  font-size: 0.85rem;
  background: none;
  border: 1px solid #ccc;
  padding: 4px 8px;
  cursor: pointer;
}

/* case controls */
.case-controls {
  display: flex;
  gap: 15px;
  margin: 0px 0;
  align-items: center;
}
.case-controls p {
  font-size: 0.85rem;
}

.case-controls input[type="date"] {
  font-size: 0.9rem;
  border: none;
}

.case-controls button {
  font-size: 0.85rem;
  background: none;
  border: 1px solid #ccc;
  padding: 4px 8px;
  cursor: pointer;
}

/* =========================
   Case Study Cover Image
   ========================= */

.doc-cover-image {
  display: block;
  max-width: 750px;
  width: 100%;
  height: auto;
  margin: 0 0 2rem 0;
}

/* Mobile override */
@media (max-width: 768px) {
  .doc-cover-image {
    max-width: 100%;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}


/* Table formatting */
/* 1. Add Neat Spacing (Padding) */
table {
  width: 100%;
  border-collapse: collapse; /* Merges borders for a sleek look */
  margin: 20px 0;
  font-family: sans-serif;
}

th, td {
  padding: 15px 20px; /* Generous padding for "Maturity" */
  text-align: left;
  border-bottom: 1px solid #eee;
}

/* 2. Style the Header */
th {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #333;
}

/* 3. Alternate Row Colors (Zebra Striping) */
tr:nth-child(even) {
  background-color: #f2f2f2; /* Light grey for every second row */
}

/* 4. Hover Effect (Optional but looks great) */
tr:hover {
  background-color: #e9ecef;
  transition: background-color 0.2s ease;
}

@media screen and (max-width: 600px) {
  /* 1. Force the table to not behave like a table */
  table, thead, tbody, th, td, tr {
    display: block;
  }

  /* 2. Hide the header row (but keep it for screen readers) */
  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 8px; /* Matches your card style */
    overflow: hidden;
  }

  td {
    /* 3. Make each cell act like a row */
    border: none;
    border-bottom: 1px solid #eee;
    position: relative;
    padding-left: 0% !important; /* Push text to the right */
    text-align: center !important;
    padding-top: 18px !important;
  }

  td::before {
    /* 4. Add the labels back manually using data attributes */
    position: absolute;
    left: 0;
    width: 100%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: center;
    font-weight: bold;
    content: attr(data-label); /* Pulls the header name */
  }
}

/* Fraud pipeline container */
.pipeline-container {
  font-family: sans-serif;
  max-width: 900px;
  margin: 20px auto;
  padding: 20px;
  background: #fff;
}

.pipeline-flex {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-top: 30px;
}

/* Funnel Styling */
.funnel-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.funnel-tier {
  height: 40px;
  margin-bottom: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  font-weight: bold;
  color: #333;
  clip-path: polygon(0% 0%, 100% 0%, 90% 100%, 10% 100%);
}

.funnel-tier-point {
  height: 40px;
  clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

/* Steps Text Styling */
.pipeline-steps {
  flex: 1;
  text-align: center;
}

.step {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.figure-caption {
  text-align: center;
  font-size: 13px;
  color: #666;
  margin-top: 20px;
}

/* --- MOBILE RESPONSIVENESS --- */
@media screen and (max-width: 600px) {
  .pipeline-flex {
    flex-direction: column; /* Stacks funnel above text */
    gap: 20px;
  }
  
  .pipeline-steps {
    text-align: center; /* Centers text for easier reading on phones */
  }
  
  .funnel-tier {
    height: 30px; /* Slimmer tiers for small screens */
    font-size: 10px;
    width: 50%;
  }

  /* We override the inline widths (100%, 85%, etc.) to make the funnel less 'sharp' on mobile */
  .funnel-tier[style*="width: 100%"] { width: 80vw !important; }
  .funnel-tier[style*="width: 85%"]  { width: 70vw !important; }
  .funnel-tier[style*="width: 70%"]  { width: 60vw !important; }
  .funnel-tier[style*="width: 55%"]  { width: 50vw !important; }
  .funnel-tier[style*="width: 40%"]  { width: 40vw !important; }
  .funnel-tier[style*="width: 25%"]  { width: 30vw !important; }
  
  .funnel-tier-point {
    width: 20% !important; /* Keeps the bottom point from being too thin */
  }

  .pipeline-steps {
    width: 100%;
    padding: 0 10px;
  }
}

/* =========================
   Long Heading Safety
   ========================= */

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}
/* NDCIL Diagram */
/* Ensure the parent container is a flexbox to force true horizontal centering */
.ndcil-container {
  display: flex;
  flex-direction: column;
  align-items: center; /* This is the magic for horizontal centering */
  text-align: center;
  padding: 40px 0; /* Remove side padding to give orbit more room */
  background: #fff;
  overflow: hidden; /* Prevents labels from creating a horizontal scrollbar */
  width: 30vw;
}

.ndcil-orbit-wrapper {
  position: relative;
  width: 300px; /* Slightly smaller to ensure labels fit on screen */
  height: 300px;
  margin: 80px auto; /* Auto margins are the 'Maturity' way to center blocks */
  border: 1px solid #ddd;
  border-radius: 50%;
  /* This ensures the coordinate system starts exactly in the middle */
  display: block; 
}

/* The Central Core */
.ndcil-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  background: #f0f0f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.core-text {
  font-size: 11px;
  line-height: 1.2;
  padding: 10px;
}

.core-text strong { font-size: 18px; color: #333; }

/* The Satellite Nodes */
.node {
  position: absolute;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* Positioning Nodes around the circle */
.social    { top: 0%;   left: 50%; background: #ff3b30; }
.ecommerce { top: 25%;  left: 93%; background: #34aadc; }
.protection{ top: 75%;  left: 93%; background: #4cd964; }
.domain    { top: 100%; left: 50%; background: #000000; }
.payment   { top: 75%;  left: 7%;  background: #5856d6; }
.logistics { top: 25%;  left: 7%;  background: #ff9500; }

/* Labels for Nodes */
.node::after {
  content: attr(data-label);
  position: absolute;
  width: 120px;
  font-size: 12px;
  font-weight: bold;
  color: #444;
}
.disclaimer-box {
  background-color: #f9f9f9;
  border-left: 3px solid #333; /* A strong architectural line */
  padding: 15px 20px;
  margin: 20px 0;
  font-style: italic;
  font-size: 0.95rem;
  color: #555;
}
/* Label Positioning */
.social::after    { bottom: 45px; left: -40px; }
.ecommerce::after { left: 45px; top: 10px; text-align: left;}
.protection::after{ left: 45px; top: 10px; text-align: left;}
.domain::after    { top: 45px; left: -40px; }
.payment::after   { right: 45px; top: 10px; text-align: right;}
.logistics::after { right: 45px; top: 10px; text-align: right;}

/* --- MOBILE RESPONSIVE --- */
@media screen and (max-width: 600px) {
  .ndcil-container {
    width: 90vw !important; /* Force it to use almost full width on mobile */
    max-width: none;        /* Remove any restrictions */
    padding: 20px 0;
  }
  .ndcil-orbit-wrapper {
    width: 100%;
    height: auto;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    padding: 0 5px;
    transform: scale(0.9);/* Slightly shrink the circle if it hits the edges */
  }

  .ndcil-core {
    position: relative;
    top: 0; left: 0;
    transform: none;
    margin-bottom: 20px;
  }

  .node {
    position: relative;
    top: 0 !important;
    left: 0 !important;
    transform: none;
    width: 100%;
    height: 50px;
    border-radius: 8px; /* Changes circles to cards on mobile */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
  }

  .node::after {
    position: static;
    color: white;
    width: auto;
    text-align: center !important;
  }
}
/* 2. TABLET / SMALL LAPTOP VIEW (Between 769px and 1024px) */
/* This is where your '30vw' usually breaks because the screen is too narrow */
@media screen and (max-width: 1024px) {
  .ndcil-container {
    width: 60vw !important; /* Give it double the space so labels don't clip */
  }
  .ndcil-orbit-wrapper {
    transform: scale(0.9); /* Slight shrink to keep satellite nodes safe */
  }
}

/* 3. MOBILE VIEW (768px and below) */
@media screen and (max-width: 768px) {
  .ndcil-container {
    width: 95vw !important; /* Almost full width for the phone */
    padding: 20px 0;
  }
  
  /* On very small phones, we shrink the circle or stack it */
  .ndcil-orbit-wrapper {
    transform: scale(0.8); 
    margin: 40px auto; 
  }

  /* Optional: If the labels still overlap on mobile, 
     you can reduce font size here */
  .node::after {
    font-size: 10px !important;
    width: 80px !important;
  }
}

/* =========================
   Case Study banner Images
   ========================= */

.case-banners {
  display: block;
  max-width: 750px;
  width: 100%;
  height: auto;
  margin: 0 0 2rem 0;
}

/* Mobile override */
@media (max-width: 768px) {
  .case-banners {
    max-width: 100%;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}

/* =========================
   EP Diagrams
   ========================= */

.ep-diagrams {
  display: block;
  max-width: 350px; 
  width: 100%;
  height: auto;
  margin: 0 0 2rem 0;
  padding: 0 10rem;
}

/* Mobile override */
@media (max-width: 768px) {
  .ep-diagrams {
    max-width: 100%;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
      padding: 0 0rem;
  }
}

.formulas p {
  font-family: "Latin Modern MAth", serif;
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
  color: #FF5349;
}

/* Mobile override */
@media (max-width: 768px) {
.formulas p {
  font-size: 1rem;
}
}

/* Frameworks classfications */

sup.model {
  color: #FF5349;
}
sup.principles {
 color: #7A5CFA;
}
sup.diagnostics {
  color: #F4B400;
}
sup.protocol {
  color: #1E88E5;
}
sup.architecture {
  color: #2E7D32;
}
sup.signal {
  color: #ffa91f;
}