Alex Dunmow 0e54864687 fix(terminal): remediate layout/whitespace + mobile responsiveness
Layout/whitespace (home page):
- feature-grid rendered as 3 full-width ballooning rows because the host
  Tailwind scan covers rendered block HTML, not theme override .ninjatpl
  files, so lg:grid-cols-* utilities in overrides are purge-fragile and
  collapsed to one column. Move multi-column layout to plain CSS in
  css.input_css_append (.tty-grid*, never purged) and apply to
  feature-grid, stats, pricing, contact-card + a .tty-form-grid for
  contact-form (col-span utilities were equally fragile).
- code_console / boot_log persona blocks shipped no max-width wrapper and
  ran edge-to-edge on the full-width landing page while sibling sections
  were contained; wrap both in a centred .tty-console-shell with a mobile
  side gutter.
- CTA heading read dark-on-green (fails contrast): .terminal-heading in
  assets/style.css hardcoded color:foreground, overriding the band's
  primary-foreground. Change to color:inherit so headings on inverted
  bands read correctly.
- Trim oversized section padding (py-16 md:py-24 -> py-12 md:py-20; the
  window-nested contact sections -> py-8 md:py-12).

Mobile:
- All multi-column grids now collapse to 1 column via CSS media queries
  (minmax(0,1fr) prevents long/monospace content forcing horizontal
  overflow); console blocks keep overflow-x scroll inside their own box.
- Pin hero min-heights to CSS (.tty-hero*) since min-h-screen / arbitrary
  min-h-[..] utilities are also purge-fragile.

Persona (phosphor TTY, window chrome, man-page, canvas hero) unchanged.
No version bump. make + check-safety both exit 0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 17:26:40 +08:00

96 lines
7.5 KiB
Plaintext

