/* ==========================================================================
   Cyberpunk Netrunner skin for Papyrus
   Loaded after main.css + pygment.css — overrides Tailwind's compiled
   utility classes directly rather than rebuilding the Tailwind pipeline.
   ========================================================================== */

:root {
    --void: #0b0614;
    --panel: #130a24;
    --panel-line: #241642;
    --cyan: #00e5ff;
    --magenta: #ff2bd6;
    --violet: #a64dff;
    --text: #d8d4e8;
    --text-dim: #8b84ab;
    --glow-cyan: 0 0 4px #00e5ff, 0 0 14px rgba(0, 229, 255, .55);
    --glow-magenta: 0 0 4px #ff2bd6, 0 0 14px rgba(255, 43, 214, .55);
    --glow-violet: 0 0 4px #a64dff, 0 0 14px rgba(166, 77, 255, .5);
}

/* ---- base surface -------------------------------------------------- */

html,
body,
.dark .dark\:bg-neutral-900,
.bg-neutral-100 {
    background-color: var(--void) !important;
}

body {
    font-family: 'Share Tech Mono', ui-monospace, Menlo, Consolas, monospace;
    color: var(--text);
    position: relative;
}

h1, h2, h3, h4, h5, h6,
.font-semibold,
.font-bold {
    font-family: 'Orbitron', 'Share Tech Mono', sans-serif;
    letter-spacing: .02em;
}

/* ---- text / border color overrides (Tailwind dark: variants) ------- */

.text-zinc-800,
.dark .dark\:text-zinc-300,
.dark .dark\:text-gray-300 {
    color: var(--text) !important;
}

.text-zinc-700,
.dark .dark\:text-zinc-400,
.text-zinc-600 {
    color: var(--text-dim) !important;
}

.border-zinc-800,
.dark .dark\:border-zinc-300,
.border-zinc-500 {
    border-color: var(--violet) !important;
}

p a,
.dark p a {
    color: var(--cyan) !important;
    text-decoration-color: var(--magenta) !important;
    transition: text-shadow .2s ease, color .2s ease;
}

p a:hover {
    color: var(--magenta) !important;
    text-shadow: var(--glow-magenta);
}

/* prose (article body) dark-mode token overrides */
.dark .prose-headings\:dark\:text-zinc-300 :is(:where(h1, h2, h3, h4, h5, h6, th):not(:where([class~="not-prose"] *))) {
    color: var(--text) !important;
}

.dark .dark\:prose-a\:text-slate-400 :is(:where(a):not(:where([class~="not-prose"] *))) {
    color: var(--cyan) !important;
}

.dark .dark\:prose-blockquote\:text-zinc-200 :is(:where(blockquote):not(:where([class~="not-prose"] *))) {
    color: var(--violet) !important;
    border-left-color: var(--magenta) !important;
}

.dark .dark\:prose-strong\:text-zinc-200 :is(:where(strong):not(:where([class~="not-prose"] *))) {
    color: var(--magenta) !important;
}

.dark .dark\:prose-code\:bg-zinc-800 :is(:where(code):not(:where([class~="not-prose"] *))) {
    background-color: var(--panel) !important;
}

.dark .dark\:prose-code\:text-zinc-200 :is(:where(code):not(:where([class~="not-prose"] *))) {
    color: var(--cyan) !important;
}

.dark .dark\:prose-pre\:bg-zinc-800 :is(:where(pre):not(:where([class~="not-prose"] *))) {
    background-color: var(--panel) !important;
    border: 1px solid var(--panel-line);
    box-shadow: inset 0 0 20px rgba(166, 77, 255, .08);
}

.dark .dark\:prose-pre\:text-zinc-200 :is(:where(pre):not(:where([class~="not-prose"] *))) {
    color: var(--text) !important;
}

/* pagination buttons */
.bg-zinc-800,
.dark .dark\:bg-zinc-300 {
    background-color: var(--panel) !important;
    border: 1px solid var(--cyan);
    box-shadow: var(--glow-cyan);
}

.text-zinc-100,
.dark .dark\:text-zinc-800 {
    color: var(--cyan) !important;
}

.dark .dark\:hover\:bg-zinc-800:hover {
    background-color: var(--panel) !important;
    box-shadow: var(--glow-magenta);
}

/* ---- nav / site title ----------------------------------------------- */

nav a {
    transition: color .2s ease, text-shadow .2s ease;
}

