:root {
  --paper: #fbf8f4;
  --panel: #fffdfb;
  --ink: #171717;
  --muted: #667078;
  --line: #e7ded7;
  --accent: #971b35;
  --accent-dark: #7c132a;
  --soft: #f7f1eb;
  --shadow: 0 12px 34px rgba(54, 36, 27, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Roboto, Arial, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.site-header { height: 74px; background: rgba(255,253,251,.96); border-bottom: 1px solid var(--line); }
.site-nav { max-width: 1200px; height: 100%; margin: 0 auto; padding: 0 22px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { color: var(--ink); text-decoration: none; font-size: 14px; }
.nav-links a.active { color: var(--accent); }
.logo { padding: 5px 9px; border: 2px solid #292929; color: #fff; background: var(--accent); font-size: 10px; line-height: 1.05; text-align: center; letter-spacing: .05em; box-shadow: inset 0 0 0 2px #fff; }
.logo span { letter-spacing: .23em; }
.nav-icons { justify-self: end; font-size: 18px; white-space: nowrap; }

.page-shell { max-width: 1200px; margin: 0 auto; padding: 28px 22px 50px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 700; letter-spacing: .13em; font-size: 13px; }
h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; }
h1 { margin: 0; font-size: clamp(38px, 4.2vw, 54px); line-height: 1.02; }
.lead { margin: 8px 0 22px; color: var(--muted); font-size: 17px; }
.config-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(370px, 1fr); gap: 20px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }

.stone-panel { padding: 18px 20px; margin-bottom: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-head h2, .catalog-head h2, .download-panel h2 { margin: 0; font-size: 31px; line-height: 1; }
.text-button { border: 0; background: transparent; color: var(--accent); text-decoration: underline; padding: 6px; }
.stone-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; margin-top: 15px; }
.stone-choice { position: relative; min-width: 0; padding: 0 0 8px; background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; text-align: center; color: var(--ink); }
.stone-choice img { display: block; width: 100%; aspect-ratio: 1.55; object-fit: cover; margin-bottom: 7px; }
.stone-choice strong { font-size: 12px; line-height: 1.15; }
.stone-choice[aria-checked="true"] { border: 2px solid var(--accent); box-shadow: 0 0 0 2px rgba(151,27,53,.08); }
.stone-choice[aria-checked="true"]::after { content: "✓"; position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; }

.scene-wrap { position: relative; overflow: hidden; border-radius: 12px; background: #dce4d5; box-shadow: var(--shadow); touch-action: pan-y; user-select: none; }
.scene-wrap > #grave-image { display: block; width: 100%; height: auto; pointer-events: none; }
.placed-layer { position: absolute; inset: 0; }
.placed-object { position: absolute; transform: translate(-50%, -100%); transform-origin: bottom center; touch-action: none; cursor: grab; }
.placed-object:active { cursor: grabbing; }
.placed-object.selected { outline: 2px dashed #44c8c3; outline-offset: 5px; }
.placed-object img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; pointer-events: none; }
.placed-object.ceramic-object { overflow: hidden; }
#placed-ceramic-photos { grid-column: 1 / -1; min-width: 0; }
#placed-ceramic-photos label { display: grid; gap: 4px; margin-top: 10px; }
#placed-ceramic-photos input { max-width: 100%; }
.ceramic-plate-layer { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: contain; }
.ceramic-horizontal .ceramic-plate-layer { inset: auto; left: 50%; top: 50%; width: var(--ceramic-plate-width); height: var(--ceramic-plate-height); transform: translate(-50%,-50%) rotate(90deg); }
.ceramic-photo-layer { position: absolute; left: var(--ceramic-photo-left); top: var(--ceramic-photo-top); z-index: 2; width: var(--ceramic-photo-width) !important; height: var(--ceramic-photo-height) !important; object-fit: var(--ceramic-photo-fit) !important; object-position: var(--ceramic-photo-position); clip-path: var(--ceramic-clip); }
.export-stamp { position: absolute; left: 0; right: 0; bottom: 0; padding: 9px 14px; background: rgba(25,25,25,.62); color: #fff; font-size: 12px; text-align: center; letter-spacing: .01em; pointer-events: none; }

.download-panel { margin-top: 16px; padding: 18px 20px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.download-copy > p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.download-copy .notice { color: var(--accent-dark); font-weight: 700; }
.notice span { display: inline-grid; place-items: center; width: 21px; height: 21px; margin-right: 5px; border: 2px solid currentColor; border-radius: 50%; font-family: Georgia, serif; }
.status { min-height: 22px; margin: 10px 4px 0; color: var(--accent-dark); font-weight: 500; }
.owner-product-link { display: inline-block; margin: 4px 4px 0; color: var(--muted); font-size: 13px; text-decoration: none; }
.owner-product-link:hover { color: var(--accent); text-decoration: underline; }
.owner-product-link span { font-size: 11px; }

.catalog-panel { position: sticky; top: 12px; padding: 20px 18px 0; max-height: calc(100vh - 24px); display: flex; flex-direction: column; overflow: hidden; }
.catalog-head h2 { font-size: 31px; }
.catalog-head p { margin: 7px 0 14px; color: var(--muted); }
.search-box { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 13px; border: 1px solid #ccd0d2; border-radius: 8px; background: #fff; }
.search-box span { font-size: 24px; transform: rotate(-15deg); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; }
.category-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 12px; }
.chip { border: 1px solid #d8d0ca; border-radius: 8px; background: #fff; padding: 8px 14px; color: var(--ink); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.catalog-meta { padding: 6px 0 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
#availability-status { color: var(--muted); font-size: 11px; text-align: right; }
.product-list { flex: 1; min-height: 260px; overflow-y: auto; padding: 10px 2px 14px 0; scrollbar-color: #c8bdb7 transparent; }
.product-card { display: grid; grid-template-columns: 104px 1fr; gap: 13px; padding: 12px; margin-bottom: 10px; background: #fff; border: 1px solid #eee6e0; border-radius: 10px; }
.product-thumb { width: 104px; height: 124px; object-fit: contain; background: #faf7f3; border-radius: 7px; }
.product-info h3 { margin: 0; font-size: 16px; line-height: 1.24; }
.product-meta { margin: 6px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.variant-field { display: grid; gap: 5px; margin: 0 0 9px; }
.variant-field[hidden] { display: none; }
.variant-field span { color: var(--muted); font-size: 13px; font-weight: 700; }
.variant-select { width: 100%; min-height: 38px; border: 1px solid #ccd0d2; border-radius: 7px; padding: 6px 30px 6px 9px; background: #fff; color: var(--ink); }
.stone-variant-field { display: grid; gap: 6px; margin: 0 0 10px; }
.stone-variant-field[hidden] { display: none; }
.stone-variant-field > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.stone-variant-options { display: flex; flex-wrap: wrap; gap: 6px; }
.stone-variant-choice { position: relative; width: 42px; height: 42px; padding: 2px; border: 1px solid #d8d0ca; border-radius: 50%; background: #fff; overflow: hidden; }
.stone-variant-choice img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.stone-variant-choice span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stone-variant-choice[aria-checked="true"] { border: 3px solid var(--accent); box-shadow: 0 0 0 2px rgba(151,27,53,.12); }
.stone-variant-choice[aria-checked="true"]::after { content: "✓"; position: absolute; right: -1px; bottom: -1px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.product-drag-hint { margin: 0 0 9px; color: #7b6c64; font-size: 12px; line-height: 1.3; }
.product-thumb { cursor: grab; touch-action: none; }
.product-thumb:active { cursor: grabbing; }
.catalog-drag-ghost { position: fixed; z-index: 2000; width: 90px; height: 105px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,.92); box-shadow: 0 10px 28px rgba(0,0,0,.2); pointer-events: none; opacity: 0; transform: translate(-50%,-50%); }
.catalog-drag-ghost.active { opacity: .9; }
.scene-wrap.drop-ready::after { content: "Otpustite za postavljanje"; position: absolute; inset: 10px; z-index: 20; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 9px; background: rgba(151,27,53,.08); color: #fff; font-size: 17px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.75); pointer-events: none; }
.product-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.outline-button, .primary-button { min-height: 42px; border-radius: 7px; padding: 9px 14px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.outline-button { border: 1.5px solid var(--accent); color: var(--accent); background: #fff; }
.primary-button { border: 1.5px solid var(--accent); color: #fff; background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.product-actions .outline-button, .product-actions .primary-button { flex: 1 1 112px; min-height: 38px; padding: 7px 10px; font-size: 13px; }
.show-more { width: 100%; margin-bottom: 10px; }
.show-more[hidden], .product-remove[hidden] { display: none; }
.basket-bar { margin: 0 -18px; padding: 13px 18px; display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; background: #fcf8f4; border-top: 1px solid var(--line); }
.basket-bar #cart-message { grid-column: 1 / -1; min-height: 0; color: var(--accent-dark); font-size: 12px; }
.basket-bar button:disabled { opacity: .55; cursor: not-allowed; }
.compact { min-height: 40px; padding: 8px 12px; font-size: 13px; }

.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: start center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(35,27,23,.45); backdrop-filter: blur(2px); }
.ceramic-dialog { position: relative; width: min(670px, 100%); max-height: min(calc(100vh - 36px), var(--ceramic-dialog-height, 100vh)); overflow: auto; padding: 26px; scroll-margin-top: 64px; }
.ceramic-dialog > h2 { margin: 0; font-size: 36px; }
.ceramic-dialog > p { margin: 6px 0; color: var(--muted); }
.ceramic-dialog h3, .field-label { display: block; margin: 18px 0 8px; font-size: 17px; font-weight: 700; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--soft); font-size: 27px; line-height: 1; }
.ceramic-shapes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.shape-choice { position: relative; min-width: 0; padding: 8px 5px 7px; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.shape-choice img { width: 100%; height: 105px; object-fit: contain; display: block; }
.shape-choice strong { font-size: 12px; }
.shape-choice[aria-checked="true"] { border: 2px solid var(--accent); }
.shape-choice[aria-checked="true"]::after { content: "✓"; position: absolute; top: 5px; right: 5px; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.select-control { width: 100%; height: 44px; border: 1px solid #ccd0d2; border-radius: 7px; padding: 0 12px; background: #fff; }
.orientation-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.orientation-options button { min-height: 42px; border: 1px solid #d8d0ca; border-radius: 7px; background: #fff; color: var(--ink); font-weight: 700; }
.orientation-options button.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.helper { font-size: 13px; color: var(--muted); }
.upload-box { min-height: 100px; border: 1.5px dashed var(--accent); border-radius: 9px; display: grid; grid-template-columns: auto auto; justify-content: center; align-content: center; column-gap: 12px; padding: 15px; text-align: left; }
.upload-box .upload-icon { grid-row: 1 / 3; font-size: 32px; color: var(--accent); }
.upload-box small { color: var(--muted); }
.remove-photo { display: block; margin: 7px 0 0 auto; color: var(--accent); font-weight: 700; }
.remove-photo[hidden] { display: none; }
.ceramic-summary { display: grid; grid-template-columns: 82px 1fr; gap: 14px; align-items: center; margin: 16px 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; }
.ceramic-summary p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.ceramic-preview { position: relative; width: 72px; height: 82px; margin: auto; }
.wide { width: 100%; margin-top: 10px; }
.return-button { position: relative; }
.return-button kbd { position: absolute; right: 14px; padding: 2px 7px; border: 1px solid #aab0b4; border-radius: 5px; background: #f4f6f7; color: #4b5459; font-family: Roboto, sans-serif; }
.shop-link { display: block; margin: 14px auto 0; color: var(--accent); text-align: center; font-weight: 700; }

@media (max-width: 980px) {
  .site-nav { grid-template-columns: 1fr auto; }
  .logo { grid-column: 2; grid-row: 1; }
  .nav-icons { display: none; }
  .nav-links { gap: 17px; overflow-x: auto; }
  .config-grid { grid-template-columns: 1fr; }
  .catalog-panel { position: static; max-height: none; }
  .product-list { max-height: 650px; }
}

@media (max-width: 680px) {
  .site-header { height: 60px; }
  .site-nav { padding: 0 14px; }
  .nav-links a:nth-child(n+4) { display: none; }
  .page-shell { padding: 22px 12px 36px; }
  .lead { font-size: 15px; }
  .stone-panel { padding: 15px 12px; }
  .stone-grid { grid-template-columns: repeat(3, 1fr); }
  .section-head { align-items: flex-start; }
  .section-head h2, .catalog-head h2, .download-panel h2 { font-size: 28px; }
  .download-panel { grid-template-columns: 1fr; padding: 16px; }
  .download-button { width: 100%; }
  .catalog-panel { padding: 16px 12px 0; }
  .product-card { grid-template-columns: 86px 1fr; padding: 10px; }
  .product-thumb { width: 86px; height: 108px; }
  .basket-bar { position: sticky; bottom: 0; margin: 0 -12px; padding: 10px 12px; grid-template-columns: 1fr 1fr; z-index: 10; }
  .basket-bar strong { grid-column: 1 / -1; }
  .ceramic-dialog { padding: 22px 14px; }
  .ceramic-shapes { grid-template-columns: repeat(3, 1fr); }
  .shape-choice img { height: 92px; }
}

/* The guided layout uses the WordPress page header on small screens. */
.mobile-only { display: none; }
#desktop-basket, #mobile-basket { display: contents; }

@media (max-width: 680px) {
  .site-header, .eyebrow, .lead, .desktop-only { display: none; }
  .page-shell h1 { font-size: clamp(32px, 8vw, 40px); }
  .mobile-steps {
    display: grid;
    grid-template-columns: 1fr 1fr 1.45fr;
    gap: 5px;
    margin: 16px 0;
    scroll-margin-top: 72px;
  }
  .mobile-steps button {
    min-width: 0;
    min-height: 52px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    text-align: left;
  }
  .mobile-steps [aria-current="step"] {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
  }
  .mobile-next, .mobile-show-review { display: inline-flex; width: 100%; margin: 14px 0; }
  .mobile-review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
  .mobile-review-actions .outline-button { flex: 1 1 195px; }
  .mobile-review-actions .text-button { flex: 1 1 145px; min-height: 44px; }
  .mobile-review-actions .text-button:disabled { opacity: .6; cursor: default; }
  .mobile-show-review { margin-top: 0; }
  .catalog-head h2 { margin-bottom: 12px; }
  .mobile-catalog-title { display: inline; }
  .catalog-panel { min-width: 0; }
  .catalog-panel .category-chips { flex-wrap: nowrap; overflow-x: auto; padding: 4px 2px 8px; }
  .category-chips .chip { flex-shrink: 0; min-height: 44px; }
  .product-list { min-height: 0; max-height: none; overflow: visible; }
  .product-thumb { cursor: default; touch-action: pan-y; }
  .product-quantity { display: grid; grid-template-columns: 46px minmax(26px, auto) 46px; width: max-content; align-items: center; text-align: center; }
  .product-quantity .outline-button { min-height: 44px; padding: 0; font-size: 22px; }
  .product-quantity button:disabled { opacity: .45; cursor: default; }
  .product-details { display: block; margin-top: 7px; font-size: 14px; }
  .product-details summary { width: max-content; min-height: 36px; padding-top: 7px; cursor: pointer; color: var(--accent); }
  .product-details .product-shop { margin: 0 0 5px; }
  .modal { align-items: start; padding-top: 14px; }
  .ceramic-dialog .shop-link { display: none; }
  .basket-bar {
    position: static;
    margin: 0;
    grid-template-columns: 1fr auto;
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .basket-bar strong { grid-column: auto; }
  #review-selected { display: none; }
  .download-copy > p { margin-bottom: 4px; }

  body:not([data-mobile-step="catalog"]) .catalog-panel,
  body[data-mobile-step="catalog"] .left-column,
  body[data-mobile-step="review"] .stone-panel,
  body:not([data-mobile-step="stone"]) .mobile-next,
  body:not([data-mobile-step="review"]) .mobile-review-actions,
  body:not([data-mobile-step="review"]) .basket-bar,
  body:not([data-mobile-step="review"]) .download-panel { display: none; }
}
