/* IRONWAKE MENU POLISH (Jesse 11-14: "a standard subtle polish to the menus please, separate from the corruption").
   Always on, menus only (#home, #overlay, the header keys). The rustic look, palette, fonts, copy, layouts and button order
   stay; this file only finishes them. Never the flight HUD, the Shipyard canvas, menu-fx layers or the hosts' stacking. */
:root{--mp-ease:cubic-bezier(.2,.7,.2,1);--mp-ring:var(--gold)}

/* ---- 1. Home card: the seven small keys end evenly (3 + 4 on wide screens, 2 + 3 + 2 on phones), same order ---- */
.home .home-links{grid-template-columns:repeat(12,minmax(0,1fr))}
.home .home-links>:is(#campaign,#replayOpening,#hangar){grid-column:span 4}
.home .home-links>:is(#challenges,#lore,#help,#reticleOpen){grid-column:span 3}
@media(max-width:600px){
 .home .home-links{grid-template-columns:repeat(6,minmax(0,1fr))}
 .home .home-links>:is(#campaign,#replayOpening,#help,#reticleOpen){grid-column:span 3}
 .home .home-links>:is(#hangar,#challenges,#lore){grid-column:span 2}
}
@media(max-height:450px) and (orientation:landscape){
 .home .home-links{grid-template-columns:repeat(12,minmax(0,1fr))}
 .home .home-links>:is(#campaign,#replayOpening,#hangar){grid-column:span 4}
 .home .home-links>:is(#challenges,#lore,#help,#reticleOpen){grid-column:span 3}
}
/* the card fits a 1280x800 screen: a little less air between the blocks, nothing removed */
@media(min-width:601px) and (min-height:451px){
 .home #difficultyNote{margin:8px 0 10px;min-height:0}
 .home .home-links{margin-top:10px}
}
/* no lone last word on a line in menu copy */
:is(#overlay,.helm-exit) p,.home .intro p{text-wrap:pretty}

/* ---- 2. One button system: primary, secondary, small. Every label centred; same weight per kind on every menu ---- */
:is(#overlay,.helm-exit) :is(#dialogActions,.helm-copy-dialogActions)>button:not(.aeSetLink),#home .intro>button:not(.aeSetLink){font-family:system-ui,-apple-system,sans-serif;font-size:14px;font-weight:650;line-height:1.25;letter-spacing:.01em;text-align:center;justify-content:center}
:is(#overlay,.helm-exit) :is(#dialogActions,.helm-copy-dialogActions)>button.primary:not(.aeSetLink),#home .intro>button.primary:not(.aeSetLink){font-weight:800}
:is(#overlay,.helm-exit) :is(#dialogActions,.helm-copy-dialogActions)>button:not(.aeSetLink){font-size:13px}
.home .intro>:is(#start,#continue).primary{position:relative;display:flex;align-items:center;justify-content:center;padding-left:40px;padding-right:40px}
.home .intro>#start.primary>span{position:absolute;right:17px;top:50%;transform:translateY(-50%)}
.home .intro>#continue.primary::after{position:absolute;right:17px;top:50%;transform:translateY(-50%)}
:is(.home .home-links,.home .difficulty,#overlay .comms-controls,.helm-exit .comms-controls,#storyScene .scene-footer)>button:not(.aeSetLink),#overlay .slot-del{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;font-weight:700;line-height:1.3;letter-spacing:.02em;text-align:center}
@media(max-width:600px){:is(#overlay,.helm-exit) :is(#dialogActions,.helm-copy-dialogActions)>button:not(.aeSetLink){font-size:12px;letter-spacing:0;padding-left:5px;padding-right:5px}}

/* ---- 7. Keys answer the hand: edge brightens, face lifts 1 px; press sinks 1 px; 120 ms; disabled reads as off ---- */
:is(#overlay,.home) button:not(.aeSetLink),header>.top-actions button:not(.aeSetLink),header #wordmark{transition:background-color 120ms,border-color 120ms,box-shadow 120ms,transform 120ms,color 120ms;-webkit-tap-highlight-color:transparent}
:is(#overlay,.home) button:not(.aeSetLink):not(:disabled):hover,header>.top-actions button:not(.aeSetLink):not(:disabled):hover{transform:translateY(-1px);border-left-color:color-mix(in srgb,var(--helm-accent,var(--gold)) 55%,#fff8ec)}
:is(#overlay,.home) button:not(.aeSetLink):not(:disabled):active,header>.top-actions button:not(.aeSetLink):not(:disabled):active{transform:translateY(1px);transition-duration:40ms}
:is(#overlay,.helm-exit) button:not(.aeSetLink):disabled{cursor:not-allowed;background:#0b1720;border-color:#2c3e47;border-left-color:#3e5157;box-shadow:none;transform:none}
:is(#overlay,.helm-exit) button:not(.aeSetLink):disabled::before{display:none}

/* ---- 4. One focus style everywhere: a thin gold ring, 2 px, with a 2 px gap ---- */
:is(#overlay,.home,header) :is(button,input,select):not(.aeSetLink):focus-visible,body.pad-nav :is(#overlay,.home,header) :is(button,input,select):not(.aeSetLink):focus,
:is(#overlay,.helm-exit) button:is(.card,.builder-slot):not(.aeSetLink):focus-visible,body.pad-nav #overlay button:is(.card,.builder-slot):not(.aeSetLink):focus,
#overlay[data-kind=reticle] :is(button,input):focus-visible,#overlay .slot-del:focus-visible{outline:2px solid var(--mp-ring);outline-offset:2px}
:is(#overlay,.home,header) button:not(.aeSetLink):focus-visible,body.pad-nav :is(#overlay,.home,header) button:not(.aeSetLink):focus{box-shadow:inset 0 1px 0 #ffffff17,inset 0 -2px 0 #0000005c,0 2px 0 #02070c}
:is(#overlay,.home) button.primary:not(.aeSetLink):focus-visible,body.pad-nav :is(#overlay,.home) button.primary:not(.aeSetLink):focus{box-shadow:inset 0 1px 0 #ffffff80,inset 0 -3px 0 #0000003d,0 2px 0 #02070c}
:is(#overlay,.helm-exit) button:is(.card,.builder-slot):not(.aeSetLink):focus-visible,body.pad-nav #overlay button:is(.card,.builder-slot):not(.aeSetLink):focus{outline-offset:-4px;box-shadow:inset 0 1px 0 #ffffff17,inset 0 -2px 0 #0000005c}
/* room for the ring inside scroll areas, with the content left exactly where it was */
:is(#overlay,.helm-exit):not([data-kind=builder]) :is(#dialogBody,.helm-copy-dialogBody){padding:4px 9px 5px 4px;margin:-4px -4px 0 -4px}

/* ---- 5. Worn-metal finish: top hairline highlight, darker bottom hairline, faint grain, rivets where rail segments meet ---- */
:is(#overlay,.helm-exit) .panel,.home .intro{box-shadow:inset 0 1px 0 #ffffff30,inset 1px 0 0 #ffffff12,inset 0 -1px 0 #000d,inset -1px 0 0 #0007,inset 0 0 0 5px #07111c99,inset 0 0 0 6px #2a4350,inset 0 7px 0 -6px #ffffff10,inset 0 22px 30px -26px #d5f3ec3d,inset 0 -40px 44px -36px #000d,0 1px 0 #ffffff0d,0 3px 0 #02060b,0 34px 64px -22px #000e,0 70px 130px -50px #000b}
:is(#overlay,.helm-exit) .panel{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .86 0 0 0 0 .93 0 0 0 0 .9 .16 0 0 0 -.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),radial-gradient(130% 70% at 0% 0%,#a9ded512,transparent 58%),linear-gradient(162deg,#0f202d 0%,#0a1722 46%,#060e17 100%)}
.home .intro{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .86 0 0 0 0 .93 0 0 0 0 .9 .16 0 0 0 -.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),radial-gradient(130% 70% at 0% 0%,#a9ded512,transparent 58%),linear-gradient(162deg,#0f202deb 0%,#0a1722ed 46%,#060e17f0 100%)}
:is(#overlay,.helm-exit) .panel:before,.home .intro:before{background:
 radial-gradient(circle at 50% 24.75%,#e4ece8 0 .9px,#94a5a8 1.6px 2.6px,#3d4d52 3px,#02070cc0 3.4px,transparent 4px),
 radial-gradient(circle at 50% 49.75%,#e4ece8 0 .9px,#94a5a8 1.6px 2.6px,#3d4d52 3px,#02070cc0 3.4px,transparent 4px),
 radial-gradient(circle at 50% 82.75%,#e4ece8 0 .9px,#94a5a8 1.6px 2.6px,#3d4d52 3px,#02070cc0 3.4px,transparent 4px),
 linear-gradient(to bottom,var(--helm-accent) 0 24%,transparent 24% 25.5%,#4f777c 25.5% 49%,transparent 49% 50.5%,var(--helm-accent) 50.5% 82%,transparent 82% 83.5%,#334a58 83.5% 100%);
 box-shadow:inset 1px 0 0 #ffffff1c,inset -1px 0 0 #0006}

/* ---- 6. Opening: the panel fades in and rises 6 px (160 ms), its keys follow 30 ms apart; closing is quicker (100 ms) ---- */
@keyframes mp-rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@keyframes mp-sink{from{opacity:1;transform:none}to{opacity:0;transform:translateY(3px)}}
:is(#overlay,.helm-exit) .panel.helm-enter{animation:mp-rise 160ms var(--mp-ease) both}
:is(#overlay,.helm-exit) .panel.helm-leave{animation:mp-sink 100ms ease-in both}
#overlay.life-stagger #dialogTitle,#overlay.life-stagger #eyebrow,.home.life-stagger .intro>:is(.eyebrow,h1){animation:mp-rise 160ms 40ms var(--mp-ease) both}
#overlay.life-stagger .life-in,.home.life-stagger .life-in{animation:mp-rise 160ms calc(80ms + var(--life-i,0)*30ms) var(--mp-ease) both}
.home.life-stagger .intro{animation:mp-rise 160ms var(--mp-ease) both}

/* ---- 3. Pause key list: same words, a two-column key / action list that scans (menu-polish.js builds the rows) ---- */
:is(#overlay,.helm-exit) .controls-strip.mp-keys{display:grid;grid-template-columns:fit-content(26%) minmax(0,1fr) 6px fit-content(26%) minmax(0,1fr);column-gap:10px;row-gap:3px;padding:10px 14px;font:12px/1.38 system-ui,-apple-system,sans-serif}
.mp-keys>.mp-row{display:grid;grid-template-columns:subgrid;grid-column:1 / 3;align-items:baseline;min-width:0}
.mp-keys>.mp-row.mp-r{grid-column:4 / 6}
.mp-keys .mp-key{justify-self:start;font:700 11px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;color:#f2dcc0;background:#0b1a24;border:1px solid #3f5a66;border-bottom-color:#26363f;border-radius:4px;padding:0 6px;line-height:1.38;white-space:nowrap;box-shadow:inset 0 1px 0 #ffffff12}
.mp-keys .mp-keyset{display:flex;flex-wrap:wrap;gap:3px;min-width:0;align-self:start}
.mp-keys .mp-or{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.mp-keys>.mp-row{position:relative}
.mp-keys .mp-act{color:#c2d2d5;min-width:0;overflow-wrap:anywhere}
.mp-keys>.mp-row.mp-solo .mp-keyset{grid-column:1 / -1}.mp-keys>.mp-row.mp-solo .mp-key{white-space:normal}
.mp-keys .mp-sep{display:none}
@media(max-width:600px){
 :is(#overlay,.helm-exit) .controls-strip.mp-keys{grid-template-columns:fit-content(50%) minmax(0,1fr)}
 .mp-keys>.mp-row,.mp-keys>.mp-row.mp-r{grid-column:1 / 3;grid-row:auto!important;margin-left:0}
}

/* ---- scroll areas: thin themed bar, soft fade where there is more to scroll (menu-polish.js sets the edges) ---- */
#overlay :is(#dialogBody,.slot-list)::-webkit-scrollbar{width:6px;height:6px}
#overlay :is(#dialogBody,.slot-list)::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--helm-accent,var(--gold)) 70%,#07111c);border-radius:6px}
#overlay :is(#dialogBody,.slot-list)::-webkit-scrollbar-track{background:#0f1f29;border-radius:6px}
#overlay:not([data-kind=builder]) #dialogBody.mp-more-top{-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 22px);mask-image:linear-gradient(to bottom,transparent 0,#000 22px)}
#overlay:not([data-kind=builder]) #dialogBody.mp-more-bottom{-webkit-mask-image:linear-gradient(to top,transparent 0,#000 22px);mask-image:linear-gradient(to top,transparent 0,#000 22px)}
#overlay:not([data-kind=builder]) #dialogBody.mp-more-top.mp-more-bottom{-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 22px,#000 calc(100% - 22px),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 22px,#000 calc(100% - 22px),transparent 100%)}

/* ---- lists: a clear hover row and a clear selected row ---- */
#overlay #dialogBody button.card:not(:disabled):hover{border-color:color-mix(in srgb,var(--helm-accent,var(--gold)) 70%,#526b77);background:#1d3542}
#overlay .slot-card.current .slot-main{background:linear-gradient(90deg,#2a3a3c,#14252f)}

/* ---- slots: the saved ship sits in a framed well like the empty slot's; Delete keeps its own warning tone ---- */
#overlay .slot-card .hull-thumb:not(.slot-plus){border:1px solid #3f5a66;border-radius:14px 4px 4px 14px;background:#07111c;box-shadow:inset 0 1px 0 #ffffff0d}
#overlay .slot-card .slot-del:not(:disabled){border-color:#7c5550;border-left-color:#b97b6d;color:#f1c6bb}
#overlay .slot-card .slot-del:not(:disabled):hover{border-left-color:#f1c6bb;background:#3a2024}

/* ---- a toast raised while a menu is open sits above the panel, never over its keys ---- */
#overlay:not([hidden])~#notice{top:14px;bottom:auto}

/* ---- reduced motion: nothing moves, everything is instant ---- */
@media(prefers-reduced-motion:reduce){
 :is(#overlay,.home) button:not(.aeSetLink),header button{transition:none!important}
 :is(#overlay,.home) button:not(.aeSetLink):is(:hover,:active),header button:is(:hover,:active){transform:none!important}
 :is(#overlay,.helm-exit) .panel,.home .intro,#overlay .life-in,.home .life-in,#overlay :is(#dialogTitle,#eyebrow){animation:none!important}
}
body[data-helm-motion=reduced] :is(#overlay,.home) button:not(.aeSetLink),body[data-helm-motion=reduced] header button{transition:none!important}
body[data-helm-motion=reduced] :is(#overlay,.home) button:not(.aeSetLink):is(:hover,:active){transform:none!important}
body[data-helm-motion=reduced] :is(#overlay,.helm-exit) .panel,body[data-helm-motion=reduced] .home .intro,body[data-helm-motion=reduced] :is(#overlay,.home) .life-in{animation:none!important}
