/* Tape-Out Mission Control — HUD styles */
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 176, 0, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 40%, rgba(43, 245, 154, 0.05), transparent 60%),
    var(--bg);
  overflow-x: hidden;
}
main { padding-block: 0; }
h1, h2, h3 { letter-spacing: -0.02em; font-weight: 700; }
h2 { margin-top: 0; }
::selection { background: var(--amber); color: #000; }

.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 9, 11, 0.72);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}
.site-header .wrap { padding-block: 0.7rem; }
.brand { font-size: 1rem; letter-spacing: 0.12em; display: flex; align-items: center; gap: 0.5rem; }
.brand-sub { color: var(--emerald); font-weight: 400; letter-spacing: 0.04em; font-size: 0.8rem; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 10px var(--emerald); animation: pulse 2s infinite; }
.site-nav { gap: 1.1rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.site-nav a:hover { border-bottom-color: var(--emerald); }
.nav-cta { color: var(--amber) !important; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* buttons */
.button { border-radius: 4px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.5rem; transition: transform .2s, box-shadow .2s, background .2s; }
.btn-amber { background: var(--amber); color: var(--accent-ink); box-shadow: 0 0 0 1px rgba(255,176,0,.6), 0 0 24px rgba(255,176,0,.25); }
.btn-amber:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--amber), 0 0 36px rgba(255,176,0,.45); filter: none; }
.btn-amber:disabled { opacity: .5; cursor: progress; transform: none; }
.btn-ghost { background: rgba(43,245,154,0.06); color: var(--emerald); box-shadow: inset 0 0 0 1px rgba(43,245,154,.4); }
.btn-ghost:hover { background: rgba(43,245,154,0.14); filter: none; }
.mini-btn { background: transparent; border: 1px solid rgba(255,176,0,.5); color: var(--amber); font: inherit; font-size: .75rem; padding: .25rem .6rem; border-radius: 3px; cursor: pointer; letter-spacing: .06em; }
.mini-btn:hover { background: rgba(255,176,0,.12); }

/* glass */
.glass {
  background: linear-gradient(180deg, rgba(30, 40, 42, 0.55), rgba(10, 14, 16, 0.7));
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.05);
  padding: 1rem;
  position: relative;
  min-width: 0;
}
.glass::before { /* corner brackets */
  content: ""; position: absolute; inset: -1px; pointer-events: none; border-radius: 8px;
  background:
    linear-gradient(var(--amber), var(--amber)) top left / 14px 1px no-repeat,
    linear-gradient(var(--amber), var(--amber)) top left / 1px 14px no-repeat,
    linear-gradient(var(--amber), var(--amber)) bottom right / 14px 1px no-repeat,
    linear-gradient(var(--amber), var(--amber)) bottom right / 1px 14px no-repeat;
  opacity: .7;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: .8rem; padding-bottom: .55rem; border-bottom: 1px dashed var(--line); }
.panel-head .icon { color: var(--emerald); }
.mono-soft { color: var(--emerald); }
.eyebrow { font-size: .75rem; letter-spacing: .18em; color: var(--emerald); text-transform: uppercase; margin-bottom: .75rem; }
.blink { animation: pulse 1.2s infinite; color: var(--emerald); }
.hint { font-size: .75rem; color: var(--ink-soft); margin: .5rem 0 0; }

