/*
 * SmartWatt design-token utilities — ported from src/lib/designTokens.ts (TOKENS).
 * Plain-CSS equivalents of the Tailwind utility strings, for use in template
 * parts, block patterns, and custom block render.php. Colors mirror theme.json.
 */

:root {
	--sw-primary: #0369a1;       /* sky-700 — AA on white (5.9:1) for button text + small labels */
	--sw-primary-hover: #075985; /* sky-800 */
	--sw-accent: #0ea5e9;
	--sw-accent-text: #0369a1;
	--sw-accent-tint: #f0f9ff;
	--sw-contrast: #0f172a;
	--sw-body: #334155;
	--sw-muted: #64748b;
	--sw-border: #e2e8f0;
	--sw-surface-alt: #f8fafc;
	--sw-navy: #0f172a;
}

/* Global box-sizing reset. The React/Tailwind original applied this via its
   preflight; without it `.sw-container`/`.sw-narrow` (width:100% + padding)
   overflow their parent by the padding amount (64px), which `overflow-x: clip`
   then hides — clipping right-edge content such as the CTA-band phone button. */
*, *::before, *::after { box-sizing: border-box; }

/* Prevent the classic full-width (100vw) horizontal-scroll overflow on mobile.
   `clip` (not hidden) avoids breaking the sticky header. */
html { overflow-x: clip; scroll-padding-top: var(--sw-hd-h, 90px); }
body { max-width: 100%; overflow-x: clip; }

