/* Portfolio System - Consolidated Styles */

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

:root {
    --bg-color: #f5f3f0;
    --node-bg: #ffffff;
    --node-border: #1a1a1a;
    --text-color: #1a1a1a;
    --accent-orange: #f39c12;
    --dot-color: rgba(26, 26, 26, 0.15);
    --grid-size: 20px;
}

body {
    font-family: "Courier New", Courier, monospace;
    background-color: var(--bg-color);
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* Dot grid background */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(
        circle,
        var(--dot-color) 1px,
        transparent 1px
    );
    background-size: var(--grid-size) var(--grid-size);
    pointer-events: none;
    z-index: 0;
}

/* Canvas container */
.canvas-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* View mode toggle button (left) */
.view-mode-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 36px;
    height: 36px;
    background: var(--node-bg);
    border: 3px solid var(--node-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.view-mode-toggle:hover {
    background: var(--accent-orange);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.view-mode-toggle:active {
    transform: scale(0.95);
}

.view-mode-toggle svg {
    color: var(--text-color);
}

/* Home button (right of chain button) */
.home-btn {
    position: fixed;
    bottom: 20px;
    left: 90px;
    width: 50px;
    height: 50px;
    background: var(--node-bg);
    border: 3px solid var(--node-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.home-btn:hover {
    background: var(--accent-orange);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.home-btn:active {
    transform: scale(0.95);
}

.home-btn svg {
    color: var(--text-color);
}

.help-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--node-bg);
    border: 3px solid var(--node-border);
    border-radius: 25px;
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.help-btn:hover {
    background: var(--accent-orange);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.help-btn:active {
    transform: scale(0.95);
}

/* Rejection message */
.rejection-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Courier New", Courier, monospace;
    font-size: clamp(24px, 8vw, 72px);
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #e74c3c;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
    word-wrap: break-word;
    white-space: normal;
}

.rejection-message.show {
    opacity: 1;
}

.canvas-workspace {
    width: 100%;
    height: 100%;
    position: relative;
    transform-origin: 0 0;
    z-index: 5;
}

/* SVG connections layer */
.connections-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.connection {
    stroke: var(--node-border);
    stroke-width: 3;
    fill: none;
}

/* Base node styles */
.node {
    background: var(--node-bg);
    border: 3px solid var(--node-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    position: absolute;
    cursor: grab;
    transition: box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.node:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.node:active {
    cursor: grabbing;
}

/* Connection ports */
.connection-port {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--node-border);
    border-radius: 50%;
    z-index: 10;
}

.connection-port.input {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
}

.connection-port.output {
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
}

/* Close button */
.close-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-color);
    transition: background 0.2s ease;
    z-index: 20;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Node content */
.node-content {
    padding: 0px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Remove padding for Work node content */
#work .node-content {
    padding: 0;
}

#work .node-grid {
    padding: 0;
}

#work .node-list-item {
    padding-left: 0;
    padding-right: 0;
}

/* Node grid (for Work/Info/Contact and categories) */
.node-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
}

.node-item {
    background: var(--node-bg);
    border: 2px solid var(--node-border);
    border-radius: 8px;
    padding: 16px 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.node-item:hover {
    background: var(--accent-orange);
    transform: translateY(-2px);
}

/* Back button styling */
.node-item-back {
    background: var(--accent-orange) !important;
}

.node-list-item-back {
    background: var(--accent-orange);
    font-weight: 700;
    justify-content: flex-start;
    padding-left: 12px;
    border-bottom: 2px solid var(--node-border) !important;
    border-radius: 9px 9px 0 0;
    cursor: grab;
}

.node-list-item-back:active {
    cursor: grabbing;
}

.back-arrow {
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    margin: -8px -12px;
    display: inline-block;
    transition: transform 0.2s ease;
}

.back-arrow:hover {
    transform: scale(1.2);
}

/* Node list container - wrapper for back button + scrollable list */
.node-list-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Node list (scrollable items) */
.node-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
}

.node-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(26, 26, 26, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.node-list-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.node-list-item.selected {
    background: var(--accent-orange);
}

.item-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--node-border);
}

.item-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    flex: 1;
}

/* Tool node */
.tool-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    padding-right: 32px; /* Account for close button to keep text centered */
}

/* Viewer node */
.viewer-node {
    width: auto !important;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Lock width during drag to prevent scaling */
.viewer-node.dragging {
    width: var(--drag-width) !important;
}

/* Viewer content fills available space */
.viewer-node .viewer-content {
    flex: 1;
    min-height: 0;
}

/* Resize handle */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30px;
    height: 30px;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--node-border);
    opacity: 0.4;
    transition: opacity 0.2s ease;
    z-index: 100;
    user-select: none;
    pointer-events: auto;
}

.resize-handle:hover {
    opacity: 1;
}

/* Hide resize handle in simplified mode */
.view-mode-simplified .resize-handle {
    display: none;
}

