:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --accent-color: #06b6d4;
    --dark-bg: #0f172a;
    --light-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.2);
    --luke-primary: #06b6d4;
    --luke-secondary: #0891b2;
    --steuber-primary: #7c3aed;
    --steuber-secondary: #2563eb;
    --row-gap: clamp(0px, .3vw, 0px);
    --row-total: min(1000px, 92vw);
    --luke-size: calc((var(--row-total) - (4 * var(--row-gap))) / 4);
    --steuber-size: calc((var(--row-total) - (7 * var(--row-gap))) / 7);
    --face-font-min: 3.2rem;
    --face-font-vw: 7.5vw;
    --face-font-max: 5.8rem;
}

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.skip-to-content {
    position: absolute;
    left: -9999px;
    padding: 1em;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    z-index: 1000;
}

.skip-to-content:focus {
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    border-radius: 5px;
}

a:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

header {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: top;
    position: relative;
    padding: 2rem 1rem 1rem;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--light-bg) 100%);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Fine glass texture + slow refraction sweep */
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0),
        linear-gradient(115deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 20%, transparent 40%, transparent 60%, rgba(255,255,255,0.02) 80%, rgba(255,255,255,0.05) 100%);
    background-size:
        3px 3px,
        200% 200%;
    mix-blend-mode: soft-light;
    opacity: 0.35;8
    pointer-events: none;
    animation: refractionShift 38s ease-in-out infinite;
}

.hero-title {
    perspective: 1000px;
    margin-bottom: 1rem;
    margin-top: 4.5rem;
    position: relative;
    z-index: 2;
}

.cube-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--row-gap);
    margin-bottom: 5.5rem;
    width: var(--row-total);
    max-width: var(--row-total);
    position: relative;
}

.name-first {
    display: grid;
    grid-template-columns: repeat(4, var(--luke-size));
    gap: var(--row-gap);
    justify-content: center;
    align-items: center;
}

.name-last {
    display: grid;
    grid-template-columns: repeat(7, var(--steuber-size));
    gap: var(--row-gap);
    justify-content: center;
    align-items: center;
}

.cube-letter {
    position: relative;
    transform-style: preserve-3d;
    animation: cube 7.2s cubic-bezier(.66,.14,.56,.75) infinite;
    animation-fill-mode: both;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.name-first .cube-letter {
    width: var(--luke-size);
    height: var(--luke-size);
}

.name-last .cube-letter {
    width: var(--steuber-size);
    height: var(--steuber-size);
}

.cube-letter:hover {
    animation-play-state: paused;
    transform: rotateX(15deg) rotateY(15deg) scale(1.1);
}

.cube-letter:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
}

@keyframes cube {
    0% {
        transform: rotateY(0deg) scale3d(.9,.9,.1);
        animation-timing-function: cubic-bezier(.4,0,.2,1);
    }
    25% {
        transform: rotateY(180deg) scale3d(.9,.9,.1);
        animation-timing-function: linear;
    }
    50% {
        transform: rotateY(180deg) scale3d(.9,.9,.1);
        animation-timing-function: cubic-bezier(.4,0,.2,1);
    }
    75% {
        transform: rotateY(360deg) scale3d(.9,.9,.1);
        animation-timing-function: linear;
    }
    100% {
        transform: rotateY(360deg) scale3d(.9,.9,.1);
    }
}

@keyframes refractionShift {
    0% { background-position: 0 0, 0% 0%; }
    50% { background-position: 0 0, 100% 100%; }
    100% { background-position: 0 0, 0% 0%; }
}

.cube-face {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: clamp(var(--face-font-min), var(--face-font-vw), var(--face-font-max));
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(124, 58, 237, 0.1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    transition: color 0.24s ease, transform 0.24s ease, font-size 0.24s ease;
}

.cube-face::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    pointer-events: none;
    /* Gentle moving highlight for glass feel */
    background:
        linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 32%, transparent 68%, rgba(255,255,255,0.10) 100%);
    mix-blend-mode: screen;
    opacity: 0.8;
    animation: glassReflection 14s ease-in-out infinite;
}

@keyframes glassReflection {
    0%, 100% { background-position: 0% 0%; opacity: 0.7; }
    50% { background-position: 100% 100%; opacity: 0.95; }
}

.name-first .cube-face {
    font-size: calc(1.5 * clamp(var(--face-font-min), var(--face-font-vw), var(--face-font-max)));
    border-color: rgba(6, 182, 212, 0.3);
}

.name-first .cube-face:nth-child(1) {
    transform: translateZ(calc(var(--luke-size) / 2));
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(8, 145, 178, 0.3));
    font-family: 'Open Sans', sans-serif;
}

.name-first .cube-face:nth-child(2) {
    transform: translateZ(calc(var(--luke-size) * -0.5)) rotateY(180deg);
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.3), rgba(6, 182, 212, 0.3));
    font-family: 'Open-Dyslexic', 'OpenDyslexic', 'Open Dyslexic', sans-serif;
}

