/* ====================================================
   FolioLink — Glassmorphism Profile Page CSS
   Mobile-first. Dark/light themes. Framer-like animations.
   ==================================================== */

/* ---------- FONT ---------- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=DM+Sans:opsz,wght@9..40,400;9..40,500&display=swap');

/* ---------- DARK THEME (default) ---------- */
:root {
  --bg: #060912;
  --bg-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.16);
  --text-primary: #f5f0e8;
  --text-secondary: rgba(245, 240, 232, 0.6);
  --text-muted: rgba(245, 240, 232, 0.35);
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.15);
  --accent-glow: rgba(245, 158, 11, 0.25);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
  --glow-color: rgba(245, 158, 11, 0.12);
  --nav-bg: rgba(6, 9, 18, 0.7);
  --radius: 20px;
  --radius-sm: 12px;
  --blur: blur(24px);
  --blur-sm: blur(12px);
}

/* ---------- LIGHT THEME ---------- */
[data-theme="light"] {
  --bg: #faf7f2;
  --bg-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
  --surface: rgba(0, 0, 0, 0.04);
  --surface-hover: rgba(0, 0, 0, 0.07);
  --border: rgba(0, 0, 0, 0.08);
  --border-bright: rgba(0, 0, 0, 0.15);
  --text-primary: #1a1614;
  --text-secondary: rgba(26, 22, 20, 0.6);
  --text-muted: rgba(26, 22, 20, 0.35);
  --accent: #d97706;
  --accent-soft: rgba(217, 119, 6, 0.1);
  --accent-glow: rgba(217, 119, 6, 0.2);
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.12);
  --glow-color: rgba(217, 119, 6, 0.1);
  --nav-bg: rgba(250, 247, 242, 0.75);
}

/* ---------- BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-image: var(--bg-grain);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient background glow */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, var(--glow-color) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- UTILITY ---------- */
.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px;
}

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

/* ====================================================
   NAVIGATION
   ==================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 20px;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}
.nav-inner {
  max-width: 600px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
}

/* Theme toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  backdrop-filter: blur(8px);
}
.theme-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border-bright);
  transform: scale(1.08);
}
.theme-toggle:active { transform: scale(0.95); }

/* ====================================================
   PROFILE PAGE WRAPPER
   ==================================================== */
.profile-page {
  position: relative;
  z-index: 1;
  padding-top: 80px; /* nav height */
  padding-bottom: 80px;
  min-height: 100vh;
}

/* ====================================================
   PROFILE CARD
   ==================================================== */
.profile-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
  animation: fadeSlideUp 0.5s ease both;
}

.profile-avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}
.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--glass-border);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.profile-avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent) 0deg,
    transparent 60deg,
    var(--accent) 120deg,
    transparent 180deg,
    var(--accent) 240deg,
    transparent 300deg,
    var(--accent) 360deg
  );
  animation: spinGlow 8s linear infinite;
  opacity: 0.35;
  z-index: -1;
}
@keyframes spinGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.profile-name {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.profile-bio {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.profile-location {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ====================================================
   SECTION HEADING
   ==================================================== */
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  animation: fadeSlideUp 0.5s ease both;
}
.section-heading-title {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.section-heading-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ====================================================
   LINK BUTTON
   ==================================================== */
.link-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease;
  animation: fadeSlideUp 0.5s ease both;
  position: relative;
  overflow: hidden;
}
/* subtle shimmer on hover */
.link-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.link-button:hover {
  background: var(--surface-hover);
  border-color: var(--border-bright);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), 0 0 20px var(--accent-soft);
}
.link-button:hover::after {
  transform: translateX(100%);
}
.link-button:active {
  transform: translateY(-1px);
  transition-duration: 0.1s;
}
.link-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.2s;
}
.link-button:hover .link-icon {
  background: var(--accent-glow);
}
.link-label {
  flex: 1;
}
.link-arrow {
  font-size: 14px;
  color: var(--text-muted);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s, transform 0.2s;
}
.link-button:hover .link-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ====================================================
   PROJECT TILE
   ==================================================== */
.projects-section {
  margin-top: 8px;
  margin-bottom: 28px;
}
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 500px) {
  .projects-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.project-tile {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  display: block;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  animation: fadeSlideUp 0.5s ease both;
}
.project-tile:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg), 0 0 24px var(--accent-soft);
  border-color: var(--border-bright);
}
.project-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--surface);
}
.project-body {
  padding: 14px 16px;
}
.project-title {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.project-description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ====================================================
   SOCIAL ROW
   ==================================================== */
.social-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 20px;
  animation: fadeSlideUp 0.5s ease both;
}
.social-link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease;
  cursor: pointer;
}
.social-link:hover {
  background: var(--surface-hover);
  border-color: var(--border-bright);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md), 0 0 16px var(--accent-soft);
}
.social-link:active { transform: scale(0.95); }

/* ====================================================
   FOOTER
   ==================================================== */
.profile-footer {
  text-align: center;
  padding: 0 20px 20px;
  animation: fadeSlideUp 0.5s ease both;
}
.profile-footer p {
  font-size: 12px;
  color: var(--text-muted);
}
.profile-footer a {
  color: var(--accent);
  text-decoration: none;
}
.profile-footer a:hover { text-decoration: underline; }

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

/* Staggered children */
.profile-card   { animation-delay: 0.05s; }
.link-button:nth-child(1) { animation-delay: 0.1s; }
.link-button:nth-child(2) { animation-delay: 0.15s; }
.link-button:nth-child(3) { animation-delay: 0.2s; }
.link-button:nth-child(4) { animation-delay: 0.25s; }
.link-button:nth-child(5) { animation-delay: 0.3s; }
.projects-section { animation-delay: 0.35s; }
.project-tile:nth-child(1) { animation-delay: 0.4s; }
.project-tile:nth-child(2) { animation-delay: 0.45s; }
.social-row { animation-delay: 0.5s; }
.contact-section { animation-delay: 0.55s; }
.contact-card { animation-delay: 0.6s; }
.profile-footer { animation-delay: 0.65s; }

/* ====================================================
   CONTACT FORM
   ==================================================== */
.contact-section {
  margin-top: 8px;
}

.contact-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
  animation: fadeSlideUp 0.5s ease both;
  position: relative;
  overflow: hidden;
}

/* Subtle accent glow at top */
.contact-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
}

.contact-field {
  margin-bottom: 18px;
}

.contact-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.contact-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
}
.contact-input::placeholder { color: var(--text-muted); }
.contact-input:focus {
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.contact-input.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.contact-textarea {
  resize: vertical;
  min-height: 100px;
}

.contact-error {
  display: block;
  font-size: 12px;
  color: #ef4444;
  margin-top: 5px;
  min-height: 16px;
}

/* Submit button */
.contact-submit {
  width: 100%;
  padding: 14px 20px;
  background: var(--accent);
  color: #060912;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.2s ease,
              opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  margin-top: 4px;
}
.contact-submit:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
}
.contact-submit:active:not(:disabled) {
  transform: translateY(0);
  filter: brightness(0.95);
}
.contact-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Loading spinner */
.contact-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(6, 9, 18, 0.3);
  border-top-color: #060912;
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.contact-submit.is-loading .contact-spinner { display: block; }
.contact-submit.is-loading .contact-submit-label { opacity: 0.7; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Global error message */
.contact-global-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
[data-theme="light"] .contact-global-error {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.07);
}

/* Success state */
.contact-success {
  text-align: center;
  padding: 16px 8px 8px;
}
.contact-success-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.contact-success-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.contact-success-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}
.contact-retry-btn {
  background: none;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 20px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.contact-retry-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}