/* ROASOD UI effects — loaded after each page's own <style> so these layer on top. */

@property --beam-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

:root {
    --ro-accent: 59, 130, 246;
    --ro-glow: 147, 197, 253;
    --ro-prompt: #60a5fa;
    --ro-on: #2563eb;
    --ro-pop: 8, 18, 44;
}

/* ---------- 1. Depth stacking & specular highlights ---------- */
.glass-card,
.glass-button {
    background-image:
        radial-gradient(120% 80% at 0% 0%, rgba(var(--ro-glow), 0.10), transparent 55%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 45%);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.25),
        0 18px 40px -20px rgba(0, 0, 0, 0.65);
}
.glass-button:hover {
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.25),
        0 14px 30px -12px rgba(var(--ro-accent), 0.45);
}

/* ---------- 2. Cursor-tracking border glow ---------- */
.glass-card::before,
.tilt::before,
.contact-line::before,
.beam-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    pointer-events: none;
    z-index: 1;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.glass-card::before,
.tilt::before,
.contact-line::before {
    background: radial-gradient(
        240px circle at var(--mx, 50%) var(--my, 50%),
        rgba(var(--ro-glow), 0.95),
        rgba(var(--ro-accent), 0.35) 40%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.35s ease;
}
.glass-card.glow-near::before,
.tilt.glow-near::before,
.contact-line.glow-near::before { opacity: 1; }

/* Soft inner light that follows the cursor too */
.glass-card.glow-near {
    background-image:
        radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--ro-accent), 0.10), transparent 70%),
        radial-gradient(120% 80% at 0% 0%, rgba(var(--ro-glow), 0.10), transparent 55%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 45%);
}

/* ---------- 3. Beam borders (rotating conic highlight) ---------- */
.beam-border { position: relative; }
.beam-border::before {
    background: conic-gradient(
        from var(--beam-angle),
        transparent 0deg,
        transparent 250deg,
        rgba(var(--ro-glow), 0.9) 320deg,
        #ffffff 340deg,
        transparent 360deg
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: beam-spin 3.2s linear infinite;
}
.beam-border:hover::before,
.beam-border:focus-visible::before,
.beam-border.beam-on::before { opacity: 1; }
@keyframes beam-spin { to { --beam-angle: 360deg; } }

/* Shimmer sweep across key buttons */
.beam-border:not(.btn)::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.18) 50%, transparent 65%);
    background-size: 250% 100%;
    background-position: 150% 0;
    transition: background-position 0.9s ease;
}
.beam-border:not(.btn):hover::after { background-position: -50% 0; }

/* Page-entrance beam on hero buttons */
.beam-border.beam-intro::before { opacity: 1; animation: beam-spin 3.2s linear 2, beam-fade 6.4s ease forwards; }
@keyframes beam-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 4. SVG film grain ---------- */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
    opacity: 0.045;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n' x='0' y='0'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-size: 220px 220px;
}

/* ---------- 5. Bento grid ---------- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: minmax(150px, auto);
    gap: 1rem;
}
.bento-cell {
    border-radius: 1.5rem;
    padding: 1.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.bento-a { grid-column: span 4; grid-row: span 2; }
.bento-b { grid-column: span 2; }
.bento-c { grid-column: span 2; }
.bento-d { grid-column: span 3; }
.bento-e { grid-column: span 3; }
@media (max-width: 900px) {
    .bento-a, .bento-b, .bento-c, .bento-d, .bento-e { grid-column: span 6; grid-row: auto; }
}
.bento-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgb(var(--ro-accent));
    margin-bottom: 0.5rem;
}
.bento-terminal {
    flex: 1;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: #c7d2fe;
    min-height: 190px;
    white-space: pre-wrap;
}
.bento-terminal .t-prompt { color: var(--ro-prompt); }
.bento-terminal .t-ok { color: #4ade80; }
.bento-terminal .t-dim { color: #6b7280; }
.bento-cursor {
    display: inline-block;
    width: 0.5em;
    height: 1em;
    background: rgb(var(--ro-glow));
    vertical-align: text-bottom;
    animation: bento-blink 1s steps(2) infinite;
}
@keyframes bento-blink { 50% { opacity: 0; } }
.bento-counter {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #ffffff, rgb(var(--ro-glow)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-variant-numeric: tabular-nums;
}
.bento-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #4ade80;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
    animation: bento-ping 1.8s infinite;
    margin-right: 0.5rem;
}
@keyframes bento-ping {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
    70% { box-shadow: 0 0 0 9px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.bento-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    margin-top: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}
.bento-switch {
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    position: relative;
    transition: background 0.25s ease;
    flex-shrink: 0;
}
.bento-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bento-toggle-row[aria-checked='true'] .bento-switch { background: var(--ro-on); }
.bento-toggle-row[aria-checked='true'] .bento-switch::after { transform: translateX(16px); }
.bento-bars { display: flex; align-items: flex-end; gap: 6px; height: 64px; margin-top: auto; padding-top: 0.75rem; }
.bento-bars span {
    flex: 1;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, var(--ro-prompt), rgba(var(--ro-accent), 0.25));
    transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- 6. Command palette ---------- */