.name-first .cube-face:nth-child(3) {
    transform: translateX(calc(var(--luke-size) * -0.5)) rotateY(-90deg);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(14, 165, 233, 0.3));
    font-family: 'Open-Dyslexic', 'OpenDyslexic', 'Open Dyslexic', sans-serif;
    opacity: 0;
}

.name-first .cube-face:nth-child(4) {
    transform: translateX(calc(var(--luke-size) / 2)) rotateY(90deg);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(6, 182, 212, 0.3));
    font-family: 'Doulos SIL', 'DoulosSIL', serif;
    opacity: 0;
}

.name-first .cube-face:nth-child(5) {
    transform: translateY(calc(var(--luke-size) * -0.5)) rotateX(90deg);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(8, 145, 178, 0.25));
    font-family: 'Open Sans', sans-serif;
    opacity: 0;
}

.name-first .cube-face:nth-child(6) {
    transform: translateY(calc(var(--luke-size) / 2)) rotateX(-90deg);
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.25), rgba(14, 165, 233, 0.25));
    font-family: 'Open Sans', sans-serif;
    opacity: 0;
}

.name-last .cube-face:nth-child(1) {
    transform: translateZ(calc(var(--steuber-size) / 2));
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(124, 58, 237, 0.2));
    font-family: 'Open Sans', sans-serif;
}

.name-last .cube-face:nth-child(2) {
    transform: translateZ(calc(var(--steuber-size) * -0.5)) rotateY(180deg);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(6, 182, 212, 0.2));
    font-family: 'Open-Dyslexic', 'OpenDyslexic', 'Open Dyslexic', sans-serif;
}

.name-last .cube-face:nth-child(3) {
    transform: translateX(calc(var(--steuber-size) * -0.5)) rotateY(-90deg);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(37, 99, 235, 0.2));
    font-family: 'Open-Dyslexic', 'OpenDyslexic', 'Open Dyslexic', sans-serif;
    opacity: 0;
}

.name-last .cube-face:nth-child(4) {
    transform: translateX(calc(var(--steuber-size) / 2)) rotateY(90deg);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(6, 182, 212, 0.2));
    font-family: 'Doulos SIL', 'DoulosSIL', serif;
    opacity: 0;
}

.name-last .cube-face:nth-child(5) {
    transform: translateY(calc(var(--steuber-size) * -0.5)) rotateX(90deg);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(37, 99, 235, 0.15));
    font-family: 'Open Sans', sans-serif;
    opacity: 0;
}

.name-last .cube-face:nth-child(6) {
    transform: translateY(calc(var(--steuber-size) / 2)) rotateX(-90deg);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(124, 58, 237, 0.15));
    font-family: 'Open Sans', sans-serif;
    opacity: 0;
}



.orthography-banner.visible {
    opacity: 0.95;
    visibility: visible;
    transform: translateX(-50%) translateY(10px);
}

.orthography-banner::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(14, 165, 233, 0.3));
    border-radius: 0 0 8px 8px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.orthography-banner.visible::before {
    opacity: 1;
}

.orthography-banner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48%;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06) 60%, transparent 100%);
    mix-blend-mode: screen;
}

.tagline {
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    text-align: center;
    margin-top: 2rem;
    animation: fadeInUp 1s ease-out;
    max-width: 700px;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

body.ortho-braille .cube-face {
    letter-spacing: 0.18em;
    font-size: calc(1.1 * clamp(var(--face-font-min), var(--face-font-vw), var(--face-font-max)));
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.ortho-braille .name-first .cube-face {
    font-size: calc(1.65 * clamp(var(--face-font-min), var(--face-font-vw), var(--face-font-max)));
}

body.ortho-morse .cube-face {
    letter-spacing: 0.08em;
    font-size: calc(0.36 * clamp(var(--face-font-min), var(--face-font-vw), var(--face-font-max)));
    font-variant-ligatures: none;
    line-height: 1.1;
    white-space: pre-line;
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.2rem;
    overflow-wrap: anywhere;
    hyphens: none;
}

body.ortho-math .cube-face {
    line-height: 1.2;
}

body.ortho-runic .cube-face {
    letter-spacing: 0.05em;
}

body.ortho-binary .cube-face {
    font-size: calc(0.28 * clamp(var(--face-font-min), var(--face-font-vw), var(--face-font-max)));
    letter-spacing: 0.02em;
    line-height: 1.1;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

body.ortho-phoenician .cube-face {
    letter-spacing: 0.08em;
}

body.ortho-hieroglyphs .cube-face {
    line-height: 1.1;
}

body.ortho-nato .cube-face {
    font-size: calc(0.34 * clamp(var(--face-font-min), var(--face-font-vw), var(--face-font-max)));
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.1;
    white-space: normal;
    word-break: keep-all;
}

@media (max-width: 768px) {
    :root {
        --row-gap: clamp(6px, 1.8vw, 10px);
        --row-total: min(1000px, 94vw);
        --luke-size: calc((var(--row-total) - (3 * var(--row-gap))) / 4);
        --steuber-size: calc((var(--row-total) - (6 * var(--row-gap))) / 7);
    }
    .orthography-banner { font-size: 0.5rem; }
}

@media (max-width: 480px) {
    :root {
        --row-gap: clamp(4px, 2.2vw, 8px);
        --row-total: min(1000px, 96vw);
        --luke-size: calc((var(--row-total) - (3 * var(--row-gap))) / 4);
        --steuber-size: calc((var(--row-total) - (6 * var(--row-gap))) / 7);
    }
}

.orthography-banner {
    position: absolute;
    top: -3.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    visibility: hidden;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.08em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(14, 165, 233, 0.15));
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: 8px; /* @skim @swim */       
    padding: 0.5rem 1.2rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease;
    margin-bottom: 1rem;
}

/* Tile Sections Styles */
.tile-sections {
    width: 100%;
    max-width: 1200px;
    margin-top: 3rem;
    padding: 0 1rem;
    position: relative;
    z-index: 2;
}

.tile-section {
    margin-bottom: 3rem;
}

.section-header {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
    font-family: 'Inter', sans-serif;
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--luke-primary), var(--steuber-primary));
    border-radius: 2px;
}

