:root {
  --paper: #ffffff;
  --ink: #111111;
  --quiet: #5c5c5c;
  --line: #111111;
  --hairline: rgba(128, 128, 128, 0.45);
  --accent: #c4009a;
  --on-accent: #ffffff;
  --serif: "Times New Roman", Times, serif;
  --display: var(--serif);
  --display-settings: normal;
  --gutter: clamp(16px, 2.6vw, 32px);
}

:root[data-lux="on"] {
  --paper: #14040f;
  --ink: #fdeef8;
  --quiet: #d9b8ce;
  --line: #fdeef8;
  --accent: #ff5fdc;
  --on-accent: #14040f;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  position: relative;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  transition: background-color 0.35s ease, color 0.35s ease;
}

main, .footer, .preview-note { position: relative; z-index: 1; }

img { display: block; max-width: 100%; }

a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button { font: inherit; letter-spacing: inherit; color: inherit; }

/* Header: sticky, name top left, menu in a row */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "nav mark tools";
  align-items: center;
  gap: 4px 24px;
  padding: 8px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  transition: background-color 0.35s ease;
}

.wordmark { grid-area: mark; display: block; text-align: center; text-decoration: none; white-space: nowrap; }
.wordmark strong {
  font-family: var(--display);
  font-variation-settings: var(--display-settings);
  font-size: clamp(30px, 3.6vw, 42px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.14em;
  margin-right: -0.14em;
}

/* Display font: the name, headings and piece names */
h1, h2, .card-name, .ask h2, .details dt {
  font-family: var(--display);
  font-variation-settings: var(--display-settings);
}
.font-test {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 30;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  background: var(--paper);
  font-size: 14px;
}

.nav { grid-area: nav; display: flex; flex-wrap: wrap; gap: 0 24px; }
.nav a { display: inline-block; padding: 10px 0; text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { text-decoration: underline; }

.tools { grid-area: tools; display: flex; justify-content: flex-end; align-items: center; gap: 18px; }
.etsy-link { padding: 10px 0; text-decoration: none; white-space: nowrap; }
.etsy-link:hover { text-decoration: underline; }

.lux-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
}
.lux-track {
  position: relative;
  width: 38px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.lux-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}
[aria-checked="true"] .lux-track::after { transform: translateX(18px); background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* Section titles */
.section { padding: 28px var(--gutter) 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 19px; font-weight: 400; }

/* Home: a mosaic of pieces */
.mosaic {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.mosaic > :first-child { grid-column: span 2; grid-row: span 2; }
.mosaic > :first-child .card-name { font-size: 18px; }

.lines { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.line-count { display: block; color: var(--quiet); font-size: 15px; }

/* A piece */
.card {
  display: block;
  padding: 8px 8px 12px;
  border: 1px solid var(--accent);
  text-align: center;
  text-decoration: none;
}
.card:hover { color: inherit; outline: 1px solid var(--accent); }
.card:hover .card-name { color: var(--accent); }
.card-photo { position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; background: rgba(128, 128, 128, 0.08); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-line { display: block; margin-top: 10px; color: var(--quiet); font-size: 14px; font-style: italic; }
.card-name { display: block; margin-top: 2px; font-size: 15px; font-weight: 700; line-height: 1.25; text-transform: uppercase; letter-spacing: 0.04em; }
.card-price { display: block; margin-top: 2px; color: var(--quiet); font-size: 15px; }

/* Line drawing standing in for a photo */
.sketch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--accent);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(196, 0, 154, 0.07) 14px 15px),
    rgba(128, 128, 128, 0.06);
}
.sketch svg { width: 62%; height: auto; overflow: visible; }

.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-11deg);
  padding: 6px 14px 7px;
  border: 3px double #c4009a;
  background: #ffffff;
  color: #c4009a;
  font-size: clamp(20px, 2.6vw, 30px);
  font-style: italic;
  white-space: nowrap;
}

/* Shop */
.shop-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 22px;
  padding: 14px var(--gutter) 0;
}
.filter { display: flex; flex-direction: column; }
.filter label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.filter select {
  min-height: 40px;
  padding: 4px 22px 4px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.filter select option { background: var(--paper); color: var(--ink); }
.result-count { margin: 0 0 10px auto; color: var(--quiet); font-size: 15px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 28px 14px;
  padding: 18px var(--gutter) 40px;
}
.empty { grid-column: 1 / -1; color: var(--quiet); }

/* Commission call */
.ask {
  margin: 48px var(--gutter) 0;
  padding: clamp(28px, 5vw, 56px) var(--gutter);
  border: 1px solid var(--accent);
  text-align: center;
}
.ask h2 { margin: 0; font-size: clamp(24px, 3.4vw, 36px); font-weight: 400; font-style: italic; }
.ask p { margin: 8px 0 20px; color: var(--quiet); }
.ask .ask-button { display: inline-block; width: auto; padding: 12px 28px; }

/* Piece page */
.page-head { padding: 28px var(--gutter) 0; }
.page-head h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); font-weight: 400; }
.page-head p { margin: 6px 0 0; color: var(--quiet); max-width: 62ch; }

