/* Input Font Definition */
@font-face {
    font-family: 'Input';
    src: url('/static/Input.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

/* @font-face {
    font-family: 'Input Variable';
    src: url('/static/Input.woff2') format('woff2');
    font-weight: 100 900;
    font-stretch: 50% 100%;
    font-style: normal;
} */

/* THEME CONFIGURATION 
    Using Standard Pico Blue (Azure).
    We only define custom "Technical" aesthetics here.
*/

:root {
    /* DEFAULT (LIGHT) VARIABLES */
    --brand-font: 'Input', Menlo, Monaco, 'Courier New', monospace;
    --pico-font-family: 'Input', "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Noto Sans", sans-serif, system-ui, -apple-system, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --pico-font-size: 98%;
    --code-bg: #f4f6f8; 
    --card-border: #e2e8f0;
    --card-bg: #ffffff;
    --card-header-bg: #f8fafc;
    --post-text-color: #2d3436;
    --grid-line-color: rgba(49, 112, 168, 0.05);
    --fade-overlay: linear-gradient(to bottom, transparent, #ffffff);
    
    /* Ensure Pico knows our base (will be overridden in dark mode) */
    --pico-background-color: #ffffff;
}

[data-theme="dark"] {
    /* DARK MODE OVERRIDES */
    --code-bg: #1e293b; 
    --card-border: #334155;
    --card-bg: #1e293b;
    --card-header-bg: #0f172a;
    --post-text-color: #e2e8f0;
    --grid-line-color: rgba(255, 255, 255, 0.05);
    --fade-overlay: linear-gradient(to bottom, transparent, #1e293b);
    
    /* Pico Dark Defaults */
    --pico-background-color: #13171f;
    --pico-color: #cbd5e1;
    --pico-muted-color: #94a3b8;

    /* Form fields: visible against dark backgrounds */
    --pico-form-element-background-color: #1e2433;
    --pico-form-element-border-color: #4a5568;
    --pico-form-element-active-border-color: var(--pico-primary);
    --pico-form-element-focus-color: var(--pico-primary);
}

/* TYPOGRAPHY & BRANDING */
body {
    --pico-typography-spacing-vertical: 0.75rem;
    
    background:
        linear-gradient(-90deg, var(--grid-line-color) 1px, transparent 1px),
        linear-gradient(var(--grid-line-color) 1px, transparent 1px),
        var(--pico-background-color);
    background-size:
        25px 25px,
        25px 25px,
        80px 80px,
        80px 80px,
        80px 80px,
        80px 80px,
        80px 80px,
        80px 80px;
    background-color: var(--pico-background-color);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--brand-font);
    color: var(--pico-primary);
    letter-spacing: -0.5px;
}

/* NAVIGATION BAR */
nav {
    border-bottom: 2px solid var(--pico-primary);
    padding: 0.75rem 0;
    margin-bottom: 2rem;
}

.brand-logo {
    height: 40px;
    width: auto;
    vertical-align: middle;
    margin-right: 10px;
}

.brand-text {
    font-family: var(--brand-font);
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--pico-primary);
    text-decoration: none;
    cursor: pointer;
}

/* POST CARDS */
.post-card {
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    background: var(--card-bg);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.post-card:hover {
    transform: translateY(-3px);
    border-color: var(--pico-primary);
    /* Blue-ish shadow for the hover state */
    box-shadow: 0 10px 20px rgba(1, 114, 173, 0.1);
}
.post-card h3 {
    margin-bottom: 0.5rem;
    color: var(--post-text-color); /* Updated for Dark Mode */
}
.post-card:hover h3 {
    color: var(--pico-primary);
}

/* UTILITY: Stretched Link (Makes entire card clickable) */
.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

/* FIX: Lift embedded links ABOVE the stretched link so they still work */
.post-card p a {
    position: relative;
    z-index: 2; 
}

/* MARKDOWN BODY STYLES */
.markdown-body {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--pico-color);
}
.markdown-body a {
    color: var(--pico-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.markdown-body pre {
    background-color: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
}
.markdown-body blockquote {
    border-left: 4px solid var(--pico-primary);
    background: var(--code-bg);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--pico-muted-color);
}

/* Blog Post Image Sizing */
.markdown-body img {
    max-width: min(100%, 800px); /* Scales down on mobile, max 1024px on desktop */
    max-height: 720px;          /* Maximum height for blog post images */
    height: auto;               /* Ensures aspect ratio is maintained */
    display: block;             /* Allows margin auto for centering */
    margin: 0 auto;             /* Centers the image */
}

/* MAKER'S REEL (Marquee) */
.makers-reel {
    position: relative;
    width: 100%;
    height: 320px; /* Adjust height as needed */
    overflow: hidden;
    background: var(--code-bg);
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    margin-bottom: 4rem; /* Spacing from next section */
}

.makers-reel-track {
    display: flex;
    gap: 1rem;
    position: absolute;
    left: 0;
    /* Use translate3d to force GPU acceleration */
    animation: scroll 60s linear infinite; 
    width: max-content;
    will-change: transform;
}

/* Only pause on hover if the device supports hover (desktop) */
@media (hover: hover) {
    .makers-reel:hover .makers-reel-track {
        animation-play-state: paused;
    }
}

.makers-reel-item {
    position: relative;
    height: 300px; /* Fixed height for uniformity */
    width: auto;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.makers-reel-item img {
    height: 100%;
    width: auto;
    display: block;
    object-fit: cover;
}

.makers-reel-item:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 8px 12px rgba(0,0,0,0.15);
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%); /* Move half way, since we duplicate content */
    }
}

/* BINARY VISUALIZER TOOL */
.binary-tool-container {
    max-width: 1000px;
    margin: 0 auto 4rem;
}

.binary-tabs {
    display: flex;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 0;
}

.binary-tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--brand-font);
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.binary-tab-btn:hover {
    background-color: var(--code-bg);
    color: var(--pico-primary);
}

