/* Amditis Design System - Core Styles (WCAG 2.1 AA compliant) */

/* Selection colors */
::selection {
    background: #a3e635;
    color: #111827;
}

::-moz-selection {
    background: #a3e635;
    color: #111827;
}

/* Sticky header offset for anchor links */
html {
    scroll-padding-top: 5rem;
}

/* Base prose typography */
p, li {
    line-height: 1.65;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #475569 #1e293b;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: #a3e635;
    color: #111827;
    font-weight: 700;
    font-size: 0.875rem;
    text-decoration: none;
    border-radius: 0 0 0.5rem 0.5rem;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #67e8f9;
    outline-offset: 2px;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible styles for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #67e8f9;
    outline-offset: 2px;
}

/* Accordion styles */
.accordion-item {
    border: 1px solid #334155;
    background: #1e293b;
    margin-bottom: 4px;
    border-radius: 4px;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.accordion-header:hover {
    background: #334155;
}

.accordion-header::after {
    content: '+';
    font-family: 'JetBrains Mono', monospace;
    color: #a3e635;
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.accordion-item.active .accordion-header::after {
    content: '\2212';
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 1000px;
}

.accordion-body {
    padding: 16px;
    border-top: 1px solid #334155;
}

/* Bullet list items — block + hanging indent.
   Grid and flex both break when <li> contains mixed inline elements (<a>, <code>,
   <strong>) because each becomes a separate grid/flex item. Block layout lets all
   inline content flow and wrap naturally. */
.bullet-item {
    display: block;
    padding-left: 1.75rem;
}

.bullet-item > span:first-child {
    display: inline;
    margin-left: -1.75rem;
    margin-right: 0.5rem;
}

/* Same fix applied to Tailwind-utility bullets (li.flex.items-start.gap-3).
   Flex treats <code> and <strong> as separate flex children, so on
   marker-prefixed bullets the marker, text, and code pill end up in
   the wrong columns on mobile. Scope block layout to marker bullets
   only — non-marker two-child lists (code pill + description span)
   still want their flex gap alignment. */
li.flex.items-start.gap-3:has(> span:first-child:is(.text-ice, .text-acid, .text-signal)) {
    display: block;
    padding-left: 1.5rem;
}

li.flex.items-start.gap-3 > span:first-child:is(.text-ice, .text-acid, .text-signal) {
    display: inline;
    margin-left: -1.5rem;
    margin-right: 0.5rem;
}

/* Code block word wrap */
pre code {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Code syntax colors - all pass WCAG AA on #1e293b */
.syntax-keyword {
    color: #f87171;
}

.syntax-string {
    color: #a3e635;
}

.syntax-func {
    color: #67e8f9;
}

.syntax-comment {
    color: #94a3b8;
    font-style: italic;
}

/* Cyber checkbox styling */
.cyber-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.cyber-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #475569;
    background: #1e293b;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    border-radius: 3px;
}

.cyber-checkbox input[type="checkbox"]:hover {
    border-color: #a3e635;
}

.cyber-checkbox input[type="checkbox"]:checked {
    border-color: #a3e635;
    background: rgba(163, 230, 53, 0.15);
}

.cyber-checkbox input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #a3e635;
    font-size: 14px;
    font-weight: bold;
}

.cyber-checkbox input[type="checkbox"]:focus-visible {
    outline: 3px solid #67e8f9;
    outline-offset: 2px;
}

/* Copy-to-clipboard button for code blocks */
.copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #94a3b8;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    z-index: 1;
    line-height: 1.6;
}

/* Show on hover of the code block wrapper */
div:hover > .copy-btn,
pre:hover > .copy-btn,
.copy-btn:focus-visible {
    opacity: 1;
}

.copy-btn:hover {
    color: #a3e635;
    border-color: #a3e635;
    background: #334155;
}

.copy-btn:focus-visible {
    outline: 3px solid #67e8f9;
    outline-offset: 2px;
}

.copy-btn.copied {
    color: #a3e635;
    border-color: #a3e635;
}

/* Mobile navigation for inner pages (modules, concepts, templates, syllabus)
   Homepage has its own mobile menu via JS; these pages just need nav visible. */
