@font-face {
  font-family: "Sa Pizzedda";
  src: url("./assets/ForSaPizzedda-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Sa Pizzedda Crunchy";
  src: url("./assets/ForSaPizzedda-Crunchy-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --paper: #f6edda;
  --ink: #181813;
  --brick: #a92d1b;
  --sand: #c49359;
  --olive: #314232;
  --line: rgba(24, 24, 19, 0.22);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(169, 45, 27, 0.34), transparent 27rem),
    var(--ink);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--sand);
  outline-offset: 2px;
}

.shell {
  width: min(1580px, calc(100% - 32px));
  margin: 16px auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 54px;
  padding-top: 6px;
  border-radius: 13px;
  background: var(--brick);
  color: var(--paper);
  font-family: "Sa Pizzedda Crunchy", sans-serif;
  font-size: 2.15rem;
  line-height: 1;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-family: "Sa Pizzedda", sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
}

.brand-copy small,
.topbar-note {
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-copy small {
  color: rgba(24, 24, 19, 0.62);
}

.topbar-note {
  display: flex;
  align-items: center;
  gap: 9px;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--brick);
  box-shadow: 0 0 0 5px rgba(169, 45, 27, 0.13);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  min-height: calc(100vh - 116px);
}

.controls {
  background: #fbf7ed;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.control-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.control-intro,
.section-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--brick);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow.light {
  color: var(--sand);
}

h1 {
  margin: 0;
  font-family: "Sa Pizzedda Crunchy", sans-serif;
  font-size: clamp(2.35rem, 4vw, 3.2rem);
  font-weight: 400;
  line-height: 0.9;
}

.icon-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 1.4rem;
  transition: transform 180ms ease, background 180ms ease;
}

.icon-button:hover {
  transform: rotate(-28deg);
  background: #fff;
}

.input-stack {
  display: grid;
  gap: 15px;
}

.input-stack label,
.range-grid label {
  display: grid;
  gap: 7px;
  color: rgba(24, 24, 19, 0.7);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.06em;
}

.input-stack input[type="text"] {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(24, 24, 19, 0.3);
  border-radius: 10px;
  background: transparent;
  padding: 0 13px;
  color: var(--ink);
  font-family: "Sa Pizzedda", sans-serif;
  font-size: 1.2rem;
}

.input-stack input[type="text"]:focus {
  border-color: var(--brick);
  background: #fff;
}

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

.event-button {
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 760;
  transition: transform 150ms ease, border 150ms ease, background 150ms ease;
}

.event-button span {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  color: var(--brick);
  font-family: "Sa Pizzedda Crunchy", sans-serif;
  font-size: 1rem;
}

.event-button:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
}

.event-button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.event-button.is-active span {
  color: var(--sand);
}

.font-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.layout-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.layout-choice {
  min-height: 78px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
}

.layout-choice small {
  font-size: 0.72rem;
  font-weight: 820;
}

.layout-choice.is-active {
  border-color: var(--brick);
  background: rgba(169, 45, 27, 0.08);
  box-shadow: inset 0 0 0 1px var(--brick);
}

.layout-icon {
  position: relative;
  width: 46px;
  height: 26px;
  display: block;
}

.layout-icon i {
  position: absolute;
  display: block;
  background: currentColor;
}

.signature-icon i:first-child {
  top: 2px;
  left: 2px;
  width: 32px;
  height: 8px;
  border-radius: 3px;
}

.signature-icon i:last-child {
  bottom: 2px;
  left: 9px;
  width: 28px;
  height: 8px;
  border-radius: 999px;
}

.ribbon-icon i:first-child,
.ribbon-icon i:last-child {
  left: 0;
  width: 46px;
  height: 7px;
  transform: rotate(-8deg);
}

.ribbon-icon i:first-child { top: 5px; }
.ribbon-icon i:last-child { bottom: 4px; }

.stamp-icon i {
  inset: 0 10px;
  border: 3px solid currentColor;
  border-radius: 8px;
  background: transparent;
}

.font-choice {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  padding: 10px 14px;
  color: inherit;
}

.font-choice span {
  font-size: 2.2rem;
  line-height: 1;
}