.piece {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "cover buy" "rest buy";
  gap: 14px clamp(20px, 3vw, 44px);
  padding: 20px var(--gutter) 24px;
  align-items: start;
}
.piece-cover { grid-area: cover; }
.piece-cover img { width: 100%; }
.piece-cover .sketch { aspect-ratio: 2 / 3; }
.piece > .gallery { grid-area: rest; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.gallery img { width: 100%; }
.buy { grid-area: buy; display: flex; flex-direction: column; gap: 14px; }
.buy .back { font-size: 15px; }
.buy .back a { text-decoration: none; }
.buy .back a:hover { text-decoration: underline; }
.more { padding-bottom: 12px; }

/* Shop: the sold archive heading spans the grid */
.grid-break { grid-column: 1 / -1; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.grid-break h2 { margin: 0; font-size: 24px; font-weight: 400; font-style: italic; color: var(--accent); }
.grid-break p { margin: 4px 0 0; color: var(--quiet); }

/* Home strapline */
.strap { margin: 0; padding: 22px var(--gutter) 0; font-family: var(--display); font-variation-settings: var(--display-settings); font-size: clamp(20px, 2.4vw, 26px); font-style: italic; font-weight: 400; text-align: center; }

/* First-visit hint at the Lux switch */
.tools { position: relative; }
.lux-hint {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  background: var(--paper);
  color: var(--accent);
  font-size: 14px;
  font-style: italic;
  white-space: nowrap;
  animation: hint 7s ease forwards;
}
@keyframes hint {
  0%, 12% { opacity: 0; transform: translateY(-4px); }
  20%, 85% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
.buy h1 { margin: 0; font-size: clamp(25px, 3vw, 34px); font-weight: 700; line-height: 1.12; text-transform: uppercase; letter-spacing: 0.03em; }
.buy p { margin: 0; }
.buy .line-name { font-style: italic; }
.buy .note { color: var(--quiet); }

.made-to-order { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border: 1px solid var(--accent); }
.made-to-order h2 { margin: 0; font-size: 22px; line-height: 1.15; }

.button {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button[disabled] { background: none; color: var(--accent); border-color: var(--accent); font-style: italic; cursor: default; }
.button[aria-disabled="true"], .button[aria-disabled="true"]:hover { background: var(--ink); border-color: var(--line); color: var(--paper); opacity: 0.55; cursor: default; }

.details { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 0; font-size: 16px; }
.details div { padding-top: 10px; border-top: 1px solid var(--hairline); }
.details dt { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.details dd { margin: 2px 0 0; }

.measure { width: 100%; border-collapse: collapse; font-size: 16px; }
.measure caption { padding-bottom: 4px; text-align: left; }
.measure th, .measure td { padding: 5px 0; border-top: 1px solid var(--hairline); text-align: left; font-weight: 400; }
.measure td { text-align: right; color: var(--quiet); }

/* Text pages */
.prose { max-width: 680px; padding: 16px var(--gutter) 56px; }
.prose h2 { margin: 36px 0 6px; font-size: 22px; font-weight: 400; }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.todo { color: var(--accent); }

/* Commission form */
.form { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; }
.form label { margin-top: 10px; font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: 0.05em; }
.form .optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--quiet); }
.form input, .form select, .form textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.form textarea { resize: vertical; }
.form .button { margin-top: 18px; }

/* Footer */
.footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 24px;
  margin-top: 36px;
  padding: 28px var(--gutter) 22px;
  border-top: 1px solid var(--line);
  font-size: 16px;
}
.footer ul { margin: 0; padding: 0; list-style: none; }
.footer li a { display: inline-block; padding: 4px 0; }
.footer p { margin: 0 0 6px; }
.preview-note { padding: 0 var(--gutter) 22px; color: var(--quiet); font-size: 14px; }

/* Lux mode: glitter, words that light up, and a UV echo of the trail */
.spark {
  position: fixed;
  z-index: 50;
  color: var(--accent);
  line-height: 1;
  pointer-events: none;
  animation: spark 0.9s ease-out forwards;
}
@keyframes spark {
  from { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
  to { opacity: 0; transform: translate(var(--dx), var(--dy, 34px)) scale(0.2) rotate(120deg); }
}

.uv { position: absolute; top: 0; left: 0; width: 100%; height: 0; z-index: 0; pointer-events: none; }
.echo {
  position: absolute;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 4px var(--accent), 0 0 12px var(--accent);
  animation: echo 9s ease-in forwards;
}
@keyframes echo {
  0% { opacity: 0.9; }
  15% { opacity: 0.55; }
  100% { opacity: 0; }
}

[data-lux="on"] .w { transition: background-color 1.4s ease, color 1.4s ease, text-shadow 1.4s ease; }
[data-lux="on"] .w.lit {
  background: var(--accent);
  color: var(--on-accent);
  text-shadow: none;
  transition: none;
}
[data-lux="on"] .wordmark strong { text-shadow: 0 0 10px rgba(255, 95, 220, 0.45); }
[data-lux="on"] .stamp { box-shadow: 0 0 14px #ff5fdc; }

@media (max-width: 900px) {
  .mosaic, .lines { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mosaic > :first-child { grid-row: span 1; }
  .mosaic > :first-child .card-photo { aspect-ratio: 4 / 3; }
}

@media (max-width: 760px) {
  .header { grid-template-columns: 1fr auto; grid-template-areas: "mark mark" "nav tools"; gap: 0 14px; padding-bottom: 0; }
  .wordmark strong { font-size: 30px; }
  .nav { gap: 0 20px; }
  .piece { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "cover" "buy" "rest"; gap: 20px; }
  .shop-bar { gap: 6px 12px; }
  .filter { flex: 1 1 0; min-width: 0; }
  .filter select { width: 100%; padding-right: 14px; font-size: 15px; }
  .result-count { margin: 0; width: 100%; }
}

@media (max-width: 420px) {
  .mosaic, .lines { gap: 10px; }
  .card { padding: 6px 6px 10px; }
  .card-name { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Home, before the first real pieces: a note in place of the "New in" mosaic. */
.mosaic > .first-drop { grid-column: 1 / -1; grid-row: auto; max-width: 42em; }
.first-drop p { margin: 0; font-size: 18px; }

/* Contact form spam trap, invisible to people. */
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
