/* Comunidad IA shared components v1. LOCAL candidate.
 * Load after campus and page CSS; adopt explicitly with body.am-community-theme.
 * Existing campus tokens are authoritative. No cascade layer or global reset.
 * Screen only: existing print, video sizing, hidden and quiz semantics remain owned
 * by their original components. This file never changes display for controls.
 */
@font-face { font-family: Inter; src: url("/community/biblioteca/inter-3100e775e861.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/community/biblioteca/space-grotesk-0640890476fc.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@media screen {
  body.am-community-theme {
    --community-control-radius: 12px;
    --community-card-radius: 18px;
    --community-touch: 44px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
  }
  body.am-community-theme.campus-home-shell {
    --home-surface: var(--panel);
    --home-line: var(--line);
    --home-cyan: var(--cyan);
    --home-text: var(--text);
    --home-muted: var(--body);
  }
  body.am-community-theme :where(.content, .page-head, .card, .course-program, .field) {
    min-inline-size: 0;
  }
  body.am-community-theme .content :where(h1, h2, h3, h4) {
    color: var(--text);
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  body.am-community-theme .content :where(h1) {
    font-size: clamp(1.9rem, 1.4rem + 2vw, 3.2rem);
    margin-block: 0 .6em;
  }
  body.am-community-theme .content :where(h2) {
    font-size: clamp(1.4rem, 1.2rem + .8vw, 2rem);
    margin-block: 0 .6em;
  }
  body.am-community-theme .content :where(h3) {
    font-size: 1.2rem;
    margin-block: 0 .6em;
  }
  body.am-community-theme .content :where(p, li, label, legend) {
    line-height: 1.65;
    overflow-wrap: anywhere;
  }
  body.am-community-theme .content :where(p, .lede) { color: var(--body); }
  body.am-community-theme :where(.eyebrow, .home-kicker, .course-program-stage) {
    font-family: var(--font);
    font-size: .875rem;
    line-height: 1.5;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--cyan);
  }
  body.am-community-theme :where(.field-help, .field-error, .course-program-meta) {
    font-family: var(--font);
    font-size: .9375rem;
    line-height: 1.6;
  }
  /* Shared quiet surfaces. Domain status borders (done/error) remain meaningful. */
  body.am-community-theme .card,
  body.am-community-theme :where(.course-program-unit, .course-program-material, .practice-resource, .am-community-card) {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--community-card-radius);
    padding: clamp(18px, 2.2vw, 28px);
    box-shadow: none;
    min-inline-size: 0;
  }
  body.am-community-theme .card:where(.done, .success) { border-color: var(--green); }
  body.am-community-theme :where(.am-community-card--featured, .course-program-header) {
    border-inline-start: 3px solid var(--cyan);
    padding-inline-start: clamp(16px, 2vw, 24px);
  }
  body.am-community-theme :where(.course-program-unit:hover, .am-community-card[href]:hover) {
    border-color: var(--cyan);
    background: var(--panel2);
  }
  /* Campus adapters: use shared tokens without changing its grid or content. */
  body.am-community-theme .campus-home-v1 .home-hero,
  body.am-community-theme .campus-home-v1 .home-program,
  body.am-community-theme .campus-home-v1 > .continue-learning,
  body.am-community-theme .campus-home-v1 > .next-action {
    color: var(--text);
    background: var(--panel);
    border-color: var(--line);
    border-radius: var(--community-card-radius);
    box-shadow: none;
  }
  body.am-community-theme .campus-home-v1 .home-hero { border-block-start: 3px solid var(--cyan); }
  body.am-community-theme :where(.home-hero-nav, .home-account-body, .home-activity-details) {
    background: var(--panel2);
    border-color: var(--line);
  }
  body.am-community-theme .campus-home-v1 :where(.home-destination, .continue-learning__item) {
    background: var(--panel2);
    border-color: var(--line);
    box-shadow: none;
  }
  body.am-community-theme .campus-home-v1 .home-destination:hover { border-color: var(--cyan); }
  body.am-community-theme .campus-home-v1 .home-hero-main .lede { color: var(--body); }
  body.am-community-theme .campus-home-v1 :where(h1, h2, h3, .home-practice-flow b) { font-family: var(--display); }
  body.am-community-theme :where(.home-destination small, .home-practice-flow small) {
    color: var(--body);
    font-size: .9375rem;
  }
  /* No generic button display rule: hidden mobile menu and quiz options stay hidden. */
  body.am-community-theme :where(button, .btn, summary, .am-community-action) {
    min-block-size: var(--community-touch);
    min-inline-size: var(--community-touch);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: normal;
    scroll-margin-block: 6rem;
  }
  body.am-community-theme .btn {
    border: 1px solid var(--cyan);
    border-radius: var(--community-control-radius);
    clip-path: none;
    background: var(--cyan);
    color: var(--bg);
    box-shadow: none;
    padding: 11px 18px;
    text-transform: none;
    letter-spacing: normal;
    text-decoration: none;
    font-weight: 700;
    max-inline-size: 100%;
  }
  body.am-community-theme .btn:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--cyan);
    border-color: var(--text);
    color: var(--bg);
  }
  body.am-community-theme .btn.secondary {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text);
  }
  body.am-community-theme .btn.secondary:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--panel2);
    border-color: var(--cyan);
    color: var(--text);
  }
  body.am-community-theme .btn.danger {
    background: var(--panel);
    border-color: var(--danger);
    color: var(--danger);
  }
  body.am-community-theme .campus-home-v1 .home-study-primary {
    background: var(--cyan);
    border-color: var(--cyan);
    color: var(--bg);
    border-radius: var(--community-control-radius);
  }
  body.am-community-theme :is(button, input, select, textarea):disabled, body.am-community-theme [aria-disabled="true"] {
    opacity: .65;
    cursor: not-allowed;
    box-shadow: none;
  }
  /* Native disabled and aria-disabled behavior belongs to existing JS/HTML. */
  body.am-community-theme .content :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="color"]), textarea, select) {
    box-sizing: border-box;
    max-inline-size: 100%;
    min-inline-size: 0;
    min-block-size: var(--community-touch);
    font: inherit;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--muted);
    border-radius: var(--community-control-radius);
    padding: 10px 12px;
  }
  body.am-community-theme :where(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
  body.am-community-theme :where(textarea) { resize: vertical; }
  body.am-community-theme :where(input[type="checkbox"], input[type="radio"], input[type="range"]) { accent-color: var(--cyan); }
  body.am-community-theme :where(.field:has(input[type="checkbox"]), .field:has(input[type="radio"]), .written-practice__radio) {
    min-block-size: var(--community-touch);
  }
  body.am-community-theme .content :where(input[readonly], textarea[readonly]) {
    background: var(--panel2);
    border-style: dashed;
  }
  body.am-community-theme .content :where([aria-invalid="true"], .field.is-invalid input, .field.is-invalid textarea, .field.is-invalid select) {
    border-color: var(--danger);
    border-width: 2px;
  }
  body.am-community-theme :where(.field-error, .error-message, .am-community-error) { color: var(--danger); }
  body.am-community-theme :where(.sidebar, .topbar) {
    background: var(--bg);
    border-color: var(--line);
    box-shadow: none;
  }
  body.am-community-theme .nav a {
    min-block-size: var(--community-touch);
    color: var(--body);
    line-height: 1.5;
    border-radius: var(--community-control-radius);
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.am-community-theme .nav a:hover { background: var(--panel); color: var(--text); }
  body.am-community-theme .nav a[aria-current="page"] {
    background: var(--panel2);
    color: var(--text);
    border: 1px solid var(--cyan);
    border-inline-start-width: 4px;
    font-weight: 700;
  }
  body.am-community-theme :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 4px;
  }
  body.am-community-theme :where(.btn, .home-study-primary):focus-visible { outline-color: var(--text); }
}
@media screen and (max-width: 720px) {
  body.am-community-theme .page-head { align-items: start; flex-wrap: wrap; }
  body.am-community-theme :where(.course-program-breadcrumb, .course-program-sequence, .top-actions) { gap: 10px; }
  body.am-community-theme .top-actions .btn {
    white-space: normal;
    text-overflow: clip;
    overflow: visible;
    font-size: 1rem;
    line-height: 1.5;
  }
  body.am-community-theme .topbar { block-size: auto; }
  body.am-community-theme .course-program-unit { gap: 12px; padding: 18px; }
  body.am-community-theme .course-program-number { flex-basis: 2rem; }
  body.am-community-theme :where(.course-program-material .btn, .practice-resource-links a) { margin-inline-end: 0; }
}
@media screen and (prefers-reduced-motion: reduce) {
  /* Scoped exception: suppress existing component motion without affecting visibility. */
  body.am-community-theme *, body.am-community-theme *::before, body.am-community-theme *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media screen and (forced-colors: active) {
  body.am-community-theme { --bg: Canvas; --panel: Canvas; --panel2: Canvas; --text: CanvasText; --body: CanvasText; --muted: CanvasText; --line: CanvasText; --cyan: Highlight; --danger: CanvasText; background: Canvas; color: CanvasText; }
  body.am-community-theme :where(.card, .home-hero, .home-program, .home-destination, .course-program-unit, .course-program-material, .sidebar, .topbar, input, select, textarea, .btn) {
    background: Canvas;
    color: CanvasText;
    border-color: CanvasText;
    box-shadow: none;
  }
  body.am-community-theme .nav a[aria-current="page"] { border-color: Highlight; }
  body.am-community-theme :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline-color: Highlight; }
  body.am-community-theme :is(button, input, select, textarea):disabled, body.am-community-theme [aria-disabled="true"] {
    opacity: 1;
    color: GrayText;
    border-color: GrayText;
  }
  body.am-community-theme :where([aria-invalid="true"]) { border-style: double; }
}
/* ADMITTED LOCAL COMPONENT ADAPTERS. Included in the single shared asset.
 * Existing canonical tokens only. No layout, media, quiz or scoring changes.
 */
