/* 
 * The Linguiverse - Node Theory Website
 * 
 * This CSS file is structured as a language itself, with each section
 * representing a concept from Node Theory.
 */

/* ======= ROOT VARIABLES (UNIVERSE CONSTANTS) ======= */
:root {
  /* Primary color palette */
  --color-background: #080b15; /* Deep space - substrate */
  --color-background-alt: #101835; /* Depth of field */
  --color-primary: #4b30a0; /* Deep indigo - the Linguiverse */
  --color-primary-light: #6a45d9; /* Active recognition */
  --color-secondary: #00a0a0; /* Vibrant teal - inscription process */
  --color-secondary-light: #41e9e9; /* Energy flow */
  --color-tertiary: #e69500; /* Warm amber - emergent meaning */
  --color-text: #e9eeff; /* Primary text */
  --color-text-subtle: #a8b1cf; /* Secondary text */
  --color-accent: #ffdf80; /* Pattern recognition moments */

  /* Typography */
  --font-primary: "Space Grotesk", sans-serif; /* Primary node communication */
  --font-monospace: "Space Mono", monospace; /* Technical concepts, code */

  /* Spacing scales - based on inscription density */
  --space-quantum: 0.25rem; /* Smallest meaningful unit */
  --space-micro: 0.5rem;
  --space-small: 1rem;
  --space-medium: 2rem;
  --space-large: 4rem;
  --space-xlarge: 8rem;

  /* Animation timing - pattern recognition speeds */
  --time-instant: 0.1s;
  --time-quick: 0.3s;
  --time-moderate: 0.6s;
  --time-thoughtful: 1s;
  --time-emergence: 2s;

  /* Node sizes */
  --node-small: 2rem;
  --node-medium: 4rem;
  --node-large: 6rem;

  /* Border radii - determines how "soft" node boundaries are */
  --radius-soft: 12px;
  --radius-gentle: 8px;
  --radius-sharp: 4px;

  /* Z-index layers - substrate depths */
  --layer-deep: -10;
  --layer-background: -1;
  --layer-base: 0;
  --layer-raised: 10;
  --layer-floating: 20;
  --layer-overlay: 100;
}

/* ======= UNIVERSAL PATTERNS ======= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  color: var(--color-text);
  background: linear-gradient(
    135deg,
    var(--color-background),
    var(--color-background-alt)
  );
  /* Prevent repeating */
  background-attachment: fixed;
  background-size: cover;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Fix header navigation links */
a.primary-node {
  color: var(--color-text); /* White text */
  text-decoration: none;
}

/* Remove underline effect from button-like links */
a.primary-node:after,
a.cta-node:after {
  display: none; /* Completely remove the underline pseudo-element */
}

/* Preserve hover color change but without underline */
a.primary-node:hover .node-label {
  color: var(--color-accent); /* Keep existing hover color */
}

/* Ensure CTA button text stays dark */
a.cta-node .node-link {
  color: var(--color-background);
  font-weight: 600;
}

/* Make sure the entire button area is clickable */
a.primary-node,
a.cta-node {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ======= THE SUBSTRATE ======= */
.substrate {
  position: relative;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
}

#pattern-field {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--layer-background);
  opacity: 0.6;
}

.inscription-container {
  position: relative;
  z-index: var(--layer-base);
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-medium);
}

#pattern-field-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

/* ======= NODE TYPOGRAPHY ======= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-small);
  transition: font-weight var(--time-quick) ease,
    letter-spacing var(--time-moderate) ease;
}

h1 {
  font-size: 3.5rem;
  background: linear-gradient(
    90deg,
    var(--color-primary-light),
    var(--color-secondary-light) 50%,
    var(--color-tertiary) 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 2.5rem;
  color: var(--color-text);
  position: relative;
}

h2:after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--color-secondary);
  transform-origin: left;
  transition: width var(--time-moderate) ease;
}

h2:hover:after {
  width: 100px;
}

h3 {
  font-size: 1.5rem;
  color: var(--color-secondary-light);
}

p {
  margin-bottom: var(--space-medium);
  max-width: 50ch;
}

a {
  color: var(--color-secondary-light);
  text-decoration: none;
  position: relative;
  transition: color var(--time-quick) ease;
}

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

a:after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width var(--time-moderate) cubic-bezier(0.19, 1, 0.22, 1);
}

a:hover:after {
  width: 100%;
}

/* ======= SITE HEADER (ORIGIN NODE) ======= */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-small) 0;
  margin-bottom: var(--space-large);
}