@media (max-width: 767px) {
    /* Taller scroll offset for two-row mobile header (logo + wrapped nav) */
    html {
        scroll-padding-top: 7rem;
    }

    /* Let header content wrap so nav drops below the logo */
    header .max-w-5xl {
        flex-wrap: wrap;
    }

    /* Override Tailwind's 'hidden' to show nav on mobile */
    header nav[aria-label="Module navigation"],
    header nav[aria-label="Page navigation"] {
        display: flex !important;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Touch-friendly tap targets (44px minimum) */
    header nav[aria-label="Module navigation"] a,
    header nav[aria-label="Page navigation"] a {
        padding: 0.375rem 0.125rem;
    }

    /* Tighten bullet indent on mobile */
    .bullet-item {
        padding-left: 1.25rem;
    }

    .bullet-item > span:first-child {
        margin-left: -1.25rem;
    }

    li.flex.items-start.gap-3:has(> span:first-child:is(.text-ice, .text-acid, .text-signal)) {
        padding-left: 1.25rem;
    }

    li.flex.items-start.gap-3 > span:first-child:is(.text-ice, .text-acid, .text-signal) {
        margin-left: -1.25rem;
    }
}

/* ============================================================
   Module time-gating for modules 2, 3, 4.
   Controlled by module-schedule.js — see spec at
   docs/superpowers/specs/2026-04-13-mooc-module-gating-design.md
   ============================================================ */

/* Visually-hidden utility for screen readers only */
.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;
}

/* Dual-state markup on homepage cards: lock icon and locked CTA are
   hidden by default; CSS reveals them only when the module is locked. */
.module-icon-locked,
.cta-locked {
    display: none;
}

/* Locked placeholder screen on module pages. Hidden by default; shown
   only when html.mooc-locked-here is set. The hide rule uses a type +
   class compound selector to out-specificity Tailwind's runtime-generated
   `.flex` and `.block` utility classes, which would otherwise win by
   source order because Tailwind CDN inserts its styles after amditis.css. */
section.module-locked-screen {
    display: none;
}

html.mooc-locked-here section.module-locked-screen {
    display: flex;
    flex: 1 1 0%;
    align-items: center;
    justify-content: center;
}

/* On a locked module page, hide the real content containers
   (module hero section + <main>). The `.module-live-content` marker
   class is added to both in each module page's HTML. */
html.mooc-locked-here .module-live-content {
    display: none;
}

/* Homepage card: locked state for module 2, 3, 4.
   Each selector is scoped by a `mooc-locked-m{N}` class on <html> so
   that CSS is inert until module-schedule.js opts the page in. */
html.mooc-locked-m2 a[data-module-card="module-2"],
html.mooc-locked-m3 a[data-module-card="module-3"],
html.mooc-locked-m4 a[data-module-card="module-4"] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Neutralize hover state on locked cards — the existing markup uses
   Tailwind's `hover:border-acid` and `group-hover:text-acid`, which
   still fire when the anchor is dimmed. We set a solid border color
   that wins by specificity. */
html.mooc-locked-m2 a[data-module-card="module-2"]:hover,
html.mooc-locked-m3 a[data-module-card="module-3"]:hover,
html.mooc-locked-m4 a[data-module-card="module-4"]:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

html.mooc-locked-m2 a[data-module-card="module-2"]:hover h3,
html.mooc-locked-m2 a[data-module-card="module-2"]:hover .bg-void\/50,
html.mooc-locked-m3 a[data-module-card="module-3"]:hover h3,
html.mooc-locked-m3 a[data-module-card="module-3"]:hover .bg-void\/50,
html.mooc-locked-m4 a[data-module-card="module-4"]:hover h3,
html.mooc-locked-m4 a[data-module-card="module-4"]:hover .bg-void\/50 {
    color: inherit;
}

/* Neutralize the icon wrapper's hover opacity animation on locked cards.
   The existing markup has `opacity-30 group-hover:opacity-100` on the
   top-right icon container, which otherwise brightens the lock icon on
   hover and makes a disabled card look interactive. Keep the icon at its
   resting 0.3 opacity during hover when the card is locked. */
