/**
 * sinanasmali.com — Site-wide Effects
 * Industrial / Blueprint / HUD aesthetic
 */

/* ============================================
   1. PAGE TRANSITION — Laser Cut
   ============================================ */
#page-transition {
    position: fixed;
    inset: 0;
    z-index: 99990;
    pointer-events: none;
}
#page-transition .laser-line {
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00c8ff 20%, #00c8ff 80%, transparent);
    box-shadow: 0 0 15px #00c8ff, 0 0 30px rgba(0, 200, 255, 0.3);
    transform: scaleX(0);
    transform-origin: left;
}
#page-transition .slab-top,
#page-transition .slab-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    background: #0a0e1a;
}
#page-transition .slab-top    { top: 0;   transform: translateY(-100%); }
#page-transition .slab-bottom { bottom: 0; transform: translateY(100%); }

/* Only ONE animation on click: laser sweeps across, then navigate */
#page-transition.sweeping .laser-line {
    animation: laser-sweep 0.35s ease forwards;
}
#page-transition.sweeping .slab-top,
#page-transition.sweeping .slab-bottom {
    display: none;
}

@keyframes laser-sweep {
    0%   { transform: scaleX(0); opacity: 1; }
    70%  { transform: scaleX(1); opacity: 1; }
    100% { transform: scaleX(1); opacity: 0; }
}

/* ============================================
   2. SCROLL REVEAL — Crop Marks + Draw Line
   ============================================ */
[data-reveal] {
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Crop marks on sections */
[data-reveal]::before,
[data-reveal]::after {
    content: '';
    position: absolute;
    border-color: rgba(0, 200, 255, 0.2);
    border-style: solid;
    border-width: 0;
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.4s 0.3s ease, border-width 0s 0.3s;
}
[data-reveal]::before {
    top: -8px;
    left: -8px;
    border-top-width: 0;
    border-left-width: 0;
}
[data-reveal]::after {
    bottom: -8px;
    right: -8px;
    border-bottom-width: 0;
    border-right-width: 0;
}
[data-reveal].revealed::before {
    border-top-width: 1px;
    border-left-width: 1px;
    opacity: 1;
}
[data-reveal].revealed::after {
    border-bottom-width: 1px;
    border-right-width: 1px;
    opacity: 1;
}

/* Horizontal reveal line */
[data-reveal] > .reveal-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, #00c8ff, transparent);
    transition: width 0.8s 0.2s ease;
}
[data-reveal].revealed > .reveal-line {
    width: 100%;
}

/* ============================================
   SIDE NAV — Unified active state
   ============================================ */
.side-nav-icon.side-nav-active {
    color: #00C8FF !important;
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.4);
}

/* ============================================
   3. PARALLAX BLUEPRINT GRID
   ============================================ */
.blueprint-grid-parallax {
    background-attachment: local;
    will-change: background-position;
}

/* ============================================
   5. GLITCH / DATA STREAM — Heading Decode
   ============================================ */
[data-glitch] {
    position: relative;
}
[data-glitch].glitching {
    animation: glitch-shake 0.1s linear 3;
}
@keyframes glitch-shake {
    0%   { transform: translate(0); }
    25%  { transform: translate(-1px, 1px); }
    50%  { transform: translate(1px, -1px); }
    75%  { transform: translate(-1px, -1px); }
    100% { transform: translate(0); }
}

/* CRT scanline flash on glitch */
[data-glitch].glitching::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 200, 255, 0.03) 2px,
        rgba(0, 200, 255, 0.03) 4px
    );
    pointer-events: none;
    animation: scanline-flash 0.3s ease forwards;
}
@keyframes scanline-flash {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================
   6. LINK & BUTTON HOVER — Electric Current
   ============================================ */
.electric-hover {
    position: relative;
    overflow: hidden;
}
.electric-hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #00c8ff, #ffb86f, #00c8ff);
    background-size: 200% 100%;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}
.electric-hover:hover::after {
    transform: scaleX(1);
    animation: electric-flow 1s linear infinite;
}
@keyframes electric-flow {
    0%   { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* Spark effect on buttons */
.spark-hover {
    position: relative;
    overflow: hidden;
}
.spark-hover::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -100%;
    width: 40px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 0.3), transparent);
    transform: translateY(-50%) skewX(-15deg);
    transition: none;
}
.spark-hover:hover::before {
    animation: spark-sweep 0.6s ease;
}
@keyframes spark-sweep {
    from { left: -100%; }
    to   { left: 200%; }
}

/* ============================================
   7. TIMELINE SCROLL ANIMATION
   ============================================ */
.timeline-line-draw {
    position: absolute;
    left: 19px;
    top: 0;
    width: 1px;
    height: 0;
    background: #00c8ff;
    transition: height 1.5s ease;
    z-index: 5;
}
.timeline-line-draw.drawn {
    height: 100%;
}

.timeline-node {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.timeline-node.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Node pulse on reveal */
.timeline-node .node-icon {
    position: relative;
}
.timeline-node.visible .node-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(0, 200, 255, 0.5);
    animation: node-pulse 0.6s ease forwards;
}
@keyframes node-pulse {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ============================================
   8. HUD LIVE DATA — Flicker Numbers
   ============================================ */
[data-hud-live] {
    position: relative;
}
[data-hud-live].flickering {
    animation: hud-flicker 0.08s steps(2) 3;
}
@keyframes hud-flicker {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ============================================
   9. PAGE LOADING — Laser Scan Line
   ============================================ */
#laser-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00c8ff 40%, #00c8ff 60%, transparent);
    box-shadow: 0 0 8px #00c8ff, 0 0 20px rgba(0, 200, 255, 0.2);
    z-index: 99991;
    transition: width 0.3s ease;
}
#laser-loader.complete {
    width: 100% !important;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.3s 0.2s ease;
}
#laser-loader-pct {
    position: fixed;
    top: 6px;
    right: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: rgba(0, 200, 255, 0.5);
    z-index: 99992;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#laser-loader-pct.visible {
    opacity: 1;
}
#laser-loader-pct.fade-out {
    opacity: 0;
}

