/* ══════════════════════════════════════
   ALFONSO CANO — 2026 Liquid Glass
   ══════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
* { touch-action: manipulation; }

/* ── THEME TOKENS ── */
:root {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', var(--font-body);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 100px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --nav-h: 60px;
}

/* ── DARK (default) ── */
[data-theme="dark"] {
  --bg: #1f2124;
  --bg-end: #171718;
  --bg-subtle: #3a3a3a;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.16);
  --text-primary: #f0f2f5;
  --text-secondary: #a0a5ae;
  --text-tertiary: #6a6f7a;
  --accent: #e0e4ea;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-glow: rgba(255, 255, 255, 0.04);
  --badge-bg: rgba(74, 222, 128, 0.08);
  --badge-border: rgba(74, 222, 128, 0.2);
  --badge-text: #4ade80;
  --shadow: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --orb-1: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 70%);
  --orb-2: radial-gradient(circle, rgba(200,200,210,0.03) 0%, transparent 70%);
  --orb-3: radial-gradient(circle, rgba(180,190,200,0.03) 0%, transparent 70%);
  --noise-opacity: 0.02;
  --dock-bg: rgba(40, 42, 48, 0.35);
  --dock-border: rgba(255, 255, 255, 0.1);
  --icon-fill: currentColor;
}

/* ── LIGHT ── */
[data-theme="light"] {
  --bg: #f0f0f2;
  --bg-end: #e8e8ec;
  --bg-subtle: #e5e5e8;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-hover: rgba(255, 255, 255, 0.8);
  --glass: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-border-hover: rgba(0, 0, 0, 0.1);
  --text-primary: #1a1a1e;
  --text-secondary: #6b6e78;
  --text-tertiary: #a0a3ab;
  --accent: #3a3e44;
  --accent-soft: rgba(0, 0, 0, 0.05);
  --accent-glow: rgba(0, 0, 0, 0.03);
  --badge-bg: rgba(22, 163, 74, 0.08);
  --badge-border: rgba(22, 163, 74, 0.2);
  --badge-text: #16a34a;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --orb-1: radial-gradient(circle, rgba(0,0,0,0.03) 0%, transparent 70%);
  --orb-2: radial-gradient(circle, rgba(0,0,0,0.02) 0%, transparent 70%);
  --orb-3: radial-gradient(circle, rgba(0,0,0,0.02) 0%, transparent 70%);
  --noise-opacity: 0.015;
  --dock-bg: rgba(255, 255, 255, 0.3);
  --dock-border: rgba(0, 0, 0, 0.06);
  --icon-fill: currentColor;
}

/* ── BASE ── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: var(--bg-end);
  overscroll-behavior: none;
}

body {
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-end) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

/* ── AMBIENT BACKGROUND ── */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: drift 20s ease-in-out infinite alternate;
}

.ambient-orb--1 {
  width: 500px; height: 500px;
  top: -15%; left: -10%;
  background: var(--orb-1);
}

.ambient-orb--2 {
  width: 400px; height: 400px;
  bottom: 10%; right: -10%;
  background: var(--orb-2);
  animation-delay: -7s;
  animation-duration: 25s;
}

.ambient-orb--3 {
  width: 350px; height: 350px;
  top: 40%; left: 50%;
  background: var(--orb-3);
  animation-delay: -14s;
  animation-duration: 22s;
}

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.08); }
}

/* ── NOISE TEXTURE ── */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
}

/* ── MAIN ── */
main {
  position: relative;
  z-index: 2;
  padding: 56px 24px;
  padding-bottom: calc(var(--nav-h) + 48px);
  max-width: 520px;
  margin: 0 auto;
}

/* ── SECTIONS ── */
.section {
  display: none;
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  filter: blur(4px);
}

.section.active {
  display: block;
  animation: sectionIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.section.leaving {
  display: block;
  animation: sectionOut 0.15s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes sectionIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes sectionOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    filter: blur(4px);
  }
}

/* ── SECTION LABEL ── */
.section-label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 28px;
}

/* ── HERO ── */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 7vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 32px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, #ffffff, #c0c4cc, #8a90a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .gradient-text {
  background: linear-gradient(135deg, #2a2e34, #4a5060, #6a7080);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── BIO ── */
.bio {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-weight: 400;
}

.highlight {
  color: var(--text-primary);
  font-weight: 500;
}

/* ── TAGS ── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.tag {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  color: var(--text-tertiary);
  background: transparent;
  transition: all var(--transition);
}

.tag:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
}

[data-theme="light"] .tag {
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .tag:hover {
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
}

.tag.sm {
  font-size: 0.58rem;
  padding: 3px 8px;
}

/* ── CARDS ── */
.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-glow), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.card-link,
.card-link:hover,
.card-link:visited,
.card-link:active,
.card-link * {
  text-decoration: none;
  color: inherit;
}

