/* ================= RESET ================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; overscroll-behavior: none; }

/* Registered property for animated gradient border rotation */
@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ================= CUSTOM PROPERTIES ================= */
:root {
  --bg: #f0f2f5;
  --bg-card: rgba(255, 255, 255, 0.6);
  --text: #0f172a;
  --text-muted: #64748b;
  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #06b6d4;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(99, 102, 241, 0.35);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 25px 60px rgba(99, 102, 241, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --nav-border: rgba(0, 0, 0, 0.06);
  --nav-hover: rgba(0, 0, 0, 0.04);
  --nav-active-bg: #0f172a;
  --nav-active-text: #fff;
  --btn-secondary-bg: rgba(0, 0, 0, 0.04);
  --badge-working-bg: rgba(34, 197, 94, 0.12);
  --badge-working-text: #16a34a;
  --badge-working-border: rgba(34, 197, 94, 0.3);
  --badge-working-glow: rgba(34, 197, 94, 0.15);
  --badge-progress-bg: rgba(251, 146, 60, 0.12);
  --badge-progress-text: #c2410c;
  --badge-progress-border: rgba(251, 146, 60, 0.3);
  --orb-opacity: 0.12;
  --placeholder-border: rgba(0, 0, 0, 0.1);
  --placeholder-text: rgba(0, 0, 0, 0.25);
  --media-bg: rgba(0, 0, 0, 0.03);
  --media-border: rgba(0, 0, 0, 0.06);
}

.dark {
  --bg: #06060b;
  --bg-card: rgba(15, 18, 25, 0.55);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(99, 102, 241, 0.45);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 25px 60px rgba(99, 102, 241, 0.15);
  --nav-bg: rgba(6, 6, 11, 0.72);
  --nav-border: rgba(255, 255, 255, 0.06);
  --nav-hover: rgba(255, 255, 255, 0.06);
  --nav-active-bg: #f1f5f9;
  --nav-active-text: #0f172a;
  --btn-secondary-bg: rgba(255, 255, 255, 0.06);
  --badge-working-bg: rgba(34, 197, 94, 0.14);
  --badge-working-text: #4ade80;
  --badge-working-border: rgba(34, 197, 94, 0.4);
  --badge-working-glow: rgba(34, 197, 94, 0.12);
  --badge-progress-bg: rgba(251, 146, 60, 0.14);
  --badge-progress-text: #fb923c;
  --badge-progress-border: rgba(251, 146, 60, 0.4);
  --orb-opacity: 0.18;
  --placeholder-border: rgba(255, 255, 255, 0.06);
  --placeholder-text: rgba(255, 255, 255, 0.18);
  --media-bg: rgba(255, 255, 255, 0.03);
  --media-border: rgba(255, 255, 255, 0.06);
}

/* ================= BODY ================= */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100%;
}

/* ================= BACKGROUND ORBS ================= */
.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  clip-path: inset(0);
  -webkit-clip-path: inset(0);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: var(--orb-opacity);
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: var(--accent-1);
  top: -15%;
  right: -10%;
  animation: orbFloat1 25s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-2);
  bottom: -10%;
  left: -10%;
  animation: orbFloat2 30s ease-in-out infinite;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--accent-3);
  top: 40%;
  left: 35%;
  animation: orbFloat3 20s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-30px, 40px) scale(1.05); }
  50% { transform: translate(20px, -20px) scale(0.95); }
  75% { transform: translate(-10px, -30px) scale(1.02); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.08); }
  66% { transform: translate(-30px, 20px) scale(0.96); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, -40px) scale(1.1); }
}

/* ================= HEADER ================= */
.site-header {
  position: sticky;
  top: 0;
  width: 100%;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--nav-border);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  position: relative;
}

/* ================= NAV ================= */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav a:hover {
  background: var(--nav-hover);
  color: var(--text);
}

.nav a.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
}

/* ================= THEME TOGGLE ================= */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 50%;
  padding: 0;
  font-size: 0;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  opacity: 0.6;
}

