:root {
  color-scheme: dark;
  --bg-primary: #0B0B0F;
  --bg-secondary: #13131A;
  --bg-card: #181822;
  --accent: #D20A2E;
  --accent-hover: #F2133C;
  --accent-glow: rgba(210, 10, 46, 0.25);
  --text-primary: #F4F4F6;
  --text-secondary: #A1A1B5;
  --border-color: rgba(255, 255, 255, 0.08);
  --font-sans: 'Poppins', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
  --font-display: 'Bricolage Grotesque', 'Poppins', system-ui, sans-serif;

  --brush: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 24' preserveAspectRatio='none'%3E%3Cpath fill-rule='evenodd' d='M2 10 L6 7 L4 5 L12 4 L30 5 L46 3 L70 5 L96 3 L122 5 L150 3 L178 4 L192 3 L197 6 L194 8 L199 11 L195 13 L198 16 L193 18 L196 21 L186 20 L170 22 L146 20 L118 22 L92 20 L64 22 L40 20 L18 22 L8 20 L3 21 L5 17 L1 15 L5 13 Z M6 11 L34 11.6 L34 12.6 L6 12.2 Z M10 15 L46 15.4 L46 16.2 L10 16 Z M160 9 L193 9.6 L193 10.6 L160 10.2 Z M150 14 L196 14.5 L196 15.3 L150 15 Z'/%3E%3C/svg%3E");
}

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

html { scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

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

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

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

main { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
section { padding: 5.5rem 0; }


#other-projects,
#about-me,
#contacts {
  content-visibility: auto;
  contain-intrinsic-size: auto 700px;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 15, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
}

nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -1px;
}
.logo .dot { color: var(--accent-hover); }

.navLinks { display: flex; list-style: none; justify-content: center; gap: 1rem; }
.navLinks a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.25s ease;
}
.navLinks a { position: relative; }
.navLinks a::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.55rem;
  height: 1px;
  background: currentColor;
  scale: 0 1;
  transform-origin: left;
  transition: scale 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.navLinks a:hover { color: var(--text-primary); }
.navLinks a:hover::after,
.navLinks a[aria-current="true"]::after { scale: 1 1; }
.navLinks a[aria-current="true"] { color: var(--text-primary); }
.navLinks { scroll-target-group: auto; }
section:focus-visible { outline: none; }

.hero {
  padding-top: 6rem;
  padding-bottom: 5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.035em;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}
.hero h1 .highlight { color: var(--accent-hover); }

.hero .subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin-bottom: 2rem;
  text-wrap: pretty;
}

.about-card {
  max-width: 820px;
  margin-bottom: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.about-card p { color: var(--text-secondary); font-size: 0.98rem; text-wrap: pretty; }

.callout { margin-top: 1rem; }
.calloutTitle {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-hover);
  margin-bottom: 0.4rem;
}
.callout p { font-size: 0.95rem; color: #D4D4E0; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 1rem; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  padding: 0.9rem 1.5rem;
  border-radius: 4px;
  background: rgba(210, 10, 47, 0.85);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background 0.25s ease, color 0.25s ease, transform 0.18s ease;
}
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-primary [aria-hidden] { display: inline-block; transition: translate 0.25s cubic-bezier(0.22, 1, 0.36, 1); }
.btn-primary:hover [aria-hidden] { translate: 0 3px; }
.btn-primary:active { transform: scale(0.98); }

.btn-second {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-height: 44px;
  margin-left: 0.75rem;
  padding: 0.85rem 0.35rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.btn-second::after,
.pill::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -0.4rem;
  right: -0.5rem;
  bottom: calc(0.85rem - 0.05em);
  height: 1.05em;
  background: var(--accent);
  opacity: 0.6;
  transform: rotate(-1deg);
  -webkit-mask: var(--brush) center / 100% 100% no-repeat;
  mask: var(--brush) center / 100% 100% no-repeat;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.btn-second:hover::after,
.btn-second:focus-visible::after,
.pill:hover::after,
.pill:focus-visible::after { clip-path: inset(0 0 0 0); }

.section-head { margin-bottom: 3rem; }
.section-head h2 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); font-weight: 700; line-height: 1.2; margin-bottom: 0.5rem; text-wrap: balance; }
.section-sub { color: var(--text-secondary); font-size: 1rem; }

