/* simidiot.net — drowned internet shrine */

@property --border-hue {
    syntax: '<angle>';
    inherits: false;
    initial-value: 180deg;
}

:root {
    --abyss: #0B0E17;
    --trench-navy: #111B2E;
    --seafoam: #00FFC6;
    --coral: #FF6B9D;
    --candle: #FFD93D;
    --denim: #B8D4E3;
    --tide: #7A9BB0;
    --sonar-teal: #00B4D8;
    --bio-purple: #9B5DE5;
    --reef-pink: #F15BB5;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--abyss);
    color: var(--denim);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Background gradient simulating ocean depth */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(0, 180, 216, 0.08), transparent 60%),
        radial-gradient(ellipse 60% 40% at 50% 100%, rgba(155, 93, 229, 0.06), transparent 60%),
        linear-gradient(180deg, #0B0E17 0%, #0a0f1f 50%, #060812 100%);
    z-index: -2;
    pointer-events: none;
}

/* Grain overlay */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0.04;
    mix-blend-mode: soft-light;
    will-change: transform;
}
.grain svg {
    width: 100%;
    height: 100%;
}

/* ==================== THE SURFACE ==================== */
.surface {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse 70% 60% at 50% 50%, rgba(0, 180, 216, 0.12), transparent 70%),
        linear-gradient(180deg, #0B0E17 0%, #0a1626 50%, #0B0E17 100%);
}

.jellyfish-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.jelly {
    position: absolute;
    width: clamp(60px, 8vw, 110px);
    height: auto;
    opacity: 0.12;
    filter: drop-shadow(0 0 8px rgba(0, 180, 216, 0.4));
    animation-name: float-up;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes float-up {
    0%   { transform: translateY(110vh) translateX(0) rotate(0deg); opacity: 0; }
    8%   { opacity: 0.14; }
    50%  { transform: translateY(50vh) translateX(20px) rotate(-3deg); opacity: 0.13; }
    92%  { opacity: 0.10; }
    100% { transform: translateY(-30vh) translateX(-20px) rotate(2deg); opacity: 0; }
}

.jelly-1 { left: 8%;  animation-duration: 22s; animation-delay: 0s; }
.jelly-2 { left: 22%; animation-duration: 28s; animation-delay: -6s; opacity: 0.10; }
.jelly-3 { left: 40%; animation-duration: 18s; animation-delay: -12s; opacity: 0.13; }
.jelly-4 { left: 55%; animation-duration: 30s; animation-delay: -3s; opacity: 0.09; }
.jelly-5 { left: 70%; animation-duration: 24s; animation-delay: -18s; opacity: 0.12; }
.jelly-6 { left: 84%; animation-duration: 26s; animation-delay: -9s; opacity: 0.11; }
.jelly-7 { left: 92%; animation-duration: 20s; animation-delay: -14s; opacity: 0.08; }

.title {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: -0.04em;
    color: var(--seafoam);
    text-shadow:
        0 0 20px rgba(0, 255, 198, 0.3),
        0 0 40px rgba(0, 255, 198, 0.15);
    text-align: center;
    z-index: 2;
    opacity: 0;
    animation: title-in 0.8s 0.3s ease-out forwards, flicker 6s 1.1s infinite;
    line-height: 1;
}

@keyframes title-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes flicker {
    0%, 4%, 100%   { opacity: 1; }
    8%             { opacity: 0.88; }
    11%            { opacity: 1; }
    17%            { opacity: 0.92; }
    23%            { opacity: 0.97; }
    29%            { opacity: 0.85; }
    34%            { opacity: 1; }
    41%            { opacity: 0.95; }
    47%            { opacity: 0.9; }
    52%            { opacity: 1; }
    63%            { opacity: 0.93; }
    71%            { opacity: 0.88; }
    78%            { opacity: 1; }
    85%            { opacity: 0.95; }
    92%            { opacity: 0.86; }
}

.subtitle {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.6vw, 1.8rem);
    color: var(--coral);
    margin-top: 1.2rem;
    transform: rotate(-2deg);
    opacity: 0;
    animation: subtitle-in 0.6s 0.8s ease-out forwards;
    z-index: 2;
    position: relative;
    padding-bottom: 4px;
}

.subtitle::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: -2px;
    height: 2px;
    background: linear-gradient(
        90deg,
        var(--sonar-teal) 0%,
        var(--bio-purple) 50%,
        var(--reef-pink) 100%
    );
    background-size: 200% 100%;
    animation: underline-shift 5s linear infinite;
    border-radius: 2px;
}

