/* ============================================================
   RESET
   ============================================================ */

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

html,
body,
p,
ol,
ul,
li,
dl,
dt,
dd,
blockquote,
figure,
fieldset,
legend,
textarea,
pre,
iframe,
hr,
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 100%;
  font-weight: normal;
}

ul {
  list-style: none;
}

button,
input,
select,
textarea {
  margin: 0;
}

img,
video {
  height: auto;
  max-width: 100%;
}

body {
  scroll-behavior: smooth;
  text-rendering: optimizeSpeed;
}

a:not([class]) {
  text-decoration-skip-ink: auto;
}

img {
  max-width: 100%;
  display: block;
}

/* ============================================================
   FONT
   ============================================================ */

@font-face {
  font-family: 'VCR OSD Mono';
  src: url('../assets/fonts/VCROSDMono.woff2') format('woff2'),
    url('../assets/fonts/VCROSDMono.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  --text-primary: #a0a0a0;
  --text-secondary: #fff;

  --font-primary: 'VCR OSD Mono', 'Courier New', monospace;
  --font-size-primary: clamp(16px, 1.8vw, 34px);
  --font-size-secondary: clamp(24px, 4.6vw, 63px);
  --line-height: 1.4;

  --layer-top: 55;
  --layer-content-hover: 21;
  --layer-content: 13;
  --layer-tv-effects: 8;
  --layer-channels: 5;

  --glitchy-blue: rgba(2, 183, 182, 0.4);
  --glitchy-red: rgba(183, 2, 2, 0.4);
  --container-width: 80%;
  --gui-bottom: 2.94117647059rem;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

* {
  scrollbar-width: thin;
  scrollbar-color: #28272a transparent;
}

*::-webkit-scrollbar-track {
  background-color: transparent;
}

*::-webkit-scrollbar {
  width: 3px;
}

*::-webkit-scrollbar-thumb {
  background-color: #28272a;
}

/* ============================================================
   SELECTION
   ============================================================ */

::selection {
  background-color: #fff;
  color: #000;
}

/* ============================================================
   BASE
   ============================================================ */

html {
  font-family: var(--font-primary);
  font-weight: normal;
  font-style: normal;
  color: var(--text-primary);
  font-size: var(--font-size-primary);
  line-height: var(--line-height);
}

body {
  background-color: #000;
  overflow: hidden;
  min-height: 100vh;
  cursor: url('../assets/images/cursor-default.png') 0 0, auto;
}

a,
button,
[role="button"] {
  cursor: url('../assets/images/cursor-pointer.png') 14 8, pointer;
}

html,
body,
.space,
.tv,
.tv-screen,
.tv-content {
  height: auto;
  min-height: 100%;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.page-container {
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 100%;
  min-height: 100vh;
  width: var(--container-width);
  margin: 0 auto;
  position: relative;
  z-index: var(--layer-content);
  background: transparent;
}

/* ============================================================
   HEADER / NAV
   ============================================================ */

.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
  font-size: var(--font-size-primary);
  text-transform: uppercase;
}

.site-header .logo {
  font-size: var(--font-size-secondary);
  color: var(--text-secondary);
  text-decoration: none;
  background: none !important;
  margin-right: auto;
}

.site-header .logo:hover {
  background: none !important;
}

.site-header nav {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

.site-header nav a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.site-header nav a:hover,
.site-header nav a.active {
  color: var(--text-secondary);
}

/* Mobile nav */
.mobile-nav {
  display: none;
}

.breadcrumb-nav {
  display: none;
}

@media (max-width: 600px) {
  .site-header nav.desktop-nav {
    display: none;
  }

  .breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    font-size: 0.8rem;
    color: var(--text-primary);
  }

  .breadcrumb-nav a {
    color: var(--text-secondary);
    text-decoration: none;
  }

  .breadcrumb-nav .separator {
    color: var(--text-primary);
  }

  .breadcrumb-nav .current {
    color: var(--text-primary);
  }
}

/* ============================================================
   CONTENT
   ============================================================ */

.content {
  padding: 1rem 0;
  display: flex;
  align-items: center;
}

.bio {
  line-height: 1.55;
}

/* Tech stack page */
.tech-stack {
  width: 100%;
}

.tech-stack-title {
  font-size: 0.85rem;
  color: #0f0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 1rem 0;
  border-bottom: 1px solid rgba(0, 255, 0, 0.15);
  padding-bottom: 0.4rem;
}

.tech-stack-category {
  margin-bottom: 1.2rem;
}

.tech-stack-category:last-child {
  margin-bottom: 0;
}

.tech-stack-label {
  font-size: 0.7rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem 0;
  font-weight: normal;
}

.tech-stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.big-text {
  font-size: var(--font-size-secondary);
  text-transform: uppercase;
}

/* ============================================================
   GLITCHY TEXT
   ============================================================ */

.glitchy-text {
  --shadow-x: 2px;
  --shadow-y: 1px;
  text-shadow:
    var(--shadow-x) var(--shadow-y) 0 var(--glitchy-blue),
    calc(var(--shadow-x) * -1) calc(var(--shadow-y) * -1) 0 var(--glitchy-red);
}

@media (min-width: 481px) {
  .glitchy-text {
    --shadow-x: 3px;
    --shadow-y: 2px;
  }
}

@media (min-width: 960px) {
  .glitchy-text {
    --shadow-x: 4px;
    --shadow-y: 3px;
  }
}

/* ============================================================
   LINKS - Rainbow static hover effect
   ============================================================ */

a {
  position: relative;
  text-decoration: none;
  color: var(--text-secondary);
  transition: background-size 0.2s cubic-bezier(0.29, 0.8, 0.21, 0.63);
  background-position: center center;
  background-size: 90% 0;
  background-repeat: no-repeat;
  background-image: url('../assets/images/rainbow-static.webp');
}

a:hover {
  cursor: var(--cursor-pointer);
  background-size: 100% 100%;
}

a:hover::after {
  visibility: visible;
  transition: visibility 0s 0.7s;
}

a[href^="http"]::after,
a[href^="mailto"]::after {
  display: block;
  content: attr(href);
  min-width: max-content;
  position: absolute;
  z-index: var(--layer-content-hover);
  background-color: rgba(0, 0, 0, 0.8);
  bottom: 100%;
  left: 0;
  margin-bottom: 0.5rem;
  font-size: 0.6rem;
  visibility: hidden;
  transition: none;
}

a:focus {
  outline: none;
  background-size: 100% 100%;
}

a:focus::after {
  visibility: visible;
}

/* ============================================================
   PROJECT LIST
   ============================================================ */

.project-list {
  list-style: none;
  padding: 0;
}

.project-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.project-list li:last-child {
  border-bottom: none;
}

.project-list a {
  display: inline;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1rem;
}

.project-list .project-desc {
  color: var(--text-primary);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  padding: 1.5rem 0;
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================
   CRT / TV EFFECTS
   ============================================================ */

/* Scanlines overlay */
.crt-overlay {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--layer-tv-effects);
}

.crt-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom,
      transparent 0px,
      transparent 1px,
      rgba(0, 0, 0, 0.15) 1px,
      rgba(0, 0, 0, 0.15) 2px);
}

