/* ==========================================================================
   POLLYGRID
   - Draggable grid system with responsive design
   - Custom theming through CSS variables
   - Window-style components with controls
   ========================================================================== */

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

/* Custom Font Definition */
@font-face {
    font-family: telegrama;
    src: url('telegrama_raw.otf');
}
/* Theme Variables */
:root {
    --color-background: #161b22;    /* Main background color */
    --color-pattern: #ffffff;       /* Pattern and accent elements */
    --color-container: #0d1117;     /* Container backgrounds */
    --color-header: #ff00ff;        /* Header backgrounds */
    --color-border: #003449;        /* Borders and highlights */
    --color-shadow:  0 -2px 10px rgba(255, 0, 255, 0.3),
        inset 0 0 0 1px rgba(0, 255, 255, 0.2); /* Shadow effects */
    --color-text: #00ffff;             /* Main text color */
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Base Body Styles */
body {
    font-family: telegrama;
    min-height: 100vh;
    background-image: url("https://sadhost.neocities.org/images/tiles/stars5.gif");
    opacity: 1;
}

h1 {
    font-size: large;
    text-align: left;
    margin-left: 10px;
}

h3 {
    text-align: center;
    padding: 10px;
}

p {
    font-size: small;
}

/* Base Images */
img {
    max-width: 100%;
    height: auto;
}

img.profile {
    border-radius: 50%;
    width: 150px;
    height: 150px;
    object-fit: cover;
}

/* ==========================================================================
   LAYOUT COMPONENTS
   ========================================================================== */

/* Base Container */
.page-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: clamp(0.25rem, 2vw, 2rem);
    position: relative;
    overflow-x: hidden;
    padding-bottom: calc(55px + clamp(0.25rem, 2vw, 2rem)) !important;
}

.content-wrapper {
    display: flex;
    gap: clamp(1rem, 2vw, 2rem);   
    width: 100%;
    max-width: 1600px;          
    margin: 0 auto;                 
    min-height: calc(100vh - 35px);
    padding: 0 1rem;   
}

footer p {
    color: var(--color-text);
    background-color: rgba(0, 255, 255, 0.1);
    text-align: center;
}

/* Main Content */
.main-windows {
    flex-grow: 1;
    max-width: 1400px;
    width: 100%;                
    padding-bottom: 35px;
}

/* Image Gallery */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.image-gallery img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

/* ==========================================================================
   LINK STYLES
   ========================================================================== */

a {
    color: var(--color-text);
    text-decoration: none;
    position: relative;
    transition: all 0.2s ease;
}

a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--color-background);
    transition: width 0.3s ease;
}

a:hover {
    color: var(--color-text)
}

a:hover::after {
    width: 100%;
}

a:active {
    transform: translateY(1px);
}

.link-button {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--color-container);
    border: 2px solid var(--color-border);
    color: var(--color-text);
    font-family: basiic;
    box-shadow: 4px 4px var(--color-shadow);
    transition: all 0.2s ease;
}

.link-button:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px var(--color-shadow);
    color: var(--color-text);
}

.link-button::after {
    display: none;
}

/* ==========================================================================
   WINDOW CONTROLS
   ========================================================================== */

.window-controls {
    display: flex;
    gap: 2px;
}

.window-button {
    display: flex;
    height: 15px;
    width: 15px;
    margin-top: 5px;
    margin-right: 5px;
    padding-bottom: 2.5px;
    background-color: var(--color-header);
    border: 2px solid var(--color-border);
    color: black;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.item .window-controls {
    display: flex;
    gap: 2px;
}

.item .window-button {
    height: 12px;
    width: 12px;
    margin-top: 2px;
    margin-right: 4px;
    padding-bottom: 2px;
    font-size: 10px;
}

.window-button.minimize {
    padding-top: 6px;
}

.window-button.maximize {
    font-size: 8px;
    padding-top: 2px;
}

.window-button.close {
    padding-top: 2px;
}

.header-title {
    font-weight: 500;
    margin-left: 5px;
    margin-top: 1px;
    padding-top: 4px;
}

/* ==========================================================================
   SIDEBAR STYLES
   ========================================================================== */

.subwindows-wrapper {
    position: relative;            
    width: 240px;
    flex-shrink: 0;  
}

.sidebar {
    background-color: var(--color-container);
    padding: 10px;
    height: fit-content;
    position: sticky;
    top: 1.5rem;
    box-shadow: 4px 4px var(--color-shadow);
    border: 2px solid var(--color-border);
}

.sidebar-header {
    display: flex;
    background-color: var(--color-header);
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border: 2px solid var(--color-border);
}

.sidebar-item-content {
    background-color: var(--color-header);
    margin: 0.5rem 0;
    border: 2px solid var(--color-border);
    padding: 0;
}

.sidebar-item-content ul {
    list-style: none;
    width: 100%;
    padding: 0;
    margin: 0;
}

.sidebar-item-content li {
    margin: 0;
    position: relative;
    border-bottom: 1px solid var(--color-border);
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-item-content li:last-child {
    border-bottom: none;
}

.sidebar-item-content a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--color-border);
    text-decoration: none;
    width: 100%;
}

