/* ============================================================================
   Global Styles & Reset
   ============================================================================ */

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

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-terminal: #0d1117;
    --text-primary: #e6e6e6;
    --text-secondary: #8b949e;
    --accent-green: #3fb950;
    --accent-blue: #58a6ff;
    --accent-purple: #bc8cff;
    --accent-red: #ff6b6b;
    --accent-yellow: #f0c674;
    --border-color: #30363d;
    --shadow: rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Segoe UI', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    font-size: 16px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* ============================================================================
   Header
   ============================================================================ */

header {
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px var(--shadow);
}

.terminal-header {
    background: var(--bg-secondary);
    padding: 10px 15px;
    display: flex;
    gap: 8px;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red {
    background: var(--accent-red);
}

.terminal-dot.yellow {
    background: var(--accent-yellow);
}

.terminal-dot.green {
    background: var(--accent-green);
}

.header-content {
    padding: 40px 30px;
    text-align: center;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--accent-green);
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.location {
    font-size: clamp(0.85rem, 2vw, 1rem);
    color: var(--text-secondary);
    margin-top: 10px;
}

/* Glitch Effect */
.glitch {
    position: relative;
    animation: glitch-skew 1s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent-red);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: 2px 0 var(--accent-blue);
    animation: glitch-anim2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip-path: inset(40% 0 61% 0); }
    20% { clip-path: inset(92% 0 1% 0); }
    40% { clip-path: inset(43% 0 1% 0); }
    60% { clip-path: inset(25% 0 58% 0); }
    80% { clip-path: inset(54% 0 7% 0); }
    100% { clip-path: inset(58% 0 43% 0); }
}

@keyframes glitch-anim2 {
    0% { clip-path: inset(25% 0 58% 0); }
    20% { clip-path: inset(54% 0 7% 0); }
    40% { clip-path: inset(58% 0 43% 0); }
    60% { clip-path: inset(40% 0 61% 0); }
    80% { clip-path: inset(92% 0 1% 0); }
    100% { clip-path: inset(43% 0 1% 0); }
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    10% { transform: skew(-2deg); }
    20% { transform: skew(2deg); }
    30% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

/* ============================================================================
   Sections
   ============================================================================ */

section {
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
}

.terminal-prompt {
    background: var(--bg-secondary);
    padding: 12px 20px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    border-bottom: 1px solid var(--border-color);
}

.prompt-symbol {
    color: var(--accent-green);
    margin-right: 8px;
}

.prompt-text {
    color: var(--accent-blue);
}

.terminal-output {
    padding: 25px;
}

.terminal-output p {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.terminal-output p:last-child {
    margin-bottom: 0;
}

.terminal-output h3 {
    color: var(--accent-green);
    margin-bottom: 20px;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.terminal-output h4 {
    color: var(--accent-blue);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--accent-green);
    white-space: nowrap;
    animation: typing 3.5s steps(50, end), blink-caret 0.75s step-end infinite;
    display: inline-block;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    color: var(--accent-green);
    max-width: 100%;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-green); }
}

/* ============================================================================
   Expertise Grid
   ============================================================================ */

.expertise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.expertise-item {
    padding: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.expertise-item:hover {
    border-color: var(--accent-blue);
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.2);
}

.expertise-item h3 {
    color: var(--accent-green);
    margin-bottom: 12px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.expertise-item p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

/* ============================================================================
   Skills Grid
   ============================================================================ */

.skills-category {
    margin-bottom: 30px;
}

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

.skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.skill-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    min-height: 50px;
}

.skill-item:hover {
    border-color: var(--accent-green);
    transform: translateX(5px);
    box-shadow: 0 0 20px rgba(63, 185, 80, 0.2);
}

.skill-icon {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    flex-shrink: 0;
}

