/* Midnight Violet — portfolio theme for mdajaharali.com */
:root {
  color-scheme: dark;
  --bg: #14121B;
  --surface: #1D1A28;
  --elevated: #242030;
  --text: #F3F0FA;
  --muted: #ABA5BA;
  --accent: #B4A2FF;
  --on-accent: #20183E;
  --accent-soft: #2D2540;
  --border: #363040;
  --control-border: #746A85;
  --accent-hover: #C3B5FF;
  --accent-pressed: #A18BEF;
  --success: #86D9B2;
  --success-bg: #1A342B;
  --warning: #F2CC81;
  --warning-bg: #382D1C;
  --error: #FF9DA9;
  --error-bg: #3B2029;

  --radius-badge: 6px;
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-dialog: 16px;

  --sidebar: 224px;
  --rail: 72px;
  --gutter: 32px;
  --ease: 150ms ease;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0; color: var(--text); min-height: 100vh;
  /* 40px lavender grid, carried over from the previous design */
  background:
    linear-gradient(to right, rgb(180 162 255 / 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(180 162 255 / 0.06) 1px, transparent 1px),
    var(--bg);
  background-size: 40px 40px;
  background-attachment: fixed;
}
body::before {
  /* soft vignette so the grid fades toward the edges */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 60% 0%, transparent 45%, rgb(20 18 27 / 0.45) 100%);
}
img { display: block; max-width: 100%; }
code { font: 500 13px/1 var(--mono); background: var(--elevated); padding: 2px 6px; border-radius: var(--radius-badge); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 9px 16px; border-radius: var(--radius-control); font-weight: 600;
}
.skip-link:focus { top: 16px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 24px 16px;
  z-index: 40;
}
.brand { display: block; font-size: 18px; line-height: 26px; font-weight: 600; padding: 4px 12px 24px; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 500; }
.brand-short { display: none; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 9px 12px; border-radius: var(--radius-control);
  color: var(--muted); font-weight: 500;
  transition: background var(--ease), color var(--ease);
}
.nav a:hover { background: var(--elevated); color: var(--text); }
.nav a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }

.sidebar-hint {
  margin-top: 24px; padding: 0 12px; color: var(--muted);
  font-size: 12px; line-height: 18px; font-weight: 500;
}
.sidebar-hint button { all: unset; cursor: pointer; border-radius: var(--radius-badge); }
.sidebar-hint button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border: 1px solid var(--control-border); border-radius: var(--radius-badge);
  font: 500 12px/1 Inter, system-ui, sans-serif; color: var(--text); background: var(--bg);
}

.profile { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; }
.initials {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.profile strong { display: block; font-weight: 500; }
.profile small { display: block; color: var(--muted); font-size: 12px; line-height: 18px; }

/* ---------- Mobile top bar + drawer ---------- */
.topbar { display: none; }
.backdrop { position: fixed; inset: 0; background: rgb(10 8 16 / 0.6); z-index: 35; }
.icon-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.icon-button:hover { background: var(--elevated); border-color: var(--control-border); }

/* ---------- Main ---------- */
.main { margin-left: var(--sidebar); padding: var(--gutter); }
.content { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 48px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding: 8px 0 24px; border-bottom: 1px solid var(--border); }
.eyebrow { color: var(--muted); font-size: 12px; line-height: 18px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.page-sub { color: var(--muted); margin-top: 4px; max-width: 60ch; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-control);
  font: 600 14px/22px Inter, system-ui, sans-serif; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-pressed); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--elevated); border-color: var(--control-border); }
.btn-secondary:active { background: var(--accent-soft); }