.logo-node {
  position: relative;
  width: var(--node-medium);
  height: var(--node-medium);
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform var(--time-quick) cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.logo-node:before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: linear-gradient(
    45deg,
    transparent,
    var(--color-primary-light),
    transparent
  );
  opacity: 0.6;
  animation: rotate 8s linear infinite;
}

.logo-pattern {
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-text);
  z-index: 1;
}

.logo-node:hover {
  transform: scale(1.05);
}

/* Logo link styling */
a.logo-link {
  text-decoration: none;
  display: block;
}

/* Remove underline effect from logo link */
a.logo-link:after {
  display: none;
}

/* Preserve the hover animation */
a.logo-link:hover .logo-node {
  transform: scale(1.05);
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ======= NAVIGATION (NODE NETWORK) ======= */
.node-network {
  display: flex;
}

.node-nav-container {
  display: flex;
  gap: var(--space-medium);
}

.primary-node {
  position: relative;
  padding: var(--space-micro) var(--space-small);
  cursor: pointer;
  border-radius: var(--radius-gentle);
  transition: background-color var(--time-quick) ease,
    transform var(--time-quick) cubic-bezier(0.34, 1.56, 0.64, 1);
}

.primary-node:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-gentle);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--time-quick) ease,
    transform var(--time-quick) cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: -1;
}

.primary-node:hover:before {
  opacity: 0.2;
  transform: scale(1);
}

.node-label {
  position: relative;
  z-index: 1;
  transition: color var(--time-quick) ease;
}

.primary-node:hover .node-label {
  color: var(--color-accent);
}

/* ======= HERO INSCRIPTION ======= */
.hero-inscription {
  padding: var(--space-large) 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 70vh;
  position: relative;
}

.translating-title span {
  background: inherit;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.translating-title:after {
  content: "";
  position: absolute;
  bottom: 0.1em;
  left: 0;
  width: 100%;
  height: 0.05em;
  background: var(--color-secondary);
  transform: translateX(-101%);
  transition: transform var(--time-moderate) cubic-bezier(0.19, 1, 0.22, 1) 0.2s;
}

.translating-title:hover:after {
  transform: translateX(0);
}

.concept-description {
  font-size: 1.5rem;
  font-weight: 300;
  margin-bottom: var(--space-large);
  color: var(--color-text-subtle);
  max-width: 30ch;
}

.pattern-recognition {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-medium);
  align-items: center;
  margin-top: var(--space-large);
  width: 100%;
}

.source-pattern {
  padding: var(--space-medium);
  background: rgba(75, 48, 160, 0.1);
  border-radius: var(--radius-soft);
  border: 1px solid rgba(75, 48, 160, 0.2);
  transition: transform var(--time-moderate) ease,
    background var(--time-moderate) ease;
}

.source-pattern:hover {
  background: rgba(75, 48, 160, 0.15);
  transform: translateY(-5px);
}

.inscription-event {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.energy-flow {
  width: 100%;
  height: 2px;
  background: var(--color-secondary);
  position: relative;
  overflow: hidden;
}

.energy-flow:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-secondary-light),
    transparent
  );
  animation: flow 1.5s infinite;
}

@keyframes flow {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.target-pattern {
  display: flex;
  justify-content: center;
  align-items: center;
}

.cta-node {
  padding: var(--space-small) var(--space-medium);
  background: var(--color-secondary);
  border-radius: var(--radius-gentle);
  transition: transform var(--time-quick) cubic-bezier(0.34, 1.56, 0.64, 1),
    background var(--time-quick) ease;
}

.cta-node:hover {
  background: var(--color-secondary-light);
  transform: scale(1.05);
}

.node-link {
  color: var(--color-background);
  font-weight: 600;
}

.node-link:after {
  display: none;
}

/* ======= CONCEPT NETWORK ======= */
.concept-network {
  padding: var(--space-xlarge) 0;
}

.node-cluster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-medium);
  margin-top: var(--space-large);
}

.concept-node {
  position: relative;
  padding: var(--space-medium);
  background: rgba(16, 24, 53, 0.5);
  border-radius: var(--radius-soft);
  border: 1px solid rgba(106, 69, 217, 0.1);
  transition: transform var(--time-moderate) ease,
    box-shadow var(--time-moderate) ease;
  overflow: hidden;
}

