@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Bebas+Neue&family=Rajdhani:wght@500;700&display=swap');

/* ─── Variables ──────────────────────────────────────────── */
:root {
  --bg:        #07070f;
  --surface:   #0d0d1a;
  --neon:      #00ffe7;
  --neon2:     #ff2d6f;
  --neon3:     #c8ff00;
  --dim:       rgba(0, 255, 231, 0.12);
  --dim2:      rgba(255, 45, 111, 0.1);
  --text:      #c8d8e8;
  --text-dim:  #4a6070;
  --mono:      'Share Tech Mono', monospace;
  --display:   'Bebas Neue', sans-serif;
  --ui:        'Rajdhani', sans-serif;
  --border:    rgba(0, 255, 231, 0.25);
}

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

/* ─── Base ───────────────────────────────────────────────── */
html, body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  overflow-x: hidden;
  position: relative;
}

/* ─── Grid background ────────────────────────────────────── */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,255,231,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,231,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
  pointer-events: none;
}

/* Perspective grid at bottom */
.grid-bg::after {
  content: '';
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40%;
  background-image:
    linear-gradient(rgba(0,255,231,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,231,0.06) 1px, transparent 1px);
  background-size: 60px 30px;
  transform: perspective(400px) rotateX(60deg);
  transform-origin: bottom center;
  pointer-events: none;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
}

/* ─── Scanlines ──────────────────────────────────────────── */
.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  z-index: 100;
  pointer-events: none;
}

/* ─── Grain ──────────────────────────────────────────────── */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  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)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.35;
  z-index: 99;
  pointer-events: none;
  animation: grainMove 0.5s steps(1) infinite;
}

@keyframes grainMove {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, -3%); }
  40%  { transform: translate(3%, 2%); }
  60%  { transform: translate(-2%, 4%); }
  80%  { transform: translate(4%, -1%); }
  100% { transform: translate(0, 0); }
}

/* ─── Page layout ────────────────────────────────────────── */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vh, 4rem) clamp(1.5rem, 5vw, 5rem);
  gap: clamp(1.5rem, 4vh, 3rem);
}

/* ─── Header ─────────────────────────────────────────────── */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: fadeIn 0.6s ease both;
}

.header-line {
  font-family: var(--mono);
  font-size: clamp(0.6rem, 1.2vw, 0.8rem);
  color: var(--neon);
  opacity: 0.7;
  letter-spacing: 0.15em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.blink {
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ─── Title ──────────────────────────────────────────────── */
.site-title {
  font-family: var(--display);
  font-size: clamp(3.5rem, 12vw, 10rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
  text-align: center;
  user-select: none;
}

.title-los {
  color: #fff;
  text-shadow:
    0 0 20px rgba(255,255,255,0.4),
    0 0 60px rgba(255,255,255,0.1);
}

.title-denso {
  color: var(--neon);
  text-shadow:
    0 0 20px var(--neon),
    0 0 60px rgba(0,255,231,0.4),
    0 0 120px rgba(0,255,231,0.15);
}

.title-dot {
  color: var(--neon2);
  font-size: 0.6em;
  text-shadow:
    0 0 20px var(--neon2),
    0 0 60px rgba(255,45,111,0.4);
}

.subtitle {
  font-family: var(--mono);
  font-size: clamp(0.55rem, 1.1vw, 0.72rem);
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-top: 0.25rem;
}

/* ─── Cards grid ─────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.75rem, 2vw, 1.75rem);
  width: 100%;
  max-width: 1100px;
  animation: fadeIn 0.6s ease 0.2s both;
}

/* ─── Card ───────────────────────────────────────────────── */
.nav-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  aspect-ratio: 3 / 4;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  outline-offset: 4px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  clip-path: polygon(
    0 12px, 12px 0,
    calc(100% - 12px) 0, 100% 12px,
    100% calc(100% - 12px), calc(100% - 12px) 100%,
    12px 100%, 0 calc(100% - 12px)
  );
}

.nav-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--dim) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.nav-card:hover,
.nav-card:focus-visible {
  border-color: var(--neon);
  box-shadow:
    0 0 20px rgba(0,255,231,0.2),
    0 0 60px rgba(0,255,231,0.08),
    inset 0 0 30px rgba(0,255,231,0.04);
  outline: none;
}

.nav-card:hover::before { opacity: 1; }

.nav-card.featured {
  border-color: rgba(0,255,231,0.4);
  box-shadow: 0 0 30px rgba(0,255,231,0.1);
}

.nav-card:active {
  transform: scale(0.98);
  transition-duration: 0.06s;
}

/* Glitch effect */
.nav-card.glitching {
  animation: cardGlitch 0.35s steps(2) both;
}
@keyframes cardGlitch {
  0%   { transform: translate(0,0); filter: hue-rotate(0deg); }
  25%  { transform: translate(-2px, 1px); filter: hue-rotate(90deg); }
  50%  { transform: translate(2px, -1px); filter: hue-rotate(-90deg); }
  75%  { transform: translate(-1px, 2px); filter: hue-rotate(45deg); }
  100% { transform: translate(0,0); filter: hue-rotate(0deg); }
}

/* ─── Corner brackets ────────────────────────────────────── */
.card-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 3;
  transition: width 0.2s ease, height 0.2s ease, border-color 0.2s ease;
}
.card-corner.tl { top: 4px; left: 4px;  border-top: 1.5px solid var(--neon); border-left: 1.5px solid var(--neon); }
.card-corner.tr { top: 4px; right: 4px; border-top: 1.5px solid var(--neon); border-right: 1.5px solid var(--neon); }
.card-corner.bl { bottom: 4px; left: 4px;  border-bottom: 1.5px solid var(--neon); border-left: 1.5px solid var(--neon); }
.card-corner.br { bottom: 4px; right: 4px; border-bottom: 1.5px solid var(--neon); border-right: 1.5px solid var(--neon); }