.skill-name {
    color: var(--text-primary);
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

/* ============================================================================
   Philosophy List
   ============================================================================ */

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

.philosophy-list li {
    margin-bottom: 15px;
    padding-left: 30px;
    position: relative;
    color: var(--text-primary);
    line-height: 1.8;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.philosophy-list li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent-green);
    font-size: 1.2rem;
}

.philosophy-list li strong {
    color: var(--accent-blue);
}

/* ============================================================================
   Contact Grid
   ============================================================================ */

.contact-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.contact-link:hover {
    border-color: var(--accent-blue);
    transform: translateX(10px);
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.2);
}

.contact-icon {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.contact-text {
    font-size: clamp(0.85rem, 2vw, 1rem);
    word-break: break-all;
}

/* ============================================================================
   Quote Section
   ============================================================================ */

blockquote {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-style: italic;
    color: var(--accent-purple);
    text-align: center;
    padding: 20px;
    border-left: 4px solid var(--accent-purple);
    padding-left: 25px;
    font-family: 'Georgia', serif;
    line-height: 1.8;
}

/* ============================================================================
   Footer
   ============================================================================ */

footer {
    margin-top: 40px;
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    margin-top: 15px;
}

.footer-content p {
    color: var(--text-secondary);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    margin-bottom: 10px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-green);
}

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

/* ============================================================================
   Matrix Background Animation
   ============================================================================ */

.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.05;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--accent-green) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: matrix-scan 10s linear infinite;
}

@keyframes matrix-scan {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

/* Tablet landscape and desktop */
@media (min-width: 769px) {
    .container {
        padding: 40px 20px;
    }

    .header-content {
        padding: 60px 40px;
    }

    .terminal-output {
        padding: 30px;
    }
}

/* Tablet portrait */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header-content {
        padding: 30px 20px;
    }

    .terminal-output {
        padding: 20px;
    }

    .terminal-prompt {
        padding: 10px 15px;
    }

    .expertise-grid {
        grid-template-columns: 1fr;
    }

    .skill-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }

    .contact-link {
        padding: 12px 15px;
    }

    blockquote {
        padding: 15px;
        padding-left: 20px;
    }

    .philosophy-list li {
        padding-left: 25px;
        margin-bottom: 12px;
    }
}

