:root {
  --bg: #ffffff;
  --ink: #1a1a1a;
  --muted: #777;
}

html { scroll-padding-top: 8rem; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2rem 2.5rem;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.logo {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.95rem;
  transition: color 0.2s;
}

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

.site-header nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 0;
}

.cart-trigger {
  margin-left: 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 0.2s;
}

.cart-trigger:hover,
.cart-trigger:focus-visible { color: var(--ink); }

.cart-count {
  display: inline-grid;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
}

main { padding: 2.5rem 2.5rem 0; }

.collection { margin-bottom: 4rem; }

.collection,
.shop,
.about,
.signup {
  scroll-margin-top: 8rem;
}

.collection-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-bottom: 1px solid #eee;
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
}

.gallery {
  column-count: 3;
  column-gap: 2rem;
}

.gallery figure {
  margin: 0 0 2rem;
  break-inside: avoid;
}

.artwork-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.artwork-open:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 5px;
}

.gallery img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  background: #f4f4f4;
  transition: opacity 0.3s, transform 0.3s;
}

@media (max-width: 900px) {
  .gallery { column-count: 2; }
}

@media (max-width: 560px) {
  .gallery { column-count: 1; }
}

.gallery figure:hover img {
  opacity: 0.92;
  transform: translateY(-3px);
}

.gallery figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.gallery-print-price {
  color: inherit;
  font: inherit;
  font-style: italic;
  line-height: inherit;
  text-align: right;
  white-space: nowrap;
}

.gallery-shop-status {
  margin: 0 0 2rem;
  padding: 0.75rem 1rem;
  border: 1px solid #eee;
  color: var(--muted);
  font-size: 0.88rem;
}

