/* ============================================
   DARKSPHERE — Design Studio Portfolio
   darksphere.cc
   ============================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === TOKENS === */
:root {
  /* Фоны */
  --bg-void:      #0A0A0A;
  --bg-primary:   #111111;
  --bg-surface:   #1A1A1A;
  --bg-elevated:  #242424;
  --bg-input:     #0D0D0D;

  /* Акцент */
  --accent:       #FFFFFF;
  --accent-hover: #DDDDDD;
  --accent-muted: rgba(255, 255, 255, 0.06);
  --accent-glow:  0 0 20px rgba(255, 255, 255, 0.15);

  /* Ошибка */
  --error:        #FF3333;
  --error-muted:  rgba(255, 51, 51, 0.08);
  --error-glow:   0 0 20px rgba(255, 51, 51, 0.3);

  /* Warn */
  --warn:         #FFAA00;

  /* Текст */
  --text-1:       #F0F0F0;
  --text-2:       #888888;
  --text-3:       #555555;
  --text-code:    #FFFFFF;

  /* Бордеры */
  --border:       rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-error: rgba(255, 51, 51, 0.3);

  /* Шрифты */
  --font-display: 'Urbanist', sans-serif;
  --font-body:    'Manrope', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Transition */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.3s;
  --dur-slow: 0.6s;

  /* Container */
  --container: 1400px;
  --pad: clamp(16px, 4vw, 60px);

  /* Radius */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--bg-void);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

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

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

/* === LAYOUT === */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section {
  padding-block: var(--space-4xl);
}

.section--tight {
  padding-block: var(--space-2xl);
}

/* === TYPOGRAPHY === */
.display {
  font-family: var(--font-display);
  font-size: clamp(48px, 10vw, 120px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--text-1);
}

.h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-1);
}

.h3 {
  font-family: var(--font-body);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-1);
}

.mono {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-code);
}

/* === SECTION LABEL === */
.label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-3);
  margin-bottom: var(--space-md);
  display: block;
}

.label::before {
  content: "> ";
  color: var(--accent);
}

/* === BRACKET NOTATION === */
.bracket {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.bracket::before { content: "["; }
.bracket::after  { content: "]"; }

.bracket--curly::before { content: "{"; }
.bracket--curly::after  { content: "}"; }

/* === ASCII LOADER === */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-void);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-1);
  transition: opacity 0.5s;
}
.loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.loader__bar { color: var(--accent); }
.loader__percent { font-size: 11px; color: var(--text-3); }

/* === NEBULA BG === */
.nebula {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.nebula::before,
.nebula::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  animation: nebula-drift 20s ease-in-out infinite alternate;
}
.nebula::before {
  width: 600px; height: 600px;
  top: -200px; right: -100px;
  background: var(--accent);
}
.nebula::after {
  width: 500px; height: 500px;
  bottom: -150px; left: -100px;
  background: #333333;
  animation-delay: -10s;
}
@keyframes nebula-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(50px, 30px) scale(1.1); }
  100% { transform: translate(-30px, -20px) scale(0.95); }
}

/* === NAV === */
.nav {
  position: fixed;
  top: 0;
  width: 100%;
  padding: var(--space-md) var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  background: transparent;
  transition: background var(--dur);
  font-family: var(--font-mono);
  font-size: 11px;
}
.nav.is-scrolled {
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav__brand {
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nav__logo {
  font-family: 'DotGothic16', var(--font-display), monospace;
  font-size: 18px;
  font-weight: 400;
  color: var(--text-1);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.nav__logo::after {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: super;
  box-shadow: var(--accent-glow);
}
.nav__links {
  display: flex;
  gap: var(--space-lg);
}
.nav__link {
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--dur);
}
.nav__link:hover { color: var(--text-1); }
.nav__link.is-active { color: var(--accent); }

.nav__burger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__burger { display: block; }
}

/* === FULLSCREEN NAV OVERLAY === */
.fullnav {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(10, 10, 10, 0.98);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s var(--ease);
}
.fullnav.is-open {
  opacity: 1;
  visibility: visible;
}
.fullnav__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-4xl) var(--pad);
  gap: var(--space-md);
}
.fullnav__link {
  font-family: var(--font-display);
  font-size: clamp(32px, 7vw, 72px);
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-1);
  display: block;
  line-height: 1.1;
  transition: color var(--dur);
}
.fullnav__link:hover { color: var(--accent); }
.fullnav__content:hover .fullnav__link:not(:hover) {
  color: var(--text-3);
}
.fullnav__close {
  position: absolute;
  top: var(--space-md);
  right: var(--pad);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  background: none;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: all var(--dur);
}
.fullnav__close:hover {
  color: var(--error);
  border-color: var(--border-error);
}

