/* ========================================
   lrx.wiki — License and Right eXchange
   Light-academia + Candy-bright Honeycomb
   ======================================== */

:root {
    /* Base Colors */
    --base-cream: #FFF8F0;
    --base-warm: #F5ECD7;
    --text-primary: #2B2118;
    --text-secondary: #6B5E52;
    --border-blush: #E8D5C4;
    --shadow-warm: rgba(43, 33, 24, 0.08);

    /* Accent Colors */
    --accent-copyright: #FF6B9D;
    --accent-opensource: #00D4AA;
    --accent-cc: #FFB347;
    --accent-patent: #7B68EE;
    --accent-trademark: #41B8D5;

    /* Hex Dimensions */
    --hex-size: 320px;
    --hex-gap: 8px;
    --hex-ratio: 0.866;
    --nav-height: 64px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--base-cream);
    color: var(--text-primary);
    font-family: 'Literata', Georgia, serif;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.7;
    font-optical-sizing: auto;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========================================
   CURSOR FOLLOWER HEX
   ======================================== */
#cursor-hex {
    position: fixed;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.25;
    transition: transform 0.2s ease-out, opacity 0.3s;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 2px solid var(--accent-patent);
    background: transparent;
    transform: translate(-50%, -50%);
    mix-blend-mode: multiply;
}

#cursor-hex::after {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 1px solid var(--accent-patent);
}

/* ========================================
   BUBBLES
   ======================================== */
#bubbles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
    animation: bubble-rise var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
}

.bubble::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 35%;
    height: 30%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.7) 0%, transparent 70%);
}

@keyframes bubble-rise {
    0% {
        transform: translateY(100vh) translateX(0) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(50vh) translateX(calc(var(--wobble) * 1px)) scale(1);
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-10vh) translateX(calc(var(--wobble) * -1px)) scale(0.6);
        opacity: 0;
    }
}

/* ========================================
   RIPPLE EFFECT
   ======================================== */
#ripple-effect {
    position: fixed;
    width: 0;
    height: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    border: 2px solid var(--accent-copyright);
    opacity: 0;
    transform: translate(-50%, -50%);
}

#ripple-effect.active {
    animation: ripple-wave 0.6s ease-out forwards;
}

@keyframes ripple-wave {
    0% {
        width: 0;
        height: 0;
        opacity: 0.6;
        border-width: 3px;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        border-width: 1px;
    }
}

/* ========================================
   NAVIGATION
   ======================================== */
#main-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--nav-height);
    background: rgba(255, 248, 240, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-blush);
}

.nav-inner {
    max-width: 1440px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
}

.nav-wordmark {
    font-family: 'Anybody', sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    font-variation-settings: 'wdth' 110;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.nav-search-wrap {
    flex: 1;
    max-width: 400px;
}

.nav-search {
    width: 100%;
    padding: 10px 20px;
    border: 1.5px solid var(--border-blush);
    border-radius: 50px;
    background: rgba(255, 248, 240, 0.6);
    font-family: 'Literata', serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    clip-path: polygon(8% 0%, 92% 0%, 100% 50%, 92% 100%, 8% 100%, 0% 50%);
    text-align: center;
}

.nav-search::placeholder {
    color: var(--text-secondary);
}

.nav-search:focus {
    border-color: var(--accent-patent);
    box-shadow: 0 0 12px rgba(123, 104, 238, 0.2);
}

.nav-links {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.nav-link {
    font-family: 'Anybody', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    font-variation-settings: 'wdth' 95;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.nav-link[data-accent='copyright']:hover { color: var(--accent-copyright); background: rgba(255, 107, 157, 0.08); }
.nav-link[data-accent='opensource']:hover { color: var(--accent-opensource); background: rgba(0, 212, 170, 0.08); }
.nav-link[data-accent='cc']:hover { color: var(--accent-cc); background: rgba(255, 179, 71, 0.08); }
.nav-link[data-accent='patent']:hover { color: var(--accent-patent); background: rgba(123, 104, 238, 0.08); }
.nav-link[data-accent='trademark']:hover { color: var(--accent-trademark); background: rgba(65, 184, 213, 0.08); }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
}

/* ========================================
   HONEYCOMB GRID
   ======================================== */
#honeycomb-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 40px 20px 60px;
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hex-cell {
    width: var(--hex-size);
    height: calc(var(--hex-size) * var(--hex-ratio));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    margin: calc(var(--hex-gap) * -2) var(--hex-gap);
    transition: transform 0.3s ease-out, filter 0.3s;
    cursor: pointer;
    position: relative;
    opacity: 0;
    transform: scale(0.85);
    animation: hex-enter 0.5s ease-out forwards;
    animation-delay: calc(var(--enter-delay, 0) * 40ms);
}

.hex-cell:nth-child(5n+1) {
    margin-top: calc(var(--hex-size) * var(--hex-ratio) * 0.25 + var(--hex-gap));
}

.hex-cell:hover {
    transform: scale(1.08);
    z-index: 10;
    filter: drop-shadow(0 8px 24px var(--shadow-warm));
}

@keyframes hex-enter {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.hex-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
    overflow: hidden;
}

/* Primary Cells */
.hex-primary {
    width: calc(var(--hex-size) * 1.15);
    height: calc(var(--hex-size) * 1.15 * var(--hex-ratio));
    background: var(--base-cream);
    border: none;
    position: relative;
}

.hex-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--border-blush);
    z-index: -1;
    transform: scale(1.02);
}

