/* ============================================================
   Mohamad Chehab — Portfolio
   Aesthetic: industrial blueprint × blue-team terminal
   ============================================================ */

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body, h1, h2, h3, p, ul, ol, dl, dd, dt, pre, figure { margin: 0; padding: 0; }

ul, ol { list-style: none; }

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

button { font: inherit; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --bg-0: #0a0e14;
  --bg-1: #0f141c;
  --bg-2: #141b25;
  --bg-3: #1b2330;

  /* Ink */
  --ink-0: #e8eef5;
  --ink-1: #aab4c0;
  --ink-2: #6e7884;
  --ink-3: #4a525c;

  /* Accents */
  --amber: #ff8a3d;
  --amber-dim: #c66726;
  --cyan: #5fd3e6;
  --cyan-dim: #3aa1b3;
  --green: #7ee787;
  --red: #ff6e6e;

  /* Lines */
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --line-amber: rgba(255, 138, 61, 0.35);

  /* Fonts */
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --f-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --f-serif: 'Fraunces', Georgia, serif;

  /* Rhythm */
  --max: 1240px;
  --gutter: clamp(1.25rem, 3vw, 2.5rem);
  --section-y: clamp(5rem, 10vw, 9rem);

  /* Easing */
  --e-out: cubic-bezier(0.2, 0.7, 0.1, 1);
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

::selection {
  background: var(--amber);
  color: var(--bg-0);
}

/* ---------- Decorative background layers ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 50%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 50%, transparent 100%);
  opacity: 0.7;
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.scanline {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0.45;
  z-index: 2;
  pointer-events: none;
  animation: scan 9s linear infinite;
  filter: drop-shadow(0 0 8px var(--amber));
}

@keyframes scan {
  0%   { transform: translateY(0); }
  100% { transform: translateY(100vh); }
}

@media (prefers-reduced-motion: reduce) {
  .scanline { animation: none; opacity: 0; }
  html { scroll-behavior: auto; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem var(--gutter);
  background: rgba(10, 14, 20, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 0.78rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--amber);
  color: var(--bg-0);
  font-weight: 800;
  font-family: var(--f-mono);
  letter-spacing: -0.02em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--amber-dim) inset, 0 0 24px -4px var(--amber);
}

.brand-meta { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; color: var(--ink-0); letter-spacing: 0.01em; }
.brand-role { color: var(--ink-2); font-size: 0.7rem; }

.primary-nav {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.primary-nav a {
  color: var(--ink-1);
  position: relative;
  padding: 0.25rem 0;
  transition: color 0.25s var(--e-out);
}

.primary-nav a::after {
  content: "";
  position: absolute;
  inset: auto 0 -2px 0;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--e-out);
}

.primary-nav a:hover { color: var(--ink-0); }
.primary-nav a:hover::after { transform: scaleX(1); }

.header-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-2);
  white-space: nowrap;
}

.header-status .dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--green);
  animation: pulse 2.4s ease-in-out infinite;
}

.header-status .status-text { color: var(--ink-1); }
.header-status .status-clock { color: var(--amber); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ---------- Layout ---------- */
main {
  position: relative;
  z-index: 5;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  scroll-margin-top: 5rem;
  position: relative;
}

.section + .section { border-top: 1px dashed var(--line); }

.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  margin-bottom: 1.75rem;
}

.section-num {
  background: var(--bg-2);
  color: var(--amber);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line-amber);
  border-radius: 2px;
  letter-spacing: 0.08em;
}

.section-tag { color: var(--cyan); }

.section-title {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.2vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink-0);
  max-width: 22ch;
  margin-bottom: 3rem;
}

.section-title em {
  font-style: italic;
  color: var(--amber);
  font-feature-settings: 'ss01';
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: calc(100vh - 4rem);
  padding-top: clamp(3rem, 8vw, 6rem);
  padding-bottom: var(--section-y);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.hero-meta-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  margin-bottom: 2.5rem;
  letter-spacing: 0.04em;
}

.hero-meta-top span {
  position: relative;
  padding-left: 0.85rem;
}

.hero-meta-top span::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--amber);
}

.hero-title {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 7.5vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin-bottom: 2.5rem;
}

