:root {
  --bg-color: #050505;
  --text-color: #e0e0e0;
  --accent-color: #ffffff;
  --glitch-color-1: #ff0000;
  --font-heading: 'Chakra Petch', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-heading);
  overflow: hidden;
  line-height: 1.6;
}

.red-smoke {
  position: fixed;
  top: -20%;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center top,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(140, 0, 0, 0.28) 22%,
      rgba(0, 0, 0, 0) 70%);
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent-color);
  letter-spacing: 4px;
  font-size: 1.5rem;
  text-shadow: 2px 2px 0px #1a1a1a;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
}

nav a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s ease;
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: 2px;
}

nav a:hover,
nav a.active {
  color: var(--glitch-color-1);
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.6);
}

main {
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.page {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  overflow: hidden;
  /* Prevent ANY scroll by default on pages */
}

/* Allow scroll specifically on CTF page */
.page.ctf-page {
  overflow-y: hidden;
  /* Handle overflow internally in .ctf-copy or as needed */
}

.page.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hero {
  overflow: hidden;
  /* Double ensure hero is not scrollable */
}

.hero,
#achievements,
#terminal-modal {
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

body.view-achievements .hero,
body.view-achievements #terminal-modal:not(.visible) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.view-achievements .nav-arrows {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nav-arrows {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}



.arrow-btn img {
  width: 16px;
  height: 16px;
  filter: invert(1) drop-shadow(0 0 6px rgba(255, 0, 0, 0.4));
}

.arrow-btn.prev {
  position: absolute;
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
}

.arrow-btn.next {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
}

.arrow-btn:hover {
  transform: translateY(-50%);
  box-shadow: 0 0 24px rgba(255, 0, 0, 0.6);
  border-color: var(--glitch-color-1);
}

.arrow-btn:active {
  transform: translateY(-50%) scale(0.93);
}

.arrow-btn.disabled {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  border-color: transparent;
  box-shadow: none;
}

.hero {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6% 0 0;
  gap: 4%;
}

.ctf-page {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 6% 4rem;
  overflow: hidden;
  overflow-x: hidden;
}

.ctf-copy {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.5rem;
}

.ctf-copy::-webkit-scrollbar {
  width: 6px;
}

.ctf-copy::-webkit-scrollbar-thumb {
  background: rgba(255, 0, 0, 0.35);
  border-radius: 8px;
}

.achievements-carousel-wrapper {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctf-title {
  font-size: 4.5rem;
  letter-spacing: 4px;
  text-align: center;
}

.achievements-hint {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.hint-arrow {
  color: var(--glitch-color-1);
  font-size: 1.4rem;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.35);
}

.hint-text {
  font-size: 0.85rem;
}

/* Carousel 3D Styles - Hexagonal Gallery */
.achievements-carousel-wrapper {
  position: relative;
  width: 100%;
  height: 70vh;
  /* Increased height for full view */
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1400px;
  /* Deep perspective */
  margin: 0;
  overflow: visible;
}

.achievements-carousel {
  position: relative;
  width: min(1000px, 96vw);
  height: 560px;
  --card-width: 760px;
  --card-height: 480px;
  --card-gap: 120px;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.achievement-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--card-width);
  height: var(--card-height);
  transform: translate(-50%, -50%) scale(0.72);

  background: rgba(10, 10, 10, 0.9);
  border: 1px solid rgba(255, 0, 0, 0.2);
  border-radius: 12px;
  padding: 2.5rem;
  display: flex;
  align-items: center;
  gap: 3rem;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);

  opacity: 0;
  pointer-events: none;
  transition: transform 0.6s ease, opacity 0.6s ease, box-shadow 0.6s ease;

  /* Internal Flex Layout */
  flex-direction: row !important;
  text-align: left !important;
  backface-visibility: hidden;
  /* Hide back of cards */
}

/* Center and side positions */
.achievement-card.is-center {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  box-shadow: 0 0 80px rgba(255, 0, 0, 0.3);
  border-color: var(--glitch-color-1);
  z-index: 3;
}

.achievement-card.is-left,
.achievement-card.is-right {
  opacity: 0.45;
  pointer-events: none;
  filter: saturate(0.8);
  z-index: 2;
}

.achievement-card.is-left {
  transform: translate(-50%, -50%) translateX(calc(-1 * (var(--card-width) * 0.68 + var(--card-gap)))) scale(0.78) rotateY(18deg);
}

.achievement-card.is-right {
  transform: translate(-50%, -50%) translateX(calc(var(--card-width) * 0.68 + var(--card-gap))) scale(0.78) rotateY(-18deg);
}

