/* ============================================================
   Francisco Naranjo Narváez — Portfolio
   Catppuccin Mocha · IDE aesthetic
   ============================================================ */

:root {
  /* Colors */
  --bg:             #1e1e2e;
  --surface:        #181825;
  --surface-2:      #11111b;
  --border:         #313244;
  --text:           #cdd6f4;
  --text-muted:     #6c7086;
  --text-faint:     #45475a;
  --accent:         #f38ba8;
  --accent-hover:   #eba0ac;
  --syntax-blue:    #89b4fa;
  --syntax-green:   #a6e3a1;
  --syntax-yellow:  #f9e2af;
  --syntax-mauve:   #cba6f7;
  --syntax-teal:    #94e2d5;
  --syntax-comment: #585b70;

  /* Typography */
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Layout */
  --sidebar-w: 35%;
  --statusbar-h: 30px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-weight: 400;
  line-height: 1.6;
  font-size: 16px;
  padding-bottom: var(--statusbar-h);
  -webkit-font-smoothing: antialiased;
}

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

::selection { background: var(--accent); color: var(--surface-2); }

/* ============================================================
   SIDEBAR (fixed, left 35%)
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--statusbar-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  /* Vertical padding shrinks on short viewports so the full sidebar fits
     without scrolling; horizontal padding stays fixed. Linear ramp between
     600px and 800px of viewport height: 1rem at 600px, 3rem (old static
     value) at 800px and up. */
  padding: clamp(1rem, calc(16vh - 80px), 3rem) 3rem;
  overflow-y: auto;
}

.sidebar-inner { width: 100%; max-width: 380px; margin-left: auto; }

.hero-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  min-height: calc(2rem * 1.15 * 3); /* reserve 3 lines (max wrap count of the name in the sidebar) so the Geist Mono swap can't grow the box and shift the sidebar */
  display: block;
}

.cursor {
  display: inline-block;
  color: var(--accent);
  animation: blink 1s step-end infinite;
  font-weight: 400;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.scramble-char { color: var(--accent); }

.role {
  font-family: var(--font-body);
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 500;
  margin-top: 0.6rem;
}

.short-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-top: clamp(0.4rem, calc(4.8vh - 22.4px), 1rem);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: clamp(0.5rem, calc(5.2vh - 23.2px), 1.15rem) 0;
}

/* Nav */
.nav { display: flex; flex-direction: column; gap: clamp(0.05rem, 0.4vh, 0.15rem); }

.nav-link {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  padding: clamp(0.15rem, calc(1.6vh - 7.2px), 0.35rem) 0.75rem;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.nav-link:hover { color: var(--text); }
.nav-link .nav-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  transition: color 0.2s ease;
}
.nav-link:hover .nav-num { color: var(--accent); }

.nav-link.active {
  color: var(--accent);
  border-left: 2px solid var(--accent);
  background: color-mix(in oklch, var(--accent) 8%, transparent);
}
.nav-link.active .nav-num { color: var(--accent); }

/* Language toggle */
.lang-toggle { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-mono); }
.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.2rem 0.1rem;
  transition: color 0.2s ease;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { color: var(--accent); font-weight: 500; }
.lang-sep { color: var(--text-faint); }

/* Socials */
.socials { display: flex; gap: 1.25rem; align-items: center; }
.socials a {
  color: var(--text-muted);
  display: inline-flex;
  transition: color 0.2s ease, transform 0.2s ease;
}
.socials a:hover { color: var(--accent); transform: translateY(-2px); }

/* Mobile nav toggle (hidden on desktop) */
.nav-toggle { display: none; }

/* ============================================================
   MAIN CONTENT (right 65%)
   ============================================================ */
.content {
  margin-left: var(--sidebar-w);
  padding: 5rem 4rem 5rem;
  max-width: 900px;
}

/* Section fade-in */
.section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  margin-bottom: 6rem;
  scroll-margin-top: 2rem;
}
.section.visible { opacity: 1; transform: translateY(0); }

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.section-tag {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  white-space: nowrap;
}
.section-header h2 {
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.section-line { flex: 1; height: 1px; background: var(--border); }

/* IDE-style comment line */
.hero-comment {
  font-family: var(--font-mono);
  color: var(--syntax-comment);
  font-size: 0.9rem;
  margin-top: 1.75rem;
}

/* ---------------- About ---------------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 2.5rem;
  align-items: start;
}
.about-text p { color: var(--text); font-size: 1rem; }
.about-photo img {
  width: 100%;
  height: auto; /* keep the 1024x1024 aspect ratio; overrides the width/height HTML attrs so the photo isn't stretched */
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  filter: grayscale(15%);
  transition: filter 0.3s ease;
}
.about-photo img:hover { filter: grayscale(0%); }


/* ---------------- Experience timeline ---------------- */
.timeline { list-style: none; position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 4px; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 2.5rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.5rem; top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  transform: translateX(0);
}
.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.35rem;
}
.timeline-role {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.timeline-role a { color: var(--syntax-blue); transition: color 0.2s ease; }
.timeline-role a:hover { color: var(--accent); }
.timeline-bullets { list-style: none; margin-bottom: 0.9rem; }
.timeline-bullets li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}
.timeline-bullets li::before {
  content: "▸";
  position: absolute; left: 0;
  color: var(--accent);
  font-size: 0.85rem;
}

