/* -------------------------------------------------------------------------- */
/*  FONTS                                                                     */
/* -------------------------------------------------------------------------- */

@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* -------------------------------------------------------------------------- */
/*  VARIABLES                                                                 */
/* -------------------------------------------------------------------------- */

:root {
  --desk-bg: #161616;
  --paper-bg-light: #f4e5d7;
  --paper-bg-dark: #ecddd0;
  --text-primary: #1f1f1f;
  --text-secondary: #fdfcf8;
  --text-muted: #555555;
  --text-accent: #a93004;
  --button-bg: #7d240d;
  --border-primary: #2c2724;
  --border-thin: rgba(48, 48, 46, 0.426);
  --paper-max-width: 900px;
}

/* -------------------------------------------------------------------------- */
/*  BASE RESET                                                                */
/* -------------------------------------------------------------------------- */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: subpixel-antialiased;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

body.desk {
  background-color: var(--desk-bg);
  font-family: "Inter", system-ui, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* THE DESK TEXTURE (Fixed Viewport) */
.desk-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: none; /* Hide on mobile */
  background-image: url("../images/bg-brut-hd.avif");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

@media (min-width: 1921px) {
  .desk-background {
    background-image: url("../images/bg-brut-4k.avif");
  }
}

@media (min-width: 768px) {
  .desk-background {
    display: block;
  }
}

/* THE PAPER (Scrollable Content) */
.paper-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  min-height: 100vh;
}

.paper {
  background-color: var(--paper-bg-light);
  padding: 0;
  line-height: 1.7; /* Increased for academic readability */
  position: relative;
  overflow: hidden; /* Contain shader overlays */
}

/* THE SHADER: (BaseColor + Noise) * LightMap */
/* We use high z-index overlays to ensure texture covers all child sections */
.paper::before,
.paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

/* LAYER 1: THE NOISE (Grain) */
.paper::before {
  background-image: url("../images/noise.avif");
  background-repeat: repeat;
  opacity: 0.04;
  mix-blend-mode: multiply;
}

/* LAYER 2: THE LIGHT (Vignette/LightMap) */
.paper::after {
  background-image: radial-gradient(
    circle at 50% 50%, 
    rgba(255, 255, 255, 0.103) 0%, 
    rgba(0, 0, 0, 0.05) 100%
  );
  z-index: 101;
}

/* Content container */
.paper > * {
  position: relative;
  z-index: 3;
}

.paper .nav-section {
  z-index: 10; /* Keep nav on top */
}

.paper > *:not(.nav-section) {
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

@media (min-width: 768px) {
  .paper > *:not(.nav-section) {
    padding-left: 5rem;
    padding-right: 5rem;
  }
}

p {
  margin-bottom: 1.5rem;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-align: justify;
  text-justify: inter-word;
}

/* State C: Desktop / Tablet Landscape */
@media (min-width: 768px) {
  body.desk {
    padding: 1.5rem 0;
  }

  .paper {
    width: 100%;
    max-width: var(--paper-max-width);
    min-height: calc(100vh - 6rem);
    margin: 0 auto;
    /* padding: 4rem 5rem; */
    /* Physical Depth Shadow */
    box-shadow: 
      0 1px 2px rgba(0,0,0,0.05), /* Tiny contact shadow */
      0 10px 40px rgba(0,0,0,0.1); /* Deep ambient shadow */
    /* Micro-Border (The Cut Edge) */
    border: 1px solid rgba(0,0,0,0.08); /* The physical edge */
  }
}

/* -------------------------------------------------------------------------- */
/*  GLOBAL NAVIGATION (Semantic CSS Grid Area)                               */
/* -------------------------------------------------------------------------- */

.nav-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "brand menu";
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem; /* Balanced padding with full-bleed coverage */
  border-bottom: 1px solid var(--border-thin);
  background-color: var(--paper-bg-dark);
}

/* Base Areas */
.nav-brand { 
  grid-area: brand; 
  justify-self: start; 
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 1.35rem; /* Slightly refined size for sophistication */
  text-decoration: none;
  color: oklch(76.9% 0.188 70.08); /* Warm gold */
  padding: 0.55rem 1.2rem 0.65rem; /* Offset bottom padding to fix serif baseline visual imbalance */
  background-color: var(--text-primary);
  border-radius: 0.15em;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  line-height: 1;
  letter-spacing: 0.03em;
}

.nav-brand:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background-color: #333;
}

.nav-brand:active {
  transform: translateY(-1px) scale(0.98);
}