.achievement-card.is-left-far,
.achievement-card.is-right-far {
  opacity: 0.2;
  pointer-events: none;
  z-index: 1;
}

.achievement-card.is-left-far {
  transform: translate(-50%, -50%) translateX(calc(-1 * (var(--card-width) * 1.12 + var(--card-gap)))) scale(0.64) rotateY(24deg);
}

.achievement-card.is-right-far {
  transform: translate(-50%, -50%) translateX(calc(var(--card-width) * 1.12 + var(--card-gap))) scale(0.64) rotateY(-24deg);
}

.achievement-card.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.72);
  z-index: 0;
}


.achievement-card .ach-image {
  order: 1 !important;
  height: 300px;
  flex: 1;
}

.achievement-card .ach-content {
  order: 2 !important;
  text-align: left !important;
}

.achievement-card:nth-child(even) {
  flex-direction: row-reverse !important;
}

.achievement-card:nth-child(even) .ach-content {
  text-align: left !important;
}

/* Mobile Adjustments */
@media (max-width: 1000px) {
  .achievements-carousel-wrapper {
    perspective: 1000px;
    height: 70vh;
  }

  .achievements-carousel {
    width: 90vw;
    height: 60vh;
    --card-width: 82vw;
    --card-height: 52vh;
  }

  .achievement-card {
    width: 85vw;
    height: auto;
    transform: translate(-50%, -50%) scale(0.9);
    flex-direction: column !important;
    padding: 1.5rem;
  }

  .achievement-card .ach-image {
    order: unset !important;
    height: 200px;
  }

  .achievement-card .ach-content {
    order: unset !important;
    text-align: center !important;
  }

}

.ach-image {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.ach-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.12), rgba(0, 0, 0, 0.6));
}

.ach-image img.ach-image-large {
  max-width: 110%;
  max-height: 110%;
}


.ach-content h3 {
  font-size: 2rem;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.ach-content {
  flex: 1.2;
  text-align: left;
}

.ach-meta {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 3px;
  color: #ff4d4d;
  margin-bottom: 0.8rem;
}

.ach-content p {
  font-family: var(--font-mono);
  color: #e5e5e5;
  line-height: 1.7;
  font-size: 1.05rem;
}

.badges-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 3rem;
  width: 100%;
  flex-wrap: wrap;
}

.badge-item {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.3s ease;
  border: none;
  background: transparent;
}

.badge-item:hover {
  transform: translateY(-5px);
}

.thm-badge {
  width: 450px;
  height: 150px;
}

.hero-image {
  width: 60%;
  height: 100%;
  margin-left: 0;
  overflow: hidden;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 45% 20%;
  opacity: 0.7;
  filter: grayscale(25%) contrast(1.1) brightness(0.85) blur(1px);
  mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 97%);
  -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 97%);
  transform: translateX(-6%) scale(1.05);
  animation: image-slide-in 1.6s ease-out forwards;
  will-change: transform;
}

@keyframes image-slide-in {
  from {
    transform: translateX(-22%) scale(1.05);
  }

  to {
    transform: translateX(0) scale(1.05);
  }
}

.hero-content {
  width: 41%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 6vh;
}

.hero-title {
  font-size: 9rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #ffffff;
  position: relative;
  display: inline-block;
  white-space: nowrap;
  letter-spacing: 4px;
  line-height: 1;
  text-shadow: 6px 6px 0px #000000;
  margin-top: 0;
  margin-bottom: 0;
  z-index: 1;
}

.subtitle {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  letter-spacing: 8px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  margin-top: 0.25rem;
  text-transform: uppercase;
}

.hero-description {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: #f0f0f0;
  width: 100%;
  margin-top: 2rem;
  line-height: 1.6;
  text-align: justify;
  background: rgba(0, 0, 0, 0.7);
  padding: 1.5rem;
  border-left: 2px solid var(--glitch-color-1);
  border-right: 2px solid var(--glitch-color-1);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  will-change: opacity, transform;
}

.hero-description.visible {
  opacity: 1;
  transform: translateY(0);
}

.word-fly {
  display: inline-block;
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.6s ease,
    filter 0.6s ease;
  will-change: transform, opacity, filter;
}

.word-fly.assembled {
  opacity: 1;
  transform: translate(0, 0) rotate(0deg) !important;
  filter: blur(0) !important;
}

.fall-target {
  opacity: 0;
  transform: translateY(-120px);
  transition: transform 0.6s ease, opacity 0.6s ease;
  will-change: transform, opacity;
}

.fall-target.fall-in {
  opacity: 1;
  transform: translateY(0);
}

.typing-mask {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  clip-path: inset(0 100% 0 0);
  position: relative;
  animation: typing-reveal var(--typing-duration, 0.85s) steps(var(--typing-steps, 18)) forwards;
  animation-delay: var(--typing-delay, 0s);
  animation-play-state: paused;
}