nav a:hover {
    color: var(--cyan) !important;
    text-shadow: var(--glow-cyan);
}

li > a.border-b-2 {
    border-color: var(--magenta) !important;
    color: var(--magenta) !important;
    text-shadow: var(--glow-magenta);
}

.cyber-title a {
    background: linear-gradient(90deg, var(--cyan), var(--magenta) 60%, var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    animation: title-pulse 3.6s ease-in-out infinite alternate;
}

@keyframes title-pulse {
    from { filter: drop-shadow(0 0 2px rgba(0, 229, 255, .35)); }
    to   { filter: drop-shadow(0 0 10px rgba(255, 43, 214, .55)); }
}

/* one-shot glitch flicker on load */
.glitch {
    position: relative;
}

.glitch a {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    font-family: 'Orbitron', sans-serif;
    opacity: 0;
    pointer-events: none;
}

.glitch::before {
    color: var(--cyan);
    animation: glitch-flicker 0.7s steps(2, end) 1;
}

.glitch::after {
    color: var(--magenta);
    animation: glitch-flicker-2 0.7s steps(2, end) 1;
}

@keyframes glitch-flicker {
    0%   { opacity: 0; transform: translate(0, 0); }
    10%  { opacity: .8; transform: translate(-2px, 1px); }
    25%  { opacity: 0; }
    40%  { opacity: .7; transform: translate(2px, -1px); }
    55%  { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes glitch-flicker-2 {
    0%   { opacity: 0; transform: translate(0, 0); }
    15%  { opacity: .7; transform: translate(2px, -1px); }
    30%  { opacity: 0; }
    45%  { opacity: .6; transform: translate(-2px, 1px); }
    60%  { opacity: 0; }
    100% { opacity: 0; }
}

.cyber-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: .7rem;
    letter-spacing: .08em;
    color: var(--text-dim);
    margin-top: .1rem;
}

/* status badge */
.cyber-status {
    margin-left: .75rem;
    margin-top: 1rem;
    font-size: .65rem;
    letter-spacing: .15em;
    color: var(--cyan);
    display: inline-flex;
    align-items: center;
    gap: .4em;
}

.cyber-status-dot {
    width: .5em;
    height: .5em;
    border-radius: 50%;
    background: var(--magenta);
    box-shadow: var(--glow-magenta);
    animation: dot-pulse 1.8s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
}

/* ---- ambient background: grid + scanlines --------------------------- */

.cyber-grid {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(166, 77, 255, .12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, .08) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 85%);
}

.cyber-scanlines {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0) 2px,
        rgba(0, 229, 255, .025) 3px,
        rgba(0, 0, 0, 0) 4px
    );
    opacity: .5;
}

/* ---- code blocks (pygments) ------------------------------------------ */

.highlight,
.highlight .hll {
    background: var(--panel) !important;
}

.highlight .c, .highlight .ch, .highlight .cm, .highlight .cp,
.highlight .cpf, .highlight .c1, .highlight .cs {
    color: #6c6490 !important;
    font-style: italic;
}

.highlight .k, .highlight .kc, .highlight .kd, .highlight .kn,
.highlight .kp, .highlight .kr, .highlight .kt, .highlight .ow, .highlight .nt {
    color: var(--magenta) !important;
}

.highlight .s, .highlight .sa, .highlight .sb, .highlight .sc,
.highlight .dl, .highlight .s1, .highlight .s2 {
    color: var(--cyan) !important;
}

.highlight .m, .highlight .mb, .highlight .mf, .highlight .mh,
.highlight .mi, .highlight .mo {
    color: var(--violet) !important;
}

.highlight .nf, .highlight .nc, .highlight .nb, .highlight .nd {
    color: #ff7edb !important;
}

.highlight .o, .highlight .p {
    color: var(--text) !important;
}

.highlight .g, .highlight .n, .highlight .x, .highlight .na,
.highlight .nx, .highlight .nv, .highlight .no, .highlight .nn, .highlight .py {
    color: var(--text) !important;
}

.highlight .gh { color: var(--cyan) !important; }
.highlight .gu { color: var(--violet) !important; }
.highlight .gd { color: #ff5f6d !important; }
.highlight .gi { color: #39ff88 !important; }
.highlight .gr, .highlight .gt { color: #ff5f6d !important; }

/* ---- scrollbar -------------------------------------------------------- */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--void);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--cyan), var(--magenta));
    border-radius: 6px;
}

