/* ============================================
   WILLIAM GONZALEZ - PORTFOLIO
   Modern Backend & Cloud Engineer Portfolio
   ============================================ */

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0e14;
  --bg-secondary: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2128;
  --border: #21262d;
  --border-light: #30363d;
  --accent: #58a6ff;
  --accent-glow: rgba(88, 166, 255, 0.15);
  --accent2: #3fb950;
  --accent2-glow: rgba(63, 185, 80, 0.15);
  --muted: #8b949e;
  --text: #e6edf3;
  --text-dim: #c9d1d9;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ============================================
   NAVIGATION
   ============================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  transition: var(--transition);
}

.nav.scrolled {
  background: rgba(10, 14, 20, 0.95);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-brand {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand::before {
  content: '>';
  color: var(--accent2);
  font-size: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: var(--transition);
}

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

.nav-links a:hover::after {
  width: 100%;
}

.nav-cta {
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg) !important;
  border-radius: 6px;
  font-weight: 600 !important;
}

.nav-cta::after {
  display: none !important;
}

.nav-cta:hover {
  background: #79c0ff;
  transform: translateY(-1px);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: var(--transition);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 40px 80px;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-glow), transparent),
    radial-gradient(ellipse 60% 40% at 80% 50%, rgba(63, 185, 80, 0.08), transparent);
  pointer-events: none;
}

.hero-content {
  max-width: 900px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 60px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-tag {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent2);
  margin-bottom: 20px;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-tag::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--accent2);
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero-sub {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-sub span {
  color: var(--accent);
}

.hero-sub .separator {
  color: var(--border-light);
}

.hero-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: #79c0ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(88, 166, 255, 0.3);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.hero-photo-wrapper {
  position: relative;
}

.hero-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 3px solid var(--border);
  filter: grayscale(20%);
  transition: var(--transition);
}

.hero-photo:hover {
  filter: grayscale(0%);
  border-color: var(--accent);
  transform: scale(1.05);
}

.hero-photo-wrapper::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 1px solid var(--border);
  border-radius: 50%;
  animation: pulse-ring 3s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* ============================================
   SECTIONS
   ============================================ */
section {
  padding: 100px 40px;
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
}

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent2);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::before {
  content: '';
  width: 40px;
  height: 1px;
  background: var(--accent2);
}

h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about-text p {
  color: var(--text-dim);
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.8;
}

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

/* ============================================
   SKILLS SECTION
   ============================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.skill-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform: scaleX(0);
  transform-origin: left;
  transition: var(--transition);
}

.skill-card:hover {
  border-color: var(--border-light);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.skill-card:hover::before {
  transform: scaleX(1);
}

.skill-card h4 {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: var(--accent-glow);
  border: 1px solid rgba(88, 166, 255, 0.25);
  color: var(--text-dim);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  font-family: var(--mono);
  transition: var(--transition);
}

.tag:hover {
  background: rgba(88, 166, 255, 0.25);
  border-color: var(--accent);
  color: var(--text);
}

.tag.green {
  background: var(--accent2-glow);
  border-color: rgba(63, 185, 80, 0.25);
}

.tag.green:hover {
  background: rgba(63, 185, 80, 0.25);
  border-color: var(--accent2);
}

/* ============================================
   PROJECTS SECTION
   ============================================ */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 32px;
  transition: var(--transition);
}

.project-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.project-header {
  padding: 32px;
}

.project-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.project-header p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.project-bullets {
  list-style: none;
  margin-bottom: 20px;
}

.project-bullets li {
  color: var(--text-dim);
  font-size: 14px;
  padding: 6px 0 6px 20px;
  position: relative;
  line-height: 1.6;
}

.project-bullets li::before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--accent2);
}

.project-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.project-links a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.project-links a:hover {
  color: #79c0ff;
}

.diagram-section {
  padding: 0 32px 32px;
}

.diagram-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
  letter-spacing: 0.1em;
}

.diagram-wrap {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.diagram-wrap img {
  width: 100%;
  display: block;
}

/* ============================================
   DEMO / CREDENTIALS SECTION
   ============================================ */
.demo-section {
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 32px;
  margin-top: 40px;
}

.demo-section h2 {
  margin-bottom: 8px;
}

.demo-section > p {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 14px;
}

.demo-section > p a {
  color: var(--accent);
  text-decoration: none;
}

.demo-section > p a:hover {
  text-decoration: underline;
}

.cards-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.tab-btn {
  font-family: var(--mono);
  font-size: 12px;
  padding: 12px 24px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  font-weight: 500;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

thead tr {
  background: var(--bg);
}

th {
  padding: 12px 20px;
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  padding: 12px 20px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

tr:hover td {
  background: var(--accent-glow);
}

/* ============================================
   CONTACT SECTION
   ============================================ */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.contact-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  text-decoration: none;
  color: var(--text-dim);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
}

.contact-item:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.contact-icon {
  font-size: 20px;
  opacity: 0.7;
}

.contact-item span {
  font-family: var(--mono);
  font-size: 12px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  text-align: center;
  padding: 48px 40px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

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

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

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   ARCHITECTURE SUMMARY
   ============================================ */
.arch-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.arch-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.arch-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.arch-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

/* ============================================
   IMAGE ZOOM MODAL
   ============================================ */
.zoom-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.zoom-overlay.active {
  display: flex;
  opacity: 1;
}

.zoom-container {
  position: relative;
  width: 90vw;
  height: 90vh;
  overflow: hidden;
  cursor: grab;
  border-radius: 12px;
  background: #1a1a2e;
}

.zoom-container:active {
  cursor: grabbing;
}

.zoom-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.1s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

.zoom-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(22, 27, 34, 0.95);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.zoom-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.zoom-level {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  min-width: 50px;
  justify-content: center;
}

.zoom-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: rgba(22, 27, 34, 0.95);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
  backdrop-filter: blur(10px);
}

.zoom-close:hover {
  background: #f85149;
  border-color: #f85149;
  color: #fff;
}

.zoom-hint {
  position: absolute;
  top: 20px;
  left: 20px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: rgba(22, 27, 34, 0.9);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  z-index: 10;
  backdrop-filter: blur(10px);
}

.diagram-wrap {
  cursor: zoom-in;
  transition: var(--transition);
}

.diagram-wrap:hover {
  box-shadow: 0 0 0 2px var(--accent);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .nav {
    padding: 0 24px;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 20, 0.98);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links a {
    font-size: 18px;
  }

  .menu-toggle {
    display: flex;
  }

  .hero {
    padding: 120px 24px 60px;
  }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }

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

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

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

  .hero-photo-wrapper {
    order: -1;
  }

  .hero-photo {
    width: 150px;
    height: 150px;
  }

  section {
    padding: 60px 24px;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .project-header {
    padding: 24px;
  }

  .diagram-section {
    padding: 0 24px 24px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .demo-section {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .btn {
    padding: 8px 16px;
    font-size: 12px;
  }
}