/* hero */
.hero { position: relative; min-height: min(100svh, 980px); display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.stage { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; touch-action: pan-y; }
.stage:active { cursor: grabbing; }
.stage-fallback { position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%); color: var(--ink-soft); text-align: center; max-width: 30ch; }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(7,9,11,.4) 0%, transparent 25%, transparent 55%, rgba(7,9,11,.92) 100%); }
.hero-hud { position: relative; z-index: 2; display: grid; gap: 1.5rem; padding-block: 34vh 3rem; pointer-events: none; }
.hero-hud > * { pointer-events: auto; }
.hud-copy h1 { font-size: clamp(1.9rem, 5.2vw, 3.8rem); max-width: 17ch; text-shadow: 0 2px 30px rgba(0,0,0,.8); }
.hud-copy h1 em { font-style: normal; color: var(--amber); text-shadow: 0 0 30px rgba(255,176,0,.4); }
.lede { color: #c9d4ce; max-width: 54ch; text-shadow: 0 1px 12px rgba(0,0,0,.9); }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.hud-panel { align-self: end; max-width: 360px; width: 100%; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: .75rem; }
.seg-btn, .chip-btn { background: rgba(255,255,255,0.03); border: 1px solid var(--line); color: var(--ink-soft); padding: .5rem .3rem; border-radius: 4px; cursor: pointer; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; display: inline-flex; gap: .35rem; justify-content: center; align-items: center; transition: all .2s; }
.seg-btn:hover, .chip-btn:hover { color: var(--ink); border-color: rgba(43,245,154,.5); }
.seg-btn.is-on, .chip-btn.is-on { color: var(--accent-ink); background: var(--emerald); border-color: var(--emerald); box-shadow: 0 0 16px rgba(43,245,154,.35); }
.tapeout-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: .75rem; }
.toggle { display: flex; gap: .55rem; align-items: center; font-size: .8rem; color: var(--ink-soft); margin: .35rem 0; cursor: pointer; }
.toggle input { accent-color: var(--emerald); width: 16px; height: 16px; }
.readouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .75rem 0 0; }
.readouts dt { font-size: .62rem; letter-spacing: .12em; color: var(--ink-soft); }
.readouts dd { margin: 0; font-size: .78rem; color: var(--amber); }
.ticker { position: relative; z-index: 2; border-block: 1px solid var(--line); background: rgba(0,0,0,.55); overflow: hidden; white-space: nowrap; font-size: .75rem; color: var(--emerald); padding: .45rem 0; }
.ticker-track { display: inline-block; animation: tick 60s linear infinite; }
.ticker-track span { margin-right: 3rem; }
.ticker-track b { color: var(--amber); font-weight: 400; }
@keyframes tick { to { transform: translateX(-50%); } }

