Spaces:
Sleeping

script / static /styles /main.scss
Lara Monteagudo Tubau
Build CSS for Hugging Face deploy
ba2c0b3
Raw History Blame Contribute Delete
4.07 kB
// =============================================================================
// main.scss β€” CollabCode Design System
// Entry point. Compiles to main.css (loaded by app.py via libsass).
//
// Architecture: ITCSS (Inverted Triangle CSS) β€” Specificity increases
// downward so lower layers can override without !important abuse.
// (Harry Roberts, csswizardry.com/itcss)
//
// Layer order:
// 1. Settings β€” tokens (variables, no output)
// 2. Tools β€” mixins, functions (no output)
// 3. Generic β€” normalize / reset
// 4. Elements β€” bare HTML element styles
// 5. Objects β€” layout primitives (no cosmetics)
// 6. Componentsβ€” UI components (all visual)
// 7. Utilities β€” single-purpose overrides
//
// Build: python static/build.py
// Watch: python static/build.py --watch
// =============================================================================
// 1 + 2. Settings & Tools (no CSS output)
@import 'tokens';
@import 'mixins';
// 3. Generic β€” Minimal reset. We don't include a full Normalize because
// Gradio already ships one. Only reset what we own.
.cc-root,
.cc-root * {
box-sizing: border-box;
}
// 4. Elements β€” Base typography for our HTML-rendered components.
.cc-root {
font-family: $font-family-sans;
font-size: $font-size-base;
line-height: $line-height-normal;
color: $color-text-primary;
background: $color-bg-base;
// Smooth font rendering on macOS / retina
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
// 5. Objects β€” Layout
.cc-container {
width: 100%;
max-width: 1160px;
margin-inline: auto;
padding-inline: $space-5;
@include max-width('md') {
padding-inline: $space-4;
}
}
.cc-stack {
display: flex;
flex-direction: column;
gap: $space-4;
}
.cc-cluster {
display: flex;
flex-wrap: wrap;
gap: $space-3;
align-items: center;
}
.cc-split {
display: flex;
justify-content: space-between;
align-items: center;
gap: $space-4;
}
// 6. Components β€” Import all component definitions
@import 'components_clean';
// 7. Utilities / Overrides
//
// Gradio integration overrides β€” scoped to avoid cascading beyond our intent.
// We avoid !important except where Gradio's own specificity forces it.
.gradio-container {
max-width: 1160px !important;
margin: 0 auto !important;
background: $color-bg-base !important;
}
// Hide Gradio's default footer (Gradio branding)
footer.svelte-mpyp5e { display: none !important; }
// Gradio injects inline styles on tab panels; bring bg in line with our palette
.tab-nav button {
font-weight: $font-weight-medium !important;
font-size: $font-size-sm !important;
}
// Global focus-visible reset β€” ensures our custom focus rings aren't masked
:focus { outline: none; }
:focus-visible {
outline: 2px solid $color-border-focus;
outline-offset: 2px;
}
// Gradio button overrides β€” nudge the primary button to use our interactive colour
.gradio-container .btn-primary,
.gradio-container button[data-testid='primary'] {
background: $color-interactive !important;
border-color: $color-interactive !important;
&:hover {
background: $color-interactive-hover !important;
border-color: $color-interactive-hover !important;
}
}
// Reduced-motion β€” disable all transitions when user prefers
@include motion-reduce {
.cc-root *,
.gradio-container * {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
// High-contrast mode β€” ensure borders and focus rings are visible
@include high-contrast {
.cc-card,
.cc-section,
.cc-stepper,
.cc-rule {
border: 2px solid ButtonText !important;
}
.cc-dim-desc {
border-left-color: Highlight !important;
}
}
// Print β€” hide navigation, keep content readable
@media print {
.cc-stepper,
footer,
button { display: none !important; }
.cc-card {
box-shadow: none;
border: 1px solid #000;
break-inside: avoid;
}
}