/* ============================================================
   Hamed: Portfolio custom styles
   Monochrome (black & white) theme, class-based dark mode.
   Tailwind handles layout/utilities; this file adds the
   bespoke animations, glass cards, and effects.
   ============================================================ */

:root {
  --bg: #ffffff;
  --fg: #09090b;
  --line: rgba(0, 0, 0, 0.1);
  --glass-bg: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.08);
  --accent: #09090b; /* monochrome accent = ink */
}

html.dark {
  --bg: #09090b;
  --fg: #fafafa;
  --line: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent: #ffffff;
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Loading ring ---------- */
.loader-ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid var(--glass-border);
  border-top-color: var(--fg);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
body.loaded #loader { opacity: 0; pointer-events: none; }

/* ---------- Mouse glow ---------- */
#mouse-glow {
  position: fixed;
  top: 0; left: 0;
  width: 420px; height: 420px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(120,120,120,0.14), transparent 60%);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
html.dark #mouse-glow {
  background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 60%);
}

/* ---------- Animated blobs / gradient background ---------- */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 18s ease-in-out infinite;
}
.blob-1 {
  width: 480px; height: 480px;
  top: -120px; left: -100px;
  background: radial-gradient(circle, rgba(0,0,0,0.10), transparent 70%);
}
.blob-2 {
  width: 520px; height: 520px;
  bottom: -160px; right: -120px;
  background: radial-gradient(circle, rgba(0,0,0,0.08), transparent 70%);
  animation-delay: -6s;
}
html.dark .blob-1 { background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%); }
html.dark .blob-2 { background: radial-gradient(circle, rgba(255,255,255,0.06), transparent 70%); }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.08); }
  66%      { transform: translate(-30px, 20px) scale(0.95); }
}

/* Subtle dotted grid overlay (floating particles feel) */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black, transparent 75%);
  opacity: 0.5;
}

/* ---------- Navbar states ---------- */
#navbar.scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-link {
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  opacity: 0.7;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.nav-link:hover { opacity: 1; }
.nav-link.active {
  opacity: 1;
  background: var(--glass-bg);
}
.mobile-link {
  display: block;
  padding: 0.6rem 0.4rem;
  border-radius: 0.6rem;
  opacity: 0.8;
}
.mobile-link:hover { opacity: 1; background: var(--glass-bg); }

/* ---------- Icon buttons ---------- */
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 9999px;
  border: 1px solid var(--glass-border);
  color: var(--fg);
  transition: background 0.2s ease, transform 0.2s ease;
}
.icon-btn:hover { background: var(--glass-bg); transform: translateY(-1px); }

/* Sun/moon visibility per theme */
#theme-toggle .moon { display: none; }
#theme-toggle .sun  { display: block; }
html.dark #theme-toggle .moon { display: block; }
html.dark #theme-toggle .sun  { display: none; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.925rem;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}
.btn-primary {
  background: var(--fg);
  color: var(--bg);
}
.btn-primary:hover { transform: translateY(-2px); opacity: 0.9; }
.btn-ghost {
  border: 1px solid var(--glass-border);
  color: var(--fg);
}
.btn-ghost:hover { background: var(--glass-bg); transform: translateY(-2px); }

/* ---------- Glass cards ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- Section scaffolding ---------- */
.section { padding: 6rem 1.5rem; position: relative; }
.section-inner { max-width: 72rem; margin: 0 auto; }
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- Skill bars ---------- */
.skill-row { }
.skill-head { display: flex; justify-content: space-between; margin-bottom: 0.4rem; font-size: 0.9rem; }
.skill-track {
  height: 6px;
  border-radius: 9999px;
  background: var(--glass-border);
  overflow: hidden;
}
.skill-fill {
  height: 100%;
  width: 0;
  border-radius: 9999px;
  background: var(--fg);
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}

/* ---------- Accordions (collapse) ---------- */
.accordion {
  border: 1px solid var(--glass-border);
  border-radius: 0.9rem;
  background: var(--glass-bg);
  overflow: hidden;
}
.accordion > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary::after {
  content: "+";
  font-size: 1.2rem;
  opacity: 0.6;
  transition: transform 0.25s ease;
}
.accordion[open] > summary::after { transform: rotate(45deg); }
.accordion-body {
  padding: 0 1.1rem 1.1rem;
  opacity: 0.85;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 0.85; transform: translateY(0); }
}

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--glass-border);
}
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-dot {
  position: absolute;
  left: -1.75rem; top: 1.4rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 0 4px var(--bg);
}

/* ---------- Project / service / cert cards ---------- */
.card {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  border-radius: 1rem;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.card:hover { transform: translateY(-6px); border-color: var(--fg); }
.card-thumb {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, var(--glass-border) 0 1px, transparent 1px 14px),
    var(--glass-bg);
  opacity: 0.9;
}

/* ---------- Contact ---------- */
.contact-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
a.contact-item:hover { border-color: var(--fg); transform: translateY(-2px); }
.contact-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 0.7rem;
  border: 1px solid var(--glass-border);
  flex-shrink: 0;
}

/* ---------- Form ---------- */
.form-label { display: block; font-size: 0.85rem; opacity: 0.7; margin-bottom: 0.35rem; }
.form-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 0.7rem;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--fg);
  outline: none;
  transition: border-color 0.2s ease;
}
.form-input:focus { border-color: var(--fg); }
.form-input::placeholder { color: var(--fg); opacity: 0.4; }
.form-error {
  font-size: 0.78rem;
  color: #ef4444;
  margin-top: 0.3rem;
  min-height: 1rem;
}
.form-input.invalid { border-color: #ef4444; }

/* ============================================================
   Hero illustration: server rack + floating chips
   ============================================================ */
.illustration {
  position: relative;
  height: 320px;
  display: grid;
  place-items: center;
}
.rack {
  width: 190px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}
.rack-unit {
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  position: relative;
}
.led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg);
  animation: blink 2s infinite;
}
.led-2 { animation-delay: 0.6s; opacity: 0.5; }
.rack-unit:nth-child(2) .led { animation-delay: 0.3s; }
.rack-unit:nth-child(3) .led { animation-delay: 0.9s; }
.rack-unit:nth-child(4) .led { animation-delay: 1.2s; }
.bar {
  flex: 1;
  height: 6px;
  border-radius: 9999px;
  background: repeating-linear-gradient(90deg, var(--glass-border) 0 6px, transparent 6px 12px);
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

.chip {
  position: absolute;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
  animation: bob 5s ease-in-out infinite;
}
.chip-cloud { top: 20px; right: 24px; animation-delay: 0s; }
.chip-net   { bottom: 40px; left: 18px; animation-delay: -1.5s; }
.chip-code  { bottom: 90px; right: 12px; animation-delay: -3s; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