@keyframes underline-shift {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

@keyframes subtitle-in {
    from { opacity: 0; transform: rotate(-2deg) translateY(6px); }
    to { opacity: 1; transform: rotate(-2deg) translateY(0); }
}

.trident-scroll {
    position: absolute;
    bottom: clamp(20px, 4vh, 40px);
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 48px;
    display: block;
    animation: pulse 2s ease-in-out infinite;
    opacity: 0;
    animation-delay: 1.5s;
    animation-fill-mode: forwards;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: translateX(-50%) translateY(0); }
    50%      { opacity: 1; transform: translateX(-50%) translateY(6px); }
}

.trident-scroll svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 6px rgba(0, 255, 198, 0.4));
}

/* ==================== WAVE DIVIDERS ==================== */
.wave-divider {
    width: 100%;
    height: 60px;
    overflow: hidden;
    pointer-events: none;
}
.wave-divider.mid {
    height: 40px;
    margin: 4vh 0;
}
.wave-divider svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 4px rgba(0, 255, 198, 0.2));
}
.wave-divider path {
    stroke-dasharray: 12 8;
    animation: wave-flow 6s linear infinite;
}
@keyframes wave-flow {
    from { stroke-dashoffset: 0; }
    to   { stroke-dashoffset: -200; }
}

/* ==================== THE REEF ==================== */
.reef {
    position: relative;
    padding: clamp(2rem, 4vw, 4rem) clamp(1rem, 4vw, 3rem) clamp(2rem, 4vw, 4rem);
    max-width: 1400px;
    margin: 0 auto;
}

.reef-cluster {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: clamp(12px, 2vw, 24px);
    margin-bottom: 8vh;
}

/* Cards */
.card {
    --card-tilt: 0;
    --card-index: 0;
    --border-hue: 180deg;
    background: var(--trench-navy);
    border: 2px solid hsl(var(--border-hue), 80%, 60%);
    border-radius: 4px;
    padding: clamp(16px, 3vw, 32px);
    position: relative;
    transform: rotate(calc(var(--card-tilt) * 1deg));
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    box-shadow:
        0 -20px 60px -10px rgba(255, 217, 61, 0.06),
        0 0 0 1px rgba(0, 180, 216, 0.05),
        0 8px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation:
        card-in 0.7s ease-out forwards,
        border-glow 8s linear infinite;
    animation-delay: calc(var(--card-index) * 0.08s), calc(var(--card-index) * -1s);
    overflow: hidden;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(30px) rotate(calc(var(--card-tilt) * 1deg)); }
    to   { opacity: 1; transform: translateY(0) rotate(calc(var(--card-tilt) * 1deg)); }
}

@keyframes border-glow {
    0%   { --border-hue: 180deg; }
    33%  { --border-hue: 280deg; }
    66%  { --border-hue: 330deg; }
    100% { --border-hue: 540deg; }
}

/* Fallback for browsers without @property — animate border-color directly */
@supports not (background: paint(something)) {
    .card {
        animation: card-in 0.7s ease-out forwards, border-cycle-fallback 8s linear infinite;
    }
    @keyframes border-cycle-fallback {
        0%   { border-color: var(--sonar-teal); }
        33%  { border-color: var(--bio-purple); }
        66%  { border-color: var(--reef-pink); }
        100% { border-color: var(--sonar-teal); }
    }
}

.card:hover {
    transform: rotate(calc(var(--card-tilt) * 1deg)) translateY(-4px);
    box-shadow:
        0 -20px 60px -10px rgba(255, 217, 61, 0.15),
        0 0 0 1px rgba(0, 180, 216, 0.1),
        0 14px 32px rgba(0, 0, 0, 0.6);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 40% at 50% 0%, rgba(255, 217, 61, 0.04), transparent 70%);
    pointer-events: none;
    transition: opacity 0.4s ease;
    opacity: 0.8;
}

.card:hover::before { opacity: 1.4; }

/* Lit card with extra candle glow */
.card--lit {
    box-shadow:
        0 -25px 80px -10px rgba(255, 217, 61, 0.12),
        0 0 0 1px rgba(0, 180, 216, 0.05),
        0 8px 24px rgba(0, 0, 0, 0.5);
}

.card--lit:hover {
    box-shadow:
        0 -25px 80px -10px rgba(255, 217, 61, 0.22),
        0 0 0 1px rgba(0, 180, 216, 0.1),
        0 14px 32px rgba(0, 0, 0, 0.6);
}

/* Card content */
.card-tag {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--tide);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.card-title {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: -0.02em;
    color: var(--seafoam);
    text-shadow: 0 0 20px rgba(0, 255, 198, 0.3);
    margin-bottom: 1rem;
    line-height: 1.1;
}

.card-body {
    font-family: 'DM Sans', system-ui, sans-serif;
    color: var(--denim);
    margin-bottom: 0.9rem;
}

.card-body:last-child { margin-bottom: 0; }

