/* ================================================================
   FRAXISOFT — cassette-futurism workstation, v2
   The site is a machine: pages are programs, clicks are hardware.
   ================================================================ */

:root {
  --bone:        #E4D8C3;
  --bone-hi:     #F0E8D8;
  --bone-low:    #CDBDA1;
  --plastic-edge:#A6947A;
  --brown-text:  #453826;
  --brown-mid:   #7A6A52;
  --screen:      #1D1712;
  --screen-deep: #120E0A;
  --amber:       #FFB000;
  --amber-soft:  #E8C87E;
  --amber-dim:   #8F6E33;
  --stripe-red:  #E0562B;
  --teal:        #3D9E8C;

  --font-pixel: 'Press Start 2P', monospace;
  --font-term:  'VT323', monospace;
  --font-body:  'IBM Plex Sans', system-ui, sans-serif;

  --bezel-r: 22px;
  --maxw: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse 120% 90% at 50% -10%, var(--bone-hi), transparent 60%),
    var(--bone);
  color: var(--brown-text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 10 10"><path d="M1 0h1v1h1v1h1v1h1v1h1v1h1v1h1v1H5v1H4v1H3v1H2V9H1z" fill="%23453826" stroke="%23F0E8D8" stroke-width=".5"/></svg>') 2 2, auto;
}

svg { shape-rendering: crispEdges; }
::selection { background: var(--amber); color: var(--screen-deep); }

a, button, input, textarea, label { cursor: inherit; }

/* ================= tube on/off (page transitions) ================= */
#tubefx {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background: var(--screen-deep);
  opacity: 0; visibility: hidden;
}
#tubefx::before {           /* the bright collapse line */
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 3px; transform: translateY(-50%);
  background: var(--amber);
  box-shadow: 0 0 24px 6px rgba(255,176,0,.8), 0 0 80px 20px rgba(255,176,0,.35);
  opacity: 0;
}
html.js #tubefx { opacity: 1; visibility: visible; animation: tube-on .5s steps(10) .05s forwards; }
@keyframes tube-on {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}
html.js #tubefx::before { animation: line-on .5s steps(10) .05s forwards; }
@keyframes line-on {
  0%   { opacity: 1; transform: translateY(-50%) scaleX(.02); }
  35%  { opacity: 1; transform: translateY(-50%) scaleX(1); }
  70%  { opacity: 1; transform: translateY(-50%) scaleX(1) scaleY(8); }
  100% { opacity: 0; transform: translateY(-50%) scaleX(1) scaleY(120); }
}
#tubefx.off { animation: tube-off .32s steps(8) forwards; }
@keyframes tube-off {
  0%   { opacity: 0; visibility: visible; }
  30%  { opacity: 1; }
  100% { opacity: 1; visibility: visible; }
}
#tubefx.off::before { animation: line-off .32s steps(8) forwards; }
@keyframes line-off {
  0%   { opacity: 0; transform: translateY(-50%) scaleY(120); }
  40%  { opacity: 1; transform: translateY(-50%) scaleY(1) scaleX(1); }
  100% { opacity: 1; transform: translateY(-50%) scaleY(1) scaleX(.01); }
}
@media (prefers-reduced-motion: reduce) {
  #tubefx, html.js #tubefx { display: none !important; }
}

/* ================= livery ================= */
.livery { display: flex; height: 10px; }
.livery i { flex: 1; }
.livery i:nth-child(1) { background: var(--stripe-red); }
.livery i:nth-child(2) { background: var(--amber); }
.livery i:nth-child(3) { background: var(--teal); }

/* ================= chassis header ================= */
.chassis-bar {
  display: flex; align-items: center; gap: 24px;
  max-width: var(--maxw); margin: 0 auto;
  padding: 20px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--brown-text); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; color: var(--stripe-red); }
.brand-name { font-family: var(--font-pixel); font-size: 13px; letter-spacing: 1px; }
.nav { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  font-family: var(--font-term); font-size: 20px; letter-spacing: 1px;
  color: var(--brown-mid); text-decoration: none; text-transform: uppercase;
}
.nav a:hover, .nav a:focus-visible { color: var(--stripe-red); }
.nav a.here { color: var(--stripe-red); }
.nav a.here::before { content: '▸'; margin-right: 4px; }

