/* CloudCaive cinematic surface adapters (ADR-0061).
   theme.css owns tokens and the reusable .cc-surface primitive. This file is
   loaded last and maps existing semantic components onto that same material,
   so marketing, editorial, account and Labs views cannot drift into separate
   visual systems. Keep layout and product behaviour in their owning files. */

html{background:var(--cc-canvas)}
/* Keep the canvas opaque while placing negative-z atmosphere layers inside
   the body's own stacking context, above its background paint. */
body{position:relative;z-index:0;background-color:var(--cc-canvas);color:var(--cc-text-primary)}

/* One quiet upper-page atmosphere. It scrolls away with the document and does
   not create the banding or repaint cost of a fixed full-page gradient. */
body::before{
  content:"";
  position:absolute;
  inset:0 0 auto;
  height:min(900px,90vh);
  z-index:-2;
  pointer-events:none;
  background:
    radial-gradient(66% 55% at 76% 4%,rgba(112,31,31,.16),rgba(112,31,31,.055) 43%,transparent 76%),
    radial-gradient(58% 50% at 22% 24%,rgba(29,94,126,.08),transparent 72%);
}
#cc-lamplight{opacity:.38}

/* Printed verification certificates are deliberately light even when the
   browser is configured to print background graphics. */
@media print{
  body.cc-certificate{background:#fff;color:#071D31}
  body.cc-certificate .cc-surface{
    background:#fff;
    background-image:none;
    border-color:#ccc;
    box-shadow:none;
  }
}

/* Semantic container contract. `data-container` records the primary purpose
   of audited public containers: open, structural, route, resource, product,
   evidence or instrument. The attribute does not create a universal card;
   each purpose-specific component still owns its layout and strength.

   Shared adapter contract. The two texture layers are declared once in
   theme.css and remain below 3.5% alpha. They are backgrounds, so they add no
   accessibility node, event target or per-child rendering layer. */
:is(
  .application-form,.hero-mark,.outcome-card,.offer-panel,
  .route-card,.model-card[data-container="product"],.evidence-card,
  .beta-offer-card,.beta-fit-card,.price-card,
  a.guide-card[data-container="resource"],.status-panel,
  .auth,.stat,.topic,.mixcta,.missioncard,.dcard,.todaystrip,.qcard,.covmap,
  .coachrep,.sumcard,.panel,.artcard,.tutor,.tierrow,.tcrow,.station .sbody,
  .patch,.badgetoast,.breaknudge,.dside-id,
  .cc-infra,.cc-infra-tile,.cc-infra-drawer,.cc-infra-summary,
  .cc-infra-instruments,.cc-infra-progress,.cc-infra-dialog,
  .cc-infra-fallback,.ccflow .ccf-stage
){
  --cc-surface-material:var(--cc-surface-cool);
  background-color:var(--cc-surface-low);
  background-image:var(--cc-surface-grain),var(--cc-surface-striation),var(--cc-surface-material);
  background-blend-mode:soft-light,soft-light,normal,normal;
  border-color:var(--cc-border);
  box-shadow:var(--cc-shadow-tile);
}

/* Quiet support surfaces use less illumination and depth. */
:is(
  .application-form,.schedule-item,.status-panel,
  .beta-fit-card,.price-card,.auth,.menu,.stat,.dcard,
  .todaystrip,.covmap,.coachrep,.panel,.tierrow,.tcrow,.station .sbody,
  .patch,.breaknudge,.dside-id
){
  --cc-surface-material:var(--cc-surface-neutral);
  background-color:var(--cc-surface-low);
  background-image:var(--cc-surface-grain),var(--cc-surface-striation),var(--cc-surface-material);
  background-blend-mode:soft-light,soft-light,normal,normal;
  border-color:var(--cc-border-subtle);
  box-shadow:var(--cc-shadow-tile);
}

/* Decision and incident context gets a restrained burgundy warmth. Actual
   health remains explicit in the status label and boundary. */
:is(.beta-offer-card,.callout.fault,.evidence-note,.mfanudge){
  --cc-surface-material:var(--cc-surface-warm);
  background-color:var(--cc-surface-low);
  background-image:var(--cc-surface-grain),var(--cc-surface-striation),var(--cc-surface-material);
  background-blend-mode:soft-light,soft-light,normal,normal;
}

/* Console and executable evidence surfaces are darker and denser. */
:is(
  .ve-viz,.table-wrap,pre,.qvisual,.qterm,.artcard pre,
  .cc-infra,.cc-infra-drawer,.cc-infra-summary,.cc-infra-terminal,
  .cc-infra-instruments,.cc-infra-progress,.cc-infra-dialog,
  .cc-infra-fallback,.ccflow .ccf-stage
){
  --cc-surface-material:var(--cc-surface-console);
  background-color:var(--cc-canvas-elevated);
  background-image:var(--cc-surface-grain),var(--cc-surface-striation),var(--cc-surface-material);
  background-blend-mode:soft-light,soft-light,normal,normal;
  border-color:var(--cc-border-subtle);
}

/* The topology grid stays functional and legible over the console material. */
.cc-infra-canvas{
  background-color:var(--cc-canvas);
  background-image:
    radial-gradient(circle,rgba(122,201,234,.12) 1px,transparent 1px),
    var(--cc-surface-grain),var(--cc-surface-striation),var(--cc-surface-console);
  background-size:22px 22px,160px 160px,auto,auto,auto;
  background-blend-mode:normal,soft-light,soft-light,normal,normal;
}

/* Component radius hierarchy. Existing padding remains owned by each context. */
:is(
  .application-form,.hero-mark,.outcome-card,.offer-panel,
  .route-card,.model-card[data-container="product"],.evidence-card,
  .beta-offer-card,.beta-fit-card,.price-card,
  a.guide-card[data-container="resource"],.status-panel
){border-radius:var(--cc-radius-large)}
:is(
  .schedule-item,.auth,.mixcta,
  .missioncard,.qcard,.covmap,.coachrep,.sumcard,.panel,.artcard,.tutor,
  .tierrow,.station .sbody,.badgetoast,.breaknudge,.cc-infra,
  .cc-infra-drawer,.cc-infra-dialog,.cc-infra-fallback,.ccflow .ccf-stage
){border-radius:var(--cc-radius-medium)}
:is(
  .menu,.stat,.topic,.dcard,.todaystrip,.qvisual,.qterm,.patch,.dside-id,
  .tcrow,.cc-infra-tile,.cc-infra-summary,.cc-infra-terminal,
  .cc-infra-instruments,.cc-infra-progress,.table-wrap,pre
){border-radius:var(--cc-radius-small)}

/* Subtle, local state lighting. Labels and icons remain the primary signal. */
:is(.cc-infra-tile--healthy,.cc-infra-status--healthy,[data-emphasis="healthy"]){
  --cc-status:var(--cc-blue-bright);
  border-color:rgba(92,177,214,.48);
}
:is(.cc-infra-tile--degraded,.cc-infra-tile--offline,[data-emphasis="degraded"]){
  --cc-status:var(--cc-red-bright);
  border-color:rgba(228,91,99,.62);
  box-shadow:var(--cc-shadow-tile),0 0 22px rgba(244,91,99,.12);
}
:is(.cc-infra-status--degraded,.cc-infra-status--offline){--cc-status:var(--cc-red-bright)}
:is(.cc-infra-tile--repairing,.cc-infra-tile--verifying,
    .cc-infra-status--repairing,.cc-infra-status--verifying){--cc-status:var(--cc-blue)}
.cc-infra-terminal__line--stderr,.cc-infra-auth-feedback{color:var(--cc-red-bright)}
.cc-infra-terminal__line--effect,.cc-infra-terminal__prompt{color:var(--cc-blue-bright)}

/* Interactive surfaces change border and luminance only. There is no scale,
   bounce or layout movement. */
:is(a[data-container="route"],a[data-container="resource"],a[data-container="evidence"],.topic,.patch,.dside-id,.cc-infra-tile){
  transition:border-color var(--cc-duration-control) var(--cc-ease-precision),
    filter var(--cc-duration-micro) var(--cc-ease-precision),
    box-shadow var(--cc-duration-control) var(--cc-ease-precision);
}
:is(a[data-container="route"],a[data-container="resource"],a[data-container="evidence"],.topic,.patch,.dside-id,.cc-infra-tile):hover{
  border-color:rgba(122,201,234,.58);
  filter:brightness(1.035);
}
:is(a[data-container="route"],a[data-container="resource"],a[data-container="evidence"],.topic,.patch,.dside-id,.cc-infra-tile):active{
  filter:brightness(.985);
}

/* Forms retain their labels and validation behaviour. Native autofill is
   pulled back into the same matte console treatment. */
:is(input,select,textarea){border-color:var(--cc-border);background-color:var(--cc-canvas-elevated);color:var(--cc-text-primary)}
:is(input,select,textarea):-webkit-autofill{
  -webkit-text-fill-color:var(--cc-text-primary);
  box-shadow:0 0 0 1000px var(--cc-canvas-elevated) inset;
}
:is(.form-status[data-state="error"],.authmsg){color:var(--cc-red-bright)}

/* Tables and code preserve their own syntax colours and scroll inside their
   bounds instead of widening the page. */
:is(.table-wrap,pre,.qterm,.artcard pre,.cc-infra-terminal){max-width:100%;overflow:auto}
:is(table){border-color:var(--cc-divider)}
:is(th,td){border-color:var(--cc-divider)}

/* The approved material is matte. No active surface may depend on live blur. */
:is(.site-nav,body>header,.overlay){backdrop-filter:none;-webkit-backdrop-filter:none}
body>header{background:var(--cc-canvas-elevated)}
.overlay{background:rgba(2,7,11,.88)}

@media(max-width:640px){
  :is(
    .application-form,.hero-mark,.outcome-card,.offer-panel,
    .route-card,.model-card[data-container="product"],.evidence-card,
    .beta-offer-card,.beta-fit-card,.price-card,
    a.guide-card[data-container="resource"],.status-panel
  ){border-radius:var(--cc-radius-medium)}
  :is(
    .schedule-item,.auth,.mixcta,
    .missioncard,.qcard,.covmap,.coachrep,.sumcard,.panel,.artcard,.tutor,
    .tierrow,.station .sbody,.badgetoast,.breaknudge,.cc-infra,
    .cc-infra-dialog,.cc-infra-fallback,.ccflow .ccf-stage
  ){border-radius:var(--cc-radius-small)}
  .cc-infra-canvas{background-size:18px 18px,160px 160px,auto,auto,auto}
}

/* The 320 px contract needs a compact wordmark and wrapping status copy.
   This keeps navigation and authentication content inside the viewport. */
@media(max-width:360px){
  .site-nav .nav-logo{gap:6px}
  .site-nav .nav-v2-mark{width:28px;height:28px}
  .site-nav .brand-wordmark{font-size:14px;letter-spacing:.1em}
  .site-nav .nav-inner{gap:6px}
  .site-nav .nav-menu-toggle{width:40px;height:40px}
  .site-nav .nav-actions .btn-ghost-nav{padding-inline:7px}
  .footer-socials{min-width:0;flex-wrap:wrap}
  .pwmeter{min-width:0;align-items:flex-start}
  .pwhint{min-width:0;white-space:normal}
}

@media(prefers-reduced-motion:reduce){
  :is(a[data-container="route"],a[data-container="resource"],a[data-container="evidence"],.topic,.patch,.dside-id,.cc-infra-tile){transition:none}
}
html[data-reduced-motion="true"] :is(a[data-container="route"],a[data-container="resource"],a[data-container="evidence"],.topic,.patch,.dside-id,.cc-infra-tile){transition:none}

@media(forced-colors:active){
  :is(.cc-surface,.application-form,.outcome-card,.offer-panel,
      .route-card,.auth,.qcard,.cc-infra,.ccflow .ccf-stage){
    background:Canvas;border-color:CanvasText;box-shadow:none;
  }
}
