/* PPADDL.com — Memphis-Tech Portfolio Atlas
   Palette:
     #1B1B3A Cosmic Indigo
     #FAF3E8 Vapor Cream
     #F25C78 Coral Shock
     #00C9A7 Mint Circuit
     #FFD23F Lemon Signal
     #B388EB Lavender Byte
     #F0EDE6 Chalk White
     #2A2A3D Anthracite
*/

:root {
    --indigo: #1B1B3A;
    --cream: #FAF3E8;
    --coral: #F25C78;
    --mint: #00C9A7;
    --lemon: #FFD23F;
    --lavender: #B388EB;
    --chalk: #F0EDE6;
    --anthracite: #2A2A3D;
    --grid-line: #F25C7840;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--cream);
    color: var(--anthracite);
    overflow-x: hidden;
    cursor: none;
    line-height: 1.7;
    font-size: 1.05rem;
    position: relative;
}

a { color: inherit; text-decoration: none; cursor: none; }

/* Scattered confetti dots across cream backgrounds */
.confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle at 12% 18%, var(--coral) 3px, transparent 4px),
        radial-gradient(circle at 78% 22%, var(--mint) 3px, transparent 4px),
        radial-gradient(circle at 36% 64%, var(--lemon) 3px, transparent 4px),
        radial-gradient(circle at 88% 78%, var(--lavender) 3px, transparent 4px),
        radial-gradient(circle at 52% 92%, var(--coral) 3px, transparent 4px),
        radial-gradient(circle at 22% 84%, var(--mint) 3px, transparent 4px),
        radial-gradient(circle at 64% 12%, var(--lavender) 3px, transparent 4px),
        radial-gradient(circle at 8% 48%, var(--lemon) 3px, transparent 4px);
    background-size: 100% 100%;
    opacity: 0.55;
}

/* ---------- Custom cursor ---------- */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.06s ease-out, width 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
    mix-blend-mode: normal;
}
.cursor svg { width: 100%; height: 100%; overflow: visible; }
.cursor svg circle { transition: r 0.18s ease, fill 0.18s ease, stroke 0.18s ease; }

.cursor.mode-tile svg circle { r: 22; fill-opacity: 0.3; }
.cursor.mode-text svg circle { display: none; }
.cursor.mode-text::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 2px; height: 24px;
    background: var(--mint);
    animation: caretBlink 1s steps(2) infinite;
}
.cursor.mode-ticker svg circle { display: none; }
.cursor.mode-ticker::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 0; height: 0;
    border-left: 12px solid var(--coral);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
}
.cursor.mode-ticker.dir-rtl::after {
    transform: translate(-50%, -50%) rotate(180deg);
}

@keyframes caretBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ---------- Top nav ---------- */
.topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 48px;
    z-index: 200;
    background: rgba(27, 27, 58, 0.86);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    color: var(--chalk);
    border-bottom: 2px dashed var(--grid-line);
}
.brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.1rem;
}
.dot-pink { color: var(--coral); }

.navdots {
    list-style: none;
    display: flex;
    gap: 14px;
    align-items: center;
}
.navdots a {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 0 0 0;
    width: 16px;
    border-radius: 999px;
    background: var(--dot);
    overflow: hidden;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--indigo);
    transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), padding 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: none;
}
.navdots a::after {
    content: attr(data-label);
    opacity: 0;
    transition: opacity 0.2s 0.1s ease;
    padding-left: 8px;
}
.navdots a:hover {
    width: 110px;
    padding: 0 12px 0 8px;
}
.navdots a:hover::after { opacity: 1; }

/* ---------- Layout shell ---------- */
main {
    padding-top: 48px;
    position: relative;
    z-index: 1;
}

/* ---------- Grid Gallery ---------- */
.grid-gallery {
    padding: 56px 24px;
    position: relative;
}
.grid-gallery.alt { background: var(--cream); }