/* ── Layout ─────────────────────────────────────────────── */
.sw-container { margin-inline: auto; max-width: 80rem; padding-inline: 1rem; width: 100%; }
.sw-narrow { margin-inline: auto; max-width: 64rem; padding-inline: 1rem; width: 100%; }
@media (min-width: 640px) { .sw-container, .sw-narrow { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .sw-container, .sw-narrow { padding-inline: 2rem; } }
.sw-section { padding-block: clamp(4rem, 2rem + 6vw, 7rem); }
.sw-section--alt { background: var(--sw-surface-alt); }
.sw-section--navy { background: var(--sw-navy); color: #fff; }

/* ── Kicker (mono, uppercase) ───────────────────────────── */
.sw-kicker { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .2em; color: var(--sw-accent-text); }

/* ── Buttons ────────────────────────────────────────────── */
.sw-btn-primary, .sw-btn-primary-lg, .sw-btn-secondary, .sw-btn-ghost, .sw-btn-on-navy {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
	border-radius: .5rem; font-weight: 700; text-decoration: none; line-height: 1;
	transition: background-color .15s, border-color .15s, color .15s; cursor: pointer;
}
.sw-btn-primary { background: var(--sw-primary); color: #fff; padding: .75rem 1.5rem; font-size: .875rem; }
.sw-btn-primary:hover { background: var(--sw-primary-hover); color: #fff; }
.sw-btn-primary-lg { background: var(--sw-primary); color: #fff; padding: 1rem 2rem; font-size: 1rem; }
.sw-btn-primary-lg:hover { background: var(--sw-primary-hover); color: #fff; }
.sw-btn-secondary { border: 2px solid var(--sw-border); background: #fff; color: var(--sw-contrast); padding: .75rem 1.5rem; font-size: .875rem; }
.sw-btn-secondary:hover { border-color: #cbd5e1; background: var(--sw-surface-alt); }
.sw-btn-ghost { color: var(--sw-body); padding: .5rem 1rem; font-size: .875rem; font-weight: 600; }
.sw-btn-ghost:hover { background: #f1f5f9; color: var(--sw-contrast); }
.sw-btn-on-navy { border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; padding: .75rem 1.5rem; font-size: .875rem; backdrop-filter: blur(4px); }
.sw-btn-on-navy:hover { background: rgba(255,255,255,.2); color: #fff; }
.sw-btn-primary:focus-visible, .sw-btn-primary-lg:focus-visible, .sw-btn-secondary:focus-visible, .sw-btn-ghost:focus-visible, .sw-btn-on-navy:focus-visible { outline: 2px solid var(--sw-accent); outline-offset: 2px; }

/* ── Cards ──────────────────────────────────────────────── */
.sw-card { background: #fff; border: 1px solid var(--sw-border); border-radius: 1rem; transition: border-color .3s, box-shadow .3s; }
.sw-card:hover { border-color: #cbd5e1; box-shadow: 0 10px 25px -5px rgba(15,23,42,.1); }

/* ── Product archive header (shop + category pages) ── */
.sw-pa-head { border-bottom: 1px solid var(--sw-border); background: linear-gradient(to bottom, #fff, var(--sw-surface-alt)); padding-block: clamp(2.5rem, 1.5rem + 4vw, 4rem); }
.sw-pa-title { margin: .5rem 0 0; font-family: 'Golos Text', system-ui, sans-serif; font-weight: 800; color: var(--sw-contrast); font-size: clamp(1.875rem, 1.4rem + 2vw, 3rem); line-height: 1.1; }
.sw-pa-desc { margin: 1rem 0 0; max-width: 42rem; color: var(--sw-body); line-height: 1.6; }

/* ── Product card (smartwatt_product_card — catalog, archives, related) ── */
.sw-pc-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 640px) { .sw-pc-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .sw-pc-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .sw-pc-grid { grid-template-columns: repeat(4, 1fr); } }

.sw-pc { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid var(--sw-border); border-radius: 1rem; transition: border-color .3s, box-shadow .3s; }
.sw-pc:hover { border-color: #cbd5e1; box-shadow: 0 14px 30px -12px rgba(15,23,42,.18); }
.sw-pc__media { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; background: #f8fafc; }
.sw-pc__media img { width: 100%; height: 100%; object-fit: contain; padding: 1rem; transition: transform .5s; }
.sw-pc:hover .sw-pc__media img { transform: scale(1.04); }

.sw-pc__body { display: flex; flex: 1; flex-direction: column; padding: 1.25rem; }
.sw-pc__cat { margin: 0; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--sw-primary); }
.sw-pc__name { margin: .35rem 0 0; font-size: 1.0625rem; line-height: 1.3; }
.sw-pc__name a { font-family: 'Golos Text', system-ui, sans-serif; font-weight: 700; color: var(--sw-contrast); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sw-pc__name a:hover { color: var(--sw-primary); }

.sw-pc__specs { margin: .85rem 0 0; padding: .85rem 0 0; border-top: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: .4rem; }
.sw-pc__specs div { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; font-size: .78rem; }
.sw-pc__specs dt { margin: 0; color: var(--sw-muted); flex: none; }
.sw-pc__specs dd { margin: 0; font-weight: 600; color: #1e293b; text-align: right; }

.sw-pc__foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid #f1f5f9; }
.sw-pc__price { display: flex; flex-direction: column; }
.sw-pc__from { font-size: .72rem; color: var(--sw-muted); }
.sw-pc__amount { font-family: 'Golos Text', system-ui, sans-serif; font-weight: 800; font-size: 1.25rem; color: var(--sw-contrast); }

.sw-pc__actions { margin-top: .75rem; display: flex; gap: .4rem; }
.sw-pc__add { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; cursor: pointer; background: var(--sw-primary); color: #fff; border-radius: .5rem; padding: .65rem .75rem; font-family: 'Golos Text', system-ui, sans-serif; font-size: .8rem; font-weight: 700; text-decoration: none; transition: background .2s; }
.sw-pc__add:hover { background: var(--sw-primary-hover); color: #fff; }
.sw-pc__add svg { width: .9rem; height: .9rem; flex: none; }
.sw-pc__add.is-busy { opacity: .65; pointer-events: none; }
.sw-pc__more { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--sw-border); background: #fff; color: #475569; border-radius: .5rem; padding: .65rem .8rem; text-decoration: none; transition: background .2s; }
.sw-pc__more:hover { background: #f8fafc; }
.sw-pc__more svg { width: .95rem; height: .95rem; flex: none; }

/* ── Badge ──────────────────────────────────────────────── */
.sw-badge { display: inline-flex; align-items: center; gap: .375rem; border-radius: 9999px; background: var(--sw-accent-tint); padding: .25rem .75rem; font-size: .75rem; font-weight: 600; color: var(--sw-accent-text); box-shadow: inset 0 0 0 1px #bae6fd; }

/* ── Reveal-on-scroll (replaces Framer Motion) ──────────── */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
[data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; } }

/* ── Site header ────────────────────────────────────────── */
.sw-site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--sw-border); }
.sw-utility-strip { border-bottom: 1px solid #f1f5f9; }
.sw-utility-strip p { margin: 0; padding-block: .55rem; color: #475569; }
.sw-utility-strip a { color: inherit; text-decoration: none; }
.sw-utility-strip a:hover { color: var(--sw-primary); }
.sw-util-right a { margin-left: 1.25rem; }
@media (max-width: 1023px) { .sw-utility-strip { display: none; } }
.sw-mainbar { min-height: 5rem; align-items: center; padding-block: .5rem; }
.sw-logo { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; }
.sw-logo__img { height: 2.25rem; width: auto; display: block; }
@media (max-width: 480px) { .sw-logo__img { height: 1.9rem; } }
.sw-logo__icon { width: 1.75rem; height: 1.75rem; color: var(--sw-accent); flex: none; }
.sw-logo__text { font-family: 'Golos Text', system-ui, sans-serif; font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em; color: var(--sw-contrast); }
.sw-logo__accent { color: var(--sw-accent); }
.sw-nav { font-size: .875rem; font-weight: 600; gap: .25rem; }
.sw-nav a, .sw-nav .wp-block-navigation-item__content { color: var(--sw-body); text-decoration: none; }
.sw-nav a:hover, .sw-nav .wp-block-navigation-item__content:hover { color: var(--sw-primary); }
.sw-header-cta { margin: 0; }

/* ── Site footer ────────────────────────────────────────── */
.sw-site-footer { padding-block: 4rem 2.5rem; }
.sw-site-footer .sw-footer-brand p { margin-top: .75rem; max-width: 28rem; color: #94a3b8; font-size: .875rem; line-height: 1.6; }
.sw-site-footer h2 { color: #fff; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 1rem; }
.sw-footer-cols { margin-top: 3rem; gap: 2.5rem; }
.sw-site-footer ul { list-style: none; padding: 0; margin: 0; }
.sw-site-footer li { margin-block: .6rem; font-size: .875rem; }
.sw-site-footer a { color: #94a3b8; text-decoration: none; }
.sw-site-footer a:hover { color: #38bdf8; }
.sw-footer-contacts .sw-muted-xs { color: #94a3b8; font-size: .75rem; }
.sw-footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; margin-top: 3rem; border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.5rem; font-size: .75rem; color: #94a3b8; }
.sw-footer-legal { display: flex; gap: 1rem; }
.sw-footer-social { display: flex; gap: .5rem; margin-top: 1.25rem; }
.sw-footer-social a { display: inline-flex; align-items: center; justify-content: center; height: 2.5rem; width: 2.5rem; border-radius: 9999px; background: rgba(255,255,255,.06); color: #cbd5e1; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); transition: background-color .2s, color .2s; }
.sw-footer-social a:hover { background: rgba(255,255,255,.12); color: #fff; }
.sw-footer-social svg { width: 1rem; height: 1rem; }

/* ── Pattern helpers ────────────────────────────────────── */
.sw-lead { font-size: 1.125rem; line-height: 1.6; color: var(--sw-muted); }
.sw-step-num { display: inline-flex; align-items: center; justify-content: center; height: 3rem; width: 3rem; border-radius: 9999px; border: 1px solid #bae6fd; background: #fff; color: var(--sw-primary-hover); font-family: 'Golos Text', system-ui, sans-serif; font-weight: 700; font-size: 1.25rem; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.sw-checklist { list-style: none; padding: 0; margin: 1.5rem 0; display: flex; flex-direction: column; gap: .75rem; }
.sw-checklist li { position: relative; padding-left: 1.75rem; color: var(--sw-body); }
.sw-checklist li::before { content: "\2713"; position: absolute; left: 0; top: 0; color: var(--sw-accent); font-weight: 700; }
.sw-quote { font-family: 'Golos Text', system-ui, sans-serif; font-weight: 500; color: var(--sw-contrast); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 1.875rem); line-height: 1.4; margin: 0; }
.sw-stars { color: var(--sw-accent); font-size: 1.25rem; letter-spacing: .15em; }
.sw-round img { border-radius: .9rem; }

/* Scenario cards ("Решения по сценариям") — mirror the React ScenarioCard:
   uniform 4:3 media + equal-height cards with the "Подробнее" link pinned to
   the bottom, so the four cards align regardless of source image dimensions. */
.sw-card.sw-round { display: flex; flex-direction: column; height: 100%; position: relative; }
.sw-card.sw-round .wp-block-image { margin: 0 0 1rem; }
.sw-card.sw-round .wp-block-image img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.sw-card.sw-round > p:last-child { margin-top: auto; padding-top: .5rem; }
/* Stretched link: the whole card is one tap target (the visible "Подробнее" link
   stays the accessible name). */
.sw-card.sw-round > p:last-child a::after { content: ""; position: absolute; inset: 0; }
.sw-card.sw-round h3 { font-size: 1.125rem; line-height: 1.25; }
/* Accent icon above each scenario title (mirrors React's ScenarioCard icon:
   rounded sky-tint square + sky glyph). Icons differ per column. */
.sw-card.sw-round h3::before {
	content: ""; display: block; width: 2.25rem; height: 2.25rem; margin-bottom: .6rem;
	border-radius: .5rem; background-color: var(--sw-accent-tint);
	background-position: center; background-repeat: no-repeat; background-size: 1.3rem 1.3rem;
}
.wp-block-column:nth-child(1) .sw-card.sw-round h3::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E"); }
.wp-block-column:nth-child(2) .sw-card.sw-round h3::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z'/%3E%3Cpath d='M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2'/%3E%3Cpath d='M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2'/%3E%3Cpath d='M10 6h4'/%3E%3Cpath d='M10 10h4'/%3E%3Cpath d='M10 14h4'/%3E%3Cpath d='M10 18h4'/%3E%3C/svg%3E"); }
.wp-block-column:nth-child(3) .sw-card.sw-round h3::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2'/%3E%3Cpath d='M12 20v2'/%3E%3Cpath d='m4.93 4.93 1.41 1.41'/%3E%3Cpath d='m17.66 17.66 1.41 1.41'/%3E%3Cpath d='M2 12h2'/%3E%3Cpath d='M20 12h2'/%3E%3Cpath d='m6.34 17.66-1.41 1.41'/%3E%3Cpath d='m19.07 4.93-1.41 1.41'/%3E%3C/svg%3E"); }
.wp-block-column:nth-child(4) .sw-card.sw-round h3::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z'/%3E%3Cpath d='M17 18h1'/%3E%3Cpath d='M12 18h1'/%3E%3Cpath d='M7 18h1'/%3E%3C/svg%3E"); }