.hw { display: flex; align-items: center; gap: 16px; }
.power, .clock {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-term); font-size: 17px; color: var(--brown-mid);
}
.clock { min-width: 74px; }
.led {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px 1px var(--teal);
  animation: led-breathe 3.5s ease-in-out infinite;
}
.led.busy { background: var(--amber); box-shadow: 0 0 7px 2px var(--amber); animation: led-busy .12s steps(2) infinite; }
@keyframes led-breathe { 50% { opacity: .55; } }
@keyframes led-busy { 50% { opacity: .3; } }

.sndbtn {
  font-family: var(--font-term); font-size: 17px; letter-spacing: 1px;
  color: var(--brown-mid);
  background: linear-gradient(180deg, var(--bone-hi), var(--bone-low));
  border: 1px solid var(--plastic-edge); border-radius: 5px;
  padding: 3px 10px 2px;
  box-shadow: 0 2px 0 var(--plastic-edge);
}
.sndbtn:active { transform: translateY(2px); box-shadow: none; }
.sndbtn[aria-pressed="true"] { color: var(--stripe-red); }

/* ================= bezel + CRT ================= */
.bezel {
  max-width: var(--maxw);
  margin: 26px auto 64px;
  padding: 18px 18px 0;
  background: linear-gradient(180deg, var(--bone-hi), var(--bone-low));
  border: 1px solid var(--plastic-edge);
  border-radius: var(--bezel-r);
  box-shadow: 0 2px 0 var(--bone-hi) inset, 0 14px 34px -18px rgba(69, 56, 38, .55);
}
.crt {
  position: relative;
  background: radial-gradient(ellipse 100% 100% at 50% 0%, #2A211A 0%, var(--screen) 55%, var(--screen-deep) 100%);
  border-radius: 14px;
  border: 2px solid #0C0906;
  box-shadow: inset 0 0 60px rgba(0,0,0,.55);
  overflow: hidden;
}
.crt-content {
  position: relative; z-index: 1;
  padding: 56px clamp(24px, 6vw, 72px);
  color: var(--amber-soft);
}
.scanlines {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 90% 80% at 50% 50%, transparent 55%, rgba(0,0,0,.38) 100%);
}
.scanlines::after {          /* slow refresh sweep */
  content: ''; position: absolute; left: 0; right: 0; height: 90px; top: -90px;
  background: linear-gradient(180deg, transparent, rgba(255,214,140,.045), transparent);
  animation: sweep 9s linear infinite;
}
@keyframes sweep { to { transform: translateY(calc(100vh + 180px)); } }
.trailfx { position: absolute; inset: 0; z-index: 2; pointer-events: none; mix-blend-mode: screen; }

.bezel-label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 8px;
  font-family: var(--font-term); font-size: 16px; letter-spacing: 2px;
  color: var(--brown-mid);
}
.bezel-screws { color: var(--plastic-edge); font-size: 13px; }

/* ================= hero (home) ================= */
.hero-bezel { margin-top: 10px; }
.hero-crt .crt-content { min-height: 480px; padding-top: 40px; }
html.js .hero-crt .crt { animation: none; }
.hero-crt .crt { }
.bootlog {
  font-family: var(--font-term); font-size: 19px; line-height: 1.45;
  color: var(--amber-dim); white-space: pre-wrap; min-height: 96px;
}
.ok { color: var(--teal); }

.hero-main { opacity: 0; transform: translateY(6px); transition: opacity .6s ease, transform .6s ease; }
.hero-main.on { opacity: 1; transform: none; }

.hero-logo { width: 84px; height: 84px; color: var(--amber); margin: 18px 0 20px; filter: drop-shadow(0 0 14px rgba(255,176,0,.35)); }
.hero-main.on .hero-logo rect { opacity: 0; animation: px-in .12s steps(2) forwards; }
.hero-main.on .hero-logo rect:nth-child(1) { animation-delay: .05s; }
.hero-main.on .hero-logo rect:nth-child(2) { animation-delay: .15s; }
.hero-main.on .hero-logo rect:nth-child(3) { animation-delay: .25s; }
.hero-main.on .hero-logo rect:nth-child(4) { animation-delay: .35s; }
.hero-main.on .hero-logo rect:nth-child(5) { animation-delay: .45s; }
.hero-main.on .hero-logo rect:nth-child(6) { animation-delay: .55s; }
@keyframes px-in { to { opacity: 1; } }

