:root {
  --background: #e3d0d0;
  --foreground: #1c1c3e;
  --panel: #ffffff;
  --panel-2: #f5eded;
  --border: #7f7d7d;
  --muted: #111111;
  --primary: #c91f85;
  --accent: #4dc7e2;
  --accent-dark: #0f7991;
  --green: #0d9f6e;
  --dim: #d2b6d5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--background);
  color: var(--foreground);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at top left, rgba(77,199,226,0.08), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(201,31,133,0.06), transparent 50%);
}

/* Scanlines */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 2px,
    rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Lightweight texture */
body::after {
  content:'';
  position:fixed; inset:0;
  background-image:radial-gradient(rgba(0,0,0,0.045) 1px,transparent 1px);
  background-size:4px 4px;
  pointer-events:none; z-index:9998; opacity:0.25;
}

/* ── NAV ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(28,28,62,0.96);
  border-bottom: 1px solid rgba(77,199,226,0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: 64px;
}

.nav-logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 3px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-logo span { color: var(--primary); }

.nav-links { display: flex; gap: 1.75rem; list-style: none; }
.nav-links a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: color 0.2s;
  padding: 4px 0;
  position: relative;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.nav-burger {
  display: none;
  background: none;
  border: 1px solid rgba(77,199,226,0.4);
  color: var(--accent);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1.1rem;
}

@media(max-width: 820px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: rgba(28,28,62,0.98);
    padding: 1.5rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid rgba(77,199,226,0.2);
  }
  .nav-burger { display: block; }
}

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex; align-items: center;
  position: relative;
  padding: 80px 4rem 4rem;
  overflow: hidden;
  perspective: 1200px;
}

.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(77,199,226,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77,199,226,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
}

.hero-glow {
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(77,199,226,0.12), transparent 60%);
  opacity:0.9;
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative; z-index: 2;
  max-width: 800px;
  transform-style: preserve-3d;
}

.hero-eyebrow {
  font-size: 11px; letter-spacing: 4px;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 12px;
}
.hero-eyebrow::before { content: ''; width: 40px; height: 1px; background: var(--accent); }

.hero-name {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(3rem, 9vw, 7rem);
  font-weight: 900;
  line-height: 0.95;
  margin: 0 0 1rem;
  letter-spacing: -2px;
  transform: translateZ(60px);
}
.hero-name .accent { color: var(--foreground); }
.hero-name .stroke {
  -webkit-text-stroke: 2px var(--accent);
  color: transparent;
  text-shadow: 0 0 30px rgba(77,199,226,0.35);
}

.hero-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--accent-dark);
  margin-bottom: 2rem; min-height: 2rem;
  transform: translateZ(30px);
}

.cursor {
  display: inline-block; width: 10px; height: 1.2em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1s infinite; margin-left: 2px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

.hero-bio {
  color: var(--muted); max-width: 520px;
  margin-bottom: 3rem; font-size: 13px; line-height: 1.9;
  border-left: 2px solid var(--accent); padding-left: 1.5rem;
  transform: translateZ(20px);
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; transform: translateZ(40px); }

/* Terminal panel */
.hero-terminal {
  position: absolute; right: 4rem; top: 50%;
  transform: translateY(-50%);
  width: 380px;
  background: #faf7f7;
  border: 1px solid var(--border);
  font-size: 11px;
  display: none;
  box-shadow: 0 8px 40px rgba(28,28,62,0.15);
}
@media(min-width: 1100px) { .hero-terminal { display: block; } }