.nav-card:hover .card-corner,
.nav-card:focus-visible .card-corner {
  width: 22px; height: 22px;
}

/* ─── Scan line animation ────────────────────────────────── */
.card-scan {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon), transparent);
  opacity: 0;
  z-index: 4;
  top: -2px;
  transition: opacity 0.1s;
}

.nav-card:hover .card-scan,
.nav-card:focus-visible .card-scan {
  opacity: 0.6;
  animation: scanDown 1.2s linear infinite;
}

@keyframes scanDown {
  0%   { top: -2px; }
  100% { top: 100%; }
}

/* ─── Card inner ─────────────────────────────────────────── */
.card-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 2vh, 1.25rem);
  flex: 1;
  padding: clamp(1.25rem, 4vh, 2.5rem) clamp(1rem, 3vw, 2rem);
}

/* ─── Card index ─────────────────────────────────────────── */
.card-index {
  position: absolute;
  top: 10px; right: 14px;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ─── Icon ───────────────────────────────────────────────── */
.card-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon {
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(0,255,231,0.4));
  pointer-events: none;
  user-select: none;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.nav-card:hover .card-icon {
  filter: drop-shadow(0 0 20px rgba(0,255,231,0.7));
  transform: scale(1.08);
}

.card-glow {
  position: absolute;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,255,231,0.15), transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-card:hover .card-glow { opacity: 1; }

/* ─── Card text ──────────────────────────────────────────── */
.card-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.card-label {
  font-family: var(--display);
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  color: #fff;
  letter-spacing: 0.08em;
  text-align: center;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.nav-card:hover .card-label {
  color: var(--neon);
  text-shadow: 0 0 20px var(--neon);
}

.card-desc {
  font-family: var(--mono);
  font-size: clamp(0.55rem, 1vw, 0.7rem);
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

/* ─── Bottom bar ─────────────────────────────────────────── */
.card-bar {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--neon), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
}

.nav-card:hover .card-bar { opacity: 0.8; }
.nav-card.featured .card-bar { opacity: 0.4; }

/* ─── Footer ─────────────────────────────────────────────── */
.footer {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--mono);
  font-size: clamp(0.55rem, 1vw, 0.7rem);
  color: var(--text-dim);
  letter-spacing: 0.12em;
  animation: fadeIn 0.6s ease 0.4s both;
}

.status-ok {
  color: var(--neon3);
  text-shadow: 0 0 8px var(--neon3);
}

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Tablet ─────────────────────────────────────────────── */
@media (min-width: 501px) and (max-width: 780px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav-card:last-child {
    grid-column: 1 / -1;
    max-width: 48%;
    margin: 0 auto;
    width: 100%;
  }
}

/* ─── Mobile ─────────────────────────────────────────────── */
@media (max-width: 500px) {
  .cards-grid {
    grid-template-columns: 1fr;
    max-width: 340px;
  }
  .nav-card {
    aspect-ratio: 5 / 2;
    clip-path: polygon(
      0 10px, 10px 0,
      calc(100% - 10px) 0, 100% 10px,
      100% calc(100% - 10px), calc(100% - 10px) 100%,
      10px 100%, 0 calc(100% - 10px)
    );
  }
  .card-inner {
    flex-direction: row;
    justify-content: flex-start;
    gap: 1rem;
  }
  .card-icon { font-size: clamp(2rem, 9vw, 3rem); flex-shrink: 0; }
  .card-text { align-items: flex-start; }
  .card-label { font-size: clamp(1.2rem, 5vw, 1.6rem); text-align: left; }
  .footer { gap: 0.75rem; }
}

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