.typing-mask::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 6px;
  background: var(--accent-color);
  vertical-align: -0.08em;
  animation: caret-blink 0.9s steps(1) infinite;
}

.typing-mask.typing-done::after {
  opacity: 0;
  animation: none;
}

.typing-mask.typing-start {
  animation-play-state: running;
}

.subtitle-mask {
  --typing-duration: 0.9s;
  --typing-steps: 18;
  --typing-delay: 0.05s;
}

@keyframes typing-reveal {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes caret-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

@media (max-width: 900px) {
  header {
    padding: 1.5rem;
    flex-direction: column;
    gap: 1rem;
  }

  .hero {
    flex-direction: column;
    justify-content: flex-start;
    padding: 8rem 8% 2rem;
  }

  .hero-image {
    width: 100%;
    height: 45vh;
    margin-left: 0;
  }

  .hero-content {
    width: 100%;
    padding-top: 2rem;
  }

  .hero-title {
    font-size: 3.8rem;
  }

  .subtitle {
    font-size: 1.1rem;
    letter-spacing: 6px;
  }

  .ctf-page {
    padding: 8rem 8% 3rem;
  }

  .achievements-carousel {
    padding: 1rem 0.5rem;
    min-height: 520px;
  }

  .achievement-card,
  .achievement-card:nth-child(even) {
    flex-direction: column;
    text-align: left;
  }

  .achievements-hint {
    margin-top: 1rem;
  }

  .thm-badge {
    width: 100%;
    max-width: 420px;
  }
}

/* Terminal Page */
.terminal-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  z-index: 2;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.terminal-page.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.terminal-window {
  width: 100%;
  max-width: 900px;
  background: #050505;
  /* Black */
  border: 1px solid rgba(255, 0, 0, 0.3);
  /* Red border */
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.15);
  /* Red glow */
  overflow: hidden;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.95rem;
}

.terminal-header {
  background: #0a0a0a;
  border-bottom: 1px solid rgba(255, 0, 0, 0.2);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.terminal-controls {
  position: absolute;
  left: 1rem;
  display: flex;
  gap: 6px;
}

.ctrl {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ctrl.red {
  background: #ff4444;
}

.ctrl.yellow {
  background: #333333;
}

/* Grayscale */
.ctrl.green {
  background: #333333;
}

/* Grayscale */

.terminal-title {
  color: #666;
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.terminal-body {
  padding: 1.5rem;
  color: #e0e0e0;
  line-height: 1.5;
}

.cmd-line {
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.prompt {
  color: var(--glitch-color-1);
  /* Red prompt */
  margin-right: 0.5rem;
  text-shadow: 0 0 5px rgba(255, 0, 0, 0.4);
}

.output-block {
  margin-bottom: 1.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255, 0, 0, 0.15);
  /* Subtle guide line */
}

.kv-pair {
  display: flex;
  margin-bottom: 0.25rem;
}

.key {
  color: #ffffff;
  min-width: 140px;
  font-weight: bold;
  opacity: 0.9;
}

.val {
  color: #cccccc;
}

.val a {
  color: var(--glitch-color-1);
  text-decoration: none;
  border-bottom: 1px dotted rgba(255, 0, 0, 0.5);
  transition: all 0.2s;
}

.val a:hover {
  color: #ffffff;
  background: rgba(255, 0, 0, 0.2);
  border-bottom-color: transparent;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 1.2em;
  background: var(--glitch-color-1);
  /* Red cursor */
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .kv-pair {
    flex-direction: column;
  }

  .key {
    margin-bottom: 2px;
  }

  .terminal-page {
    padding: 1rem;
  }
}

/* Modal Overlay Styles */
.terminal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.terminal-overlay.visible {
  visibility: visible;
  opacity: 1;
}

.terminal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  /* Darker backdrop */
  backdrop-filter: blur(8px);
}

.terminal-overlay .terminal-window {
  position: relative;
  z-index: 1001;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
  width: 90%;
  max-width: 900px;
}

.terminal-overlay.visible .terminal-window {
  transform: scale(1);
  opacity: 1;
}

/* Close button cursor pointer */
#close-terminal {
  cursor: pointer;
  font-family: sans-serif;
  color: rgba(0, 0, 0, 0.5);
  line-height: 1;
  transition: all 0.2s;
}

#close-terminal:hover {
  background: #ff0000;
  color: #000;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

#close-terminal::before {
  content: '';
}

#close-terminal:hover::before {
  content: 'x';
  font-size: 10px;
  font-weight: 900;
  margin-bottom: 2px;
}