.hero-title {
  font-family: var(--font-pixel);
  font-size: clamp(26px, 5.4vw, 54px);
  color: var(--amber); letter-spacing: 2px;
  text-shadow: 0 0 18px rgba(255,176,0,.35);
}
.hero-sub {
  font-family: var(--font-term); font-size: clamp(22px, 3vw, 30px);
  color: var(--amber-soft); margin-top: 14px; letter-spacing: 1px;
}
.hero-line { max-width: 560px; margin-top: 16px; color: #C9B694; }
.hero-cta { display: flex; gap: 16px; margin-top: 30px; flex-wrap: wrap; }

.key-btn {
  display: inline-flex; align-items: baseline; gap: 12px;
  font-family: var(--font-pixel); font-size: 12px;
  color: var(--screen-deep); text-decoration: none;
  background: var(--amber);
  padding: 15px 20px 13px;
  border-radius: 6px; border: 0;
  border-bottom: 4px solid #A36F00;
  transition: transform .08s ease, border-bottom-width .08s ease;
}
.key-btn:hover { background: #FFC133; }
.key-btn:active { transform: translateY(3px); border-bottom-width: 1px; }
.key-hint { font-family: var(--font-term); font-size: 15px; opacity: .65; }
.ghost-btn {
  display: inline-flex; align-items: center;
  font-family: var(--font-term); font-size: 19px; letter-spacing: 1px;
  color: var(--amber-soft); text-decoration: none;
  padding: 12px 18px; border: 1px dashed var(--amber-dim); border-radius: 6px;
}
.ghost-btn:hover { color: var(--amber); border-color: var(--amber); }

.hero-status {
  margin-top: 34px;
  font-family: var(--font-term); font-size: 18px; letter-spacing: 2px;
  color: var(--teal);
}
.cursor { margin-left: 6px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ================= beige panels ================= */
.panel { max-width: var(--maxw); margin: 0 auto 90px; padding: 0 24px; }
.panel-head { max-width: 660px; margin-bottom: 40px; }
.eyebrow {
  font-family: var(--font-term); font-size: 18px; letter-spacing: 4px;
  color: var(--stripe-red); margin-bottom: 10px;
}
.panel h1, .panel h2, .screen-title {
  font-family: var(--font-pixel);
  font-size: clamp(17px, 2.6vw, 24px);
  line-height: 1.55;
}
.panel-intro { margin-top: 14px; color: var(--brown-mid); }

/* ================= cartridges ================= */
.cartridges { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.cartridge {
  position: relative; text-align: left; width: 100%;
  background: linear-gradient(180deg, var(--bone-hi), var(--bone));
  border: 1px solid var(--plastic-edge);
  border-top: 8px solid var(--stripe);
  border-radius: 10px 10px 4px 4px;
  padding: 22px 20px 24px;
  box-shadow: 0 10px 22px -16px rgba(69,56,38,.6);
  transition: transform .14s steps(3), box-shadow .14s steps(3);
  color: var(--brown-text); text-decoration: none; font-family: var(--font-body);
}
.cartridge:hover { transform: translateY(-6px); box-shadow: 0 18px 28px -16px rgba(69,56,38,.7); }
.cartridge:active { transform: translateY(2px); }
.cartridge.slotted { transform: translateY(6px); box-shadow: 0 4px 10px -8px rgba(69,56,38,.8); border-top-width: 4px; margin-top: 4px; }
.cart-icon { width: 44px; height: 44px; color: var(--stripe); margin-bottom: 16px; }
.cartridge h3 { font-family: var(--font-pixel); font-size: 12px; line-height: 1.7; margin-bottom: 12px; }
.cartridge p { font-size: 15.5px; color: var(--brown-mid); }
.cart-run {
  display: inline-block; margin-top: 14px;
  font-family: var(--font-term); font-size: 17px; letter-spacing: 2px;
  color: var(--brown-text); text-transform: uppercase;
  border-bottom: 2px dotted var(--plastic-edge);
}
.cartridge:hover .cart-run { color: var(--stripe-red); }
.cartridge:hover .cart-run::after { content: ' ▸'; }

/* ghost button legibility on beige panels */
.panel .ghost-btn { color: var(--brown-mid); border-color: var(--brown-mid); }
.panel .ghost-btn:hover { color: var(--stripe-red); border-color: var(--stripe-red); }

/* program directory (home) */
.prg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.prg-cards .cartridge { border-radius: 10px 10px 4px 4px; }
.prg-size { font-family: var(--font-term); font-size: 15px; color: var(--plastic-edge); letter-spacing: 1px; float: right; }

/* ================= module viewer (modules page) ================= */
.viewer-bezel { margin-top: 8px; }
.viewer .crt-content { min-height: 380px; padding-top: 40px; }
.tl { opacity: 0; }
.tl.on { opacity: 1; }
html:not(.js) .tl, .no-anim .tl { opacity: 1; }
.mod-head { font-family: var(--font-term); font-size: 20px; color: var(--amber-dim); margin-bottom: 20px; }
.mod-title { font-family: var(--font-pixel); font-size: clamp(15px, 2.2vw, 20px); color: var(--amber); text-shadow: 0 0 14px rgba(255,176,0,.25); margin-bottom: 22px; }
.mod-sec { font-family: var(--font-term); font-size: 19px; letter-spacing: 3px; color: var(--teal); margin: 20px 0 8px; }
.mod-body p, .mod-body li { color: #C9B694; font-size: 16px; max-width: 620px; }
.mod-body ul { list-style: none; }
.mod-body li { padding-left: 22px; position: relative; margin: 6px 0; }
.mod-body li::before { content: '▪'; position: absolute; left: 4px; color: var(--amber); }

/* ================= process ================= */
.term-head { font-family: var(--font-term); font-size: 19px; color: var(--amber-dim); letter-spacing: 1px; margin-bottom: 18px; }
.screen-title { color: var(--amber); text-shadow: 0 0 14px rgba(255,176,0,.25); margin-bottom: 36px; }
.pipeline { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 30px 26px; }
.step-no { font-family: var(--font-pixel); font-size: 11px; color: var(--teal); }
.step-week { font-family: var(--font-term); font-size: 15px; color: var(--amber-dim); margin-left: 8px; letter-spacing: 1px; }
.step-bar { height: 10px; margin: 10px 0 14px; border: 1px solid var(--amber-dim); padding: 1px; }
.step-bar i {
  display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(90deg, var(--amber) 0 6px, transparent 6px 9px);
  transition: width .9s steps(12);
}
.step.on .step-bar i, html:not(.js) .step-bar i { width: var(--fill); }
.step h3 { font-family: var(--font-term); font-size: 26px; letter-spacing: 1px; color: var(--amber-soft); margin-bottom: 6px; }
.step p { font-size: 15px; color: #B8A582; }
.step .artifact { margin-top: 10px; font-family: var(--font-term); font-size: 16px; color: var(--teal); letter-spacing: 1px; }

/* engagement modes */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.mode {
  background: linear-gradient(180deg, var(--bone-hi), var(--bone));
  border: 1px solid var(--plastic-edge); border-radius: 10px;
  padding: 24px 22px;
  box-shadow: 0 10px 22px -16px rgba(69,56,38,.6);
}
.mode h3 { font-family: var(--font-pixel); font-size: 12px; line-height: 1.7; margin-bottom: 10px; }
.mode .mode-tag { font-family: var(--font-term); font-size: 17px; letter-spacing: 2px; color: var(--stripe-red); display: block; margin-bottom: 8px; }
.mode p { font-size: 15.5px; color: var(--brown-mid); }

/* ================= disk / stack ================= */
.disk {
  background: var(--screen);
  border: 2px solid #0C0906; border-radius: 12px;
  padding: 30px clamp(20px, 4vw, 40px) 26px;
  box-shadow: inset 0 0 40px rgba(0,0,0,.5);
  font-family: var(--font-term); color: var(--amber-soft);
  position: relative; overflow: hidden;
}
.disk-cmd { font-size: 20px; color: var(--amber-dim); margin-bottom: 20px; }
.disk-listing { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 22px 34px; }
.disk-cat { color: var(--teal); font-size: 18px; letter-spacing: 3px; margin-bottom: 8px; }
.disk-col p:not(.disk-cat) { display: flex; align-items: baseline; font-size: 19px; line-height: 1.75; white-space: nowrap; }
.disk-col p span { flex: 1; min-width: 12px; margin: 0 6px; border-bottom: 2px dotted var(--amber-dim); }
.disk-free { margin-top: 24px; font-size: 17px; color: var(--amber-dim); }

/* ================= contact form ================= */
.form-term { max-width: 640px; }
.f-row { margin-bottom: 22px; }
.f-row label {
  display: block; font-family: var(--font-term); font-size: 19px;
  letter-spacing: 2px; color: var(--teal); margin-bottom: 6px;
}
.f-row input, .f-row textarea {
  width: 100%; background: rgba(255,176,0,.05);
  border: 1px solid var(--amber-dim); border-radius: 4px;
  color: var(--amber); font-family: var(--font-term); font-size: 21px;
  padding: 10px 12px; caret-color: var(--amber);
}
.f-row input:focus, .f-row textarea:focus {
  outline: none; border-color: var(--amber);
  box-shadow: 0 0 12px rgba(255,176,0,.25);
}
.f-row textarea { min-height: 120px; resize: vertical; }
.contact-alt { margin-top: 26px; font-family: var(--font-term); font-size: 18px; color: var(--amber-dim); letter-spacing: 1px; }
.contact-alt a { color: var(--amber-soft); }
.contact-line { max-width: 540px; color: #C9B694; margin-bottom: 24px; }

/* ================= terminal overlay ================= */
#term {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(18,14,10,.72);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 4vh 16px;
}
#term[hidden] { display: none; }
.term-box {
  width: min(760px, 100%); max-height: 70vh;
  background: var(--screen-deep);
  border: 2px solid #0C0906; border-radius: 12px;
  box-shadow: 0 0 0 6px var(--bone-low), 0 30px 60px -20px rgba(0,0,0,.8), inset 0 0 50px rgba(0,0,0,.6);
  padding: 22px 24px; overflow: auto;
  font-family: var(--font-term); font-size: 20px; color: var(--amber-soft);
}
.term-out { white-space: pre-wrap; line-height: 1.4; }
.term-out .t-dim { color: var(--amber-dim); }
.term-out .t-teal { color: var(--teal); }
.term-in { display: flex; gap: 8px; margin-top: 8px; align-items: baseline; }
.term-in .ps1 { color: var(--teal); }
.term-in input {
  flex: 1; background: none; border: 0; outline: none;
  font: inherit; color: var(--amber); caret-color: var(--amber);
}
.term-hint { position: fixed; bottom: 12px; right: 18px; font-family: var(--font-term); font-size: 16px; color: var(--plastic-edge); letter-spacing: 1px; }

/* ================= 404 ================= */
.guru {
  max-width: 720px; margin: 8vh auto; padding: 34px 30px;
  background: var(--screen-deep);
  border: 5px solid var(--stripe-red); border-radius: 4px;
  font-family: var(--font-term); font-size: 22px; color: var(--stripe-red);
  text-align: center; letter-spacing: 1px;
  animation: guru-blink 1.6s steps(1) infinite;
}
@keyframes guru-blink { 50% { border-color: transparent; } }
.guru a { color: var(--amber); }

/* ================= footer ================= */
.chassis-foot {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 8px 24px 34px;
  font-family: var(--font-term); font-size: 17px; letter-spacing: 1px;
  color: var(--brown-mid); flex-wrap: wrap;
}
.foot-left { display: flex; align-items: center; gap: 10px; }
.foot-left .brand-mark { width: 22px; height: 22px; }
.foot-term-btn { background: none; border: 0; font: inherit; color: var(--brown-mid); letter-spacing: 1px; text-decoration: underline dotted; }
.foot-term-btn:hover { color: var(--stripe-red); }

/* ================= reveal ================= */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.reveal.on, html:not(.js) .reveal { opacity: 1; transform: none; }

a:focus-visible, button:focus-visible { outline: 3px solid var(--stripe-red); outline-offset: 3px; }

/* ================= small screens ================= */
@media (max-width: 720px) {
  .chassis-bar { flex-wrap: wrap; gap: 12px; }
  .clock, .power { display: none; }
  .nav { gap: 14px; margin-left: 0; width: 100%; }
  .hero-crt .crt-content { min-height: 0; padding-top: 30px; }
  .bezel { margin-left: 12px; margin-right: 12px; }
  .term-hint { display: none; }
}

/* ================= reduced motion ================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .led, .cursor, .guru, .scanlines::after { animation: none !important; }
  .reveal, .hero-main, .tl { opacity: 1 !important; transform: none !important; transition: none !important; }
  .hero-main.on .hero-logo rect { opacity: 1; animation: none; }
  .step-bar i { width: var(--fill) !important; transition: none; }
  .cartridge, .key-btn { transition: none; }
  .trailfx { display: none; }
}