.card-note {
    font-family: 'Caveat', cursive;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--candle);
    transform: rotate(-1deg);
    margin-top: 1rem;
    display: inline-block;
}

.card-mono {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 400;
    color: var(--sonar-teal);
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    margin: 0.6rem 0;
    padding: 0.5rem 0.8rem;
    background: rgba(0, 180, 216, 0.08);
    border-left: 3px solid var(--sonar-teal);
    display: inline-block;
}

/* Trident bullet list */
.trident-list {
    list-style: none;
    padding: 0;
    margin-top: 0.8rem;
}

.trident-list li {
    position: relative;
    padding-left: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--denim);
}

.trident-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 1.2rem;
    height: 1.2rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M4 4 L4 9 M10 2 L10 9 M16 4 L16 9 M4 9 L16 9 L16 11 L4 11 Z M10 11 L10 18 M7 18 L13 18' fill='none' stroke='%23F15BB5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-size: contain;
}

/* Sticky note */
.sticky {
    background: rgba(255, 217, 61, 0.08);
    border: 1px dashed rgba(255, 217, 61, 0.4);
    padding: 1rem 1.2rem;
    border-radius: 2px;
    transform: rotate(-1.5deg);
    font-family: 'Caveat', cursive;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--candle);
    margin: 0.6rem 0;
    line-height: 1.3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.sticky.sticky-coral {
    background: rgba(255, 107, 157, 0.08);
    border-color: rgba(255, 107, 157, 0.4);
    color: var(--coral);
    transform: rotate(2deg);
}

/* Candle on lit cards */
.candle {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 46px;
    z-index: 2;
    filter: drop-shadow(0 0 12px rgba(255, 217, 61, 0.5));
}

.candle svg { width: 100%; height: 100%; }

.flame {
    transform-origin: 50% 100%;
    animation: flicker-flame 0.18s ease-in-out infinite alternate;
}

.flame-inner {
    transform-origin: 50% 100%;
    animation: flicker-flame-inner 0.13s ease-in-out infinite alternate;
}

@keyframes flicker-flame {
    0%   { transform: scale(1, 1) translateY(0); opacity: 0.9; }
    100% { transform: scale(0.92, 1.08) translateY(-1px); opacity: 1; }
}

@keyframes flicker-flame-inner {
    0%   { transform: scale(1, 0.95); opacity: 0.85; }
    100% { transform: scale(0.88, 1.05); opacity: 1; }
}

/* Circuit art container */
.circuit-art {
    margin: 1rem 0;
    background: rgba(11, 14, 23, 0.5);
    border-radius: 4px;
    padding: 0.5rem;
}

.circuit-art svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Jelly illustration */
.jelly-illu {
    margin: 1rem auto;
    max-width: 140px;
    animation: bob 4s ease-in-out infinite;
}

.jelly-illu svg {
    width: 100%;
    height: auto;
    display: block;
}

@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* Entry list */
.entry-list {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    counter-reset: entry;
}

.entry-list li {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px dashed rgba(122, 155, 176, 0.2);
}

.entry-list li:last-child { border-bottom: none; }

.entry-date {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    color: var(--candle);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.entry-text {
    color: var(--denim);
    line-height: 1.55;
}

/* ==================== THE TRENCH ==================== */
.trench {
    padding: clamp(2rem, 5vw, 5rem) clamp(1rem, 4vw, 3rem) clamp(3rem, 6vw, 6rem);
    max-width: 1400px;
    margin: 0 auto;
}

.trench-card {
    background: linear-gradient(180deg, var(--trench-navy) 0%, #080c18 100%);
    border: 2px solid var(--bio-purple);
    border-radius: 6px;
    padding: clamp(1.5rem, 4vw, 3rem);
    position: relative;
    box-shadow:
        0 -25px 80px -10px rgba(155, 93, 229, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 0 80px rgba(0, 0, 0, 0.4);
    animation: trench-glow 12s linear infinite;
}

@keyframes trench-glow {
    0%   { border-color: var(--bio-purple); box-shadow: 0 -25px 80px -10px rgba(155, 93, 229, 0.18), 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 80px rgba(0, 0, 0, 0.4); }
    50%  { border-color: var(--sonar-teal); box-shadow: 0 -25px 80px -10px rgba(0, 180, 216, 0.18), 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 80px rgba(0, 0, 0, 0.4); }
    100% { border-color: var(--bio-purple); box-shadow: 0 -25px 80px -10px rgba(155, 93, 229, 0.18), 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 80px rgba(0, 0, 0, 0.4); }
}

.trench-card .card-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.treasure-map {
    background: rgba(11, 14, 23, 0.6);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: 4px;
    padding: 1rem;
    margin: 1.5rem 0;
}

.treasure-map svg {
    width: 100%;
    height: auto;
    display: block;
}

.trench-line {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.3rem, 3vw, 2rem);
    color: var(--tide);
    text-align: center;
    margin: 2rem 0 1rem;
    transform: rotate(-1deg);
}

.trench-meta {
    text-align: center;
    color: var(--tide);
    font-size: 0.95rem;
    line-height: 1.7;
    padding-top: 1rem;
    border-top: 1px dashed rgba(122, 155, 176, 0.2);
}

.trench-meta p {
    margin: 0.4rem 0;
}

.trench-meta .card-mono {
    margin-top: 0.8rem;
}

/* ==================== SONAR NAV ==================== */
.sonar {
    position: fixed;
    bottom: clamp(16px, 3vw, 32px);
    right: clamp(16px, 3vw, 32px);
    z-index: 200;
}

.sonar-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--trench-navy);
    border: 2px solid var(--seafoam);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow:
        0 0 20px rgba(0, 255, 198, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sonar-button:hover {
    transform: scale(1.08);
    box-shadow:
        0 0 30px rgba(0, 255, 198, 0.5),
        0 6px 16px rgba(0, 0, 0, 0.7);
}

.sonar-icon {
    width: 26px;
    height: 26px;
    transition: transform 0.4s ease;
}

.sonar.is-open .sonar-icon {
    transform: rotate(45deg) scale(1.1);
}

.sonar-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--seafoam);
    opacity: 0;
    animation: sonar-ring 2.5s ease-out infinite;
    pointer-events: none;
}