/* === HERO === */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(60px + var(--space-2xl)) var(--pad) var(--space-2xl);
  position: relative;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  position: relative;
  min-height: 70vh;
}
.hero__left {
  position: relative;
  z-index: 2;
}
.hero__right {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  min-height: 500px;
  overflow: hidden;
}
@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }
  .hero__right {
    position: absolute;
    inset: 0;
    opacity: 0.2;
    pointer-events: none;
    min-height: auto;
  }
}

/* === ASCII ART CANVAS (hero right) === */
#asciiCanvas {
  width: 100%;
  max-width: 600px;
  height: auto;
  image-rendering: pixelated;
}

/* Dashed frame placeholder */
.ascii-art-frame {
  position: absolute;
  inset: -16px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}
@keyframes art-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes sphere-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}
@keyframes sphere-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.hero__subtitle {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.5vw, 16px);
  color: var(--accent);
  margin-bottom: var(--space-lg);
}
.hero__subtitle::before {
  content: "$ ";
  opacity: 0.5;
}
.hero__title {
  font-family: 'DotGothic16', var(--font-display), monospace;
  font-size: clamp(52px, 11vw, 140px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-1);
  margin-bottom: var(--space-lg);
  image-rendering: pixelated;
}
.hero__title-line {
  display: block;
}
.hero__title-line:nth-child(2) {
  padding-left: clamp(20px, 5vw, 80px);
}
.hero__desc {
  font-family: var(--font-body);
  font-size: clamp(15px, 1.5vw, 18px);
  color: var(--text-2);
  max-width: 550px;
  margin-bottom: var(--space-xl);
  line-height: 1.6;
}
.hero__actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.hero__scroll {
  position: absolute;
  bottom: var(--space-xl);
  right: var(--pad);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
}
.hero__scroll-arrow {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.hero__scroll-arrow::after {
  content: "";
  width: 50px;
  height: 1px;
  background: var(--text-3);
}
.hero__scroll-text {
  font-style: italic;
  font-family: var(--font-body);
  font-size: 12px;
}

/* Cursor blink */
.cursor::after {
  content: "█";
  color: var(--accent);
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* === BUTTONS === */
.btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  border: none;
  transition: all var(--dur);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}
.btn--primary {
  background: var(--accent);
  color: var(--bg-void);
}
.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--accent-glow);
  transform: translateY(-2px);
}
.btn--ghost {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--border-hover);
}
.btn--ghost:hover {
  border-color: var(--text-1);
  background: rgba(255,255,255,0.03);
}
.btn--error {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--border-error);
}
.btn--error:hover {
  background: var(--error-muted);
  box-shadow: var(--error-glow);
}
.btn--full { width: 100%; justify-content: center; }

/* === PROJECT CARDS (shop-style) === */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 1024px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .projects-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.4s var(--ease);
  display: flex;
  flex-direction: column;
  text-decoration: none;
}
.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.card__preview {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-elevated);
}
.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(30%) brightness(0.9);
  transition: all 0.6s var(--ease);
}
.card:hover .card__img {
  filter: grayscale(0%) brightness(1);
  transform: scale(1.05);
}
.card__number {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-1);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  padding: 3px 8px;
  border-radius: 2px;
}
.card__preview::after {
  content: "+++";
  position: absolute;
  bottom: 8px; right: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,0.2);
}
/* ASCII placeholder when no image */
.card__ascii {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1.15;
  white-space: pre;
  color: var(--text-1);
  opacity: 0.5;
  padding: var(--space-md);
}
.card__body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
}
.card__category {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.card__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}
.card__desc {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__spacer { flex: 1; }
.card__cta {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  transition: all var(--dur);
  margin-top: var(--space-md);
}
.card:hover .card__cta {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-muted);
}

