/* --- Geocities Retro Styles & Variables --- */
:root {
    --bg-color: #000000;
    --text-primary: #00ff00; /* Green phosphor look */
    --text-secondary: #00ffff; /* Cyan secondary text */
    --accent-yellow: #ffff00;
    --accent-magenta: #ff00ff;
    --accent-cyan: #00ffff;
    --accent-red: #ff0000;
    --accent-orange: #ffaa00;
    --accent-green: #00e673;
    --accent-gray: #888888;
    --win-gray: #c0c0c0;
    --win-dark-gray: #808080;
    --font-retro: "Comic Sans MS", "Arial", sans-serif;
    --font-serif: "Times New Roman", Times, serif;
    --font-mono: "Courier New", monospace;
}

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

body {
    background-color: var(--bg-color);
    /* Starry sky repeating tile background */
    background-image: 
      radial-gradient(1.5px 1.5px at 20px 30px, #eee, transparent),
      radial-gradient(1.5px 1.5px at 40px 70px, #fff, transparent),
      radial-gradient(2px 2px at 90px 10px, #ddd, transparent);
    background-size: 120px 120px;
    color: var(--text-primary);
    font-family: var(--font-retro);
    line-height: 1.5;
    padding: 20px;
    width: 80vw;
    margin: 0 auto;
    overflow-x: hidden;
}

/* --- Header Section --- */
header {
    text-align: center;
    padding: 30px 10px;
    margin-bottom: 30px;
    border-bottom: 3px double var(--win-gray);
}

.header-container {
    max-width: 900px;
    margin: 0 auto;
}

.badge {
    background-color: var(--accent-yellow);
    color: #000000;
    border: 2px inset #ffffff;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 15px;
}

header h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    color: var(--accent-magenta);
    text-shadow: 2px 2px 0px var(--accent-cyan);
    margin-bottom: 12px;
    font-weight: bold;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 650px;
    margin: 0 auto;
}

/* --- Container & Layout --- */
.container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* --- 3D Retro Cards --- */
.retro-panel {
    background-color: #000000;
    border: 3px outset var(--win-gray);
    padding: 25px;
    box-shadow: 3px 3px 0px rgba(255, 255, 255, 0.15);
    border-radius: 0;
    transition: none;
}

.retro-panel:hover {
    border-color: var(--win-gray);
    box-shadow: 3px 3px 0px rgba(255, 255, 255, 0.15);
}

.retro-subpanel {
    background-color: #000000;
    border: 2px inset var(--win-gray);
    padding: 20px;
    border-radius: 0;
    margin-top: 15px;
}

/* Section Headings */
h2.section-title {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    color: var(--accent-yellow);
    margin-bottom: 10px;
    text-decoration: underline;
}

.card-desc {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

/* --- Interactive Simulator Layout --- */
.sim-grid {
    display: grid;
    grid-template-columns: 1fr 120px 1fr;
    gap: 20px;
    align-items: center;
}

.sim-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 340px;
    justify-content: space-between;
    min-width: 0;
}

.sim-node h3 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--accent-magenta);
    margin-bottom: 10px;
    text-decoration: underline;
}

/* Ring display */
.energy-display {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #050505;
    border: 2px inset var(--win-gray);
    margin-bottom: 15px;
}

.progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(-90deg);
}

.progress-ring-circle {
    stroke: var(--accent-magenta) !important;
    transition: stroke-dashoffset 0.1s linear;
}

.energy-text {
    font-size: 1.8rem;
    font-weight: bold;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Kinetic Charge Pad (Styled like a classic Win95 button) */
.charge-pad {
    width: 100%;
    height: 90px;
    background-color: var(--win-gray);
    color: #000000;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-bottom: 2px solid var(--win-dark-gray);
    border-right: 2px solid var(--win-dark-gray);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    user-select: none;
    touch-action: none;
    padding: 10px;
    box-shadow: none;
    transition: none;
}

.charge-pad:hover {
    background-color: #d0d0d0;
    border-color: #ffffff #ffffff var(--win-dark-gray) var(--win-dark-gray);
    box-shadow: none;
}

.charge-pad.charging {
    background-color: #b0b0b0;
    border-top: 2px solid var(--win-dark-gray);
    border-left: 2px solid var(--win-dark-gray);
    border-bottom: 2px solid #ffffff;
    border-right: 2px solid #ffffff;
    box-shadow: none;
}

/* Status Indicators */
.status-indicator {
    display: flex;
    gap: 10px;
    font-size: 0.9rem;
    margin-top: 10px;
    align-items: center;
}

.status-label {
    color: var(--text-secondary);
}

.status-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: bold;
    background-color: #111;
    border: 1px inset var(--win-gray);
    padding: 2px 8px;
    display: inline-block;
}

.motor-off {
    color: #888;
}

.motor-pulse {
    color: var(--accent-red);
    animation: textPulse 0.4s infinite alternate;
}

.motor-shimmer {
    color: var(--accent-magenta);
    animation: textPulse 0.15s infinite alternate;
}

/* --- ESP-NOW Signal Bridge --- */
.sim-bridge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    min-width: 0;
}

