/* spongedigital.art — внутренние страницы в системе главной (студия-чертёж букв): те же токены, JetBrains Mono,
   панель справа 320 px с разделами (h2 10 px капсом .14em), кнопки-режимы, переключатели, штамп чертежа,
   «Cianotipia» — синька. Страница — лист: рамка с зонами 1–8 / A–F, сетка 24 px, размерная линия под заголовком,
   спецификация таблицей. Линии чертятся (scaleX 0 → 1), текст проявляется; в обе стороны прокрутки. */
:root {
  --bg: #e8ebee; --ink: #111; --ink-2: #5d646c; --line: #c3c9cf; --panel: #f3f5f7; --red: #e4150b;
  --grid: rgba(17, 17, 17, .045);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --panel-w: 320px; --pad: clamp(28px, 4.4vw, 72px);
  --e-draw: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="blue"] {
  --bg: #1c3d6e; --ink: #e9f1ff; --ink-2: #9db4d8; --line: #3c5f94; --panel: #183563; --grid: rgba(233, 241, 255, .07);
}
* { box-sizing: border-box; }
html { background: var(--bg); scrollbar-color: var(--ink) var(--bg); scrollbar-width: thin; hyphens: manual; }
html::-webkit-scrollbar { width: 8px; }
html::-webkit-scrollbar-track { background: var(--bg); }
html::-webkit-scrollbar-thumb { background: var(--ink); border: 2px solid var(--bg); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0; color: var(--ink); font: 13px/1.6 var(--mono);
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px; background-attachment: fixed;
  transition: background-color .4s ease, color .4s ease;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--bg); }
a { color: inherit; }
p, h1, h2, h3, ol, figure { margin: 0; padding: 0; }
ol { list-style: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--ink); color: var(--bg); }
.skip:focus { top: 12px; }

/* рамка листа с зонами */
.frame { position: fixed; top: 12px; bottom: 12px; left: 12px; right: calc(var(--panel-w) + 12px); border: 1px solid var(--ink); pointer-events: none; z-index: 3; transition: border-color .4s ease; }
.zones { position: absolute; display: flex; justify-content: space-around; font-size: 9px; color: var(--ink-2); letter-spacing: .1em; }
.zones--x { left: 0; right: 0; top: -1px; translate: 0 -100%; }
.zones--x span { background: var(--bg); padding: 0 6px; translate: 0 50%; }
.zones--y { top: 0; bottom: 0; left: -1px; flex-direction: column; align-items: center; translate: -50% 0; }
.zones--y span { background: var(--bg); padding: 4px 0; }

/* лист */
.stage { position: relative; z-index: 1; margin-right: var(--panel-w); padding: 0 var(--pad); }
.head { min-height: min(92vh, 900px); display: flex; flex-direction: column; justify-content: flex-end; gap: 22px; padding: 120px 0 72px; max-width: 980px; }
.crumb { display: flex; gap: 10px; flex-wrap: wrap; font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); }
.crumb a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.crumb a:hover { color: var(--ink); text-decoration-color: var(--ink); }
.h1 { font: 500 clamp(30px, 4.6vw, 70px)/1.04 var(--mono); letter-spacing: -.035em; max-width: 19ch; text-wrap: balance; }
.sub { font-size: clamp(14px, 1.2vw, 16px); line-height: 1.6; color: var(--ink-2); max-width: 52ch; }

/* размерная линия: стрелки на концах, подпись в разрыве */
.dim { display: flex; align-items: center; gap: 10px; max-width: 640px; color: var(--ink); font: 500 10px/1 var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.dim-l, .dim-r { flex: 1; height: 1px; background: currentColor; position: relative; transform-origin: right; }
.dim-r { transform-origin: left; }
.dim-l::before, .dim-r::after { content: ""; position: absolute; top: -4px; width: 0; height: 0; border: 4px solid transparent; }
.dim-l::before { left: 0; border-right: 8px solid currentColor; border-left: 0; }
.dim-r::after { right: 0; border-left: 8px solid currentColor; border-right: 0; }
.dim-l::after, .dim-r::before { content: ""; position: absolute; top: -9px; width: 1px; height: 19px; background: currentColor; }
.dim-l::after { left: 0; } .dim-r::before { right: 0; left: auto; }
.dim-t { background: var(--bg); padding: 2px 4px; }
body:not(.show-numbers) .dim, body:not(.show-numbers) .stamp, body:not(.show-numbers) .zones, body:not(.show-numbers) .callout, body:not(.show-numbers) .td--pos { opacity: 0; }
.dim, .stamp, .zones, .callout, .td--pos { transition: opacity .3s ease; }

.body { display: flex; flex-direction: column; gap: clamp(64px, 8vw, 110px); max-width: 760px; padding-bottom: 40px; }
.blk { display: grid; gap: 20px; }
.k { display: flex; align-items: center; gap: 10px; font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); }
.k-rule { flex: 1; height: 1px; background: var(--line); transform-origin: left; }
.callout { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--ink); border-radius: 50%; font-style: normal; font-weight: 500; color: var(--ink); letter-spacing: 0; }
.txt { font-size: 14px; line-height: 1.75; max-width: 66ch; }
.txt--lead { font-size: clamp(16px, 1.45vw, 19px); line-height: 1.6; font-weight: 400; }