/* === FILTER BAR === */
.filters {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}
.filter-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 14px;
  transition: all var(--dur);
}
.filter-btn:hover {
  color: var(--text-1);
  border-color: var(--border-hover);
}
.filter-btn.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-muted);
}

/* === SECTION HEADER === */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}
.section-header__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}
.section-header__count::before { content: "{"; }
.section-header__count::after  { content: "}"; }

/* === SERVICES / PRICING === */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .services-grid { grid-template-columns: 1fr; }
}

.service-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all 0.4s var(--ease);
  position: relative;
}
.service-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.service-card__num {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-1);
  opacity: 0.04;
  line-height: 1;
}
.service-card__icon {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.service-card__icon::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}
.service-card__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
}
.service-card__desc {
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.5;
  flex: 1;
}
.service-card__price {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* === CONTACT / BRIEF FORM === */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}
@media (max-width: 768px) {
  .contact-grid { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.form-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px var(--space-md);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-1);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--dur);
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-3);
}
.form-textarea {
  resize: vertical;
  min-height: 140px;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23555'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-message {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  display: none;
}
.form-message.is-success {
  display: block;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid rgba(255,255,255,0.2);
}
.form-message.is-error {
  display: block;
  color: var(--error);
  background: var(--error-muted);
  border: 1px solid var(--border-error);
}

/* Contact info */
.contact-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}
.contact-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 13px;
}
.contact-row__key {
  color: var(--text-3);
  min-width: 30px;
}
.contact-row__value {
  color: var(--text-2);
}
.contact-row__value a {
  color: var(--accent);
  transition: opacity var(--dur);
}
.contact-row__value a:hover { opacity: 0.7; }

/* === BENTO FOOTER === */
.footer {
  padding: var(--space-2xl) var(--pad);
  border-top: 1px solid var(--border);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (max-width: 768px) {
  .footer__grid { grid-template-columns: 1fr; }
}
.footer__cell {
  background: var(--bg-void);
  padding: var(--space-xl);
}
.footer__cell--full {
  grid-column: 1 / -1;
}
.footer__nav-link {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-2);
  display: block;
  padding: var(--space-xs) 0;
  transition: color var(--dur);
}
.footer__nav-link:hover { color: var(--text-1); }

/* Telemetry bar */
.telemetry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--space-lg);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  gap: var(--space-lg);
  overflow-x: auto;
  flex-wrap: nowrap;
}
.telemetry__item {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.telemetry__item--live::before {
  content: "";
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
.telemetry__center {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 14px;
  transition: all var(--dur);
}
.telemetry__center:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* === 404 PAGE === */
.page-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}
.page-404__number {
  font-family: var(--font-display);
  font-size: clamp(100px, 25vw, 280px);
  font-weight: 900;
  color: var(--text-1);
  line-height: 1;
  position: relative;
}
.page-404__number::before,
.page-404__number::after {
  content: "404";
  position: absolute;
  inset: 0;
}
.page-404__number::before {
  color: var(--error);
  animation: glitch1 3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}
.page-404__number::after {
  color: var(--accent);
  animation: glitch2 3s infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}
@keyframes glitch1 {
  0%,92%  { transform: translate(0); }
  93% { transform: translate(-4px,2px); }
  95% { transform: translate(4px,-2px); }
  96%,100% { transform: translate(0); }
}
@keyframes glitch2 {
  0%,94%  { transform: translate(0); }
  95% { transform: translate(3px,1px); }
  97% { transform: translate(-3px,-1px); }
  98%,100% { transform: translate(0); }
}
.page-404__text {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-2);
  margin: var(--space-xl) 0;
}
.page-404__text span { color: var(--accent); }
.page-404__links {
  display: flex;
  gap: var(--space-md);
}

