:root {
  --bg-color: #02050a;
  --bg-layer: #050a10;
  --terminal-bg: #070c12;
  --terminal-border: #18222c;
  --terminal-border-bright: rgba(0, 255, 170, 0.28);
  --primary-color: #00ffaa;
  --primary-strong: #63ffd0;
  --text-main: #c2d0de;
  --text-soft: #8e9dae;
  --text-dim: #5c6672;
  --success: #6dc95f;
  --warning: #df8d4e;
  --danger: #ff6d6d;
  --font-mono: "Fira Code", "JetBrains Mono", monospace;
  --font-ui: "Space Grotesk", "Inter", sans-serif;
  --glow: 0 0 14px rgba(0, 255, 170, 0.45);
  --header-offset: 84px;
  --screen-gap: 1.3rem;
  --screen-inner-max: 1120px;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg-color);
  height: 100%;
}

body.cyber-theme {
  font-family: var(--font-mono);
  color: var(--text-main);
  background:
    radial-gradient(circle at 12% 10%, rgba(0, 255, 170, 0.09), transparent 36%),
    radial-gradient(circle at 90% 88%, rgba(0, 179, 255, 0.08), transparent 40%),
    var(--bg-color);
  line-height: 1.62;
  overflow: hidden;
  min-height: 100%;
}

body.intro-lock {
  overflow: hidden;
}

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

/* =========================================
   INTRO
   ========================================= */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  background: #000;
  display: grid;
  place-items: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.intro-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6) saturate(1.1);
  transition: opacity 0.7s ease;
  z-index: 1;
}

.intro-video-bg {
  position: absolute;
  inset: -3%;
  width: 106%;
  height: 106%;
  object-fit: cover;
  filter: blur(28px) brightness(0.4);
  transform: scale(1.06);
  opacity: 0;
  transition: opacity 0.7s ease;
  z-index: 0;
}

.intro-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 0%, rgba(0, 0, 0, 0.72) 100%);
  z-index: 2;
}

.intro-caption {
  position: absolute;
  bottom: 2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--primary-color);
  text-shadow: var(--glow);
  z-index: 4;
}

.intro-logo-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--intro-logo-size, clamp(260px, 52vw, 650px));
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.14);
  transition: opacity 0.62s ease, transform 0.62s ease;
  z-index: 4;
}

.intro-logo-stage img {
  width: 100%;
  filter: drop-shadow(0 0 40px rgba(0, 255, 170, 0.52));
}

.intro-screen.logo-phase .intro-video {
  opacity: 0.45;
}

.intro-screen.logo-phase .intro-video-bg {
  opacity: 0.72;
}

.intro-screen.logo-phase .intro-logo-stage {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.logo-flight {
  position: fixed;
  z-index: 10001;
  pointer-events: none;
  filter: drop-shadow(0 0 32px rgba(0, 255, 170, 0.48));
}

.intro-skip {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  border: 1px solid var(--primary-color);
  background: rgba(0, 0, 0, 0.5);
  color: var(--primary-color);
  border-radius: 50px;
  padding: 0.56rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 5;
  transition: all 0.3s ease;
}

.intro-skip:hover {
  background: var(--primary-color);
  color: #000;
  box-shadow: var(--glow);
}

/* =========================================
   MATRIX BACKGROUND
   ========================================= */
.site-matrix {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.14;
}

.matrix-canvas {
  width: 100%;
  height: 100%;
}

/* =========================================
   HEADER
   ========================================= */
.site-header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.7rem;
  background: rgba(3, 7, 11, 0.86);
  border-bottom: 1px solid var(--terminal-border);
  backdrop-filter: blur(6px);
  transition: transform 0.42s ease;
  transform: translateY(-100%);
}

body.intro-complete .site-header,
body.intro-logo-transfer .site-header {
  transform: translateY(0);
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand-logo-wrap {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.4s ease, transform 0.4s ease;
  margin-right: 0.75rem;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(0, 255, 170, 0.45));
}