@media (min-width: 900px) {
  .hero-hud { grid-template-columns: 1fr 340px; align-items: end; padding-block: 28vh 3.5rem; }
}

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-block: 3rem; padding: 0; }
.stat { background: var(--surface); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.stat b { font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--amber); font-variant-numeric: tabular-nums; }
.stat span { font-size: .75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.stats.wrap { width: calc(100% - 2rem); }

/* sections */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section.alt { background: linear-gradient(180deg, rgba(43,245,154,0.025), rgba(255,176,0,0.02)); border-block: 1px solid var(--line); }
.sec-head { margin-bottom: 2rem; }
.sec-head p:not(.eyebrow) { color: var(--ink-soft); }

/* verify */
.verify-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.console { background: #020403; border: 1px solid rgba(43,245,154,.18); border-radius: 4px; height: 300px; overflow: auto; margin: 0 0 .8rem; padding: .8rem; font-size: .74rem; line-height: 1.55; color: #8ff5c4; white-space: pre-wrap; word-break: break-word; text-shadow: 0 0 6px rgba(43,245,154,.35); }
.console .w { color: var(--amber); } .console .e { color: var(--red); } .console .ok { color: var(--emerald); font-weight: 700; } .console .d { color: #6b7d75; } .console .c { color: var(--cyan); }
.cursor { animation: pulse 1s steps(1) infinite; }
.console-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.speed { font-size: .75rem; color: var(--ink-soft); display: flex; gap: .4rem; align-items: center; }
.speed select, .knob select { background: #050807; border: 1px solid var(--line); border-radius: 4px; padding: .3rem .4rem; color: var(--ink); }
.progress { height: 3px; background: rgba(255,255,255,.06); margin-top: .9rem; border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--emerald)); box-shadow: 0 0 12px var(--emerald); transition: width .3s; }
.status-pill { padding: .15rem .55rem; border-radius: 99px; border: 1px solid currentColor; color: var(--ink-soft); }
.status-pill.run { color: var(--amber); animation: pulse 1s infinite; }
.status-pill.done { color: var(--emerald); }
.counters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.counter { display: flex; flex-direction: column; gap: .25rem; overflow: hidden; }
.c-label { font-size: .65rem; letter-spacing: .14em; color: var(--ink-soft); }
.counter b { font-size: clamp(1.3rem, 3.2vw, 2rem); color: var(--red); font-variant-numeric: tabular-nums; transition: color .4s, text-shadow .4s; text-shadow: 0 0 18px rgba(255,77,94,.35); }
.counter.clean b { color: var(--emerald); text-shadow: 0 0 18px rgba(43,245,154,.5); }
.counter.clean { border-color: rgba(43,245,154,.5); }
.c-sub { font-size: .68rem; color: var(--ink-soft); }
.spark { height: 3px; background: rgba(255,77,94,.15); margin-top: .4rem; }
.spark i { display: block; height: 100%; width: 100%; background: var(--red); transition: width .25s, background .4s; }
.counter.clean .spark i { background: var(--emerald); }
.counter.bump { animation: bump .5s; }
@keyframes bump { 30% { transform: scale(1.04); box-shadow: 0 0 40px rgba(43,245,154,.35); } }
.dials { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: .75rem; }
.dial { text-align: center; font-size: .65rem; letter-spacing: .1em; color: var(--ink-soft); }
.dial svg { width: 100%; max-width: 110px; display: block; margin: 0 auto .3rem; }
.dial .trk { fill: none; stroke: rgba(255,255,255,.07); stroke-width: 8; }
.dial .val { fill: none; stroke: var(--amber); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .4s, stroke .4s; transform: rotate(-90deg); transform-origin: 50% 50%; }
.dial .ticks { stroke: rgba(255,255,255,.18); stroke-width: 1; }
.dial text { fill: var(--ink); font-family: var(--font-mono); font-size: 15px; text-anchor: middle; }
.dial.pass .val { stroke: var(--emerald); filter: drop-shadow(0 0 4px var(--emerald)); }
.dial.pass { color: var(--emerald); }
.lvs-canvas { width: 100% !important; height: 240px !important; display: block; }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 340px; }
.verdict { margin-top: 1.25rem; display: flex; gap: 1rem; align-items: center; border: 1px solid var(--emerald); background: rgba(43,245,154,.07); border-radius: 8px; padding: 1rem 1.25rem; color: var(--emerald); animation: verdict .8s cubic-bezier(.2,1.4,.4,1); box-shadow: 0 0 60px rgba(43,245,154,.15); }
.verdict .icon { font-size: 2rem; }
.verdict b { display: block; letter-spacing: .2em; font-size: 1.1rem; }
.verdict span { color: var(--ink); font-size: .85rem; }
@keyframes verdict { from { opacity: 0; transform: scale(.94) translateY(10px); } }

@media (min-width: 960px) {
  .verify-grid { grid-template-columns: 1.25fr 1fr; grid-template-areas: "con cnt" "con dia" "lvs slk"; }
  .console-panel { grid-area: con; } .counters { grid-area: cnt; } .dials-panel { grid-area: dia; } .lvs-panel { grid-area: lvs; } .slack-panel { grid-area: slk; }
  .console { height: 430px; }
}

/* PVT */
.pvt-grid { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .pvt-grid { grid-template-columns: 1.6fr 1fr; } }
.matrix { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 560px; font-size: .78rem; }
.matrix th { font-weight: 400; color: var(--ink-soft); font-size: .68rem; letter-spacing: .08em; padding: .35rem; text-align: center; }
.matrix th[scope="row"] { text-align: left; color: var(--amber); white-space: nowrap; }
.matrix td { padding: 0; }
.matrix button { width: 100%; padding: .6rem .2rem; border-radius: 3px; border: 1px solid transparent; cursor: pointer; font-variant-numeric: tabular-nums; font-size: .78rem; transition: transform .15s, box-shadow .2s; animation: cellIn .5s backwards; }
.matrix button.ok { background: rgba(43,245,154,.12); color: #9ff7cd; }
.matrix button.warn { background: rgba(255,176,0,.16); color: #ffd67a; }
.matrix button.bad { background: rgba(255,77,94,.18); color: #ff9ca6; }
.matrix button:hover { transform: scale(1.06); border-color: currentColor; }
.matrix button.sel { box-shadow: 0 0 0 2px var(--ink), 0 0 20px currentColor; }
@keyframes cellIn { from { opacity: 0; transform: scale(.6); } }
.legend { font-size: .72rem; color: var(--ink-soft); display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .8rem 0 0; }
.lg { width: 12px; height: 12px; display: inline-block; border-radius: 2px; }
.lg.ok { background: rgba(43,245,154,.5); } .lg.warn { background: rgba(255,176,0,.6); } .lg.bad { background: rgba(255,77,94,.6); }
.knob { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; font-size: .78rem; color: var(--ink-soft); margin-bottom: .7rem; align-items: center; }
.knob input[type=range] { grid-column: 1 / -1; accent-color: var(--amber); width: 100%; }
.knob output { color: var(--amber); }
.calc-out { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 1rem; }
.calc-out div { background: #070a0b; padding: .6rem; }
.calc-out span { display: block; font-size: .64rem; color: var(--ink-soft); letter-spacing: .08em; text-transform: uppercase; }
.calc-out b { font-size: 1.05rem; color: var(--emerald); font-variant-numeric: tabular-nums; }
.calc-out b.neg { color: var(--red); }
.formula { font-size: .68rem; color: var(--ink-soft); margin: .8rem 0 0; }

/* flow */
.flow-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 1000px) { .flow-grid { grid-template-columns: 1.7fr 1fr; } }
.flow-svg-wrap { overflow-x: auto; }
#flow-svg { width: 100%; min-width: 620px; height: auto; display: block; }
.fnode { cursor: pointer; }
.fnode rect { fill: rgba(10,16,16,.9); stroke: rgba(43,245,154,.45); stroke-width: 1.2; transition: all .25s; }
.fnode text { fill: var(--ink); font-family: var(--font-mono); font-size: 12px; pointer-events: none; }
.fnode .sub { fill: var(--ink-soft); font-size: 9.5px; }
.fnode:hover rect, .fnode:focus rect { stroke: var(--amber); fill: rgba(40,30,5,.9); }
.fnode:focus { outline: none; }
.fnode.active rect { stroke: var(--amber); stroke-width: 2; fill: rgba(255,176,0,.14); filter: drop-shadow(0 0 8px rgba(255,176,0,.6)); }
.fnode.lit rect { stroke: var(--emerald); fill: rgba(43,245,154,.14); }
.fedge { fill: none; stroke: rgba(43,245,154,.35); stroke-width: 1.4; stroke-dasharray: 5 5; animation: dash 1.2s linear infinite; }
.fedge.lit { stroke: var(--amber); stroke-width: 2; }
@keyframes dash { to { stroke-dashoffset: -20; } }
.packet { fill: var(--amber); filter: drop-shadow(0 0 6px var(--amber)); }
.flow-detail h3 { color: var(--amber); font-size: 1.1rem; margin-bottom: .4rem; }
.flow-detail .tool { color: var(--emerald); font-size: .78rem; margin-bottom: .8rem; }
.flow-detail p { font-size: .85rem; color: #c3cec8; }
.flow-detail ul { padding-left: 1rem; font-size: .8rem; color: var(--ink-soft); margin: 0 0 .8rem; }
.flow-detail .kv { display: grid; grid-template-columns: repeat(2,1fr); gap: .4rem; }
.flow-detail .kv div { border: 1px solid var(--line); border-radius: 4px; padding: .4rem .5rem; }
.flow-detail .kv span { display: block; font-size: .6rem; color: var(--ink-soft); letter-spacing: .1em; }
.flow-detail .kv b { color: var(--amber); font-size: .9rem; }
.flow-detail { animation: fadeIn .35s; }
.flow-detail.swap { animation: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
.mermaid-out { overflow-x: auto; min-height: 120px; }
.mermaid-out svg { max-width: 100%; min-width: 560px; height: auto; }
.mermaid-src { font-size: .75rem; color: var(--ink-soft); white-space: pre; }

/* floorplan */
.fp-grid { display: grid; gap: 1rem; }
@media (min-width: 960px) { .fp-grid { grid-template-columns: 1.6fr 1fr; } }
.fp-canvas { width: 100% !important; aspect-ratio: 1 / 1; height: auto !important; max-height: 640px; display: block; touch-action: none; cursor: crosshair; background: #030605; border-radius: 4px; }
.fp-metrics { display: grid; gap: 1px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 1rem 0; }
.fp-metrics div { background: #070a0b; padding: .5rem .7rem; display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-soft); }
.fp-metrics b { color: var(--emerald); font-variant-numeric: tabular-nums; }
.fp-metrics b.neg { color: var(--red); }
.fp-metrics b.warn { color: var(--amber); }
.fp-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* tools */
.tools-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 960px) { .tools-grid { grid-template-columns: 1.3fr 1fr; } }
#tools .glass + .glass { margin-top: 0; }
#tools > .wrap > .glass { margin-bottom: 1rem; }
.tool-table { width: 100%; border-collapse: collapse; font-size: .8rem; min-width: 640px; }
.tool-table th { text-align: left; font-weight: 400; color: var(--ink-soft); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; padding: .55rem; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; }
.tool-table th:hover { color: var(--amber); }
.tool-table th[aria-sort] { color: var(--amber); }
.tool-table td { padding: .55rem; border-bottom: 1px solid rgba(255,255,255,.04); }
.tool-table tr:hover td { background: rgba(43,245,154,.04); }
.tool-table td:first-child { color: var(--amber); white-space: nowrap; }
.bar { display: inline-block; height: 6px; background: linear-gradient(90deg, var(--emerald), var(--amber)); border-radius: 3px; vertical-align: middle; margin-right: .4rem; transition: width .8s; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; position: relative; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 1px; background: linear-gradient(var(--emerald), var(--amber)); }
.timeline li { position: relative; padding-left: 2.2rem; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 1.2rem; width: 13px; height: 13px; border-radius: 50%; background: var(--bg); border: 2px solid var(--emerald); box-shadow: 0 0 10px var(--emerald); }
.timeline .glass { display: grid; gap: .3rem; }
.tl-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.tl-top b { color: var(--amber); font-size: 1.05rem; }
.tl-top span { color: var(--emerald); font-size: .75rem; letter-spacing: .1em; }
.timeline p { margin: 0; font-size: .85rem; color: #c3cec8; }
.tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .3rem; }
.tags span { font-size: .66rem; border: 1px solid var(--line); padding: .1rem .45rem; border-radius: 3px; color: var(--ink-soft); }
@media (min-width: 900px) { .timeline { grid-template-columns: 1fr 1fr; } .timeline::before, .timeline li::before { display: none; } .timeline li { padding-left: 0; } }

/* contact */
.contact-inner { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 900px) { .contact-inner { grid-template-columns: 1fr 1fr; } }
.contact h2 { font-size: clamp(1.6rem, 4vw, 2.6rem); }
.contact-form { display: grid; gap: .8rem; }
.contact-form label { display: grid; gap: .3rem; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.contact-form input, .contact-form textarea { background: #050807; border: 1px solid var(--line); border-radius: 4px; padding: .6rem; text-transform: none; letter-spacing: 0; }
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--emerald); outline: none; box-shadow: 0 0 0 3px rgba(43,245,154,.15); }
.form-ok { color: var(--emerald); font-size: .85rem; margin: 0; }

.site-footer { background: #040506; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .75rem; }

/* reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .ticker-track, .fedge { animation: none; }
}
