/* ===================================
   RESET — Minimal, purposeful.
   Only what's needed, nothing more.
   =================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-snap-type: y proximity;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

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

ul,
ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  font-weight: inherit;
}

p {
  overflow-wrap: break-word;
}

iframe {
  border: 0;
}
/* ===================================
   DESIGN TOKENS — The DNA.
   Every visual decision flows from here.
   =================================== */

:root {
  /* --- Colors: Monochrome --- */
  --bg-primary:    #0a0a0a;
  --bg-secondary:  #111111;
  --bg-tertiary:   #1a1a1a;
  --bg-elevated:   #0f0f0f;

  --text-primary:   #e8e8e8;
  --text-secondary: #777777;
  --text-muted:     #555555;
  --text-accent:    #ffffff;

  --border:       #222222;
  --border-hover: #444444;
  --border-focus: #666666;

  /* --- Spacing: 4px base --- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* --- Typography Scale --- */
  --font-serif: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:  'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Courier New', monospace;

  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  3rem;       /* 48px */
  --text-6xl:  3.75rem;    /* 60px */
  --text-hero: clamp(2.5rem, 5vw + 1rem, 5rem);

  --leading-tight:  1.2;
  --leading-normal: 1.6;
  --leading-loose:  1.8;

  --tracking-tight:  -0.02em;
  --tracking-normal:  0;
  --tracking-wide:    0.05em;
  --tracking-wider:   0.1em;

  /* --- Transitions --- */
  --ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out:     cubic-bezier(0, 0, 0.2, 1);
  --ease-in:      cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce:  cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast:   150ms;
  --duration-normal: 300ms;
  --duration-slow:   500ms;
  --duration-slower: 800ms;

  /* --- Z-index Scale --- */
  --z-base:    0;
  --z-above:   10;
  --z-nav:     100;
  --z-overlay: 200;
  --z-modal:   300;

  /* --- Layout --- */
  --max-width:      1200px;
  --max-width-text: 720px;
  --header-height:  64px;

  /* --- Grain --- */
  --grain-opacity: 0.03;

  /* --- WASM-driven custom properties (updated by bridge.js) --- */
  --parallax-offset: 0px;
  --header-translate-y: 0px;
}
/* ===================================
   BASE — Typography, body, core.
   The foundation everything sits on.
   =================================== */

/* --- Font Faces --- */
/* Self-hosted later. System stack fallback for now. */
/* When fonts are added, uncomment and use unicode-range
   for per-script loading (Latin, Cyrillic, Arabic, CJK) */

/*
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('../assets/fonts/cormorant-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-cyrillic.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
*/

/* --- Body --- */

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

/* --- Headings --- */

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: var(--leading-tight);
  color: var(--text-accent);
  letter-spacing: var(--tracking-wide);
}

h1 {
  font-size: var(--text-hero);
}

h2 {
  font-size: var(--text-4xl);
  margin-block-end: var(--space-8);
}

h3 {
  font-size: var(--text-2xl);
  margin-block-end: var(--space-4);
}

/* --- Paragraphs --- */

p {
  color: var(--text-secondary);
  max-width: var(--max-width-text);
  margin-block-end: var(--space-6);
}

p:last-child {
  margin-block-end: 0;
}

/* --- Links --- */

a {
  position: relative;
  transition: color var(--duration-normal) var(--ease-default);
}

a:hover {
  color: var(--text-accent);
}

/* Underline animation — grows left to right */
.link-underline {
  background-image: linear-gradient(var(--text-accent), var(--text-accent));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: left bottom;
  padding-block-end: 2px;
  transition: background-size var(--duration-normal) var(--ease-out);
}

.link-underline:hover {
  background-size: 100% 1px;
}

/* --- Selection --- */

::selection {
  background: var(--text-accent);
  color: var(--bg-primary);
}

::-moz-selection {
  background: var(--text-accent);
  color: var(--bg-primary);
}

/* --- Scrollbar --- */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-primary);
}

/* --- Focus --- */

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

/* --- Reduced Motion --- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* --- Monospace elements --- */

code, pre, kbd {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
/* ===================================
   LAYOUT — Structure. Grid. Space.
   Using CSS logical properties for
   automatic RTL support.
   =================================== */

/* --- Skip to Content --- */

.skip-link {
  position: fixed;
  top: -100%;
  inset-inline-start: var(--space-4);
  z-index: var(--z-modal);
  padding: var(--space-2) var(--space-4);
  background: var(--text-accent);
  color: var(--bg-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* --- Header --- */

.header {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: var(--z-nav);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--space-8);
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--border);
  transform: translateY(var(--header-translate-y));
  transition: transform var(--duration-normal) var(--ease-out);
}

.header__name {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-accent);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.header__name {
  flex-shrink: 0;
  position: relative;
  z-index: 101;
}

.header__hamburger {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: var(--space-2);
  z-index: 101;
  position: relative;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  transition: transform var(--duration-normal) var(--ease-out);
}

.header__hamburger.is-active .hamburger-line:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}
.header__hamburger.is-active .hamburger-line:nth-child(2) {
  transform: translateY(-10px) rotate(-45deg);
}

