/* Font faces */
@font-face {
    font-family: 'SquareOutline';
    src: url('fonts/LEDpixel-SquareOutline.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'S_Demo_Slab';
    src: url('fonts/LEDpixel-S_DEMO_SlabSerif.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'SH1_Slab_Serif';
    src: url('fonts/LEDpixel-SH1_SlabSerif.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'S_Slab_Serif';
    src: url('fonts/LEDpixel-S_SlabSerif.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'Circle';
    src: url('fonts/LEDpixel-Circle.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'SH2_Slab_Serif';
    src: url('fonts/LEDpixel-SH2_SlabSerif.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'SCr_Slab_Serif';
    src: url('fonts/LEDpixel-SCr_SlabSerif.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'HO_Slab_Serif';
    src: url('fonts/LEDpixel-HO_SlabSerif.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'SquareCircle';
    src: url('fonts/LEDpixel-SquareCircle.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'T_Slab_Serif';
    src: url('fonts/LEDpixel-T_SlabSerif.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'HO_Unicase';
    src: url('fonts/LEDpixel-HO_Unicase.otf') format('opentype');
    font-display: block;
}

@font-face {
    font-family: 'EuclidCircularB';
    src: url('fonts/EuclidCircularB-Medium.otf') format('opentype');
    font-display: block;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'EuclidCircularB', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #F5F7FA;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 1.45rem; /* Further increased desktop font size for better readability */
}

a {
    color: #111;
    text-decoration: none;
}

a:hover, a:focus {
    color: #111;
    text-decoration: underline;
}

/* Container utility */
.container {
    max-width: 650px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

/* Left align content on About and Contact pages */
body.about .container,
body.contact .container {
    text-align: left;
}

/* Ensure titles are also left-aligned on About and Contact pages */
body.about .main-title,
body.contact .main-title {
    text-align: left;
}

/* Add more space between paragraphs on About and Contact pages */
body.about p,
body.contact p {
    margin-bottom: 2rem;
}

/* Make email link black on contact page */
body.contact a {
    color: #111;
}

/* Navigation */
.nav {
    background-color: transparent;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 62px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    min-width: 200px;
}

.nav-brand a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 1.1rem;
}

.nav-logo {
    height: 26px;
    width: auto;
    display: block;
    margin: 0;
    padding: 0;
    transition: opacity 0.2s ease;
}

.nav-logo-mobile {
    height: 26.4px; /* 10% bigger than 24px */
    width: auto;
    display: none;
    margin: 0;
    padding: 0;
    transition: opacity 0.2s ease;
}

/* Hide logo on home page only */
body.home .nav-logo,
body.home .nav-logo-mobile {
    display: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-burger {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
    margin-right: 0.5rem;
    position: static;
    top: auto;
    z-index: auto;
    background: none;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #333;
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Active page navigation styling for desktop only */
@media (min-width: 651px) {
    body.about .nav-links a[href="about.html"]::after,
    body.contact .nav-links a[href="contact.html"]::after {
        width: 100%;
        display: block;
    }
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8rem 0;
}

/* Center main content vertically and horizontally on homepage */
body.home .main {
    align-items: center;
}

/* Ensure homepage container is properly centered */
body.home .container {
    max-width: none;
    text-align: center;
    width: 100vw;
    padding: 0;
}

/* Ensure titles keep full size on desktop for all pages */
@media (min-width: 651px) {
    body.home .main-title,
    body.about .main-title,
    body.contact .main-title {
        font-size: 97px !important; /* Force desktop size only on desktop */
    }
}

/* Ensure homepage title is centered */
body.home .main-title {
    text-align: center;
    width: 100%;
}

.main-title {
    font-size: 97px; /* Fixed pixel size for pixel fonts */
    font-weight: normal; /* Pixel fonts have their own weight */
    margin-bottom: 5rem;
    color: #333;
    letter-spacing: 0; /* Let the font handle spacing */
    text-transform: uppercase;
    display: block;
    min-height: 80px; /* Ensures consistent positioning */
    line-height: 1;
    text-align: center;
}

.title-line {
    display: block;
    white-space: nowrap;
    text-align: center;
    
    /* Critical: Disable all font smoothing */
    -webkit-font-smoothing: none !important;
    -moz-osx-font-smoothing: grayscale !important;
    font-smooth: never !important;
    text-rendering: optimizeSpeed !important;
    
    /* Force pixel-perfect rendering */
    image-rendering: -moz-crisp-edges !important;
    image-rendering: -webkit-crisp-edges !important;
    image-rendering: pixelated !important;
    image-rendering: crisp-edges !important;
    
    /* Prevent subpixel rendering */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Apply anti-smoothing to each character */
.main-title span {
    display: inline-block;
    -webkit-font-smoothing: none !important;
    -moz-osx-font-smoothing: grayscale !important;
    font-smooth: never !important;
    text-rendering: optimizeSpeed !important;
    image-rendering: pixelated !important;
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: -moz-crisp-edges !important;
    image-rendering: crisp-edges !important;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInChar 0.6s ease-out forwards;
    pointer-events: none; /* Disable hover during entrance */
}

/* Character entrance animation delays */
.main-title span:nth-child(1) { animation-delay: 0.1s; }
.main-title span:nth-child(2) { animation-delay: 0.2s; }
.main-title span:nth-child(3) { animation-delay: 0.3s; }
.main-title span:nth-child(4) { animation-delay: 0.4s; }
.main-title span:nth-child(5) { animation-delay: 0.5s; }
.main-title span:nth-child(6) { animation-delay: 0.6s; }
.main-title span:nth-child(7) { animation-delay: 0.7s; }
.main-title span:nth-child(8) { animation-delay: 0.8s; }

/* Home page specific delays for two-line title */
body.home .title-line:nth-child(1) span:nth-child(1) { animation-delay: 0.1s; }
body.home .title-line:nth-child(1) span:nth-child(2) { animation-delay: 0.2s; }
body.home .title-line:nth-child(1) span:nth-child(3) { animation-delay: 0.3s; }
body.home .title-line:nth-child(1) span:nth-child(4) { animation-delay: 0.4s; }
body.home .title-line:nth-child(1) span:nth-child(5) { animation-delay: 0.5s; }
body.home .title-line:nth-child(1) span:nth-child(6) { animation-delay: 0.6s; }

body.home .title-line:nth-child(2) span:nth-child(1) { animation-delay: 0.7s; }
body.home .title-line:nth-child(2) span:nth-child(2) { animation-delay: 0.8s; }
body.home .title-line:nth-child(2) span:nth-child(3) { animation-delay: 0.9s; }
body.home .title-line:nth-child(2) span:nth-child(4) { animation-delay: 1.0s; }
body.home .title-line:nth-child(2) span:nth-child(5) { animation-delay: 1.1s; }
body.home .title-line:nth-child(2) span:nth-child(6) { animation-delay: 1.2s; }
body.home .title-line:nth-child(2) span:nth-child(7) { animation-delay: 1.3s; }
body.home .title-line:nth-child(2) span:nth-child(8) { animation-delay: 1.4s; }

@keyframes fadeInChar {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto; /* Re-enable hover after animation */
    }
}

/* Enable hover effects after entrance animation completes */
.main-title.loaded span:hover {
    cursor: pointer;
}


/* Individual character hover colors - only after animation completes */
body.home .main-title.loaded .title-line:nth-child(1) span:nth-child(1):hover { color: #1DB41E; } /* { */
body.home .main-title.loaded .title-line:nth-child(1) span:nth-child(2):hover { color: #D001FF; } /* P */
body.home .main-title.loaded .title-line:nth-child(1) span:nth-child(3):hover { color: #E5E522; } /* Ĩ */
body.home .main-title.loaded .title-line:nth-child(1) span:nth-child(4):hover { color: #FF6E00; } /* x */
body.home .main-title.loaded .title-line:nth-child(1) span:nth-child(5):hover { color: #00D2FF; } /* e */
body.home .main-title.loaded .title-line:nth-child(1) span:nth-child(6):hover { color: #1DB41E; } /* l */

body.home .main-title.loaded .title-line:nth-child(2) span:nth-child(1):hover { color: #3737C8; } /* P */
body.home .main-title.loaded .title-line:nth-child(2) span:nth-child(2):hover { color: #FF0000; } /* ů */
body.home .main-title.loaded .title-line:nth-child(2) span:nth-child(3):hover { color: #E5E522; } /* p */
body.home .main-title.loaded .title-line:nth-child(2) span:nth-child(4):hover { color: #1DB41E; } /* p */
body.home .main-title.loaded .title-line:nth-child(2) span:nth-child(5):hover { color: #D001FF; } /* ē */
body.home .main-title.loaded .title-line:nth-child(2) span:nth-child(6):hover { color: #00D2FF; } /* T */
body.home .main-title.loaded .title-line:nth-child(2) span:nth-child(7):hover { color: #FF6E00; } /* Ş */
body.home .main-title.loaded .title-line:nth-child(2) span:nth-child(8):hover { color: #3737C8; } /* } */

/* Random character hover colors for About and Contact pages - only after animation completes */
body.about .main-title.loaded span:nth-child(1):hover { color: #FF6E00; } /* A */
body.about .main-title.loaded span:nth-child(2):hover { color: #1DB41E; } /* b */
body.about .main-title.loaded span:nth-child(3):hover { color: #D001FF; } /* o */
body.about .main-title.loaded span:nth-child(4):hover { color: #00D2FF; } /* u */
body.about .main-title.loaded span:nth-child(5):hover { color: #E5E522; } /* t */

body.contact .main-title.loaded span:nth-child(1):hover { color: #3737C8; } /* C */
body.contact .main-title.loaded span:nth-child(2):hover { color: #FF0000; } /* o */
body.contact .main-title.loaded span:nth-child(3):hover { color: #1DB41E; } /* n */
body.contact .main-title.loaded span:nth-child(4):hover { color: #FF6E00; } /* t */
body.contact .main-title.loaded span:nth-child(5):hover { color: #E5E522; } /* a */
body.contact .main-title.loaded span:nth-child(6):hover { color: #D001FF; } /* c */
body.contact .main-title.loaded span:nth-child(7):hover { color: #00D2FF; } /* t */

@keyframes charGlitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

/* Individual character font classes */
.main-title .square-outline { font-family: 'SquareOutline', monospace; }
.main-title .s-demo-slab { font-family: 'S_Demo_Slab', monospace; }
.main-title .sh1-slab-serif { font-family: 'SH1_Slab_Serif', monospace; }
.main-title .s-slab-serif { font-family: 'S_Slab_Serif', monospace; }
.main-title .circle { font-family: 'Circle', monospace; }
.main-title .sh2-slab-serif { font-family: 'SH2_Slab_Serif', monospace; }
.main-title .scr-slab-serif { font-family: 'SCr_Slab_Serif', monospace; }
.main-title .ho-slab-serif { font-family: 'HO_Slab_Serif', monospace; }
.main-title .square-circle { font-family: 'SquareCircle', monospace; }
.main-title .t-slab-serif { font-family: 'T_Slab_Serif', monospace; }
.main-title .ho-unicase { font-family: 'HO_Unicase', monospace; }


.main-tagline {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 6rem;
    letter-spacing: 1px;
    font-weight: 400;
}

.tagline-line {
    display: inline;
}

@media (max-width: 650px) {
    .tagline-line {
        display: block;
        text-align: center;
    }
}

.main-button, .main-button:visited {
    background: #fff;
    color: #111;
    border: 2px solid #111;
    font-weight: bold;
    text-decoration: none;
}

.main-button:hover, .main-button:focus {
    background: #fff;
    color: #111;
    text-decoration: none;
}

.main-button {
    display: inline-block;
    background-color: #333;
    color: white;
    padding: 1rem 2.5rem;
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 1px;
    border-radius: 50px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    transform: translate(0);
    font-size: 1rem; /* Fixed, smaller font size for desktop */
}

@keyframes wiggle {
    0%, 5% { transform: rotateZ(0); }
    8% { transform: rotateZ(-3deg); }
    11% { transform: rotateZ(2deg); }
    14% { transform: rotateZ(-2deg); }
    17% { transform: rotateZ(1deg); }
    20% { transform: rotateZ(-1deg); }
    23%, 100% { transform: rotateZ(0); }
}

.main-button:hover {
    background-color: #fff;
}

/* Desktop only: add glitch animation on hover */
@media (min-width: 1201px) {
    .main-button:hover {
        animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    }
}

@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-4px, 4px);
    }
    40% {
        transform: translate(-4px, -4px);
    }
    60% {
        transform: translate(4px, 4px);
    }
    80% {
        transform: translate(4px, -4px);
    }
    100% {
        transform: translate(0);
    }
}

/* Content area styling for About and Contact pages */
.content {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
    line-height: 1.8;
    font-size: 1.1rem;
}

.content p {
    margin-bottom: 1.5rem;
}

.content a {
    color: #007bff;
    text-decoration: none;
}

.content a:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    background-color: #F5F7FA;
    padding: 2rem;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

/* Mobile styles */
@media (max-width: 1200px) {
    body {
        font-size: 1.22rem; /* Mobile/tablet font size */
    }
    
    .nav {
        flex-direction: row;
        gap: 0.8rem; /* 20% smaller from 1rem */
        padding: 0.8rem; /* 20% smaller from 1rem */
        justify-content: space-between;
        align-items: center;
        min-height: 50px; /* 20% smaller from 62px */
        position: relative;
    }
    
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #F5F7FA;
        flex-direction: column;
        text-align: center;
        padding: 0;
        z-index: 1000;
        gap: 0.5rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }
    
    .nav-links.active {
        max-height: 200px;
        padding: 1rem 0;
    }
    
    .nav-links a {
        padding: 0.6rem 0;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    .nav-links.active a {
        opacity: 1;
        transform: translateY(0);
    }
    
    .nav-links a:nth-child(2) {
        transition-delay: 0.2s;
    }
    
    .nav-links a::after {
        display: none !important;
    }
    
    .nav-burger {
        display: flex;
        flex-direction: column;
        cursor: pointer;
        gap: 4px;
        margin-right: 0.5rem;
        position: static;
        top: auto;
        z-index: auto;
        background: none;
    }
    
    .nav-burger span {
        width: 25px;
        height: 3px;
        background: #333;
        transition: 0.3s;
    }
    
    .nav-burger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .nav-burger.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-burger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    .nav-logo,
    .nav-logo-hover {
        display: none;
    }
    
    .nav-logo-mobile,
    .nav-logo-mobile-hover {
        display: block;
        height: 26.4px; /* 10% bigger than 24px */
        margin-left: 0.5rem;
    }
    
    .main {
        padding: 10rem 0; /* Even more space from nav */
    }
    
    .main-title {
        font-size: 62.7px; /* 5% smaller than 66px */
        margin-bottom: 5rem; /* More space before tagline */
    }
    
    .title-line {
        display: block !important;
        width: 100%;
        text-align: center;
        margin-bottom: 1.2rem;
    }
    
    .title-line:last-child {
        margin-bottom: 0;
    }
    
    .main-tagline {
        font-size: 1.2rem; /* Smaller mobile tagline */
        margin-bottom: 6rem; /* More space before button */
    }
    
    .main-button {
        padding: 0.8rem 2rem; /* 20% smaller vertical padding */
        font-size: 0.8rem; /* 20% smaller text */
    }
    
    .container {
        padding: 0 2.5rem; /* Even more horizontal spacing */
    }
    
    .content {
        font-size: 1.2rem; /* Even larger mobile content font */
        padding: 0 2.5rem; /* Match container spacing */
        line-height: 1.6; /* Better line height */
    }
    
    .content p {
        margin-bottom: 1.2rem; /* 20% smaller from 1.5rem */
    }
    
    .footer {
        padding: 1.6rem; /* 20% smaller from 2rem */
        font-size: 0.83rem; /* 15% larger from 0.72rem */
    }
    
    .mobile-break {
        display: inline;
    }
}

/* Tablet styles - now only for very large screens */
@media (min-width: 1201px) {
    .content {
        max-width: 800px;
    }
}

/* Logo fade in/out animation */
.nav-logo, .nav-logo-mobile {
    opacity: 0;
    transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1);
}

/* Logo stacking and hover effects */
.nav-brand a {
    position: relative;
    display: inline-block;
}

.nav-logo-hover,
.nav-logo-mobile-hover {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-logo-hover {
    height: 26px;
    width: auto;
    display: block;
}

.nav-logo-mobile-hover {
    height: 26.4px;
    width: auto;
    display: none;
}

.nav-brand a:hover .nav-logo-hover,
.nav-brand a:hover .nav-logo-mobile-hover {
    opacity: 1;
}

body.home .nav-logo.visible, body.home .nav-logo-mobile.visible {
    opacity: 1;
}

body:not(.home) .nav-logo.visible, body:not(.home) .nav-logo-mobile.visible {
    opacity: 1;
}

.nav-logo.fading-out, .nav-logo-mobile.fading-out {
    opacity: 0;
    transition: opacity 0.15s cubic-bezier(0.4,0,0.2,1);
}

/* Fade-in animation for body text paragraphs on About and Contact pages */
@keyframes fadeInBodyText {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.about .container p, body.contact .container p {
    opacity: 0;
    animation: fadeInBodyText 0.7s cubic-bezier(0.4,0,0.2,1) forwards;
    animation-delay: 0.3s;
}

body.about .container p:nth-of-type(2) { animation-delay: 0.5s; }
body.about .container p:nth-of-type(3) { animation-delay: 0.7s; }
body.contact .container p:nth-of-type(2) { animation-delay: 0.5s; }

/* Preloader styles */
#preloader.loader {
  --preloader-bg: #F5F7FA;
  --preloader-color: #111;
  --preloader-size: 14vh;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  background: var(--preloader-bg);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s;
}
#preloader .preloader-brace {
  font-family: Consolas, Menlo, Monaco, monospace;
  font-weight: bold;
  font-size: var(--preloader-size);
  color: var(--preloader-color);
  opacity: 0.8;
  display: inline-block;
  animation: preloader-pulse 0.4s alternate infinite ease-in-out;
}
#preloader .preloader-brace:nth-child(2) {
  animation-delay: 0.4s;
}
@keyframes preloader-pulse {
  to {
    transform: scale(0.8);
    opacity: 0.5;
  }
}

/* Animated dot preloader styles */
#preloader.cs-loader {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  background: #F5F7FA;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s;
}
#preloader .cs-loader-inner {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100vw;
  color: #111;
  padding: 0;
  text-align: center;
  transform: translateY(-50%);
}
#preloader .cs-loader-inner label {
  font-size: 14px;
  opacity: 0;
  display: inline-block;
}
@keyframes lol {
  0% {
    opacity: 0;
    transform: translateX(-120px);
  }
  33% {
    opacity: 1;
    transform: translateX(0px);
  }
  66% {
    opacity: 1;
    transform: translateX(0px);
  }
  100% {
    opacity: 0;
    transform: translateX(120px);
  }
}
#preloader .cs-loader-inner label:nth-child(6) { animation: lol 3s infinite ease-in-out; }
#preloader .cs-loader-inner label:nth-child(5) { animation: lol 3s 100ms infinite ease-in-out; }
#preloader .cs-loader-inner label:nth-child(4) { animation: lol 3s 200ms infinite ease-in-out; }
#preloader .cs-loader-inner label:nth-child(3) { animation: lol 3s 300ms infinite ease-in-out; }
#preloader .cs-loader-inner label:nth-child(2) { animation: lol 3s 400ms infinite ease-in-out; }
#preloader .cs-loader-inner label:nth-child(1) { animation: lol 3s 500ms infinite ease-in-out; }