/* таблицы: спецификация и ссылки */
.tbl { display: grid; border: 1px solid var(--ink); background: var(--bg); transition: background-color .4s ease, border-color .4s ease; }
.tr { display: grid; grid-template-columns: 56px 1fr; border-bottom: 1px solid var(--line); text-decoration: none; }
.tbl > .tr:last-child, .tbl > li:last-child .tr { border-bottom: 0; }
.td { padding: 11px 14px; font-size: 13px; line-height: 1.5; }
.td--pos { border-right: 1px solid var(--line); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tr--head .td { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); border-bottom: 1px solid var(--ink); padding: 8px 14px; }
.tr--head { border-bottom: 0; }
.tbl--links .tr { grid-template-columns: 56px 1fr auto 44px; align-items: center; min-height: 52px; transition: background-color .15s ease, color .15s ease; }
.td--name { font-weight: 500; font-size: 14px; }
.td--cat { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); }
.td--go { text-align: center; transition: translate .35s var(--e-draw); }
.tbl--links .tr:hover { background: var(--ink); color: var(--bg); }
.tbl--links .tr:hover .td--pos, .tbl--links .tr:hover .td--cat { color: var(--bg); opacity: .7; }
.tbl--links .tr:hover .td--go { translate: 6px 0; }

/* вопросы — «Notas» чертежа */
.notes { display: grid; gap: 34px; counter-reset: n; }
.notes li { display: grid; grid-template-columns: 34px 1fr; gap: 6px; }
.note-n { font-weight: 500; }
.note-q { font: 500 clamp(15px, 1.4vw, 18px)/1.4 var(--mono); margin-bottom: 8px; letter-spacing: -.01em; }

/* призыв — блок изменений внизу листа */
.cta { display: grid; gap: 16px; padding: 28px; border: 1px solid var(--ink); background: var(--panel); position: relative; transition: background-color .4s ease; }
.cta::before { content: ""; position: absolute; inset: 6px; border: 1px dashed var(--line); pointer-events: none; }
.cta-h { font: 500 clamp(24px, 2.8vw, 40px)/1.08 var(--mono); letter-spacing: -.03em; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; position: relative; }
.btn { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 20px; background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; border: 1px solid var(--ink); transition: background-color .15s ease, color .15s ease; }
.btn:hover { background: transparent; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.mail { padding: 12px 0; text-underline-offset: 3px; }

.foot { display: grid; gap: 8px; padding: 70px 0 calc(40px + env(safe-area-inset-bottom)); font-size: 11px; color: var(--ink-2); max-width: 760px; border-top: 1px solid var(--line); margin-top: 60px; }
.foot-l { display: flex; flex-wrap: wrap; gap: 0 20px; }
.foot a { display: inline-block; padding: 8px 0; text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); }

/* штамп главной, живой: доля прочитанного */
.stamp { position: fixed; right: calc(var(--panel-w) + 28px); bottom: 28px; z-index: 4; border: 1px solid var(--ink); background: var(--bg);
         display: grid; grid-template-columns: auto auto; font-size: 10px; pointer-events: none; font-variant-numeric: tabular-nums; max-width: 300px; }
.stamp > div { padding: 4px 8px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.stamp > div:nth-child(2n) { border-right: 0; min-width: 11ch; text-align: right; }
.stamp > div:nth-last-child(-n+2) { border-bottom: 0; }
.stamp .sk { color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }
.stamp .title { grid-column: 1 / -1; font-weight: 500; font-size: 11px; letter-spacing: .12em; border-right: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* панель — как на главной */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); z-index: 5; background: var(--panel); border-left: 1px solid var(--ink);
         overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; transition: background-color .4s ease, transform .35s var(--e-draw); }
