/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  /* Dark theme (default) */
  --bg: #0B0F1A;
  --surface: #131826;
  --surface-raised: #1A2133;
  --border: #262E44;
  --text: #E6E8EC;
  --text-dim: #8B93A7;
  --accent: #4C9F70;
  --accent-soft: rgba(76, 159, 112, 0.14);
  --accent-2: #E8A33D;
  --accent-2-rgb: 232, 163, 61;
  --code: #6FCF97;

  /* Framed-glass header: translucent tint of the theme bg so the blur blends
     with the page instead of reading as a different color. */
  --topbar-bg: rgba(11, 15, 26, 0.45);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --max-width: 920px;
  --transition: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="light"] {
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --border: #E3E3DE;
  --text: #1A1D23;
  --text-dim: #5B6172;
  --accent: #327A54;
  --accent-soft: rgba(50, 122, 84, 0.10);
  --accent-2: #B77A1F;
  --accent-2-rgb: 183, 122, 31;
  --code: #2E7D4F;
  --topbar-bg: rgba(247, 247, 245, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

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

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

section {
  padding: 3.25rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-heading {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 1.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.section-heading .line-no {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.95rem;
  opacity: 0.7;
}

/* ==========================================================================
   Custom cursor
   ========================================================================== */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
}

.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  transition: opacity 0.2s;
}

.cursor-ring {
  width: 32px; height: 32px;
  border: 1px solid var(--accent);
  opacity: 0.5;
  transition: width 0.25s, height 0.25s, opacity 0.25s, border-color 0.25s;
}

.cursor-ring.hovering {
  width: 52px; height: 52px;
  opacity: 0.9;
  background: var(--accent-soft);
}

@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ==========================================================================
   Nav / theme toggle
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  /* Glass look: blur what's behind a translucent tint of the theme bg, so the
     header blends with the page (works in all browsers, unlike color-mix()). */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text);
}
.brand span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link-btn {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s;
}
.nav-link-btn:hover { border-color: var(--accent); color: var(--accent); }

.theme-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
}

.theme-toggle .knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

[data-theme="light"] .theme-toggle .knob {
  transform: translateX(24px);
}

/* ==========================================================================
   Mobile hamburger menu
   ========================================================================== */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  z-index: 110;
}
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.hamburger-btn.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.is-open span:nth-child(2) { opacity: 0; }
.hamburger-btn.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .hamburger-btn { display: flex; }

  .nav-links {
    position: fixed;
    top: 76px;
    right: 1rem;
    left: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    min-width: 190px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.35);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 105;
  }
  .nav-links.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .nav-links .nav-link-btn { text-align: left; }
  .nav-links .theme-toggle { align-self: flex-start; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 6rem;
}

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

@media (max-width: 720px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; max-width: 200px; margin: 0 auto; }
}

.eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  margin-bottom: 1rem;
}