.hex-primary .hex-inner {
    padding: 40px 28px;
}

.hex-primary h2 {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-variation-settings: 'wdth' calc(75 + (125 - 75) * ((100vw - 320px) / (1440 - 320)));
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 8px 0;
}

.hex-primary p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

/* Secondary Cells */
.hex-secondary {
    width: var(--hex-size);
    height: calc(var(--hex-size) * var(--hex-ratio));
}

.hex-secondary .hex-inner {
    padding: 28px 20px;
}

.hex-secondary h3 {
    font-family: 'Anybody', sans-serif;
    font-weight: 600;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    font-variation-settings: 'wdth' 100;
    line-height: 1.25;
    color: #fff;
    margin: 6px 0;
}

.hex-secondary p {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.85);
    line-height: 1.45;
}

/* Secondary cell category colors */
.hex-secondary[data-category='copyright'] { background: var(--accent-copyright); }
.hex-secondary[data-category='opensource'] { background: var(--accent-opensource); }
.hex-secondary[data-category='cc'] { background: var(--accent-cc); }
.hex-secondary[data-category='patent'] { background: var(--accent-patent); }
.hex-secondary[data-category='trademark'] { background: var(--accent-trademark); }

/* Tertiary Cells */
.hex-tertiary {
    width: calc(var(--hex-size) * 0.55);
    height: calc(var(--hex-size) * 0.55 * var(--hex-ratio));
}

.hex-tertiary .hex-inner {
    padding: 8px;
}

.hex-tertiary[data-category='copyright'] { background: rgba(255, 107, 157, 0.15); }
.hex-tertiary[data-category='opensource'] { background: rgba(0, 212, 170, 0.15); }
.hex-tertiary[data-category='cc'] { background: rgba(255, 179, 71, 0.15); }
.hex-tertiary[data-category='patent'] { background: rgba(123, 104, 238, 0.15); }
.hex-tertiary[data-category='trademark'] { background: rgba(65, 184, 213, 0.15); }

.hex-icon {
    font-size: 1.6rem;
    opacity: 0.7;
}

/* Tags and Meta */
.hex-tag {
    font-family: 'Anybody', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    font-variation-settings: 'wdth' 90;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 3px;
    clip-path: polygon(8% 0%, 92% 0%, 100% 50%, 92% 100%, 8% 100%, 0% 50%);
}

.hex-primary .hex-tag {
    background: var(--base-warm);
    color: var(--text-secondary);
}

.hex-secondary .hex-tag {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.hex-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: auto;
}

.hex-meta code,
.edit-item code,
.footer-bottom code {
    font-family: 'Fira Code', monospace;
    font-weight: 450;
    font-size: 0.9em;
    text-shadow: 0 0 8px rgba(123, 104, 238, 0.3);
}

.hex-primary .hex-meta code { color: var(--accent-patent); }

/* Hover radial wash */
.hex-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: radial-gradient(circle at center, var(--hover-color, transparent) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease-out;
    pointer-events: none;
    z-index: 1;
}

.hex-cell:hover::after {
    opacity: 1;
}

.hex-cell[data-category='copyright'] { --hover-color: rgba(255, 107, 157, 0.12); }
.hex-cell[data-category='opensource'] { --hover-color: rgba(0, 212, 170, 0.12); }
.hex-cell[data-category='cc'] { --hover-color: rgba(255, 179, 71, 0.12); }
.hex-cell[data-category='patent'] { --hover-color: rgba(123, 104, 238, 0.12); }
.hex-cell[data-category='trademark'] { --hover-color: rgba(65, 184, 213, 0.12); }