html.mooc-locked-m2 a[data-module-card="module-2"]:hover .group-hover\:opacity-100,
html.mooc-locked-m3 a[data-module-card="module-3"]:hover .group-hover\:opacity-100,
html.mooc-locked-m4 a[data-module-card="module-4"]:hover .group-hover\:opacity-100 {
    opacity: 0.3;
}

/* Swap icon: hide the default, reveal the lock. */
html.mooc-locked-m2 a[data-module-card="module-2"] .module-icon-default,
html.mooc-locked-m3 a[data-module-card="module-3"] .module-icon-default,
html.mooc-locked-m4 a[data-module-card="module-4"] .module-icon-default {
    display: none;
}

html.mooc-locked-m2 a[data-module-card="module-2"] .module-icon-locked,
html.mooc-locked-m3 a[data-module-card="module-3"] .module-icon-locked,
html.mooc-locked-m4 a[data-module-card="module-4"] .module-icon-locked {
    display: inline-block;
}

/* Swap CTA text: hide the default `Begin module →`, reveal the
   `Unlocks Sun 4/N 5pm ET` string that's hard-coded in the HTML. */
html.mooc-locked-m2 a[data-module-card="module-2"] .cta-default,
html.mooc-locked-m2 a[data-module-card="module-2"] .cta-arrow,
html.mooc-locked-m3 a[data-module-card="module-3"] .cta-default,
html.mooc-locked-m3 a[data-module-card="module-3"] .cta-arrow,
html.mooc-locked-m4 a[data-module-card="module-4"] .cta-default,
html.mooc-locked-m4 a[data-module-card="module-4"] .cta-arrow {
    display: none;
}

html.mooc-locked-m2 a[data-module-card="module-2"] .cta-locked,
html.mooc-locked-m3 a[data-module-card="module-3"] .cta-locked,
html.mooc-locked-m4 a[data-module-card="module-4"] .cta-locked {
    display: inline-block;
}

/* Inline locked links (syllabus, concepts, header nav, prose references).
   Applied by module-schedule.js on DOMContentLoaded. Color is slate-400
   on bg-void which stays above WCAG AA contrast. Line-through is a
   language-independent locked signal. */
.module-locked-link {
    opacity: 0.5;
    color: #94a3b8 !important;
    cursor: not-allowed;
    text-decoration: line-through dotted;
}

.module-locked-link:hover,
.module-locked-link:focus {
    color: #94a3b8 !important;
    text-decoration: line-through dotted;
}

/* Locked placeholder screen styling — minimal because the markup
   uses existing Tailwind utility classes for layout. */
.module-locked-screen .module-lock-icon-wrap {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #1e293b;
}

/* On a locked module page, the skip-link's `#main` target is hidden,
   so hide the skip-link itself to avoid sending keyboard users to a
   display:none element. The locked placeholder is the only content. */
html.mooc-locked-here .skip-link {
    display: none;
}

/* Featured/active module hero — exactly one variant is shown at a time,
   selected by the mooc-featured-m{1-4} class set on <html> in phase 1
   of module-schedule.js. All variants default to display:none so the
   page never flashes the wrong one. Compound `.featured-module-wrap
   .featured-module` selector is used throughout to beat Tailwind CDN's
   `.flex` utility, which gets injected late and wins single-class ties
   in the cascade. The matching card in the grid below is hidden to
   keep 6 cards (2 clean rows of 3 at lg). */
.featured-module-wrap .featured-module {
    display: none;
}

html.mooc-featured-m1 .featured-module-wrap .featured-module[data-featured-module="module-1"],
html.mooc-featured-m2 .featured-module-wrap .featured-module[data-featured-module="module-2"],
html.mooc-featured-m3 .featured-module-wrap .featured-module[data-featured-module="module-3"],
html.mooc-featured-m4 .featured-module-wrap .featured-module[data-featured-module="module-4"] {
    display: flex;
}

html.mooc-featured-m1 a[data-module-card="module-1"],
html.mooc-featured-m2 a[data-module-card="module-2"],
html.mooc-featured-m3 a[data-module-card="module-3"],
html.mooc-featured-m4 a[data-module-card="module-4"] {
    display: none;
}