/* ---- headshot (homepage bio) ---------------------------------------
   Neon ring + a short glitch burst on hover/tap: two tinted copies of the
   photo slice and jump sideways (RGB split) while scanlines flicker over it.
   ------------------------------------------------------------------------ */

.headshot {
    position: relative;
    width: 176px;
    height: 176px;
    padding: 3px;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--cyan), var(--violet), var(--magenta));
    box-shadow: 0 0 18px rgba(166, 77, 255, .45), 0 0 40px rgba(0, 229, 255, .15);
    margin: 0 auto 2rem;
    outline: none;
    cursor: crosshair;
    transition: box-shadow .3s ease;
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 640px) {
    .headshot {
        float: right;
        margin: .25rem 0 1rem 2.5rem;
        shape-outside: circle(50%);
    }
}

.headshot img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    border-radius: 9999px;
}

.headshot .headshot-glitch {
    position: absolute;
    inset: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}

.headshot-glitch--a { filter: sepia(1) saturate(6) hue-rotate(140deg) brightness(1.1); }
.headshot-glitch--b { filter: sepia(1) saturate(6) hue-rotate(260deg) brightness(1.1); }

/* scanlines */
.headshot::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 9999px;
    background: repeating-linear-gradient(0deg, rgba(11, 6, 20, .7) 0 1px, transparent 1px 3px);
    opacity: 0;
    pointer-events: none;
}

.headshot:hover,
.headshot:focus {
    box-shadow: 0 0 6px var(--cyan), 0 0 26px rgba(255, 43, 214, .6), 0 0 60px rgba(0, 229, 255, .3);
}

.headshot:hover > img:first-child,
.headshot:focus > img:first-child {
    animation: headshot-jitter .7s steps(1, end) 1;
}

.headshot:hover .headshot-glitch--a,
.headshot:focus .headshot-glitch--a {
    animation: headshot-slice-a .7s steps(1, end) 1;
}

.headshot:hover .headshot-glitch--b,
.headshot:focus .headshot-glitch--b {
    animation: headshot-slice-b .7s steps(1, end) 1;
}

.headshot:hover::after,
.headshot:focus::after {
    animation: headshot-scan .7s linear 1;
}

@keyframes headshot-jitter {
    0%   { transform: translate(-4px, 2px) skewX(4deg);  filter: drop-shadow(-6px 0 rgba(0, 229, 255, .95)) drop-shadow(6px 0 rgba(255, 43, 214, .95)) brightness(1.3) contrast(1.2); }
    15%  { transform: translate(4px, -2px) skewX(-6deg); filter: drop-shadow(6px 0 rgba(0, 229, 255, .95)) drop-shadow(-6px 0 rgba(255, 43, 214, .95)) brightness(.7) hue-rotate(40deg); }
    30%  { transform: translate(-3px, 0) skewX(2deg);    filter: drop-shadow(-5px 0 rgba(0, 229, 255, .95)) drop-shadow(5px 0 rgba(255, 43, 214, .95)) brightness(1.4) contrast(1.3); }
    45%  { transform: translate(3px, 2px) skewX(-3deg);  filter: drop-shadow(8px 0 rgba(0, 229, 255, .95)) drop-shadow(-8px 0 rgba(255, 43, 214, .95)) brightness(.8) hue-rotate(-40deg); }
    60%  { transform: translate(-2px, -2px);             filter: drop-shadow(-4px 0 rgba(0, 229, 255, .95)) drop-shadow(4px 0 rgba(255, 43, 214, .95)) brightness(1.2); }
    75%  { transform: translate(2px, 1px) skewX(2deg);   filter: drop-shadow(3px 0 rgba(0, 229, 255, .95)) drop-shadow(-3px 0 rgba(255, 43, 214, .95)) brightness(.9); }
    90%  { transform: translate(-1px, 0);                filter: drop-shadow(-2px 0 rgba(0, 229, 255, .9)) drop-shadow(2px 0 rgba(255, 43, 214, .9)); }
    100% { transform: none; filter: none; }
}