/* Mobile landscape */
@media (max-width: 640px) {
    .header-content {
        padding: 25px 15px;
    }

    .skill-grid {
        grid-template-columns: 1fr;
    }

    .expertise-grid {
        gap: 15px;
    }

    .expertise-item {
        padding: 15px;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    section {
        margin-bottom: 15px;
    }

    .header-content {
        padding: 20px 15px;
    }

    .terminal-output {
        padding: 15px;
    }

    .terminal-prompt {
        padding: 8px 12px;
    }

    .skill-item {
        padding: 10px 12px;
        min-height: 45px;
    }

    .contact-link {
        padding: 12px;
        gap: 12px;
    }

    .contact-text {
        word-break: break-word;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }

    .separator {
        display: none;
    }

    blockquote {
        padding: 12px;
        padding-left: 15px;
    }

    .philosophy-list li {
        padding-left: 20px;
        margin-bottom: 10px;
        font-size: 0.9rem;
    }
}

/* Very small mobile devices */
@media (max-width: 360px) {
    .container {
        padding: 8px;
    }

    .terminal-output {
        padding: 12px;
    }

    .expertise-item {
        padding: 12px;
    }

    .skill-item {
        padding: 8px 10px;
    }
}

/* ============================================================================
   Landscape orientation on mobile
   ============================================================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .header-content {
        padding: 20px;
    }

    section {
        margin-bottom: 15px;
    }

    .terminal-output {
        padding: 15px;
    }
}

/* ============================================================================
   Interactive Terminal
   ============================================================================ */

.interactive-terminal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 600px;
    max-width: calc(100vw - 40px);
    max-height: 400px;
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.interactive-terminal .terminal-header {
    background: var(--bg-secondary);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: grab;
    user-select: none;
}

.interactive-terminal .terminal-header:active {
    cursor: grabbing;
}

.terminal-controls {
    display: flex;
    gap: 8px;
}

.terminal-controls .terminal-dot {
    cursor: pointer;
    transition: all 0.2s ease;
}

.terminal-controls .terminal-dot:hover {
    transform: scale(1.2);
    opacity: 0.8;
}

.terminal-controls .terminal-dot.red:hover {
    box-shadow: 0 0 8px var(--accent-red);
}

.terminal-controls .terminal-dot.yellow:hover {
    box-shadow: 0 0 8px var(--accent-yellow);
}

.terminal-controls .terminal-dot.green:hover {
    box-shadow: 0 0 8px var(--accent-green);
}

.terminal-title {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
    text-align: center;
}

.drag-indicator {
    color: var(--text-secondary);
    font-size: 1rem;
    opacity: 0.5;
    cursor: grab;
    margin-left: auto;
}

.drag-indicator:active {
    cursor: grabbing;
}

.terminal-body {
    padding: 15px;
    height: 350px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.terminal-line {
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.terminal-line.command {
    color: var(--accent-green);
}

.terminal-line.output {
    color: var(--text-primary);
}

.terminal-line.error {
    color: var(--accent-red);
}

.terminal-info {
    color: var(--accent-blue);
    font-style: italic;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    caret-color: var(--accent-green);
}

.terminal-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.reopen-terminal-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--bg-terminal);
    border: 1px solid var(--accent-green);
    border-radius: 8px;
    color: var(--accent-green);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.reopen-terminal-btn:hover {
    background: var(--bg-secondary);
    box-shadow: 0 0 20px rgba(63, 185, 80, 0.4);
    transform: translateY(-2px);
}

/* Terminal animations */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Custom scrollbar for terminal */
.terminal-body::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.terminal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-green);
}

/* Minimized state */
.interactive-terminal.minimized {
    max-height: 40px !important;
    height: auto !important;
}

.interactive-terminal.minimized .terminal-body {
    display: none;
}

/* Maximized state */
.interactive-terminal.maximized {
    width: calc(100vw - 40px) !important;
    height: 80vh !important;
    max-width: none !important;
    left: 20px !important;
    top: 10vh !important;
    right: auto !important;
    bottom: auto !important;
}

.interactive-terminal.maximized .terminal-body {
    height: calc(80vh - 50px) !important;
}

/* Mobile adjustments for terminal */
@media (max-width: 768px) {
    .interactive-terminal {
        bottom: 10px;
        right: 10px;
        left: auto !important;
        top: auto !important;
        width: calc(100vw - 20px);
        max-height: 300px;
    }

    .interactive-terminal .terminal-header {
        cursor: default;
    }

    .drag-indicator {
        display: none;
    }

    .terminal-body {
        height: 250px;
        padding: 12px;
        font-size: 0.85rem;
    }

    .interactive-terminal.maximized {
        left: 10px !important;
        top: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 100px) !important;
    }

    .interactive-terminal.maximized .terminal-body {
        height: calc(100vh - 150px) !important;
    }

    .reopen-terminal-btn {
        bottom: 10px;
        right: 10px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .interactive-terminal {
        bottom: 5px;
        right: 5px;
        width: calc(100vw - 10px);
        max-height: 250px;
    }

    .terminal-body {
        height: 200px;
        padding: 10px;
        font-size: 0.8rem;
    }

    .terminal-input {
        font-size: 0.8rem;
    }

    .reopen-terminal-btn {
        bottom: 5px;
        right: 5px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {
    body {
        background: white;
        color: black;
    }

    .matrix-bg,
    .interactive-terminal,
    .reopen-terminal-btn {
        display: none;
    }

    .glitch::before,
    .glitch::after {
        display: none;
    }

    section,
    header {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .contact-link:hover,
    .skill-item:hover,
    .expertise-item:hover {
        transform: none;
        box-shadow: none;
    }
}