body.intro-complete .brand-logo-wrap,
body.intro-logo-transfer .brand-logo-wrap {
  opacity: 1;
  transform: scale(1);
}

.prompt {
  color: var(--success);
  font-weight: 600;
  margin-right: 0.65rem;
}

.brand-text {
  color: var(--primary-color);
  font-weight: 700;
  text-shadow: var(--glow);
}

.menu {
  display: flex;
  gap: 1.25rem;
}

.menu a {
  font-size: 0.82rem;
  color: var(--text-soft);
  transition: color 0.25s ease;
}

.menu a:hover {
  color: var(--primary-color);
  text-shadow: var(--glow);
}

.menu a.is-active {
  color: var(--primary-color);
  text-shadow: var(--glow);
}

/* =========================================
   SCREEN HUD
   ========================================= */
.screen-hud {
  position: fixed;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 110;
  display: grid;
  gap: 0.46rem;
}

.screen-hud-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(194, 208, 222, 0.5);
  background: rgba(194, 208, 222, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
}

.screen-hud-btn:hover {
  border-color: var(--primary-color);
  box-shadow: var(--glow);
}

.screen-hud-btn.is-active {
  background: var(--primary-color);
  border-color: var(--primary-strong);
  box-shadow: var(--glow);
  transform: scale(1.12);
}

/* =========================================
   LAYOUT + TERMINAL
   ========================================= */
main {
  position: relative;
  z-index: 2;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 170, 0.4) rgba(7, 12, 18, 0.6);
}

.section.full-height {
  width: min(var(--screen-inner-max), 100%);
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--header-offset) + 1rem) 2rem var(--screen-gap);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  margin: 0 auto;
  opacity: 0.78;
  transform: scale(0.985);
  transition: transform 0.38s ease, opacity 0.38s ease;
}

.section.full-height.screen-active {
  opacity: 1;
  transform: scale(1);
}

.section.full-height > article {
  width: 100%;
  max-height: calc(100dvh - var(--header-offset) - 2.1rem);
}

.terminal-window,
.system-status {
  display: flex;
  flex-direction: column;
}

.terminal-body,
.system-status {
  overflow-y: auto;
}

.terminal-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 170, 0.4) rgba(7, 12, 18, 0.6);
}

.align-center {
  align-items: center;
}

.terminal-window {
  background: var(--terminal-bg);
  border: 1px solid var(--terminal-border);
  border-radius: 10px;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.9), inset 0 0 18px rgba(0, 255, 170, 0.03);
  width: 100%;
  overflow: hidden;
}

.highlight-window {
  border-color: var(--terminal-border-bright);
  box-shadow: 0 0 34px rgba(0, 255, 170, 0.11);
}

.terminal-header {
  background: #12161b;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--terminal-border);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red {
  background: #ff5f56;
}

.dot.yellow {
  background: #ffbd2e;
}

.dot.green {
  background: #27c93f;
}

.terminal-header .title {
  margin-left: auto;
  margin-right: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.terminal-body {
  padding: 2.2rem;
}

h1,
h2,
h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(1.5rem, 3vw, 2.7rem);
  color: var(--primary-color);
  line-height: 1.3;
}

h2 {
  font-size: clamp(1.2rem, 2.2vw, 1.76rem);
  color: var(--primary-color);
}

h3 {
  font-size: 1.08rem;
  color: #e3ecf5;
}

.sys-out {
  color: var(--text-soft);
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}

.success {
  color: var(--success);
}

.sys-tag {
  display: inline-block;
  background: rgba(223, 141, 78, 0.1);
  color: var(--warning);
  padding: 4px 10px;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  border: 1px solid rgba(223, 141, 78, 0.35);
}

.sys-output ul {
  list-style: none;
  color: var(--text-soft);
  margin-left: 1rem;
  margin-top: 0.5rem;
  line-height: 1.85;
}