.hero .role {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.hero p.desc {
  max-width: 54ch;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

.btn-row { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.8rem 1.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--accent);
  color: #0B0F1A;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover { transform: translateY(-2px); }

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-coffee {
  background: var(--accent-2);
  color: #0B0F1A;
  border-color: var(--accent-2);
  font-weight: 600;
}
.btn-coffee:hover { transform: translateY(-2px); }

/* ==========================================================================
   (old inline coffee box removed - now a floating widget, see below)
   ========================================================================== */

.hero-photo {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 3/4;
}

.hero-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(15%);
}

/* Crossfade to the second photo on hover.
   The alt photo is stacked on top (absolute), starts at opacity 0 and
   scales slightly; hovering the container fades it in smoothly. */
.hero-photo .hero-photo-alt {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.5s ease, transform 0.5s ease;
  filter: grayscale(15%);
}
.hero-photo:hover .hero-photo-alt {
  opacity: 1;
  transform: scale(1);
}
/* On touch devices (no hover) tapping toggles it; also respect users who
   disable hover animations. */
@media (hover: none) {
  .hero-photo .hero-photo-alt { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-photo .hero-photo-alt { transition: none; }
}

/* ==========================================================================
   Reveal on scroll
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   About
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
}
@media (max-width: 720px) { .about-grid { grid-template-columns: 1fr; } }

.about-grid p { color: var(--text-dim); margin-bottom: 1rem; }

.edu-item {
  border-left: 2px solid var(--border);
  padding-left: 1.2rem;
  margin-bottom: 1.5rem;
  position: relative;
}
.edu-item::before {
  content: '';
  position: absolute;
  left: -5px; top: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.edu-item .period {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}
.edu-item h3 { font-size: 1.05rem; margin: 0.2rem 0; }
.edu-item .detail { color: var(--text-dim); font-size: 0.92rem; }

/* Institution links (AIUB, RCBSC) — same brand blue, hover shows the logo. */
.school-link {
  color: #2E86DE;
  position: relative;
  transition: color 0.2s;
  border-bottom: 1px dashed transparent;
}
.school-link:hover {
  color: #5AA7EE;
  border-bottom-color: currentColor;
}

/* The old per-link popups are replaced by one global cursor tooltip. */
.school-logo { display: none; }

.logo-tip {
  position: fixed;
  top: 0;
  left: 0;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 9999;
}
.logo-tip.is-visible { opacity: 1; }
.logo-tip img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.desc .school-link { border-bottom: none; }

/* ==========================================================================
   Skills
   ========================================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
}

.skill-card h3 {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 500;
  margin-bottom: 1rem;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag {
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.reveal.is-visible .tag {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================================================
   Projects
   ========================================================================== */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.8rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.3s, transform 0.3s;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.project-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.project-head h3 { font-size: 1.2rem; }

.project-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  white-space: nowrap;
  transition: color 0.25s, border-color 0.25s;
}
.project-link:hover { color: var(--accent); border-color: var(--accent); }

.project-card p.desc { color: var(--text-dim); margin-bottom: 0.8rem; }

.project-details {
  list-style: none;
  margin-bottom: 1rem;
}
.project-details li {
  font-size: 0.9rem;
  color: var(--text-dim);
  padding-left: 1.1rem;
  position: relative;
  margin-bottom: 0.3rem;
}
.project-details li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ==========================================================================
   Achievements
   ========================================================================== */
.achievement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 8px;
  padding: 1.6rem;
  margin-bottom: 1.2rem;
}
.achievement-card h3 { font-size: 1.1rem; margin-bottom: 0.2rem; }
.achievement-card .org { font-size: 0.88rem; color: var(--text-dim); margin-bottom: 0.8rem; }
.achievement-card ul { list-style: none; }
.achievement-card li {
  font-size: 0.9rem;
  color: var(--text-dim);
  padding-left: 1.1rem;
  position: relative;
  margin-bottom: 0.25rem;
}
.achievement-card li::before {
  content: '★';
  position: absolute;
  left: 0;
  color: var(--accent-2);
  font-size: 0.75rem;
}

/* ==========================================================================
   CV section
   ========================================================================== */
.cv-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

.cv-box .cv-info { flex: 1; min-width: 220px; }
.cv-box h3 { margin-bottom: 0.5rem; }
.cv-box p { color: var(--text-dim); margin-bottom: 1.2rem; font-size: 0.92rem; }

.cv-preview-frame {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 2rem;
  overflow: hidden;
}
.cv-preview-frame iframe {
  width: 100%;
  height: 480px;
  border: none;
  display: block;
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  transition: border-color 0.25s, transform 0.25s;
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.contact-card .label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
  display: block;
}
.contact-card .value { font-size: 1rem; word-break: break-word; }

/* Social icon buttons (GitHub, LinkedIn, Facebook) */
.social-icons {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  margin-bottom: 1.6rem;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  transition: color 0.25s, border-color 0.25s, transform 0.25s;
}

.social-icon svg { width: 22px; height: 22px; }

.social-icon:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.contact-grid { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; }