.menu-label { 
  grid-area: menu;  
  justify-self: end; 
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.6rem 1.2rem; /* Uniform with desktop buttons */
  border: 1.5px solid var(--text-primary);
  border-radius: 0.15em;
  color: var(--text-primary);
  cursor: pointer;
  width: 75px;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-label:hover {
  background: var(--text-primary);
  color: var(--paper-bg-dark);
}

.menu-label:active {
  transform: scale(0.95);
}

.menu-label::after { content: "MENU"; }
.menu-checkbox:checked ~ .menu-label::after { content: "CLOSE"; }

.nav-services   { grid-area: services; }
.nav-about      { grid-area: about; }
.nav-contact    { grid-area: contact; }

.menu-checkbox { display: none; }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: transparent;
  cursor: default;
}

.menu-checkbox:checked ~ .nav-overlay {
  display: block;
}

.nav-item {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  transition: all 0.3s ease;
}

.nav-item:hover { color: var(--text-primary); }

/* Mobile Implementation */
@media (max-width: 767.98px) {
  .nav-section {
    position: relative; /* Context for our absolute overlay */
  }

  .menu-label { 
    display: block; 
    z-index: 60;
    position: relative;
  }

  .nav-menu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0rem 2.7rem 0.5rem 2.7rem;
    z-index: 50;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 
      "services about"
      "contact contact";
    gap: 1rem;
    background-color: var(--paper-bg-dark);
    border-bottom: 1px solid var(--border-thin);
  }

  .menu-checkbox:checked ~ .nav-menu {
    display: grid;
  }

  .nav-item {
    display: block; 
  }

  /* Mobile Alignment */
  .nav-services { justify-self: start; text-align: left; }
  .nav-about, .nav-contact      { justify-self: end; text-align: right; }
}

/* Desktop Implementation (5 columns, 1 row) */
@media (min-width: 768px) {
  .nav-menu {
    display: contents;
  }

  .nav-section {
    grid-template-columns: repeat(4, 1fr);
    grid-template-areas: "brand services about contact";
    padding: 1.5rem 2rem;
  }

  .menu-label { display: none !important; }

  .nav-item {
    display: block !important;
  }

  /* Desktop Alignment */
  .nav-brand         { justify-self: start; text-align: left; }
  .nav-services  { justify-self: end;   text-align: right; }
  .nav-about     { justify-self: center; text-align: center; }
  .nav-contact { 
    justify-self: end; 
    text-align: right;
    background: var(--text-primary);
    color: var(--paper-bg-light);
    padding: 0.6rem 1.2rem; /* Unify with brand and menu */
    border-radius: 0.15em;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  }

  .nav-contact:hover {
    background: #333; /* Slightly lighter than var(--text-primary) */
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: var(--paper-bg-light);
  }

  .nav-contact:active {
    transform: translateY(-2px) scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* -------------------------------------------------------------------------- */
/*  HERO ESTHETICS                                                          */
/* -------------------------------------------------------------------------- */

.hero-section {
  padding: 5rem 0;
  text-align: center;
  text-align-last: center;
  border-bottom: 1px solid var(--border-thin);
  background-color: var(--paper-bg-light);
}

.metadata {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.70rem;
  font-weight: 700;
  display: flex;
  justify-content: center;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.title {
  display: flex;
  flex-direction: column;
  font-family: "Playfair Display", serif;
  font-size: 3.2rem;
  line-height: 0.8;
  font-weight: 700;
  margin: 0 auto 1.5rem auto;
  align-items: center;
  max-width: 90%;
}

.title-highlight {
  color: var(--text-accent);
  font-size: 1.4rem;
  margin: 0.5rem 0 0 0;
  padding: 0;
}

.subtitle {
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  max-width: 80%;
  margin: 0 auto;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-align: justify;
  text-justify: inter-word;
}

.dropcap {
  font-size: 1.2rem;
}

.dropcap::first-letter {
  font-family: "Playfair Display", serif;
  float: left;
  font-size: 4.5rem;
  line-height: 1;
  padding-right: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-title {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--border-thin);
  padding: 0.5rem 0;
  margin: 0 0 2rem;
  font-weight: 700;
}

/* SERVICES SECTION */

.services-section {
  padding-top: 5rem;
  padding-bottom: 5rem;
  background-color: var(--paper-bg-dark);
  border-bottom: 1px solid var(--border-thin);
}

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
}

.service-item {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.15); /* Subtle "tucked-in" card look */
  border: 1px solid var(--border-thin);
  height: 100%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.service-item:hover,
.service-item:active {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.service-item:active {
  transform: translateY(-2px) scale(0.98);
  transition: transform 0.1s ease;
}

.service-item h3 {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(0,0,0,0.1); /* Subtle rule under header */
}

.service-item p {
  font-family: "Inter", sans-serif;
  font-size: 0.80rem;
  line-height: 1.5;
  color: var(--text-primary); /* Darker for readability */
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .services-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 
      "risk resilience"
      "governance intelligence";
    gap: 2rem; 
  }

  .service-risk { grid-area: risk; }
  .service-resilience { grid-area: resilience; }
  .service-governance { grid-area: governance; }
  .service-intelligence { grid-area: intelligence; }

  .service-item {
    padding: 2.5rem;
  }
}

@media (max-width: 767.98px) {
  .service-item {
     /* Ensuring cards are distinct on mobile */
     border-color: rgba(0, 0, 0, 0.1);
  }
}

.details-link {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  background-color: #1c1c1c;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--text-primary);
  letter-spacing: 0.1em;
  transition: all 0.2s ease;
  margin-top: auto; /* Push to bottom for symmetry */
  align-self: flex-start;
}

.details-link:hover {
  background: var(--text-primary);
  color: var(--paper-bg-light);
}


/* ABOUT SECTION */

.about-section {
  padding-top: 8rem; /* Increased for better visual breathing room */
  padding-bottom: 5rem;
  background: var(--paper-bg-light);
  border-bottom: 1px solid var(--border-thin);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

.about-image {
  margin: 0;
  width: 100%;
  border: 1px solid var(--text-primary);
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
  color: var(--text-primary);
}

.about-subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: -0.015rem;
  color: var(--text-accent);
  margin-bottom: 0.5rem;
}

.about-title {
  font-family: "Playfair Display", serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: -0.015rem;
}

.about-content p {
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0;
  padding-bottom: 1.5rem;
  text-align: left;
}

@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-items: stretch;
  }

  .about-image {
    border: 2px solid var(--border-primary);
  }

  .about-content {
    padding-left: 4rem;
  }

  .about-title {
    font-size: 2.8rem;
  }
}




