/* ==========================================================================
   davidgn.pages.dev · Full Modern Stylesheet
   David González Naveros · Portfolio & Presentació Personal
   ========================================================================== */

:root {
  --font-sans: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fredoka', var(--font-sans);

  /* Paleta Mode Clar */
  --bg-body: #fff9f5;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f8f1eb;
  --bg-accent-soft: rgba(56, 189, 248, 0.12);

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --border-color: #2d3748;
  --border-subtle: rgba(45, 55, 72, 0.15);

  --color-primary: #fdbcb4;
  --color-primary-dark: #f87171;
  --color-accent: #38bdf8;
  --color-accent-dark: #0284c7;
  --color-secondary: #add8e6;
  --color-emerald: #10b981;
  --color-emerald-dark: #059669;
  --color-amber: #f59e0b;
  --color-purple: #c084fc;

  --shadow-sm: 3px 3px 0 var(--border-color);
  --shadow-md: 5px 5px 0 var(--border-color);
  --shadow-lg: 8px 8px 0 var(--border-color);
  --shadow-hover: 7px 7px 0 var(--border-color);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --glow-1: rgba(253, 188, 180, 0.45);
  --glow-2: rgba(173, 216, 230, 0.5);
  --glow-3: rgba(196, 181, 253, 0.4);
  --dot-pattern: rgba(45, 55, 72, 0.06);

  --container-max: 1120px;
  --header-height: 74px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="dark"] {
  --bg-body: #181512;
  --bg-surface: #221d19;
  --bg-surface-elevated: #2a241f;
  --bg-subtle: #1c1814;
  --bg-accent-soft: rgba(56, 189, 248, 0.18);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --border-color: #383129;
  --border-subtle: rgba(255, 255, 255, 0.12);

  --color-primary: #c98a80;
  --color-primary-dark: #f87171;
  --color-accent: #38bdf8;
  --color-accent-dark: #38bdf8;
  --color-secondary: #475569;
  --color-emerald: #34d399;
  --color-emerald-dark: #10b981;

  --shadow-sm: 3px 3px 0 #0d0b09;
  --shadow-md: 5px 5px 0 #0d0b09;
  --shadow-lg: 8px 8px 0 #0d0b09;
  --shadow-hover: 7px 7px 0 #0d0b09;

  --glow-1: rgba(248, 113, 113, 0.15);
  --glow-2: rgba(56, 189, 248, 0.15);
  --glow-3: rgba(192, 132, 252, 0.15);
  --dot-pattern: rgba(255, 255, 255, 0.04);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1.5rem);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-body);
  background-image:
    radial-gradient(circle at 1px 1px, var(--dot-pattern) 1px, transparent 1.6px),
    radial-gradient(55rem 32rem at 110% -5%, var(--glow-1), transparent 60%),
    radial-gradient(48rem 30rem at -10% 25%, var(--glow-2), transparent 58%),
    radial-gradient(52rem 34rem at 50% 115%, var(--glow-3), transparent 62%);
  background-size: 26px 26px, 100% 100%, 100% 100%, 100% 100%;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-body) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 3px solid var(--border-color);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.brand-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--color-primary);
  box-shadow: 2px 2px 0 var(--border-color);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.brand-avatar img {
  width: 28px;
  height: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-accent-soft);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.btn-theme {
  width: 42px;
  height: 42px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 1.15rem;
  box-shadow: 2px 2px 0 var(--border-color);
  display: grid;
  place-items: center;
  transition: var(--transition);
}

.btn-theme:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--border-color);
}

.btn-theme:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--border-color);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-surface);
  box-shadow: 2px 2px 0 var(--border-color);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 8px;
}

.nav-toggle span {
  width: 20px;
  height: 2.5px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  padding: 4.5rem 0 3.5rem;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 3.5rem;
  align-items: center;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.4rem;
}

.badge-dot {
  width: 9px;
  height: 9px;
  background: var(--color-emerald);
  border-radius: 50%;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.hero-title {
  font-size: clamp(2.5rem, 5.5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero-tagline {
  font-size: clamp(1.15rem, 2.3vw, 1.4rem);
  font-weight: 700;
  color: var(--color-accent-dark);
  margin-bottom: 1.25rem;
  line-height: 1.35;
}

.hero-lead {
  font-size: 1.12rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 1rem;
  border: 2.5px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  text-decoration: none;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--border-color);
}

.btn-primary {
  background: var(--color-primary);
  color: #1e293b;
}

.btn-accent {
  background: var(--color-accent);
  color: #0f172a;
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn-hub {
  background: var(--color-emerald);
  color: #064e3b;
}

/* Hero Visual / Avatar Card */
.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
}

.avatar-card {
  position: relative;
  background: var(--bg-surface);
  border: 3.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1.8rem 1.8rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--color-primary) 20%, var(--bg-surface)), var(--bg-surface) 50%);
}

