/* Nabil Shehadeh. Dark only, one accent (#1F5FBF), one radius scale: surfaces 16px, inner 10px, controls pill. */

:root {
  --bg: #0e0e0e;
  --tile: #161616;
  --tile-2: #1f1f1f;
  --ink: #ededed;
  --ink-2: #a3a3a3;
  --ink-3: #7c7c7c;
  --line: #262626;
  --accent: #1F5FBF;
  --accent-hi: #2b6dd1;   /* hover state of the same blue */
  --ring: #4f86d9;        /* focus ring: same hue, lifted so it reads on near-black */
  --menu: #171717;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -16px rgb(0 0 0 / .7);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 40px; background: var(--bg); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: color-mix(in oklab, var(--accent) 45%, transparent); color: var(--ink); }

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: 16px; top: -48px; padding: 8px 12px; background: var(--ink); color: var(--bg); border-radius: 999px; z-index: 60; }
.skip:focus { top: 16px; }

/* Layout */
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.measure { max-width: 600px; }
section { margin-top: clamp(80px, 9vw, 112px); }
section.intro { margin-top: 0; padding-top: clamp(48px, 7vw, 80px); }
section.last { padding-bottom: 120px; }

/* Header: name left, social icons right */
.me { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.me h1 { font-size: 16px; font-weight: 500; color: var(--ink); letter-spacing: -.005em; line-height: 1.45; }
.me p { color: var(--ink-2); line-height: 1.45; }

.social { display: flex; gap: 2px; margin-right: -8px; }
.soc {
  position: relative;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 999px;
  font-size: 18px; color: var(--ink-3);
  transition: color 200ms ease, background-color 200ms ease, transform 160ms var(--ease-out);
}
.soc:active { transform: scale(.94); }

/* Tooltips: delay the first one, then show neighbours instantly (.warm) */
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: calc(100% + 6px);
  padding: 5px 9px; border-radius: 8px;
  background: var(--ink); color: var(--bg);
  font: 500 12px/1 var(--sans); white-space: nowrap;
  pointer-events: none;
  opacity: 0; transform: translateX(-50%) translateY(-2px) scale(.97); transform-origin: top center;
  transition: opacity 125ms ease-out, transform 125ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .soc:hover { color: var(--ink); background: var(--tile-2); }
  [data-tip]:hover::after { opacity: 1; transform: translateX(-50%); transition-delay: 380ms; }
  .warm [data-tip]:hover::after { transition-delay: 0ms; transition-duration: 0ms; }
}
[data-tip].tip-off::after { opacity: 0 !important; transition: none !important; }

.block { margin-top: clamp(48px, 6vw, 64px); }
h2 { font-size: 16px; font-weight: 500; color: var(--ink); letter-spacing: -.005em; margin-bottom: 14px; }
.measure > p + p { margin-top: 14px; }
.row-head { display: flex; gap: 10px; align-items: baseline; }
.muted { color: var(--ink-3); font-weight: 400; }
.lede { font-size: clamp(24px, 3vw, 30px); line-height: 1.2; letter-spacing: -.025em; color: var(--ink); font-weight: 500; margin-bottom: 14px; }

/* Primary button */
.actions { margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px 0 15px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 14.5px; font-weight: 500; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .14), 0 8px 24px -12px color-mix(in oklab, var(--accent) 70%, transparent);
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.btn i { font-size: 13px; transition: transform 250ms var(--ease-out); }
.btn:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--accent-hi); }
  .btn:hover i { transform: scale(1.12); }
}