@keyframes headshot-slice-a {
    0%   { opacity: 1; clip-path: inset(6% 0 72% 0);  transform: translateX(-16px); }
    10%  { opacity: 1; clip-path: inset(38% 0 38% 0); transform: translateX(13px); }
    20%  { opacity: 1; clip-path: inset(66% 0 10% 0); transform: translateX(-10px); }
    30%  { opacity: 1; clip-path: inset(20% 0 58% 0); transform: translateX(18px); }
    40%  { opacity: 1; clip-path: inset(50% 0 28% 0); transform: translateX(-14px); }
    50%  { opacity: 1; clip-path: inset(2% 0 82% 0);  transform: translateX(9px); }
    60%  { opacity: 1; clip-path: inset(76% 0 4% 0);  transform: translateX(-12px); }
    70%  { opacity: 1; clip-path: inset(30% 0 52% 0); transform: translateX(7px); }
    85%  { opacity: 1; clip-path: inset(58% 0 26% 0); transform: translateX(-5px); }
    100% { opacity: 0; clip-path: inset(50% 0 50% 0); transform: none; }
}

@keyframes headshot-slice-b {
    0%   { opacity: 1; clip-path: inset(56% 0 22% 0); transform: translateX(15px); }
    10%  { opacity: 1; clip-path: inset(12% 0 66% 0); transform: translateX(-18px); }
    20%  { opacity: 1; clip-path: inset(42% 0 34% 0); transform: translateX(11px); }
    30%  { opacity: 1; clip-path: inset(82% 0 2% 0);  transform: translateX(-8px); }
    40%  { opacity: 1; clip-path: inset(26% 0 50% 0); transform: translateX(16px); }
    50%  { opacity: 1; clip-path: inset(60% 0 16% 0); transform: translateX(-12px); }
    60%  { opacity: 1; clip-path: inset(8% 0 74% 0);  transform: translateX(10px); }
    70%  { opacity: 1; clip-path: inset(46% 0 36% 0); transform: translateX(-7px); }
    85%  { opacity: 1; clip-path: inset(70% 0 14% 0); transform: translateX(4px); }
    100% { opacity: 0; clip-path: inset(50% 0 50% 0); transform: none; }
}

@keyframes headshot-scan {
    0%   { opacity: 1;   background-position: 0 0; }
    15%  { opacity: .35; }
    30%  { opacity: .95; }
    45%  { opacity: .25; }
    60%  { opacity: .85; }
    80%  { opacity: .3; }
    100% { opacity: 0;   background-position: 0 18px; }
}

/* Reduced motion: keep the ring glow, skip the glitch */
@media (prefers-reduced-motion: reduce) {
    .headshot:hover *,
    .headshot:focus *,
    .headshot:hover::after,
    .headshot:focus::after {
        animation: none !important;
    }
}

/* ---- homepage ------------------------------------------------------- */

.home-intro::after {
    content: "";
    display: block;
    clear: both;
}

.cyber-section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: .85rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--cyan);
    padding-bottom: .5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--panel-line);
}

.home-post {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .25rem 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: .75rem;
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: .5rem;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.home-post:hover {
    border-color: var(--violet);
    box-shadow: 0 0 14px rgba(166, 77, 255, .3);
}

.home-post-title {
    color: var(--text);
    font-size: 1.1rem;
}

.home-post:hover .home-post-title {
    color: var(--magenta);
}

.home-post-date {
    color: var(--text-dim);
    font-size: .8rem;
    white-space: nowrap;
    align-self: center;
}

.home-post-summary {
    grid-column: 1 / -1;
    color: var(--text-dim);
    font-size: .9rem;
}

.home-all-posts {
    display: inline-block;
    margin-top: .5rem;
    color: var(--cyan);
}

.home-all-posts:hover {
    color: var(--magenta);
    text-shadow: var(--glow-magenta);
}

/* ---- blog page ------------------------------------------------------ */

.blog-intro {
    color: var(--text-dim);
    margin: .5rem 0 2.5rem;
}

.blog-year {
    margin-bottom: 2.5rem;
}

.blog-rss {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--cyan);
}

.blog-rss:hover {
    color: var(--magenta);
    text-shadow: var(--glow-magenta);
}

/* ---- 404 page ------------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.notfound {
    margin: 4rem 0 2rem;
}

.notfound-title {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin: 0 0 2rem;
}

.notfound-code {
    position: relative;
    display: inline-block;
    align-self: flex-start;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: clamp(4.5rem, 18vw, 8rem);
    line-height: 1;
    background: linear-gradient(90deg, var(--cyan), var(--violet) 55%, var(--magenta));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 16px rgba(166, 77, 255, .45));
}

/* RGB-split glitch copies of "404", firing every few seconds */
.notfound-code::before,
.notfound-code::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    opacity: 0;
    -webkit-background-clip: initial;
    background: none;
}

