Files
computing-box/public/css/binary.css
Alexander Lyall d4765b3788 feat(v2-alpha): refactor binary simulator and introduce shared site layout
- Rewrite binary simulator with unified unsigned and two’s complement logic
- Support dynamic bit widths from 4 to 64 with LSB-preserving resizing
- Replace legacy unsigned-only scripts with a single maintainable implementation
- Extract binary styles into dedicated CSS and add global site styling
- Introduce shared header, footer, and base layout components
- Migrate Binary page to BaseLayout and modular assets

Signed-off-by: Alexander Lyall <alex@adcm.uk>
2025-12-14 19:46:23 +00:00

294 lines
5.3 KiB
CSS

:root{
--bg: #1f2027;
--panel2: rgba(255,255,255,.04);
--text: #e8e8ee;
--muted: #a9acb8;
--accent: #33ff7a;
--accent-dim: rgba(51,255,122,.15);
--line: rgba(255,255,255,.12);
}
/* DSEG font (you already have these in public/fonts/) */
@font-face{
font-family: "DSEG7ClassicRegular";
src:
url("/fonts/DSEG7Classic-Regular.woff") format("woff"),
url("/fonts/DSEG7Classic-Regular.ttf") format("truetype");
font-weight: 400;
font-style: normal;
font-display: swap;
}
.wrap{
max-width: 1200px;
margin: 0 auto;
padding: 32px 20px 60px;
}
.topGrid{
display:grid;
grid-template-columns: 1fr 340px;
gap: 28px;
align-items:start;
}
.readout{
background: transparent;
text-align:center;
padding: 10px 10px 0;
}
.label{
letter-spacing: .18em;
font-weight: 800;
color: var(--muted);
text-transform: uppercase;
font-size: 14px;
margin-top: 10px;
}
.num{
font-family: "DSEG7ClassicRegular", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-weight: 400;
color: var(--accent);
text-shadow: 0 0 18px var(--accent-dim);
}
.denary{
font-size: 84px;
line-height: 1.0;
margin: 6px 0 16px;
}
.binary{
font-size: 62px;
letter-spacing: .12em;
line-height: 1.0;
margin: 6px 0 18px;
}
.controls{
margin-top: 10px;
display:flex;
gap: 12px;
justify-content:center;
flex-wrap:wrap;
}
.btn{
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.14);
color: #fff;
padding: 12px 14px;
border-radius: 12px;
font-weight: 800;
cursor: pointer;
min-width: 160px;
}
.btn:active{ transform: translateY(1px); }
.divider{
margin-top: 26px;
border-top: 1px solid var(--line);
}
/* Right panels */
.panelCol{
display:flex;
flex-direction:column;
gap: 14px;
}
.card{
background: var(--panel2);
border: 1px solid rgba(255,255,255,.10);
border-radius: 14px;
padding: 14px;
}
.cardTitle{
letter-spacing: .18em;
font-weight: 900;
color: var(--muted);
text-transform: uppercase;
font-size: 12px;
margin: 0 0 10px;
}
.hint{
color: var(--muted);
font-size: 12px;
margin-top: 8px;
line-height: 1.35;
}
.toggleRow{
display:flex;
align-items:center;
justify-content:space-between;
gap: 10px;
}
.toggleLabel{
color: var(--text);
font-weight: 800;
font-size: 14px;
}
/* Switch (re-used for mode + bits) */
.switch{
position: relative;
width: 56px;
height: 34px;
display:inline-block;
flex: 0 0 auto;
}
.switch input{
opacity:0;
width:0;
height:0;
}
.slider{
position:absolute;
inset:0;
background: rgba(255,255,255,.10);
border: 1px solid rgba(255,255,255,.14);
border-radius: 999px;
transition: .18s ease;
}
.slider::before{
content:"";
position:absolute;
height: 28px;
width: 28px;
left: 3px;
top: 2px;
background: rgba(255,255,255,.92);
border-radius: 50%;
transition: .18s ease;
}
.switch input:checked + .slider{
background: rgba(51,255,122,.20);
border-color: rgba(51,255,122,.55);
}
.switch input:checked + .slider::before{
transform: translateX(22px);
background: var(--accent);
}
/* Bit width controls */
.bitWidthRow{
display:grid;
grid-template-columns: 44px 1fr 44px;
gap: 10px;
align-items:center;
}
.miniBtn{
height: 44px;
width: 44px;
border-radius: 12px;
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.14);
color: #fff;
cursor:pointer;
font-weight: 900;
font-size: 18px;
}
.bitInputWrap{
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.14);
border-radius: 12px;
padding: 10px 12px;
display:flex;
align-items:center;
justify-content:space-between;
gap: 12px;
}
.bitInputLabel{
color: var(--muted);
font-size: 12px;
font-weight: 900;
letter-spacing: .18em;
text-transform: uppercase;
}
.bitInput{
width: 86px;
text-align:right;
background: transparent;
border: none;
outline: none;
color: var(--accent);
font-family: "DSEG7ClassicRegular", ui-monospace, monospace;
font-size: 28px;
}
.bitInput::-webkit-outer-spin-button,
.bitInput::-webkit-inner-spin-button{
-webkit-appearance:none;
margin:0;
}
/* ✅ Bits grid: wraps every 8 bits, NO horizontal scroll bar */
.bits{
margin-top: 26px;
padding-top: 22px;
display:grid;
grid-template-columns: repeat(8, minmax(90px, 1fr));
gap: 18px;
align-items:end;
text-align:center;
/* make absolutely sure we don't create a horizontal scrollbar */
overflow-x: hidden;
}
/* Bit tile */
.bit{
display:flex;
flex-direction:column;
align-items:center;
gap: 10px;
padding: 8px 4px;
}
.bulb{
width: 22px;
height: 22px;
border-radius: 50%;
background: rgba(255,255,255,.08);
border: 1px solid rgba(255,255,255,.12);
box-shadow: none;
margin-bottom: 4px;
}
.bulb.on{
background: #ffd86b;
border-color: rgba(255,216,107,.7);
box-shadow: 0 0 18px rgba(255,216,107,.6);
}
.bitVal{
font-family: "DSEG7ClassicRegular", ui-monospace, monospace;
font-size: 30px;
color: var(--text);
opacity: .95;
line-height: 1;
min-height: 34px;
}
/* Responsive */
@media (max-width: 980px){
.topGrid{ grid-template-columns: 1fr; }
.denary{ font-size: 72px; }
.binary{ font-size: 52px; }
.bits{ grid-template-columns: repeat(4, minmax(90px, 1fr)); }
}
@media (max-width: 520px){
.denary{ font-size: 62px; }
.binary{ font-size: 44px; }
.btn{ min-width: 140px; }
}