/* ========== Animations ========== */
@keyframes crt-flicker {
    0%   { opacity: 1; }
    10%  { opacity: 0.7; }
    20%  { opacity: 0.95; }
    30%  { opacity: 0.8; }
    50%  { opacity: 0.6; }
    70%  { opacity: 0.95; }
    80%  { opacity: 0.8; }
    100% { opacity: 1; }
}
@keyframes icon-toggle {
  0% { transform: rotate(0deg) scale(1); }
  40% { transform: rotate(20deg) scale(1.2); }
  60% { transform: rotate(-20deg) scale(1.2); }
  100% { transform: rotate(0deg) scale(1); }
}
.dark-mode-icon-animate {
  animation: icon-toggle 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
}

/* ========== CRT Effects ========== */
html.dark body {
    background-color: var(--color-stone-900);
    text-shadow: 0 0 1px var(--color-amber-100, #fef3c7, 0.5);
}
html.dark::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    /* scan lines: darker in dark mode */
    background: repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.12) 0,
            rgba(0, 0, 0, 0.12) 1px,
            transparent 1px,
            transparent 3px
    );
    z-index: 2000;
    pointer-events: none;
    animation: crt-flicker 0.1s infinite;
}
html:not(.dark) body {
    background-color: var(--color-amber-100);
    color: var(--color-stone-800);
    text-shadow: 0 0 1px #29252411;
}
html:not(.dark)::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    /* scan lines: more visible in light mode */
    background: repeating-linear-gradient(
        0deg,
        rgba(41, 37, 36, 0.07) 0,   /* stone-800, higher opacity */
        rgba(41, 37, 36, 0.07) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 2000;
    pointer-events: none;
    animation: crt-flicker 0.1s infinite;
}
html.no-crt::after {
  display: none !important;
}

/* ========== Layout ========== */
html, body {
    height: 100%;
    min-height: 100vh;
}
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main {
    flex: 1 0 auto;
}
footer {
    flex-shrink: 0;
}

/* ========== Accessibility ========== */
.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;
}
.focus\:not-sr-only:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    z-index: 1000;
}

/* ========== Code Block Copy Button ========== */
.copy-code-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(30,41,59,0.08);
    border: none;
    border-radius: 0.25rem;
    padding: 0.1rem 0.3rem;
    font-size: 0.85rem;
    color: #64748b;
    opacity: 0.7;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s, opacity 0.2s;
}
.copy-code-btn:hover {
    background: #E69F00; /* CUD Orange */
    color: white;
    opacity: 1;
}

/* ========== Link and Button Focus/Hover ========== */
a, button {
    outline: none;
    transition: box-shadow 0.15s, background 0.15s, color 0.15s;
}
a:hover, a:focus {
    box-shadow: 0 2px 0 0 #0072B2, 0 0 0 2px #0072B233; /* CUD Blue */
    background: #F0E442; /* CUD Yellow for highlight */
    color: #0072B2 !important; /* CUD Blue */
    text-decoration: underline;
}
button:hover, button:focus {
    box-shadow: 0 2px 8px 0 #0072B233, 0 0 0 2px #E69F00; /* CUD Blue shadow, CUD Orange outline */
    background: #E69F00; /* CUD Orange */
    color: #fff !important;
}
button:focus-visible, a:focus-visible {
    outline: 2px solid #0072B2; /* CUD Blue */
    outline-offset: 2px;
} 

/* ========== CRT Text Glow ========== */
.crt-glow {
  text-shadow:
    0 0 2px #f59e0b, /* Amber glow for dark mode */
    0 0 1px #292524;  /* Subtle dark shadow for light mode */
}
html:not(.dark) .crt-glow {
  text-shadow:
    0 0 2px #f59e0b,   /* Amber glow */
    0 0 1px #29252422;
}
html.dark .crt-glow {
  text-shadow:
    0 0 2px #f59e0b,
    0 0 4px #fef3c7;
}

/* ========== Prose/Markdown Consistency ========== */
.prose {
  color: #292524;
  font-family: monospace, monospace;
}
.dark .prose {
  color: #fef3c7;
}
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  color: #292524;
  text-shadow: 0 0 1px #29252422;
}
.dark .prose h1, .dark .prose h2, .dark .prose h3, .dark .prose h4, .dark .prose h5, .dark .prose h6 {
  color: #fef3c7;
  text-shadow: 0 0 2px #f59e0b;
}
.prose blockquote {
  border-left: 4px solid #1c1917;
  background: #fef3c7;
  color: #292524;
  padding-left: 1.25em;
  margin-left: 0;
  font-style: italic;
}
.dark .prose blockquote {
  border-left: 4px solid #fef3c7;
  background: #292524;
  color: #fef3c7;
}

/* ========== Prose Code Block Background and Border ========== */
.prose pre {
  background: #fef3c7;
  border: 1px solid #1c1917;
  color: #292524;
  border-radius: 0.375rem;
  padding: 1em;
  overflow-x: auto;
}
.dark .prose pre {
  background: #292524;
  border: 1px solid #fef3c7;
  color: #fef3c7;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
}
.dark .prose pre code {
  background: none;
  border: none;
  padding: 0;
}

/* ========== Prose Skill Tags/List Items ========== */
.prose ul > li, .prose ol > li {
  background: none;
  border: none;
  color: inherit;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0.5em;
  display: list-item;
  font-weight: normal;
}
.dark .prose ul > li, .dark .prose ol > li {
  background: none;
  border: none;
  color: inherit;
}

/* ========== CRT Glow for Prose ========== */
.prose, .prose * {
  text-shadow: 0 0 1px #29252422;
}
.dark .prose, .dark .prose * {
  text-shadow: 0 0 2px #f59e0b;
} 

/* ========== Search Bar Accessibility Fix ========== */
input[type="text"][placeholder^="Search"] {
  background: #fff;
  color: #292524;
  border: 2px solid #292524;
  font-weight: bold;
  box-shadow: 0 2px 8px 0 #0072B233;
  transition: box-shadow 0.15s, border-color 0.15s;
}
html.dark input[type="text"][placeholder^="Search"] {
  background: #1c1917;
  color: #fef3c7;
  border: 2px solid #fef3c7;
  font-weight: bold;
  box-shadow: 0 2px 8px 0 #f59e0b33;
}
input[type="text"][placeholder^="Search"]:focus {
  outline: 2px solid #f59e0b;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px #f59e0b55;
}
html.dark input[type="text"][placeholder^="Search"]:focus {
  outline: 2px solid #f59e0b;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px #f59e0b99;
} 

/* ========== Remove CRT effect for PDF viewer ========== */
.no-crt-effect, .no-crt-effect * {
  text-shadow: none !important;
  filter: none !important;
  background: white !important;
  position: relative;
  z-index: 10;
}
.no-crt-effect iframe {
  background: white !important;
  filter: none !important;
  text-shadow: none !important;
}
.no-crt-effect::after {
  display: none !important;
} 