/* FOOTER SECTION */

.footer-section {
  padding: 1.5rem 2rem 0.75rem 2rem; /* Reduced bottom padding */
  border-top: 1px solid var(--border-thin);
  background: var(--paper-bg-dark);
}

@media (min-width: 768px) {
  .footer-section {
    padding: 3rem 1rem 1rem 1rem; /* More space on top, less on bottom */
  }
}

/* Footer Grid Named Areas */
.footer-social  { grid-area: social; }
.footer-hub     { grid-area: hub; }
.footer-privacy { grid-area: privacy; }
.footer-brand   { grid-area: brand; }

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: 
    "social hub"
    "privacy brand";
  gap: 0.75rem; /* Slightly tighter internal gap */
  font-family: "JetBrains Mono", monospace;
}

.footer-item {
  display: flex;
  flex-direction: column;
  text-transform: uppercase;
  text-align: center;
  align-items: center;
}

.footer-label {
  font-size: 0.70rem;
  letter-spacing: 0.10em;
  color: var(--text-accent);
  margin-bottom: 0.5rem;
  font-weight: 700;
  display: inline-block;
}

/* SOCIAL ICONS (Context Specific) */
.social-icons {
  display: flex;
  gap: 1.5rem;
}

.social-icons a {
  color: var(--text-primary);
  transition: transform 0.2s ease, color 0.2s ease;
}

.social-icons a:hover {
  color: var(--text-accent);
  transform: translateY(-2px);
}

.social-icons svg {
  width: 1.2rem;
  height: 1.2rem;
}

.hub-location {
  font-size: 0.7rem;
  color: var(--text-primary);
  font-weight: 400;
}

.privacy-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border: 1px solid rgba(0,0,0,0.1);
  padding: 0.4rem 1rem;
}

.brand-small {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.copyright {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* CONTACT OVERLAY SYTEM */

.contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.contact-overlay:target {
  opacity: 1;
  pointer-events: auto;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  cursor: default;
}

.overlay-content {
  position: relative;
  background-color: var(--paper-bg-light);
  padding: 4rem;
  border: 1px solid var(--border-thin);
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  text-align: center;
  max-width: 90%;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contact-overlay:target .overlay-content {
  transform: translateY(0);
}

.overlay-content .footer-label {
  display: block;
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
}

.overlay-content .social-icons {
  justify-content: center;
  gap: 2.5rem;
}

.overlay-content .social-icons svg {
  width: 2rem;
  height: 2rem;
}

/* Print Specifics */
@media print {
  body.desk {
    background: white;
  }
  .paper {
    box-shadow: none;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  .nav-section,
  .nav-overlay,
  .contact-overlay {
    display: none;
  }
}
