/* ============================================
   HexCorp.io — Effects & New Sections
   Interactive features, animations, new layouts
   ============================================ */

/* ---- Circuit SVG Traces in Hero ---- */
.circuit-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}
.circuit-svg path {
    fill: none;
    stroke: var(--neon);
    stroke-width: 1.5;
    filter: url(#glow);
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawTrace 3s ease forwards;
    opacity: 0.4;
}
.circuit-svg circle {
    fill: var(--neon);
    opacity: 0;
    animation: nodeAppear 0.5s ease forwards;
}
@keyframes drawTrace {
    to { stroke-dashoffset: 0; }
}
@keyframes nodeAppear {
    to { opacity: 0.6; }
}

/* ---- Typing Effect ---- */
.typing-line {
    font-size: inherit;
    font-weight: inherit;
    color: var(--text-primary);
}
.typing-cursor {
    color: var(--neon);
    font-weight: 300;
    animation: blink 0.8s infinite;
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ---- Parallax (handled by JS, but ensure smooth) ---- */
.hero-bg-pattern {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ---- Theme Toggle ---- */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--neon);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.theme-toggle:hover {
    border-color: var(--neon);
    box-shadow: 0 0 15px var(--neon-dim);
    transform: rotate(180deg);
}
.theme-toggle-icon {
    transition: transform 0.3s;
}

/* ---- Light Theme Overrides ---- */
[data-theme="light"] {
    --bg-dark: #F0F2F8;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F8F9FC;
    --bg-surface: #E8ECF4;
    --bg-elevated: #FFFFFF;
    --border: rgba(26,58,143,0.15);
    --border-hover: rgba(26,58,143,0.35);
    --text-primary: #0F0F1A;
    --text-secondary: #374151;
    --text-muted: #6B7280;
    --shadow-glow: 0 0 30px rgba(26,58,143,0.08);
}
[data-theme="light"] body::before {
    background-image:
        linear-gradient(rgba(26,58,143,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26,58,143,0.06) 1px, transparent 1px),
        linear-gradient(rgba(26,58,143,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26,58,143,0.08) 1px, transparent 1px);
    background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
}
[data-theme="light"] .site-header {
    background: rgba(240,242,248,0.9);
}
[data-theme="light"] .site-header.scrolled {
    background: rgba(255,255,255,0.95);
}
[data-theme="light"] .site-footer {
    background: #0F0F1A;
}
[data-theme="light"] .terminal-body,
[data-theme="light"] .terminal-easter-egg {
    background: #0F0F1A;
    color: #8B9DC3;
}

/* ---- Interactive Chip Diagram ---- */
.chip-section {
    padding: 80px 0;
    overflow: hidden;
}
.chip-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}
.chip {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.chip-pins-top,
.chip-pins-bottom {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.chip-pins-top::before,
.chip-pins-top::after,
.chip-pins-bottom::before,
.chip-pins-bottom::after {
    content: '';
    display: block;
}
.chip-pins-top {
    padding: 0 40px;
    margin-bottom: -2px;
}
.chip-pins-bottom {
    padding: 0 40px;
    margin-top: -2px;
}
.chip-body {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 40px 60px;
    text-align: center;
    position: relative;
    min-width: 280px;
    transition: all 0.3s;
}
.chip-body:hover {
    border-color: var(--neon);
    box-shadow: 0 0 40px var(--neon-dim), inset 0 0 40px rgba(0,229,255,0.03);
}
.chip-label {
    font-family: var(--mono);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.1em;
}
.chip-sublabel {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--neon);
    letter-spacing: 0.2em;
    margin-top: 4px;
    margin-bottom: 24px;
}
.chip-connectors {
    display: flex;
    justify-content: space-between;
    gap: 40px;
}
.chip-connector {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s;
}
.chip-connector:hover .connector-label {
    color: var(--neon);
    text-shadow: 0 0 10px var(--neon-glow);
}
.chip-connector:hover .connector-line {
    background: var(--neon);
    box-shadow: 0 0 8px var(--neon-glow);
}
.connector-line {
    width: 40px;
    height: 2px;
    background: var(--border);
    transition: all 0.3s;
}
.connector-line.vertical {
    width: 2px;
    height: 30px;
    margin: 8px auto 0;
}
.connector-label {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s;
    white-space: nowrap;
}
.chip-connector.bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 8px;
}
/* Chip pin stubs */
.chip-body::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 30px;
    right: 30px;
    height: 12px;
    background: repeating-linear-gradient(90deg, var(--border) 0px, var(--border) 4px, transparent 4px, transparent 16px);
}
.chip-body::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 30px;
    right: 30px;
    height: 12px;
    background: repeating-linear-gradient(90deg, var(--border) 0px, var(--border) 4px, transparent 4px, transparent 16px);
}

