/**
 * Public styles for Holophonix LMS
 */

/* ── Course Flow block ───────────────────────────────────────────────────── */

/* No explicit width — the theme's .has-global-padding > .alignfull negative margins
   expand this to full viewport width. Setting width: 100% here would fight those margins
   and constrain us to the content column (645px).
   No overflow-x: hidden — that would clip the inner scroll container's right edge. */
.hlx-course-flow-outer {}

.hlx-course-flow {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}

.hlx-flow-scroll {
    box-sizing: border-box; /* include padding in width so the 48px sides don't overflow the parent */
    width: 100%; overflow-x: auto; overflow-y: visible;
    padding: 24px 48px 32px;
    scrollbar-width: thin; scrollbar-color: #c7c7cc transparent;
}
.hlx-flow-scroll::-webkit-scrollbar { height: 4px; }
.hlx-flow-scroll::-webkit-scrollbar-track { background: #e5e5ea; border-radius: 2px; }
.hlx-flow-scroll::-webkit-scrollbar-thumb { background: #c7c7cc; border-radius: 2px; }

.hlx-flow-graph { position: relative; display: inline-block; min-width: 100%; }

/* SVG connection layer */
.hlx-flow-svg { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }

.hlx-flow-conn {
    fill: none; stroke: #d1d1d6; stroke-width: 3;
    stroke-linecap: round; stroke-linejoin: round;
    transition: stroke 0.25s ease, stroke-width 0.25s ease, filter 0.25s ease, stroke-opacity 0.25s ease;
}
.hlx-flow-conn--dimmed  { stroke-opacity: 0.2; stroke: #d1d1d6 !important; filter: none !important; }
.hlx-flow-conn--active  { stroke: #6e6e73 !important; stroke-width: 3.5 !important; filter: drop-shadow(0px 0px 4px rgba(0,0,0,0.08)); }

/* Cards — shared */
.hlx-flow-node {
    position: absolute; border-radius: 14px; overflow: hidden; cursor: default;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.05);
    transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease;
    will-change: transform;
}
.hlx-flow-node--large { width: 200px; height: 290px; }
.hlx-flow-node--small { width: 180px; height: 128px; border-radius: 12px; }

.hlx-flow-node:hover,
.hlx-flow-node--active {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 28px rgba(0,0,0,0.13), 0 0 0 1px rgba(0,0,0,0.07);
    z-index: 10;
}
.hlx-flow-node--dimmed    { opacity: 0.35; }
.hlx-flow-node--connected { box-shadow: 0 2px 10px rgba(0,0,0,0.07), 0 0 0 2px rgba(0,0,0,0.1); }

/* Thumbnail */
.hlx-flow-thumb {
    position: absolute; top: 0; left: 0; right: 0; overflow: hidden;
}
.hlx-flow-node--large .hlx-flow-thumb { height: 72%; }
.hlx-flow-node--small .hlx-flow-thumb { height: 64%; }

.hlx-flow-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hlx-flow-thumb::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to bottom, transparent, #fff);
}
.hlx-flow-node--large .hlx-flow-thumb::after { height: 60px; }
.hlx-flow-node--small .hlx-flow-thumb::after { height: 36px; }
.hlx-flow-thumb--empty { background: #f2f2f7; }

/* Body — auto-sized to content, pinned to card bottom */
.hlx-flow-body {
    position: absolute; bottom: 0; left: 0; right: 0;
    display: flex; flex-direction: column; gap: 6px;
}
.hlx-flow-node--large .hlx-flow-body { padding: 0 12px 14px; }
.hlx-flow-node--small .hlx-flow-body { padding: 0 10px 9px; }

.hlx-flow-title { font-weight: 600; line-height: 1.35; color: #1d1d1f; letter-spacing: -0.1px; }
.hlx-flow-node--large .hlx-flow-title { font-size: 13.5px; }
.hlx-flow-node--small .hlx-flow-title { font-size: 11.5px; line-height: 1.3; }

/* Status */
.hlx-flow-status { display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 500; }
.hlx-flow-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.hlx-flow-status--completed   .hlx-flow-dot  { background: #34c759; }
.hlx-flow-status--in-progress .hlx-flow-dot  { background: #ff9f0a; }
.hlx-flow-status--not-started .hlx-flow-dot  { background: #c7c7cc; }
.hlx-flow-status--completed   .hlx-flow-status-label { color: #1c7c3c; }
.hlx-flow-status--in-progress .hlx-flow-status-label { color: #7a4f00; }
.hlx-flow-status--not-started .hlx-flow-status-label { color: #8e8e93; }

/* Parallel column label */
.hlx-flow-col-label {
    position: absolute; transform: translateX(-50%);
    font-size: 9px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.18em; color: #aeaeb2; white-space: nowrap; pointer-events: none;
}

/* Legend */
.hlx-flow-legend {
    display: flex; justify-content: center; gap: 24px;
    margin-top: 16px; padding: 0 48px;
    font-size: 11px; color: #6e6e73;
}
.hlx-flow-legend-item { display: flex; align-items: center; gap: 6px; }
.hlx-flow-legend-dot  { width: 7px; height: 7px; border-radius: 50%; }
.hlx-flow-legend-dot--completed   { background: #34c759; }
.hlx-flow-legend-dot--in-progress { background: #ff9f0a; }
.hlx-flow-legend-dot--not-started { background: #c7c7cc; }

/* ── SF Pro typography ───────────────────────────────────────────────────── */
body {
    font-family: -apple-system, "SF Pro Display", BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Smooth scroll ───────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

.holophonix-lms-content {
    /* Add your custom styles here */
}

/* ── Fullbleed helper ────────────────────────────────────────────────────── */

/* Escapes the constrained content width (contentSize: 645px in Twenty Twenty-Five).
   Technique: width: 100vw + margin-left: calc(50% - 50vw) shifts the element
   to the left viewport edge regardless of its parent's centering margins.
   The !important overrides the :where() auto-margin from .is-layout-constrained. */
.hlx-fullbleed {
    max-width: none !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: 0 !important;
}

.hlx-widget.hlx-fullbleed {
    max-width: none !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: 0 !important;
}

/* ── Parallax image bands ─────────────────────────────────────────────────── */
.hlx-parallax-band {
    position: relative;
    background-attachment: fixed;
    background-size: cover;
    overflow: hidden;
}
.hlx-parallax-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
}
.hlx-parallax-title {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.hlx-parallax-drift {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    will-change: transform;
}
.hlx-parallax-title h2 {
    color: #fff;
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 700;
    text-align: center;
    max-width: 900px;
    padding: 0 24px;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
    letter-spacing: 0.03em;
    margin: 0;
}
.hlx-parallax-subtitle {
    color: rgba(255, 255, 255, 0.78);
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    text-align: center;
    max-width: 700px;
    padding: 0 24px;
    margin: 12px 0 0;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
}
.hlx-parallax-cta {
    display: inline-block;
    margin-top: 28px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #fff !important;
    font-weight: 600;
    font-size: 1rem;
    padding: 12px 28px;
    border-radius: 980px;
    text-decoration: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s, border-color 0.2s;
}
.hlx-parallax-cta:hover {
    background: rgba(255, 255, 255, 0.26);
    border-color: #fff;
    color: #fff !important;
    text-decoration: none;
}
/* iOS Safari: background-attachment fixed unsupported — degrade gracefully */
@supports (-webkit-touch-callout: none) {
    .hlx-parallax-band { background-attachment: scroll; }
}

/* ── Scroll reveal ───────────────────────────────────────────────────────── */
.hlx-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms ease, transform 600ms ease;
}
.hlx-reveal.hlx-visible {
    opacity: 1;
    transform: none;
}

/* ── Hero section ────────────────────────────────────────────────────────── */
.hlx-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1d1d1f;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    color: #f5f5f7;
}
.hlx-hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
}
.hlx-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 860px;
    padding: 0 24px;
}
.hlx-hero-content h1 {
    color: #fff;
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}
.hlx-hero-content p {
    color: rgba(245, 245, 247, 0.8);
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 400;
    margin-bottom: 36px;
}
.hlx-hero-cta {
    display: inline-block;
    background: #2997ff;
    color: #fff !important;
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 32px;
    border-radius: 980px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
}
.hlx-hero-cta:hover {
    background: #0a84ff;
    color: #fff !important;
    transform: scale(1.03);
}

/* ── Typewriter heading ──────────────────────────────────────────────────── */
.hlx-tw-text {
    display: inline-block;
    clip-path: inset(0 100% 0 0);
}
.hlx-tw-caret {
    display: inline-block;
    width: 2px;
    height: 0.8em;
    background: currentColor;
    margin-left: 3px;
    vertical-align: middle;
    animation: hlx-tw-blink 0.65s step-start infinite;
}
@keyframes hlx-tw-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .hlx-tw-text { clip-path: none !important; transition: none !important; }
    .hlx-tw-caret { display: none; }
}
.hlx-typewriter-wrap {
    display: block;
}
.hlx-tw-eyebrow {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: #6e6e73;
    margin: 0 0 10px;
}

/* ── Single-course page layout ───────────────────────────────────────────── */

/* Featured image + author meta are suppressed via render_block PHP filter —
   no CSS display:none needed here. */

/* Title area: generous padding above, tight below (parallax follows immediately).
   Browsers without :has() support get a JS-added class fallback (.holophonix-course-title-group). */
.single-course .wp-block-group.alignfull.has-global-padding:has(> .wp-block-post-title),
.single-course .wp-block-group.alignfull.has-global-padding.holophonix-course-title-group {
    padding-top: 48px !important;
    padding-bottom: 0 !important;
}

.single-course .wp-block-post-title {
    font-size: clamp(2rem, 4vw, 3rem) !important;
    font-weight: 600 !important;
    line-height: 1.1 !important;
    margin-bottom: 40px !important;
}

/* Tighten the gap between the site header and the title group.
   Scoped to the immediate <main> child so theme spacing on other pages is preserved. */
.single-course main.wp-block-group > .wp-block-group.alignfull.has-global-padding:first-child {
    margin-top: 0 !important;
}

/* ── Course Workflow Display ──────────────────────────────────────────────── */
.holophonix-course-workflow-wrapper {
    margin: 30px auto;
    padding: 0;
    background: transparent;
    border: none;
    max-width: 100%;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.workflow-legend {
    display: flex;
    gap: 25px;
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.legend-indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
}

.legend-indicator.completed {
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.legend-indicator.completed::after {
    content: '✓';
}

.legend-indicator.in-progress {
    background: #fff;
    border: 2px solid #000;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    letter-spacing: -2px;
}

.legend-indicator.in-progress::after {
    content: '...';
}

.legend-indicator.not-started {
    background: #fff;
    border: 2px solid #ccc;
}

.workflow-display-canvas {
    position: relative;
    min-height: 400px;
    background: transparent;
    border: none;
    overflow: visible;
    padding: 40px;
}

.workflow-display-node {
    position: absolute;
    background: #fff;
    border: 2px solid #000;
    border-radius: 0px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    user-select: none;
    width: 240px;
    box-sizing: border-box;
    text-align: center;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.workflow-display-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 20;
}

.workflow-display-node .node-thumbnail {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #f5f5f5;
    overflow: hidden;
}

.workflow-display-node .node-content {
    padding: 15px;
}

.workflow-display-node .node-title {
    color: #000;
    font-weight: 600;
    line-height: 1.4;
    font-size: 14px;
}

.workflow-display-node .status-badge {
    position: absolute;
    bottom: -16px;
    right: -16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.workflow-display-node .status-badge.badge-completed {
    background: #000;
    color: #fff;
}

.workflow-display-node .status-badge.badge-progress {
    background: #fff;
    color: #000;
    letter-spacing: -2px;
}

.holophonix-workflow-message {
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .workflow-legend {
        flex-direction: column;
        gap: 15px;
    }

    .workflow-display-canvas {
        overflow-x: auto;
    }

    .workflow-display-node {
        min-width: 120px;
        max-width: 180px;
        font-size: 13px;
        padding: 12px 15px;
    }
}

/* ── Sensei Quiz — hide per-question point value on student quiz page ──────
   The <span class="grade"> inside the question block header shows the point
   value of each question (e.g. "4"). Students don't need to see this while
   answering; it only reveals how the quiz is weighted.
   ───────────────────────────────────────────────────────────────────────── */
.sensei-lms-question-block__header span.grade {
    display: none;
}

/* ── MC answer comparison table (student quiz results) ──────────────────── */

/* Hide the hardcoded "Right Answer:" text node that Sensei prints before our
   table — the table is self-explanatory.
   Modern browsers use :has(); older browsers fall back via a JS-added class
   (.holophonix-has-mc-table) attached by holophonix-lms-public.js. */
.sensei-lms-question__answer-feedback__correct-answer:has(.holophonix-mc-result-table),
.sensei-lms-question__answer-feedback__correct-answer.holophonix-has-mc-table {
    font-size: 0;
    color: transparent;
}

/* ── Partial credit feedback state ───────────────────────────────────────── *
 * Sensei only has --correct / --incorrect. We add --partial for MC questions *
 * where grade > 0 but < max. Colour scheme: amber/orange.                    */
.sensei-lms-question__answer-feedback--partial {
    --feedback-color: #b85c00;
    --feedback-bg:    rgba(255,140,0,.06);
}

/* Reuse Sensei's own CSS variable slots if the theme sets them */
.sensei-lms-question__answer-feedback--partial
    .sensei-lms-question__answer-feedback__header {
    color: var(--feedback-color, #b85c00);
    background: var(--feedback-bg, rgba(255,140,0,.06));
}

/* The icon (Sensei uses an SVG via ::before on the span).
   We overlay a simple character so it's always visible regardless of theme. */
.sensei-lms-question__answer-feedback--partial
    .sensei-lms-question__answer-feedback__icon::before {
    content: '~' !important;
    font-style: normal;
    font-weight: 700;
}

/* Title text is replaced by JS (see holophonix-lms-public.js),
   but add a fallback so it's never blank before JS runs. */
.sensei-lms-question__answer-feedback--partial
    .sensei-lms-question__answer-feedback__title {
    color: var(--feedback-color, #b85c00);
}

.holophonix-mc-result-table {
    font-size: 0.875rem;
    color: inherit;
    border-collapse: collapse;
    width: 100%;
    margin-top: 0.5em;
}

.holophonix-mc-result-table th,
.holophonix-mc-result-table td {
    padding: 0.4em 0.75em;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,.08);
    vertical-align: middle;
    color: #1a1a1a;
}

.holophonix-mc-result-table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    border-bottom: 2px solid rgba(0,0,0,.15);
}

.holophonix-mc-result-table .col-selected,
.holophonix-mc-result-table .col-type {
    white-space: nowrap;
    width: 1%;
}

/* Row highlight by outcome */
.holophonix-mc-result-table tr.row-right-selected { background: rgba( 40,167, 69,.08); }
.holophonix-mc-result-table tr.row-right-missed   { background: rgba(220, 53, 69,.06); }
.holophonix-mc-result-table tr.row-wrong-selected { background: rgba(220, 53, 69,.08); }
.holophonix-mc-result-table tr.row-wrong-ok       { background: transparent; }

/* Answer type column */
.holophonix-mc-result-table .type-right { color: #28a745 !important; font-weight: 600; }
.holophonix-mc-result-table .type-wrong { color: #999    !important; font-weight: 400; }

/* Selected / not-selected icons */
.holophonix-mc-result-table .mc-icon { font-weight: 700; color: #1a1a1a; }
.holophonix-mc-result-table .mc-icon--yes { color: #333; }
.holophonix-mc-result-table .mc-icon--no  { color: #bbb; }

/* ── Complete Lesson button ─────────────────────────────────────────────── */

/* Filled solid style */
.sensei-course-theme-lesson-actions__complete-lesson-form [data-id="complete-lesson-button"],
.wp-block-sensei-lms-lesson-actions [data-id="complete-lesson-button"],
.sensei-course-theme-lesson-actions__complete-lesson-form .wp-block-button__link,
.wp-block-sensei-lms-button-complete-lesson .wp-block-button__link {
    background-color: var(--wp--preset--color--contrast) !important;
    color: var(--wp--preset--color--base, #fff) !important;
    border: none !important;
    border-radius: 4px;
    padding: 0.65em 1.4em;
    font-weight: 600;
    transition: opacity 0.15s ease;
}

.sensei-course-theme-lesson-actions__complete-lesson-form [data-id="complete-lesson-button"]:hover,
.wp-block-sensei-lms-lesson-actions [data-id="complete-lesson-button"]:hover,
.sensei-course-theme-lesson-actions__complete-lesson-form .wp-block-button__link:hover,
.wp-block-sensei-lms-button-complete-lesson .wp-block-button__link:hover {
    opacity: 0.85;
    background-color: var(--wp--preset--color--contrast) !important;
    color: var(--wp--preset--color--base, #fff) !important;
}
