/* Approved Sketch Redesign, shared across languages and themes. */
:root {
  --navy: #002877;
  --page-gray: #ededed;
  --preview-gray: #f2f2f2;
  --ink: #26324b;
  --muted: #566477;
  --paper: #fff;
  --surface: #f5f5f5;
  --surface-selected: #edf2ff;
  --line: #b8c1d0;
  --line-soft: #e1e4ea;
  --blue: #002877;
  --blue-hover: #0043ad;
  --yellow: #fc0;
  --footer: #002877;
  --focus: #557ad0;
  --content-width: 1080px;
  --page-gutter: clamp(24px, 6vw, 88px);
  --navigation-bg: #002877;
  --range-track: #dbe1ed;
  --hero-ink: #002877;
}

:root[data-theme="dark"] {
  --navy: #b8ceff;
  --page-gray: #101522;
  --preview-gray: #202a3c;
  --ink: #f4f6fb;
  --muted: #c2c9d8;
  --paper: #171e2d;
  --surface: #1c2638;
  --surface-selected: #283c62;
  --line: #667893;
  --line-soft: #3a4961;
  --blue: #b0c8ff;
  --blue-hover: #d4e1ff;
  --yellow: #fc0;
  --focus: #b8ceff;
  --footer: #09152b;
  --navigation-bg: #142750;
  --range-track: #475772;
  --hero-ink: #f4f6fb;
}