.ico { width: 1.1rem; height: 1.1rem; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.featuredGrid { display: grid; grid-template-columns: 1fr; gap: 3rem; }

.projectCard {
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: start;
}


.carousel,
.single-img {
  position: relative;
  background: #08080C;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: manipulation;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline-offset: -3px; }
@media (prefers-reduced-motion: no-preference) {
  .carousel-track { scroll-behavior: smooth; }
}

.carousel-track > * {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.carousel-track img,
.single-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-controls {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  pointer-events: none;
}
.carousel-controls[hidden] { display: none; }

.carBtn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(11, 11, 15, 0.8);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.carBtn .ico { width: 20px; height: 20px; stroke-width: 2.5; }
.carBtn:hover { background: var(--accent); border-color: var(--accent); }

.car-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(11, 11, 15, 0.65);
}
.carDot {
  position: relative;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

.carDot::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  translate: -50% -50%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  transition: width 0.2s ease, background 0.2s ease;
}

.carDot[aria-current="true"]::before { width: 20px; background: var(--accent-hover); }

.project-content,
.compactBody {
  padding: 2rem 0 2rem 2rem;
  display: flex;
  flex-direction: column;
}
.project-content { justify-content: space-between; align-self: stretch; }

.projHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.85rem; }
.projHead h3 { font-size: 1.55rem; font-weight: 700; line-height: 1.25; }

.proj-year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
}

.tech_tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-bottom: 1.25rem; list-style: none; }
.tag { font-family: var(--font-mono); font-size: 0.78rem; }
.tech_tags .tagIcon { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.tech_tags .tagIcon img { width: 32px; height: 32px; object-fit: contain; display: block; }

.project-desc { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 1.75rem; text-wrap: pretty; }
.project-desc.project-role { margin-top: -0.9rem; }

.projFooter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: color 0.2s ease;
}
.project-link .ico { transition: translate 0.2s ease; }
.project-link:hover { color: var(--accent-hover); }
.project-link:hover .ico { translate: 2px -2px; }


.other-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: 1.75rem; }

.compact-card { border-top: 1px solid var(--border-color); overflow: hidden; display: flex; flex-direction: column; }

.compact-thumb {
  height: 200px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(16, 185, 129, 0.15) 0%, #090B0E 70%);
}
.compact-thumb::before {
  content: attr(data-project-title);
  position: absolute;
  z-index: 1;
  padding: 0 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
}
.compact-thumb::after {
  content: attr(data-project-sub);
  position: absolute;
  z-index: 1;
  margin-top: 3.2rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.compact-thumb img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.compact-card:hover .compact-thumb img { transform: scale(1.04); }

.compactBody { flex-grow: 1; padding: 1.5rem 0 1.5rem 0; }
.compact-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.65rem; }
.compact-head h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.compactBody .project-desc { font-size: 0.9rem; margin-bottom: 1.25rem; }
.compactBody .project-desc.project-role { margin-top: -0.6rem; flex-grow: 1; }
.compact-links { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }


.skillsWrap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem; align-items: start; }