@media screen {
  body.am-community-theme :is(.phase49-study, .phase49-forum) {
    --p49-panel: var(--panel);
    --p49-edge: var(--line);
    --p49-muted: var(--body);
    --p49-cyan: var(--cyan);
  }
  body.am-community-theme[data-page="asistente"] .phase49-study :is(.study-chat, .study-focus) {
    background: var(--panel);
    border-color: var(--line);
    border-radius: var(--community-card-radius, 18px);
    box-shadow: none;
  }
  body.am-community-theme[data-page="asistente"] .study-message { background: var(--panel2); }
  body.am-community-theme[data-page="asistente"] .study-message.user { border-color: var(--cyan); }
  body.am-community-theme[data-page="feed"] :is(.thread, .feed-compose-toggle, .feed-attachment) {
    background: var(--panel);
    border-color: var(--line);
    border-radius: var(--community-card-radius, 18px);
    box-shadow: none;
  }
  /* Replies retain accepted-answer/role styles. No blanket reply border reset. */
  body.am-community-theme[data-page="biblioteca"] .organized-card,
  body.am-community-theme[data-page="biblioteca"] .library-study .study-section {
    background: var(--panel);
    border-color: var(--line);
    border-radius: var(--community-card-radius, 18px);
    box-shadow: none;
  }
  body.am-community-theme[data-page="biblioteca"] .library-study .library-study-actions button:not(.secondary):not(.danger):not(:disabled):not([aria-disabled="true"]) {
    background: var(--cyan);
    color: var(--bg);
    border-color: var(--cyan);
    border-radius: var(--community-control-radius, 12px);
  }
  body.am-community-theme[data-page="ruta"] .campus-visual-v1 > .next-action,
  body.am-community-theme[data-page="ruta"] .campus-activation-details {
    background: var(--panel);
    border-color: var(--line);
    border-radius: var(--community-card-radius, 18px);
    box-shadow: none;
  }
  body.am-community-theme[data-page="ruta"] .campus-visual-v1 > .next-action .btn:not(.secondary):not(.danger):not(:disabled):not([aria-disabled="true"]) {
    background: var(--cyan);
    color: var(--bg);
    border-color: var(--cyan);
  }
}
/* Component-specific forced-colors state contract. Must remain after adapters.
 * Enabled primary rules use the same specificity as their screen counterpart.
 * Disabled selectors are disjoint: native fieldset disabled inheritance is kept.
 */
