/*
Theme Name: МЭМП — инженерная тема
Version: 0.1.0
Requires at least: 6.5
Requires PHP: 8.2
Text Domain: memp-engineering
*/
:root{--ink:#183444;--muted:#526875;--accent:#a95024;--line:#dce3e6;--soft:#f2f5f5;--paper:#fff;--radius:6px}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--paper);color:var(--ink);font-family:Arial,"Segoe UI",sans-serif;font-size:16px;line-height:1.6}a{color:inherit;text-underline-offset:4px}a:hover{color:var(--accent)}img{max-width:100%;height:auto}h1,h2,h3,p{margin:0 0 18px}h1{font-size:clamp(28px,3.1vw,42px);font-weight:600;line-height:1.2;letter-spacing:-.025em}h2{font-size:28px;line-height:1.25;font-weight:600;letter-spacing:-.02em}h3{font-size:20px;line-height:1.35;font-weight:600}.wrap{width:min(1180px,calc(100% - 64px));margin:auto}.skip{position:absolute;left:12px;top:-90px;z-index:10;padding:10px;background:white}.skip:focus{top:8px}:focus-visible{outline:3px solid #a95024;outline-offset:4px}.topline{background:var(--soft);font-size:13px;color:var(--muted);border-bottom:1px solid var(--line)}.topline .wrap{display:flex;justify-content:space-between;padding:7px 0;gap:12px}.masthead{display:flex;align-items:center;justify-content:space-between;gap:25px;padding:24px 0}.brand{display:flex;align-items:center;gap:12px;text-decoration:none;min-width:225px}.brand-logo{display:block;width:52px;height:auto;flex-shrink:0}.brand strong{font-size:25px;font-weight:600;letter-spacing:.06em;display:block;line-height:1.2}.brand small{display:block;font-size:11px;color:var(--muted);margin-top:4px}.masthead nav{display:flex;align-items:center;gap:25px;font-size:14px}.masthead nav a{text-decoration:none;white-space:nowrap}.contact-head{text-align:right;font-size:14px}.contact-head a{display:block;text-decoration:none}.contact-head a:first-child{font-weight:600;font-size:18px}.header-line{border-bottom:1px solid var(--line)}.button{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;border:1px solid var(--accent);background:var(--accent);color:#fff;padding:12px 22px;border-radius:4px;font:600 14px/1.4 Arial,sans-serif;min-height:46px;cursor:pointer}.button:hover{background:#87411f;color:#fff}.button.secondary{background:transparent;color:var(--ink);border-color:#a5b5bc}.button.secondary:hover{background:#e9eeef}.actions{display:flex;gap:12px;flex-wrap:wrap}.eyebrow{font-size:12px;letter-spacing:.1em;text-transform:uppercase;font-weight:600;color:var(--muted);margin-bottom:16px}.hero{background:linear-gradient(110deg,#f0f4f4,#f8f9f7);border-bottom:1px solid var(--line)}.hero-grid{display:grid;grid-template-columns:1.03fr 1fr;gap:60px;align-items:center;padding:58px 0}.hero p.lead{max-width:540px;color:var(--muted);font-size:17px;margin:22px 0 27px}.hero-visual{margin:0;background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:25px 30px 17px}.hero-visual img{width:100%;height:250px;object-fit:contain}.hero-visual figcaption{border-top:1px solid var(--line);padding-top:14px;margin-top:14px;display:flex;justify-content:space-between;font-size:13px;gap:10px}.hero-visual figcaption a{text-decoration:none;font-weight:600}.facts{display:grid;grid-template-columns:repeat(3,1fr);padding:21px 0;gap:35px;border-bottom:1px solid var(--line);font-size:13px}.facts strong{display:block;font-size:15px;font-weight:600}.facts span{color:var(--muted)}.section{padding:48px 0}.section-head{display:flex;justify-content:space-between;align-items:baseline;gap:20px;margin-bottom:26px}.section-head h2{margin:0}.section-head a{font-size:14px}.directions{display:grid;grid-template-columns:repeat(4,1fr);gap:18px}.direction{padding:23px;border:1px solid var(--line);border-radius:var(--radius);text-decoration:none;display:flex;flex-direction:column;min-height:196px}.direction:hover{border-color:var(--accent);background:#fcfaf8}.direction .number{font-size:12px;color:var(--accent);margin-bottom:28px}.direction h3{font-size:18px;margin-bottom:9px}.direction p{font-size:13px;color:var(--muted);margin:0}.direction .arrow{margin-top:auto;align-self:flex-end}.soft{background:var(--soft)}.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:22px}.card{background:white;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column}.card-image{height:215px;padding:25px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:center}.card-image img{height:100%;width:100%;object-fit:contain}.no-photo{font-size:15px;color:var(--muted);background:repeating-linear-gradient(0deg,#f7f9f9,#f7f9f9 19px,#edf1f2 20px)}.card-body{padding:24px;display:flex;flex-direction:column;flex:1}.card h3{font-size:19px;margin-bottom:12px}.card h3 a{text-decoration:none}.card .category{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:11px}.card p{font-size:14px;color:var(--muted)}.card .card-links{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-top:auto;font-size:13px;padding-top:16px}.card-links a:last-child{color:var(--accent)}.help-band{display:grid;grid-template-columns:1.5fr 1fr;gap:50px;align-items:center;border:1px solid var(--line);padding:34px;border-radius:var(--radius);background:#f9faf8}.help-band p{margin-bottom:0;color:var(--muted)}.help-band .actions{justify-content:flex-end}.breadcrumb{font-size:13px;color:var(--muted);padding:24px 0;display:flex;gap:9px;flex-wrap:wrap}.page-intro{max-width:790px;margin:8px 0 30px}.page-intro p{color:var(--muted)}.filters{display:flex;flex-wrap:wrap;gap:9px;margin:24px 0 28px}.filters a{font-size:13px;padding:8px 14px;border:1px solid var(--line);border-radius:4px;text-decoration:none}.filters a[aria-current]{background:var(--ink);color:white;border-color:var(--ink)}.catalog-search{display:flex;gap:10px;max-width:550px;margin:20px 0}.catalog-search input{flex:1;min-width:0}.product-head{display:grid;grid-template-columns:1fr 1fr;gap:55px;margin:12px 0 40px;align-items:start}.product-photo{border:1px solid var(--line);padding:30px;min-height:350px;display:flex;align-items:center;justify-content:center;border-radius:var(--radius)}.product-photo img{width:100%;height:310px;object-fit:contain}.product-head h1{font-size:34px}.product-head p{color:var(--muted)}.product-head .actions{margin:25px 0}.note{font-size:13px;color:var(--muted);border-left:3px solid var(--accent);padding:10px 18px;background:var(--soft);margin:24px 0}.technical{max-width:920px;overflow-wrap:anywhere}.technical p{margin-bottom:20px}.technical img{max-width:320px;float:right;margin:0 0 20px 24px}.technical:after{content:'';display:block;clear:both}.table-scroll{overflow-x:auto;margin:24px 0;max-width:100%}table{border-collapse:collapse;width:100%;font-size:14px;line-height:1.5}td,th{border:1px solid var(--line);padding:10px 14px;text-align:left}th{background:var(--soft);font-weight:600}caption{text-align:left;font-weight:600;margin-bottom:12px}.contacts-grid{display:grid;grid-template-columns:1fr 1.15fr;gap:65px;margin:25px 0 55px}.contacts-details dt{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin-top:23px}.contacts-details dd{margin:5px 0 0;font-size:19px}.request-form{border:1px solid var(--line);padding:30px;border-radius:var(--radius)}.request-form label{display:block;font-size:13px;font-weight:600;margin-bottom:15px}input,textarea{display:block;width:100%;padding:12px;border:1px solid #a5b5bc;border-radius:3px;font:16px Arial,sans-serif;color:var(--ink);margin-top:6px;background:white}textarea{resize:vertical;min-height:120px}.form-note{font-size:12px;color:var(--muted);margin-top:16px}.honeypot{position:absolute;left:-9999px}.success{background:#e9f3ed;border:1px solid #b1cbb9;padding:16px;margin-bottom:18px}.footer{background:#193544;color:#eaf0f2;padding:36px 0 55px}.footer-grid{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:35px}.footer p{font-size:13px;color:#c5d1d7}.footer a{display:block;font-size:14px;margin-bottom:7px;text-decoration:none}.footer h2{font-size:20px}.staging-note{position:fixed;bottom:0;left:0;width:100%;padding:5px 15px;text-align:center;background:#e8dcbf;color:#46371d;font-size:12px;z-index:8}.empty{padding:40px;border:1px solid var(--line)}
@media(max-width:950px){.wrap{width:calc(100% - 40px)}.masthead{flex-wrap:wrap}.masthead nav{order:3;width:100%;justify-content:center;padding-top:12px;border-top:1px solid var(--line)}.hero-grid{gap:30px;padding:38px 0}.hero-visual{padding:20px}.hero-visual img{height:215px}.directions{grid-template-columns:repeat(2,1fr)}.cards{grid-template-columns:repeat(2,1fr)}.help-band{gap:25px}.product-head{gap:30px}.product-head h1{font-size:29px}}
@media(max-width:600px){.wrap{width:calc(100% - 32px)}.topline .wrap{font-size:11px}.topline .wrap span:last-child{display:none}.masthead{gap:18px;padding:18px 0}.brand{min-width:0}.brand strong{font-size:22px}.brand small{font-size:10px}.brand-logo{width:42px}.contact-head a:first-child{font-size:14px}.contact-head a:last-child{font-size:11px}.masthead nav{gap:22px;font-size:13px;justify-content:flex-start;overflow:auto}.hero-grid{grid-template-columns:1fr;gap:25px;padding:30px 0}.hero p.lead{font-size:16px}.hero-visual img{height:190px}.facts{grid-template-columns:1fr;gap:14px;padding:20px 0}.facts strong{display:inline;margin-right:7px}.section{padding:34px 0}.section-head{align-items:flex-start}.section-head h2,h2{font-size:24px}.section-head a{font-size:12px;white-space:nowrap}.directions{gap:12px}.direction{padding:17px;min-height:200px}.direction h3{font-size:16px}.direction .number{margin-bottom:20px}.cards{grid-template-columns:1fr}.card-image{height:210px}.help-band{grid-template-columns:1fr;padding:25px;gap:23px}.help-band .actions{justify-content:flex-start}.product-head{grid-template-columns:1fr;gap:24px}.product-photo{min-height:250px;order:2}.product-photo img{height:220px}.technical img{float:none;margin:15px auto;display:block;max-width:100%}.contacts-grid{grid-template-columns:1fr;gap:30px}.request-form{padding:20px}.footer-grid{grid-template-columns:1fr;gap:20px}.footer{padding-bottom:70px}.filters{gap:7px}.filters a{padding:8px 10px;font-size:12px}.button{padding:12px 17px}.breadcrumb{padding:18px 0}.page-intro{margin-top:2px}.note{margin:18px 0}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
/* Consistent 4:3 product image slots reserve space before image loading. */
.hero-visual img{display:block;width:100%;height:auto;aspect-ratio:4/3;object-fit:contain}
.card-image{position:relative;aspect-ratio:4/3;height:auto;padding:0;flex-shrink:0;overflow:hidden}
.card-image img{position:absolute;inset:20px;width:calc(100% - 40px);height:calc(100% - 40px);object-fit:contain}
.card-image.no-photo{padding:20px}
.product-photo{position:relative;aspect-ratio:4/3;min-height:0;padding:0;overflow:hidden}
.product-photo img{position:absolute;inset:24px;width:calc(100% - 48px);height:calc(100% - 48px);object-fit:contain}
/* Product galleries: stable viewing area across all photo orientations. */
.product-head>div{min-width:0}
.product-gallery{min-width:0}
.gallery-figure{margin:0}
.gallery-figure .product-photo{display:block;background:#f5f7f7}
.gallery-figure .product-photo img{inset:12px;width:calc(100% - 24px);height:calc(100% - 24px)}
.gallery-figure figcaption{font-size:13px;line-height:1.5;color:var(--muted);padding:12px 0;min-height:5em}
.gallery-thumbnails{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.gallery-thumbnails a{display:block;min-width:0;text-decoration:none;border:1px solid var(--line);border-radius:4px;background:#fff;overflow:hidden}
.gallery-thumbnails a[aria-current]{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.gallery-thumbnails a>span:first-child{display:block;position:relative;aspect-ratio:4/3;background:#f5f7f7}
.gallery-thumbnails img{position:absolute;inset:5px;width:calc(100% - 10px);height:calc(100% - 10px);object-fit:contain}
.gallery-thumbnails a>span:last-child{display:block;padding:8px;font-size:11px;line-height:1.4;min-height:3.8em}
.product-head .gallery-note{font-size:12px;line-height:1.5;margin:14px 0 0;color:var(--muted)}
.model-line{display:flex;gap:8px;flex-wrap:wrap;margin:22px 0}
.model-line span{padding:6px 12px;background:var(--soft);border:1px solid var(--line);font-size:14px}
.product-head .selection-hint{font-size:14px;line-height:1.7;padding-top:18px;border-top:1px solid var(--line)}
.featured-cards{grid-template-columns:repeat(4,minmax(0,1fr))}
.featured-cards .card-body{padding:20px}
.featured-cards .card-links{flex-wrap:wrap}
@media(max-width:1100px){.featured-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.product-gallery{order:2}.featured-cards{grid-template-columns:1fr}.gallery-thumbnails{gap:7px}.gallery-thumbnails a>span:last-child{padding:6px;font-size:10px}.gallery-figure figcaption{min-height:6em}}

.gallery-thumbnails:has(>a:nth-child(2):last-child){grid-template-columns:repeat(2,minmax(0,1fr))}
.gallery-thumbnails a>span:last-child{overflow-wrap:anywhere}
.contact-map .section-head p{margin:10px 0 0;color:#536b76}.contact-map iframe{display:block;width:100%;height:500px;border:1px solid #dce3e6;border-radius:4px;background:#f2f5f5}.contact-map .section-head>a{flex-shrink:0}@media(max-width:640px){.contact-map iframe{height:360px}.contact-map .section-head{align-items:flex-start;flex-direction:column;gap:16px}}

/* Enlarged photos stay in a closable, keyboard-accessible modal. */
html.photo-viewer-open{overflow:hidden}
.photo-viewer{position:fixed;inset:0;margin:0;border:0;padding:72px 24px 24px;width:100%;height:100%;height:100dvh;max-width:none;max-height:none;background:transparent;color:#fff;box-sizing:border-box;overflow:auto}
.photo-viewer[open]{display:flex;align-items:center;justify-content:center}
.photo-viewer::backdrop{background:rgba(12,25,33,.94)}
.photo-viewer figure{margin:0;max-width:100%;text-align:center}
.photo-viewer img{display:block;margin:auto;width:auto;height:auto;max-width:100%;max-height:calc(100dvh - 160px);object-fit:contain}
.photo-viewer figcaption{font-size:14px;line-height:1.5;margin:14px auto 0;max-width:800px;color:#fff}
.photo-viewer-close{position:fixed;top:16px;right:24px;display:flex;align-items:center;gap:10px;min-height:44px;padding:8px 16px;border:1px solid #aab8bf;border-radius:4px;background:#fff;color:#193544;font:16px Arial,sans-serif;cursor:pointer;z-index:1}
.photo-viewer-close span{font-size:26px;line-height:1}
.photo-viewer-close:focus-visible{outline:3px solid #edae75;outline-offset:3px}
@media(max-width:600px){.photo-viewer{padding:72px 12px 20px}.photo-viewer-close{right:12px}.photo-viewer figcaption{font-size:13px}}

/* Full enterprise profile migrated from the former About page. */
.about-enterprise{margin-top:40px}
.about-section{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:44px;align-items:start;padding:36px 0;border-top:1px solid var(--line)}
.about-copy h2{font-size:26px;margin-bottom:22px}
.about-copy h3{font-size:19px;margin:24px 0 12px}
.about-copy ul{margin:0 0 22px;padding-left:22px}
.about-copy li{margin-bottom:9px}
.about-photo{margin:0;padding:12px;border:1px solid var(--line);border-radius:6px;background:var(--soft)}
.about-photo img{display:block;width:100%;height:auto;object-fit:contain}
@media(max-width:750px){.about-section{grid-template-columns:1fr;gap:22px;padding:28px 0}.about-copy h2{font-size:24px}.about-photo{max-width:580px}}

/* Engineering and manufacturing services. */
.services-lead{max-width:800px;color:var(--muted);margin-bottom:30px}
.services-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.service-card{display:flex;flex-direction:column;align-items:flex-start;border:1px solid var(--line);border-radius:6px;padding:28px;background:#fff}
.service-card h2{font-size:23px;line-height:1.3}
.service-card p,.service-card li{font-size:15px}
.service-card ul{padding-left:20px;margin:0 0 22px}
.service-card li{margin-bottom:8px}
.service-card .button{margin-top:auto}
.service-request{max-width:900px;padding:36px 0 48px}
.service-request h2{font-size:25px}
@media(max-width:1000px){.services-grid{grid-template-columns:1fr}.service-card{padding:24px}}

/* Alternate photos and text on wide screens; keep text then photo on mobile. */
@media(min-width:751px){
.about-section:nth-child(even){grid-template-columns:minmax(0,1fr) minmax(0,1.2fr)}
.about-section:nth-child(even) .about-copy{grid-column:2;grid-row:1}
.about-section:nth-child(even) .about-photo{grid-column:1;grid-row:1}
}

/* Reveal About photos once, from their alternating side. */
.about-photo{--photo-enter-x:18px;--photo-enter-y:0px}
.about-section:nth-child(even) .about-photo{--photo-enter-x:-18px}
.about-photo.photo-awaiting{opacity:0}
.about-photo.photo-revealed{animation:about-photo-appear .65s ease-out both}
@keyframes about-photo-appear{from{opacity:0;transform:translate(var(--photo-enter-x),var(--photo-enter-y))}to{opacity:1;transform:translate(0,0)}}
@media(max-width:750px){.about-section .about-photo{--photo-enter-x:0px;--photo-enter-y:16px}}
@media(prefers-reduced-motion:reduce){.about-photo.photo-awaiting,.about-photo.photo-revealed{opacity:1;transform:none;animation:none}}

/* Production video in the homepage's existing media column. */
.hero-video{padding:12px 12px 8px;min-width:0;overflow:hidden}
.hero-video video{display:block;width:100%;height:auto;aspect-ratio:16/9;object-fit:contain;background:#e8edee;border-radius:3px}
.hero-video figcaption{align-items:center;flex-wrap:wrap;margin-top:8px;padding-top:8px}
.hero-video-toggle{min-height:44px;padding:8px 12px;border:1px solid #a5b5bc;border-radius:4px;background:#fff;color:var(--ink);font:14px Arial,sans-serif;cursor:pointer}
.hero-video-toggle:hover{background:var(--soft)}
.hero-video-error{font-size:13px;color:var(--muted);margin:10px 0}

/* Full-width, lightened moving background confined to the homepage hero. */
.hero-background{position:relative;isolation:isolate;overflow:hidden;background:#f2f5f5}
.hero-background .hero-grid{position:relative;z-index:1;display:block;min-height:490px;padding:64px 0 82px}
.hero-background .hero-copy{max-width:580px}
.hero-background .hero-video{position:absolute;inset:0;margin:0;padding:0;border:0;border-radius:0;overflow:hidden;pointer-events:none}
.hero-background .hero-video video{position:absolute;inset:0;width:100%;height:100%;aspect-ratio:auto;object-fit:cover;object-position:center;border-radius:0;filter:brightness(1.04) saturate(.65)}
.hero-background .hero-video::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(248,250,250,.92) 0%,rgba(248,250,250,.85) 42%,rgba(248,250,250,.61) 100%)}
.hero-background .hero-video figcaption{position:absolute;right:32px;bottom:18px;z-index:2;margin:0;padding:0;border:0;pointer-events:auto}
.hero-background .hero-video-toggle{background:rgba(255,255,255,.8);font-size:12px;min-height:44px}
.hero-background .hero-video-error{position:absolute;right:32px;bottom:18px;z-index:2;max-width:260px;background:#f8fafa;padding:8px 12px}
.hero-background .button.secondary{background:rgba(255,255,255,.78)}
@media(max-width:600px){
 .hero-background .hero-grid{min-height:0;padding:36px 0 78px}
 .hero-background .hero-video::after{background:rgba(248,250,250,.86)}
 .hero-background .hero-video figcaption,.hero-background .hero-video-error{right:16px;bottom:16px}
}

/* Product clip: preserve the full portrait frame, play only on request. */
.product-video{margin:0 0 40px}
.product-video video{display:block;width:100%;max-width:360px;height:auto;aspect-ratio:9/16;object-fit:contain;background:#17232a;border:1px solid var(--line);border-radius:var(--radius)}

/* Video shares the photo stage; no media download until its thumbnail is selected. */
.gallery-figure .product-photo[hidden]{display:none}
.gallery-video-frame video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#17232a}
.gallery-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:grid;place-items:center;width:40px;height:40px;border-radius:50%;background:rgba(24,52,68,.9);color:#fff;font-size:18px;padding-left:3px}