.crt-vline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.04);
  animation: vline 8s linear infinite;
}

.crt-glow {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6);
}

/* Noise texture overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--layer-tv-effects) - 1);
  pointer-events: none;
  opacity: 0.03;
  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)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ============================================================
   STARFIELD
   ============================================================ */

#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ============================================================
   TURN ON ANIMATION
   ============================================================ */

body {
  animation: turn-on-transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards,
    turn-on-filter 0.5s ease-out forwards;
}

/* ============================================================
   SKIP LINK
   ============================================================ */

.skip-link {
  position: absolute;
  z-index: var(--layer-top);
  top: 0;
  left: 0;
  background: #000;
  color: #fff;
  padding: 0.5rem 1rem;
  text-decoration: none;
}

.skip-link:not(:focus) {
  transform: translateX(-100%);
}

/* ============================================================
   PAGE TITLE (breadcrumb on sub-pages)
   ============================================================ */

.page-title {
  font-size: var(--font-size-secondary);
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: none;
}

@media (max-width: 600px) {
  .page-title {
    display: block;
  }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes vline {
  0% {
    transform: translateY(-100%);
  }

  80%,
  100% {
    transform: translateY(100vh);
  }
}

@keyframes turn-on-transform {
  0% {
    transform: scale(1, 0.6) translate(0, 0) skew(2deg);
  }

  6% {
    transform: scale(2) translate(0, -20%) skew(2deg);
  }

  30% {
    transform: scale(1) translate(0, -20%) skew(-2deg);
  }

  50% {
    transform: scale(1, 0.8) translate(0, 40%) skew(-2deg);
  }

  100% {
    transform: scale(1) translate(0, 0) skew(0);
  }
}

@keyframes turn-on-filter {
  0% {
    filter: brightness(1) invert(1) saturate(1.2);
  }

  3% {
    filter: brightness(4) invert(1) saturate(2);
  }

  15% {
    filter: brightness(4) invert(0) saturate(2);
  }

  30%,
  50% {
    filter: brightness(10) invert(0) saturate(1);
  }

  70% {
    filter: contrast(1) brightness(1) invert(0) saturate(1);
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes float {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-20px);
  }

  100% {
    transform: translateY(0);
  }
}

/* ============================================================
   CHANNEL CONTROLS
   ============================================================ */

.channel-controls {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--layer-content);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.channel-controls button {
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-primary);
  font-size: 0.65rem;
  padding: 0.4rem 0.6rem;
  letter-spacing: 0.05em;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.channel-controls button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   BOOT SCREEN
   ============================================================ */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 2rem;
  overflow: hidden;
}