.font-choice small {
  font-size: 0.75rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.font-choice.is-active {
  border-color: var(--brick);
  background: rgba(169, 45, 27, 0.08);
  box-shadow: inset 0 0 0 1px var(--brick);
}

.simple-sample {
  font-family: "Sa Pizzedda", sans-serif;
}

.crunchy-sample {
  font-family: "Sa Pizzedda Crunchy", sans-serif;
}

.section-line > span {
  color: rgba(24, 24, 19, 0.6);
  font-size: 0.75rem;
  font-weight: 760;
}

.palette-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.palette-button {
  min-height: 51px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #fff;
}

.palette-button span {
  display: block;
}

.palette-button.is-active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px #fbf7ed, 0 0 0 4px var(--ink);
}

.color-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.color-inputs label {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: rgba(24, 24, 19, 0.62);
  font-size: 0.68rem;
  font-weight: 760;
}

.color-inputs input[type="color"] {
  width: 100%;
  height: 31px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
}

.color-inputs input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-inputs input[type="color"]::-webkit-color-swatch {
  border: 0;
}

.range-grid {
  display: grid;
  gap: 15px;
}

.range-grid label > span {
  display: flex;
  justify-content: space-between;
}

.range-grid output {
  color: var(--brick);
  font-weight: 850;
}

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

.brand-shot {
  position: relative;
  min-height: 118px;
  margin: 20px 24px 24px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(0deg, rgba(24, 24, 19, 0.78), transparent 72%),
    url("./assets/sa-pizzedda-food.jpg") center 43% / cover;
}

.brand-shot span {
  padding: 15px;
  color: #fff;
  font-family: "Sa Pizzedda Crunchy", sans-serif;
  font-size: 1.35rem;
}

.studio {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(480px, 1fr) auto;
  background: #24231e;
}

.studio-toolbar,
.export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  color: var(--paper);
}

.studio-toolbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.preview-meta {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 730;
}

.toolbar-actions,
.export-actions {
  display: flex;
  gap: 9px;
}

.secondary-button,
.primary-button,
.download-button {
  min-height: 44px;
  border-radius: 9px;
  padding: 0 16px;
  font-weight: 800;
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: transparent;
  color: var(--paper);
}

.primary-button {
  border: 1px solid var(--brick);
  background: var(--brick);
  color: #fff;
}

.secondary-button:hover,
.primary-button:hover,
.download-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.canvas-wrap {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(22px, 4vw, 54px);
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    #1c1b17;
  background-size: 28px 28px;
}

.pattern-canvas {
  width: min(100%, 820px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 10px solid #f7f2e7;
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 0 30px 75px rgba(0, 0, 0, 0.42);
  transition: transform 300ms cubic-bezier(0.2, 0.78, 0.2, 1);
}

.pattern-canvas.is-generating {
  transform: scale(0.985) rotate(-0.35deg);
}

.pattern-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-badges {
  position: absolute;
  right: 20px;
  bottom: 17px;
  display: flex;
  gap: 6px;
}

.canvas-badges span {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 6px 9px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.export-bar {
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.export-copy {
  display: grid;
  gap: 3px;
}

.export-copy strong {
  font-family: "Sa Pizzedda", sans-serif;
  font-size: 1.2rem;
}

.export-copy span {
  color: rgba(246, 237, 218, 0.62);
  font-size: 0.76rem;
}

.download-button {
  display: grid;
  align-content: center;
  justify-items: start;
  min-width: 154px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: transparent;
  color: var(--paper);
  text-align: left;
}

.download-button.accent {
  border-color: var(--sand);
  background: var(--sand);
  color: var(--ink);
}

.download-button small {
  opacity: 0.65;
  font-size: 0.66rem;
  font-weight: 650;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 18px);
  border-radius: 999px;
  background: #fff;
  padding: 11px 17px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 760;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 1050px) {
  .shell {
    width: min(100% - 20px, 900px);
    margin: 10px auto;
  }

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

  .controls {
    border-right: 0;
  }

  .studio {
    min-height: 760px;
  }

  .brand-shot {
    min-height: 160px;
  }
}

@media (max-width: 660px) {
  .shell {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-note {
    max-width: 135px;
    padding-top: 8px;
    font-size: 0.62rem;
    line-height: 1.45;
  }

  .control-section {
    padding-inline: 18px;
  }

  .brand-shot {
    margin-inline: 18px;
  }

  .studio {
    grid-template-rows: auto auto auto;
    min-height: 0;
  }

  .studio-toolbar,
  .export-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions,
  .export-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .canvas-wrap {
    padding: 20px;
  }

  .pattern-canvas {
    border-width: 6px;
  }

  .canvas-badges {
    display: none;
  }

  .download-button {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