.grid {
    display: grid;
    gap: 0;
    grid-auto-rows: 160px;
    grid-template-columns: repeat(6, 1fr);
    background: var(--grid-line);
    /* Borders between cells achieved via dashed lines on tiles */
    border: 3px dashed var(--coral);
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
}
@media (max-width: 900px) {
    .grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 180px; }
}

.tile {
    position: relative;
    background: var(--cream);
    overflow: hidden;
    border: 3px dashed var(--coral);
    /* Alternate tile borders to mint (every even tile) */
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    will-change: transform;
    cursor: none;
}
.tile:nth-child(even) { border-color: var(--mint); }

.tile.proximity {
    border-style: solid;
    border-width: 2px;
}

.tile:hover {
    transform: translateY(-6px);
    z-index: 5;
}

.tile.expanded {
    position: fixed;
    inset: 10vh 10vw;
    z-index: 1000;
    width: 80vw;
    height: 80vh;
    transform: none;
    border: 3px solid var(--chalk);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

/* Tile sizes (Memphis off-kilter rhythm) */
.tile-1x1 { grid-column: span 1; grid-row: span 1; }
.tile-2x1 { grid-column: span 2; grid-row: span 1; }
.tile-3x1 { grid-column: span 3; grid-row: span 1; }
.tile-1x2 { grid-column: span 1; grid-row: span 2; }
.tile-2x2 { grid-column: span 2; grid-row: span 2; }
.tile-2x3 { grid-column: span 2; grid-row: span 3; }
.tile-3x2 { grid-column: span 3; grid-row: span 2; }

@media (max-width: 900px) {
    .tile-3x2, .tile-3x1 { grid-column: span 3; }
    .tile-2x3, .tile-2x2, .tile-2x1 { grid-column: span 2; }
}
@media (max-width: 600px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
    .tile-3x2, .tile-3x1, .tile-2x3, .tile-2x2, .tile-2x1 { grid-column: span 2; }
}

/* Tile color fills */
.tile.coral { background: var(--coral); color: var(--chalk); }
.tile.mint { background: var(--mint); color: var(--indigo); }
.tile.lemon { background: var(--lemon); color: var(--indigo); }
.tile.lavender { background: var(--lavender); color: var(--indigo); }
.tile.cream { background: var(--cream); color: var(--anthracite); }
.tile.indigo { background: var(--indigo); color: var(--chalk); }

.tile.dotgrid {
    background-color: var(--cream);
    background-image: radial-gradient(circle, var(--anthracite) 1.5px, transparent 2px);
    background-size: 32px 32px;
}

.tile.checker.checker-coral-cream {
    background-image:
        linear-gradient(45deg, var(--coral) 25%, transparent 25%, transparent 75%, var(--coral) 75%),
        linear-gradient(45deg, var(--coral) 25%, var(--cream) 25%, var(--cream) 75%, var(--coral) 75%);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}
.tile.checker.checker-mint-indigo {
    background-image:
        linear-gradient(45deg, var(--mint) 25%, transparent 25%, transparent 75%, var(--mint) 75%),
        linear-gradient(45deg, var(--mint) 25%, var(--indigo) 25%, var(--indigo) 75%, var(--mint) 75%);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}
.tile.checker.checker-lemon-lavender {
    background-image:
        linear-gradient(45deg, var(--lemon) 25%, transparent 25%, transparent 75%, var(--lemon) 75%),
        linear-gradient(45deg, var(--lemon) 25%, var(--lavender) 25%, var(--lavender) 75%, var(--lemon) 75%);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}

/* Tile inner content */
.tile-inner {
    position: relative;
    height: 100%;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.tile-overlay {
    position: relative;
    height: 100%;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    z-index: 3;
}
.tile-overlay.light { color: var(--chalk); }

.tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    background: rgba(242, 92, 120, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
    align-self: flex-start;
    color: inherit;
}
.tile.indigo .tag { background: rgba(0, 201, 167, 0.18); color: var(--mint); }

.tile.duo .tag { background: rgba(255, 255, 255, 0.18); color: var(--chalk); }
.tile.duo .tile-overlay p { color: var(--chalk); }

.midtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.annotate {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 38ch;
}

.tile-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--anthracite);
    display: flex;
    gap: 8px;
    align-items: center;
}
.line-no {
    background: rgba(242, 92, 120, 0.18);
    padding: 1px 6px;
    border-radius: 2px;
    color: var(--coral);
}

.megatitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    letter-spacing: -0.04em;
    line-height: 0.9;
    color: var(--indigo);
}
.ampersand { color: var(--coral); }

.tile-caption {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    color: var(--anthracite);
    max-width: 42ch;
}

.squiggle {
    width: 100%;
    max-width: 320px;
    height: 22px;
}

/* Corner SVG decorations */
.corner {
    position: absolute;
    width: 24px;
    height: 24px;
    z-index: 4;
    pointer-events: none;
}
.corner-tl { top: 8px; left: 8px; }
.corner-br { bottom: 8px; right: 8px; }

.bigmotif {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 50%;
    height: 70%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.85;
}
.bigmotif.small { width: 40%; height: 50%; }

/* ---------- Duotone tiles ---------- */
.tile.duo {
    background: var(--indigo);
}
.duotone {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: grayscale(1) contrast(1.15);
    z-index: 1;
}
.duotone::after {
    content: '';
    position: absolute;
    inset: 0;
    mix-blend-mode: screen;
    opacity: 0.7;
    transition: opacity 0.4s ease;
}
.tile.duo:hover .duotone::after { opacity: 0.9; }

.tile.duo-coral { background: var(--indigo); }
.tile.duo-coral .duotone::after { background: var(--coral); }
.tile.duo-mint { background: var(--anthracite); }
.tile.duo-mint .duotone::after { background: var(--mint); }
.tile.duo-lemon { background: var(--lavender); }
.tile.duo-lemon .duotone::after { background: var(--lemon); mix-blend-mode: lighten; }

