/* ============================================================
   Ahmed Diab — portfolio
   Full-screen physics canvas of draggable project icons.
   ============================================================ */

:root {
  --bg:        #ffffff;
  --surface:   #ffffff;
  --ink:       #0f172a;
  --muted:     #6b7280;
  --line:      #e6e6e4;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.05);
  --shadow-md: 0 8px 24px rgba(15,23,42,.10), 0 2px 6px rgba(15,23,42,.06);
  --shadow-lg: 0 18px 50px rgba(15,23,42,.16), 0 4px 12px rgba(15,23,42,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;                /* the canvas is the whole screen */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Scene / canvas (full screen, plain white) ---------- */
.scene {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow: hidden;
  touch-action: none;              /* let physics drag own the gesture */
}

/* ---------- Header — centred name overlay ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 26px 20px;
  text-align: center;
  pointer-events: none;            /* icons stay draggable underneath */
  z-index: 20;
}

.wordmark {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0;
}

/* ---------- Contact — email pill, bottom centre ---------- */
.contact-email {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 20;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: color .15s ease, border-color .15s ease, transform .12s ease;
}
.contact-email:hover {
  color: var(--ink);
  border-color: var(--ink);
  transform: translateX(-50%) translateY(-1px);
}

/* ---------- App icons ---------- */
.icon {
  position: absolute;
  top: 0; left: 0;
  display: grid;
  place-items: center;
  background: var(--surface);
  border-radius: 22%;
  box-shadow: var(--shadow-md);
  cursor: grab;
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.icon:active { cursor: grabbing; }
.icon:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.icon img {
  width: 58%;
  height: 58%;
  pointer-events: none;
}

/* real app icons: the image is the whole tile */
.icon.is-full {
  background: transparent;
  box-shadow: none;
}
.icon.is-full img {
  width: 100%;
  height: 100%;
  border-radius: 22%;
  /* shadow follows the icon's actual (squircle) silhouette */
  filter: drop-shadow(0 9px 22px rgba(15,23,42,.20))
          drop-shadow(0 2px 6px rgba(15,23,42,.12));
}

/* coloured glow behind the expanded icon */
.icon::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 30%;
  background: radial-gradient(circle, var(--accent, #2563eb) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .25s ease;
  z-index: -1;
}
.icon.is-expanded::before { opacity: .28; }

.icon.is-snapping { animation: icon-snap .5s cubic-bezier(.34,1.56,.64,1); }

@keyframes icon-snap {
  0%   { transform: var(--t) scale(1); }
  35%  { transform: var(--t) scale(.82); }
  70%  { transform: var(--t) scale(1.12); }
  100% { transform: var(--t) scale(1); }
}

/* ---------- Project card (expanded) ---------- */
.project-card {
  position: fixed;
  z-index: 40;
  width: 280px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  opacity: 0;
  transform: scale(.85);
  transform-origin: var(--card-origin, top left);
  pointer-events: none;
  transition: opacity .22s ease, transform .28s cubic-bezier(.34,1.4,.64,1);
}
.project-card.is-open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.project-card__close {
  position: absolute;
  top: 10px; right: 12px;
  width: 26px; height: 26px;
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
}
.project-card__close:hover { background: var(--bg); color: var(--ink); }

.project-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.project-card__icon {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  flex: none;
}
.project-card__icon img { width: 60%; height: 60%; }

.project-card.is-full .project-card__icon {
  border: 0;
  box-shadow: none;
  background: transparent;
}
.project-card.is-full .project-card__icon img {
  width: 100%;
  height: 100%;
  border-radius: 11px;
}

.project-card__name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.project-card__desc {
  font-size: 14px;
  color: var(--muted);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.project-card__link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--surface);
  background: var(--ink);
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 10px;
  transition: transform .12s ease;
}
.project-card__link:hover { transform: translateY(-1px); }

/* ---------- Phones ---------- */
@media (max-width: 720px) {
  .site-header { padding: 20px 16px; }
  .wordmark { font-size: 22px; }
  .contact-email { bottom: 18px; font-size: 13px; padding: 8px 16px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .icon.is-snapping { animation: none; }
  .project-card { transition: opacity .15s ease; }
}