/* ---- Product Card Flip ---- */
.product-card {
    perspective: 1000px;
    cursor: pointer;
}
.product-card-inner {
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
    position: relative;
}
.product-card.flipped .product-card-inner {
    transform: rotateY(180deg);
}
.product-card-front,
.product-card-back {
    backface-visibility: hidden;
}
.product-card-back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px;
    text-align: center;
}
.product-card-back h4 {
    color: var(--neon);
    font-family: var(--mono);
    font-size: 14px;
    margin-bottom: 12px;
}
.product-card-back p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}
.product-card-back .flip-hint {
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* ---- Project Status Board ---- */
.status-board {
    padding: 100px 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all 0.3s;
}
.status-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}
.status-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.status-card-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}
.status-badge {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    letter-spacing: 0.03em;
}
.status-dev {
    background: rgba(251,191,36,0.15);
    color: #FBBF24;
    border: 1px solid rgba(251,191,36,0.25);
}
.status-beta {
    background: rgba(0,229,255,0.1);
    color: var(--neon);
    border: 1px solid rgba(0,229,255,0.2);
}
.status-live {
    background: rgba(52,211,153,0.1);
    color: var(--trace-light);
    border: 1px solid var(--trace-glow);
}
.status-progress {
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}
.status-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--neon));
    border-radius: 3px;
    transition: width 1.5s ease;
    position: relative;
}
.status-progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(0,229,255,0.5));
    animation: progressPulse 2s ease-in-out infinite;
}
.status-progress-bar.beta {
    background: linear-gradient(90deg, var(--neon), var(--trace-light));
}
@keyframes progressPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}
.status-meta {
    display: flex;
    justify-content: space-between;
}
.status-meta-item {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- Tech Stack ---- */
.tech-stack {
    padding: 100px 0;
}
.stack-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
.stack-category {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    transition: all 0.3s;
}
.stack-category:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}
.stack-category-title {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--neon);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.stack-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stack-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}
.stack-item:hover {
    color: var(--text-primary);
}
.stack-icon {
    color: var(--primary-light);
    font-size: 14px;
    width: 20px;
    text-align: center;
}

/* ---- Build Activity Grid ---- */
.activity-section {
    padding: 100px 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.activity-wrapper {
    max-width: 900px;
    margin: 0 auto;
}
.activity-grid {
    display: grid;
    grid-template-columns: repeat(52, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 16px;
}
.activity-cell {
    width: 100%;
    aspect-ratio: 1;
    min-width: 8px;
    background: var(--neon);
    border-radius: 2px;
    opacity: 0.05;
    transition: all 0.2s;
}
.activity-cell:hover {
    transform: scale(1.8);
    opacity: 1 !important;
    box-shadow: 0 0 8px var(--neon-glow);
}
.activity-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}
.activity-legend .activity-cell {
    width: 12px;
    height: 12px;
    min-width: 12px;
    aspect-ratio: auto;
}
.activity-legend-label {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    margin: 0 4px;
}

/* ---- Founder Story (Terminal Style) ---- */
.founder {
    padding: 100px 0;
}
.founder-content {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 40px;
    align-items: start;
    max-width: 960px;
    margin: 0 auto;
}
.founder-terminal {
    background: #0B0E18;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
}
.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.terminal-dot.red { background: #EF4444; }
.terminal-dot.yellow { background: #FBBF24; }
.terminal-dot.green { background: #34D399; }
.terminal-title {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}
.terminal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    display: none;
}
.terminal-body {
    padding: 24px;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}
.terminal-prompt {
    color: var(--trace-light);
    font-weight: 700;
}
.terminal-cmd {
    color: var(--neon);
}
.terminal-signature {
    color: var(--accent-light);
    font-weight: 600;
}
.terminal-cursor-blink {
    color: var(--neon);
    animation: blink 0.8s infinite;
}
.founder-highlights {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 20px;
}

/* ---- Newsletter ---- */
.newsletter {
    padding: 80px 0;
}
.newsletter-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
}
.newsletter-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 12px 0 8px;
}
.newsletter-desc {
    font-size: 14px;
    color: var(--text-muted);
}
.newsletter-form {
    flex-shrink: 0;
}
.newsletter-input-group {
    display: flex;
    gap: 8px;
}
.newsletter-input-group input {
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    width: 260px;
    transition: border-color 0.2s;
}
.newsletter-input-group input:focus {
    outline: none;
    border-color: var(--neon);
    box-shadow: 0 0 0 3px var(--neon-dim);
}
.newsletter-input-group input::placeholder {
    color: var(--text-muted);
}
.newsletter-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    font-family: var(--mono);
}

/* ---- Easter Egg Terminal ---- */
.terminal-easter-egg {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 640px;
    background: #0B0E18;
    border: 1px solid var(--neon);
    border-radius: var(--radius-md);
    z-index: 15000;
    box-shadow: 0 0 40px var(--neon-dim), 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
    animation: terminalSlideUp 0.3s ease;
}
@keyframes terminalSlideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.terminal-easter-egg .terminal-close {
    display: block;
}
.terminal-output {
    padding: 16px 20px;
    max-height: 300px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.terminal-output p { margin-bottom: 4px; }
.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.3);
}
.terminal-input-line .terminal-prompt {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--trace-light);
    font-weight: 700;
    white-space: nowrap;
}
#terminal-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--neon);
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
    caret-color: var(--neon);
}

/* ---- Scroll Reveal Animation ---- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}
.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Responsive for new sections ---- */
@media (max-width: 1024px) {
    .stack-grid { grid-template-columns: repeat(2, 1fr); }
    .founder-content { grid-template-columns: 1fr; }
    .newsletter-box { flex-direction: column; text-align: center; }
    .newsletter-form { width: 100%; }
    .newsletter-input-group { justify-content: center; }
}

@media (max-width: 768px) {
    .status-grid { grid-template-columns: 1fr; }
    .stack-grid { grid-template-columns: 1fr 1fr; }
    .activity-grid { grid-template-columns: repeat(26, 1fr); }
    .chip-body { padding: 30px 40px; min-width: 220px; }
    .chip-connectors { gap: 20px; }
    .connector-line { width: 24px; }
    .newsletter-input-group { flex-direction: column; }
    .newsletter-input-group input { width: 100%; }
}

@media (max-width: 480px) {
    .stack-grid { grid-template-columns: 1fr; }
    .activity-grid { grid-template-columns: repeat(13, 1fr); }
}