.sidebar-item-content a::after {
    content: '>';
    font-family: basiic;
    opacity: 0.7;
    background: none;
    height: auto;
    position: static;
    width: auto;
    bottom: auto;
}

.sidebar-item-content a::after {
    content: '>';
    font-family: basiic;
    opacity: 0.7;
    background: none;
    height: auto;
    position: relative;
    bottom: 0;
    transition: transform 0.2s ease;
}

.sidebar-item-content a:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.sidebar-item-content a:hover::after {
    transform: translateX(3px);
}

/* ==========================================================================
   GRID SYSTEM
   ========================================================================== */

/* Base Grid Container */
.grid {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    display: block;
}

/* Base Grid Item */
.item {
    display: block;
    position: absolute;
    margin: 8px;
    z-index: 1;
    background-color: var(--color-container);
    border: 2px solid var(--color-border);
    box-shadow: 4px 4px var(--color-shadow);
    transition: width 0.3s ease;
}

.tools img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    margin: 0.8em;
    text-align: center;
}

/* Grid Sizes - Desktop Default */
.size-full { width: calc(100% - 16px); }
.size-unit { width: calc(20% - 16px); }
.size-thirty { width: calc(30% - 16px); }
.size-two-units { width: calc(40% - 16px); }
.size-three-units { width: calc(60% - 16px); }
.size-four-units { width: calc(80% - 16px); }
.size-half { width: calc(50% - 16px); }
.size-close-half { width: calc(45% - 16px); }

/* Square Grid Item */
.size-square {
    width: calc(40% - 16px);
    height: 0;
    padding-bottom: calc(40% - 16px);
}

/* Grid Item Header */
.item-header {
    display: flex;
    background-color: var(--color-header);
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem;
    border-bottom: 2px solid var(--color-border);
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    height: 25px;
    cursor: grab;
}

/* Grid Item Content */
.item-content {
    position: relative;
    width: 100%;
    min-height: 100px;
    cursor: default;
    border-radius: inherit;
    padding-top: 25px;
}

.content-inner {
    padding: 15px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: left;
    justify-content: center;
    flex-direction: column;
    font-size: 0.875rem;
    color: var(--color-text);
}

table {
    border-collapse: collapse;
    width: 100%;
}

td, th {
    border: 2px solid var(--color-border);
    text-align: center;
    padding: 8px;
}

/* Square Content Positioning */
.size-square .item-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 25px;
}

.size-square .content-inner {
    position: absolute;
    top: 25px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Grid Item States */
.item.muuri-item-dragging {
    z-index: 4;
}

.item.muuri-item-dragging .item-header {
    cursor: grabbing;
}

.item.muuri-item-releasing {
    z-index: 3;
}

.item.muuri-item-hidden {
    z-index: 0;
}

/* ==========================================================================
   INFO TAGS
   ========================================================================== */

.info-box {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
}

.status-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.box {
    padding: 4px 12px;
    border: 2px solid var(--color-border);
    color: var(--color-text);
    background-color: transparent;
    display: inline-flex;
    align-items: center;
}

.info-tag:hover {
    background-color: #ff69b41a;
}

/* ==========================================================================
   LIST STYLES
   ========================================================================== */

/* Base List Styles */
.styled-list {
    background-color: var(--color-container);
    border: 2px solid var(--color-border);
    box-shadow: 4px 4px var(--color-shadow);
    padding: 20px 25px 20px 40px;
    margin: 10px 0;
    width: fit-content;
    min-width: 250px;
    font-size: 0.95rem;
}

/* Unordered List Styles */
.styled-list.ul {
    list-style: none;
    padding-left: 15px;
}

.styled-list.ul > li {
    position: relative;
    padding: 8px 0 8px 30px;
    margin: 8px 0;
    line-height: 1.5;
    font-weight: 500;
}

.styled-list.ul > li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7em;
    transform: translateY(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background-color: var(--color-pattern);
    border: 2px solid var(--color-border);
    transition: all 0.2s ease;
}

.styled-list.ul ul > li {
    position: relative;
    padding: 6px 0 6px 28px;
    margin: 4px 0;
    line-height: 1.4;
    font-weight: normal;
}

.styled-list.ul ul > li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7em;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    background-color: var(--color-header);
    border: 2px solid var(--color-border);
    transition: all 0.2s ease;
}

