/* ============================================================
   Ben Levi — DevOps & AI Portfolio
   Design system: dark ops-console aesthetic, zero dependencies
   ============================================================ */

:root {
  --bg: #0a0e14;
  --bg-soft: #0d1320;
  --panel: #111827;
  --panel-2: #0f1522;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(34, 211, 238, 0.35);
  --text: #d7dee9;
  --text-dim: #8b98ab;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --gradient: linear-gradient(120deg, #22d3ee, #a78bfa);
  --mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(2, 6, 23, 0.6);
  --maxw: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(34, 211, 238, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(167, 139, 250, 0.08), transparent);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(34, 211, 238, 0.3); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

canvas#net-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; position: relative; z-index: 1; }

/* ---------- Nav ---------- */
nav.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 20, 0.75);
  border-bottom: 1px solid var(--border);
}
.topnav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.brand .prompt { color: var(--ok); }
.brand .cursor-blink { animation: blink 1.2s step-end infinite; color: var(--accent); }
.navlinks { display: flex; gap: 4px; }
.navlinks a {
  color: var(--text-dim);
  font-size: 13.5px;
  padding: 7px 12px;
  border-radius: 8px;
  transition: color .2s, background .2s;
}
.navlinks a:hover { color: var(--text); background: rgba(148,163,184,0.08); text-decoration: none; }

/* live status pill in nav */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse-dot 2s ease-in-out infinite;
}
.dot.err { background: var(--err); box-shadow: 0 0 8px var(--err); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 44px;
  align-items: center;
  padding: 76px 0 60px;
}
.kicker {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.08;
  margin: 0 0 18px;
  letter-spacing: -1px;
}
.hero h1 .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lede { color: var(--text-dim); font-size: 1.06rem; max-width: 46ch; }
.hero-cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn-primary {
  background: var(--gradient);
  color: #06121a;
  box-shadow: 0 6px 24px rgba(34, 211, 238, 0.25);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(34, 211, 238, 0.4); }
.btn-ghost {
  background: rgba(148,163,184,0.06);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--border-strong); }

/* ---------- Terminal window ---------- */
.term {
  background: #0b1018;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(148,163,184,0.05);
  border-bottom: 1px solid var(--border);
}
.term-bar .tl { width: 11px; height: 11px; border-radius: 50%; }
.tl.r { background: #ff5f57; } .tl.y { background: #febc2e; } .tl.g { background: #28c840; }
.term-bar .term-title { margin-left: 8px; color: var(--text-dim); font-size: 12px; }
.term-body {
  padding: 16px 18px 20px;
  min-height: 300px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-body .tp { color: var(--ok); }
.term-body .tc { color: var(--text); }
.term-body .td { color: var(--text-dim); }
.term-body .ta { color: var(--accent); }
.term-body .tk { color: var(--accent-2); }
.term-body .tok { color: var(--ok); }
.term-caret {
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s step-end infinite;
}

/* ---------- Sections ---------- */
section { padding: 64px 0; }
.sec-head { margin-bottom: 34px; }
.sec-head .num { font-family: var(--mono); color: var(--accent); font-size: 13px; }
.sec-head h2 { font-size: 1.9rem; margin: 6px 0 8px; letter-spacing: -0.5px; }
.sec-head p { color: var(--text-dim); margin: 0; max-width: 62ch; }

.panel {
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s ease; }
.reveal.vis { opacity: 1; transform: none; }

/* ---------- Live ops grid ---------- */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.ops-card { padding: 20px; position: relative; overflow: hidden; }
.ops-card .label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ops-card .value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 10px;
  color: var(--text);
}
.ops-card .value.ok { color: var(--ok); }
.ops-card .sub { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; font-family: var(--mono); }
.ops-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0.6;
}

.runs-list { margin-top: 18px; }
.run-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
}
.run-row:first-child { border-top: none; }
.run-row .rname { color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-row .rmeta { color: var(--text-dim); white-space: nowrap; }
.run-row .rstat { font-weight: 700; white-space: nowrap; }
.rstat.success { color: var(--ok); }
.rstat.failure { color: var(--err); }
.rstat.in_progress, .rstat.queued { color: var(--warn); }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.skill-col { padding: 22px; }
.skill-col h3 {
  margin: 0 0 14px;
  font-size: 1.02rem;
  color: var(--accent);
  font-family: var(--mono);
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.07);
  border: 1px solid rgba(34, 211, 238, 0.18);
  color: var(--text);
  transition: border-color .2s, transform .2s;
}
.tag:hover { border-color: var(--border-strong); transform: translateY(-1px); }

/* ---------- Projects ---------- */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.proj-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .2s, border-color .2s;
  color: var(--text);
}
a.proj-card:hover { transform: translateY(-4px); border-color: var(--border-strong); text-decoration: none; }
.proj-card h3 { margin: 0; font-size: 1.06rem; display: flex; align-items: center; gap: 9px; }
.proj-card h3 .folder { color: var(--accent); }
.proj-card p { margin: 0; color: var(--text-dim); font-size: 0.92rem; flex: 1; }
.proj-meta {
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  align-items: center;
}
.lang-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* ---------- News ---------- */
.news-list { display: grid; gap: 12px; }
.news-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 18px;
  transition: border-color .2s;
}
.news-item:hover { border-color: var(--border-strong); }
.news-item .src {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  white-space: nowrap;
  min-width: 90px;
}
.news-item a { color: var(--text); font-size: 0.95rem; }
.news-item .when { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }

/* ---------- Architecture ---------- */
.arch-wrap { padding: 26px; overflow-x: auto; }
.arch-svg { min-width: 720px; width: 100%; height: auto; }
.arch-note { color: var(--text-dim); font-size: 0.92rem; margin-top: 14px; }

/* ---------- Videos ---------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.video-card { overflow: hidden; }
.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b1018 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.video-thumb .play {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #06121a;
  font-size: 22px;
  transition: transform .2s;
}
.video-thumb:hover .play { transform: scale(1.12); }
.video-card .vtitle { padding: 14px 18px; font-size: 0.95rem; }
.video-card iframe { width: 100%; aspect-ratio: 16/9; border: 0; display: block; }

/* ---------- Chat widget ---------- */
.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: #06121a;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(34, 211, 238, 0.4);
  transition: transform .2s;
  display: flex; align-items: center; justify-content: center;
}
.chat-fab:hover { transform: scale(1.08); }

.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 200;
  width: min(380px, calc(100vw - 44px));
  height: min(540px, calc(100vh - 130px));
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel.open { display: flex; }
.chat-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.chat-head .bot-av {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.chat-head .bot-name { font-weight: 700; font-size: 14.5px; }
.chat-close {
  margin-left: auto; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  font-size: 15px; cursor: pointer; transition: color .2s, border-color .2s;
}
.chat-close:hover { color: var(--text); border-color: var(--border-strong); }
.chat-head .bot-sub { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.bot { background: rgba(148,163,184,0.08); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: rgba(34, 211, 238, 0.14); border: 1px solid rgba(34,211,238,0.25); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.typing { color: var(--text-dim); font-family: var(--mono); }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.chat-suggest button {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
}
.chat-suggest button:hover { border-color: var(--border-strong); color: var(--text); }
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1;
  background: rgba(148,163,184,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 13.5px;
  outline: none;
}
.chat-input-row input:focus { border-color: var(--border-strong); }
.chat-input-row button {
  background: var(--gradient);
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  color: #06121a;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Hero identity (photo + role badge) ---------- */
.hero-id { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.avatar {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border-strong);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.08), 0 8px 30px rgba(34, 211, 238, 0.18);
}
.role-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(34, 211, 238, 0.08); border: 1px solid var(--border-strong);
  color: var(--accent); font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.5px;
}

/* ---------- Floating clouds ---------- */
.floating-clouds { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.cloud { position: absolute; left: -140px; color: var(--accent); opacity: 0.10; animation: drift linear infinite; }
.cloud:nth-child(2n) { color: var(--accent-2); opacity: 0.12; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 280px)); } }

/* ---------- Case studies ---------- */
.case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 18px; }
.case-card { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.case-tag { font-family: var(--mono); font-size: 11.5px; color: var(--accent-2); text-transform: uppercase; letter-spacing: 1px; }
.case-card h3 { margin: 0; font-size: 1.2rem; }
.case-problem { margin: 0; color: var(--text-dim); font-size: 0.95rem; }
.case-problem strong { color: var(--text); }
.case-card ul { margin: 0; padding-left: 18px; font-size: 0.93rem; display: grid; gap: 6px; }
.case-card ul li::marker { color: var(--accent); }
.case-links { margin-top: auto; font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }
.case-private { color: var(--text-dim); }

/* ---------- Services ---------- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.svc-card { padding: 22px; }
.svc-card h3 { margin: 0 0 8px; font-size: 1.02rem; }
.svc-card p { margin: 0; color: var(--text-dim); font-size: 0.93rem; }
.svc-contact { margin-top: 18px; color: var(--text-dim); font-size: 0.93rem; }

/* ---------- About: experience & education ---------- */
.bio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; margin-top: 18px; }
.bio-col { padding: 24px; }
.bio-col h3 { margin: 0 0 14px; font-family: var(--mono); font-size: 13.5px; color: var(--accent); font-weight: 600; letter-spacing: 0.5px; }
.bio-col h3:not(:first-child) { margin-top: 22px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border-strong); display: grid; gap: 20px; }
.timeline > li { position: relative; }
.timeline > li::before {
  content: ""; position: absolute; left: -25px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent); box-shadow: 0 0 8px rgba(34, 211, 238, 0.5);
}
.tl-when { font-family: var(--mono); font-size: 12px; color: var(--accent-2); }
.tl-role { font-weight: 700; margin: 2px 0 6px; }
.timeline ul { margin: 0; padding-left: 18px; color: var(--text-dim); font-size: 0.92rem; }
.bio-note { margin: 18px 0 0; color: var(--text-dim); font-size: 0.92rem; font-style: italic; }
.edu { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 0.95rem; }
.edu span { color: var(--text-dim); font-size: 0.9rem; }
.bio-personal { margin: 0 0 18px; color: var(--text-dim); font-size: 0.95rem; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 46px;
  color: var(--text-dim);
  font-size: 0.9rem;
}
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
footer .mono { font-family: var(--mono); font-size: 12px; }

/* ---------- Animations ---------- */
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse-dot { 50% { opacity: 0.4; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .navlinks { display: none; }
}

/* ---------- Accessibility: respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  canvas#net-bg { display: none; }
  .cloud { animation: none; left: 8%; }
}