/* Simplified view mode */
.view-mode-simplified {
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    height: 100vh !important;
    position: relative !important;
}

.view-mode-simplified .canvas-workspace {
    position: relative !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    padding: 20px 0 40px 0; /* Top 20px, bottom 40px, sides 0 (nodes handle their own) */
}

.view-mode-simplified .node {
    cursor: default !important;
    pointer-events: none !important;
    position: absolute !important;
}

.view-mode-simplified .viewer-node {
    margin-bottom: 40px; /* Add visible spacing below viewer */
}

/* Smooth transitions only during mode switch */
.node.mode-transitioning {
    transition:
        left 0.5s ease-in-out,
        top 0.5s ease-in-out,
        width 0.5s ease-in-out,
        margin 0.5s ease-in-out !important;
}

.view-mode-simplified .node * {
    pointer-events: auto;
}

.view-mode-simplified .connection-port {
    display: none;
}

.view-mode-simplified .tool-emblem {
    display: none !important;
}

.view-mode-simplified .connections-svg {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
}

.viewer-content {
    width: 100%;
    background: #e8e6e3;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 9px 9px 0 0;
}

.view-mode-simplified .viewer-content {
    min-height: 300px;
    /* No max-height - let images display at full size */
    overflow: hidden; /* Never show scrollbars, content scales to fit */
}

.view-mode-full .viewer-content {
    min-height: 450px;
    overflow: hidden; /* Never show scrollbars, content scales to fit */
}

.viewer-image {
    max-width: 100%;
    width: 100%; /* Fill width in simplified mode */
    height: auto; /* Maintain aspect ratio */
    object-fit: contain;
}

.view-mode-full .viewer-image {
    width: auto; /* In full mode, don't force width */
    max-height: 100%;
}

.viewer-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-width: 1920px;
    max-height: 1080px;
}

.canvas-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-container canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.viewer-empty {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-color);
    opacity: 0.3;
    padding: 40px;
}

.viewer-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.canvas-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-container canvas {
    display: block !important;
    max-width: 100%;
    width: 100%; /* Fill width in simplified mode */
    height: auto; /* Maintain aspect ratio */
}

.view-mode-full .canvas-container canvas {
    width: auto; /* In full mode, don't force width */
    max-height: 100%;
}

/* Viewer bottom bar */
.viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 20px;
    background: var(--accent-orange);
    border-top: 3px solid var(--node-border);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 0 0 9px 9px;
}

.viewer-icon {
    font-size: 20px;
}

/* Static pages */
.static-page {
    padding: 40px;
    text-align: center;
}

.static-page h2 {
    font-size: 24px;
    margin-bottom: 20px;
    letter-spacing: 0.1em;
}

.static-page p {
    font-size: 14px;
    line-height: 1.6;
}

/* Loading/empty states */
.node-loading,
.node-empty {
    padding: 20px;
    text-align: center;
    font-size: 14px;
    opacity: 0.5;
}

/* Scrollbar styling */
.node-list::-webkit-scrollbar {
    width: 8px;
}

.node-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.node-list::-webkit-scrollbar-thumb {
    background: var(--node-border);
    border-radius: 4px;
}

.node-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-orange);
}

/* Tool emblem (connection line button) */
.tool-emblem {
    position: absolute;
    cursor: pointer;
    z-index: 100;
    pointer-events: auto;
}

.emblem-trigger {
    width: 40px;
    height: 40px;
    background: var(--accent-orange);
    border: 3px solid var(--node-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    transition: transform 0.2s ease;
    pointer-events: auto;
    cursor: pointer;
}

.emblem-trigger:hover {
    transform: scale(1.1);
}

.emblem-menu {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    transform-origin: top center;
    background: var(--node-bg);
    border: 3px solid var(--node-border);
    border-radius: 8px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
    pointer-events: auto;
    min-width: 120px;
    white-space: nowrap;
}

.tool-emblem:hover .emblem-menu {
    opacity: 1;
    visibility: visible;
    display: flex;
}

.emblem-option {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.emblem-option:hover {
    background: var(--accent-orange);
}

.emblem-option.active {
    background: var(--accent-orange);
}

/* Carousel navigation */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid var(--node-border);
    border-radius: 50%;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.carousel-nav:hover:not(:disabled) {
    background: var(--accent-orange);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.carousel-nav:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

.carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(200, 200, 200, 0.5);
}

.carousel-prev {
    left: 16px;
}

.carousel-next {
    right: 16px;
}

/* Info overlay */
.info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.info-content {
    background: var(--node-bg);
    border: 3px solid var(--node-border);
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
}

.info-content h3 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
    text-align: center;
}

.info-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 12px;
}

.info-label {
    font-weight: 700;
    letter-spacing: 0.1em;
    min-width: 80px;
}

.info-value {
    word-break: break-all;
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    :root {
        --grid-size: 15px;
    }

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