/* ================================================
   MAH PORTFOLIO — Main Styles
   mdaminulhaque.com | Max Payne Noir Theme
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@300;400;500;600;700&family=Special+Elite&family=Share+Tech+Mono&display=swap');

/* ============ CSS VARIABLES ============ */
:root {
  --bg-0: #000000;
  --bg-1: #080808;
  --bg-2: #0f0f0f;
  --bg-3: #141414;
  --bg-4: #1c1c1c;
  --bg-5: #242424;

  --red:         #cc0000;
  --red-bright:  #ff1111;
  --red-dim:     #7a0000;
  --red-glow:    rgba(204, 0, 0, 0.35);
  --red-subtle:  rgba(204, 0, 0, 0.08);

  --amber:       #cc8800;
  --amber-bright:#ffaa00;
  --amber-dim:   #886600;

  --text-0: #ffffff;
  --text-1: #e2e2e2;
  --text-2: #a0a0a0;
  --text-3: #606060;
  --text-4: #383838;

  --border-1: #1a1a1a;
  --border-2: #2a2a2a;
  --border-3: #3a3a3a;

  --font-display: 'Oswald', 'Impact', sans-serif;
  --font-body:    'Share Tech Mono', 'Courier New', monospace;
  --font-retro:   'Special Elite', 'Courier New', serif;

  --nav-h: 68px;
  --container: 1280px;

  --t-fast:   0.15s ease;
  --t-normal: 0.3s ease;
  --t-slow:   0.6s ease;

  --shadow-red:  0 0 24px rgba(204, 0, 0, 0.3);
  --shadow-dark: 0 8px 32px rgba(0, 0, 0, 0.85);
}

/* B&W MODE — applied to <html> to cascade to all elements including images */
html.bw-mode {
  filter: grayscale(100%) contrast(1.08);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg-1);
  color: var(--text-1);
  font-family: var(--font-body);
  line-height: 1.7;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Film grain overlay */
body::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.045;
  pointer-events: none;
  z-index: 9000;
  animation: grain 0.8s steps(1) infinite;
}

/* CRT scanlines */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 3px,
    rgba(0,0,0,0.04) 3px, rgba(0,0,0,0.04) 4px
  );
  pointer-events: none;
  z-index: 9001;
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text-0);
}
h1 { font-size: clamp(2rem,   5vw, 4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.6rem); }
h4 { font-size: 1.15rem; }

p { font-family: var(--font-body); font-size: 0.875rem; color: var(--text-2); line-height: 1.85; }
a { color: var(--red); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--red-bright); }
strong { color: var(--text-0); }
ul { list-style: none; }

/* ============ LAYOUT ============ */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
}

.section { padding: 5rem 0; }
.section + .section { border-top: 1px solid var(--border-1); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

main { padding-top: var(--nav-h); position: relative; z-index: 10; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--red-dim); }
::-webkit-scrollbar-thumb:hover { background: var(--red); }
::selection { background: var(--red); color: #fff; }

/* ============ RAIN CANVAS ============ */
#rain-canvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.12;
}

/* ============ VIGNETTE ============ */
.vignette {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.75) 100%);
}

/* ============ LOADER ============ */
.loader {
  position: fixed; inset: 0;
  background: #000;
  z-index: 99999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2rem;
}
.loader__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-1);
}
.loader__title span { color: var(--red); }
.loader__bar-wrap { width: 280px; height: 2px; background: var(--border-1); }
.loader__bar { height: 100%; background: var(--red); width: 0; }
.loader__text {
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--text-3);
}
.loader.fade-out { animation: loaderOut 0.5s ease forwards; }

/* ============ NAVIGATION ============ */
#site-nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(6,6,6,0.96);
  border-bottom: 1px solid var(--border-1);
  z-index: 8000;
  backdrop-filter: blur(12px);
  transition: border-color var(--t-normal);
}
#site-nav.scrolled { border-bottom-color: var(--red-dim); }

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.4rem; font-weight: 700;
  letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--text-0); text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
}
.nav-logo span { color: var(--red); }

.nav-links {
  display: flex; align-items: center;
  gap: 0; list-style: none;
}
.nav-links a {
  display: block;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-display);
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-3); text-decoration: none;
  transition: color var(--t-fast);
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute; bottom: -1px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 2px; background: var(--red);
  transition: width var(--t-normal);
}
.nav-links a:hover, .nav-links a.active { color: var(--text-0); }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