.notfound-code::before {
    color: var(--cyan);
    animation: notfound-glitch-a 4s steps(1, end) infinite;
}

.notfound-code::after {
    color: var(--magenta);
    animation: notfound-glitch-b 4s steps(1, end) infinite;
}

@keyframes notfound-glitch-a {
    0%, 86%, 100% { opacity: 0; transform: none; clip-path: none; }
    88% { opacity: .9; transform: translate(-6px, 0); clip-path: inset(10% 0 60% 0); }
    91% { opacity: .9; transform: translate(5px, 0);  clip-path: inset(55% 0 20% 0); }
    94% { opacity: .9; transform: translate(-3px, 0); clip-path: inset(30% 0 45% 0); }
}

@keyframes notfound-glitch-b {
    0%, 86%, 100% { opacity: 0; transform: none; clip-path: none; }
    88% { opacity: .9; transform: translate(6px, 0);  clip-path: inset(65% 0 10% 0); }
    91% { opacity: .9; transform: translate(-5px, 0); clip-path: inset(20% 0 62% 0); }
    94% { opacity: .9; transform: translate(4px, 0);  clip-path: inset(45% 0 30% 0); }
}

.notfound-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    letter-spacing: .35em;
    text-transform: uppercase;
    color: var(--magenta);
    text-shadow: var(--glow-magenta);
}

.notfound-terminal {
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-left: 3px solid var(--cyan);
    border-radius: .5rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: .95rem;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.notfound-terminal .prompt { color: var(--cyan); margin-right: .5rem; }
.notfound-terminal .err { color: var(--magenta); }
.notfound-path { color: var(--text); }

.notfound-terminal .cursor {
    display: inline-block;
    width: .6em;
    height: 1.1em;
    margin-left: .3em;
    vertical-align: text-bottom;
    background: var(--magenta);
    animation: notfound-blink 1s steps(1, end) infinite;
}

@keyframes notfound-blink {
    50% { opacity: 0; }
}

.notfound-help {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.notfound-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.notfound-btn {
    display: inline-block;
    padding: .6rem 1.2rem;
    border: 1px solid var(--cyan);
    border-radius: .375rem;
    color: var(--cyan);
    transition: box-shadow .2s ease, color .2s ease, border-color .2s ease;
}

.notfound-btn--alt {
    border-color: var(--magenta);
    color: var(--magenta);
}

.notfound-btn:hover,
.notfound-btn:focus-visible {
    box-shadow: var(--glow-cyan);
    outline: none;
}

.notfound-btn--alt:hover,
.notfound-btn--alt:focus-visible {
    box-shadow: var(--glow-magenta);
}

@media (prefers-reduced-motion: reduce) {
    .notfound-code::before,
    .notfound-code::after,
    .notfound-terminal .cursor {
        animation: none;
    }
}

/* ---- post navigation (bottom of posts) ------------------------------ */

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin: 1rem 0;
}

.post-nav .post-nav-link {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin: 0;
}

.post-nav-link--older {
    text-align: right;
    grid-column: 2;
}

.post-nav-label {
    font-size: .75rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--cyan);
}

@media (max-width: 639px) {
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-link--older { grid-column: 1; }
}

/* ==========================================================================
   Light mode ("daylight" palette)
   Opt-in via the nav switch, which sets <html data-theme="light">. Dark stays
   the default. The same tokens are remapped, so every component follows;
   accents are deepened so all text clears WCAG AA (4.5:1) on the light surface.
   ========================================================================== */

:root {
    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
    --void: #f7f4fc;
    --panel: #ffffff;
    --panel-line: #e3dcf0;
    --cyan: #00707f;
    --magenta: #b0128c;
    --violet: #6a2fc2;
    --text: #1e1833;
    --text-dim: #585073;
    /* glows become soft tinted halos instead of neon bloom */
    --glow-cyan: 0 0 10px rgba(0, 112, 127, .22);
    --glow-magenta: 0 0 10px rgba(176, 18, 140, .2);
    --glow-violet: 0 0 10px rgba(106, 47, 194, .2);
}

/* grey Tailwind surfaces (TOC, tags, share bar) join the palette */
[data-theme="light"] .dark .dark\:bg-zinc-700,
[data-theme="light"] .dark .dark\:bg-zinc-800,
[data-theme="light"] .dark .dark\:bg-neutral-700 {
    background-color: var(--panel) !important;
    border: 1px solid var(--panel-line);
}