.gallery-shop-status:empty { display: none; }
.gallery-shop-status.error { color: #b3261e; }
.gallery-shop-status.success { color: #1a7f37; }

.shop {
  margin: 1rem 0 5rem;
  padding: 2.25rem 0 0;
  border-top: 1px solid #eee;
}

.shop-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.shop-heading h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.shop-heading > p {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.shop-card {
  min-width: 0;
}

.shop-card-open {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.shop-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
  border-radius: 2px;
  background: #f4f4f4;
}

.shop-card-open:hover img,
.shop-card-open:focus-visible img {
  opacity: 0.92;
  transform: translateY(-3px);
}

.shop-card-open:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 5px;
}

.shop-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
}

.shop-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.shop-kind {
  color: var(--muted);
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-description {
  min-height: 2.8em;
  margin: 0.45rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.shop-card-price {
  margin: 0.25rem 0 0;
  color: var(--ink);
  font-size: 0.86rem;
}

.product-dialog,
.cart-dialog {
  border: 0;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}

.product-dialog::backdrop,
.cart-dialog::backdrop {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(5px);
}

.product-dialog {
  width: min(960px, calc(100vw - 3rem));
  max-height: calc(100vh - 3rem);
  padding: 0;
  overflow: auto;
}

.dialog-close {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.product-dialog > .dialog-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 1;
}

.product-dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  min-height: 560px;
}

.product-dialog-art {
  display: grid;
  min-height: 560px;
  padding: 2.25rem;
  place-items: center;
  background: #f6f6f4;
}

.product-dialog-art img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.product-dialog-details {
  display: flex;
  padding: 4.5rem 3rem 3rem;
  flex-direction: column;
  justify-content: center;
}

.product-dialog-details h2,
.cart-dialog h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.product-dialog-details > h2 {
  margin-bottom: 2rem;
  line-height: 1.3;
}

.product-dialog-form > label,
.quantity-field span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-dialog-form select,
.quantity-field input {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #bbb;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.product-dialog-actions {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: end;
  margin-top: 1.2rem;
}

.primary-button {
  min-height: 2.8rem;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.primary-button:hover { opacity: 0.84; }

.primary-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.cart-summary > p,
.test-checkout-note {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.cart-dialog {
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin-right: 1rem;
  padding: 2rem;
  overflow: auto;
}

.cart-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #eee;
}

.cart-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1.2rem 0;
  border-bottom: 1px solid #eee;
}

.cart-item img {
  width: 72px;
  height: 90px;
  object-fit: cover;
  background: #f4f4f4;
}

.cart-item h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.cart-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.cart-item-controls button {
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.cart-item-controls .cart-item-remove {
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.cart-item-price {
  font-size: 0.88rem;
  white-space: nowrap;
}

.cart-empty {
  margin: 3rem 0;
  color: var(--muted);
  text-align: center;
}

.cart-summary { padding-top: 1.5rem; }

.cart-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 1rem;
}

.cart-checkout {
  width: 100%;
  margin-top: 1.25rem;
}

.test-checkout-note {
  padding: 0.85rem;
  border: 1px solid #e7e2d5;
  background: #faf8f1;
  color: #5f5744;
}

.cart-message {
  min-height: 1.4em;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.cart-message.error { color: #b3261e; }

.shop-status {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.shop-status.error { color: #b3261e; }
.shop-status.success { color: #1a7f37; }

.about {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  align-items: flex-start;
  max-width: 900px;
  margin: 2rem auto 5rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
}

.about-photo {
  flex: 1 1 240px;
  max-width: 320px;
}

.about-photo img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}

.about-text {
  flex: 2 1 320px;
}

.about-text h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 0;
}

.about-text h2:not(:first-child) { margin-top: 2rem; }

.about-text a { color: var(--ink); }

.signup {
  border-top: 1px solid #eee;
  padding: 4rem 2.5rem;
  text-align: center;
}

.signup h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.signup > p {
  margin: 0 auto 1.75rem;
  max-width: 420px;
  color: var(--ink);
}

.signup-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 440px;
  margin: 0 auto;
}

.signup-form input[type="email"] {
  flex: 1 1 240px;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
}

.signup-form input[type="email"]:focus {
  outline: none;
  border-color: var(--ink);
}

.signup-form button {
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s;
}

.signup-form button:hover { opacity: 0.85; }

.signup-form button:disabled {
  opacity: 0.5;
  cursor: default;
}

.signup-status {
  min-height: 1.2em;
  margin: 1rem auto 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.signup-status.success { color: #1a7f37; }
.signup-status.error { color: #b3261e; }

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

footer {
  border-top: 1px solid #eee;
  padding: 2rem 2.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.title-editor-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 4rem 2.5rem 7rem;
}

.title-editor-intro {
  max-width: 680px;
  margin-bottom: 3rem;
}

.title-editor-intro h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.title-editor-intro > p:last-child {
  margin: 1rem 0 0;
  color: var(--muted);
}

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

.title-editor-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.title-editor-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 620px;
  object-fit: contain;
  object-position: left bottom;
  background: #f4f4f4;
}

.title-editor-number {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.title-editor-card input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0;
  border: 0;
  border-bottom: 1px solid #bbb;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.15rem;
}

.title-editor-card input:focus {
  border-bottom-color: var(--ink);
  outline: 0;
}

.title-editor-card input::placeholder { color: #aaa; }

.title-editor-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 4rem;
  padding: 1rem 0;
  border-top: 1px solid #eee;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
}

.title-editor-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.title-editor-status {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.title-editor-status.success { color: #1a7f37; }
.title-editor-status.error { color: #b3261e; }

@media (max-width: 600px) {
  .site-header { padding: 1.25rem 1.25rem; }
  .site-header nav a { margin-left: 1rem; }
  .cart-trigger { margin-left: 1rem; }
  main { padding: 1.25rem 1.25rem 0; }
  .shop-heading { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
  .shop-heading > p { text-align: left; }
  .shop-grid { grid-template-columns: 1fr; }
  .product-dialog { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); }
  .product-dialog-layout { display: block; min-height: 0; }
  .product-dialog-art { min-height: 0; padding: 2.5rem 1.25rem 1.25rem; }
  .product-dialog-art img { max-height: 48vh; }
  .product-dialog-details { padding: 2rem 1.25rem; }
  .cart-dialog { width: calc(100vw - 1rem); margin: auto; padding: 1.25rem; }
  .title-editor-main { padding: 2.5rem 1.25rem 6rem; }
  .title-editor-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .title-editor-actions { align-items: stretch; flex-direction: column; }
  .title-editor-actions .primary-button { width: 100%; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