.skill-cat[data-cat="languages"] { --cat-color: #F2133C; }
.skill-cat[data-cat="engines"]   { --cat-color: #3B82F6; }
.skill-cat[data-cat="tools"]     { --cat-color: #A855F7; }

.skill-cat h3 {
  position: relative;
  isolation: isolate;
  display: inline-block;
  padding: 0 0.15rem;
  margin-bottom: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-primary);
}
.skill-cat h3::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -0.5rem;
  right: -0.6rem;
  bottom: -0.05em;
  height: 1.05em;
  background: var(--cat-color, var(--accent));
  opacity: 0.55;
  transform: rotate(-1deg);
  -webkit-mask: var(--brush) center / 100% 100% no-repeat;
  mask: var(--brush) center / 100% 100% no-repeat;
}
.skill-cat[data-cat="engines"] h3::after { transform: rotate(0.8deg); left: -0.4rem; }
.skill-cat[data-cat="tools"] h3::after   { transform: rotate(-0.5deg); right: -0.8rem; }

.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; justify-content: center; list-style: none; }
.skill-cat[data-cat="languages"] .skillItem:last-child { grid-column: 2; }

.skillItem {
  position: relative;
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 0.5rem;
  transition: background 0.25s ease;
}
.skillItem:hover { background: rgba(255, 255, 255, 0.025); }

.skillItem::after {
  content: attr(data-tooltip) "\A" attr(data-subtitle);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.6rem);
  z-index: 10;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--cat-color, var(--accent));
  border-radius: 6px;
  background: #111118;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: pre;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 0.35rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.skill-cat[data-cat="languages"] .skillItem::after { content: attr(data-tooltip); }
.skillItem:hover::after,
.skillItem:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.skillItem:focus-visible { outline-color: var(--cat-color, var(--accent-hover)); }

.skill-ico { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.skillItem img { width: 32px; height: 32px; object-fit: contain; transition: translate 0.2s ease; }
.skillItem:hover img,
.skillItem:focus-visible img { translate: 0 -2px; }

img.whiteIcon { filter: brightness(0) invert(1) !important; }


.contactBox { border-top: 1px solid var(--border-color); padding: 3rem 0; text-align: center; }
.contactBox h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.2; margin-bottom: 1rem; text-wrap: balance; }
.contact-text { color: var(--text-secondary); max-width: 620px; margin: 0 auto 2.25rem; text-wrap: pretty; }
.contact-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem 1.75rem; }

.pill {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.85rem 0.35rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.pill .ico { width: 1.25rem; height: 1.25rem; }

footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}


@media (prefers-reduced-motion: no-preference) {
  
  @keyframes rise { from { opacity: 0; translate: 0 16px; } }
  @keyframes rise-y { from { translate: 0 12px; } }
  .hero > * { animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .hero > h1 { animation-name: rise-y; }
  .hero > :nth-child(2) { animation-delay: 0.08s; }
  .hero > :nth-child(3) { animation-delay: 0.16s; }
  .hero > :nth-child(4) { animation-delay: 0.24s; }

  
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes reveal { from { opacity: 0; translate: 0 24px; } }
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
  }
  
  .reveal-fallback .reveal { opacity: 0; translate: 0 24px; transition: opacity 0.55s ease, translate 0.55s cubic-bezier(0.22, 1, 0.36, 1); }
  .reveal-fallback .reveal.in { opacity: 1; translate: none; }
}

@media (max-width: 900px) {
  .projectCard { grid-template-columns: 1fr; }
  .project-content { padding: 1.5rem 0; }
  .skillsWrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  nav { grid-template-columns: auto 1fr; padding: 0.5rem 1rem; }
  .navLinks { justify-content: flex-end; gap: 0; }
  .navLinks a { padding: 0 0.4rem; font-size: 0.8rem; }
  main { padding: 0 1.25rem; }
  section { padding: 3.5rem 0; }
  .hero { padding-top: 3.5rem; }
  .skillsWrap { grid-template-columns: 1fr; gap: 2rem; }
  .skill-cat[data-cat="languages"] .skillItem:last-child { grid-column: auto; }
}

@media (hover: none) {
  .pill::after,
  .btn-second::after { clip-path: inset(0 0 0 0); opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .compact-card:hover .compact-thumb img { transform: none; }
}