@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap");
:root {
  --paper: #f7f4eb;
  --ink: #23352d;
  --red: #ad3d30;
  --line: #d8d8c9;
  --soft: #e9eddf;
  --muted: #6c7468;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    15px "DM Sans",
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line);
  padding: 11px 17px;
  border-radius: 5px;
  color: var(--ink);
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: var(--soft);
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--red);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #9ebd8d;
  outline-offset: 3px;
}
.primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.primary:hover {
  background: #963326;
}
.secondary {
  display: inline-block;
  padding: 13px 22px;
  border: 1px solid var(--ink);
  border-radius: 4px;
}
.button-link {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 4px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2.6px;
  font-weight: 700;
  text-transform: uppercase;
}
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
header {
  height: 90px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
  gap: 25px;
}
.brand {
  font-size: 25px;
  letter-spacing: -1px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-mark {
  font-size: 27px;
}
.seal {
  font: 15px serif;
  color: var(--red);
  border: 1px solid var(--red);
  padding: 3px;
  transform: rotate(-6deg);
  margin-left: 5px;
}
nav {
  display: flex;
  gap: 28px;
  font-size: 13px;
}
.header-note {
  font-size: 12px;
  color: var(--muted);
}
h1,
h2,
h3 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-weight: 400;
}
h1 {
  font-size: clamp(42px, 5.1vw, 76px);
  line-height: 1.16;
  letter-spacing: -3px;
  margin: 23px 0;
}
h2 {
  font-size: 34px;
  line-height: 1.3;
  letter-spacing: -1px;
}
.hero {
  min-height: 610px;
  padding: 65px 7vw 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 4vw;
  position: relative;
  overflow: hidden;
}
.hero:before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23b0aa96' filter='url(%23n)' opacity='.4' d='M0 0h160v160H0z'/%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-copy,
.hero-art {
  position: relative;
}
.hero-copy {
  animation: enter 0.65s ease-out;
}
.hero-copy p:not(.eyebrow) {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.8;
}
.hero h1 em {
  font-weight: 400;
  color: var(--red);
}
.hero-actions {
  display: flex;
  gap: 13px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.hero-art {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  animation: enter 0.8s ease-out;
}
.hero-art canvas {
  width: min(100%, 420px);
  image-rendering: pixelated;
  transform: rotate(-6deg);
  filter: drop-shadow(14px 18px 0 #e7e4d9);
  border: 16px solid #eeeada;
  background: #eeeada;
  border-radius: 12px;
}
.art-caption {
  position: absolute;
  right: 0;
  bottom: -20px;
  font: italic 15px Georgia;
  transform: rotate(-5deg);
}
.bamboo {
  position: absolute;
  right: 0;
  top: 0;
  width: 80px;
  height: 210px;
  opacity: 0.25;
  pointer-events: none;
}
.strip {
  display: flex;
  justify-content: space-around;
  gap: 16px;
  padding: 22px 5vw;
  border-block: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.5px;
  background: #eeeede;
}
.section {
  padding: 64px 6vw;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 26px;
}
.section-head h2 {
  margin: 7px 0;
}
.text-link {
  font-size: 13px;
  border-bottom: 1px solid;
  padding-bottom: 4px;
}
.patterns-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px 22px;
}
.pattern-card {
  min-width: 0;
  cursor: pointer;
}
.pattern-thumb {
  background: #e9ebdf;
  aspect-ratio: 1.15;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 3px;
  transition: background 0.2s;
}
.pattern-card:nth-child(4n + 2) .pattern-thumb {
  background: #eee3d5;
}
.pattern-card:nth-child(4n + 3) .pattern-thumb {
  background: #e5e9e8;
}
.pattern-card:nth-child(4n + 4) .pattern-thumb {
  background: #eee5df;
}
.pattern-thumb canvas {
  width: 74%;
  height: auto;
  image-rendering: pixelated;
  transition: transform 0.25s;
}
.pattern-card:hover canvas {
  transform: translateY(-6px) rotate(-3deg);
}
.pattern-title {
  display: flex;
  justify-content: space-between;
  margin: 15px 0 7px;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}
.pattern-meta {
  font-size: 11px;
  color: var(--muted);
}
.story {
  background: var(--ink);
  color: var(--paper);
  padding: 65px 8vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}
.story h2 {
  max-width: 580px;
  margin: 12px 0;
}
.story .eyebrow {
  color: #bac8ac;
}
.story p {
  color: #c5cdbd;
  max-width: 360px;
  line-height: 1.8;
}
.story .secondary {
  color: var(--paper);
  border-color: #8d9a85;
}
footer {
  padding: 30px 6vw;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 12px;
  color: var(--muted);
}
.page-title {
  padding: 45px 6vw 15px;
}
.page-title h1 {
  font-size: 46px;
  letter-spacing: -2px;
  margin: 10px 0;
}
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
input,
select {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fcfaf5;
  color: var(--ink);
  min-width: 0;
}
input[type="range"] {
  padding: 0;
  width: 100%;
  accent-color: var(--red);
}
input[type="color"] {
  padding: 2px;
  width: 44px;
  height: 40px;
}
.filters input {
  flex: 1;
  min-width: 180px;
}
.filters select {
  min-width: 130px;
}
.maker-top {
  display: flex;
  gap: 15px;
  justify-content: space-between;
  align-items: center;
  padding: 24px 4vw;
  border-bottom: 1px solid var(--line);
}
.maker-top h1 {
  font-size: 27px;
  letter-spacing: -1px;
  margin: 0;
}
.maker-top input {
  width: 200px;
  border: 0;
  background: none;
  padding: 4px 0;
  font-weight: 600;
}
.maker-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}
.workspace {
  display: grid;
  grid-template-columns: 235px minmax(250px, 1fr) 220px;
  min-height: 660px;
}
.inspector {
  padding: 25px 20px;
  border-right: 1px solid var(--line);
}
.inspector.right {
  border-right: 0;
  border-left: 1px solid var(--line);
}
.inspector h3 {
  font:
    600 13px "DM Sans",
    sans-serif;
  margin: 0 0 18px;
}
.inspector label,
dialog label {
  display: block;
  font-size: 12px;
  margin: 20px 0 9px;
}
.inspector input[type="number"],
.inspector select {
  width: 100%;
  margin-top: 8px;
}
.inspector .primary {
  width: 100%;
  margin-top: 18px;
}
.upload {
  border: 1px dashed #a9b39d;
  text-align: center;
  padding: 22px 8px;
  cursor: pointer;
  display: block;
  font-size: 12px;
  line-height: 1.8;
}
.upload strong {
  display: block;
  font-size: 24px;
}
.inspector hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.canvas-area {
  background: #e9e9de;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 12px;
  justify-content: center;
  border-bottom: 1px solid #d2d5c6;
}
.tools button {
  padding: 8px 10px;
  font-size: 12px;
  background: var(--paper);
}
.tools button.active {
  background: var(--ink);
  color: white;
}
.board-wrap {
  flex: 1;
  min-height: 460px;
  max-height: 650px;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 30px;
  position: relative;
}
.board-wrap canvas {
  box-shadow: 0 12px 40px #26352d17;
  touch-action: none;
  max-width: none;
}
.board-bottom {
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}
.swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 16px 0;
}
.swatch {
  padding: 0;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px #c4c9bb;
}
.swatch.active {
  box-shadow: 0 0 0 3px var(--red);
}
.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  cursor: pointer;
}
.color-row i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #0002;
}
.color-row b {
  margin-left: auto;
}
.count-total {
  font-family: Georgia, serif;
  font-size: 38px;
  margin: 10px 0;
}
.detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6vw;
  align-items: center;
}
.detail .pattern-thumb {
  aspect-ratio: 1;
}
.detail h1 {
  font-size: 46px;
}
.detail-stats {
  display: flex;
  gap: 30px;
  margin: 30px 0;
}
.detail-stats b {
  font-size: 25px;
  display: block;
}
.detail-stats span {
  font-size: 12px;
  color: var(--muted);
}
.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.project-row h3 {
  font-size: 18px;
  margin: 0 0 8px;
}
.empty {
  text-align: center;
  padding: 70px 10px;
}
.notice {
  background: #ebe6d8;
  padding: 12px;
  font-size: 11px;
  line-height: 1.6;
}
.check {
  display: flex !important;
  align-items: center;
  gap: 9px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 35px;
  max-width: 490px;
  width: calc(100% - 30px);
}
dialog::backdrop {
  background: #14241baa;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 27px;
}
.close {
  float: right;
  border: 0;
  font-size: 24px;
  padding: 0 8px;
}
.export-actions {
  display: grid;
  gap: 9px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: white;
  padding: 13px 22px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  z-index: 99;
  transition: 0.2s;
  max-width: 90vw;
  font-size: 13px;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 1000px) {
  .header-note {
    display: none;
  }
  .workspace {
    grid-template-columns: 200px minmax(200px, 1fr);
  }
  .inspector.right {
    grid-column: 1/-1;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .patterns-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .hero {
    min-height: 550px;
  }
  .hero-art canvas {
    border-width: 10px;
  }
  .art-caption {
    font-size: 12px;
  }
}
@media (max-width: 650px) {
  header {
    height: 78px;
    padding: 0 5vw;
    gap: 10px;
    flex-wrap: wrap;
    align-content: center;
  }
  .brand {
    font-size: 20px;
  }
  nav {
    font-size: 11px;
    gap: 14px;
  }
  .seal {
    display: none;
  }
  .hero {
    grid-template-columns: 1fr;
    padding: 35px 7vw 45px;
    gap: 35px;
  }
  .hero-copy p:not(.eyebrow) {
    font-size: 14px;
  }
  .hero h1 {
    font-size: 48px;
    letter-spacing: -2px;
    margin: 15px 0;
  }
  .hero-art {
    padding: 0 30px;
  }
  .hero-art canvas {
    width: 260px;
  }
  .art-caption {
    bottom: -10px;
    right: 16px;
  }
  .strip {
    font-size: 10px;
    padding: 16px 15px;
    flex-wrap: wrap;
  }
  .section {
    padding: 35px 5vw;
  }
  .section-head h2 {
    font-size: 26px;
  }
  .patterns-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px 13px;
  }
  .pattern-title {
    font-size: 13px;
  }
  .pattern-meta {
    font-size: 10px;
  }
  .story {
    display: block;
    padding: 40px 7vw;
  }
  .story h2 {
    font-size: 30px;
  }
  .story .secondary {
    margin-top: 15px;
  }
  footer {
    font-size: 10px;
    flex-wrap: wrap;
  }
  .page-title {
    padding: 30px 5vw 5px;
  }
  .page-title h1 {
    font-size: 38px;
  }
  .detail {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .detail h1 {
    font-size: 36px;
  }
  .maker-top {
    padding: 15px;
    align-items: start;
    flex-direction: column;
  }
  .maker-top h1 {
    font-size: 22px;
  }
  .maker-actions {
    flex-wrap: wrap;
    font-size: 11px;
  }
  .maker-actions button {
    padding: 8px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .inspector {
    border-right: 0;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .inspector > h3,
  .inspector > hr,
  .inspector > .notice {
    grid-column: 1/-1;
  }
  .inspector hr {
    margin: 5px 0;
  }
  .inspector label {
    margin: 0;
  }
  .inspector .primary {
    margin: 0;
  }
  .inspector .upload {
    padding: 8px;
  }
  .inspector .upload strong {
    font-size: 18px;
  }
  .inspector.right {
    display: block;
  }
  .board-wrap {
    min-height: 380px;
    max-height: 500px;
    padding: 20px;
  }
  .canvas-area {
    order: -1;
  }
  .swatches {
    grid-template-columns: repeat(10, 1fr);
  }
  .project-row {
    flex-wrap: wrap;
  }
  .filters {
    gap: 8px;
  }
  .filters select {
    min-width: 110px;
    flex: 1;
  }
  .header-note {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}

.swatches {
  max-height: 245px;
  overflow-y: auto;
  padding: 4px;
}
.color-row:hover {
  background: #e9eddf;
}
.brand:focus {
  color: var(--ink);
}
#source-preview {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  margin: 10px 0;
}
#source-preview[hidden],
#crop-fields[hidden] {
  display: none;
}
#crop-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.color-row {
  width: 100%;
  text-align: left;
  border-radius: 4px;
  background: transparent;
}
.color-row.active {
  outline: 2px solid var(--red);
  background: #fff2de;
}
#save-recovery {
  margin: 0 5% 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filters {
  flex-wrap: wrap;
}
.filters select {
  min-width: 135px;
}
.swatches {
  max-height: 340px;
  overflow: auto;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #b34c38;
  outline-offset: 3px;
}
@media (max-width: 600px) {
  .filters > * {
    flex: 1 1 45%;
  }
  .export-actions {
    display: flex;
    flex-wrap: wrap;
  }
  .tools {
    gap: 5px;
  }
  .tools button {
    padding: 9px;
    font-size: 12px;
  }
  .workspace {
    overflow: hidden;
  }
  .board-wrap {
    max-width: 100%;
    min-height: 320px;
  }
  .maker-top {
    gap: 14px;
  }
  .maker-actions {
    flex-wrap: wrap;
  }
}