footer {
  text-align: center;
  padding: 1.25rem 1.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   Modal (CV preview)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}
.modal-overlay.is-open { display: flex; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(760px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 1.05rem; }

.modal-actions { display: flex; align-items: center; gap: 0.8rem; }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.82rem; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--accent); }

.modal-body { flex: 1; overflow: hidden; }
.modal-body iframe {
  width: 100%;
  height: 100%;
  min-height: 65vh;
  border: none;
  display: block;
}

.modal-box-cv { width: min(640px, 100%); }
.modal-body-cv {
  overflow-y: auto;
  padding: 1.2rem;
  background: var(--bg);
}
.cv-preview-img {
  width: 100%;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  display: block;
}

/* ==========================================================================
   Floating coffee widget
   ========================================================================== */
.coffee-widget {
  position: fixed;
  left: 24px;
  top: 45%;
  z-index: 900;
  touch-action: none;
  user-select: none;
  transition: transform 0.6s ease;
  transform: translateX(0);
}

/* On phones only, the idle widget tucks toward whichever edge it's docked
   on so it's less intrusive - tablets/laptops stay put and only fade
   (see .coffee-fab below). */
@media (max-width: 640px) {
  .coffee-widget.is-idle.dock-left { transform: translateX(-50%); }
  .coffee-widget.is-idle.dock-right { transform: translateX(50%); }
}

.coffee-fab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem 0.6rem 0.7rem;
  border-radius: 999px;
  background: rgb(var(--accent-2-rgb));
  border: none;
  cursor: grab;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: transform 0.2s ease, background 0.6s ease, box-shadow 0.6s ease;
}
.coffee-fab:active { cursor: grabbing; }
.coffee-fab:hover { transform: scale(1.04); }

/* Idle: after ~2.5s with no interaction and the panel closed, the button's
   own background becomes translucent with a blur behind it - so any page
   text underneath is softly blurred, never sharply overlapping/mixing with
   the "Buy me a coffee" label itself. */