/* --- Main --- */

main {
  position: relative;
}

/* --- Section --- */

.section {
  position: relative;
  padding-block: var(--space-24);
  padding-inline: var(--space-8);
  min-height: 60vh;
  min-height: 60dvh;
  opacity: 1;
  transform: none;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  scroll-margin-top: var(--header-height);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

/* JS-enhanced: WASM drives these when available */
/* Sections always visible by default; WASM smooths the reveal */
.wasm-active .section {
  --section-opacity: 1;
  opacity: var(--section-opacity);
  transform: translateY(calc((1 - var(--section-opacity)) * 20px));
}

.section--visible {
  --section-opacity: 1;
}

.section__inner {
  max-width: var(--max-width);
  margin-inline: auto;
}

/* --- Hero --- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding-block-start: var(--header-height);
  text-align: center;
  opacity: 1;
  transform: none;
  scroll-snap-align: start;
}

.hero__content {
  transform: translateY(var(--parallax-offset));
}

.hero__tagline {
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  color: var(--text-accent);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-block-end: var(--space-6);
}

.hero__subtitle {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.hero__scroll-hint {
  position: absolute;
  bottom: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  opacity: 0.6;
}

.hero__scroll-hint span {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.hero__scroll-line {
  width: 1px;
  height: 24px;
  background: linear-gradient(to bottom, var(--text-primary), transparent);
}

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

.projects-grid {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: var(--space-8);
  padding-bottom: var(--space-6);
  scrollbar-width: none; /* Hide scrollbar for clean look */
  padding-inline: 4px;
}

.projects-grid::-webkit-scrollbar {
  display: none;
}

.projects-grid .project-card {
  flex: 0 0 calc(100% - 40px); /* slightly less than 100% to peek the next item */
  max-width: 500px;
  scroll-snap-align: center;
}

.projects-carousel-wrapper {
  position: relative;
}

.carousel-nav__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  width: 48px;
  height: 48px;
  border-radius: 0; /* Retro boxy shape */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all var(--duration-fast);
}

.carousel-nav__btn:hover {
  color: var(--bg-primary);
  border-color: var(--text-accent);
  background: var(--text-accent);
  transform: translateY(-50%);
}

#carousel-prev { left: -64px; }
#carousel-next { right: -64px; }

/* --- Contact --- */

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-block-start: var(--space-8);
}

/* --- Footer --- */

.footer {
  padding-block: var(--space-8);
  padding-inline: var(--space-8);
  border-block-start: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: end;
  gap: var(--space-2);
  scroll-snap-align: end;
}

.footer__desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  max-width: 400px;
  line-height: var(--leading-loose);
  margin: 0;
}

.footer__text {
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wide);
  font-family: var(--font-mono);
  margin: 0;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .section {
    padding-block: var(--space-20);
    padding-inline: var(--space-6);
  }

  .header {
    padding-inline: var(--space-4);
  }

  .header__name {
    font-size: var(--text-sm);
  }

  .header__hamburger {
    display: flex;
  }

  .header__nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-primary);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-8);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal) var(--ease-out);
  }

  .header__nav.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .hero__tagline {
    font-size: var(--text-4xl);
  }

  .carousel-nav__btn {
    display: none; /* Hide buttons on mobile, swipe natively */
  }

  .projects-grid .project-card {
    flex: 0 0 calc(100% - 16px);
    max-width: none;
  }

  h2 {
    font-size: var(--text-3xl);
  }

  .footer {
    align-items: flex-start;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .section {
    padding-block: var(--space-16);
    padding-inline: var(--space-4);
  }

  .hero__tagline {
    font-size: var(--text-3xl);
  }

  .contact__links {
    flex-direction: column;
  }
}
/* ===================================
   COMPONENTS — Cards, switcher, grain.
   Each component is self-contained.
   =================================== */

/* --- Language Switcher --- */

.lang-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--border);
}

.lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-3);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  text-transform: uppercase;
  transition: color var(--duration-fast) var(--ease-default),
              background-color var(--duration-fast) var(--ease-default);
}

.lang-switcher__btn:hover {
  color: var(--text-primary);
}

