:root {
  color-scheme: light;
  --ink: #12130f;
  --ink-2: #2c3027;
  --muted: #676d5d;
  --paper: #f6f2e7;
  --panel: #fffdf5;
  --line: #d8d0bd;
  --acid: #b9df54;
  --acid-2: #8ab63f;
  --orange: #f05d23;
  --blue: #2635d9;
  --blue-2: #5763f5;
  --shadow: 0 22px 80px rgba(18, 19, 15, 0.16);
  --radius: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(18, 19, 15, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(18, 19, 15, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 18px 18px;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(118deg, rgba(185, 223, 84, 0.35), transparent 28%),
    linear-gradient(242deg, rgba(240, 93, 35, 0.16), transparent 26%),
    linear-gradient(0deg, rgba(38, 53, 217, 0.1), transparent 46%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1000;
  padding: 0.7rem 1rem;
  color: var(--panel);
  background: var(--ink);
  text-decoration: none;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 2px solid rgba(18, 19, 15, 0.1);
  background: rgba(246, 242, 231, 0.88);
  backdrop-filter: blur(14px);
}

.header-shell,
.footer-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 70px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 12px);
  grid-template-rows: repeat(2, 12px);
  gap: 3px;
  padding: 5px;
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--ink);
}

.brand-mark span:nth-child(1) {
  background: var(--acid);
}

.brand-mark span:nth-child(2) {
  background: var(--orange);
}

.brand-mark span:nth-child(3) {
  background: var(--blue);
}

.brand-mark span:nth-child(4) {
  background: var(--ink);
}

.site-nav,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.site-nav a,
.site-footer a {
  text-decoration: none;
}

.site-nav a:hover,
.site-footer a:hover {
  color: var(--ink);
}

.hero {
  padding: 2.8rem 0 1.4rem;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(260px, 0.58fr);
  gap: 2rem;
  align-items: center;
  min-height: 360px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.9rem;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 0.85rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 6vw, 5rem);
  line-height: 0.94;
  font-weight: 900;
}

.hero-lede {
  max-width: 580px;
  color: var(--ink-2);
  font-size: 1.05rem;
  line-height: 1.62;
}

.hero-actions,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.2rem;
}

.button,
.icon-button,
.segmented {
  border: 2px solid var(--ink);
  color: var(--ink);
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.78rem 1.05rem;
  border-radius: var(--radius);
  font-weight: 900;
  text-decoration: none;
}

.button.primary {
  background: var(--acid);
}

.button.secondary {
  background: var(--panel);
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.segmented:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.button:active:not(:disabled),
.icon-button:active:not(:disabled),
.segmented:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink);
}

.button:disabled {
  opacity: 0.48;
}

.hero-sample {
  justify-self: end;
  width: min(315px, 100%);
  aspect-ratio: 1 / 1;
}

.sample-frame {
  transform: rotate(3deg);
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 12px 12px 0 var(--ink);
  padding: 0.75rem;
  width: 100%;
}

.sample-pixels {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  background: var(--ink);
  image-rendering: pixelated;
}

.sample-pixels span {
  position: absolute;
  left: calc(var(--x) * 16.666%);
  top: calc(var(--y) * 16.666%);
  width: 16.666%;
  height: 16.666%;
  background: var(--c);
}

.sample-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.6375rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sample-meta strong {
  color: var(--ink);
}

.product-band {
  padding: 3rem 0 4rem;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.2rem;
  align-items: start;
}

.workspace,
.control-panel {
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workspace {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border-bottom: 3px solid var(--ink);
  background: #e7e0cf;
}

.tool-title,
.toolbar-actions {
  display: flex;
  gap: 0.55rem;
}

.tool-title,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.tool-title {
  gap: 0.45rem;
  min-height: 40px;
  color: var(--ink);
}

.icon-button {
  border-radius: var(--radius);
  width: 42px;
  height: 42px;
  padding: 0;
}

.canvas-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 620px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #d7d0c1 25%, transparent 25%),
    linear-gradient(-45deg, #d7d0c1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d7d0c1 75%),
    linear-gradient(-45deg, transparent 75%, #d7d0c1 75%),
    #eee8da;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.canvas-stage.dragging {
  outline: 5px solid var(--orange);
  outline-offset: -14px;
}

.upload-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(520px, calc(100% - 2rem));
  min-height: 310px;
  padding: 2rem;
  text-align: center;
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  background: rgba(255, 253, 245, 0.92);
}

.upload-state.hidden {
  display: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-bottom: 1rem;
  color: var(--ink);
  border: 2px solid var(--ink);
  background: var(--orange);
  box-shadow: 6px 6px 0 var(--ink);
}

.upload-icon svg {
  width: 2rem;
  height: 2rem;
}

.upload-state h2 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}

