/* ---- Design tokens -------------------------------------------------- */
:root {
  --antiquewhite: #faebd7;
  --paper: #f6f3ec;
  --paper-raised: #fbf9f4;
  --ink: #201c16;
  --ink-soft: #57503f;
  --muted: #8b8378;
  --maroon: #800000;
  --line: rgba(32, 28, 22, 0.14);
  --accent: #2f4a3c;      /* deep bottle green — primary actions */
  --accent-ink: #f6f3ec;  /* text on top of accent */
  --accent-soft: #e4e9e3;
  --warn: #a23b2d;        /* out of stock, errors */
  --warn-soft: #f3e3df;
  --radius: 3px;
  --font-display: 'Crimson Text', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-fancy: 'Yesteryear', Georgia, 'Times New Roman', serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ----------------------------------------------------------- */

.site-header {
  //border-bottom: 1px solid var(--line);
  background: var(--antiquewhite);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  padding-bottom: 10px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.wordmark img {
  display: block;
  height: min(10vw,100px);
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a {
  text-decoration: none;
  color: var(--accent);
  font-size: 0.95rem;
}

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

.cart-link {
  position: relative;
  color: var(--accent) !important;
  font-weight: 500;
}

.cart-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  margin-left: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  font-size: 0.72rem;
  text-align: center;
  line-height: 18px;
}

/* ---- Mobile nav (hamburger) ---------------------------------------------- */

.nav-toggle {
  display: none; /* shown only under the breakpoint below */
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Bars morph into an X while the menu is open */
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }

  /* Collapsed by default; .site-header's sticky positioning gives this
     dropdown its containing block, so top/left/right anchor to the header
     itself rather than the narrower centered .container inside it. */
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 4px 24px 12px;
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .site-nav a:last-child {
    border-bottom: none;
  }
}

/* ---- Hero --------------------------------------------------------------- */

.hero {
  padding: 100px 0 200px;
  background-image: linear-gradient(to left, rgba(250, 235, 215, 0.7) 50%, rgba(333, 333, 333, 0.6) 90%), url('/images/products/olgpearlbracelet.jpg');
  text-align: center;
  background-position: center;
  //border-bottom: 1px solid var(--line);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 16px;
  //max-width: 14ch;
}

.hero p {
  //max-width: 46ch;
  font-family: var(--font-fancy);
  color: var(--accent);
  font-size: 3rem;
  margin: 0;
}

.hero span{
  color: var(--maroon);
}

.hero__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}

.hero__content {
  flex: 1;
  min-width: 0;
}

.hero__media {
  flex-shrink: 0;
}

.hero__photo {
  display: block;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
}

@media (max-width: 760px) {
  .hero__inner {
    flex-direction: column-reverse;
    gap: 28px;
  }

  .hero__photo {
    width: 160px;
    height: 160px;
  }
}

/* ---- About: "What we make" ---------------------------------------- */
.about {
  padding: 72px 0 56px;
  //border-bottom: 1px solid var(--line);
}

.about h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 16px;
  max-width: 65ch;
}

.about p {
  max-width: 65ch;
  color: var(--ink-soft);
  font-size: 1.08rem;
  margin: 0;
}

.about-make__inner {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  max-width: 820px;
}

.about-make__photos {
  display: flex;
  flex-shrink: 0;
  gap: 16px;
}

.about-make__photo {
  display: block;
  width: 140px;
  min-width: 0;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
}