.btn-nav-search {
  background: none; border: 1px solid var(--border-2);
  color: var(--text-3); padding: 0.35rem 0.65rem;
  cursor: pointer; font-family: var(--font-body);
  font-size: 0.65rem; letter-spacing: 0.15em; text-transform: uppercase;
  transition: all var(--t-fast);
}
.btn-nav-search:hover { border-color: var(--red); color: var(--red); }

.theme-toggle {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-3); border: 1px solid var(--border-2);
  padding: 0.35rem 0.65rem; cursor: pointer;
  font-family: var(--font-display); font-size: 0.6rem;
  font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-3); transition: all var(--t-fast); white-space: nowrap;
}
.theme-toggle:hover { border-color: var(--text-2); color: var(--text-1); }
.theme-toggle.active { border-color: var(--text-2); color: var(--text-0); background: var(--bg-5); }
.toggle-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); transition: background var(--t-fast); flex-shrink: 0;
}
.theme-toggle.active .toggle-dot { background: var(--text-2); }

.nav-burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 0.5rem;
}
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--text-2); transition: all var(--t-normal); }

/* ============ FOOTER ============ */
#site-footer {
  background: var(--bg-0);
  border-top: 1px solid var(--border-1);
  padding: 4rem 0 2rem;
}
.footer-inner { max-width: var(--container); margin: 0 auto; padding: 0 2rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border-1);
}
.footer-brand .logo { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; letter-spacing: 0.2em; color: var(--text-0); margin-bottom: 1rem; }
.footer-brand .logo span { color: var(--red); }
.footer-brand p { font-size: 0.78rem; max-width: 280px; margin-bottom: 1.5rem; }
.footer-social { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.social-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.65rem; border: 1px solid var(--border-2);
  font-family: var(--font-display); font-size: 0.65rem;
  font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); transition: all var(--t-fast);
}
.social-link:hover { border-color: var(--red); color: var(--text-1); background: var(--red-subtle); }
.footer-col h5 {
  font-family: var(--font-display); font-size: 0.65rem;
  font-weight: 600; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--red); margin-bottom: 1rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-1);
}
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col ul li a { font-size: 0.78rem; color: var(--text-3); transition: color var(--t-fast); font-family: var(--font-body); }
.footer-col ul li a:hover { color: var(--text-1); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; }
.footer-bottom p { font-size: 0.72rem; color: var(--text-4); }
.footer-bottom span { color: var(--red); }

/* ============ PAGE HEADER ============ */
.page-header {
  padding: calc(var(--nav-h) + 4rem) 0 3rem;
  background: var(--bg-0);
  border-bottom: 1px solid var(--border-1);
  position: relative; overflow: hidden;
}
.page-header .bg-text {
  position: absolute; top: 50%; right: 2rem;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: clamp(5rem, 15vw, 12rem);
  font-weight: 700; text-transform: uppercase;
  color: rgba(204,0,0,0.04);
  pointer-events: none; white-space: nowrap;
  letter-spacing: 0.1em;
}
.page-label {
  font-family: var(--font-body); font-size: 0.65rem;
  color: var(--red); letter-spacing: 0.4em; text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.page-label::before { content: ''; display: inline-block; width: 28px; height: 1px; background: var(--red); }
.page-header h1 { margin-bottom: 1rem; }
.page-header p { max-width: 580px; font-size: 0.875rem; }

/* ============ SECTION HEADER ============ */
.section-header { margin-bottom: 3rem; }
.section-label {
  font-family: var(--font-body); font-size: 0.65rem;
  color: var(--red); letter-spacing: 0.4em; text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.section-header h2 { margin-bottom: 0.75rem; }
.section-header p { max-width: 560px; }
.section-line { width: 48px; height: 2px; background: var(--red); margin-top: 1rem; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg-0); border-bottom: 1px solid var(--border-1);
    padding: 1rem 2rem; gap: 0.25rem;
  }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-bottom { flex-direction: column; gap: 0.75rem; text-align: center; }
  .section { padding: 3.5rem 0; }
}
@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .grid-4 { grid-template-columns: 1fr; }
}