/* Photographic image substitutes — geometric SVG-data placeholders */
.duo-img-01 { background-image:
    linear-gradient(120deg, #7a7a7a 0%, #3a3a3a 60%, #d0d0d0 100%),
    radial-gradient(circle at 30% 40%, #eaeaea, #2a2a2a);
    background-blend-mode: multiply;
}
.duo-img-02 { background:
    radial-gradient(circle at 70% 30%, #c4c4c4, #2a2a2a 70%);
}
.duo-img-03 { background:
    linear-gradient(60deg, #4a4a4a 0%, #b0b0b0 50%, #2a2a2a 100%);
}
.duo-img-04 { background:
    radial-gradient(ellipse at 30% 70%, #e0e0e0 0%, #404040 60%, #1a1a1a 100%);
}
.duo-img-05 { background:
    linear-gradient(35deg, #2a2a2a 0%, #909090 40%, #d8d8d8 70%, #404040 100%);
}
.duo-img-06 { background:
    radial-gradient(circle at 50% 30%, #cccccc 0%, #4a4a4a 70%);
}
.duo-img-07 { background:
    linear-gradient(160deg, #1f1f1f 0%, #6a6a6a 50%, #c0c0c0 100%);
}
.duo-img-08 { background:
    radial-gradient(ellipse at 60% 50%, #dadada 0%, #3a3a3a 80%);
}

/* ---------- Specimen Strip Ticker ---------- */
.specimen {
    height: 120px;
    background: var(--indigo);
    overflow: hidden;
    position: relative;
    border-top: 3px dashed var(--mint);
    border-bottom: 3px dashed var(--coral);
}
.ticker {
    height: 100%;
    overflow: hidden;
    position: relative;
}
.ticker-track {
    list-style: none;
    display: flex;
    gap: 48px;
    align-items: center;
    height: 100%;
    padding: 0 24px;
    width: max-content;
    animation: tickerScroll 40s linear infinite;
}
.ticker-track li {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ticker-track li svg { width: 100%; height: 100%; }
.ticker-track li:hover { transform: scale(1.5); }
.ticker:hover .ticker-track { animation-play-state: paused; }

.ticker-rtl .ticker-track { animation-direction: reverse; }

@keyframes tickerScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ---------- Tutorial Interlude ---------- */
.interlude {
    background: var(--indigo);
    color: var(--chalk);
    padding: 96px 24px 96px 96px;
    position: relative;
    border-top: 3px dashed var(--coral);
    border-bottom: 3px dashed var(--mint);
}
.interlude.dotgrid-bg {
    background-color: var(--indigo);
    background-image: radial-gradient(circle, rgba(240, 237, 230, 0.15) 1.5px, transparent 2px);
    background-size: 32px 32px;
}

.margin-doodles {
    position: absolute;
    left: 96px;
    top: 64px;
    width: 80px;
    pointer-events: none;
}
.margin-doodles .doodle {
    width: 60px;
    height: 120px;
    margin-bottom: 16px;
    display: block;
}
.margin-doodles .doodle path,
.margin-doodles .doodle line,
.margin-doodles .doodle circle {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.6s ease;
}
.interlude.in-view .margin-doodles .doodle path,
.interlude.in-view .margin-doodles .doodle line,
.interlude.in-view .margin-doodles .doodle circle {
    stroke-dashoffset: 0;
}

.lined {
    counter-reset: line;
    list-style: none;
    max-width: 720px;
    margin: 0 auto 0 200px;
    padding-left: 0;
}
@media (max-width: 900px) {
    .interlude { padding: 72px 24px 72px 64px; }
    .margin-doodles { left: 16px; }
    .lined { margin-left: 80px; }
}

.lined li {
    position: relative;
    padding: 6px 0 6px 56px;
    border-left: 2px solid rgba(179, 136, 235, 0.4);
    margin-left: 0;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.lined li::before {
    counter-increment: line;
    content: counter(line, decimal-leading-zero);
    position: absolute;
    left: 16px;
    top: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--lavender);
}
.interlude.in-view .lined li { opacity: 1; transform: translateY(0); }
.interlude.in-view .lined li:nth-child(1) { transition-delay: 0.05s; }
.interlude.in-view .lined li:nth-child(2) { transition-delay: 0.13s; }
.interlude.in-view .lined li:nth-child(3) { transition-delay: 0.21s; }
.interlude.in-view .lined li:nth-child(4) { transition-delay: 0.29s; }
.interlude.in-view .lined li:nth-child(5) { transition-delay: 0.37s; }
.interlude.in-view .lined li:nth-child(6) { transition-delay: 0.45s; }
.interlude.in-view .lined li:nth-child(7) { transition-delay: 0.53s; }

.interlude-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--chalk);
    margin-bottom: 8px;
}

.interlude code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    background: rgba(242, 92, 120, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--lemon);
}

/* ---------- Footer ---------- */
.footer {
    background: var(--indigo);
    color: var(--chalk);
    padding: 36px 24px;
    border-top: 3px dashed var(--lemon);
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}
.footer .brand { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; }
.footer .meta { color: var(--mint); }
.footer .hash { color: var(--lavender); }

/* ---------- Expanded tile scrim ---------- */
.scrim {
    position: fixed;
    inset: 0;
    background: rgba(27, 27, 58, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.scrim.active { opacity: 1; pointer-events: auto; }

/* Expanded tile inner styles */
.tile.expanded .tile-overlay {
    padding: 48px;
    justify-content: center;
}
.tile.expanded .midtitle { font-size: clamp(2rem, 4vw, 3.5rem); }
.tile.expanded .annotate { font-size: 1.1rem; max-width: 56ch; }

/* Hide cursor styling on touch devices */
@media (hover: none) {
    body { cursor: auto; }
    .cursor { display: none; }
    a, .tile { cursor: pointer; }
}
