/* ==========================================================================
   Viter — single-page stylesheet
   Same identity as before: black, red matrix rain, cyan (#00ffe5) glow accents,
   Segoe UI stack. Layout reorganised into sections with a sticky header.
   ========================================================================== */

:root {
  --bg: #000;
  --fg: #fff;
  --accent: #00ffe5;
  --muted: rgba(255, 255, 255, 0.7);
  --border: rgba(255, 255, 255, 0.16);
  --header-h: 64px;
  --gutter: clamp(16px, 5vw, 32px);
  --font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

html, body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  text-align: center;
}

img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

canvas#matrix {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.site-header, main { position: relative; z-index: 2; }

/* VITER pixel transition: fixed, centred, behind content, never intercepts input */
.pixel-word {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}
.pixel-word canvas { display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 8px 14px;
  background: #000;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Header / nav ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  height: var(--header-h);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.site-header.scrolled {
  background: rgba(0, 0, 0, 0.8);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.header-inner {
  max-width: 1040px;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: var(--fg);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 3px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  transition: text-shadow 0.3s ease;
}
.brand:hover, .brand:focus-visible { text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent); }

.menu {
  display: flex;
  gap: 30px;
}

.menu a {
  position: relative;
  text-decoration: none;
  color: var(--fg);
  font-size: 1.1rem;
  font-weight: 500;
  padding: 8px 2px;
  transition: text-shadow 0.3s ease;
}

.menu a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.menu a:hover,
.menu a:focus-visible {
  text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
}

.menu a.active::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  background: none;
  border: 0;
  color: var(--fg);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle .bars {
  position: relative;
  width: 24px;
  height: 18px;
}
.nav-toggle .bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}
.nav-toggle .bars span:nth-child(1) { top: 0; }
.nav-toggle .bars span:nth-child(2) { top: 8px; }
.nav-toggle .bars span:nth-child(3) { top: 16px; }

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

/* ---------- Sections ---------- */

.section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(64px, 12vw, 110px) var(--gutter);
  justify-content: center;
}

.hero {
  min-height: 100vh;
  min-height: 100svh;
  padding-top: calc(var(--header-h) + 24px);
}

/* ---------- Home hero ---------- */

.top-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.top-container img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0;
  transform: translateX(-100px);
  animation: slideInLeft 1s ease-out forwards;
}

h1 {
  font-size: 4rem;
  font-weight: bold;
  letter-spacing: 4px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

h1 span {
  opacity: 0;
  transform: translateX(100px);
  display: inline-block;
  animation: slideLetter 0.6s ease-out forwards;
}

h1 span:nth-child(1) { animation-delay: 0.3s; }
h1 span:nth-child(2) { animation-delay: 0.5s; }
h1 span:nth-child(3) { animation-delay: 0.7s; }
h1 span:nth-child(4) { animation-delay: 0.9s; }
h1 span:nth-child(5) { animation-delay: 1.1s; }

h1:hover span { text-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent); }

/* ---------- Section heading ---------- */

.page-heading {
  font-size: 1.6rem;
  font-weight: normal;
  letter-spacing: 2px;
  margin-bottom: 30px;
}

/* ---------- About ---------- */

.about-text {
  font-size: 1.15rem;
  line-height: 1.8;
  max-width: 640px;
  text-align: center;
}

.about-text .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
}

.about-text.play .word { animation: wordIn 0.35s ease-out forwards; }

/* ---------- Contact ---------- */

.contact-icons {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.contact-icons a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 72px;
  padding: 10px 6px;
  color: var(--fg);
  text-decoration: none;
  border-radius: 12px;
  transition: text-shadow 0.3s ease, transform 0.2s ease, background 0.3s ease;
}

.contact-icons a svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.icon-label {
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.contact-icons a:hover,
.contact-icons a:focus-visible {
  text-shadow: 0 0 10px var(--accent);
  background: rgba(0, 255, 229, 0.08);
  transform: translateY(-3px);
}

/* ---------- Projects ---------- */

.projects-wrap {
  width: 100%;
  max-width: 1040px;
}

.projects-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin-bottom: 28px;
}