/* === PROJECT PAGE === */
.project-hero {
  padding: calc(80px + var(--space-3xl)) var(--pad) var(--space-2xl);
}
.project-hero__back {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: var(--space-lg);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  transition: color var(--dur);
}
.project-hero__back:hover { color: var(--accent); }
.project-hero__back::before { content: "←"; }

.project-hero__category {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-md);
}
.project-hero__title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: var(--space-md);
}
.project-hero__desc {
  font-size: 16px;
  color: var(--text-2);
  max-width: 700px;
  line-height: 1.6;
}

.project-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  padding: 0 var(--pad) var(--space-4xl);
  max-width: 1000px;
  margin: 0 auto;
}
.project-gallery img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* === ADMIN === */
.admin {
  padding: var(--space-4xl) var(--pad);
  max-width: 900px;
  margin: 0 auto;
}
.admin__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}
.admin-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.dropzone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius);
  padding: var(--space-2xl);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
  transition: all var(--dur);
  cursor: pointer;
}
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--accent);
}
.dropzone__hint {
  font-size: 11px;
  margin-top: var(--space-sm);
  opacity: 0.5;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.preview-grid__item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.preview-grid__item img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.preview-grid__remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(255,51,51,0.8);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Admin projects list */
.admin-projects {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}
.admin-project {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.admin-project__info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.admin-project__thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-elevated);
}
.admin-project__title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
}
.admin-project__cat {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
}
.admin-project__actions {
  display: flex;
  gap: var(--space-sm);
}
.admin-project__btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-3);
  border-radius: 2px;
  transition: all var(--dur);
}
.admin-project__btn:hover {
  color: var(--text-1);
  border-color: var(--border-hover);
}
.admin-project__btn--delete:hover {
  color: var(--error);
  border-color: var(--border-error);
}

/* Auth screen */
.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth__box {
  max-width: 360px;
  width: 100%;
  padding: var(--space-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.auth__title {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-1);
  margin-bottom: var(--space-lg);
}
.auth__input {
  width: 100%;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
  color: var(--text-1);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}
.auth__input:focus {
  border-color: var(--accent);
  outline: none;
}

/* === SCRAMBLE === */
.scramble.is-scrambling {
  text-shadow:
    -1px 0 rgba(255,51,51,0.5),
     1px 0 rgba(255,255,255,0.5);
}

/* === SCROLL REVEAL ANIMATIONS === */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
/* Stagger siblings */
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }
.reveal:nth-child(4) { transition-delay: 0.3s; }
.reveal:nth-child(5) { transition-delay: 0.4s; }
.reveal:nth-child(6) { transition-delay: 0.5s; }

.reveal-fade {
  opacity: 0;
  transition: opacity 0.8s ease;
}
.reveal-fade.is-visible {
  opacity: 1;
}

/* === UTILITIES === */
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-3); }
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* === IMAGE PROTECTION === */

/* Disable drag, select, right-click visually */
.protected-img {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Watermark overlay on project images */
.watermarked {
  position: relative;
  overflow: hidden;
}
.watermarked::after {
  content: "DARKSPHERE";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: clamp(14px, 3vw, 24px);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.06);
  transform: rotate(-25deg);
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}

/* Repeating watermark for gallery images */
.watermarked--repeat::after {
  content: "DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE  ·  DARKSPHERE";
  font-size: clamp(10px, 2vw, 16px);
  letter-spacing: 0.2em;
  line-height: 3;
  white-space: normal;
  word-break: break-all;
  opacity: 1;
  color: rgba(255, 255, 255, 0.04);
  transform: rotate(-25deg) scale(1.5);
}

/* Transparent overlay to block save-image */
.watermarked::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: auto;
  cursor: default;
}

/* ============================================
   ASCII / PIXEL / SCANLINE LAYER
   ============================================ */

/* === GLOBAL SCANLINES (subtle CRT overlay) === */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  mix-blend-mode: multiply;
}

/* === ASCII BACKGROUND TEXTURE === */
.ascii-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  color: var(--accent);
  opacity: 0.025;
  white-space: pre;
  word-break: break-all;
  padding: 20px;
}

/* Pixel noise overlay */
.pixel-noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.015;
  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: 256px 256px;
}

/* Halftone dot overlay */
.halftone {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px
  );
  background-size: 4px 4px;
}