.terminal-bar {
  background: #ede8e8; padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.t-dot { width: 8px; height: 8px; border-radius: 50%; }
.t-dot.r { background: #ff5f57; }
.t-dot.y { background: #febc2e; }
.t-dot.g { background: #28c840; }
.terminal-body { padding: 16px; line-height: 2; font-family: 'Share Tech Mono', monospace; }
.t-prompt { color: var(--accent-dark); }
.t-cmd { color: var(--primary); }
.t-out { color: var(--muted); padding-left: 1rem; }
.t-ok { color: var(--accent-dark); }
.t-warn { color: #d2691e; }

/* ── BUTTONS ── */
.btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  padding: 13px 28px; cursor: pointer; text-decoration: none;
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
  background: var(--foreground); color: var(--background);
  border: 1px solid var(--foreground); font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent); color: var(--foreground);
  box-shadow: 0 0 30px rgba(77,199,226,0.4);
}
.btn-ghost {
  background: transparent; color: var(--foreground);
  border: 1px solid var(--accent);
}
.btn-ghost:hover {
  background: rgba(77,199,226,0.08);
  box-shadow: 0 0 20px rgba(77,199,226,0.15);
}

/* ── PAGE LAYOUT ── */
.page {
  padding: 110px 2rem 4rem;
  max-width: 1200px; margin: 0 auto; min-height: 100vh;
}

.section-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 3rem; }
.section-num { font-family: 'Orbitron', sans-serif; font-size: 11px; color: var(--muted); letter-spacing: 3px; }
.section-title { font-family: 'Orbitron', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--primary); letter-spacing: 2px; margin: 0; }
.section-line { flex: 1; height: 1px; background: linear-gradient(to right, var(--border), transparent); max-width: 240px; }

/* ── CARDS ── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.75rem;
  position: relative; overflow: hidden;
  transition: all 0.3s;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 32px -8px rgba(77,199,226,0.2);
  transform: translateY(-2px);
}

.pill {
  display: inline-block;
  border: 1px solid var(--accent); color: var(--accent-dark);
  font-size: 11px; padding: 4px 12px; border-radius: 2px; letter-spacing: 1px;
}
.pill-muted { border: 1px solid var(--border); color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.5rem; }
@media(max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 1rem; }

/* ── SKILLS ── */
.skill-card .skill-icon {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px; letter-spacing: 3px;
  color: var(--accent); margin-bottom: 0.75rem;
  border: 1px solid rgba(77,199,226,0.3);
  display: inline-block; padding: 3px 8px;
}
.skill-card .skill-name { font-family: 'Orbitron', sans-serif; font-size: 12px; letter-spacing: 2px; color: var(--foreground); margin-bottom: 0.75rem; }
.skill-card .skill-desc { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 1rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 0.75rem; }
.tag { font-size: 10px; letter-spacing: 1px; padding: 4px 10px; border: 1px solid var(--border); color: var(--muted); text-transform: uppercase; }

/* ── PROJECTS ── */
.project-card .proj-num {
  position: absolute; right: 1rem; bottom: 0.5rem;
  font-family: 'Orbitron', sans-serif; font-size: 5rem; font-weight: 900;
  color: rgba(28,28,62,0.06); line-height: 1; pointer-events: none;
}
.project-card .proj-cat { margin-bottom: 0.75rem; }
.project-card .proj-title { font-family: 'Orbitron', sans-serif; font-size: 1rem; color: var(--foreground); margin: 0 0 0.75rem; letter-spacing: 0.5px; }
.project-card .proj-desc { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 1.25rem; }
.proj-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.25rem; }
.proj-link { font-size: 12px; color: var(--accent-dark); text-decoration: none; letter-spacing: 1px; font-family: 'Share Tech Mono', monospace; }
.proj-link:hover { color: var(--primary); text-decoration: underline; }

/* ── EDUCATION ── */
.edu-item {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 4px; padding: 1.75rem;
  width: 100%; max-width: 640px;
}
.edu-item.current { border-color: var(--accent); box-shadow: 0 0 30px -10px rgba(77,199,226,0.25); }
.edu-arrow { display: flex; flex-direction: column; align-items: center; }
.edu-arrow .line { width: 1px; height: 30px; background: var(--border); }
.edu-arrow .arr { color: var(--accent); font-size: 1.2rem; }

/* ── CONTACT FORM ── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }
.form-label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.form-input {
  background: var(--panel); border: 1px solid var(--border);
  color: var(--foreground); font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; padding: 11px 14px; outline: none;
  transition: border-color 0.2s; width: 100%;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(77,199,226,0.12); }
textarea.form-input { resize: vertical; min-height: 140px; }

.contact-link {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; border: 1px solid var(--border);
  text-decoration: none; transition: all 0.2s;
  color: var(--foreground); font-size: 13px;
  background: var(--panel);
}
.contact-link:hover { border-color: var(--accent); color: var(--accent-dark); }
.contact-link-icon { color: var(--accent); width: 20px; }

/* ── FOOTER ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--muted); letter-spacing: 1px;
  background: rgba(28,28,62,0.04);
}
@media(max-width: 600px) { .footer { flex-direction: column; gap: 0.5rem; text-align: center; } }

/* ── ANIMATIONS ── */
.fade-in { opacity: 0; animation: fadeIn 0.6s ease forwards; }
@keyframes fadeIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.25s; }
.delay-3 { animation-delay: 0.4s; }
.delay-4 { animation-delay: 0.55s; }