[data-theme="light"] .dark .dark\:hover\:bg-zinc-800:hover {
    background-color: #efe9f8 !important;
}

[data-theme="light"] .cyber-grid {
    background-image:
        linear-gradient(rgba(106, 47, 194, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 112, 127, .05) 1px, transparent 1px);
}

[data-theme="light"] .cyber-scanlines {
    display: none;
}

[data-theme="light"] .cyber-title a {
    animation: none;
    filter: none;
}

[data-theme="light"] .home-post:hover {
    box-shadow: 0 4px 18px rgba(106, 47, 194, .12);
}

[data-theme="light"] .headshot {
    box-shadow: 0 6px 24px rgba(106, 47, 194, .22);
}

[data-theme="light"] .notfound-code {
    filter: none;
}

[data-theme="light"] .dark .dark\:prose-pre\:bg-zinc-800 :is(:where(pre):not(:where([class~="not-prose"] *))) {
    box-shadow: none;
}

/* syntax colors with enough contrast on white */
[data-theme="light"] .highlight .nf,
[data-theme="light"] .highlight .nc,
[data-theme="light"] .highlight .nb,
[data-theme="light"] .highlight .nd { color: #9c1a7d !important; }
[data-theme="light"] .highlight .gd,
[data-theme="light"] .highlight .gr,
[data-theme="light"] .highlight .gt { color: #c0263a !important; }
[data-theme="light"] .highlight .gi { color: #16794a !important; }

/* brief cross-fade when the visitor flips the switch (not on page load) */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease,
        box-shadow .35s ease, fill .35s ease !important;
}

/* ---- theme switch (nav) -----------------------------------------------
   A small "power toggle": both modes are always visible as icons, and a
   glowing ring slides to frame the active one.
   ------------------------------------------------------------------------ */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    border-radius: 9999px;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 3.25rem;
    height: 1.6rem;
    padding: 0 .3rem;
    border: 1px solid var(--panel-line);
    border-radius: 9999px;
    background: var(--panel);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.theme-toggle:hover .theme-toggle-track {
    border-color: var(--violet);
    box-shadow: var(--glow-violet);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

.theme-toggle-icon {
    position: relative;
    z-index: 1;
    width: .9rem;
    height: .9rem;
    color: var(--text-dim);
    opacity: .55;
    transition: color .3s ease, opacity .3s ease;
}

/* the sliding ring */
.theme-toggle-thumb {
    position: absolute;
    top: 50%;
    left: .12rem;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 9999px;
    border: 1px solid var(--magenta);
    box-shadow: var(--glow-magenta);
    transform: translateY(-50%);
    transition: transform .3s cubic-bezier(.4, 1.4, .6, 1), border-color .3s ease, box-shadow .3s ease;
}

/* dark (default): ring on the moon */
.theme-toggle-icon--moon {
    color: var(--magenta);
    opacity: 1;
}

/* light: ring slides to the sun */
[data-theme="light"] .theme-toggle-thumb {
    transform: translate(1.62rem, -50%);
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
}

[data-theme="light"] .theme-toggle-icon--moon {
    color: var(--text-dim);
    opacity: .55;
}

[data-theme="light"] .theme-toggle-icon--sun {
    color: var(--cyan);
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle-thumb,
    .theme-toggle-icon {
        transition: none;
    }
}

/* Mobile: the switch moves to the top-right corner, centered on the title
   row and inset to the same 1rem gutter as the left edge. */
.site-nav {
    position: relative;
}

@media (max-width: 639px) {
    .nav-theme {
        position: absolute;
        top: 1.2rem;
        right: 1rem;
        padding-top: 0;
    }

    .site-nav > div:first-child {
        padding-right: 4.75rem;
    }
}

/* Very narrow phones: drop the decorative ONLINE badge so the name stays on one line */
@media (max-width: 359px) {
    .cyber-status {
        display: none;
    }
}

/* Tablet widths: keep the switch off the right edge (lg+ already has a nav margin) */
@media (min-width: 640px) and (max-width: 1023px) {
    .nav-theme {
        margin-right: 1rem;
    }
}

/* Mobile: grow the tap target to ~44px tall without moving the switch visually */
@media (max-width: 639px) {
    .theme-toggle {
        padding: .5rem;
        margin: -.5rem;
    }
}