@media screen and (forced-colors: active) {
  body.am-community-theme[data-page="biblioteca"] .library-study .library-study-actions button:not(.secondary):not(.danger):not(:disabled):not([aria-disabled="true"]),
  body.am-community-theme[data-page="ruta"] .campus-visual-v1 > .next-action .btn:not(.secondary):not(.danger):not(:disabled):not([aria-disabled="true"]) {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }
  body.am-community-theme[data-page="biblioteca"] .library-study .library-study-actions button:is(.secondary, .danger):not(:disabled):not([aria-disabled="true"]),
  body.am-community-theme[data-page="ruta"] .campus-visual-v1 > .next-action .btn:is(.secondary, .danger):not(:disabled):not([aria-disabled="true"]) {
    background: ButtonFace;
    color: ButtonText;
    border-color: ButtonText;
  }
  body.am-community-theme[data-page="biblioteca"] .library-study .library-study-actions button:is(:disabled, [aria-disabled="true"]),
  body.am-community-theme[data-page="ruta"] .campus-visual-v1 > .next-action .btn:is(:disabled, [aria-disabled="true"]) {
    background: ButtonFace;
    color: GrayText;
    border-color: GrayText;
    opacity: 1;
    box-shadow: none;
  }
}
/* Mobile entry: retain every control, notice, DOM order and focus behavior.
 * Campus has its own admitted compact header and is intentionally excluded.
 * Two rows grow naturally for enlarged text; no clipping or fixed heights.
 */
