@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans+Condensed:wght@600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
  --background: 220 20% 4%;
  --foreground: 160 100% 95%;
  --card: 220 20% 7%;
  --primary: 160 100% 50%;
  --primary-foreground: 220 20% 4%;
  --secondary: 220 15% 12%;
  --muted-foreground: 220 10% 55%;
  --accent: 180 100% 50%;
  --border: 160 50% 20%;
  --grid-color: 160 50% 15%;
}

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

* {
  border-color: hsl(var(--border));
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.font-display {
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.font-mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.page {
  position: relative;
  min-height: 100vh;
  background: hsl(var(--background));
}

.cyber-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(hsl(var(--grid-color) / 0.3) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--grid-color) / 0.3) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.3;
  pointer-events: none;
}

.orb-tl {
  position: fixed;
  top: 0;
  left: 25%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: hsl(var(--primary) / 0.05);
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.orb-br {
  position: fixed;
  bottom: 0;
  right: 25%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: hsl(var(--accent) / 0.05);
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    transparent 45%,
    hsl(var(--background) / 0.8) 100%
  );
}

.scanline {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.03;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    hsl(var(--primary) / 0.1) 2px,
    hsl(var(--primary) / 0.1) 4px
  );
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

main {
  position: relative;
  z-index: 10;
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1rem 4rem;
}

@media (min-width: 640px) {
  main {
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
}

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

.mb-12 {
  margin-bottom: 3rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-16 {
  margin-top: 4rem;
}

.header-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.ring-spin {
  position: absolute;
  width: 8rem;
  height: 8rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--primary) / 0.3);
  animation: spin 20s linear infinite;
}

.ring-spin-dot {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0.5rem;
  height: 0.5rem;
  background: hsl(var(--primary));
  border-radius: 9999px;
  transform: translate(-50%, -50%);
}

.ring-ping {
  position: absolute;
  width: 7rem;
  height: 7rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--primary) / 0.2);
  animation: ping 3s ease-in-out infinite;
}

.ring-glow {
  position: absolute;
  width: 6rem;
  height: 6rem;
  border-radius: 1rem;
  background: linear-gradient(
    to bottom right,
    hsl(var(--primary) / 0.2),
    hsl(var(--primary) / 0.05),
    transparent
  );
  filter: blur(16px);
}

.icon-box {
  position: relative;
  width: 6rem;
  height: 6rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    to bottom right,
    hsl(var(--card)),
    hsl(var(--card)),
    hsl(var(--secondary) / 0.5)
  );
  border: 1px solid hsl(var(--primary) / 0.3);
  box-shadow:
    0 0 30px hsl(var(--primary) / 0.2),
    inset 0 1px 1px hsl(var(--primary) / 0.1);
}

.icon-corner {
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  --icon-corner-stroke: hsl(var(--primary) / 0.65);
}

.icon-corner-tl {
  top: 0;
  left: 0;
  border-top: 2px solid var(--icon-corner-stroke);
  border-left: 2px solid var(--icon-corner-stroke);
  border-radius: 0.5rem 0 0 0;
}

.icon-corner-tr {
  top: 0;
  right: 0;
  border-top: 2px solid var(--icon-corner-stroke);
  border-right: 2px solid var(--icon-corner-stroke);
  border-radius: 0 0.5rem 0 0;
}

.icon-corner-bl {
  bottom: 0;
  left: 0;
  border-bottom: 2px solid var(--icon-corner-stroke);
  border-left: 2px solid var(--icon-corner-stroke);
  border-radius: 0 0 0 0.5rem;
}

.icon-corner-br {
  bottom: 0;
  right: 0;
  border-bottom: 2px solid var(--icon-corner-stroke);
  border-right: 2px solid var(--icon-corner-stroke);
  border-radius: 0 0 0.5rem 0;
}

.shield-main {
  width: 3rem;
  height: 3rem;
  color: hsl(var(--primary));
  filter: drop-shadow(0 0 8px hsl(var(--primary) / 0.8));
}

.title-main {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 0.5rem;
  color: hsl(var(--primary));
  text-shadow:
    0 0 20px hsl(var(--primary) / 0.45),
    0 0 2px hsl(var(--primary) / 0.25);
}

@media (min-width: 640px) {
  .title-main {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
}

.tagline {
  margin: 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.05em;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-family: "IBM Plex Mono", monospace;
}

.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: hsl(var(--primary));
  animation: pulse 2s ease-in-out infinite;
}

.stack-gap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.main-links-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.main-links-grid > * {
  min-width: 0;
}

@media (min-width: 640px) {
  .main-links-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0;
  font-size: 0.875rem;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: hsl(var(--primary) / 0.8);
}

.section-title::before,
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    hsl(var(--primary) / 0.3),
    transparent
  );
}

.section-title span {
  padding: 0 1rem;
  white-space: nowrap;
}

.link-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--card) / 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease;
  text-decoration: none;
  color: inherit;
}

.link-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.1), transparent);
  pointer-events: none;
}

.link-card:hover {
  border-color: hsl(var(--primary) / 0.5);
  box-shadow: 0 0 30px hsl(160 100% 50% / 0.2);
  transform: translateY(-2px);
}

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

.link-card__icon {
  position: relative;
  z-index: 1;
  display: flex;
  height: 2.5rem;
  width: 2.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  transition:
    background 0.3s,
    transform 0.3s;
}

.link-card:hover .link-card__icon {
  background: hsl(var(--primary) / 0.2);
  transform: scale(1.1);
}

.link-card__icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.bsky-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

.shield-main,
.shield-main svg {
  width: 3rem;
  height: 3rem;
}

.link-card__body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

.link-card__title {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

.link-card:hover .link-card__title {
  color: hsl(var(--primary));
}

.link-card__desc {
  margin: 0.125rem 0 0;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "IBM Plex Mono", monospace;
}

.link-card__arrow {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  color: hsl(var(--muted-foreground));
  opacity: 0;
  transition:
    opacity 0.3s,
    color 0.3s;
}

.link-card:hover .link-card__arrow {
  opacity: 1;
  color: hsl(var(--primary));
}

.animate-fade-in {
  animation: fade-in 0.5s ease-out forwards;
  opacity: 0;
}

.footer-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-family: "IBM Plex Mono", monospace;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border) / 0.3);
  background: hsl(var(--card) / 0.5);
}

.footer-pill svg {
  width: 0.75rem;
  height: 0.75rem;
  color: hsl(var(--primary));
}

.footer-sep {
  color: hsl(var(--primary));
}

.typing-prefix {
  color: hsl(var(--primary));
}

.typing-cursor {
  color: hsl(var(--primary));
  transition: opacity 0.2s;
}

.typing-cursor.is-off {
  opacity: 0;
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ping {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.15;
  }
}

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

/* --- 404 page --- */
.page-404 main {
  max-width: 36rem;
}

.error-code {
  margin: 0 0 0.5rem;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  font-size: clamp(4rem, 18vw, 7rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--accent)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px hsl(var(--primary) / 0.25);
}

.error-title {
  margin: 0 0 1rem;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.error-desc {
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
}

.error-meta {
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border) / 0.4);
  background: hsl(var(--card) / 0.5);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  word-break: break-all;
}

.error-meta strong {
  color: hsl(var(--primary) / 0.9);
  font-weight: 600;
}

.link-card.is-internal:hover {
  transform: translateY(-2px);
}

a.link-card.is-internal {
  cursor: pointer;
}

.link-card.is-internal .link-card__arrow {
  opacity: 0.65;
}

.link-card.is-internal:hover .link-card__arrow {
  opacity: 1;
  color: hsl(var(--primary));
}