.upload-state p {
  min-height: 3.2em;
  max-width: 400px;
  margin-bottom: 1.4rem;
  color: var(--muted);
  line-height: 1.6;
}

.preview-wrap {
  display: none;
  width: 640px;
  height: 420px;
  max-width: calc(100% - 2rem);
  max-height: calc(100% - 2rem);
  position: relative;
  border: 3px solid var(--ink);
  box-shadow: 10px 10px 0 rgba(18, 19, 15, 0.88);
  background: var(--panel);
}

.preview-wrap.visible {
  display: block;
}

#preview-canvas,
#grid-overlay {
  display: block;
  width: 100%;
  height: 100%;
}

#preview-canvas {
  image-rendering: pixelated;
  touch-action: none;
}

#grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.78rem 0.95rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  border-top: 3px solid var(--ink);
  background: #e7e0cf;
}

.control-panel {
  position: sticky;
  top: 88px;
}

.panel-section {
  padding: 1rem;
  border-bottom: 3px solid var(--ink);
}

.panel-section:last-child {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2,
.panel-section h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.section-heading span,
#output-size {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.control,
.select-control {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.control.is-collapsed {
  display: none;
}

.control span,
.select-control span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--orange);
}

select {
  width: 100%;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  font-weight: 800;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.2rem;
  padding: 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #f8f4e9;
}

.toggle-row span {
  display: grid;
  gap: 0.2rem;
}

.toggle-row small {
  color: var(--muted);
  line-height: 1.4;
}

input[type="checkbox"] {
  width: 46px;
  height: 26px;
  accent-color: var(--blue);
}

.export-actions .button {
  flex: 1 1 132px;
}

.insights p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.content-section {
  padding: 4.5rem 0;
}

.use-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.use-grid article,
    .feature-list,
.faq-list details {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 6px 6px 0 var(--ink);
}

.use-grid article {
  min-height: 250px;
  padding: 1.2rem;
}

.tile-index {
  display: inline-flex;
  margin-bottom: 3.5rem;
  color: var(--orange);
  font-weight: 900;
}

.use-grid h2,
  .feature-summary h2,
.faq h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  line-height: 1;
}

.use-grid p,
  .feature-summary p,
.faq p {
  color: var(--muted);
  line-height: 1.7;
}

.feature-grid,
.faq-grid {
  display: grid;
  grid-template-columns: 0.78fr 1fr;
  gap: 2rem;
  align-items: start;
}

.feature-list {
  overflow: hidden;
}

.feature-list > div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 2px solid var(--ink);
}

.feature-list > div:last-child {
  border-bottom: 0;
}

.feature-list strong {
  color: var(--ink);
}

.feature-list span {
  color: var(--muted);
  line-height: 1.55;
}

.faq-list {
  display: grid;
  gap: 0.8rem;
}

.faq-list details {
  padding: 1rem 1.1rem;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 900;
}

.faq-list p {
  margin: 0.7rem 0 0;
}

.site-footer {
  border-top: 2px solid rgba(18, 19, 15, 0.12);
  background: #e7e0cf;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  z-index: 200;
  min-width: min(360px, calc(100% - 32px));
  padding: 0.85rem 1rem;
  color: var(--panel);
  text-align: center;
  font-weight: 900;
  border: 2px solid var(--ink);
  background: var(--ink);
  box-shadow: 6px 6px 0 var(--orange);
  visibility: hidden;
  transform: translate(-50%, calc(100% + 2.5rem));
  transition: transform 0.22s ease, visibility 0.22s ease;
}

.toast.show {
  visibility: visible;
  transform: translate(-50%, 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .hero {
    padding-top: 3.5rem;
  }

  .hero-grid {
    min-height: 0;
  }

  .hero-grid,
  .app-shell,
  .feature-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }

  .hero-sample {
    justify-self: start;
  }

  .canvas-stage {
    min-height: 520px;
  }

  .control-panel {
    position: static;
  }

  .use-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .header-shell,
  .footer-shell {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 0.8rem 0;
  }

  .site-nav,
  .site-footer nav {
    width: 100%;
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  h1 {
    font-size: clamp(2.7rem, 17vw, 4.6rem);
  }

  .hero-actions,
  .export-actions,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    flex-direction: row;
  }

.canvas-stage {
    min-height: 390px;
  }

  .status-row,
  .feature-list > div {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .sample-frame {
    transform: rotate(0deg);
    box-shadow: 8px 8px 0 var(--ink);
  }
}