.lang-switcher__btn--active {
  background: var(--text-accent);
  color: var(--bg-primary);
}

/* --- Project Card --- */

.project-card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  transition: border-color var(--duration-normal) var(--ease-out);
  overflow: hidden;
}

.project-card:hover {
  border-color: var(--border-hover);
}

.project-card__preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-block-end: 1px solid var(--border);
  cursor: pointer;
}

.project-card__iframe {
  width: 200%;
  height: 200%;
  transform: scale(0.5);
  transform-origin: top left;
  pointer-events: none;
  transition: pointer-events var(--duration-fast);
}

.project-card__preview:hover .project-card__iframe {
  pointer-events: auto;
}

.project-card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.6);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  pointer-events: none;
}

.project-card__preview:hover .project-card__overlay {
  opacity: 1;
}

.project-card__overlay-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-accent);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  border: 1px solid var(--text-accent);
  padding: var(--space-2) var(--space-4);
}

.project-card__info {
  padding: var(--space-6);
}

.project-card__title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  color: var(--text-accent);
  margin-block-end: var(--space-2);
}

.project-card__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-block-end: var(--space-4);
  line-height: var(--leading-loose);
}

.project-card__stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block-end: var(--space-4);
}

.project-card__tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  letter-spacing: var(--tracking-wide);
}

.project-card__links {
  display: flex;
  gap: var(--space-4);
}

.project-card__link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding-block-end: 1px;
  border-block-end: 1px solid transparent;
  transition: color var(--duration-fast) var(--ease-default),
              border-color var(--duration-fast) var(--ease-default);
}

.project-card__link:hover {
  color: var(--text-accent);
  border-color: var(--text-accent);
}

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

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  letter-spacing: var(--tracking-wide);
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--border);
  transition: color var(--duration-normal) var(--ease-default),
              border-color var(--duration-normal) var(--ease-default),
              background-color var(--duration-normal) var(--ease-default);
}

.contact-link:hover {
  color: var(--text-accent);
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
}

.contact-link__icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* --- Contact Block --- */
.contact-block {
  margin-top: 40px;
  border: 1px solid var(--border);
  padding: 32px;
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.4), rgba(10, 10, 10, 0.8));
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}
.contact-block::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--text-accent), transparent);
  opacity: 0.3;
}
.contact-block__heading {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  color: var(--text-accent);
  margin-bottom: var(--space-4);
}
.contact-block__text {
  font-size: var(--text-md);
  color: var(--text-secondary);
  line-height: var(--leading-loose);
  max-width: 600px;
  margin-bottom: var(--space-8);
}


/* --- Film Grain Overlay --- */

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}

/* --- Hidden Message (Easter Egg) --- */

.hidden-message {
  color: transparent;
  user-select: text;
  -webkit-user-select: text;
  font-style: italic;
  display: inline;
}

.hidden-message::selection {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.hidden-message::-moz-selection {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* --- Section Label --- */

.section__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  margin-block-end: var(--space-4);
}

/* --- Skills Block --- */
.skills-block {
  margin-top: 40px;
  border: 1px solid var(--border);
  padding: 24px;
  background: var(--bg-secondary);
  opacity: 1;
  visibility: visible;
}
.skills-block__heading {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.skills-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.skill-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--duration-normal) var(--ease-default);
}
.skill-item:last-child {
  border-bottom: none;
}
.skill-item:hover {
  border-color: var(--border-hover);
}
.skill-item__name {
  font-weight: 500;
  color: var(--text-accent);
  font-size: 14px;
  letter-spacing: 0.5px;
}
.skill-item__primary-badge {
  font-size: 10px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-accent);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  font-family: var(--font-mono);
  vertical-align: middle;
}
.skill-item__desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  max-width: none;
}

/* --- Virtual Terminal --- */
body.terminal-open {
  overflow: hidden;
}

.virtual-terminal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  color: #3fb950;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.virtual-terminal--active {
  opacity: 1;
  pointer-events: all;
}
/* Output area — fills full screen, content flows top → bottom */
.virtual-terminal__output-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 24px 36px 8px 36px;
}