/* ========================================
   HEX DIVIDER
   ======================================== */
.hex-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 32px 0;
}

.hex-dot {
    width: 12px;
    height: 12px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--dot-color, var(--border-blush));
    opacity: 0.6;
    transition: opacity 0.3s;
}

.hex-dot:hover {
    opacity: 1;
}

/* ========================================
   RECENT EDITS
   ======================================== */
#recent-edits {
    max-width: 800px;
    margin: 0 auto 60px;
    padding: 0 24px;
    position: relative;
    z-index: 2;
}

.section-title {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 2.5vw, 2.2rem);
    font-variation-settings: 'wdth' calc(75 + (125 - 75) * ((100vw - 320px) / (1440 - 320)));
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.edits-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.edit-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--base-warm);
    border-radius: 8px;
    border-left: 3px solid var(--accent-patent);
    transition: transform 0.2s, border-color 0.2s;
}

.edit-item:hover {
    transform: translateX(4px);
    border-left-color: var(--accent-copyright);
}

.edit-item code {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--accent-patent);
    text-shadow: 0 0 8px rgba(123, 104, 238, 0.3);
    white-space: nowrap;
    min-width: 120px;
}

.edit-desc {
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
}

.edit-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ========================================
   FOOTER
   ======================================== */
#site-footer {
    background: var(--base-warm);
    border-top: 1px solid var(--border-blush);
    position: relative;
    z-index: 2;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    display: flex;
    gap: 48px;
}

.footer-brand {
    flex: 1;
}

.footer-wordmark {
    font-family: 'Anybody', sans-serif;
    font-weight: 800;
    font-size: 2.4rem;
    font-variation-settings: 'wdth' 120;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    display: block;
    margin-bottom: 12px;
}

.footer-brand p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 360px;
}

.footer-links-grid {
    display: flex;
    gap: 48px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-col h4 {
    font-family: 'Anybody', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    font-variation-settings: 'wdth' 95;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.footer-col a {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--accent-copyright);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    border-top: 1px solid var(--border-blush);
}

.footer-bottom p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.footer-bottom code {
    font-family: 'Fira Code', monospace;
    font-size: 0.85em;
    color: var(--accent-opensource);
    text-shadow: 0 0 8px rgba(0, 212, 170, 0.3);
}

/* ========================================
   SEARCH GLOW PULSE
   ======================================== */
@keyframes search-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(123, 104, 238, 0); }
    50% { box-shadow: 0 0 16px 4px rgba(123, 104, 238, 0.2); }
}

.nav-search.glow-pulse {
    animation: search-glow 1.2s ease-in-out 1;
}

/* ========================================
   DATA OVERLAY BACKGROUND
   ======================================== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50Z' fill='none' stroke='%23E8D5C4' stroke-width='0.5'/%3E%3Cpath d='M28 166L0 150L0 116L28 100L56 116L56 150Z' fill='none' stroke='%23E8D5C4' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 56px 100px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    :root {
        --hex-size: 260px;
    }
}

@media (max-width: 768px) {
    :root {
        --hex-size: 220px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(255, 248, 240, 0.96);
        backdrop-filter: blur(8px);
        flex-direction: column;
        padding: 16px 24px;
        border-bottom: 1px solid var(--border-blush);
        gap: 4px;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .footer-inner {
        flex-direction: column;
        gap: 32px;
    }

    .footer-links-grid {
        flex-wrap: wrap;
        gap: 32px;
    }

    .edit-item {
        flex-wrap: wrap;
    }

    .edit-item code {
        min-width: auto;
    }

    #cursor-hex {
        display: none;
    }
}

@media (max-width: 640px) {
    :root {
        --hex-size: 100%;
    }

    #honeycomb-grid {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 24px 16px;
    }

    .hex-cell,
    .hex-primary,
    .hex-secondary,
    .hex-tertiary {
        width: 100%;
        max-width: 400px;
        height: auto;
        min-height: 120px;
        clip-path: polygon(4% 0%, 96% 0%, 100% 25%, 100% 75%, 96% 100%, 4% 100%, 0% 75%, 0% 25%);
        margin: 0;
    }

    .hex-primary {
        min-height: 200px;
    }

    .hex-tertiary {
        min-height: 70px;
    }

    .hex-cell:nth-child(5n+1) {
        margin-top: 0;
    }

    .hex-inner {
        position: relative;
        padding: 24px 20px;
    }

    .nav-search {
        clip-path: none;
        border-radius: 50px;
    }

    .footer-links-grid {
        flex-direction: column;
    }
}