/* ===== CSS Variables ===== */
:root {
  --bg-primary: #060a14;
  --bg-secondary: #0c1222;
  --bg-card: rgba(12, 18, 34, 0.7);
  --text-primary: #ffffff;
  --text-secondary: #8892b0;
  --accent: #1a73e8;
  --accent-light: #4dabf7;
  --accent-glow: rgba(26, 115, 232, 0.35);
  --accent-glow-strong: rgba(26, 115, 232, 0.55);
  --border: rgba(26, 115, 232, 0.25);
  --border-hover: rgba(26, 115, 232, 0.6);
  --header-bg: rgba(6, 10, 20, 0.85);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8f9fc;
  --bg-secondary: #eef1f8;
  --bg-card: rgba(255, 255, 255, 0.85);
  --text-primary: #0a0e1a;
  --text-secondary: #4a5568;
  --accent-glow: rgba(26, 115, 232, 0.2);
  --accent-glow-strong: rgba(26, 115, 232, 0.35);
  --border: rgba(26, 115, 232, 0.2);
  --border-hover: rgba(26, 115, 232, 0.5);
  --header-bg: rgba(248, 249, 252, 0.9);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 5rem 0;
}

.section-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1.5rem;
}

.text-accent {
  color: var(--accent-light);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 50px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #1557b0);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:hover {
  box-shadow: 0 6px 28px var(--accent-glow-strong);
}

.btn--outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: rgba(26,115,232,0.22);
  box-shadow: none;
}

.btn--outline:hover {
  background: rgba(26, 115, 232, 0.06);
  box-shadow: 0 6px 18px rgba(26,115,232,0.08);
}

/* Focus visible for keyboard users */
button:focus-visible, a:focus-visible, .btn:focus-visible {
  outline: 3px solid rgba(26,115,232,0.18);
  outline-offset: 3px;
  border-radius: 8px;
}

.btn--sm {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

.btn--full {
  width: 100%;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), box-shadow var(--transition);
}

.header.scrolled {
  box-shadow: var(--shadow);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1rem;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--transition);
}

.logo:hover {
  color: var(--accent-light);
}

.nav__list {
  display: flex;
  gap: 1.25rem;
}

.nav__link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: 0.25rem 0;
  transition: color var(--transition);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow-strong);
  transition: width var(--transition), left var(--transition);
}

.nav__link:hover,
.nav__link.active {
  color: var(--text-primary);
}

.nav__link.active::after,
.nav__link:hover::after {
  width: 100%;
  left: 0;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: rotate(15deg);
}

.icon-sun { display: none; }
.icon-moon { display: block; }

[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 70px;
  background: linear-gradient(180deg, rgba(10,14,26,0.02) 0%, transparent 65%);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 6.2vw, 3.4rem);
  font-weight: 700;
  line-height: 1.08;
  margin-bottom: 0.5rem;
}

.hero__role {
  font-size: clamp(0.875rem, 2.2vw, 1rem);
  font-weight: 600;
  color: var(--accent-light);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  min-height: 1.5em;
  margin-bottom: 1rem;
}

.cursor {
  animation: blink 0.8s step-end infinite;
  color: var(--accent);
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero__desc {
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.hero__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero__image {
  display: flex;
  justify-content: center;
  perspective: 900px;
}

/* ===== Portrait (Hero & About) ===== */
.portrait {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  animation: portraitFloat 6s ease-in-out infinite;
  display: inline-block;
  overflow: visible;
}

.portrait--hero {
  width: min(100%, 320px);
}

.portrait--about {
  width: min(100%, 340px);
  animation-delay: -2s;
}

.portrait__inner {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  box-shadow:
    inset 0 6px 18px rgba(0,0,0,0.18),
    0 10px 30px rgba(0,0,0,0.22);
  transform-style: preserve-3d;
  transition: transform 0.35s ease, box-shadow 0.4s ease;
}

.portrait__inner--framed {
  padding: 6px;
  background: transparent;
}

.portrait__inner--framed img {
  border-radius: 50%;
}

.portrait__inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 12%;
  display: block;
  transition: transform 0.5s ease;
}

.portrait:hover .portrait__inner {
  box-shadow:
    0 28px 70px rgba(26, 115, 232, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.4);
}

.portrait:hover .portrait__inner img {
  transform: scale(1.04);
}

.portrait__glow {
  position: absolute;
  top: 16%;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 40%;
  background: radial-gradient(ellipse, rgba(26, 115, 232, 0.18) 0%, rgba(26, 115, 232, 0.03) 45%, transparent 70%);
  border-radius: 50%;
  filter: blur(20px);
  z-index: 1;
  animation: glowPulse 6s ease-in-out infinite;
  pointer-events: none;
}

.portrait__glow--frame {
  top: 8%;
  width: 86%;
  height: 70%;
  animation: glowPulse 3.5s ease-in-out infinite reverse;
}

.portrait__ring {
  display: none;
}

.portrait__ring--1 {
  width: 104%;
  aspect-ratio: 1;
}

.portrait__ring--2 {
  width: 92%;
  aspect-ratio: 1;
}

.portrait__ring--3 {
  width: 76%;
  aspect-ratio: 1;
}

/* Gold crescent behind portrait (subtle, on the right) */
.portrait::after {
  content: '';
  position: absolute;
  right: -6%;
  top: 6%;
  width: 58%;
  height: 88%;
  background: radial-gradient(circle at 28% 50%, rgba(216,176,91,0.98) 0%, rgba(216,176,91,0.9) 18%, rgba(196,156,72,0.55) 36%, transparent 45%);
  border-radius: 50%;
  transform: rotate(-10deg);
  filter: blur(1px);
  z-index: 2;
  pointer-events: none;
}

@keyframes portraitFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.55; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.12); }
}