@keyframes sonar-ring {
    0%   { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.8); opacity: 0; }
}

.sonar-menu {
    position: absolute;
    bottom: 24px;
    right: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.sonar-item {
    position: absolute;
    width: 40px;
    height: 40px;
    bottom: 0;
    right: 0;
    transform: translate(0, 0) scale(0);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    pointer-events: none;
}

.sonar.is-open .sonar-item {
    pointer-events: auto;
    opacity: 1;
}

/* Radial positions - distance ~110px from center */
.sonar.is-open .sonar-item[data-angle="0"]   { transform: translate(0, -110px) scale(1); transition-delay: 0.05s; }
.sonar.is-open .sonar-item[data-angle="315"] { transform: translate(-78px, -78px) scale(1); transition-delay: 0.10s; }
.sonar.is-open .sonar-item[data-angle="270"] { transform: translate(-110px, 0) scale(1); transition-delay: 0.15s; }
.sonar.is-open .sonar-item[data-angle="225"] { transform: translate(-78px, 78px) scale(1); transition-delay: 0.20s; }
.sonar.is-open .sonar-item[data-angle="180"] { transform: translate(0, 110px) scale(1); transition-delay: 0.25s; }

.sonar-item a {
    display: flex;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--trench-navy);
    border: 1.5px solid currentColor;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.sonar-item:nth-child(1) a { color: var(--seafoam); }
.sonar-item:nth-child(2) a { color: var(--coral); }
.sonar-item:nth-child(3) a { color: var(--candle); }
.sonar-item:nth-child(4) a { color: var(--bio-purple); }
.sonar-item:nth-child(5) a { color: var(--reef-pink); }

.sonar-item a:hover {
    transform: scale(1.15);
    box-shadow: 0 0 20px currentColor, 0 4px 12px rgba(0, 0, 0, 0.6);
}

.sonar-item a::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    color: var(--denim);
    background: rgba(11, 14, 23, 0.85);
    padding: 2px 8px;
    border-radius: 3px;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.sonar-item a:hover::after { opacity: 1; }

.sonar-item a svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .reef-cluster {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .reef-cluster .card { grid-column: span 1 !important; }
    .title { font-size: clamp(2.5rem, 14vw, 5rem); }

    .sonar {
        bottom: 16px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    .sonar-menu { bottom: 24px; right: 50%; transform: translateX(50%); }

    .sonar.is-open .sonar-item[data-angle="0"]   { transform: translate(0, -90px) scale(1); }
    .sonar.is-open .sonar-item[data-angle="315"] { transform: translate(-65px, -65px) scale(1); }
    .sonar.is-open .sonar-item[data-angle="270"] { transform: translate(-90px, 0) scale(1); }
    .sonar.is-open .sonar-item[data-angle="225"] { transform: translate(65px, -65px) scale(1); }
    .sonar.is-open .sonar-item[data-angle="180"] { transform: translate(90px, 0) scale(1); }
}

@media (max-width: 480px) {
    .candle { width: 22px; height: 36px; top: 8px; right: 8px; }
    .card { padding: 16px; }
    .entry-list li { grid-template-columns: 50px 1fr; gap: 0.6rem; }
}

/* Selection */
::selection {
    background: rgba(0, 255, 198, 0.25);
    color: var(--seafoam);
}