/* ---------- Sections ---------- */
.section { display: flex; flex-direction: column; gap: 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title { font-size: 18px; line-height: 26px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.count { color: var(--muted); font-weight: 500; }
.section-note { color: var(--muted); font-size: 12px; line-height: 18px; font-weight: 500; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 8px; border-radius: var(--radius-badge);
  font-size: 12px; line-height: 18px; font-weight: 500; white-space: nowrap;
}
.badge svg.icon { width: 14px; height: 14px; stroke-width: 2; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-neutral { background: var(--elevated); color: var(--muted); }

/* Project header */
.project-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.url { color: var(--muted); font-size: 12px; line-height: 18px; font-weight: 500; display: flex; align-items: center; gap: 4px; margin-top: 2px; }

/* Toolkit */
.toolkit { display: flex; flex-wrap: wrap; gap: 8px; }
.toolkit li { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); font-weight: 500; }

/* Contact */
.contact { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.contact h2 { font-size: 18px; line-height: 26px; font-weight: 600; }
.contact p { color: var(--muted); margin-top: 4px; max-width: 52ch; }

.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 18px; }

/* ---------- Case studies ---------- */
.hero-statement { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.015em; max-width: 24ch; }
.case { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; padding: 0; overflow: hidden; }
.case-body { padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.case-body h3 { font-size: 22px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; }
.case-body > p { color: var(--muted); }
.inside { display: grid; grid-template-columns: auto 1fr; gap: 8px 24px; margin: 0; }
.inside dt { color: var(--muted); font-size: 12px; line-height: 22px; font-weight: 500; }
.inside dd { margin: 0; }
.case-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.arch { background: var(--bg); border-left: 1px solid var(--border); padding: 32px; display: flex; flex-direction: column; justify-content: center; gap: 0; }
.arch-label { color: var(--muted); font-size: 12px; line-height: 18px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 16px; }
.node { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); }
.node strong { font-weight: 500; }
.node span { color: var(--muted); font-size: 12px; line-height: 18px; font-weight: 500; }
.node.focus { background: var(--accent-soft); border-color: var(--accent-soft); }
.node.focus strong { color: var(--accent); }
.wire { display: flex; align-items: center; gap: 8px; height: 32px; padding-left: 24px; color: var(--muted); font: 500 12px/18px var(--mono); }
.wire::before { content: ""; width: 1px; height: 100%; background: var(--control-border); }
.steps-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; counter-reset: s; }
.steps-list li { padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.steps-list li span { font: 500 12px/18px var(--mono); color: var(--accent); }
.steps-list li strong { font-weight: 600; }
.steps-list li p { color: var(--muted); }

/* ---------- Quick links dialog ---------- */
.command {
  border: 1px solid var(--border); border-radius: var(--radius-dialog);
  background: var(--elevated); color: var(--text);
  width: min(440px, calc(100vw - 32px)); padding: 0;
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.45);
}
.command::backdrop { background: rgb(10 8 16 / 0.6); }
.command-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.command-head h2 { font-size: 18px; line-height: 26px; font-weight: 600; }
.command-head .icon-button { width: 36px; height: 36px; background: transparent; border-color: transparent; }
.command-head .icon-button:hover { background: var(--accent-soft); }
.command-list { padding: 0 12px 12px; }
.command-list a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px;
  border-radius: var(--radius-control); transition: background var(--ease);
}
.command-list a:hover, .command-list a:focus-visible { background: var(--accent-soft); outline: none; }
.command-list a:focus-visible kbd { border-color: var(--accent); color: var(--accent); }
.command-list strong { display: block; font-weight: 500; }
.command-list small { display: block; color: var(--muted); font-size: 12px; line-height: 18px; }
.command-list .icon { margin-left: auto; color: var(--muted); }
.command-foot { padding: 12px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 18px; display: flex; gap: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .case { grid-template-columns: 1fr; }
  .arch { border-left: 0; border-top: 1px solid var(--border); }
}

@media (min-width: 768px) and (max-width: 1023px) {
  :root { --gutter: 24px; }
  .sidebar { width: var(--rail); padding: 24px 12px; align-items: center; }
  .brand { padding: 4px 0 24px; }
  .brand-full { display: none; }
  .brand-short { display: inline; }
  .nav a { justify-content: center; width: 48px; height: 48px; padding: 0; }
  .nav a span, .sidebar-hint, .profile div { display: none; }
  .profile { padding: 0; }
  .main { margin-left: var(--rail); }
  .steps-list { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  :root { --gutter: 16px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 30; height: 64px; padding: 0 16px;
    background: rgb(20 18 27 / 0.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { padding: 0; }
  .sidebar { transform: translateX(-100%); transition: transform 180ms ease; width: min(280px, 85vw); visibility: hidden; }
  .sidebar.open { transform: none; visibility: visible; }
  .sidebar .drawer-close { position: absolute; top: 16px; right: 16px; }
  .main { margin-left: 0; }
  .content { gap: 32px; }
  .hero-statement { font-size: 24px; line-height: 32px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .steps-list { grid-template-columns: 1fr; gap: 16px; }
  .card { padding: 20px; }
  .case { padding: 0; }
  .case-body, .arch { padding: 20px; }
  .contact .btn { width: 100%; }
}
@media (min-width: 768px) { .drawer-close { display: none !important; } .backdrop { display: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