#ro-cmdk-hint {
    position: fixed;
    left: 1.25rem;
    bottom: 1.25rem;
    z-index: 55;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #e5e7eb;
    cursor: pointer;
}
#ro-cmdk-hint kbd, #ro-cmdk-foot kbd {
    font-family: inherit;
    font-size: 0.68rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
}
#ro-cmdk-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 14vh 1rem 1rem;
    background: rgba(0, 6, 20, 0.6);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
#ro-cmdk-overlay.open { display: flex; animation: cmdk-fade 0.18s ease both; }
@keyframes cmdk-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cmdk-pop { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: none; } }
#ro-cmdk {
    width: 100%;
    max-width: 560px;
    border-radius: 1.25rem;
    overflow: hidden;
    background: rgba(var(--ro-pop), 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 30px 80px -20px rgba(0, 0, 0, 0.8);
    animation: cmdk-pop 0.28s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
#ro-cmdk-input {
    font-family: inherit;
    width: 100%;
    padding: 1.1rem 1.25rem;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    outline: none;
}
#ro-cmdk-list { max-height: 320px; overflow-y: auto; padding: 0.5rem; scrollbar-width: thin; }
.ro-cmdk-group { font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; color: #6b7280; padding: 0.6rem 0.75rem 0.3rem; }
.ro-cmdk-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    color: #d1d5db;
    cursor: pointer;
}
.ro-cmdk-item .hint { font-size: 0.72rem; color: #6b7280; }
.ro-cmdk-item.active { background: rgba(var(--ro-accent), 0.22); color: #fff; }
.ro-cmdk-item mark { background: transparent; color: rgb(var(--ro-glow)); font-weight: 700; }
#ro-cmdk-empty { padding: 1.5rem; text-align: center; color: #6b7280; font-size: 0.9rem; }
#ro-cmdk-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    font-size: 0.72rem;
    color: #6b7280;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
#ro-cmdk-sound { background: none; border: 0; color: inherit; cursor: pointer; font-size: 0.72rem; }
#ro-cmdk-sound:hover { color: #fff; }
@media (max-width: 640px) { #ro-cmdk-hint kbd { display: none; } }

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    .beam-border::before { animation: none; }
    .bento-cursor, .bento-live-dot { animation: none; }
    #ro-cmdk, #ro-cmdk-overlay.open { animation: none; }
}

/* ---------- Monochrome theme (portfolio page: <body class="ro-mono">) ---------- */
.ro-mono {
    --ro-accent: 228, 228, 228;
    --ro-glow: 255, 255, 255;
    --ro-prompt: #e4e4e4;
    --ro-on: #8c8c8c;
    --ro-pop: 16, 16, 16;
}
/* .tilt keeps its own gradient background; add highlight via shadow only, and a springy return */
.ro-mono .tilt {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    transition: border-color .3s ease, box-shadow .4s ease, transform .45s cubic-bezier(.34, 1.4, .64, 1);
}
.ro-mono .tilt:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 30px 60px rgba(0, 0, 0, 0.55); }
.ro-mono .btn-ghost, .ro-mono .contact-line { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.ro-mono #ro-cmdk-hint {
    background: rgba(20, 20, 20, 0.75);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line-hi);
    font-family: 'Inter', sans-serif;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 30px rgba(0, 0, 0, 0.5);
}
.ro-mono #ro-cmdk-hint:hover { border-color: var(--text); }
.ro-mono #ro-cmdk-overlay { background: rgba(0, 0, 0, 0.6); }
.ro-mono .bento-label { font-family: 'JetBrains Mono', monospace; letter-spacing: .16em; color: var(--accent-2); }
.ro-mono .bento-counter { font-family: 'Space Grotesk', sans-serif; }
.ro-mono .bento-cell p:not(.bento-label) { font-size: 14px; }