@keyframes ringExpand {
  0% {
    opacity: 0.6;
    transform: translate(-50%, -55%) scale(0.85);
  }
  70% {
    opacity: 0.15;
    transform: translate(-50%, -55%) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -55%) scale(1.15);
  }
}

@keyframes borderPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(26, 115, 232, 0.35); }
  50% { box-shadow: 0 0 36px rgba(26, 115, 232, 0.6); }
}

[data-theme="light"] .portrait__inner {
  box-shadow:
    0 24px 56px rgba(26, 115, 232, 0.3),
    0 12px 28px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .portrait:hover .portrait__inner {
  box-shadow:
    0 32px 72px rgba(26, 115, 232, 0.45),
    0 16px 36px rgba(0, 0, 0, 0.15);
}

/* ===== About ===== */
.about {
  background: var(--bg-secondary);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}

.about__details {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.about__details li {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.about__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.about__value {
  font-size: 1.0625rem;
  font-weight: 500;
}

.about__image {
  display: flex;
  justify-content: center;
  perspective: 900px;
}

/* ===== Services ===== */
.services__header {
  text-align: center;
  margin-bottom: 3rem;
}

.services__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px var(--accent-glow-strong);
}

.service-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px var(--accent-glow);
}

.service-card__icon {
  color: var(--accent-light);
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: center;
}

.service-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.service-card__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ===== Contact ===== */
.contact {
  background: var(--bg-secondary);
}

.contact__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: start;
}

.contact__subtitle {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.social-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.social-link:hover {
  transform: translateY(-4px) scale(1.08);
}

.social-link--github {
  color: var(--text-primary);
}

.social-link--github:hover {
  border-color: #fff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
}

.social-link--instagram {
  color: #e1306c;
}

.social-link--instagram:hover {
  border-color: #e1306c;
  box-shadow: 0 0 16px rgba(225, 48, 108, 0.4);
}

.social-link--facebook {
  color: #1877f2;
}

.social-link--facebook:hover {
  border-color: #1877f2;
  box-shadow: 0 0 16px rgba(24, 119, 242, 0.4);
}

.social-link--whatsapp {
  color: #25d366;
}

.social-link--whatsapp:hover {
  border-color: #25d366;
  box-shadow: 0 0 16px rgba(37, 211, 102, 0.4);
}

.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 0 32px var(--accent-glow);
  backdrop-filter: blur(8px);
  transition: box-shadow var(--transition);
}

.contact-form:focus-within {
  box-shadow: 0 0 40px var(--accent-glow-strong);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-secondary);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* ===== Footer ===== */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer__tagline {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.footer__copy {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* ===== Animations ===== */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .hero__grid {
    grid-template-columns: 1fr 1fr;
  }

  .about__grid {
    grid-template-columns: 1fr 1fr;
  }

  .contact__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .services__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 767px) {
  .nav-toggle {
    display: flex;
  }

  .nav {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition), opacity var(--transition), visibility var(--transition);
  }

  .nav.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav__list {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .nav__link {
    display: block;
    padding: 0.75rem 1.5rem;
  }

  .header__actions .btn--outline {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .portrait,
  .portrait__glow,
  .portrait__ring,
  .portrait__inner--framed {
    animation: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}