.boot-screen.boot-fade {
  animation: bootFadeOut 0.6s ease-out forwards;
}

.boot-text {
  font-family: var(--font-primary);
  font-size: 14px;
  color: #0f0;
  line-height: 1.6;
  max-height: 100%;
  overflow-y: auto;
}

.boot-line {
  white-space: pre;
}

@keyframes bootFadeOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1, 0.005);
  }

  100% {
    opacity: 0;
    transform: scale(0, 0);
  }
}

/* ============================================================
   VHS TIMESTAMP
   ============================================================ */

.vhs-timestamp {
  position: fixed;
  top: 1.2rem;
  right: 1.5rem;
  z-index: var(--layer-content);
  font-family: var(--font-primary);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.08em;
  pointer-events: none;
}

.rec-dot {
  color: #ff0000;
  animation: blink 1s step-end infinite;
  font-size: 0.8rem;
}

/* ============================================================
   RESUME PAGE
   ============================================================ */

.resume-content {
  align-items: flex-start;
  overflow-y: visible;
}

/* Allow body scroll on resume page */
body:has(.resume-content) {
  overflow-y: auto !important;
  overflow-x: hidden;
}

.resume {
  width: 100%;
  padding: 1rem 0;
}

.resume-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1.5rem;
}

.resume-name {
  font-size: var(--font-size-secondary);
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.resume-title {
  font-size: 0.85rem;
  color: var(--text-primary);
  letter-spacing: 0.1em;
}

.resume-contact {
  font-size: 0.7rem;
  color: var(--text-primary);
  margin-top: 0.8rem;
}

.resume-contact a {
  font-size: 0.7rem;
}

.resume-section {
  margin-bottom: 1.8rem;
}

.resume-section-title {
  font-size: 0.85rem;
  color: #0f0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 255, 0, 0.15);
  padding-bottom: 0.4rem;
}

.resume-item {
  margin-bottom: 1.2rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
}

.resume-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.resume-item-title {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.resume-item-date {
  color: var(--text-primary);
  font-size: 0.65rem;
  opacity: 0.7;
}

.resume-item-sub {
  color: var(--text-primary);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.resume-item-desc {
  color: var(--text-primary);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.resume-list {
  list-style: none;
  padding: 0;
  margin-top: 0.4rem;
}

.resume-list li {
  color: var(--text-primary);
  font-size: 0.75rem;
  padding: 0.15rem 0;
}

.resume-list li::before {
  content: '> ';
  color: rgba(0, 255, 0, 0.4);
}

.resume-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 0.3rem 0.6rem;
  font-family: var(--font-primary);
}

.resume-footer-note {
  color: rgba(0, 255, 0, 0.3);
  font-size: 0.7rem;
  margin-top: 2rem;
  text-align: center;
}

/* ============================================================
   VISITOR COUNTER
   ============================================================ */

.visitor-counter {
  font-family: var(--font-primary);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  opacity: 0.6;
  transition: opacity 0.3s;
}

.visitor-counter:hover {
  opacity: 1;
}

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

#visitor-count {
  color: var(--text-accent);
  font-weight: bold;
  transition: color 0.3s;
}

#visitor-count.counter-loaded {
  color: #0f0;
  text-shadow: 0 0 4px rgba(0, 255, 0, 0.4);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --container-width: 90%;
  }

  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .content {
    padding: 0.5rem 0;
  }

  .channel-controls {
    bottom: 1rem;
    right: 1rem;
  }

  .channel-controls button {
    font-size: 0.6rem;
    padding: 0.5rem 0.7rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  :root {
    --container-width: 92%;
    --font-size-primary: clamp(14px, 4vw, 18px);
    --font-size-secondary: clamp(20px, 8vw, 36px);
  }

  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .site-header {
    padding: 1rem 0;
    gap: 0.6rem;
    flex-wrap: wrap;
  }

  .site-footer {
    gap: 0.8rem;
    padding: 1rem 0;
  }

  .site-footer a {
    font-size: 0.65rem;
  }

  .bio {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .project-list a {
    font-size: 0.9rem;
  }

  .project-list .project-desc {
    display: block;
    margin-left: 0;
    margin-top: 0.2rem;
    font-size: 0.75rem;
  }

  .project-list li {
    padding: 0.8rem 0;
  }

  /* Tooltip would overflow on mobile */
  a[href^="http"]::after,
  a[href^="mailto"]::after {
    display: none;
  }
}