.avatar-portrait {
  position: relative;
  width: 170px;
  height: 250px;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: radial-gradient(circle, color-mix(in srgb, var(--color-accent) 25%, transparent) 0%, transparent 70%);
}

.avatar-portrait img {
  width: 140px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 rgba(0,0,0,0.18));
  transition: transform 0.25s ease;
}

.avatar-portrait:hover img {
  transform: scale(1.06) rotate(-2deg);
}

.avatar-name {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.avatar-role {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 1rem;
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-body);
  border: 1.5px solid var(--border-color);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-secondary);
}

/* Floating stickers */
.sticker {
  position: absolute;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  z-index: 2;
  white-space: nowrap;
}

.sticker-1 {
  top: 15px;
  left: -20px;
  transform: rotate(-6deg);
  background: var(--color-secondary);
  color: #1e293b;
}

.sticker-2 {
  bottom: 45px;
  right: -25px;
  transform: rotate(5deg);
  background: var(--color-primary);
  color: #1e293b;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */
.section {
  padding: 4.5rem 0;
}

.section-alt {
  background: color-mix(in srgb, var(--bg-subtle) 70%, var(--bg-body));
  border-top: 3px solid var(--border-color);
  border-bottom: 3px solid var(--border-color);
}

.section-head {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 3.2rem;
}

.section-kicker {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent-dark);
  margin-bottom: 0.4rem;
}

.section-title {
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 0.8rem;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Philosophy & About Grid
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.6rem;
}

.card {
  background: var(--bg-surface);
  border: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-hover);
}

.card-icon {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: var(--radius-md);
  border: 2.5px solid var(--border-color);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  margin-bottom: 1.25rem;
  box-shadow: 2px 2px 0 var(--border-color);
}

.card-title {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.card-text {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.65;
}

/* ==========================================================================
   Projects Grid
   ========================================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.8rem;
}

.project-card {
  background: var(--bg-surface);
  border: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition);
  position: relative;
}

.project-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-hover);
}

.project-card-featured {
  background: linear-gradient(155deg, color-mix(in srgb, var(--color-primary) 18%, var(--bg-surface)), var(--bg-surface) 60%);
  border-color: var(--border-color);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.project-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  background: var(--color-secondary);
  color: #1e293b;
}

.project-badge.active {
  background: var(--color-emerald);
  color: #064e3b;
}

.project-title {
  font-size: 1.45rem;
}

.project-desc {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.6;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.tag {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.project-action {
  margin-top: 0.8rem;
}

/* ==========================================================================
   Career Timeline
   ========================================================================== */
.timeline {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  padding-left: 2.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: var(--border-color);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 2.2rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -2.5rem;
  top: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border-color);
  background: var(--color-primary);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  box-shadow: 2px 2px 0 var(--border-color);
  z-index: 2;
}

.timeline-item.active .timeline-marker {
  background: var(--color-emerald);
}

.timeline-content {
  background: var(--bg-surface);
  border: 2.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.timeline-content:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.timeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.timeline-role {
  font-size: 1.18rem;
  font-weight: 800;
}

.timeline-period {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
}

.timeline-org {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-accent-dark);
  margin-bottom: 0.6rem;
}

.timeline-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ==========================================================================
   Education & Skills
   ========================================================================== */
.edu-skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

.edu-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.edu-item {
  background: var(--bg-surface);
  border: 2.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow-sm);
}

.edu-degree {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.edu-school {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-accent-dark);
}

.edu-years {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 800;
}

.skills-group {
  margin-bottom: 1.5rem;
}

.skills-group:last-child {
  margin-bottom: 0;
}

.skills-title {
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.skills-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--border-color);
  transition: var(--transition);
}

.skill-pill:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--border-color);
}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.contact-box {
  background: var(--bg-surface);
  border: 3.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  background: linear-gradient(160deg, color-mix(in srgb, var(--color-secondary) 25%, var(--bg-surface)), var(--bg-surface) 60%);
}

.contact-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin: 2.2rem 0;
}

.contact-card {
  background: var(--bg-body);
  border: 2.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.contact-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-md);
}

.contact-icon {
  font-size: 1.8rem;
}

.contact-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.contact-value {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--text-primary);
  word-break: break-all;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: auto;
  border-top: 3px solid var(--border-color);
  background: var(--bg-surface);
  padding: 2.5rem 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
  font-weight: 700;
}

.footer-nav a:hover {
  color: var(--color-accent-dark);
  text-decoration: underline;
}

.footer-copy {
  font-size: 0.85rem;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2.5rem;
  }

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

  .hero-visual {
    order: -1;
  }

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

@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 3px solid var(--border-color);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    transform: translateY(-150%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
  }

  .nav-menu.is-active {
    transform: translateY(0);
  }

  .nav-toggle {
    display: flex;
  }

  .sticker-1 { left: 0; }
  .sticker-2 { right: 0; }
}

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