/*
Theme Name: Металлокод
Theme URI: https://metallokod.ru
Author: Металлокод
Description: Собственная тема сайта металлоцеха.
Version: 0.2.2
Requires at least: 6.4
Requires PHP: 8.1
Text Domain: metallokod
*/

:root {
    --ink: #171d20;
    --paper: #f2f1ed;
    --panel: #e5e6e2;
    --light: #fafafa;
    --accent: #ff7637;
    --muted: #4e554c;
    --gutter: clamp(20px, 5vw, 80px);
    --section: clamp(64px, 10vw, 150px);
    --display: clamp(2.15rem, 5.3vw, 5.5rem);
    --head: clamp(1.95rem, 4vw, 3.75rem);
    --ease-out: cubic-bezier(.23, 1, .32, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 Inter, system-ui, sans-serif; }
::selection { color: var(--ink); background: var(--accent); }
a { color: inherit; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.07; letter-spacing: -.035em; text-wrap: balance; }
h1 { font-size: var(--display); }
h2 { font-size: var(--head); }
h3 { font-size: clamp(1.25rem, 2.3vw, 1.75rem); }
p { text-wrap: pretty; }
.wrap { width: min(100% - var(--gutter) * 2, 1440px); margin-inline: auto; }
.section { margin-block: var(--section); }
.skip-link { position: absolute; z-index: 3; inset: .5rem auto auto .5rem; transform: translateY(-150%); padding: .6rem 1rem; background: var(--light); }
.skip-link:focus { transform: none; }

.site-header { background: var(--ink); color: var(--light); }
.header-layout, .footer-layout { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem 2rem; }
.header-layout { padding-block: 1.1rem; }
.brand { font-size: clamp(1.2rem, 2.5vw, 1.65rem); letter-spacing: -.04em; font-weight: 850; text-decoration: none; }
.brand img { width: clamp(132px, 15vw, 184px); filter: brightness(0) invert(1); }
.site-nav, .site-nav ul { display: flex; gap: .25rem 1.3rem; align-items: center; flex-wrap: wrap; }
.site-nav ul { padding: 0; margin: 0; list-style: none; }
.site-nav a { display: inline-flex; min-height: 44px; align-items: center; }

.hero { background: var(--ink); color: var(--light); }
.hero__content { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: clamp(1.75rem, 5vw, 5rem); padding-block: clamp(3rem, 6vw, 5.5rem); }
.hero h1 { max-width: 18ch; }
.hero h1 span { color: var(--accent); }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .85rem 1.3rem; margin-top: 1.5rem; }
.lede { flex-basis: 100%; max-width: 35ch; font-size: clamp(1.125rem, 1.7vw, 1.25rem); }
.technical-drawing { margin: 0; min-width: 0; padding: 1rem; border: 1px solid #ffffff24; background-color: #20272b; background-image: linear-gradient(90deg, #ffffff0c 1px, transparent 1px), linear-gradient(#ffffff0c 1px, transparent 1px); background-size: 24px 24px; }
.technical-drawing svg { display: block; width: 100%; max-height: 480px; }
.technical-drawing figcaption { color: #b7c1c6; font-size: .85rem; text-align: right; }
.drawing-code { display: block; color: #c4cdd1; font-size: .82rem; font-weight: 650; letter-spacing: .06em; }
.drawing-structure { stroke: #a7b5bd; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.drawing-structure .drawing-highlight { stroke: #b56847; stroke-width: 1.75; }
.drawing-trace { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button { appearance: none; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: .65rem 1rem; color: var(--light); background: var(--ink); border: 0; border-radius: 0; text-align: center; text-decoration: none; font: inherit; font-weight: 720; cursor: pointer; transition: background-color .16s ease, transform .14s var(--ease-out); }
.button--accent { color: var(--ink); background: var(--accent); }
.button--accent:hover { background: #ff9a6d; }
.button:active { transform: scale(.98); }
.button:focus-visible { outline-color: var(--ink); outline-offset: -5px; }
.hero .text-link { padding-block: .55rem; }

.work-gallery { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 4rem); margin-top: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.work { grid-column: span 5; min-width: 0; }
.work:nth-child(odd) { grid-column: span 7; }
.work:nth-child(even) { margin-top: clamp(1rem, 5vw, 3.5rem); }
.work__link { position: relative; display: block; text-decoration: none; background: var(--ink); color: var(--light); }
.work__link:focus-visible { outline-color: var(--accent); outline-offset: -4px; z-index: 1; }
.work__image { width: 100%; height: auto; }
.work__caption { position: absolute; inset: auto 0 0; display: grid; gap: .35rem; padding: 2rem clamp(1rem, 2vw, 1.65rem) 1rem; background: linear-gradient(transparent, #111518f2 32%); opacity: 0; transition: opacity .16s ease; }
.work__title { font-size: clamp(1.12rem, 2vw, 1.6rem); font-weight: 750; line-height: 1.15; }
.work__description { max-width: 61ch; font-size: .94rem; line-height: 1.4; }
.work__link:focus-visible .work__caption { opacity: 1; transition: none; }
@media (hover: hover) and (pointer: fine) {
    .work__link:hover .work__caption { opacity: 1; }
}
.work__link--text .work__caption { position: static; opacity: 1; padding: 1.35rem; background: none; }
.service-list p { max-width: 52ch; margin-top: .55rem; }
.archive-link { display: inline-flex; min-height: 44px; align-items: center; margin-top: 2rem; font-weight: 720; }
.works-page { --gallery-gap: clamp(.55rem, 1.3vw, 1.1rem); padding-block: clamp(2.5rem, 5vw, 5rem); }
.works-page > h1 { margin-bottom: clamp(1.25rem, 3vw, 2.5rem); }
.archive-lead { display: grid; grid-template-columns: minmax(0, 1.84fr) minmax(0, 1fr); align-items: start; gap: var(--gallery-gap); margin-bottom: var(--gallery-gap); }
.archive-lead--portrait { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.archive-gallery { columns: 3; column-gap: var(--gallery-gap); }
.archive-gallery .archive-work { display: inline-block; vertical-align: top; width: 100%; break-inside: avoid; margin-bottom: var(--gallery-gap); }
.service-section { display: grid; gap: 2rem; grid-template-columns: 2fr 3fr; }
.section-copy p { margin-top: .9rem; max-width: 46ch; }
.service-list { padding: 0; margin: 0; list-style: none; display: grid; gap: 2rem; }
.production { display: grid; grid-template-columns: 2fr 3fr; gap: 2rem; align-items: start; }
.production--no-image { grid-template-columns: 1fr; }
.production__image { width: 100%; max-height: 500px; object-fit: cover; object-position: center 48%; }

.request-section { background: var(--panel); padding-block: var(--section); }
.request-layout { display: grid; grid-template-columns: 2fr 3fr; gap: clamp(2rem, 6vw, 6rem); }
.request-layout > div > p { margin-top: 1rem; max-width: 34ch; }
.request-choices { display: grid; gap: 1rem; }
.request-choices details { background: var(--light); padding: clamp(1rem, 3vw, 2rem); scroll-margin-top: 1rem; }
.request-choices summary { cursor: pointer; font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 720; }
.request-choices form { margin-top: 1.25rem; display: grid; gap: 1rem; }
.request-choices form label { display: block; font-weight: 600; }
.request-choices input, .request-choices textarea { font: inherit; color: var(--ink); background: var(--light); width: 100%; min-width: 0; min-height: 44px; padding: .5rem .65rem; border: 1px solid var(--muted); border-radius: 0; margin-top: .25rem; }
.request-choices textarea { resize: vertical; }
.request-choices button { justify-self: start; }
.request-status { font-weight: 700; }

.site-footer { color: var(--light); background: var(--ink); padding-block: clamp(3rem, 8vw, 7rem); }
.footer-brand { font-size: clamp(2.4rem, 8.4vw, 7.5rem); line-height: 1; letter-spacing: -.04em; font-weight: 800; text-decoration: none; }
.footer-brand img { width: clamp(220px, 48vw, 624px); filter: brightness(0) invert(1); }
.footer-layout p { margin-bottom: .4rem; overflow-wrap: anywhere; }
.footer-contacts { font-style: normal; }
.footer-legal { color: #b7c1c6; font-size: .9rem; padding-top: .8rem; }
.site-main article > :is(h1, img, p) { margin-bottom: 1rem; }

@media (max-width: 760px) {
    .hero__content, .service-section, .request-layout, .production { grid-template-columns: 1fr; gap: 1.4rem; }
    .hero__actions { gap: .65rem 1.1rem; }
    .work-gallery { display: grid; grid-template-columns: minmax(0, 1fr); }
    .work:nth-child(n) { grid-column: auto; margin: 0; }
    .work:nth-child(even) { width: 88%; justify-self: end; }
    .footer-layout { flex-direction: column; }
    .archive-gallery { columns: 2; }
    .archive-lead { grid-template-columns: 1.6fr 1fr; }
    .archive-lead--portrait { grid-template-columns: 1fr 1.4fr; }
}

@media (max-width: 470px) {
    .header-layout { display: grid; padding-block: .65rem; }
    .site-nav, .site-nav ul { gap: .1rem .75rem; }
    .site-nav a { font-size: .9rem; }
    .lede { font-size: 1.125rem; }
    .archive-gallery { columns: 1; }
    .archive-lead, .archive-lead--portrait { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .button { transition: none; }
    .button:active { transform: none; }
    .work__caption { transition: none; }
}

@media (prefers-reduced-motion: no-preference) {
    .drawing-trace { animation: mk-trace 760ms var(--ease-out) 80ms both; }
    .mk-enter { animation: mk-enter 430ms cubic-bezier(.22, 1, .36, 1); }
}

@keyframes mk-trace {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0); }
}

@keyframes mk-enter {
    from { opacity: .78; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