{# hero terminal override (GO-BIG showpiece): canvas ASCII glyph-rain background, TTY prompt eyebrow, scanline overlay. All builtin field reads + macro + branch structure preserved from the builtin default. The rain shows when there is no backgroundImage; it lazy-inits on view, honors prefers-reduced-motion, degrades to a static phosphor gradient with JS off, and is dependency-free. #}
{% set eyebrowText = eyebrow.text|default:eyebrow %}
{% set headlineText = headline.text|default:headline %}
{% set subText = subheadline.text|default:subheadline %}
{% set descText = description.text|default:description %}
{% set pText = ctaPrimary.text %}
{% set pUrl = ctaPrimary.url %}
{% set sText = ctaSecondary.text %}
{% set sUrl = ctaSecondary.url %}
{% set variant = template|default:"centered" %}
{% set hasImage = backgroundImage %}
{% set showOverlay = hasImage and overlayColor != "none" and overlayColor != "" %}
{% macro herocontent(align) %}
{% if eyebrowText %}<span class="terminal-eyebrow inline-block mb-4 border border-border bg-muted/40 px-3 py-1">$ {{ eyebrowText }} <span aria-hidden="true" class="caret-blink">_</span></span>{% endif %}
{% if headlineText %}<h1 class="terminal-heading text-4xl sm:text-5xl lg:text-6xl font-bold leading-tight text-foreground">{{ headlineText }}</h1>{% endif %}
{% if subText %}<h2 class="mt-4 text-xl sm:text-2xl text-muted-foreground max-w-2xl{% if align == "center" %} mx-auto{% endif %}">{{ subText }}</h2>{% endif %}
{% if descText %}<p class="mt-4 max-w-xl leading-relaxed text-muted-foreground{% if align == "center" %} mx-auto{% endif %}">{{ descText }}</p>{% endif %}
{% if pText or sText %}<div class="mt-8 flex flex-col sm:flex-row gap-4{% if align == "center" %} justify-center{% endif %}">
{% if pText and pUrl %}<a href="{{ pUrl }}" class="terminal-mono inline-flex items-center justify-center gap-2 border border-primary bg-primary px-6 py-3 font-semibold uppercase tracking-wider text-primary-foreground transition-colors hover:bg-transparent hover:text-primary">{{ pText }}</a>{% endif %}
{% if sText and sUrl %}<a href="{{ sUrl }}" class="terminal-mono inline-flex items-center justify-center border border-border px-6 py-3 font-semibold uppercase tracking-wider text-foreground transition-colors hover:border-primary hover:text-primary">{{ sText }}</a>{% endif %}
</div>{% endif %}
{% if trustLogos %}<div class="mt-10">
<p class="terminal-mono text-xs uppercase tracking-widest text-muted-foreground mb-3">Trusted by</p>
<div class="flex flex-wrap items-center gap-6{% if align == "center" %} justify-center{% endif %}">{% for logo in trustLogos %}{% if logo.url %}<a href="{{ logo.url }}" target="_blank" rel="noopener noreferrer" class="opacity-60 transition-opacity hover:opacity-100">{% img logo.image alt=logo.alt class="h-8 w-auto" %}</a>{% else %}{% img logo.image alt=logo.alt class="h-8 w-auto opacity-60" %}{% endif %}{% endfor %}</div>
</div>{% endif %}
{% endmacro %}
{% if variant == "split" %}
<section class="hero grid grid-cols-1 lg:grid-cols-2 overflow-hidden bg-background text-foreground{% if class %} {{ class }}{% endif %}">
<div class="relative tty-hero-media bg-muted {% if mediaPosition == "left" %}order-1 lg:order-1{% else %}order-1 lg:order-2{% endif %}">{% if hasImage %}{% img backgroundImage alt=headlineText class="absolute inset-0 h-full w-full object-cover" layout="hero" %}{% else %}<div class="tty-rain-wrap"><div class="tty-rain-fallback"></div><canvas class="tty-rain-canvas" aria-hidden="true"></canvas></div>{% endif %}<div aria-hidden="true" class="tty-scanlines pointer-events-none absolute inset-0"></div></div>
<div class="flex flex-col justify-center px-6 py-16 lg:px-12 {% if mediaPosition == "left" %}order-2 lg:order-2{% else %}order-2 lg:order-1{% endif %}"><div class="max-w-lg text-left">{{ herocontent("left") }}</div></div>
</section>
{% else %}
{% set align = "center" %}
{% if variant == "left-aligned" %}{% set align = "left" %}{% endif %}
<section class="hero tty-hero flex flex-col overflow-hidden bg-background text-foreground {% if minHeight == "screen" %}tty-hero-screen{% elif minHeight == "50vh" %}tty-hero-half{% elif minHeight == "auto" %}tty-hero-auto{% else %}tty-hero-tall{% endif %} {% if verticalAlign == "top" %}justify-start pt-20{% elif verticalAlign == "bottom" %}justify-end pb-20{% else %}justify-center{% endif %}{% if class %} {{ class }}{% endif %}">
{% if hasImage %}<div class="absolute inset-0 z-0">{% img backgroundImage alt=headlineText class="h-full w-full object-cover" layout="hero" %}{% if showOverlay %}<div class="absolute inset-0 {% if overlayColor == "light" %}bg-background/60{% elif overlayColor == "primary" %}bg-primary/50{% elif overlayOpacity <= 30 %}bg-black/30{% elif overlayOpacity <= 50 %}bg-black/50{% elif overlayOpacity <= 70 %}bg-black/70{% else %}bg-black/80{% endif %}"></div>{% endif %}</div>{% else %}<div class="tty-rain-wrap z-0"><div class="tty-rain-fallback"></div><canvas class="tty-rain-canvas" aria-hidden="true"></canvas></div>{% endif %}
<div aria-hidden="true" class="tty-scanlines pointer-events-none absolute inset-0 z-0"></div>
<div class="relative z-10 mx-auto w-full max-w-4xl px-4 sm:px-6 lg:px-8 {% if variant == "left-aligned" %}text-left{% else %}text-center{% endif %}">{{ herocontent(align) }}</div>
</section>
{% endif %}
<script>
(function(){
if(window.__terminalRain)return;window.__terminalRain=1;
var reduce=window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;
function initCanvas(cv){
if(cv.__init)return;cv.__init=1;
var ctx=cv.getContext&&cv.getContext('2d');if(!ctx)return;
var wrap=cv.parentElement;
var cs=getComputedStyle(document.documentElement);
function raw(n){return cs.getPropertyValue(n).trim();}
var fg=raw('--foreground');
var col1='hsl('+(raw('--primary')||fg)+')';
var col2='hsl('+(raw('--accent')||fg)+')';
var fade='hsl('+(raw('--background')||fg)+' / 0.12)';
var glyphs='01<>[]{}#$%&*+=/|_~^:;.,abcdefghijklmnopqrstuvwxyz'.split('');
var fontSize=14,cols=0,drops=[],W=0,H=0,dpr=1;
function resize(){
dpr=Math.min(window.devicePixelRatio||1,2);
W=wrap.clientWidth;H=wrap.clientHeight;
if(W===0||H===0)return;
cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0);
cols=Math.max(1,Math.floor(W/fontSize));
drops=[];for(var i=0;i<cols;i++)drops[i]=Math.random()*-50;
}
resize();
var last=0,fps=1000/18;
function frame(t){
requestAnimationFrame(frame);
if(t-last<fps)return;last=t;
if(W===0||H===0){resize();return;}
ctx.fillStyle=fade;ctx.fillRect(0,0,W,H);
ctx.font=fontSize+'px monospace';
for(var i=0;i<cols;i++){
var ch=glyphs[Math.floor(Math.random()*glyphs.length)];
var x=i*fontSize,y=drops[i]*fontSize;
ctx.fillStyle=Math.random()<0.85?col1:col2;
ctx.fillText(ch,x,y);
if(y>H&&Math.random()>0.975)drops[i]=0;
drops[i]++;
}
}
if(window.ResizeObserver){var ro=new ResizeObserver(resize);ro.observe(wrap);}else{window.addEventListener('resize',resize);}
requestAnimationFrame(frame);
}
function boot(){
if(reduce)return;
var cvs=document.querySelectorAll('.tty-rain-canvas');
if(!cvs.length)return;
if(!('IntersectionObserver' in window)){cvs.forEach(initCanvas);return;}
var io=new IntersectionObserver(function(es){es.forEach(function(e){if(e.isIntersecting){initCanvas(e.target);io.unobserve(e.target);}});},{threshold:0.05});
cvs.forEach(function(c){io.observe(c);});
}
if(document.readyState!='loading')boot();else document.addEventListener('DOMContentLoaded',boot);
})();
</script>