/* Reveal on load / scroll */
.js [data-reveal] {
  opacity: 0; transform: translateY(10px); filter: blur(4px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out), filter 600ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.js [data-reveal].in { opacity: 1; transform: none; filter: none; }

/* KSHF case study: text left, sticky screen right */
.case {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 64px;
  margin-top: 24px;
}
.step {
  position: relative;
  min-height: 46vh;
  display: flex; flex-direction: column; justify-content: center;
  opacity: .3;
  transition: opacity 400ms ease;
  cursor: pointer;
}
.step:first-child { min-height: 40vh; justify-content: flex-start; padding-top: 6vh; }
.step:last-child { min-height: 56vh; }
.step.on { opacity: 1; cursor: default; }
.step h3 { position: relative; font-size: 16px; font-weight: 500; color: var(--ink); margin-bottom: 6px; letter-spacing: -.005em; }
.step p { max-width: 42ch; }
.dot {
  position: absolute; left: -22px; top: .62em;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent);
  opacity: 0; transform: scale(.5);
  transition: opacity 250ms ease, transform 300ms var(--ease-out);
}
.step.on .dot { opacity: 1; transform: none; }
.step-img { display: none; }

.case-media { position: relative; }
.frame-sticky { position: sticky; top: calc(50vh - 200px); }
.frame {
  display: block; width: 100%;
  padding: 10px;
  border-radius: 16px;
  background: var(--tile);
  box-shadow: 0 0 0 1px var(--line);
  will-change: transform;
  transition: box-shadow 250ms ease;
}
.frame-inner {
  position: relative; display: block;
  aspect-ratio: 1600 / 841;
  border-radius: 10px;
  overflow: hidden;
  background: #121212;
}
.frame-inner img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left;
  opacity: 0; filter: blur(6px); transform: scale(1.015);
  transition: opacity 360ms ease, filter 360ms ease, transform 520ms var(--ease-out);
}
.frame-inner img.on { opacity: 1; filter: none; transform: none; }
.frame-note {
  margin-top: 12px; text-align: center;
  font-size: 13.5px; color: var(--ink-3);
}
@media (hover: hover) and (pointer: fine) {
  .frame:hover { box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 60%, var(--line)); }
}