/* === NEBULA VARIANTS === */
.nebula--red::before { background: #FF3333; }
.nebula--red::after  { background: #880000; }

/* === +++ CORNER MARKERS === */
.markers {
  position: relative;
}
.markers::before {
  content: "+++";
  position: absolute;
  top: 12px; right: 16px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  opacity: 0.25;
  letter-spacing: 0.2em;
}
.markers::after {
  content: "+++";
  position: absolute;
  bottom: 12px; left: 16px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  opacity: 0.25;
  letter-spacing: 0.2em;
}

/* === ASCII DIVIDER === */
.ascii-divider {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-align: center;
  padding: var(--space-xl) 0;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}
/* reveal-fade handles opacity: 0 → 0.2 */
.ascii-divider.reveal-fade.is-visible {
  opacity: 0.2;
}

/* === PIXEL BORDER (dashed ASCII-style) === */
.pixel-border {
  border: 1px dashed var(--border-hover);
}

/* === CRT GREEN IMAGE === */
.crt-green {
  position: relative;
}
.crt-green img {
  filter: grayscale(100%) brightness(0.8) contrast(1.4) sepia(100%) hue-rotate(70deg) saturate(5);
}
.crt-green::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.3) 2px,
    rgba(0, 0, 0, 0.3) 4px
  );
  pointer-events: none;
  border-radius: inherit;
}

/* === ASCII FRAME around sections === */
.ascii-frame {
  position: relative;
  padding: var(--space-xl);
}
.ascii-frame::before {
  content: "\250C\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2510";
  position: absolute;
  top: 0; left: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--border-hover);
  pointer-events: none;
}
.ascii-frame::after {
  content: "\2514\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2518";
  position: absolute;
  bottom: 0; right: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--border-hover);
  pointer-events: none;
}

/* === SECTION FILEPATH HEADER === */
.filepath {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: var(--space-lg);
}
.filepath::before {
  content: "* ";
  color: var(--accent);
  font-weight: 700;
}

/* === 404 PAGE (rewrite — full ASCII terminal) === */
.page-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: var(--space-2xl);
  color: var(--text-1);
}

.page-404__ascii {
  font-family: var(--font-mono);
  font-size: clamp(8px, 1.5vw, 14px);
  line-height: 1.2;
  color: var(--accent);
  opacity: 0.3;
  margin-bottom: var(--space-xl);
  text-align: center;
}

.page-404__number {
  font-family: var(--font-display);
  font-size: clamp(100px, 25vw, 280px);
  font-weight: 900;
  color: var(--text-1);
  line-height: 1;
  position: relative;
  margin-bottom: var(--space-lg);
}
.page-404__number::before,
.page-404__number::after {
  content: "404";
  position: absolute;
  inset: 0;
}
.page-404__number::before {
  color: var(--error);
  animation: glitch1 3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}
.page-404__number::after {
  color: var(--accent);
  animation: glitch2 3s infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

.page-404__terminal {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-1);
  text-align: left;
  max-width: 500px;
  margin: 0 auto var(--space-xl);
  line-height: 1.8;
}
.page-404__terminal p {
  color: var(--text-2);
}
.page-404__terminal span {
  color: var(--accent);
}

.page-404__files {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}
.page-404__files a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity var(--dur);
}
.page-404__files a:hover {
  opacity: 0.7;
}

.page-404__links {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

/* Glitch keyframes (404) */
@keyframes glitch1 {
  0%,92%  { transform: translate(0); }
  93% { transform: translate(-4px,2px); }
  94% { transform: translate(4px,-2px); }
  95% { transform: translate(-2px,-1px); }
  96%,100% { transform: translate(0); }
}
@keyframes glitch2 {
  0%,94%  { transform: translate(0); }
  95% { transform: translate(3px,1px); }
  96% { transform: translate(-3px,-1px); }
  97% { transform: translate(2px,2px); }
  98%,100% { transform: translate(0); }
}

/* === SECTION DECORATION — for hero, portfolio, services, contact === */

/* Hero: ASCII texture in background */
.hero {
  position: relative;
}
.hero::before {
  content: "01001 10110 00101 11010 01101 10011 00110 11001 01010 10101 00011 11100 01111 10000 01001 10110 00101 11010 01101 10011 00110 11001 01010";
  position: absolute;
  top: 0; right: 0;
  width: 40%;
  height: 100%;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.8;
  color: var(--accent);
  opacity: 0.03;
  word-break: break-all;
  overflow: hidden;
  pointer-events: none;
  writing-mode: vertical-lr;
  letter-spacing: 0.5em;
}

/* Service cards: +++ markers */
.service-card::before {
  content: "+++";
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-3);
  opacity: 0.2;
  letter-spacing: 0.3em;
}