.projects-filter button {
  background: none;
  border: none;
  padding: 10px 8px;
  min-height: 44px;
  min-width: 44px;
  color: rgba(255, 255, 255, 0.55);
  font-family: var(--font);
  font-weight: normal;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, text-shadow 0.2s ease;
}

.projects-filter button:hover,
.projects-filter button:focus-visible { color: #fff; }

.projects-filter button.active {
  color: #fff;
  border-bottom-color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 255, 229, 0.5);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 320px));
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.project-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.project-card:hover,
.project-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(0, 255, 229, 0.15);
  transform: translateY(-3px);
}

.project-card.is-hidden { display: none; }

.project-card .project-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.project-card .project-index {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
}

.project-card .project-category {
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(0, 255, 229, 0.8);
  white-space: nowrap;
}

.project-card .project-title {
  font-size: 1.05rem;
  font-weight: normal;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.project-card .project-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card .project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.project-card .project-tags span {
  font-size: 0.7rem;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.65);
}

.project-card .project-actions {
  display: flex;
  gap: 8px 20px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.project-card .project-tags + .project-actions,
.project-card .project-desc + .project-actions { margin-top: 12px; }

.project-card .project-actions a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.project-card .project-actions a svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.project-card .project-actions a:hover,
.project-card .project-actions a:focus-visible {
  color: var(--accent);
  text-shadow: 0 0 6px rgba(0, 255, 229, 0.5);
}

.project-card .project-actions a:hover svg,
.project-card .project-actions a:focus-visible svg { transform: translate(2px, -2px); }

.projects-empty {
  color: rgba(255, 255, 255, 0.6);
  grid-column: 1 / -1;
  text-align: center;
}

/* ---------- Scroll reveal (only when JS is running) ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Keyframes ---------- */

@keyframes slideInLeft { to { opacity: 1; transform: translateX(0); } }
@keyframes slideLetter { to { opacity: 1; transform: translateX(0); } }
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes wordIn { to { opacity: 1; transform: translateY(0); } }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .about-text .word,
  .top-container img,
  h1 span,
  .js .reveal {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---------- Responsive ---------- */

/* Tablet and below: hamburger navigation */
@media (max-width: 768px) {
  :root { --header-h: 58px; }

  .nav-toggle { display: inline-flex; }

  .menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: rgba(0, 0, 0, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
  }

  .menu.open {
    transform: none;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .menu a {
    padding: 16px 4px;
    font-size: 1.2rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .menu a:last-child { border-bottom: 0; }
  .menu a::after { display: none; }
  .menu a.active { color: var(--accent); }
}

@media (max-width: 600px) {
  h1 { font-size: 2.5rem; }

  .top-container { flex-direction: column; gap: 16px; }
  .top-container img { width: 130px; height: 130px; }

  .page-heading { font-size: 1.4rem; margin-bottom: 24px; }
  .about-text { font-size: 1rem; }

  .contact-icons { gap: 12px; }
  .contact-icons a { min-width: 68px; }

  .projects-grid { grid-template-columns: 1fr; gap: 12px; }
  .projects-filter { gap: 4px 10px; margin-bottom: 20px; }
}

@media (max-width: 380px) {
  h1 { font-size: 2.2rem; letter-spacing: 2px; }
  .brand { font-size: 1.1rem; letter-spacing: 2px; }
  .project-card { padding: 14px 15px; }
  .contact-icons { gap: 4px; }
  .contact-icons a { min-width: 64px; }
}

/* Large screens: let the hero breathe */
@media (min-width: 1400px) {
  .header-inner, .projects-wrap { max-width: 1160px; }
  h1 { font-size: 5rem; }
  .top-container img { width: 220px; height: 220px; }
  .about-text { font-size: 1.3rem; max-width: 720px; }
}