.esp-now-signals {
    position: relative;
    width: 60px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wave {
    position: absolute;
    border: 3px solid transparent;
    border-right-color: var(--accent-cyan);
    border-radius: 50%;
    transform: rotate(-45deg);
    animation: signalWave 1.5s infinite linear;
    opacity: 0;
}

.wave-1 {
    width: 20px;
    height: 20px;
    animation-delay: 0s;
}

.wave-2 {
    width: 40px;
    height: 40px;
    animation-delay: 0.5s;
}

.wave-3 {
    width: 60px;
    height: 60px;
    animation-delay: 1s;
}

.protocol-badge {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: #000000;
    background-color: var(--win-gray);
    border: 2px inset #ffffff;
    padding: 4px 8px;
    white-space: nowrap;
    border-radius: 0;
}

/* --- Follower Visual Strip --- */
.follower-strip-container {
    width: 100%;
    background-color: #000000;
    border: 3px inset var(--win-gray);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    border-radius: 0;
}

.led-strip {
    display: flex;
    gap: 4px;
    width: 100%;
    justify-content: space-between;
}

.led-pixel {
    flex: 1;
    height: 22px;
    background-color: #111111;
    border: 1px solid #333333;
    border-radius: 0;
    transition: background 0.15s, box-shadow 0.15s;
}

.status-indicator-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    align-items: center;
}

.font-mono {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}

/* --- Technical Details Layout --- */
.info-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
}

.info-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
    min-width: 0;
}

.text-block h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--accent-yellow);
    border-left: none;
    padding-left: 0;
    text-decoration: underline;
}

.text-block h3 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--accent-magenta);
    text-decoration: underline;
}

.text-block p {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.code-math {
    background-color: #050505;
    border: 2px inset var(--win-gray);
    padding: 12px 18px;
    margin: 15px 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow-x: auto;
    border-radius: 0;
}

/* --- Table Styles --- */
.table-panel h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: var(--accent-yellow);
    text-decoration: underline;
}

.table-panel .subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.table-panel h3 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--accent-magenta);
    text-decoration: underline;
}

.table-spacing {
    margin-top: 30px;
}

.table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pinout-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
    min-width: 400px;
    border: 2px solid var(--win-gray);
}

.pinout-table th {
    background-color: #000080; /* Netscape Blue Header */
    color: #ffffff;
    font-weight: bold;
    padding: 10px 12px;
    border: 1px solid var(--win-gray);
}

.pinout-table td {
    padding: 12px;
    border: 1px solid var(--win-gray);
    color: var(--text-primary);
    background-color: #000000;
}

.pinout-table th:nth-child(2),
.pinout-table td:nth-child(2),
.pinout-table th:nth-child(3),
.pinout-table td:nth-child(3),
.pinout-table th:nth-child(4),
.pinout-table td:nth-child(4) {
    text-align: center;
}

.pinout-table code {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    background-color: #111;
    border: 1px inset var(--win-gray);
    padding: 2px 6px;
}

/* Badge Chips for pins */
.pin-badge {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 3px 8px;
    text-transform: uppercase;
    border: 1px solid currentColor;
    display: inline-block;
}

.pin-sda { color: var(--accent-cyan); }
.pin-scl { color: var(--accent-yellow); }
.pin-gnd { color: var(--accent-gray); }
.pin-int { color: var(--accent-magenta); }
.pin-led { color: var(--accent-red); }
.pin-motor { color: var(--accent-orange); }
.pin-vcc { color: var(--accent-green); }

/* --- Retro Lists & Links --- */
.retro-list {
    margin-left: 20px;
    margin-bottom: 15px;
}

.retro-list li {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.geo-link {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.geo-link:hover {
    color: var(--accent-magenta);
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 3px double var(--win-gray);
    margin-top: 40px;
}

/* --- Animations --- */
@keyframes textPulse {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

@keyframes signalWave {
    0% {
        transform: rotate(-45deg) scale(0.6);
        opacity: 0;
    }
    30% {
        opacity: 0.8;
    }
    100% {
        transform: rotate(-45deg) scale(1.6);
        opacity: 0;
    }
}

/* --- Responsive Adjustments & Mobile Friendliness --- */
@media(max-width: 900px) {
    body {
        width: 95vw;
        max-width: 100vw;
        padding: 10px;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    .container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .retro-panel {
        padding: 15px;
        max-width: 100%;
        box-sizing: border-box;
    }
    .retro-subpanel {
        padding: 10px;
        max-width: 100%;
        box-sizing: border-box;
    }
    .sim-grid {
        grid-template-columns: 1fr 30px 1fr;
        gap: 5px;
        width: 100%;
        box-sizing: border-box;
    }
    .sim-node {
        min-height: auto;
        padding: 10px 4px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    .sim-node h3 {
        font-size: 0.85rem;
    }
    .energy-display {
        width: 70px;
        height: 70px;
        margin-bottom: 5px;
    }
    .progress-ring {
        width: 70px;
        height: 70px;
    }
    .energy-text {
        font-size: 1.1rem;
    }
    .sim-bridge {
        padding: 0;
        width: 30px;
        overflow: hidden;
    }
    .protocol-badge {
        display: none;
    }
    .esp-now-signals {
        width: 30px;
    }
    .follower-strip-container {
        padding: 6px 3px;
        margin: 8px 0;
        width: 100%;
        box-sizing: border-box;
    }
    .led-strip {
        gap: 1px;
    }
    .led-pixel {
        height: 12px;
        min-width: 1px;
    }
    .status-indicator {
        font-size: 0.72rem;
        gap: 2px;
        flex-direction: column;
        align-items: center;
    }
    .status-value {
        font-size: 0.72rem;
        padding: 1px 2px;
    }
    .info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 100%;
        box-sizing: border-box;
    }
    .pinout-table {
        min-width: 280px;
        font-size: 0.8rem;
    }
    .pinout-table th, .pinout-table td {
        padding: 6px 8px; /* Reduce cell padding to save space on mobile */
    }
}