.panel section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel h2 { margin: 0 0 10px; font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); }
.ph1 { font: 500 13px/1.2 var(--mono); letter-spacing: .14em; }
.ph1 a { text-decoration: none; }
.sub2 { color: var(--ink-2); margin-top: 4px; font-size: 12px; }
.modes { display: grid; gap: 4px; }
.mode { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); text-decoration: none; font: 500 12px/1 var(--mono);
        transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.mode small { color: var(--ink-2); font-weight: 400; }
.mode:hover { border-color: var(--ink); }
.mode:active { transform: translateY(1px); }
.mode.is-cur { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.mode.is-cur small { color: var(--bg); opacity: .7; }
.row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; font-size: 12px; }
button { font: 500 12px/1 var(--mono); color: var(--ink); background: transparent; border: 1px solid var(--line); cursor: pointer; border-radius: 0; }
.switch { width: 38px; height: 20px; padding: 0; border: 1px solid var(--ink); position: relative; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: var(--ink-2); transition: transform .2s var(--e-draw), background-color .2s ease; }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--ink); }
.panel .contact p { margin: 0 0 6px; font-size: 12px; }
.panel .contact a { text-decoration: underline; text-underline-offset: 3px; }
.toggle-panel { display: none; }
.b-close { display: none; }

/* появления: линии чертятся, текст проявляется; прячутся, когда уходят обратно вниз */
.js .rv { opacity: 0; translate: 0 16px; transition: opacity .6s ease, translate .7s var(--e-draw); }
.js .rv.is-in { opacity: 1; translate: 0 0; }
.js .k-rule { transform: scaleX(0); transition: transform 1.1s var(--e-draw) .15s; }
.js .k.is-in .k-rule { transform: scaleX(1); }
.js .callout { scale: .4; transition: scale .6s var(--e-draw), opacity .3s ease; }
.js .k.is-in .callout { scale: 1; }
.js .head > * { opacity: 0; translate: 0 18px; transition: opacity .7s ease, translate .9s var(--e-draw); }
.js .dim-l, .js .dim-r { transform: scaleX(0); transition: transform 1.2s var(--e-draw) .35s; }
.is-ready .head > * { opacity: 1; translate: 0 0; }
.is-ready .head .h1 { transition-delay: .1s; } .is-ready .head .dim { transition-delay: .2s; } .is-ready .head .sub { transition-delay: .3s; }
.is-ready .dim-l, .is-ready .dim-r { transform: scaleX(1); }
.js .frame { clip-path: inset(0 100% 100% 0); transition: clip-path 1.2s var(--e-draw); }
.is-ready .frame { clip-path: inset(-20px -20px -20px -20px); }
.is-leaving .stage, .is-leaving .stamp { opacity: 0; translate: 0 -12px; transition: opacity .35s ease, translate .45s var(--e-draw); }
.is-leaving .frame { clip-path: inset(0 0 100% 0); transition: clip-path .45s var(--e-draw); }