/* Ordered List Styles */
.styled-list.ol {
    counter-reset: item;
    list-style: none;
    padding-left: 15px;
}

.styled-list.ol li {
    position: relative;
    padding: 5px 0 5px 35px;
    margin: 5px 0;
    counter-increment: item;
    line-height: 1.4;
}

.styled-list.ol li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 0.7em;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background-color: var(--color-header);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

/* List Hover Effects */
.styled-list li {
    transition: all 0.2s ease;
}

.styled-list li:hover {
    color: var(--color-border);
    transform: translateX(2px);
}

.styled-list.ul li:hover::before {
    background-color: var(--color-border);
    border-color: var(--color-border);
}

.styled-list.ul > li:hover::before {
    transform: translateY(-50%) rotate(45deg) scale(1.1);
}

.styled-list.ul ul > li:hover::before {
    transform: translateY(-50%) scale(1.1);
}

.styled-list.ol li:hover::before {
    background-color: var(--color-pattern);
    color: var(--color-border);
    transform: translateY(-50%) scale(1.1);
}

.list-column {
    float: left;
    width: 25%;
    padding: 0 10px;
}

.list-column-card {
    padding: 16px;
    text-align: center;
    background-color: var(--color-background);
    border: 2px solid var(--color-border);
}

.list-row {margin: 0 -5px; line-height: 2;}

/* Clear floats after the columns */
.list-row:after {
  content: "";
  display: table;
  clear: both;
}
/* ==========================================================================
   TOOLTIP STYLES
   ========================================================================== */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--color-container);
    color: var(--color-text);
    text-align: center;
    font-size: 0.875rem;
    border: 2px solid var(--color-border);
    padding: 8px;
    box-shadow: 4px 4px var(--color-shadow);
    position: absolute;
    z-index: 5;
    bottom: 103%;
    left: 50%;
    transform: translateX(-50%);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: var(--color-border) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
}

/* ==========================================================================
   SCROLLBAR STYLES
   ========================================================================== */

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background-color: var(--color-container);
    border: 2px solid var(--color-border);
}

::-webkit-scrollbar-thumb {
    background-color: var(--color-header);
    border: 2px solid var(--color-border);
    box-shadow: inset 0 0 6px var(--color-shadow);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-pattern);
}

::-webkit-scrollbar-button {
    display: none;
}

::-webkit-scrollbar-corner {
    background-color: var(--color-container);
}
/* ==========================================================================
   RESPONSIVE & TOUCH IMPROVEMENTS
   Add these to the end of your existing CSS for enhanced mobile experience
   ========================================================================== */

/* Base Container Fixes */
@media screen {
    .page-container {
        padding: clamp(0.25rem, 2vw, 2rem);
        overflow-x: hidden;
        max-width: 100%;
        min-height: 100vh;
    }

    .content-wrapper {
        gap: clamp(0.25rem, 2vw, 1rem);
        width: 100%;
        position: relative;
    }

    .grid {
        width: 100%;
        height: auto !important;
        position: relative !important;
    }
}

/* Large Desktop Screens (1200px and above) - Default layout */