.sys-output li::before {
  content: "> ";
  color: var(--primary-color);
}

/* =========================================
   BUTTONS
   ========================================= */
.terminal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.8rem;
  flex-wrap: wrap;
}

.justify-center {
  justify-content: center;
}

.btn-cli {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--text-dim);
  color: var(--text-main);
  padding: 0.72rem 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  transition: all 0.28s ease;
  cursor: pointer;
}

.btn-cli:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  text-shadow: var(--glow);
  box-shadow: inset 0 0 16px rgba(0, 255, 170, 0.15);
  transform: translateY(-2px);
}

.btn-cli.highlight {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-cli.highlight:hover {
  background: rgba(0, 255, 170, 0.09);
}

/* =========================================
   REUSABLE BLOCKS
   ========================================= */
.system-status {
  width: min(980px, 100%);
  border-left: 2px solid var(--primary-color);
  padding-left: 2rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
  margin-top: 1.7rem;
}

.kpi-box {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  font-size: 1.05rem;
}

.kpi-label {
  color: var(--text-dim);
}

.kpi-value {
  color: var(--primary-color);
  font-weight: 700;
  text-shadow: var(--glow);
}

.module-grid,
.architecture-grid,
.stack-grid,
.case-grid,
.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.timeline,
.process-grid {
  display: grid;
  gap: 0.95rem;
}

.module-item,
.arch-card,
.stack-card,
.case-card,
.timeline-item,
.process-step,
.faq-card,
.quick-contact {
  border: 1px dashed var(--terminal-border);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.015);
  transition: border-color 0.24s ease, transform 0.24s ease, background-color 0.24s ease;
}

.module-item:hover,
.arch-card:hover,
.stack-card:hover,
.case-card:hover,
.timeline-item:hover,
.process-step:hover,
.faq-card:hover,
.quick-contact:hover {
  border-color: var(--primary-color);
  background: rgba(0, 255, 170, 0.04);
  transform: translateY(-2px);
}

.module-meta,
.arch-meta,
.stack-meta,
.case-meta,
.timeline-meta,
.faq-meta {
  font-size: 0.76rem;
  color: var(--warning);
  margin-bottom: 0.45rem;
}

.module-title,
.arch-title,
.stack-title,
.case-title,
.timeline-title,
.process-title,
.faq-title {
  color: #f0f6ff;
  margin-bottom: 0.5rem;
}

.module-title::before,
.arch-title::before,
.stack-title::before,
.case-title::before,
.timeline-title::before,
.process-title::before,
.faq-title::before {
  content: "./";
  color: var(--primary-color);
  margin-right: 0.2rem;
}

.module-desc,
.arch-desc,
.stack-desc,
.case-desc,
.timeline-desc,
.process-desc,
.faq-desc {
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.97rem;
  line-height: 1.62;
}

.stack-tags {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.46rem;
}

.stack-tags span {
  display: inline-flex;
  border: 1px solid rgba(0, 255, 170, 0.32);
  color: var(--primary-strong);
  font-size: 0.72rem;
  padding: 0.2rem 0.44rem;
}

.case-link {
  margin-top: 0.7rem;
  display: inline-flex;
  color: var(--primary-color);
  font-size: 0.8rem;
}

/* =========================================
   CONTACT FORM
   ========================================= */
.contact-shell {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 1.2rem;
  align-items: start;
}

.quick-title {
  color: var(--primary-color);
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.quick-contact p {
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.quick-contact a {
  color: var(--primary-strong);
}

.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.form-field {
  display: grid;
  gap: 0.34rem;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-field span {
  color: var(--text-soft);
  font-size: 0.8rem;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--terminal-border);
  background: rgba(1, 8, 13, 0.85);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  padding: 0.62rem 0.7rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--primary-color);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 170, 0.28);
}