.hero-title .line {
  display: block;
  opacity: 0;
  transform: translateY(20px);
  animation: rise 0.9s var(--e-out) forwards;
}

.hero-title .line-1 { animation-delay: 0.05s; color: var(--ink-0); }
.hero-title .line-2 { animation-delay: 0.18s; color: var(--ink-1); font-style: italic; }
.hero-title .line-3 { animation-delay: 0.32s; }

.hero-title .accent {
  color: var(--amber);
  position: relative;
  display: inline-block;
}

.hero-title .accent::after {
  content: "_";
  display: inline-block;
  margin-left: 0.05em;
  color: var(--amber);
  animation: blink 1.05s steps(1) infinite;
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-sub {
  max-width: 60ch;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.65;
  color: var(--ink-1);
  margin-bottom: 2.25rem;
  opacity: 0;
  animation: rise 0.8s var(--e-out) 0.5s forwards;
}

.hero-sub strong { color: var(--ink-0); font-weight: 600; }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 4rem;
  opacity: 0;
  animation: rise 0.8s var(--e-out) 0.65s forwards;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  font-family: var(--f-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--e-out), background 0.25s var(--e-out), color 0.25s var(--e-out), box-shadow 0.25s var(--e-out);
}

.btn-primary {
  background: var(--amber);
  color: var(--bg-0);
  box-shadow: 0 0 0 0 transparent;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px -8px var(--amber), 0 0 0 1px var(--amber-dim) inset;
}

.btn-primary .btn-arrow { transition: transform 0.25s var(--e-out); }
.btn-primary:hover .btn-arrow { transform: translateX(4px); }

.btn-ghost {
  background: transparent;
  color: var(--ink-0);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  animation: rise 0.8s var(--e-out) 0.8s forwards;
}

.hero-stats > div {
  padding: 1.1rem 1.25rem;
  border-right: 1px solid var(--line);
  font-family: var(--f-mono);
}

.hero-stats > div:last-child { border-right: none; }

.hero-stats dt {
  font-size: 0.7rem;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.hero-stats dd {
  color: var(--ink-0);
  font-size: 0.95rem;
  font-weight: 500;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about-prose p {
  color: var(--ink-1);
  font-size: 1.02rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

.about-prose p:last-child { margin-bottom: 0; }

.about-prose strong {
  color: var(--ink-0);
  font-weight: 600;
}

.about-card {
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-family: var(--f-mono);
  font-size: 0.84rem;
  overflow: hidden;
  position: sticky;
  top: 6rem;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

.about-card header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.95rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line-strong);
}

.card-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.card-dot-r { background: #ff5f56; }
.card-dot-y { background: #ffbd2e; }
.card-dot-g { background: #27c93f; }

.card-title {
  margin-left: 0.6rem;
  color: var(--ink-2);
  font-size: 0.78rem;
}

.about-card pre {
  padding: 1.25rem;
  white-space: pre;
  overflow-x: auto;
  color: var(--ink-1);
  line-height: 1.7;
}

.t-key { color: var(--cyan); }
.t-str { color: var(--amber); }

/* ============================================================
   STACK
   ============================================================ */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.stack-card {
  background: var(--bg-1);
  padding: 1.75rem;
  transition: background 0.3s var(--e-out);
  position: relative;
}

.stack-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 2px solid transparent;
  pointer-events: none;
  transition: border-color 0.3s var(--e-out);
}

.stack-card:hover { background: var(--bg-2); }
.stack-card:hover::before { border-top-color: var(--amber); }

.stack-card-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--line-strong);
}

.stack-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--bg-3);
  color: var(--amber);
  font-family: var(--f-mono);
  font-size: 1.05rem;
  border-radius: 2px;
  border: 1px solid var(--line-amber);
}

.stack-card h3 {
  font-family: var(--f-mono);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-0);
  text-transform: uppercase;
}

.stack-card ul {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.92rem;
  color: var(--ink-1);
}

.stack-card li {
  position: relative;
  padding-left: 1.1rem;
  line-height: 1.5;
}

.stack-card li::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--cyan);
  font-size: 0.85rem;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.project-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-strong);
}

.project {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: padding-left 0.35s var(--e-out);
}

