:root {
    --bg: #F2F0F7;
    --surface: #FFFFFF;
    --ink: #181A27;
    --muted: #5A5F76;
    --line: #DCD9E6;
    --accent: #5B3FD1;
    --accent-ink: #FFFFFF;
    --tint: #E7E1FA;
  }
  :root[data-theme="dark"] {
    --bg: #12111B;
    --surface: #1C1A28;
    --ink: #EEEBF8;
    --muted: #A7A3BC;
    --line: #2E2B40;
    --accent: #A592FF;
    --accent-ink: #14112B;
    --tint: #2A2545;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: 'Onest', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    line-height: 1.5; transition: background .3s, color .3s;
  }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
  .wrap { max-width: 1040px; margin: 0 auto; padding: 20px 20px 72px; }

  .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }

  /* Общее меню */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .wrap-header { padding: 12px 20px; }
  .bar { justify-content: flex-start; gap: 16px; flex-wrap: wrap; }
  a.brand { color: var(--ink); text-decoration: none; }
  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 4px;
    align-items: center;
    flex: 1 1 auto;
  }
  .nav a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    padding: 8px 10px;
    border-radius: 10px;
  }
  .nav a:hover { background: var(--tint); }
  .nav a[aria-current="page"] {
    color: var(--accent);
    background: var(--tint);
  }
  .bar-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
  .toggle.nav-toggle { display: none; }
  .nav-toggle svg { width: 20px; height: 20px; }

  @media (max-width: 800px) {
    .toggle.nav-toggle { display: none; }
    .nav {
      display: flex;
      flex-basis: 100%;
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      gap: 8px;
      order: 3;
      padding: 4px 0 2px;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav a { flex: none; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 15px; }
    .nav a[aria-current="page"] { border-color: var(--accent); }
  }
  .toggle {
    width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    display: grid; place-items: center;
  }
  .toggle svg { width: 20px; height: 20px; }
  .toggle .sun { display: none; }
  :root[data-theme="dark"] .toggle .sun { display: block; }
  :root[data-theme="dark"] .toggle .moon { display: none; }

  .hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; padding: 36px 0 32px; }
  h1 { margin: 0 0 20px; font-size: clamp(30px, 4.2vw, 48px); line-height: 1.08; letter-spacing: -1px; font-weight: 800; }
  .lead { margin: 0 0 28px; font-size: 18px; color: var(--muted); max-width: 52ch; }
  .actions { display: flex; flex-wrap: wrap; gap: 12px; }
  .btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 14px 20px; border-radius: 14px;
    font: inherit; font-weight: 500; font-size: 15px; text-decoration: none; cursor: pointer;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    transition: transform .15s;
  }
  .btn:active { transform: scale(.97); }
  .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .btn svg { width: 18px; height: 18px; flex: none; }
  .hint { margin: 12px 0 0; min-height: 20px; font-size: 14px; color: var(--muted); }

  .portrait { margin: 0; position: relative; justify-self: end; width: 100%; max-width: 380px; }
  .portrait::before {
    content: ""; position: absolute; inset: 0; border: 2px solid var(--accent);
    border-radius: 26px; transform: translate(12px, 12px);
  }
  .portrait img { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 26px; background: var(--tint); }
  .linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

  section { padding: 0 0 32px; }
  h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.3px; }
  .list { border-bottom: 1px solid var(--line); }
  .row { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 22px 0; border-top: 1px solid var(--line); }
  .row h3 { margin: 0; font-size: 18px; }
  .row p { margin: 0; color: var(--muted); max-width: 60ch; }

  .svc-hint {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--muted);
    max-width: 60ch;
  }
  .row.is-accordion { grid-template-columns: 280px 1fr; }
  .row-toggle {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }
  .row-toggle .chevron {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 3px;
    color: var(--muted);
    transition: transform .2s ease, color .2s ease;
  }
  .row-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); color: var(--accent); }
  .row.is-accordion { cursor: pointer; }
  .row.is-accordion .row-toggle:hover .chevron,
  .row.is-accordion:hover .row-toggle .chevron { color: var(--accent); }
  .row-panel { grid-column: 2; padding-top: 8px; cursor: default; }
  .row-panel[hidden] { display: none; }
  .svc-example { margin: 0; width: 100%; max-width: 240px; }
  .svc-example .frame { max-width: 240px; aspect-ratio: 9 / 16; }
  .svc-example img,
  .svc-example video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
  }
  @media (min-width: 801px) {
    .svc-example { max-width: 380px; }
    .svc-example .frame { max-width: 380px; }
    .svc-card { max-width: 380px; }
  }
  .svc-example-links {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 14px;
    margin: 10px 0 0;
    font-size: 14px;
    color: var(--muted);
    max-width: 60ch;
  }
  .svc-example-links a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
  }
  .svc-example-links a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .svc-prompt-excerpt {
    margin: 0;
    max-width: 60ch;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font: inherit;
    font-size: 14px;
    line-height: 1.55;
    color: var(--muted);
    white-space: pre-wrap;
  }
  .svc-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-width: 240px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
  }
  .svc-card strong { font-size: 16px; font-weight: 700; }
  .svc-card p { margin: 0; color: var(--muted); max-width: none; }
  .svc-card a {
    color: var(--accent);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
  }
  .svc-card a:hover { text-decoration: underline; text-underline-offset: 3px; }


  .works { display: none; grid-template-columns: repeat(auto-fill, minmax(220px, 260px)); gap: 22px; margin-top: 16px; }
  .works figure { margin: 0; }
  .frame {
    display: block; width: 100%; padding: 0; aspect-ratio: 9 / 16; overflow: hidden;
    border-radius: 16px; border: 1px solid var(--line); background: var(--tint);
  }
  button.frame { cursor: zoom-in; }
  .frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .frame video { 
    display: block; 
    width: 100%; 
    height: auto; 
    max-height: 480px; 
    object-fit: contain; 
    background: #111; 
    border-radius: 12px;
  }
  video::cue {
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 18px;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 6px;
  }
  video::-webkit-media-text-track-display {
    transform: translateY(-18px);
  }
  .works figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); max-width: 260px; }
  dialog.promptdlg {
    border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: var(--surface); color: var(--ink);
    width: min(680px, 92vw); max-height: 86vh; overflow: auto;
  }
  dialog.promptdlg::backdrop { background: rgba(10, 8, 20, .82); }
  dialog.promptdlg h3 { margin: 0 0 12px; font-size: 18px; }
  dialog.promptdlg pre { margin: 0 0 16px; white-space: pre-wrap; font: inherit; font-size: 14px; line-height: 1.55; color: var(--muted); }
  .dlg-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .dlg-actions .btn { padding: 10px 16px; }
  .promptbtn { margin-top: 4px; font-size: 14px; }
  .works .frame { max-width: 260px; }
  .works figure:has(.prompt-panel:not([hidden])) {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 680px;
  }
  .prompt-panel {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink);
  }
  .prompt-panel pre {
    margin: 0 0 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
    font-size: 14px;
    line-height: 1.55;
    color: var(--muted);
  }
  .prompt-panel .dlg-actions .btn { padding: 8px 14px; font-size: 14px; }
  dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 92vh; }
  dialog.lightbox::backdrop { background: rgba(10, 8, 20, .82); }
  dialog.lightbox img { display: block; max-width: 92vw; max-height: 92vh; border-radius: 12px; }

  .prices { display: none; margin-top: 12px; }
  .prices .row { grid-template-columns: 1fr auto; }
  .price { font-weight: 700; color: var(--accent); }

  #section-contact { max-width: 480px; }
  #section-contact p { margin: 0 0 8px; color: var(--muted); }
  #section-contact .form-privacy { font-size: 13px; margin-bottom: 14px; }
  #section-contact .form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  .mic-btn {
    width: 48px; height: 48px; padding: 0; justify-content: center; flex: none;
  }
  .mic-btn svg { width: 20px; height: 20px; }
  .mic-btn.is-recording {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
    animation: mic-pulse 1.2s ease-in-out infinite;
  }
  @keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--tint); }
    50% { box-shadow: 0 0 0 6px var(--tint); }
  }
  .dima-and-form {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(280px, 1fr);
    gap: 22px 24px;
    align-items: start;
    width: 100%;
    min-width: 0;
  }
  .dima-and-form > figure {
    margin: 0;
    min-width: 0;
    width: 220px;
    max-width: 220px;
  }
  .dima-and-form > figure .frame,
  .dima-and-form > figure figcaption {
    max-width: 100%;
  }
  .dima-and-form > figure video {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-width: 0;
  }
  .dima-and-form > figure:has(.prompt-panel:not([hidden])) {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 680px;
  }
  .dima-and-form #section-contact {
    min-width: 0;
    max-width: 480px;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  @media (max-width: 899px) {
    .dima-and-form {
      grid-template-columns: 1fr;
      gap: 20px;
    }
    .dima-and-form > figure {
      width: 260px;
      max-width: 260px;
    }
    .dima-and-form #section-contact {
      width: 100%;
      max-width: 480px;
    }
  }
  @media (max-width: 800px) {
    .hero { grid-template-columns: 1fr; gap: 16px; padding: 16px 0 24px; } .portrait { order: -1; justify-self: start; width: 112px; max-width: 112px; }
    .portrait::before { display: none; }
    .portrait img { height: auto; aspect-ratio: 1 / 1; border-radius: 18px; object-position: center 25%; }
    .row { grid-template-columns: 1fr; gap: 6px; }
    .row.is-accordion { grid-template-columns: 1fr; }
    .row-panel { grid-column: 1; }
    .row-toggle { min-height: 32px; }
    .works:has(.prompt-panel:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