/* Tiered Tile Grid Styles */
.tile-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
    position: relative;
}

/* Tier 1: Large tiles (2 per row) */
.tier-1 {
    grid-template-columns: repeat(2, 1fr);
    justify-items: center;
}

/* Tier 2: Medium tiles (2 per row) */
.tier-2 {
    grid-template-columns: repeat(2, 1fr);
    justify-items: center;
}

/* Tier 3: Medium tiles (3 per row) */
.tier-3 {
    grid-template-columns: repeat(3, 1fr);
    justify-items: center;
}

/* Tier 4: Small tiles (4 per row) */
.tier-4 {
    grid-template-columns: repeat(4, 1fr);
    justify-items: center;
}

.tile {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(124, 58, 237, 0.1));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
}

.tile-image {
    width: 100%;
    height: auto;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.tile-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.tile:hover .tile-image img {
    transform: scale(1.05);
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.tile:hover::before {
    opacity: 1;
}

.tile:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.tile h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

.tile p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

/* Tile Size Variations */
.tile-large {
    min-height: 200px;
    padding: 2rem;
    max-width: 400px;
}

.tile-large h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.tile-large p {
    font-size: 1rem;
}

.tile-medium {
    min-height: 180px;
    padding: 1.5rem;
    max-width: 300px;
}

.tile-medium h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.tile-medium p {
    font-size: 0.9rem;
}

.tile-small {
    min-height: 140px;
    padding: 1rem;
    max-width: 200px;
}

.tile-small h3 {
    font-size: 1rem;
    margin-bottom: 0;
}

.tile-small p {
    display: none;
}

/* Ensure tiles align to edges */
.tier-1,
.tier-2,
.tier-3,
.tier-4 {
    justify-content: space-between;
    align-items: start;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tier-1,
    .tier-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tier-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tier-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .tile-large {
        min-height: 180px;
        padding: 1.5rem;
        max-width: 350px;
    }
    
    .tile-large h3 {
        font-size: 1.25rem;
    }
    
    .tile-medium {
        min-height: 160px;
        max-width: 280px;
    }
    
    .tile-small {
        min-height: 120px;
        padding: 0.75rem;
        max-width: 180px;
    }
}

@media (max-width: 768px) {
    .tier-1,
    .tier-2,
    .tier-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .tier-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .tile-large {
        min-height: 160px;
        padding: 1rem;
        max-width: 300px;
    }
    
    .tile-large h3 {
        font-size: 1.1rem;
    }
    
    .tile-large p {
        font-size: 0.85rem;
    }
    
    .tile-medium {
        min-height: 140px;
        padding: 1rem;
        max-width: 250px;
    }
    
    .tile-medium h3 {
        font-size: 1rem;
    }
    
    .tile-medium p {
        font-size: 0.8rem;
    }
    
    .tile-small {
        min-height: 100px;
        padding: 0.75rem;
        max-width: 150px;
    }
    
    .tile-small h3 {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .tier-1,
    .tier-2,
    .tier-3,
    .tier-4 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .tile-large,
    .tile-medium,
    .tile-small {
        min-height: 120px;
        padding: 0.75rem;
        max-width: 100%;
    }
    
    .tile-large h3,
    .tile-medium h3,
    .tile-small h3 {
        font-size: 1rem;
    }
    
    .tile-large p,
    .tile-medium p {
        font-size: 0.8rem;
    }
    
    .section-header {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
}