@media screen and (max-width: 720px) {
  body.am-community-theme:not(.campus-home-shell) .topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: start;
    gap: 6px 8px;
    block-size: auto;
    min-block-size: 0;
    padding: 8px 12px;
    position: static;
  }
  body.am-community-theme:not(.campus-home-shell) .topbar > p {
    grid-column: 1 / -1;
    margin: 0;
  }
  body.am-community-theme:not(.campus-home-shell) .topbar > .mobile-menu {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    padding: 6px;
    min-block-size: 44px;
  }
  body.am-community-theme:not(.campus-home-shell) .topbar .top-actions {
    display: grid;
    grid-column: 2;
    grid-row: 1 / 3;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 6px;
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  body.am-community-theme:not(.campus-home-shell) .topbar .top-actions > #community-owner-view {
    grid-column: 1 / -1;
    inline-size: 100%;
    margin: 0;
  }
  body.am-community-theme:not(.campus-home-shell) .topbar .top-actions > :is(.btn, .notification-toggle) {
    box-sizing: border-box;
    min-block-size: 44px;
    min-inline-size: 44px;
    max-inline-size: 100%;
    padding: 6px 8px;
    font-size: .9375rem;
    line-height: 1.4;
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    justify-content: center;
    text-align: center;
  }
  body.am-community-theme[data-page="cursos"] #page-content.content {
    padding-block-start: 12px;
  }
  body.am-community-theme[data-page="cursos"] .course-program-breadcrumb {
    gap: 8px;
    margin-block-end: 8px;
  }
  body.am-community-theme[data-page="cursos"] :is(.written-practice, .native-production) {
    padding: 12px;
  }
  body.am-community-theme[data-page="cursos"] :is(.written-practice__header, .native-production__header, .u01-header) > h1,
  body.am-community-theme[data-page="cursos"] .course-program-header > h1 {
    font-size: 1.625rem;
    line-height: 1.2;
    margin-block: 8px;
  }
  body.am-community-theme[data-page="cursos"] :is(.written-practice__header, .native-production__header, .u01-header) > p {
    margin-block: 6px;
    line-height: 1.45;
  }
  body.am-community-theme[data-page="cursos"] :is(.written-practice__lead, .u01-lead, .course-program-intro) {
    font-size: 1rem;
    line-height: 1.45;
  }
  body.am-community-theme[data-page="cursos"] :is(.written-practice__warning, .native-production__warning) {
    font-size: .875rem;
    line-height: 1.45;
    padding: 8px 10px;
  }
  body.am-community-theme[data-page="cursos"] :is(.written-practice__scope, .u01-label) {
    font-size: .875rem;
    line-height: 1.45;
  }
  body.am-community-theme[data-page="cursos"] .u01-actions {
    margin-block: 8px;
    gap: 8px;
  }
  body.am-community-theme[data-page="cursos"] .course-program-header {
    margin-block-end: 16px;
    padding-inline-start: 12px;
  }
  body.am-community-theme[data-page="cursos"] .course-program-header > p {
    margin-block: 6px;
    line-height: 1.45;
  }
  body.am-community-theme[data-page="cursos"] .course-program-quick {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-block: 6px 8px;
  }
  body.am-community-theme[data-page="cursos"] .course-program-quick .btn {
    min-inline-size: 0;
    font-size: .9375rem;
    line-height: 1.4;
    padding: 6px 8px;
    text-align: center;
    justify-content: center;
  }
  body.am-community-theme[data-page="cursos"] .native-agents .na-hero h1 {
    font-size: 1.625rem;
    line-height: 1.2;
    margin-block: 8px;
  }
}