.coffee-widget.is-idle .coffee-fab {
  background: rgba(var(--accent-2-rgb), 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.coffee-widget:hover .coffee-fab,
.coffee-widget:focus-within .coffee-fab {
  background: rgb(var(--accent-2-rgb));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.coffee-fab-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.coffee-fab-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #0B0F1A;
  line-height: 1.15;
  text-align: left;
  white-space: nowrap;
}

.coffee-panel {
  position: absolute;
  left: calc(100% + 12px);
  top: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  display: none;
}
.coffee-panel.is-open { display: block; }

/* When the widget is docked near the right edge, open the panel to the
   left instead so it doesn't run off-screen. */
.coffee-widget.dock-right .coffee-panel {
  left: auto;
  right: calc(100% + 12px);
}

@media (max-width: 420px) {
  .coffee-panel { width: min(240px, calc(100vw - 90px)); }
}

.coffee-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.coffee-panel-head .modal-close { font-size: 1.3rem; }

.coffee-panel-sub {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.9rem;
}

.coffee-amounts {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.amount-btn {
  flex: 1;
  padding: 0.5rem 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.amount-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
.amount-btn.is-selected {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: rgba(232, 163, 61, 0.1);
}

.coffee-custom-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.coffee-note {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.6rem;
}

/* ==========================================================================
   Contact form
   ========================================================================== */
.contact-form {
  margin: 2rem auto 0;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.contact-form .form-title {
  text-align: center;
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.contact-form .form-title::after {
  content: '';
  display: block;
  width: 44px;
  height: 2px;
  margin: 0.6rem auto 0;
  background: var(--accent);
  border-radius: 2px;
}

.form-row { display: flex; flex-direction: column; gap: 0.4rem; }

/* Phone row: searchable country-code picker + number input side by side */
.phone-row { display: flex; gap: 0.5rem; position: relative; }
.phone-row input[type="tel"] {
  flex: 1 1 auto;
  min-width: 0;
}
.phone-select { position: relative; flex: 0 0 auto; }
.phone-select-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 100%;
  padding: 0.7rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, var(--bg));
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.phone-select-btn:hover { border-color: var(--accent); }
.ps-flag { font-size: 1.05rem; }
.ps-name { font-weight: 600; }
.ps-code { color: var(--muted, #888); font-family: var(--font-mono); font-size: 0.8rem; }
.ps-arrow { font-size: 0.7rem; color: var(--muted, #888); }
.phone-select-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  width: 280px;
  max-width: 80vw;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.ps-search {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  outline: none;
}
.ps-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  max-height: 240px;
  overflow-y: auto;
}
.ps-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.ps-option:hover { background: var(--accent-soft, rgba(0, 0, 0, 0.06)); }
.ps-option.ps-selected { background: var(--accent-soft, rgba(0, 0, 0, 0.06)); }
.ps-option .ps-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.ps-empty { padding: 0.6rem; text-align: center; color: var(--muted, #888); font-size: 0.85rem; }

/* Honeypot: visually hidden, but present in the DOM so bots fill it in.
   Not display:none on the input itself — some naive bots skip display:none
   inputs, so we keep the input technically visible but fully off-screen. */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}


.form-row label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.form-row input,
.form-row textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.25s;
}
.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field-invalid {
  border-color: #e5484d !important;
}
.field-invalid:focus {
  border-color: #e5484d !important;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.15);
}

.contact-form .btn { align-self: center; min-width: 180px; }

.form-alert {
  margin: 1.5rem auto 0;
  max-width: 560px;
  text-align: center;
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}
.form-alert-success {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.form-alert-error {
  background: rgba(220, 90, 90, 0.1);
  color: #dc5a5a;
  border: 1px solid #dc5a5a;
}

/* ==========================================================================
   Cursor-reactive background glow
   ========================================================================== */
.bg-glow {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.glow-blob {
  position: absolute;
  top: 0;
  left: 0;
  width: 560px;
  height: 560px;
  margin-left: -280px;
  margin-top: -280px;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--accent-soft) 0%, transparent 70%);
  filter: blur(40px);
  opacity: 0.9;
  will-change: transform;
}

[data-theme="light"] .glow-blob {
  opacity: 0.85;
  background: radial-gradient(circle at center, rgba(50, 122, 84, 0.22) 0%, transparent 70%);
}

.bg-wash {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 30%, var(--accent-soft) 0%, transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(232, 163, 61, 0.08) 0%, transparent 60%);
  filter: blur(30px);
  opacity: 0.85;
  animation: bgWash 28s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes bgWash {
  from { transform: translate(-4%, -3%) scale(1); }
  to   { transform: translate(4%, 3%) scale(1.08); }
}
[data-theme="light"] .bg-wash {
  opacity: 0.8;
  background:
    radial-gradient(circle at 20% 30%, rgba(50, 122, 84, 0.18) 0%, transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(183, 122, 31, 0.16) 0%, transparent 60%);
}

.bg-particle {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  box-shadow: 0 0 6px var(--accent);
  pointer-events: none;
}
[data-theme="light"] .bg-particle { opacity: 0.45; }

@media (hover: none), (pointer: coarse) {
  .bg-glow { display: none; }
}

/* Ensure real content sits above the decorative glow layer */
section, footer { position: relative; z-index: 1; }

/* ---- Project screenshots gallery ---- */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.screenshot-item {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  cursor: zoom-in;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.screenshot-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.screenshot-item img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
}
.screenshot-item figcaption {
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  opacity: 0.75;
  text-align: center;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 94vw;
  max-height: 84vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.lightbox p {
  margin-top: 0.9rem;
  color: #fff;
  font-size: 0.95rem;
  opacity: 0.85;
}
.lightbox-close {
  position: absolute;
  top: 1.2rem;
  right: 1.4rem;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.9;
  transition: background 0.2s, opacity 0.2s, transform 0.2s;
}
.lightbox-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.08);
}