/* Desktop to Tablet Landscape (1199px) */
@media (max-width: 1199px) {
    .content-wrapper {
        padding: 0 1rem;
        max-width: 1200px;
    }
    
    .sidebar-container {
        width: 200px !important;   
    }

    .main-windows {
        margin-left: 0 !important;
        width: 100%;
        padding-bottom: 35px;
    }

    /* Grid System */
    .grid {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .item {
        position: static !important;
        transform: none !important;
        width: calc(50% - 1rem) !important;
        margin: 0.5rem !important;
        display: block !important;
    }

    /* Specific Grid Sizes */
    .size-full {
        width: calc(100% - 1rem) !important;
    }
}

/* Tablet Portrait (992px) */
@media (max-width: 991px) {
    /* Layout */
    .content-wrapper {
        flex-direction: column;
        padding: 0 0.5rem;
    }

    .subwindows-wrapper {
        width: 100% !important;
        margin-bottom: 1rem;
    }
    
    .main-windows {
        margin: 0 auto;
    }

    .page-container {
        padding-bottom: calc(35px + 1rem) !important;
    }

    /* Grid System */
    .grid {
        display: flex !important;
        flex-direction: column !important;
    }

    .grid-item,
    .size-unit,
    .size-thirty,
    .size-two-units,
    .size-three-units,
    .size-four-units,
    .size-half,
    .size-full,
    .size-square {
        width: calc(100% - 1rem) !important;
        position: static !important;
        margin: 0.5rem 0 !important;
        height: auto !important;
    }

    /* Square Items Fix */
    .size-square {
        padding-bottom: 0 !important;
    }

    .size-square .item-content {
        position: relative !important;
        height: auto !important;
        min-height: 200px;
    }

    .size-square .content-inner {
        position: relative !important;
        top: 0 !important;
    }

    /* Content Adjustments */
    .item-content {
        min-height: auto;
        padding-top: 5px;
    }

    .content-inner {
        padding: 1rem;
    }
}

/* Mobile (768px) */
@media (max-width: 767px) {
    /* Container */
    .page-container {
        padding: 0 !important;
        padding-bottom: 60px !important;
        margin: 0 !important;
    }

    .content-wrapper {
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Grid System */
    .grid {
        margin: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
    }

    .item {
        margin: 4px 4px !important;
        width: calc(100% - 8px) !important;
    }

    .item-header {
        position: relative !important;
        min-height: 40px;
        height: auto;
    }

    /* Content */
    .content-inner {
        padding: 12px !important;
    }
}

 /* iOS support */
    @supports (padding: env(safe-area-inset-bottom)) {
        .page-container {
            padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
        }
}

/* Small Mobile (380px) */
@media (max-width: 380px) {
    .grid-item {
        margin: 2px 2px !important;
        width: calc(100% - 4px) !important;
    }

    .content-inner {
        padding: 8px !important;
    }
}

/* Touch Device Improvements */
@media (hover: none) {
    /* Better Touch Targets */
    .window-button {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
        touch-action: manipulation;
    }

    .sidebar-item-content li {
        min-height: 44px;
        padding: 12px 16px;
        touch-action: manipulation;
        display: flex;
        align-items: center;
    }


    /* Active States */
    .window-button:active,
    .link-button:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
        background-color: var(--color-header);
    }

    /* Remove Hover Effects */
    .item:hover,
    .info-tag:hover,
    .menu-item:hover,
    .styled-list li:hover,
    .sidebar-item-content li:hover::before,
    .window-button:hover {
        transform: none !important;
    }

    a:hover::after {
        width: 0;
    }

    /* Grid Drag Improvements */
    .item-header {
        min-height: 44px;
        cursor: default;
        touch-action: none;
    }

    .window-controls {
        display: flex;
        gap: 4px;
    }

    /* Scrolling Improvements */
    .sidebar,
    .content-inner {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        overscroll-behavior: contain;
    }

    /* Prevent Text Selection */
    .item-header,
    .window-button,
    .menu-item {
        user-select: none;
        -webkit-user-select: none;
    }

    /* Remove Tap Highlight */
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    body {
        overscroll-behavior-y: none;
    }

    .sidebar {
        -webkit-overflow-scrolling: touch;
    }

    .page-container {
        padding-top: env(safe-area-inset-top) !important;
        padding-bottom: calc(env(safe-area-inset-bottom) + 48px) !important;
    }

}

/* Android Specific Fixes */
@supports not (-webkit-touch-callout: none) {
    * {
        touch-action: manipulation;
    }
}

/* Landscape Mode */
@media (orientation: landscape) and (max-height: 600px) {
    .start-menu {
        max-height: calc(70vh - 52px) !important;
        overflow-y: auto;
    }

    .modal-container {
        max-height: 90vh;
    }

    .grid {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .item {
        position: relative !important;
        transform: none !important;
    }

    /* Square Items in Landscape */
    .size-square {
        height: auto !important;
        padding-bottom: 0 !important;
    }

    .size-square .item-content {
        position: relative !important;
        height: 200px !important;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .window-button {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}