.theme-toggle:hover {
  transform: scale(1.1);
  border-color: var(--border-hover);
  opacity: 1;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ================= PAGE LAYOUT ================= */
.page-center {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.page-column {
  flex-direction: column;
  align-items: center;
  padding: 80px 28px 60px;
  gap: 48px;
}

/* ================= GLASS CARD ================= */
.card {
  position: relative;
  overflow: hidden;
  width: min(1200px, 92vw);
  min-height: calc(100vh - 62px - 56px);
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  padding: 54px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================= HERO ================= */
.hero {
  width: 100%;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 60px;
  align-items: center;
  text-align: left;
  max-width: 1050px;
  margin: 0 auto;
}

.hero-photo {
  width: 340px;
  height: 440px;
  border-radius: 24px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 0 80px rgba(99, 102, 241, 0.06);
  background: var(--media-bg);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.hero .about {
  margin-top: 16px;
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 17px;
  max-width: 520px;
}

.hero-actions {
  margin-top: 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ================= GRADIENT TEXT ================= */
.gradient-text {
  background: linear-gradient(
    135deg,
    var(--accent-1),
    var(--accent-2),
    var(--accent-3),
    var(--accent-1)
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ================= BUTTONS ================= */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
  border: none;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.button.secondary {
  background: var(--btn-secondary-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.button.secondary:hover {
  border-color: var(--border-hover);
  color: var(--accent-1);
}

/* ================= SECTION HEADER ================= */
.section-header {
  text-align: center;
  max-width: 600px;
}

.section-header h1 {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 0 0 12px;
}

.section-header p {
  font-size: 17px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ================= PROJECTS GRID ================= */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  width: 100%;
  max-width: 1100px;
}

/* ================= PROJECT CARD ================= */
.project-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 34px 34px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.project-card:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
}

.project-card h2,
.project-card h3 {
  margin: 10px 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.project-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 15px;
}

/* ================= PROJECT MEDIA ================= */
.project-media {
  margin-top: 18px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--media-border);
  display: grid;
  place-items: center;
  position: relative;
}

.project-preview {
  width: 100%;
  display: block;
  border-radius: 0;
}

.project-media .media-fallback {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px;
}

.project-media.no-image .media-fallback { display: block; }
.project-media:not(.no-image) .media-fallback { display: none; }

/* ================= VIEW SITE LINK ================= */
.view-site {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 18px;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-1);
  transition: gap 0.2s ease;
}

.project-card:hover .view-site {
  gap: 10px;
}

/* ================= STATUS BADGES ================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-badge.working {
  background: var(--badge-working-bg);
  color: var(--badge-working-text);
  border: 1px solid var(--badge-working-border);
  box-shadow: 0 0 12px var(--badge-working-glow);
}

.status-badge.working::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.status-badge.in-progress {
  background: var(--badge-progress-bg);
  color: var(--badge-progress-text);
  border: 1px solid var(--badge-progress-border);
}

/* ================= PLACEHOLDER CARDS ================= */
.placeholder-card {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 2px dashed var(--placeholder-border) !important;
  box-shadow: none !important;
  cursor: default;
  align-items: center;
  justify-content: center;
}

.placeholder-card:hover {
  transform: none !important;
  box-shadow: none !important;
  border-color: var(--placeholder-border) !important;
}

.placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.placeholder-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px dashed var(--placeholder-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 300;
  color: var(--placeholder-text);
}

.placeholder-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--placeholder-text);
}

/* ================= CONTACT ================= */
.contact-content {
  text-align: center;
  max-width: 500px;
}

.contact-content h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 0 0 16px;
}

.contact-content p {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
}

.contact-actions {
  margin-top: 32px;
}

/* ================= INTERACTIVE EFFECTS ================= */

/* Cursor spotlight on hero card */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(99, 102, 241, 0.04),
    transparent 40%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.card:hover::after {
  opacity: 1;
}

/* Cursor spotlight on project cards */
.project-card:not(.placeholder-card)::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(99, 102, 241, 0.07),
    transparent 40%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:not(.placeholder-card):hover::after {
  opacity: 1;
}

/* Rotating gradient border on project cards */
.project-card:not(.placeholder-card)::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 23px;
  padding: 2px;
  background: conic-gradient(
    from var(--border-angle),
    var(--accent-1),
    var(--accent-2),
    var(--accent-3),
    var(--accent-2),
    var(--accent-1)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.project-card:not(.placeholder-card):hover::before {
  opacity: 1;
  animation: rotateBorder 4s linear infinite;
}

@keyframes rotateBorder {
  to { --border-angle: 360deg; }
}

/* Button press feedback */
.button.primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.button.secondary:active {
  transform: scale(0.97);
}

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

/* ================= ENTRANCE ANIMATIONS ================= */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }
.fade-in-delay-4 { animation-delay: 0.4s; }
.fade-in-delay-5 { animation-delay: 0.5s; }

/* ================= HOMEPAGE LAYOUT ================= */
.homepage {
  position: relative;
  z-index: 1;
}

.hero-section {
  min-height: calc(100vh - 62px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  gap: 0;
}

.card.hero-card {
  min-height: auto;
}

/* ================= HERO SUB ================= */
.hero-sub {
  margin-top: 16px;
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 17px;
  max-width: 520px;
}

/* ================= SCROLL HINT ================= */
.scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 24px;
  transition: border-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
  animation: fadeInUp 0.8s ease forwards, bounceHint 2s ease-in-out 1.5s infinite;
}

.scroll-hint:hover {
  border-color: var(--border-hover);
  color: var(--accent-1);
  transform: translateY(2px);
}

@keyframes bounceHint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ================= SECTIONS ================= */
.section {
  padding: 80px 28px;
}

.section-compact {
  padding: 60px 28px;
}

.section[id] {
  scroll-margin-top: 80px;
}

.section-inner {
  max-width: 900px;
  margin: 0 auto;
}

.section-heading {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  color: var(--text);
}

/* ================= FEATURED PROJECTS ================= */
.featured-projects {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
}

.featured-card {
  width: 100%;
  max-width: 520px;
}

div.project-card {
  cursor: default;
}

/* ================= PROJECT LINKS ================= */
.project-links {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
}

/* ================= SMALL BUTTON ================= */
.button.small {
  padding: 10px 20px;
  font-size: 13px;
}

/* ================= ABOUT ================= */
.about-centered {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.about-text {
  max-width: 600px;
}

.about-text p {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.8;
  margin: 0 0 16px;
  text-align: left;
}

.about-text p:last-child {
  margin-bottom: 0;
}

/* ================= FOOTER ================= */
.site-footer {
  padding: 48px 28px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* ================= SCROLL ANIMATIONS ================= */
.fade-in-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================= RESPONSIVE (TABLET) ================= */
@media (max-width: 900px) {
  .card {
    min-height: auto;
    padding: 36px 28px;
  }

  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
    gap: 28px;
  }

  .hero-photo {
    width: min(260px, 65vw);
    height: min(320px, 75vw);
  }

  .hero h1 {
    font-size: 38px;
  }

  .hero .about {
    max-width: 100%;
    font-size: 16px;
  }

  .hero-actions {
    justify-content: center;
  }

  .page-column {
    padding: 48px 20px 40px;
    gap: 32px;
  }

  .section-header h1 {
    font-size: 34px;
  }

  .project-card {
    min-height: 0;
  }

  .project-media {
    max-height: 260px;
  }

  .contact-content h1 {
    font-size: 36px;
  }

  .header-inner {
    padding: 12px 20px;
  }

  .nav a {
    padding: 7px 14px;
    font-size: 13px;
  }

  .button {
    padding: 12px 24px;
    font-size: 14px;
  }

  .hero-section {
    min-height: auto;
    padding: 20px;
  }

  .section {
    padding: 48px 20px;
  }

  .section-compact {
    padding: 40px 20px;
  }

  .section-heading {
    font-size: 22px;
    margin-bottom: 20px;
  }

  .featured-card {
    max-width: 100%;
  }

  .button.small {
    padding: 10px 18px;
    font-size: 12px;
  }
}

/* ================= RESPONSIVE (MOBILE) ================= */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 32px;
  }

  .nav a {
    padding: 6px 10px;
    font-size: 12px;
  }

  .page-center {
    padding: 16px;
  }

  .card {
    padding: 28px 20px;
    border-radius: 22px;
  }

  .contact-content h1 {
    font-size: 32px;
  }

  .section {
    padding: 40px 16px;
  }

  .section-compact {
    padding: 32px 16px;
  }

  .section-heading {
    font-size: 20px;
    margin-bottom: 16px;
  }
}

/* ================= REDUCED MOTION ================= */
@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  .gradient-text { animation: none; }
  .fade-in { animation: none; opacity: 1; }
  .status-badge.working::before { animation: none; }
  .project-card:not(.placeholder-card):hover::before { animation: none; }
  .fade-in-scroll { opacity: 1; transform: none; transition: none; }
  .scroll-hint { animation: none; opacity: 1; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
