/* home.css – Alogic Lab app shell (navbar, routing views) and the Home page */
:root { --ink: #05070b; --signal: #ffcc1a; --cyan: #8fb8de; --violet: #a99bd6; --steel: #6b7285; --soft: #d3d6df; }

[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

/* ---------- navbar ---------- */
.nav { display: flex; align-items: center; gap: 18px; flex: none; flex-wrap: wrap; padding: 10px 20px; background: rgba(5, 7, 11, .96); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: -.025em; }
.logo svg { width: 32px; height: 32px; }
.logo b { font-weight: 300; color: var(--signal); }
.nav-tabs { display: flex; gap: 2px; }
.nav-tab { padding: 8px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-radius: 6px 6px 0 0; }
.nav-tab:hover { color: var(--text); }
.nav-tab[aria-current="page"] { color: var(--text); box-shadow: inset 0 -3px 0 var(--signal); }
.btn.signal { background: var(--signal); border-color: var(--signal); color: #1a1200; font-weight: 700; }
.btn.signal:hover { background: #ffdb5c; border-color: #ffdb5c; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.quiet { background: transparent; }
body[data-route="tools"] .nav-cta { display: none; }

/* ---------- views ---------- */
.view { flex: 1; min-height: 0; }
#tools { display: flex; flex-direction: column; }
.tool-title { font-weight: 700; margin-right: 6px; }
#home {
  overflow-y: auto;
  background-color: var(--ink);
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 32px 32px;
}
.wrap { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }

/* ---------- hero: the headline is a ladder rung ---------- */
.hero { padding-block: 52px 24px; }
.hero-rung {
  --glow: 0 0 24px rgba(255, 204, 26, .4);
  display: flex; align-items: center; margin: 0;
  font-size: clamp(1.7rem, 5.6vw, 4.4rem); font-weight: 800; letter-spacing: -.04em; line-height: 1;
}
.hbus { align-self: stretch; flex: none; width: .14em; min-width: 6px; border-radius: 3px; background: var(--steel); }
.hstep {
  flex: none; white-space: nowrap; padding: .2em .4em .26em;
  border: .06em solid #3a3f4d; border-radius: .18em; background: rgba(5, 7, 11, .75); color: #7d8497;
}
.hwire { position: relative; overflow: hidden; flex: 1 1 .5em; min-width: .5em; height: .07em; min-height: 3px; background: #3a3f4d; }
.hwire::after { content: ""; position: absolute; inset: 0; background: var(--signal); transform: scaleX(0); transform-origin: left; }
.hwire.lead { flex: 0 0 .45em; min-width: 8px; }
.hero-rung.run .hstep { animation: energize .5s ease-out forwards; animation-delay: calc(var(--i) * .75s + .3s); }
.hero-rung.run .hwire::after { animation: flowin .25s ease-out forwards; animation-delay: calc(var(--i) * .75s + .8s); }
@keyframes energize {
  to { color: #fff; border-color: var(--signal); box-shadow: var(--glow), inset 0 0 18px rgba(255, 204, 26, .12); text-shadow: 0 0 18px rgba(255, 204, 26, .55); }
}
@keyframes flowin { to { transform: scaleX(1); } }
@keyframes flowiny { to { transform: scaleY(1); } }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 540px); gap: 44px; align-items: center; margin-top: 40px; }
.lead { max-width: 46ch; margin: 0 0 26px; color: var(--soft); font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.55; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.fine { margin: 16px 0 0; color: var(--muted); font-size: 14px; }

/* live preview card */
.scope {
  margin: 0; background: rgba(10, 12, 18, .92); box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
}
.scope figcaption { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.live-svg { display: block; width: 100%; height: auto; padding: 10px 10px 0; }
.live-svg text { fill: var(--muted); font-size: 13px; text-anchor: middle; }
.live-svg .lrail { stroke: var(--steel); stroke-width: 5; stroke-linecap: round; }
.live-svg .lw { fill: none; stroke: #363c4b; stroke-width: 3; stroke-linecap: round; }
.live-svg .bar, .live-svg .slash { fill: none; stroke: var(--steel); stroke-width: 3.5; stroke-linecap: round; }
.live-svg .slash { stroke-width: 2.5; }
.live-svg .jn { fill: #363c4b; }
.live-svg .coil { fill: none; stroke: var(--steel); stroke-width: 3.5; }
.live-svg .link { fill: none; stroke: #363c4b; stroke-width: 2; stroke-dasharray: 3 5; }
.live-svg .lw.on { stroke: var(--signal); stroke-dasharray: 9 7; animation: flow .7s linear infinite; filter: drop-shadow(0 0 3px rgba(255, 204, 26, .7)); }
.live-svg .c.on .bar, .live-svg .c.on .slash, .live-svg .coil.on { stroke: var(--signal); }
.live-svg .coil.on { fill: rgba(255, 204, 26, .16); }
.live-svg .jn.on { fill: var(--signal); }
.live-svg .motor .spin { fill: none; stroke: #363c4b; stroke-width: 3; stroke-linecap: round; transform-origin: 0 0; }
.live-svg .motor.on .spin { stroke: var(--signal); animation: spin 1s linear infinite; }
.live-svg .motor.on .ring { stroke: var(--signal); }
.live-svg .motor .ring { fill: none; stroke: var(--steel); stroke-width: 3.5; }
.live-svg .motor text { fill: var(--text); font-size: 15px; font-weight: 700; }
@keyframes flow { to { stroke-dashoffset: -16; } }
@keyframes spin { to { transform: rotate(360deg); } }
.caption { min-height: 3.6em; margin: 0; padding: 10px 16px 14px; color: var(--soft); font-size: 14px; line-height: 1.5; }

/* ---------- sections ---------- */
.sec { padding-block: 60px 8px; }
.sec-h { margin: 0 0 8px; font-size: clamp(1.7rem, 3.4vw, 2.4rem); letter-spacing: -.03em; line-height: 1.1; }
.sec-p { max-width: 58ch; margin: 0 0 22px; color: var(--muted); font-size: 16px; line-height: 1.5; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--cyan); }
.chip[aria-pressed="true"] { background: var(--signal); border-color: var(--signal); color: #04121f; font-weight: 700; }

/* domain tiles: chamfered corner like a drawing sheet */
.domains { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: 14px; }
.dom {
  --edge: var(--line);
  position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 196px; padding: 20px;
  border: 0; text-align: left; font: inherit; color: var(--text); text-decoration: none; cursor: pointer;
  background: rgba(14, 17, 24, .88); box-shadow: inset 0 0 0 1px var(--edge);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  transition: box-shadow .15s;
}
.dom::after {
  content: ""; position: absolute; top: 0; right: 0; width: 18px; height: 18px;
  background: linear-gradient(to bottom left, transparent calc(50% - 1px), var(--edge) calc(50% - 1px), var(--edge) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}
.dom[data-cat="electrical"] { --cat: var(--cyan); }
.dom[data-cat="electronics"] { --cat: var(--violet); }
.dom svg { width: 56px; height: 56px; flex: none; fill: none; stroke: var(--cat); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: stroke .15s, filter .15s; }
.dom h3 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.01em; }
.dom p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.state { margin-top: auto; color: var(--muted); font-size: 13px; }
.dom:hover, .dom:focus-visible { --edge: var(--signal); }
.dom:hover svg, .dom:focus-visible svg { stroke: var(--signal); filter: drop-shadow(0 0 6px rgba(255, 204, 26, .6)); }

.dom.big { grid-column: span 2; grid-row: span 2; gap: 14px; padding: 28px; --edge: rgba(255, 204, 26, .55); background: linear-gradient(160deg, rgba(255, 204, 26, .11), rgba(14, 17, 24, .92) 46%); }
.dom.big svg { width: 92px; height: 92px; stroke: var(--signal); }
.dom.big h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -.03em; }
.dom.big p { max-width: 38ch; font-size: 16px; color: var(--soft); }
.feat { display: grid; gap: 9px; margin: 4px 0 0; padding: 0; list-style: none; color: var(--soft); font-size: 15px; }
.feat li { position: relative; padding-left: 24px; }
.feat li::before { content: ""; position: absolute; left: 0; top: .6em; width: 14px; height: 3px; border-radius: 2px; background: var(--signal); }
.state.live { color: var(--signal); font-size: 16px; font-weight: 700; }

/* ---------- steps (a real sequence) ---------- */
.steps { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin: 28px 0 0; padding: 0; list-style: none; }
.steps::before { content: ""; position: absolute; left: 18px; right: 18px; top: 18px; height: 3px; background: var(--line); }
.steps li { position: relative; }
.snode { position: relative; display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 14px; border: 3px solid var(--signal); border-radius: 50%; background: var(--ink); color: var(--signal); font-weight: 800; }
.steps h3 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.01em; }
.steps p { max-width: 36ch; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }

/* ---------- footer, toast ---------- */
.foot { margin-top: 64px; padding: 28px 0 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.foot a { color: var(--soft); margin-left: 16px; }
.foot .logo { font-size: 17px; }
.foot .logo svg { width: 26px; height: 26px; }
.foot p { margin: 14px 0 0; }
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 50; max-width: min(92vw, 460px); padding: 12px 18px;
  border: 1px solid var(--signal); border-radius: 6px; background: #161a24; color: var(--text); font-size: 14px;
  transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .domains { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 640px) {
  .nav { gap: 10px; padding: 8px 14px; }
  .nav .nav-cta { display: none; }
  .hero-rung { flex-direction: column; align-items: flex-start; font-size: 2.3rem; }
  .hbus, .hwire.lead { display: none; }
  .hwire { flex: none; width: 3px; height: .55em; min-width: 3px; margin-left: .5em; }
  .hwire::after { transform: scaleY(0); transform-origin: top; }
  .hero-rung.run .hwire::after { animation-name: flowiny; }
  .domains { grid-template-columns: 1fr; }
  .dom.big { grid-column: auto; grid-row: auto; }
  .steps { grid-template-columns: 1fr; gap: 22px; }
  .steps::before { left: 18px; right: auto; top: 18px; bottom: 18px; width: 3px; height: auto; }
  .steps li { padding-left: 54px; }
  .snode { position: absolute; left: 0; top: 0; margin: 0; }
  .foot a:first-of-type { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-rung .hstep, .hero-rung.run .hstep { animation: none; color: #fff; border-color: var(--signal); }
  .hero-rung .hwire::after, .hero-rung.run .hwire::after { animation: none; transform: none; }
  .live-svg .lw.on, .live-svg .motor.on .spin { animation: none; }
  .toast, .dom svg { transition: none; }
}