.binary-tab-btn.active {
    background-color: var(--card-bg);
    color: var(--pico-primary);
    border-bottom: 2px solid var(--pico-primary);
    border-left: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    border-top: 1px solid var(--card-border);
    margin-bottom: -1px; /* Overlap border */
    font-weight: bold;
}

.binary-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-top: none; /* Merges with tabs */
    padding: 2rem;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    min-height: 300px;
}

/* Bit Toggles */
.bit-row {
    display: flex;
    gap: 0.5rem;
}

.bit-btn {
    width: 4rem;
    height: 4rem;
    font-size: 1.5rem;
    font-family: var(--brand-font);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--pico-primary);
    background: transparent;
    color: var(--pico-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0; /* Reset */
}

.bit-btn:hover {
    background-color: var(--code-bg);
}

.bit-btn.on {
    background-color: var(--pico-primary);
    color: #fff;
    box-shadow: 0 4px 6px rgba(1, 114, 173, 0.2);
}

.bit-value-label {
    width: 3.5rem; /* Match btn width */
    text-align: center;
    font-size: 0.75rem;
    color: var(--pico-muted-color);
    margin-bottom: 0.25rem;
    font-family: var(--brand-font);
}

.bit-value-label.active {
    color: var(--pico-primary);
    font-weight: bold;
}

/* Inputs */
.binary-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.binary-large-input {
    width: 6rem; /* w-24 */
    height: 5rem; /* h-20 */
    font-size: 3rem; /* text-5xl */
    text-align: center;
    border: none;
    border-radius: 0.5rem; /* rounded-lg */
    color: #fff;
    font-family: var(--brand-font);
    background: #14b8a6; /* bg-teal-500 */
    padding: 0;
}
/* Hex input variant */
.binary-large-input.hex-input {
    background: #a855f7; /* bg-purple-500 */
}

.binary-ctrl-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.binary-ctrl-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pico-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}
.binary-ctrl-btn:hover {
    background-color: var(--pico-primary-hover);
}

/* Slide Out Panel */
.cheat-sheet-container {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%) translateX(100%); /* Hidden by default */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
}

.cheat-sheet-container.open {
    transform: translateY(-50%) translateX(0);
}

.cheat-sheet-toggle {
    width: 3rem;
    height: 4rem;
    background: var(--pico-primary);
    color: #fff;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    border: none;
}

.cheat-sheet-content {
    width: 200px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    padding: 1rem;
    max-height: 80vh;
    overflow-y: auto;
}

.cheat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    text-align: center;
    padding: 0.25rem;
    font-family: var(--brand-font);
    font-size: 0.9rem;
}

.cheat-row.highlight {
    background-color: var(--code-bg);
    color: var(--pico-primary);
    font-weight: bold;
    border-radius: 4px;
}

/* Logic Panel Layout */
.logic-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* ABOUT PAGE STYLES */
.profile-img {
    border-radius: 50%;
    border: 4px solid var(--pico-primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 200px;
    display: block;
    margin-bottom: 1rem;
}

.skill-tag {
    display: inline-block;
    background-color: var(--code-bg);
    color: var(--pico-color);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--card-border);
    font-family: var(--brand-font);
}
/* RESOURCE PAGE LAYOUT */

