/* ============================================================
   Richard Kalab — Portfolio
   Custom styles layered on top of Tailwind CDN utilities.
   ============================================================ */

:root {
  --grid: rgba(15, 23, 42, 0.06);
}
html.dark {
  --grid: rgba(255, 255, 255, 0.05);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* offset for sticky navbar */
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(99, 102, 241, 0.3);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.4);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.6); background-clip: content-box; }

/* ---------- Navbar ---------- */
#navbar.scrolled {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}
html.dark #navbar.scrolled {
  background: rgba(10, 10, 10, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.nav-link {
  padding: 0.5rem 0.85rem;
  border-radius: 0.55rem;
  color: rgb(71, 85, 105);
  transition: color .2s, background-color .2s;
}
html.dark .nav-link { color: rgb(148, 163, 184); }
.nav-link:hover { color: rgb(15, 23, 42); background: rgba(15,23,42,0.04); }
html.dark .nav-link:hover { color: #fff; background: rgba(255,255,255,0.05); }

.mobile-link {
  padding: 0.7rem 0.85rem;
  border-radius: 0.6rem;
  color: rgb(71, 85, 105);
}
html.dark .mobile-link { color: rgb(203, 213, 225); }
.mobile-link:hover { background: rgba(15,23,42,0.04); }
html.dark .mobile-link:hover { background: rgba(255,255,255,0.05); }

.lang-btn { color: rgb(100, 116, 139); }
.lang-btn.active { background: rgb(79, 70, 229); color: #fff; }
html.dark .lang-btn.active { background: rgb(99, 102, 241); color: #fff; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 0.7rem;
  font-weight: 600; font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(180deg, #6366f1, #4f46e5);
  box-shadow: 0 8px 24px -6px rgba(79, 70, 229, 0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 14px 32px -8px rgba(79, 70, 229, 0.6); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 0.7rem;
  font-weight: 600; font-size: 0.95rem;
  color: rgb(30, 41, 59);
  background: rgba(15,23,42,0.03);
  border: 1px solid rgba(15,23,42,0.1);
  transition: transform .18s ease, background-color .18s ease, border-color .18s;
}
html.dark .btn-secondary { color: rgb(226, 232, 240); background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.12); }
.btn-secondary:hover { transform: translateY(-2px); background: rgba(15,23,42,0.06); }
html.dark .btn-secondary:hover { background: rgba(255,255,255,0.08); }

/* ---------- Section helpers ---------- */
.section-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgb(79, 70, 229);
}
html.dark .section-eyebrow { color: rgb(129, 140, 248); }
.section-eyebrow::before { content: ""; width: 1.6rem; height: 2px; border-radius: 2px; background: currentColor; opacity: .5; }
.section-eyebrow.justify-center { justify-content: center; }

.section-title {
  margin-top: 0.9rem;
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  color: rgb(15, 23, 42);
}
html.dark .section-title { color: #fff; }

.section-lead {
  margin-top: 1rem;
  font-size: 1.05rem; line-height: 1.7;
  color: rgb(71, 85, 105);
}
html.dark .section-lead { color: rgb(148, 163, 184); }

/* ---------- Hero background ---------- */
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}
.hero-glow {
  position: absolute; top: -18%; left: 50%; transform: translateX(-50%);
  width: 60rem; height: 36rem; max-width: 120vw;
  background: radial-gradient(circle at 50% 50%, rgba(99,102,241,0.22), transparent 62%);
  filter: blur(20px);
  pointer-events: none;
}
html.dark .hero-glow { background: radial-gradient(circle at 50% 50%, rgba(99,102,241,0.28), transparent 60%); }

/* ---------- Service cards ---------- */
.service-card {
  position: relative;
  padding: 1.6rem;
  border-radius: 1rem;
  border: 1px solid rgba(15,23,42,0.08);
  background: #fff;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
html.dark .service-card { background: #0d0d0d; border-color: rgba(255,255,255,0.08); }
.service-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,0.5); box-shadow: 0 18px 40px -16px rgba(79,70,229,0.35); }

.icon-box {
  display: grid; place-items: center;
  height: 2.85rem; width: 2.85rem;
  border-radius: 0.7rem;
  margin-bottom: 1.1rem;
  color: rgb(79, 70, 229);
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.2);
}
html.dark .icon-box { color: rgb(165, 180, 252); background: rgba(99,102,241,0.12); }
.icon-box svg { height: 1.45rem; width: 1.45rem; }

.service-title { font-size: 1.1rem; font-weight: 700; color: rgb(15,23,42); }
html.dark .service-title { color: #fff; }
.service-desc { margin-top: 0.55rem; font-size: 0.95rem; line-height: 1.6; color: rgb(71,85,105); }
html.dark .service-desc { color: rgb(148,163,184); }

/* ---------- Tech badges ---------- */
.tech-group {
  padding: 1.4rem;
  border-radius: 1rem;
  border: 1px solid rgba(15,23,42,0.08);
  background: #fff;
}
html.dark .tech-group { background: #0d0d0d; border-color: rgba(255,255,255,0.08); }
.tech-cat {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: rgb(100,116,139); margin-bottom: 0.9rem;
}
html.dark .tech-cat { color: rgb(148,163,184); }

.badge {
  display: inline-flex; align-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem; font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 0.5rem;
  color: rgb(51,65,85);
  background: rgba(15,23,42,0.04);
  border: 1px solid rgba(15,23,42,0.08);
  transition: color .18s, background-color .18s, border-color .18s, transform .18s;
}
html.dark .badge { color: rgb(203,213,225); background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
.badge:hover { color: rgb(79,70,229); border-color: rgba(99,102,241,0.45); background: rgba(99,102,241,0.08); transform: translateY(-1px); }
html.dark .badge:hover { color: rgb(165,180,252); }

/* ---------- Project cards ---------- */
.project-card {
  display: flex; flex-direction: column;
  padding: 1.8rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(15,23,42,0.08);
  background: #fff;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
html.dark .project-card { background: #0d0d0d; border-color: rgba(255,255,255,0.08); }
.project-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,0.4); box-shadow: 0 22px 48px -20px rgba(79,70,229,0.35); }

.project-card .proj-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1.25rem; }
.project-card .proj-num {
  font-family: "JetBrains Mono", monospace; font-size: 0.8rem; font-weight: 600;
  color: rgb(79,70,229); padding: 0.25rem 0.55rem; border-radius: 0.4rem;
  background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.2);
}
html.dark .project-card .proj-num { color: rgb(165,180,252); }
.project-card h3 { font-size: 1.25rem; font-weight: 700; color: rgb(15,23,42); }
html.dark .project-card h3 { color: #fff; }

.proj-block { margin-top: 0.9rem; }
.proj-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: rgb(79,70,229);
}
html.dark .proj-label { color: rgb(129,140,248); }
.proj-text { margin-top: 0.25rem; font-size: 0.93rem; line-height: 1.6; color: rgb(71,85,105); }
html.dark .proj-text { color: rgb(148,163,184); }

.proj-tags { margin-top: 1.1rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.proj-tag {
  font-family: "JetBrains Mono", monospace; font-size: 0.72rem;
  padding: 0.25rem 0.55rem; border-radius: 0.4rem;
  color: rgb(71,85,105); background: rgba(15,23,42,0.04); border: 1px solid rgba(15,23,42,0.07);
}
html.dark .proj-tag { color: rgb(203,213,225); background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.07); }

/* ---------- Why cards ---------- */
.why-card {
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(15,23,42,0.08);
  background: #fff;
  transition: transform .25s ease, border-color .25s;
}
html.dark .why-card { background: #0d0d0d; border-color: rgba(255,255,255,0.08); }
.why-card:hover { transform: translateY(-3px); border-color: rgba(99,102,241,0.4); }
.why-card .why-check {
  display: grid; place-items: center; height: 2.2rem; width: 2.2rem; border-radius: 0.6rem;
  margin-bottom: 0.9rem; color: #fff;
  background: linear-gradient(180deg, #6366f1, #4f46e5);
}
.why-card .why-check svg { height: 1.2rem; width: 1.2rem; }
.why-card h3 { font-size: 1.05rem; font-weight: 700; color: rgb(15,23,42); }
html.dark .why-card h3 { color: #fff; }
.why-card p { margin-top: 0.45rem; font-size: 0.93rem; line-height: 1.6; color: rgb(71,85,105); }
html.dark .why-card p { color: rgb(148,163,184); }

/* ---------- Looking list ---------- */
.looking-item {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 500; color: rgb(30,41,59);
}
html.dark .looking-item { color: rgb(226,232,240); }
.looking-item svg { height: 1.05rem; width: 1.05rem; color: rgb(79,70,229); flex-shrink: 0; }
html.dark .looking-item svg { color: rgb(129,140,248); }

/* ---------- References ---------- */
.ref-card {
  display: flex; flex-direction: column;
  padding: 1.8rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(15,23,42,0.08);
  background: #fff;
}
html.dark .ref-card { background: #0d0d0d; border-color: rgba(255,255,255,0.08); }
.ref-card .quote-mark { font-size: 2.6rem; line-height: 1; color: rgba(99,102,241,0.35); font-family: Georgia, serif; }
.ref-card blockquote { font-size: 1rem; line-height: 1.65; color: rgb(51,65,85); }
html.dark .ref-card blockquote { color: rgb(203,213,225); }
.ref-card .ref-author { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid rgba(15,23,42,0.08); }
html.dark .ref-card .ref-author { border-top-color: rgba(255,255,255,0.08); }
.ref-card .ref-name { font-weight: 700; color: rgb(15,23,42); }
html.dark .ref-card .ref-name { color: #fff; }
.ref-card .ref-role { font-size: 0.85rem; color: rgb(100,116,139); }
html.dark .ref-card .ref-role { color: rgb(148,163,184); }

/* ---------- Contact cards ---------- */
.contact-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  min-width: 12rem;
  padding: 1.5rem 1.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(15,23,42,0.08);
  background: #fff;
  font-weight: 600; color: rgb(15,23,42);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
html.dark .contact-card { background: #0d0d0d; border-color: rgba(255,255,255,0.08); color: #fff; }
.contact-card svg { color: rgb(79,70,229); }
html.dark .contact-card svg { color: rgb(129,140,248); }
.contact-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,0.45); box-shadow: 0 18px 40px -18px rgba(79,70,229,0.35); }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
  .btn-primary:hover, .btn-secondary:hover, .service-card:hover,
  .project-card:hover, .contact-card:hover, .why-card:hover { transform: none; }
}