/* форма заявки — кнопки и переключатели панели главной */
.blk--form .of { display: grid; gap: 26px; }
.pf-lede { font-size: clamp(16px, 1.45vw, 19px); line-height: 1.6; }
.pf { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.pf-set { grid-column: 1 / -1; border: 0; margin: 0 0 24px; padding: 0; min-width: 0; }
.pf-set legend { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); padding: 0; margin-bottom: 10px; }
.pf-fams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pf-fam { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 10px; text-align: left; border: 1px solid var(--line); background: var(--bg);
          transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.pf-fam:hover { border-color: var(--ink); }
.pf-fam[aria-expanded="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pf-count { font-weight: 500; color: var(--red); }
.pf-svc { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 10px; }
.pf-svc[hidden], .pf-done[hidden], .pf-go[hidden] { display: none; }
.pf-chip { position: relative; }
.pf-chip input, .pf-tab input { position: absolute; opacity: 0; pointer-events: none; }
.pf-chip span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 10px; border: 1px dashed var(--ink-2); color: var(--ink-2); font-size: 12px; cursor: pointer; background: var(--bg); }
.pf-chip input:checked + span { border: 1px solid var(--ink); background: var(--ink); color: var(--bg); }
.pf-chip input:focus-visible + span, .pf-tab input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.pf-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pf-tab span { display: grid; gap: 6px; height: 100%; padding: 12px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.pf-tab span:hover { border-color: var(--ink); }
.pf-tab b { font-weight: 500; font-size: 14px; }
.pf-tab small { font-size: 11px; line-height: 1.45; color: var(--ink-2); }
.pf-tab input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pf-tab input:checked + span small { color: var(--bg); opacity: .7; }
.pf-field { display: grid; gap: 6px; margin-bottom: 18px; position: relative; }
.pf-wide, .pf-f-password { grid-column: 1 / -1; }
.pf-field label { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); }
.pf-field input, .pf-field textarea { font: 500 16px/1.3 var(--mono); color: var(--ink); background: transparent; border: 1px solid var(--ink); padding: 10px; border-radius: 0; resize: none; width: 100%; }
.pf-field input:focus, .pf-field textarea:focus { outline: 2px solid var(--ink); outline-offset: 2px; }
.pf-field.is-bad input { border-color: var(--red); border-style: dashed; }
.pf-err, .pf-alert { font-size: 11px; color: var(--red); min-height: 17px; }
.pf-alert { grid-column: 1 / -1; }
.pf-eye { position: absolute; right: 2px; top: 18px; width: 40px; height: 40px; border: 0; }
.pf-eye::before { content: ""; position: absolute; inset: 14px 9px; border: 1px solid var(--ink); border-radius: 50%; }
.pf-eye::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; background: var(--ink-2); border-radius: 50%; }
.pf-eye[aria-pressed="true"]::after { background: var(--ink); }
.pf-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pf-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.pf-send { min-height: 48px; padding: 0 22px; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); text-transform: uppercase; letter-spacing: .06em; transition: background-color .15s ease, color .15s ease; }
.pf-send:hover { background: transparent; color: var(--ink); }
.pf-send:active { transform: translateY(1px); }
.pf-send:disabled { opacity: .6; }
.pf-note { font-size: 11px; color: var(--ink-2); max-width: 280px; }
.pf-note a { text-underline-offset: 3px; }
.pf-done { display: grid; gap: 14px; padding: 24px; border: 1px solid var(--ink); background: var(--panel); opacity: 0; transition: opacity .5s ease; outline: 0; }
.pf-done.is-in { opacity: 1; }
.pf-done-h { font: 500 24px/1.15 var(--mono); letter-spacing: -.02em; }
.pf-go { justify-self: start; padding: 8px 0; text-underline-offset: 3px; }
.nx { border-top: 1px solid var(--line); padding-top: 16px; }
.nx-h { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); margin-bottom: 12px; }
.nx-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.nx-steps li { display: grid; gap: 8px; align-content: start; padding: 12px; border: 1px solid var(--line); font-size: 12px; line-height: 1.5; }
.nx-steps b { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--ink); border-radius: 50%; font-weight: 500; }
.pf-mailaddr { font: 500 clamp(17px, 2vw, 22px)/1.3 var(--mono); text-underline-offset: 4px; overflow-wrap: anywhere; }

@media (max-width: 1180px) { .stamp { display: none; } }
@media (max-width: 760px) {
  :root { --panel-w: 0px; --pad: 26px; }
  .frame { top: 8px; bottom: 8px; left: 8px; right: 8px; }
  .zones--x { display: none; }
  .zones--y span { font-size: 8px; }
  .head { min-height: 84svh; padding: 90px 0 48px; gap: 18px; }
  .h1 { font-size: clamp(26px, 7.6vw, 38px); letter-spacing: -.04em; }
  .panel { top: auto; left: 0; width: auto; height: min(78vh, 640px); border-left: 0; border-top: 1px solid var(--ink); transform: translateY(100%); }
  .is-panel .panel { transform: none; }
  .toggle-panel { display: block; position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 6; min-height: 44px; padding: 0 16px; background: var(--bg); border: 1px solid var(--ink); letter-spacing: .12em; transition: bottom .35s var(--e-draw); }
  .is-panel .toggle-panel { bottom: calc(min(78vh, 640px) + 12px); }
  .is-panel .b-open { display: none; } .is-panel .b-close { display: inline; }
  .mode { min-height: 44px; }
  .pf, .pf-tabs, .nx-steps { grid-template-columns: 1fr; }
  .pf-fams { grid-template-columns: 1fr 1fr; }
  .tbl--links .tr { grid-template-columns: 44px 1fr 40px; }
  .tbl--links .td--cat { display: none; }
  .tr { grid-template-columns: 44px 1fr; }
  .td { padding: 10px 10px; }
  .cta { padding: 22px 18px; }
  .foot { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .js .rv, .js .head > *, .js .k-rule, .js .callout, .js .dim-l, .js .dim-r, .js .frame { transition: none; opacity: 1; translate: none; transform: none; scale: none; clip-path: none; }
  .panel, .switch::after { transition: none; }
}