/* 1. The Layout Grid (Sidebar + Main Content) */
@media (min-width: 1024px) {
    .layout-grid {
        display: grid;
        grid-template-columns: 240px 1fr; /* Sidebar fixed width + fluid content */
        gap: 3rem;
        align-items: start;
    }
}

/* 2. Sticky Sidebar Navigation */
.category-nav {
    position: sticky;
    top: 2rem;
    padding-right: 1rem;
}
.category-nav a {
    display: block;
    padding: 0.5rem 0;
    color: var(--pico-muted-color);
    text-decoration: none;
    font-size: 0.95rem;
    border-right: 2px solid transparent; /* Highlight marker */
}
.category-nav a:hover {
    color: var(--pico-primary);
    border-right-color: var(--card-border);
}

/* 3. Section Spacing & Anchors */
section.resource-category {
    margin-bottom: 4rem;
    scroll-margin-top: 2rem; /* Ensure sticky header doesn't cover title when jumping */
}

section.resource-category h2 {
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* 4. Resource Cards */
.resource-card {
    height: 100%;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden; /* For header background clipping */
}
.resource-card:hover {
    border-color: var(--pico-primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(1, 114, 173, 0.1);
}
.resource-card header {
    background: var(--card-header-bg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}
.resource-card .card-content {
    padding: 0 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.resource-card h5 {
    margin: 0;
    font-size: 1.1rem;
}
.resource-card a {
    text-decoration: none;
    color: var(--pico-color);
    display: block; /* Make the link block for better hit area on text */
}
.resource-card a:hover {
    color: var(--pico-primary);
}
.resource-title-icon {
    font-size: 0.8em;
    color: var(--pico-muted-color);
    margin-left: 5px;
    vertical-align: middle;
}

/* Blurb Text */
.resource-card p {
    font-size: 0.95rem;
    color: var(--pico-color); /* Was fixed gray */
    margin-bottom: 0;
    line-height: 1.6;
}

/* FOOTER STYLES */
.site-footer {
    text-align: center;
    padding: 3rem 0 1.5rem;
    border-top: 1px solid var(--card-border);
    margin-top: 4rem;
    color: var(--pico-muted-color);
}
.site-footer .social-links a {
    font-size: 1.5rem; /* Larger icons */
    margin: 0 0.75rem;
    color: var(--pico-muted-color);
    transition: color 0.2s;
}
.site-footer .social-links a:hover {
    color: var(--pico-primary);
}
.site-footer .legal-links {
    margin: 1rem 0;
    font-size: 0.9rem;
}
.site-footer .legal-links a {
    color: var(--pico-muted-color);
    text-decoration: none;
}
.site-footer .legal-links a:hover {
    color: var(--pico-primary);
    text-decoration: underline;
}
.site-footer .legal-links span {
    margin: 0 0.5rem;
}
.site-footer .copyright {
    font-size: 0.9rem;
}
.site-footer .disclaimer {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    font-style: italic;
}

/* CUSTOM TABS STYLING */
/* Reset global nav styles for tabs */
.tabs nav {
    border-bottom: none;
    margin-bottom: 0;
    padding: 0;
}

.tabs nav ul {
    display: flex;
    border-bottom: none;
    padding: 0;
    margin: 0;
    list-style: none;
}
.tabs nav li {
    margin: 0;
    padding: 0;
}
/* Hide the radio button itself */
.tabs input[type="radio"] {
    display: none;
}
/* Style the label to look like a tab */
.tabs label {
    display: block;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px; /* Overlap the border */
    color: var(--pico-muted-color);
    font-weight: 500;
    transition: color 0.2s, border-color 0.2s;
}
.tabs label:hover {
    color: var(--pico-primary);
    background-color: var(--code-bg); /* Slight hover background */
}
/* Active Tab Styling */
.tabs input:checked + label {
    border-bottom-color: var(--pico-primary);
    color: var(--pico-primary);
    font-weight: bold;
}

/* UTILITY: No Marker (Hide summary triangle) */

summary.no-marker {

    list-style: none;

}

summary.no-marker::-webkit-details-marker {

    display: none;

}

summary.no-marker::after {

    display: none !important;

    background-image: none !important;

}

/* Right-aligned dropdown menus */
details.dropdown ul.dropdown-menu-right {
    left: auto;
    right: 0;
}

/* Custom Grid: Force 3 columns on large screens */
@media (min-width: 992px) {
    .grid-3-col {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Line Clamping Utility */
.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Party popper active indicator */
@keyframes popper-pulse {
  0%, 100% {
    box-shadow: 0 0 4px 0px color-mix(in srgb, var(--pico-primary) 20%, transparent);
    background: color-mix(in srgb, var(--pico-primary) 10%, transparent);
  }
  50% {
    box-shadow: 0 0 10px 6px color-mix(in srgb, var(--pico-primary) 35%, transparent);
    background: color-mix(in srgb, var(--pico-primary) 25%, transparent);
  }
}

.popper-active {
  animation: popper-pulse 2s ease-in-out infinite;
  border-radius: 50%;
}

/* === Code Blocks (Shiki) === */
.code-block {
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
  border: 1px solid var(--pico-muted-border-color);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  font-size: 12px;
  font-family: -apple-system, sans-serif;
}

[data-theme="light"] .code-header {
  background: #e6e9ef;
  color: #7c7f93;
}

[data-theme="dark"] .code-header {
  background: #181825;
  color: #6c7086;
}

.code-lang {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.code-copy {
  background: transparent;
  border: 1px solid var(--pico-muted-border-color);
  color: inherit;
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-family: -apple-system, sans-serif;
  width: auto;
  margin: 0;
}

.code-copy:hover {
  background: var(--pico-muted-border-color);
}

/* Shiki dual theme support */
[data-theme="light"] .shiki,
[data-theme="light"] .shiki span {
  color: var(--shiki-light) !important;
  background-color: var(--shiki-light-bg) !important;
}

[data-theme="dark"] .shiki,
[data-theme="dark"] .shiki span {
  color: var(--shiki-dark) !important;
  background-color: var(--shiki-dark-bg) !important;
}

.code-block .shiki {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  counter-reset: line;
}

.code-block .shiki code {
  font-family: 'Input', monospace;
}

.code-block .shiki code .line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2.5em;
  text-align: right;
  margin-right: 1em;
  padding-right: 0.5em;
  opacity: 0.4;
  font-size: 0.85em;
  border-right: 1px solid currentColor;
  user-select: none;
}

/* === Terminal Blocks === */
.terminal-block {
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
  background: #0d0d0d !important;
  color: #cccccc;
}

.terminal-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: #1a1a1a !important;
  gap: 8px;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }

.terminal-title {
  color: #666;
  font-size: 12px;
  margin-left: 8px;
  font-family: -apple-system, sans-serif;
}

.terminal-header .code-copy {
  margin-left: auto;
  border-color: #444;
  color: #888;
}

.terminal-header .code-copy:hover {
  background: #333;
}

.terminal-body {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  line-height: 1.8;
  color: #cccccc !important;
  font-family: 'Input', monospace;
  font-size: 14px;
  background: #0d0d0d !important;
}

.terminal-body code {
  background: transparent !important;
  color: inherit !important;
}

.terminal-prompt {
  color: #28c840;
  font-weight: bold;
}

.terminal-command {
  color: #e0e0e0;
}

.terminal-output {
  color: #999;
}

.terminal-comment {
  color: #666;
  font-style: italic;
}

.terminal-url {
  color: #89b4fa;
  text-decoration: underline;
}

/* Cookie Consent Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: var(--pico-card-background-color, #fff);
  border-top: 2px solid var(--pico-primary);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: center;
}

.cookie-banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 900px;
  width: 100%;
  flex-wrap: wrap;
}

.cookie-banner-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.cookie-banner-text {
  flex: 1;
  margin: 0;
  font-size: 0.9rem;
  min-width: 200px;
}

.cookie-banner-text a {
  color: var(--pico-primary);
}

.cookie-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cookie-banner-actions button {
  margin: 0;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  width: auto;
  cursor: pointer;
}

.cookie-accept {
  background: var(--pico-primary) !important;
  color: white !important;
  border: none !important;
  border-radius: 4px;
}

.cookie-accept:hover {
  filter: brightness(1.1);
}

.cookie-decline {
  background: transparent !important;
  color: var(--pico-muted-color) !important;
  border: 1px solid var(--pico-muted-border-color) !important;
  border-radius: 4px;
  box-shadow: none !important;
}

.cookie-decline:hover {
  color: var(--pico-color) !important;
  border-color: var(--pico-color) !important;
}

@media (max-width: 600px) {
  .cookie-banner-content {
    flex-direction: column;
    text-align: center;
  }
  .cookie-banner-actions {
    width: 100%;
    justify-content: center;
  }
}