.about-make__content {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

@media (max-width: 640px) {
  .about-make__inner {
    flex-direction: column;
  }

  .about-make__photos {
    width: 100%;
  }

  .about-make__photo {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
  }
}

/* ---- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: #253c30;
}

.btn-primary:disabled {
  background: var(--muted);
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--ink-soft);
}

.btn-danger {
  background: transparent;
  border-color: var(--warn);
  color: var(--warn);
}

.btn-danger:hover {
  background: var(--warn-soft);
}

.btn-block {
  width: 100%;
}

/* ---- Product grid -------------------------------------------------- */

.section {
  padding: 48px 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0 0 24px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
  margin: -8px 0 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-field label {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.filter-field select {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  font-size: 0.9rem;
  min-width: 170px;
}

.filter-field--checkbox {
  flex-direction: row;
}

.filter-field--checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
}

.filter-field--checkbox input {
  width: auto;
}

.filter-field--sort {
  margin-left: auto;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px 28px;
}

@media (max-width: 860px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

.product-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.product-card__image {
  aspect-ratio: 4 / 5;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card__name {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 4px;
}

.product-card__price {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.badge-soldout {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--warn);
}

.product-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 2px;
}

/* ---- Product detail --------------------------------------------------- */

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  padding: 48px 0 72px;
  align-items: start;
}

@media (max-width: 760px) {
  .product-detail {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

.product-detail__image {
  border: 1px solid var(--line);
  background: var(--paper-raised);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  position: relative;
}

.product-detail__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0 0 8px;
}

.product-detail__price {
  font-size: 1.2rem;
  margin: 0 0 20px;
}

.product-detail__description {
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 52ch;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.qty-input {
  width: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  text-align: center;
}

.thumb-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.thumb-btn {
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  padding: 0;
  background: var(--paper-raised);
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--radius);
}

.thumb-btn.active {
  border-color: var(--accent);
  border-width: 2px;
}

.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Cart --------------------------------------------------------------- */

.cart-row {
  display: grid;
  grid-template-columns: 72px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.cart-row__image {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  overflow: hidden;
}

.cart-row__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-row__name {
  font-weight: 500;
}

.cart-row__remove {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

.summary-panel {
  border: 1px solid var(--line);
  background: var(--paper-raised);
  padding: 24px;
  border-radius: var(--radius);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.summary-row--total {
  color: var(--ink);
  font-weight: 600;
  font-size: 1.1rem;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.coupon-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.coupon-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  text-transform: uppercase;
}

.coupon-row .btn {
  padding: 10px 16px;
}

.checkout-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 48px;
  padding: 48px 0 80px;
  align-items: start;
}

@media (max-width: 800px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.form-field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
}

#shipping-form select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  font-family: inherit;
  font-size: inherit;
}

.form-field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.empty-state {
  padding: 64px 0;
  text-align: left;
  color: var(--ink-soft);
}

.empty-state a {
  color: var(--accent);
  font-weight: 500;
}

.error-banner {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.92rem;
}

.confirmation {
  padding: 96px 0;
  text-align: left;
}

.confirmation h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  margin: 0 0 12px;
}

/* ---- Footer -------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.footer-email {
  color: var(--muted);
  text-decoration: none;
}

.footer-email:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---- Admin --------------------------------------------------------------- */

.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-login {
  max-width: 360px;
  margin: 120px auto;
  padding: 0 24px;
}

.admin-login h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin-bottom: 20px;
}

.admin-header {
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}

.admin-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin: 28px 0 24px;
  border-bottom: 1px solid var(--line);
}

.admin-tab {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.admin-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 500;
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--accent-soft);
  color: var(--accent);
}

.status-pill.status-cancelled {
  background: var(--warn-soft);
  color: var(--warn);
}

.admin-form {
  border: 1px solid var(--line);
  background: var(--paper-raised);
  padding: 24px;
  border-radius: var(--radius);
  max-width: 480px;
  margin-bottom: 32px;
}

.admin-form h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 18px;
}

.admin-form--wide {
  max-width: 760px;
}

.tax-state-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 24px;
  margin-bottom: 20px;
}

.tax-state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.88rem;
}

.tax-state-input {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.tax-state-input input {
  width: 76px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  font-family: inherit;
}

@media (max-width: 760px) {
  .tax-state-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .tax-state-grid {
    grid-template-columns: 1fr;
  }
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-actions button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1;
  padding: 6px 12px;
  color: var(--ink);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.row-actions button:hover {
  border-color: var(--ink-soft);
}

.row-actions button.danger {
  border-color: var(--warn);
  color: var(--warn);
}

.row-actions button.danger:hover {
  background: var(--warn-soft);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

.edit-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  font-weight: 500;
}

.edit-link:hover {
  color: #253c30;
}

.buyer-email {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---- Order detail modal ------------------------------------------------ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(32, 28, 22, 0.45);
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--paper);
}

.modal__header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 4px;
}

.modal__body {
  padding: 24px;
}

.modal__section {
  margin-bottom: 22px;
}

.modal__section:last-child {
  margin-bottom: 0;
}

.modal__label {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.modal__line-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.modal__line-item:last-child {
  border-bottom: none;
}

/* ---- Admin: multi-image upload preview -------------------------------- */

.image-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.image-preview-item {
  position: relative;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  background: rgba(32, 28, 22, 0.75);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}

.field-hint {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 6px;
}

.csv-import-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.csv-import-bar .field-hint {
  margin-top: 0;
  max-width: 46ch;
}

.csv-import-errors {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--warn);
}

.csv-import-errors li {
  padding: 2px 0;
}

.badge-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge-preset-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--ink-soft);
}

.badge-preset-btn:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}