/* Inline link that previews what it names (intro) */
.peek {
  color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
  text-decoration-color: color-mix(in oklab, var(--accent) 70%, transparent);
  transition: text-decoration-color 200ms ease, color 200ms ease;
}
@media (hover: hover) and (pointer: fine) { .peek:hover { text-decoration-color: var(--accent-hi); color: #fff; } }

/* Projects: a stacked list; the hovered row stays bright, the rest step back */
.projects { max-width: 760px; display: flex; flex-direction: column; }
.proj {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 32px;
  padding: 12px 0;
  transition: opacity 200ms ease;
}
.proj + .proj { margin-top: 8px; }
.proj-main { display: block; }
.proj-main::after { content: ""; position: absolute; inset: 0; }
.proj-title { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.proj-title i { font-size: 14px; color: var(--accent-hi); opacity: 0; transform: translate(-3px, 3px); transition: opacity 200ms ease, transform 250ms var(--ease-out); }
.proj-desc { display: block; max-width: 58ch; }
.proj-meta { align-self: start; margin-top: 3px; font: 400 13px/1.4 var(--mono); color: var(--ink-3); white-space: nowrap; }
.proj-code { position: relative; z-index: 1; display: inline-flex; gap: 6px; align-items: center; padding: 2px 0; transition: color 200ms ease; }
.proj-code i { font-size: 14px; }
.proj-thumb { display: none; }
.proj:has(.proj-main:active) .proj-title { transform: scale(.99); }

@media (hover: hover) and (pointer: fine) {
  .projects:hover .proj { opacity: .4; }
  .projects .proj:hover { opacity: 1; }
  .proj:hover .proj-title i { opacity: 1; transform: none; }
  a.proj-code:hover { color: var(--ink); }
}

/* Cursor-following preview, shared by the project rows and the intro link */
.preview {
  position: fixed; left: 0; top: 0; z-index: 30;
  width: 360px; aspect-ratio: 1600 / 841;
  border-radius: 12px; overflow: hidden;
  pointer-events: none;
  background: var(--tile);
  box-shadow: 0 0 0 1px var(--line), 0 28px 60px -24px rgb(0 0 0 / .7);
  opacity: 0;
  transition: opacity 200ms ease;
  will-change: transform, opacity;
}
.preview.show { opacity: 1; }
.preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; opacity: 0; transition: opacity 220ms ease; }
.preview img.on { opacity: 1; }

.foot { margin-top: 72px; font-size: 14px; color: var(--ink-3); }

/* Floating pill */
.pill {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex; align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
  transform: translateX(-50%);
  transition: opacity 400ms var(--ease-out), transform 500ms var(--ease-out);
}
.js .pill:not(.ready) { opacity: 0; transform: translate(-50%, 12px); }
@media (prefers-reduced-transparency: reduce) { .pill { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; } }

.pill-btn {
  height: 34px; padding: 0 12px 0 14px;
  display: inline-flex; align-items: center; gap: 9px;
  border-radius: 999px;
  font-size: 14px; color: var(--ink);
  transition: background-color 200ms ease, transform 160ms var(--ease-out);
}
.pill-btn:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .pill-btn:hover { background: var(--tile-2); } }
.pill-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.pill-label-wrap { display: inline-block; overflow: hidden; white-space: nowrap; transition: width 260ms var(--ease-out); }
.pill-label { display: inline-block; transition: opacity 120ms ease, filter 120ms ease, transform 120ms ease; }
.pill-label.swap { opacity: 0; filter: blur(2px); transform: translateY(3px); }
.pill-caret { font-size: 13px; color: var(--ink-3); }

.menu {
  position: absolute; left: 0; bottom: calc(100% + 8px);
  min-width: 190px; padding: 6px;
  border-radius: 16px;
  background: var(--menu);
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
  transform-origin: 24px 100%;
  opacity: 0; transform: scale(.96) translateY(4px); visibility: hidden;
  transition: opacity 150ms ease, transform 180ms var(--ease-out), visibility 0s linear 180ms;
}
.menu.open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.menu a {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 12px; border-radius: 10px;
  font-size: 14px; color: var(--ink-2);
}
.menu a::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0; }
.menu a[aria-current="true"] { color: var(--ink); }
.menu a[aria-current="true"]::before { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .menu a:hover { background: var(--tile); color: var(--ink); } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(max(20px, env(safe-area-inset-bottom)) + 58px);
  z-index: 50;
  padding: 9px 14px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-size: 13.5px; white-space: nowrap;
  opacity: 0; transform: translate(-50%, 8px) scale(.97);
  transition: opacity 250ms ease, transform 350ms var(--ease-out);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Mobile */
@media (max-width: 820px) {
  .case { grid-template-columns: 1fr; gap: 0; margin-top: 28px; }
  .case-media { display: none; }
  .step, .step:first-child, .step:last-child { min-height: 0; padding: 0; opacity: 1; cursor: default; justify-content: flex-start; }
  .step + .step { margin-top: 44px; }
  .dot { display: none; }
  .step-img { display: block; margin-top: 18px; border-radius: 12px; box-shadow: 0 0 0 10px var(--tile); width: calc(100% - 20px); margin-left: 10px; cursor: pointer; }

  .proj { grid-template-columns: 1fr; gap: 6px; }
  .proj-thumb { display: block; border-radius: 12px; margin-bottom: 14px; box-shadow: 0 0 0 1px var(--line); }
  .proj-title i { opacity: 1; transform: none; }
  .proj-meta { margin-top: 2px; }
  .proj + .proj { margin-top: 28px; }

}
@media (max-width: 420px) {
  .wrap { padding: 0 16px; }
  .soc { width: 34px; height: 34px; font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { transform: none; filter: none; transition: opacity 300ms ease; }
  .frame-inner img { filter: none; transform: none; transition: opacity 200ms ease; }
  .pill-label.swap { filter: none; transform: none; }

  .menu, .toast, .pill { transition-property: opacity, visibility; }
}