.project::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(180deg, var(--amber), transparent);
  transition: width 0.35s var(--e-out);
}

.project:hover {
  padding-left: 1.5rem;
}

.project:hover::before {
  width: 3px;
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
}

.project-year {
  color: var(--amber);
  font-weight: 700;
  font-size: 1.5rem;
  font-family: var(--f-mono);
  letter-spacing: -0.02em;
}

.project-cat {
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.project-title {
  font-family: var(--f-serif);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink-0);
  margin-bottom: 0.75rem;
}

.project p {
  color: var(--ink-1);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1.1rem;
  max-width: 65ch;
}

.project p strong { color: var(--ink-0); font-weight: 600; }

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-tags li {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--cyan);
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--bg-1);
}

/* ============================================================
   CREDENTIALS
   ============================================================ */
.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.cred-card {
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1.6rem;
  transition: border-color 0.3s var(--e-out), transform 0.3s var(--e-out);
}

.cred-card:hover {
  border-color: var(--line-amber);
  transform: translateY(-3px);
}

.cred-edu { grid-column: span 2; background: var(--bg-2); }

@media (max-width: 720px) {
  .cred-edu { grid-column: span 1; }
}

.cred-card header {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.cred-kind {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--bg-0);
  background: var(--cyan);
  padding: 0.18rem 0.5rem;
  border-radius: 2px;
  font-weight: 700;
}

.cred-edu .cred-kind { background: var(--amber); }

.cred-card h3 {
  font-family: var(--f-serif);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--ink-0);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.cred-line {
  font-family: var(--f-mono);
  color: var(--ink-0);
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.cred-meta {
  font-family: var(--f-mono);
  color: var(--ink-2);
  font-size: 0.78rem;
  margin-bottom: 0.85rem;
}

.cred-card p:not(.cred-line):not(.cred-meta) {
  color: var(--ink-1);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-lead {
  font-size: 1.08rem;
  color: var(--ink-1);
  margin-bottom: 2rem;
  max-width: 60ch;
}

.contact-grid {
  display: grid;
  gap: 0.75rem;
}

.contact-card {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.4rem 1.6rem;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  transition: background 0.25s var(--e-out), border-color 0.25s var(--e-out), transform 0.25s var(--e-out);
}

.contact-card:hover {
  background: var(--bg-2);
  border-color: var(--amber);
  transform: translateX(6px);
}

.contact-kind {
  font-family: var(--f-mono);
  color: var(--cyan);
  font-size: 0.82rem;
}

.contact-handle {
  font-family: var(--f-mono);
  color: var(--ink-0);
  font-size: 1.02rem;
  font-weight: 500;
  word-break: break-all;
}

.contact-arrow {
  font-family: var(--f-mono);
  color: var(--amber);
  font-size: 1.4rem;
  transition: transform 0.25s var(--e-out);
}

.contact-card:hover .contact-arrow { transform: translateX(6px); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  position: relative;
  z-index: 5;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--ink-2);
}

.footer-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.5rem 0;
}

.footer-row-sub { color: var(--ink-3); }
.footer-mono { color: var(--cyan); }

/* ============================================================
   Reveal animation for in-view sections
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s var(--e-out), transform 0.9s var(--e-out);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-title .line, .hero-sub, .hero-cta, .hero-stats {
    opacity: 1; animation: none; transform: none;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.85rem 1rem;
  }
  .primary-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--line);
  }
  .header-status .status-text { display: none; }

  .about-grid { grid-template-columns: 1fr; }
  .about-card { position: static; }

  .project { grid-template-columns: 1fr; gap: 1rem; }
  .project-meta { flex-direction: row; align-items: baseline; gap: 1rem; }
  .project-year { font-size: 1.1rem; }
}

@media (max-width: 560px) {
  .brand-meta { display: none; }
  .header-status .status-clock { font-size: 0.72rem; }

  .contact-card {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .contact-arrow { display: none; }

  .hero-meta-top { gap: 0.85rem; font-size: 0.68rem; }
  .hero-stats > div { border-right: none; border-bottom: 1px solid var(--line); }
  .hero-stats > div:last-child { border-bottom: none; }
}