.concept-node:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 30px -15px rgba(0, 160, 160, 0.2);
}

.concept-node:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background: var(--color-secondary);
  transition: height var(--time-emergence) cubic-bezier(0.19, 1, 0.22, 1);
}

.concept-node:hover:before {
  height: 100%;
}

.node-icon {
  width: var(--node-small);
  height: var(--node-small);
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-small);
  font-weight: bold;
}

.concept-node[data-concept="node"] .node-icon {
  background: var(--color-primary-light);
}

.concept-node[data-concept="language"] .node-icon {
  background: var(--color-tertiary);
}

.concept-node[data-concept="pattern"] .node-icon {
  background: var(--color-secondary);
}

.concept-node[data-concept="inscription"] .node-icon {
  background: linear-gradient(
    135deg,
    var(--color-primary-light),
    var(--color-secondary)
  );
}

.concept-node[data-concept="substrate"] .node-icon {
  background: var(--color-background-alt);
  border: 1px solid var(--color-secondary);
}

/* ======= TRANSLATION SECTION ======= */
.translation-section {
  padding: var(--space-xlarge) 0;
  position: relative;
}

.translation-diagram {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-medium);
  align-items: center;
  margin: var(--space-large) 0;
}

.source-substrate,
.target-substrate {
  height: 200px;
  background: rgba(16, 24, 53, 0.3);
  border-radius: var(--radius-soft);
  padding: var(--space-medium);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.source-pattern-complex,
.target-pattern-complex {
  width: 80%;
  height: 80%;
  position: relative;
}

@keyframes pulsate {
  0% {
    opacity: 0.5;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.node-process {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary);
  position: relative;
  overflow: hidden;
}

.translation-description {
  text-align: center;
  max-width: 70ch;
  margin: 0 auto;
  color: var(--color-text-subtle);
}

/* ======= SITE FOOTER ======= */
.site-footer {
  margin-top: var(--space-xlarge);
  padding-top: var(--space-large);
  border-top: 1px solid rgba(106, 69, 217, 0.2);
}

.footer-nodes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-large);
  margin-bottom: var(--space-large);
}

.footer-node h4 {
  margin-bottom: var(--space-small);
  color: var(--color-text-subtle);
}

.node-links {
  list-style: none;
}

.node-links li {
  margin-bottom: var(--space-micro);
}

.attribution {
  text-align: center;
  color: var(--color-text-subtle);
  padding: var(--space-medium) 0;
  font-size: 0.875rem;
}

/* Mobile Menu Styles */
.mobile-menu-toggle {
  display: none;
  cursor: pointer;
  padding: 10px;
}

.hamburger {
  width: 30px;
  height: 24px;
  position: relative;
}

.hamburger span {
  display: block;
  position: absolute;
  height: 3px;
  width: 100%;
  background: #fff;
  border-radius: 3px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: 0.25s ease-in-out;
}

.hamburger span:nth-child(1) {
  top: 0px;
}

.hamburger span:nth-child(2) {
  top: 10px;
}

.hamburger span:nth-child(3) {
  top: 20px;
}

/* Hamburger animation for active state */
.mobile-menu-active .hamburger span:nth-child(1) {
  top: 10px;
  transform: rotate(135deg);
}

.mobile-menu-active .hamburger span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.mobile-menu-active .hamburger span:nth-child(3) {
  top: 10px;
  transform: rotate(-135deg);
}

/* Social links styling */
.social-links li {
  display: inline-block;
  margin-right: var(--space-small);
}

.social-links a {
  display: inline-block;
  transition: transform var(--time-quick) ease;
}