.card-link { display: block; cursor: pointer; }

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.card-icon-wrap {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.card-info { flex: 1; min-width: 0; }

.card-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-subtitle {
  display: block;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.card-badge {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--badge-text);
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.card .tags {
  margin-top: 0;
  position: relative;
  z-index: 1;
}

/* ── LINKS ── */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  text-decoration: none;
  color: var(--text-primary);
  background: var(--glass);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  transition: all var(--transition);
}

.link-item:hover {
  border-color: var(--glass-border-hover);
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.link-item:hover .link-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

.link-icon {
  display: flex;
  align-items: center;
  color: var(--accent);
  flex-shrink: 0;
}

.link-label {
  font-weight: 600;
  font-size: 0.92rem;
}

.link-handle {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-left: auto;
}

.link-arrow {
  color: var(--text-tertiary);
  opacity: 0;
  transition: all var(--transition);
  flex-shrink: 0;
}

/* ── EMAIL ── */
.email-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition);
}

.email-btn:hover {
  border-color: var(--glass-border-hover);
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}

/* ── DOCK (floating nav) — Liquid Glass (Apple-style) ── */
.dock {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  height: 56px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(50px) saturate(2) brightness(1.15);
  -webkit-backdrop-filter: blur(50px) saturate(2) brightness(1.15);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.3);
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  z-index: 100;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.25),
    inset 0 -0.5px 0 rgba(255, 255, 255, 0.05);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

/* Specular highlight — top reflection like real glass */
.dock::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 50%;
  border-radius: 22px 22px 50% 50%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.08) 30%,
    rgba(255, 255, 255, 0.0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Subtle prismatic refraction sweep */
.dock::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.0) 30%,
    rgba(255, 255, 255, 0.06) 45%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 55%,
    rgba(255, 255, 255, 0.0) 70%,
    transparent 100%
  );
  animation: liquid-sweep 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes liquid-sweep {
  0%, 100% { transform: translateX(-15%); }
  50% { transform: translateX(15%); }
}

/* Light mode — glass adapts */
[data-theme="light"] .dock {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  border-top-color: rgba(255, 255, 255, 0.7);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.05),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.6),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.03);
}

.dock-divider {
  width: 1px;
  height: 24px;
  background: var(--glass-border);
  margin: 0 4px;
  flex-shrink: 0;
}

.dock-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: #1a1c20;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.dock-btn:hover {
  color: #000000;
  background: rgba(255, 255, 255, 0.1);
}

.dock-btn.active {
  color: #ffffff;
}

.dock-indicator {
  position: absolute;
  height: 40px;
  width: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 0;
  top: 50%;
  left: 0;
  margin-top: -20px;
}

.dock-indicator.sliding {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    -3px 0 8px rgba(0, 120, 255, 0.3),
    3px 0 8px rgba(255, 40, 40, 0.3),
    0 0 12px rgba(180, 0, 255, 0.15);
}

[data-theme="light"] .dock-btn {
  color: #2a2c30;
}

[data-theme="light"] .dock-btn:hover {
  color: #000000;
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dock-btn.active {
  color: #1a1a1e;
}

[data-theme="light"] .dock-indicator {
  background: rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ── THEME TOGGLE ── */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ── RESPONSIVE ── */
@media (min-width: 768px) {
  main {
    padding: 72px 32px;
    padding-bottom: calc(var(--nav-h) + 56px);
  }
  .hero-title { font-size: 3.2rem; }
  .bio { font-size: 1.1rem; }
}

@media (max-width: 480px) {
  .dock { gap: 0; padding: 0 4px; }
  .dock-btn { width: 40px; height: 40px; }
  .link-handle { display: none; }
  .pet-screen-frame { padding: 10px; border-radius: 16px; }
  .pet-btn { padding: 8px 12px; font-size: 0.72rem; }
}

/* ── PET (Tamagotchi LCD) ── */
.pet-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pet-screen-frame {
  background: #7a8460;
  border-radius: 20px;
  padding: 12px;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.3);
  border: 3px solid #5a6348;
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

.pet-screen-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    transparent 50%
  );
  pointer-events: none;
  border-radius: 17px;
  z-index: 1;
}

#pet-screen {
  display: block;
  border-radius: 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 100%;
  height: auto;
  max-width: 280px;
}

.pet-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.pet-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.pet-btn:hover {
  border-color: var(--glass-border-hover);
  color: var(--text-primary);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.pet-btn:active {
  transform: scale(0.95);
  background: var(--surface-hover);
}

.pet-btn svg {
  flex-shrink: 0;
}

/* ── TRANSITIONS for theme change ── */
.card, .link-item, .email-btn, .tag, .dock, .section-label, .card-icon-wrap, .card-badge {
  transition: all var(--transition);
}