/* ── PRELOADER ── */
#preloader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #05070a;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.terminal-loader {
  font-family: 'IBM Plex Mono', monospace;
  color: #4dc7e2;
  text-align: left;
  width: min(500px, calc(100vw - 40px));
}

.terminal-logo {
  margin-bottom: 30px;
  color: #4dc7e2;
  text-shadow: 0 0 10px #4dc7e2;
}

.terminal-logo svg {
  display: block;
  width: 120px;
  height: 120px;
}

.terminal-line {
  opacity: 0;
  margin: 12px 0;
  letter-spacing: 1px;
}

.preloader-show {
  animation: showLine .25s ease forwards;
}

.access {
  color: #7cff7c;
  font-weight: bold;
  margin-top: 25px;
}

@keyframes showLine {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility 0s linear .35s;
}

@media (max-width: 600px) {
  .terminal-loader { width: min(500px, calc(100vw - 32px)); }
  .terminal-logo svg { width: 90px; height: 90px; }
}


/* ============================================================
   MOBILE POLISH — phones and small tablets
   ============================================================ */
@media (max-width: 768px) {
  html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: hidden;
    width: 100%;
  }

  /* Header / navigation */
  header {
    padding: 12px 16px;
    min-height: 58px;
  }

  .nav-container {
    width: 100%;
    gap: 10px;
  }

  .logo {
    font-size: 18px;
    white-space: nowrap;
  }

  nav ul {
    gap: 0;
  }

  nav a {
    display: block;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.2;
  }

  /* Main page spacing */
  main,
  .page-container,
  .container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  section {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: clamp(30px, 8vw, 44px);
    line-height: 1.08;
  }

  h2 {
    font-size: clamp(24px, 6vw, 32px);
    line-height: 1.15;
  }

  h3 {
    font-size: 20px;
  }

  p {
    font-size: 15px;
    line-height: 1.65;
  }

  /* Homepage / hero */
  .hero,
  .hero-section {
    min-height: auto;
    padding: 70px 18px 55px;
  }

  .hero-content {
    width: 100%;
    max-width: 100%;
  }

  .hero-terminal {
    max-width: 100%;
    overflow-x: auto;
    font-size: 12px;
  }

  .hero-buttons,
  .button-group,
  .cta-buttons {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .hero-buttons a,
  .button-group a,
  .cta-buttons a,
  .btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Cards */
  .cards,
  .card-grid,
  .projects-grid,
  .skills-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .card,
  .project-card {
    width: 100%;
    box-sizing: border-box;
  }

  /* Certificates: one clean card per row */
  .cert-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
    width: 100%;
  }

  .cert-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 20px 16px;
  }

  .cert-badge-img {
    width: 105px !important;
    height: 105px !important;
    margin: 0 auto 14px;
  }

  .cert-name {
    font-size: 18px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .cert-issuer {
    font-size: 14px;
  }

  .cert-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
  }

  .cert-tags .tag {
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }

  .cert-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Skills / tags */
  .skills,
  .skill-list,
  .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .skill,
  .skills span,
  .tags span,
  .tag {
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.35;
  }

  /* Tables and wide technical content */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  pre,
  code {
    max-width: 100%;
    box-sizing: border-box;
  }

  pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
  }

  /* Contact form */
  form {
    width: 100%;
  }

  input,
  textarea,
  select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px; /* prevents iOS zoom */
  }

  textarea {
    min-height: 130px;
  }

  /* Footer */
  footer {
    padding: 28px 16px;
    text-align: center;
  }

  /* Touch friendliness */
  a,
  button,
  input,
  textarea,
  select {
    -webkit-tap-highlight-color: transparent;
  }

  button,
  nav a,
  .btn,
  .hero-buttons a,
  .cta-buttons a {
    min-height: 44px;
  }

  /* Avoid hover-only effects sticking on touch devices */
  @media (hover: none) {
    .card:hover,
    .project-card:hover,
    .cert-card:hover {
      transform: none;
    }
  }
}

/* Very small phones */
@media (max-width: 420px) {
  header {
    padding-left: 12px;
    padding-right: 12px;
  }

  section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero,
  .hero-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .cert-card {
    padding: 17px 13px;
  }

  .cert-badge-img {
    width: 90px !important;
    height: 90px !important;
  }

  .terminal-loader {
    width: calc(100vw - 28px);
  }

  .terminal-logo svg {
    width: 80px;
    height: 80px;
  }
}