html { min-width: 0; }
body { background: var(--page-gray); }
.skip-link { position: fixed; z-index: 200; top: -80px; left: 20px; padding: 12px 20px; background: var(--paper); }
.skip-link:focus { top: 12px; }
.topbar {
  min-height: 73px;
  padding: 14px max(var(--page-gutter), calc((100% - var(--content-width)) / 2));
  border: 0;
}
.brand-logo { display: block; width: 121px; height: 40px; object-fit: contain; }
.brand-logo-dark, [data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }
.theme-toggle, .language-switcher { border-radius: 5px; }
.theme-toggle { justify-content: center; }
[data-theme="dark"] .theme-toggle[aria-pressed="true"] .theme-thumb { background: #142750; }
.main-navigation { background: var(--navigation-bg); }
.navigation-inner { display: flex; align-items: stretch; gap: 40px; width: min(var(--content-width), calc(100% - var(--page-gutter) * 2)); min-height: 58px; margin: auto; }
.main-navigation a { display: inline-flex; align-items: center; padding: 15px 0; color: #fff; font-size: 16px; text-decoration: none; }
.main-navigation a:hover { text-decoration: underline; text-underline-offset: 7px; }
.main-navigation a:focus-visible { outline-color: var(--yellow); }
.workspace { width: 100%; padding: 0; }
#about-ai-act, #label-editor, #faq { scroll-margin-top: 24px; }

.hero { background: #8eabff; border-radius: 0; }
[data-theme="dark"] .hero { background: #293d72; }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; width: min(var(--content-width), calc(100% - var(--page-gutter) * 2)); min-height: 392px; margin: auto; }
.tool-intro { margin: 0; padding: 35px 0; }
.tool-intro h1 { color: var(--hero-ink); font-size: 64px; line-height: 1.12; letter-spacing: -1.6px; overflow-wrap: break-word; }
html:not([lang="en"]) .tool-intro h1 { font-size: clamp(36px, 4vw, 54px); }
html:not([lang="en"]) .tool-intro h1 span { display: block; text-wrap: balance; }
html:not([lang="en"]) .tool-intro h1 br { display: none; }
.tool-intro > p:last-child { max-width: 422px; margin-top: 24px; color: var(--hero-ink); font-size: 20px; line-height: 30px; }
.hero-art { display: grid; place-items: center; justify-self: center; width: 435px; max-width: 100%; height: 314px; padding: 16px 21px 15px 22px; transform: translateX(-24px); }
.hero-art img { display: block; max-width: 100%; height: auto; }

.context-band { padding: 66px var(--page-gutter) 67px; }
.official-context { grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 6px 20px; width: min(var(--content-width), 100%); margin: auto; padding: 20px 24px; border: 0; border-radius: 5px; background: var(--surface); }
.context-content { display: contents; }
.context-content > * { grid-column: 2; }
.context-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 2px; background: var(--navy); color: #fff; font-size: 18px; font-weight: 700; }
[data-theme="dark"] .context-icon { color: #142750; }
.official-context p { margin: 0; }
.official-context .official-links { margin-top: 4px; }
.official-links { flex-wrap: wrap; gap: 10px 28px; white-space: normal; }
.official-links a { color: var(--blue); }

.editor-section { padding: 36px var(--page-gutter) 28px; border-radius: 7px; background: var(--paper); }
.editor-container { max-width: var(--content-width); margin: auto; }
.editor-container > h2 { margin: 0 0 6px; font-size: 32px; line-height: 1.4; letter-spacing: -.8px; }
.editor-shell { grid-template-columns: 360px minmax(0, 1fr); gap: 72px; min-height: 0; overflow: visible; border: 0; border-radius: 0; }
.controls { padding: 56px 0 0; border: 0; }
.control-group { padding: 22px 0; border-top: 0; border-bottom: 1px solid var(--line-soft); }
.control-group:first-child { padding-top: 0; }
.control-group legend.sr-only { margin: -1px; padding: 0; }
.legend-with-info, .field-heading, .legend-row { margin: 0 0 16px; font-size: 15px; font-weight: 700; }
.legend-with-info { gap: 10px; min-height: 28px; }
.info-button { flex-shrink: 0; width: 28px; height: 28px; border-color: var(--line); background: var(--surface); color: var(--muted); }
.info-button:hover, .info-button[aria-expanded='true'] { border-color: var(--navy); background: var(--surface-selected); color: var(--navy); }
.info-popover { top: 39px; width: min(380px, calc(100vw - 48px)); border-radius: 7px; box-shadow: 0 8px 28px rgba(0,40,119,.14); }
.segment span, .position-option > span { min-height: 48px; height: 100%; border-radius: 7px; background: var(--paper); color: var(--ink); font-size: 14px; }
html[lang="pl"] .segment span { font-size: 13px; line-height: 1.35; }
.segment.is-selected span, .position-option.is-selected > span { border-color: var(--navy); color: var(--navy); background: var(--surface-selected); box-shadow: inset 0 0 0 1px var(--navy); }
.segment input:focus-visible + span, .position-option input:focus-visible + span, .swatch:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; }
.legend-row { align-items: center; }
.legend-row output { color: var(--navy); font-size: 15px; font-variant-numeric: tabular-nums; }
.range { display: block; height: 28px; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--navy) 0 var(--range-progress), var(--range-track) var(--range-progress) 100%); }
.range::-moz-range-track { height: 6px; background: var(--range-track); }
.range::-moz-range-progress { height: 6px; background: var(--navy); }
.range::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -8px; border: 3px solid var(--paper); background: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.range::-moz-range-thumb { width: 16px; height: 16px; border: 3px solid var(--paper); background: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.range-labels { margin-top: 5px; font-size: 13px; }
.position-grid { gap: 10px; }
.position-option > span { padding: 10px 14px; gap: 10px; }
.control-row { grid-template-columns: 136px minmax(0, 1fr); gap: 28px; padding-bottom: 28px; border-bottom: 0; }
.swatches { align-items: center; min-height: 28px; gap: 14px; }
.swatch { width: 28px; height: 28px; }
.swatch.is-selected { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--navy); }
.action-stack { margin-top: auto; padding-top: 20px; border-top: 0; }
.primary-button, .secondary-button { min-height: 57px; border: 1px solid var(--yellow); border-radius: 7px; background: var(--yellow); color: #26324b; padding: 12px 24px; }
.primary-button:hover:not(:disabled), .secondary-button:hover { border-color: #ebbc00; background: #ebbc00; color: #002877; }
.primary-button:disabled { border-color: #f3d979; background: #ffe58b; color: #69717c; }
[data-theme="dark"] .primary-button:disabled { border-color: var(--line-soft); background: #364154; color: #abb5c5; }
.secondary-button { min-width: 197px; }
.stage-panel { background: transparent; }
.stage-toolbar { min-height: 56px; padding: 0 0 14px; border-bottom: 0; align-items: center; }
.stage-title { font-size: 16px; font-weight: 700; }
.text-button { font-size: 14px; padding-inline: 0; }
.dropzone { min-height: 584px; margin: 0; border: 1px dashed #69768b; border-radius: 7px; background: var(--preview-gray); }
.dropzone[role='button']:hover, .dropzone.is-dragging { border: 1px dashed var(--navy); background: var(--surface-selected); }
.dropzone.is-dragging { outline: 3px solid var(--focus); outline-offset: 3px; }
.upload-state { padding: 38px 24px; }
.upload-icon { width: 57px; height: 57px; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 7px; color: var(--navy); background: var(--paper); }
.upload-state #upload-help { margin-top: 7px; margin-bottom: 24px; }
.file-limit { margin-top: 8px; }
.preview-state { padding: 24px; }
#preview-canvas { max-height: 540px; box-shadow: 0 3px 16px rgba(0,40,119,.12); }
.compliance-note { max-width: none; margin-top: 22px; font-size: 13px; }

.faq-section { padding: 76px var(--page-gutter) 112px; color: var(--navy); }
.faq-inner { width: min(var(--content-width), 100%); margin: auto; }
.faq-inner h2 { margin: 0 0 24px; font-size: 32px; line-height: 1.4; letter-spacing: -.8px; }
.faq-list { max-width: 868px; }
.faq-list details { border-bottom: 1px solid #8299c5; }
.faq-list summary { position: relative; display: block; padding: 25px 48px 25px 0; font-size: 20px; font-weight: 700; line-height: 1.5; list-style: none; cursor: pointer; }
.faq-list details:first-child summary { padding-top: 0; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '+'; position: absolute; top: 50%; right: 12px; transform: translateY(-50%); font-size: 32px; font-weight: 400; line-height: 1; }
.faq-list details:first-child summary::after { margin-top: -12px; }
.faq-list details[open] summary::after { content: '−'; }
.faq-list summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.faq-list details p { max-width: 725px; margin: -8px 48px 24px 0; font-size: 20px; line-height: 1.5; }
.site-footer { min-height: 141px; padding: 30px max(var(--page-gutter), calc((100% - var(--content-width)) / 2)); }
.site-footer nav { flex-wrap: wrap; }
.legal-close { flex-shrink: 0; }

@media (max-width: 1200px) {
  .hero-inner { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; }
  .tool-intro h1 { font-size: clamp(40px, 4.5vw, 58px); letter-spacing: -.025em; }
  .hero-art { width: 100%; height: auto; aspect-ratio: 435 / 314; padding: 4%; transform: translateX(-12px); }
  .editor-shell { grid-template-columns: 330px minmax(0, 1fr); gap: 40px; }
  .control-row { grid-template-columns: 122px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 800px) {
  .topbar { min-height: 73px; padding: 14px var(--page-gutter); }
  .navigation-inner { gap: 32px; min-height: 58px; }
  .main-navigation a { font-size: 16px; }
  .hero-inner { min-height: 330px; gap: 0; }
  .tool-intro h1 { font-size: 36px; }
  .tool-intro > p:last-child { font-size: 18px; line-height: 1.5; }
  .context-band { padding: 36px var(--page-gutter); }
  .official-links { flex-direction: row; }
  .editor-shell { grid-template-columns: 1fr; grid-template-areas: 'stage' 'controls'; gap: 28px; }
  .editor-section { padding-block: 28px; }
  .editor-container > h2 { font-size: 28px; margin-bottom: 18px; }
  .stage-panel { grid-area: stage; }
  .controls { grid-area: controls; padding: 0; border: 0; }
  .dropzone { min-height: 380px; }
  .stage-toolbar { min-height: 42px; }
  .control-row { grid-template-columns: minmax(122px, .7fr) minmax(0, 1.3fr); }
  .info-popover { width: min(380px, 100%); }
  .action-stack { margin-top: 0; padding-top: 0; }
  .faq-section { padding-block: 48px 64px; }
  .faq-list summary, .faq-list details p { font-size: 18px; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; padding: 32px var(--page-gutter); }
  .site-footer nav { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .topbar { grid-template-columns: 1fr auto; gap: 16px; padding: 14px var(--page-gutter); }
  .topbar-actions { width: auto; }
  .theme-toggle { display: inline-flex; }
  #language-select { width: 122px; }
  .navigation-inner { gap: 14px 24px; min-height: 55px; flex-wrap: wrap; }
  html:not([lang="en"]) .navigation-inner { gap: 6px 18px; }
  html:not([lang="en"]) .main-navigation a { font-size: 14px; }
  .main-navigation a { font-size: 15px; }
  .hero-inner { display: flex; flex-direction: column; align-items: start; padding: 34px 0 18px; }
  .tool-intro { padding: 0; }
  .tool-intro h1 { font-size: clamp(30px, 8.4vw, 42px); }
  html:not([lang="en"]) .tool-intro h1 { font-size: clamp(30px, 8vw, 40px); }
  .tool-intro > p:last-child { margin-top: 20px; font-size: 17px; }
  .hero-art { width: 260px; max-width: 90%; align-self: center; margin-top: 12px; transform: none; }
  .context-band { padding: 28px var(--page-gutter); }
  .official-context { gap: 6px 14px; padding: 18px 16px; }
  .official-context h2 { font-size: 17px; }
  .official-context p { font-size: 15px; }
  .official-links { flex-direction: column; gap: 10px; }
  .editor-section { padding-inline: var(--page-gutter); }
  .dropzone { min-height: 340px; }
  .upload-state { padding: 28px 12px; }
  .upload-state #upload-help { max-width: 245px; }
  .position-option > span { padding-inline: 10px; gap: 8px; font-size: 13px; }
  .control-row { grid-template-columns: 122px minmax(0, 1fr); gap: 20px; }
  .faq-section { padding-inline: var(--page-gutter); }
  .faq-list summary { padding-right: 34px; font-size: 17px; }
  .faq-list details p { margin-right: 28px; font-size: 17px; }
  .faq-list summary::after { right: 2px; }
  .site-footer { padding-inline: var(--page-gutter); }
}

@media (max-width: 380px) {
  .topbar { grid-template-columns: 1fr; gap: 8px; }
  .topbar-actions { justify-self: end; }
  .brand { grid-row: 1; }
  .topbar-actions { grid-row: 2; }
  .control-row { grid-template-columns: 1fr; gap: 20px; }
}