/* ============================================
   10. KONAMI CODE — Wireframe / Blueprint Mode
   ============================================ */
html.wireframe-mode,
html.wireframe-mode body {
    background: #050a14 !important;
}
html.wireframe-mode * {
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
}
html.wireframe-mode *:not(img):not(svg):not(span.material-symbols-outlined) {
    color: rgba(0, 200, 255, 0.6) !important;
    border-color: rgba(0, 200, 255, 0.15) !important;
}
html.wireframe-mode img {
    filter: brightness(0) invert(0.5) sepia(1) saturate(5) hue-rotate(160deg) !important;
    opacity: 0.3 !important;
}
html.wireframe-mode section,
html.wireframe-mode div,
html.wireframe-mode nav,
html.wireframe-mode aside,
html.wireframe-mode footer,
html.wireframe-mode main,
html.wireframe-mode header {
    outline: 1px solid rgba(0, 200, 255, 0.08) !important;
}

/* Wireframe dimension labels */
.wireframe-label {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    color: rgba(0, 200, 255, 0.3) !important;
    pointer-events: none;
    z-index: 100;
    letter-spacing: 0.1em;
}

/* Wireframe toggle indicator */
#wireframe-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #00c8ff;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 200, 255, 0.3);
    padding: 8px 20px;
    z-index: 100000;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: none;
}
html.wireframe-mode #wireframe-indicator {
    display: block;
}

/* ============================================
   11. CARD HOVER — Technical Drawing Dimensions
   ============================================ */
.tech-card {
    position: relative;
}
.tech-card .dim-label-w,
.tech-card .dim-label-h {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    color: rgba(0, 200, 255, 0);
    letter-spacing: 0.1em;
    transition: color 0.3s ease;
    pointer-events: none;
}
.tech-card .dim-label-w {
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
}
.tech-card .dim-label-h {
    right: -40px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}
.tech-card:hover .dim-label-w,
.tech-card:hover .dim-label-h {
    color: rgba(0, 200, 255, 0.4);
}

/* Measurement bracket lines */
.tech-card .dim-line-top,
.tech-card .dim-line-right {
    position: absolute;
    background: rgba(0, 200, 255, 0);
    transition: background 0.3s ease;
    pointer-events: none;
}
.tech-card .dim-line-top {
    top: -4px;
    left: 0;
    width: 100%;
    height: 1px;
}
.tech-card .dim-line-right {
    top: 0;
    right: -4px;
    width: 1px;
    height: 100%;
}
.tech-card:hover .dim-line-top,
.tech-card:hover .dim-line-right {
    background: rgba(0, 200, 255, 0.15);
}

/* Corner tick marks */
.tech-card .corner-tl,
.tech-card .corner-tr,
.tech-card .corner-bl,
.tech-card .corner-br {
    position: absolute;
    width: 8px;
    height: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s 0.1s ease;
}
.tech-card:hover .corner-tl,
.tech-card:hover .corner-tr,
.tech-card:hover .corner-bl,
.tech-card:hover .corner-br {
    opacity: 1;
}
.tech-card .corner-tl { top: -2px; left: -2px; border-top: 1px solid rgba(0,200,255,0.3); border-left: 1px solid rgba(0,200,255,0.3); }
.tech-card .corner-tr { top: -2px; right: -2px; border-top: 1px solid rgba(0,200,255,0.3); border-right: 1px solid rgba(0,200,255,0.3); }
.tech-card .corner-bl { bottom: -2px; left: -2px; border-bottom: 1px solid rgba(0,200,255,0.3); border-left: 1px solid rgba(0,200,255,0.3); }
.tech-card .corner-br { bottom: -2px; right: -2px; border-bottom: 1px solid rgba(0,200,255,0.3); border-right: 1px solid rgba(0,200,255,0.3); }

/* ============================================
   12. STAT COUNTER — Mechanical Odometer
   ============================================ */
[data-countup] {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}
[data-countup].counting {
    animation: counter-tick 0.05s steps(1) 10;
}
@keyframes counter-tick {
    50% { opacity: 0.7; }
}

/* ============================================
   TERMINAL FORM — Blinking cursor per field
   ============================================ */
.term-cursor {
    display: none;
    width: 7px;
    height: 15px;
    background: #00ff41;
    animation: cursor-blink 0.7s step-end infinite;
    flex-shrink: 0;
}
.term-field.active .term-arrow {
    color: #28c840 !important;
}
.term-field.active .term-cursor {
    display: inline-block !important;
}
/* Hide native caret — our cursor replaces it */
.term-input {
    caret-color: transparent;
}
.term-input::placeholder {
    color: #48484a;
}

/* ============================================
   UTILITY: Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    [data-reveal] { opacity: 1; transform: none; }
}

/* Manual reduce-motion via SYS_CONFIG toggle */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}
.reduce-motion [data-reveal] { opacity: 1; transform: none; }
