/* ==========================================================================
   Frehiwot Gemechu — Backend Developer Portfolio
   ========================================================================== */

:root {
  --bg-primary: #0b1120;
  --bg-secondary: #111827;
  --bg-elevated: #1a2332;
  --bg-card: rgba(26, 35, 50, 0.72);
  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-accent: rgba(56, 189, 248, 0.28);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-glow: rgba(56, 189, 248, 0.22);
  --success: #34d399;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.28);
  --container: 1140px;
  --nav-height: 72px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

/* -------------------------------------------------------------------------- */
/* Navigation                                                                 */
/* -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  height: var(--nav-height);
  z-index: 1000;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: box-shadow var(--transition);
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin-inline: auto;
  background: var(--text-primary);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition),
    border-color var(--transition), box-shadow var(--transition);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: var(--bg-primary);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-outline {
  color: var(--accent);
  border-color: var(--border-accent);
  background: transparent;
}

.btn-outline:hover {
  background: var(--accent-soft);
}

.btn-resume {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border-accent);
}

.btn-resume:hover {
  background: rgba(56, 189, 248, 0.2);
}

.btn-resume svg,
.btn-primary svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-lg {
  padding: 0.9rem 1.6rem;
  font-size: 0.9375rem;
}

/* -------------------------------------------------------------------------- */
/* Hero                                                                       */
/* -------------------------------------------------------------------------- */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(56, 189, 248, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(14, 165, 233, 0.06), transparent 55%),
    linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3.5rem;
  align-items: center;
  padding-block: 4rem 5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  margin-bottom: 1.25rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.hero-role {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero-summary {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 34rem;
  margin-bottom: 1.75rem;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.hero-tag {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-card {
  position: relative;
  width: min(100%, 340px);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), transparent 50%);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.hero-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.hero-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.hero-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.stat-item {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(11, 17, 32, 0.6);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.25rem;
}

/* -------------------------------------------------------------------------- */
/* Impact strip                                                               */
/* -------------------------------------------------------------------------- */

.impact-strip {
  padding: 3rem 0;
  background: var(--bg-secondary);
  border-block: 1px solid var(--border-subtle);
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.impact-item {
  text-align: center;
  padding: 1rem;
}

.impact-value {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.impact-label {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* -------------------------------------------------------------------------- */
/* Sections                                                                   */
/* -------------------------------------------------------------------------- */

.section {
  padding: 5.5rem 0;
}

.section-header {
  max-width: 640px;
  margin-bottom: 3rem;
}

.section-header.centered {
  margin-inline: auto;
  text-align: center;
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section-desc {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* -------------------------------------------------------------------------- */
/* About                                                                      */
/* -------------------------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-meta {
  display: grid;
  gap: 0.875rem;
}

.meta-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.meta-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
}

.meta-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.meta-card p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* Skills                                                                     */
/* -------------------------------------------------------------------------- */

.skills-section {
  background: var(--bg-secondary);
  border-block: 1px solid var(--border-subtle);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.skill-category {
  padding: 1.35rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition), transform var(--transition);
}

.skill-category:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.skill-category.featured {
  border-color: var(--border-accent);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.08), var(--bg-card));
}

.skill-category h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.skill-category h3::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--accent);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
}

.skill-tag.primary {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border-accent);
  font-weight: 600;
}

.skill-tag:hover {
  border-color: var(--border-accent);
}

/* -------------------------------------------------------------------------- */
/* Projects — Timeline Case Studies                                           */
/* -------------------------------------------------------------------------- */

.projects-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.projects-timeline::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--border-subtle));
}

.project-case {
  position: relative;
  margin-left: 3rem;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.project-case:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
}

.project-case::before {
  content: "";
  position: absolute;
  left: -2.55rem;
  top: 1.85rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.project-case.featured::before {
  width: 14px;
  height: 14px;
  left: -2.65rem;
  box-shadow: 0 0 12px var(--accent-glow);
}

.project-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.project-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.project-org {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
}

.project-period {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.project-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.project-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.project-col h4 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.project-list li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  line-height: 1.55;
}

.project-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.impact-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.impact-callout svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--success);
  margin-top: 2px;
}

.impact-callout p {
  font-size: 0.8125rem;
  color: #a7f3d0;
  line-height: 1.5;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-tag {
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}

/* -------------------------------------------------------------------------- */
/* Contact                                                                    */
/* -------------------------------------------------------------------------- */

.contact-section {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.contact-card {
  max-width: 720px;
  margin-inline: auto;
  text-align: center;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.contact-card p {
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
  font-size: 1rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
}

.contact-link:hover {
  color: var(--accent);
  border-color: var(--border-accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.contact-link.highlight {
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  border-color: transparent;
}

.contact-link.highlight:hover {
  color: var(--bg-primary);
  box-shadow: 0 6px 24px var(--accent-glow);
}

/* -------------------------------------------------------------------------- */
/* Footer                                                                     */
/* -------------------------------------------------------------------------- */

.site-footer {
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.site-footer p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* Animations                                                                 */
/* -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@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;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .hero-visual {
    order: -1;
  }

  .hero-card {
    width: min(100%, 300px);
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .impact-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links,
  .nav-actions .btn-resume-nav {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    padding: 1.25rem 1rem 1.5rem;
    background: rgba(11, 17, 32, 0.98);
    border-bottom: 1px solid var(--border-subtle);
    gap: 1rem;
  }

  .about-grid,
  .project-columns,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .projects-timeline::before {
    left: 11px;
  }

  .project-case {
    margin-left: 2rem;
    padding: 1.25rem;
  }

  .project-case::before {
    left: -1.85rem;
  }

  .project-case.featured::before {
    left: -1.95rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .contact-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-link {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .impact-grid {
    grid-template-columns: 1fr;
  }

  .hero-card-stats {
    grid-template-columns: 1fr;
  }
}