/* Hide scrollbar for a clean terminal look */
.virtual-terminal__output-wrap::-webkit-scrollbar {
  display: none;
}
.virtual-terminal__output-wrap {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
.virtual-terminal__output {
  overflow: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 13px;
  line-height: 1.65;
}
/* Individual output line — used for animation */
.vt-line {
  animation: vt-line-appear 0.12s ease both;
}
@keyframes vt-line-appear {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Input line — pinned at bottom */
.virtual-terminal__input-wrap {
  flex-shrink: 0;
  padding: 8px 32px 20px 32px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.virtual-terminal__input-line {
  display: flex;
  align-items: center;
  font-size: 13px;
  line-height: 1.65;
}
.vt-prompt {
  color: #58a6ff;
  white-space: nowrap;
  margin-right: 6px;
  flex-shrink: 0;
}
.vt-input-text {
  color: #e6edf3;
  word-break: break-all;
}
.vt-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #e6edf3;
  vertical-align: text-bottom;
  animation: vt-cursor-blink 1.1s step-end infinite;
  margin-left: 1px;
  opacity: 1;
}
@keyframes vt-cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
/* ===================================
   ANIMATIONS — Motion. Life. Restraint.
   Nothing moves unless it has purpose.
   =================================== */

/* --- Section Reveal --- */

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Pulse Opacity (scroll hint) --- */

@keyframes pulse-opacity {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.8;
  }
}

/* --- Cursor blink --- */

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.cursor-blink::after {
  content: '▎';
  animation: blink 1.2s step-end infinite;
  color: var(--text-accent);
}

/* --- Stagger children --- */

/* Default: visible for no-JS / WASM-failure states */
.stagger-children > * {
  opacity: 1;
  transform: none;
}

/* JS-enhanced: only hide when JS adds class */
.js-stagger .stagger-children > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.js-stagger .stagger-children.visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: none; }
.js-stagger .stagger-children.visible > *:nth-child(2) { transition-delay: 100ms; opacity: 1; transform: none; }
.js-stagger .stagger-children.visible > *:nth-child(3) { transition-delay: 200ms; opacity: 1; transform: none; }
.js-stagger .stagger-children.visible > *:nth-child(4) { transition-delay: 300ms; opacity: 1; transform: none; }
.js-stagger .stagger-children.visible > *:nth-child(5) { transition-delay: 400ms; opacity: 1; transform: none; }
.js-stagger .stagger-children.visible > *:nth-child(6) { transition-delay: 500ms; opacity: 1; transform: none; }
.js-stagger .stagger-children.visible > *:nth-child(7) { transition-delay: 600ms; opacity: 1; transform: none; }
.js-stagger .stagger-children.visible > *:nth-child(8) { transition-delay: 700ms; opacity: 1; transform: none; }
.js-stagger .stagger-children.visible > *:nth-child(n+9) { transition-delay: 800ms; opacity: 1; transform: none; }

/* --- Flash effect (Easter Egg: 67 sequence) --- */

@keyframes flash-67 {
  0%   { opacity: 0; }
  15%  { opacity: 0.08; }
  30%  { opacity: 0; }
  45%  { opacity: 0.04; }
  100% { opacity: 0; }
}

.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: #f5f0e8;
  pointer-events: none;
  opacity: 0;
}

.flash-overlay--active {
  animation: flash-67 0.6s var(--ease-out) forwards;
}

/* --- Resonance Pulse (Idle) --- */
@keyframes resonance-pulse {
  0%, 100% { opacity: 0.8; text-shadow: 0 0 0px var(--text-muted); }
  50% { opacity: 1; text-shadow: 0 0 12px rgba(255, 255, 255, 0.4); }
}

body.idle-resonance #about p:nth-of-type(3) em {
  animation: resonance-pulse 4s ease-in-out infinite;
  display: inline-block;
}

/* --- Language transition --- */

[data-i18n] {
  transition: opacity var(--duration-fast) var(--ease-default);
}

.i18n-switching [data-i18n] {
  opacity: 0.4;
}
/* ===================================
   RTL — Arabic layout overrides.
   Logical properties handle most of it.
   This file covers what they don't.
   =================================== */

[dir="rtl"] {
  /* Arabic-optimized font stack */
  --font-sans: 'Noto Sans Arabic', 'Segoe UI', 'Tahoma', system-ui, sans-serif;
  --font-serif: 'Noto Serif Arabic', 'Traditional Arabic', 'Times New Roman', serif;
}

[dir="rtl"] body {
  text-align: right;
}

/* Header: flip order */
[dir="rtl"] .header {
  flex-direction: row-reverse;
}

/* Link underline: grow from right */
[dir="rtl"] .link-underline {
  background-position: right bottom;
}

/* Scrollbar position */
[dir="rtl"]::-webkit-scrollbar {
  direction: rtl;
}

/* Project card links */
[dir="rtl"] .project-card__links {
  flex-direction: row-reverse;
}

/* Contact links */
[dir="rtl"] .contact__links {
  flex-direction: row-reverse;
}

/* Footer alignment */
[dir="rtl"] .footer {
  text-align: center;
}