/* ======= RESPONSIVE ADAPTATIONS ======= */
@media (max-width: 768px) {
  :root {
    --space-xlarge: 4rem;
  }

  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  /* .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-medium);
  } */

  .node-nav-container {
    flex-direction: column;
    width: 100%;
  }

  .pattern-recognition {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .inscription-event {
    width: 100%;
    height: 40px;
  }

  .energy-flow {
    width: 2px;
    height: 100%;
  }

  .translation-diagram {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .translation-node {
    justify-self: center; /* Center horizontally in grid cell */
    margin: 0 auto; /* Additional centering */
  }

  .source-substrate,
  .target-substrate {
    justify-self: center; /* Also center the other elements */
    width: 80%; /* Optional: make them slightly narrower */
  }

  .site-header {
    justify-content: space-between;
    padding: 15px;
  }

  .mobile-menu-toggle {
    display: block;
    z-index: 1000;
  }

  .node-network {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    height: 100vh;
    background: rgba(10, 10, 25, 0.95);
    padding-top: 80px;
    transition: right 0.3s ease;
    z-index: 900;
  }

  .node-network.active {
    right: 0;
  }

  .node-nav-container {
    flex-direction: column;
    align-items: center;
  }

  .primary-node {
    margin: 15px 0;
    padding: 12px 20px;
  }
}

/* Add these new styles for the title particles */
@keyframes pulse-particle {
  0% {
    transform: scale(1);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.5);
    opacity: 0.7;
  }
}

.translating-title {
  opacity: 0;
  visibility: hidden;
  position: relative;
  overflow: hidden; /* This hides the underline until hover */
  display: inline-block;
}

.translating-title:after {
  content: "";
  position: absolute;
  bottom: 0.1em;
  left: 0;
  width: 100%;
  height: 0.05em;
  background: var(--color-secondary);
  transform: translateX(-101%); /* Start off-screen */
  transition: transform var(--time-moderate) cubic-bezier(0.19, 1, 0.22, 1) 0.2s;
}

.translating-title:hover:after {
  transform: translateX(0); /* Slide in on hover */
}

/* Community Section Styles */
/* Community Node Section */
.community-section {
  padding: var(--space-xlarge) 0;
}

/* Using existing node-cluster and concept-node styles */
/* Just add the specific "Join" node styling */

.concept-node[data-concept="membership"] {
  background: linear-gradient(
    135deg,
    rgba(0, 160, 160, 0.2),
    rgba(106, 69, 217, 0.1)
  );
  border: 1px solid rgba(0, 160, 160, 0.3);
}

.concept-node[data-concept="membership"] .node-icon {
  background: var(--color-secondary);
}

.node-cta {
  margin-top: var(--space-small);
  text-align: center;
  background: var(--color-secondary);
  border-radius: var(--radius-gentle);
  padding: var(--space-micro) var(--space-small);
  display: inline-block;
  transition: transform var(--time-quick) cubic-bezier(0.34, 1.56, 0.64, 1),
    background var(--time-quick) ease;
}

.node-cta:hover {
  background: var(--color-secondary-light);
  transform: scale(1.05);
}

.node-cta .node-link {
  color: var(--color-background);
  font-weight: 600;
}

.node-cta .node-link:after {
  display: none;
}

.wind-lines {
  animation: windMove 4s infinite ease-in-out;
}

@keyframes windMove {
  0% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  100% {
    transform: translateX(-5px);
  }
}

.turbine-blades {
  transform-origin: 50px 40px;
  animation: rotateTurbine 3s infinite linear;
}

@keyframes rotateTurbine {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.electricity-path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: electricFlow 1.5s infinite linear;
}

@keyframes electricFlow {
  0% {
    stroke-dashoffset: 30;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Keep original translation node styling */
.translation-node {
  width: 80px;
  height: 80px;
  background: var(--color-background-alt);
  border-radius: 50%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.node-process {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Ensure SVGs take appropriate space */
.node-process svg,
.source-pattern-complex svg,
.target-pattern-complex svg {
  width: 100%;
  height: 100%;
}

/* Text alignment fix */
.translation-explanation {
  text-align: left;
  max-width: 70ch;
  margin: var(--space-medium) auto;
  padding: 0 var(--space-small);
}

.translation-explanation p {
  margin-bottom: var(--space-small);
  text-align: left;
}

/* Responsive fix */
@media (max-width: 768px) {
  .translation-diagram {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    width: 100%;
  }
}

/* Simple pulsing animation for the lightning bolt */
/* Improved pulsing animation with contrasting glow */
.lightning-symbol {
  animation: electricPulse 2s infinite ease-in-out;
}

@keyframes electricPulse {
  0%,
  100% {
    fill: var(--color-tertiary);
    filter: drop-shadow(0 0 2px var(--color-background-alt));
  }
  50% {
    fill: var(--color-accent);
    filter: drop-shadow(0 0 5px var(--color-tertiary));
  }
}