/* ---------------- Badges ---------------- */
.badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
}
.badge-blue   { color: var(--syntax-blue);   background: color-mix(in oklch, var(--syntax-blue)   12%, var(--surface)); }
.badge-green  { color: var(--syntax-green);  background: color-mix(in oklch, var(--syntax-green)  12%, var(--surface)); }
.badge-yellow { color: var(--syntax-yellow); background: color-mix(in oklch, var(--syntax-yellow) 12%, var(--surface)); }
.badge-mauve  { color: var(--syntax-mauve);  background: color-mix(in oklch, var(--syntax-mauve)  12%, var(--surface)); }
.badge-teal   { color: var(--syntax-teal);   background: color-mix(in oklch, var(--syntax-teal)   12%, var(--surface)); }

/* ---------------- Projects ---------------- */
.projects-grid { display: flex; flex-direction: column; gap: 1.5rem; }

.project-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  transition: transform 200ms ease, border-color 200ms ease;
  display: grid;
  grid-template-columns: 1fr;
}
.project-card:hover { transform: translateY(-4px); border-color: var(--accent); }

.project-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.85rem; }
.project-name {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.project-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.project-links { display: flex; gap: 1.25rem; margin-top: auto; }
.project-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--syntax-blue);
  transition: color 0.2s ease;
}
.project-link:hover { color: var(--accent); }

.other-projects-label {
  font-family: var(--font-mono);
  color: var(--syntax-comment);
  font-size: 0.85rem;
  font-weight: 400;
  margin: 2.5rem 0 1rem;
}
.other-projects { display: flex; flex-direction: column; gap: 1rem; }
.project-card-sm { grid-template-columns: 1fr; }
.project-card-sm .project-body { padding: 1.1rem 1.5rem; gap: 0.6rem; }

/* ---------------- Stack ---------------- */
.stack-group { margin-bottom: 2rem; }
.stack-cat {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.75rem;
}
.stack-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.stack-item:hover { border-color: var(--accent); transform: translateY(-3px); }
.stack-item img { width: 32px; height: 32px; }
.stack-glyph { color: var(--accent); }
.stack-item span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---------------- Contact ---------------- */
.contact-lead {
  color: var(--text);
  font-size: 1.05rem;
  max-width: 600px;
  margin-bottom: 1.75rem;
}
.contact-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.contact-cta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.contact-cta:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ============================================================
   STATUS BAR (fixed bottom)
   ============================================================ */
.statusbar {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  height: var(--statusbar-h);
  background: var(--accent);
  color: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.25rem;
  z-index: 100;
  overflow: hidden;
  white-space: nowrap;
}
.statusbar span { display: inline-flex; align-items: center; }
.statusbar span:not(:last-child)::after {
  content: "·";
  margin-left: 1.5rem;
  opacity: 0.6;
}

/* ============================================================
   RESPONSIVE — < 768px : single column, sidebar -> sticky header
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem 1.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    z-index: 50;
  }
  .sidebar-inner { max-width: none; margin: 0; }

  .hero-name {
    font-size: 1.4rem;
    min-height: calc(1.4rem * 1.15 * 2); /* mobile name reserves 2 lines at the smaller size (overrides the desktop 3-line reserve) */
    padding-right: 3.5rem;                /* clear the absolutely-positioned hamburger so the name never flows under it (~22px gap at any width < 768px) */
  }
  .role { font-size: 0.95rem; margin-top: 0.3rem; }

  /* Collapse secondary content behind the toggle */
  .short-desc, .nav, .lang-toggle, .socials, .divider { display: none; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    position: absolute;
    top: 1.4rem; right: 1.5rem;
    width: 34px; height: 30px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 6px;
  }
  .nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--accent);
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  /* Expanded state */
  .sidebar.open .short-desc,
  .sidebar.open .nav,
  .sidebar.open .lang-toggle,
  .sidebar.open .socials,
  .sidebar.open .divider { display: flex; }
  .sidebar.open .short-desc { display: block; }
  .sidebar.open .nav { flex-direction: column; }
  .sidebar.open .divider { height: 1px; }

  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .content {
    margin-left: 0;
    padding: 2.5rem 1.5rem 3rem;
    max-width: 100%;
  }

  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 220px; margin: 0 auto; }

  .section { text-align: center; }
  .section-header { justify-content: center; }
  .badges, .project-links, .contact-links, .stack-grid { justify-content: center; }
  .timeline { text-align: left; }
  .about-text { text-align: left; }
  .project-body { text-align: left; }

  .statusbar { font-size: 0.6rem; gap: 0.75rem; justify-content: center; }
  .statusbar span:not(:last-child)::after { margin-left: 0.75rem; }
  .statusbar span:nth-child(2) { display: none; }
}

@media (max-width: 420px) {
  .statusbar span:nth-child(1) { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .section { opacity: 1; transform: none; transition: none; }
  .cursor { animation: none; }
  * { scroll-behavior: auto; }
}