.form-field textarea {
  resize: vertical;
  min-height: 120px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
}

.form-status {
  color: var(--text-soft);
  font-size: 0.8rem;
}

.form-status[data-state="error"] {
  color: var(--danger);
}

.form-status[data-state="ok"] {
  color: var(--success);
}

/* =========================================
   REVEAL + TYPING
   ========================================= */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.cursor-blink {
  display: inline-block;
  width: 10px;
  height: 1.2em;
  background-color: var(--primary-color);
  vertical-align: bottom;
  animation: blink 1s step-end infinite;
}

.typing-cursor::after {
  content: "█";
  color: var(--primary-color);
  animation: blink 1s step-end infinite;
  margin-left: 5px;
}

.typewriter-inline {
  display: inline-block;
  min-height: 1em;
}

.fade-in-delayed {
  opacity: 0;
  animation: fadeIn 1.4s forwards 2.2s;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

[data-reveal] {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.85s ease, transform 0.85s ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================
   FOOTER
   ========================================= */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 92;
  text-align: center;
  padding: 0.38rem 1rem;
  color: var(--text-dim);
  border-top: 1px dashed rgba(24, 34, 44, 0.74);
  background: linear-gradient(0deg, rgba(2, 5, 10, 0.92), rgba(2, 5, 10, 0.55));
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.site-footer p {
  font-size: 0.7rem;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
  :root {
    --screen-inner-max: 980px;
  }

  .menu {
    gap: 0.9rem;
  }

  .menu a {
    font-size: 0.78rem;
  }

  .contact-shell {
    grid-template-columns: 1fr;
  }

  .screen-hud {
    right: 0.55rem;
  }
}

@media (max-width: 768px) {
  :root {
    --header-offset: 108px;
    --screen-gap: 1rem;
  }

  .site-header {
    padding: 0.82rem 0.9rem;
    gap: 0.6rem;
    flex-direction: column;
    align-items: stretch;
  }

  .menu {
    overflow-x: auto;
    white-space: nowrap;
    gap: 0.7rem;
    scrollbar-width: none;
  }

  .menu::-webkit-scrollbar {
    display: none;
  }

  .section.full-height {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(var(--header-offset) + 0.7rem) 0.8rem var(--screen-gap);
    margin-bottom: 0;
  }

  .section.full-height > article {
    max-height: calc(100dvh - var(--header-offset) - 1.8rem);
  }

  .terminal-body {
    padding: 1rem;
  }

  h1 {
    font-size: clamp(1.32rem, 7.5vw, 1.9rem);
  }

  h2 {
    font-size: clamp(1.08rem, 6vw, 1.42rem);
  }

  .kpi-grid,
  .module-grid,
  .architecture-grid,
  .stack-grid,
  .case-grid,
  .faq-grid,
  .contact-form {
    grid-template-columns: 1fr;
  }

  .screen-hud {
    top: auto;
    bottom: 0.82rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    grid-auto-flow: column;
    gap: 0.38rem;
    padding: 0.25rem 0.42rem;
    border: 1px solid rgba(24, 34, 44, 0.8);
    border-radius: 999px;
    background: rgba(3, 7, 11, 0.66);
    backdrop-filter: blur(4px);
  }

  .screen-hud-btn {
    width: 8px;
    height: 8px;
  }

  .site-footer {
    display: none;
  }

  .intro-caption {
    bottom: 1.2rem;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-align: center;
    width: calc(100% - 2rem);
  }

  .intro-skip {
    top: 0.8rem;
    right: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .intro-logo-stage {
    width: var(--intro-logo-size, clamp(220px, 78vw, 430px));
  }
}

@media (max-width: 768px) and (orientation: portrait) {
  .intro-video {
    object-fit: contain;
  }

  .intro-video-bg {
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  main {
    scroll-snap-type: y proximity;
    scroll-behavior: auto;
  }

  .section.full-height {
    transition: none;
  }
}