/* Section dividers */
.section + .section::before {
  content: "";
  display: block;
  height: 1px;
  background: repeating-linear-gradient(
    to right,
    var(--text-3) 0 4px,
    transparent 4px 12px
  );
  opacity: 0.15;
}

/* ============================================
   MOBILE OPTIMIZATION (375px — 900px)
   ============================================ */

/* Hero mobile */
@media (max-width: 640px) {
  .hero {
    padding-top: calc(60px + var(--space-lg));
    padding-bottom: var(--space-lg);
  }
  .hero__title {
    font-size: clamp(36px, 12vw, 60px);
  }
  .hero__title-line:nth-child(2) {
    padding-left: 10px;
  }
  .hero__subtitle {
    font-size: 12px;
  }
  .hero__desc {
    font-size: 14px;
  }
  .hero__actions {
    flex-direction: column;
    width: 100%;
  }
  .hero__actions .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .hero__scroll {
    display: none;
  }
  .hero__right {
    min-height: auto;
  }
}

/* Nav mobile */
@media (max-width: 640px) {
  .nav {
    padding: var(--space-sm) var(--space-md);
  }
  .nav__brand {
    display: none;
  }
  .nav__logo {
    font-size: 14px;
  }
}

/* Fullnav mobile */
@media (max-width: 640px) {
  .fullnav__content {
    padding: var(--space-2xl) var(--space-md);
  }
  .fullnav__link {
    font-size: clamp(28px, 8vw, 48px);
  }
  .fullnav__close {
    right: var(--space-md);
  }
}

/* Section headers mobile */
@media (max-width: 640px) {
  .h1 {
    font-size: clamp(24px, 7vw, 36px);
  }
  .h2 {
    font-size: clamp(20px, 5vw, 28px);
  }
  .section {
    padding-block: var(--space-2xl);
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Contact form mobile */
@media (max-width: 640px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* Brief form inline grids */
@media (max-width: 640px) {
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Legal section mobile */
@media (max-width: 768px) {
  #legal > .container > div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
  }
  #legal [style*="position: sticky"] {
    display: none;
  }
}

/* Services grid mobile tighter */
@media (max-width: 640px) {
  .services-grid {
    gap: 12px;
  }
  .service-card {
    padding: var(--space-md);
  }
}

/* Telemetry bar mobile */
@media (max-width: 640px) {
  .telemetry {
    font-size: 8px;
    gap: var(--space-md);
    padding: 8px var(--space-md);
  }
  .telemetry__center {
    font-size: 8px;
    padding: 4px 10px;
  }
}

/* Footer mobile */
@media (max-width: 640px) {
  .footer__cell {
    padding: var(--space-md);
  }
}

/* Buttons mobile */
@media (max-width: 640px) {
  .btn {
    font-size: 11px;
    padding: 12px 20px;
  }
}

/* Cards mobile */
@media (max-width: 640px) {
  .card__body {
    padding: var(--space-md);
  }
  .card__title {
    font-size: 16px;
  }
}

/* ASCII elements — hide on very small screens */
@media (max-width: 480px) {
  .ascii-bg { display: none; }
  .scanlines { display: none; }
  .halftone { display: none; }
  .markers::before,
  .markers::after { display: none; }
  .hero::before { display: none; }
  .filepath { font-size: 10px; }
}

/* Canvas performance on mobile — reduce size */
@media (max-width: 640px) {
  #asciiCanvas {
    max-width: 100%;
  }
  #asciiBook {
    display: none;
  }
}
