@font-face {
  font-family: "Pacifico";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/pacifico-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Pacifico";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/pacifico-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --ink: #1e1d1c;
  --muted: #6c7075;
  --glaze: #e37393;
  --glaze-dark: #cf5a7c;
  --glaze-soft: #fdf2f5;
  --grout: #e0e3e6;
  --line: #cfd4d9;
  --danger: #c62828;
  --danger-bg: #fff6f6;

  /* Frosting background colors (Step 2 + applied to Step 5) */
  --cake-white: #ffffff;
  --cake-pink: #f6bdd0;
  --cake-blue: #b2dbf5;
  --cake-green: #bce2b5;

  /* Inscription lettering colors (Step 5 + applied to Step 2) */
  --icing-white: #ffffff;
  --icing-pink: #d44874;
  --icing-blue: #2973b2;
  --icing-green: #337e33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--glaze-dark); }
a:hover { color: var(--glaze); }
a[href^="tel:"] { white-space: nowrap; }
a, button, label { -webkit-tap-highlight-color: transparent; }

/* Hero — square white кафель tiles with gray-ish cement grout */
.hero {
  overflow-x: clip;
  border-bottom: 1px solid var(--grout);
  background-color: #ffffff;
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.92) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M44 0H0v44' fill='none' stroke='%23d4d8dc' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 100% 100%, 44px 44px;
}

.hero-inner {
  max-width: 660px;
  margin: 0 auto;
  padding: 40px 20px 44px;
  text-align: center;
}

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.brand-logo {
  display: block;
  width: 210px;
  height: auto;
}

.brand {
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.bento-title {
  display: inline-block;
  font-family: "Pacifico", cursive;
  font-weight: 400;
  font-size: clamp(42px, 9vw, 66px);
  line-height: 1.15;
  color: var(--glaze);
  margin: 4px 0 18px;
  transform: rotate(-3.2deg);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.85), 0 4px 12px rgba(227, 115, 147, 0.18);
}

.lead {
  font-size: 17px;
  color: #3a3d40;
  max-width: 540px;
  margin: 0 auto;
}

.facts {
  list-style: none;
  padding: 14px 0;
  margin: 24px auto;
  max-width: 560px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
  border-top: 1px solid var(--grout);
  border-bottom: 1px solid var(--grout);
  font-size: 14px;
  color: var(--muted);
}
.facts b { color: var(--ink); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-block;
  border: 1px solid var(--glaze);
  border-radius: 8px;
  padding: 12px 24px;
  background: var(--glaze);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:hover:not(:disabled) {
  background: var(--glaze-dark);
  border-color: var(--glaze-dark);
  color: #fff;
}
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn.ghost {
  background: transparent;
  color: var(--glaze-dark);
  border: 1px solid var(--glaze);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--glaze-soft);
  border-color: var(--glaze-dark);
}

/* Single-column open white form */
.order-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 20px 64px;
}

.step {
  padding: 24px 0;
  border-bottom: 1px solid var(--grout);
}
.step:first-child { padding-top: 8px; }
.step-last { border-bottom: 0; padding-bottom: 20px; }

.step-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
}
.step-title em {
  font-style: italic;
  font-weight: 500;
  color: #222;
}

/* Choice chips & cards */
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.options input { position: absolute; opacity: 0; pointer-events: none; }
.options span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 15px;
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: border-color .14s ease, background-color .18s ease, color .18s ease, box-shadow .14s ease, text-shadow .18s ease;
}
.options span:hover { border-color: var(--glaze); }
.options input:focus-visible + span { outline: 2px solid var(--glaze); outline-offset: 2px; }

/* Regular chips (e.g. flavor) */
.chip input:checked + span {
  background: var(--glaze);
  border-color: var(--glaze);
  color: #fff;
}

.card { flex: 1 1 150px; min-width: 0; }
.card span {
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  gap: 2px;
  padding: 12px 14px;
}
.card small { color: var(--muted); font-size: 13px; font-weight: 400; }
.card input:checked + span {
  border-color: var(--glaze);
  background: var(--glaze-soft);
  box-shadow: 0 0 0 1px var(--glaze) inset;
}

/* ============================================================
   Cross-preview color buttons (Step 2 <-> Step 5)
   ============================================================ */

.color-options .chip span {
  font-weight: 600;
}

/* Keep real cake/text colors visible when checked; show crisp dark ring instead */
.color-options .chip input:checked + span {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink) inset;
}

/* Step 2: cake background buttons show their own frosting background */
.bg-color-options .c-white span,
.bg-color-options .c-white input:checked + span { background: var(--cake-white); }
.bg-color-options .c-pink span,
.bg-color-options .c-pink input:checked + span  { background: var(--cake-pink); }
.bg-color-options .c-blue span,
.bg-color-options .c-blue input:checked + span  { background: var(--cake-blue); }
.bg-color-options .c-green span,
.bg-color-options .c-green input:checked + span { background: var(--cake-green); }

/* Step 2 default text color (before Step 5 chosen, or when Step 5 is custom) */
.bg-color-options .chip span,
.bg-color-options .chip input:checked + span {
  color: var(--ink);
}

/* Step 2 text color controlled by Step 5 selection */
.bg-color-options.apply-text-white .chip:not(.c-custom) span,
.bg-color-options.apply-text-white .chip:not(.c-custom) input:checked + span {
  color: var(--icing-white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.34);
}
.bg-color-options.apply-text-pink .chip:not(.c-custom) span,
.bg-color-options.apply-text-pink .chip:not(.c-custom) input:checked + span {
  color: var(--icing-pink);
}
.bg-color-options.apply-text-blue .chip:not(.c-custom) span,
.bg-color-options.apply-text-blue .chip:not(.c-custom) input:checked + span {
  color: var(--icing-blue);
}
.bg-color-options.apply-text-green .chip:not(.c-custom) span,
.bg-color-options.apply-text-green .chip:not(.c-custom) input:checked + span {
  color: var(--icing-green);
}

/* Step 2 matching background + text color → outline shadow around text */
.bg-color-options.apply-text-white .c-white span {
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.72), 0 1px 2px rgba(0, 0, 0, 0.55);
}
.bg-color-options.apply-text-pink .c-pink span,
.bg-color-options.apply-text-blue .c-blue span,
.bg-color-options.apply-text-green .c-green span {
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.95), 0 1px 3px rgba(0, 0, 0, 0.38);
}

/* Step 5: text color buttons show their own lettering color */
.text-color-options .t-white span,
.text-color-options .t-white input:checked + span {
  color: var(--icing-white);
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.72), 0 1px 2px rgba(0, 0, 0, 0.55);
}
.text-color-options .t-pink span,
.text-color-options .t-pink input:checked + span  { color: var(--icing-pink); }
.text-color-options .t-blue span,
.text-color-options .t-blue input:checked + span  { color: var(--icing-blue); }
.text-color-options .t-green span,
.text-color-options .t-green input:checked + span { color: var(--icing-green); }

/* Step 5 default background (before Step 2 chosen, or when Step 2 is custom) */
.text-color-options .chip span,
.text-color-options .chip input:checked + span {
  background: var(--cake-white);
}

/* Step 5 background controlled by Step 2 selection */
.text-color-options.apply-bg-white .chip:not(.c-custom) span,
.text-color-options.apply-bg-white .chip:not(.c-custom) input:checked + span {
  background: var(--cake-white);
}
.text-color-options.apply-bg-pink .chip:not(.c-custom) span,
.text-color-options.apply-bg-pink .chip:not(.c-custom) input:checked + span {
  background: var(--cake-pink);
}
.text-color-options.apply-bg-blue .chip:not(.c-custom) span,
.text-color-options.apply-bg-blue .chip:not(.c-custom) input:checked + span {
  background: var(--cake-blue);
}
.text-color-options.apply-bg-green .chip:not(.c-custom) span,
.text-color-options.apply-bg-green .chip:not(.c-custom) input:checked + span {
  background: var(--cake-green);
}

/* White text on colored pastel backgrounds gets softer icing shadow */
.text-color-options.apply-bg-pink .t-white span,
.text-color-options.apply-bg-blue .t-white span,
.text-color-options.apply-bg-green .t-white span {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.34);
}

/* Step 5 matching background + text color → outline shadow around text */
.text-color-options.apply-bg-pink .t-pink span,
.text-color-options.apply-bg-blue .t-blue span,
.text-color-options.apply-bg-green .t-green span {
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.95), 0 1px 3px rgba(0, 0, 0, 0.38);
}

/* "Свій варіант" button ALWAYS stays black text on white background */
.color-options .c-custom span,
.color-options .c-custom input:checked + span {
  background: #ffffff;
  color: var(--ink);
  text-shadow: none;
  font-weight: 500;
}

/* Text inputs */
input[type=text], input[type=tel], input[type=date], input[type=time], textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  transition: border-color .12s ease, background .12s ease;
}
input[type=date], input[type=time] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  line-height: 1.3;
  text-align: left;
}
input[type=date]::-webkit-date-and-time-value,
input[type=time]::-webkit-date-and-time-value {
  text-align: left;
}
input[type=text]:focus, input[type=tel]:focus, input[type=date]:focus, input[type=time]:focus, textarea:focus {
  outline: none;
  border-color: var(--glaze);
  box-shadow: 0 0 0 3px rgba(227, 115, 147, 0.16);
}
.custom-input { margin-top: 10px; }

label { display: block; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.grid > .field { min-width: 0; }
.grid label, .address-wrap label { font-size: 13px; font-weight: 500; color: var(--muted); }
.grid input, .address-wrap input { margin-top: 5px; color: var(--ink); font-size: 16px; }
.phone-group {
  display: flex;
  align-items: stretch;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.phone-group:focus-within {
  border-color: var(--glaze);
  box-shadow: 0 0 0 3px rgba(227, 115, 147, 0.16);
}
.phone-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  background: var(--surface);
  border-right: 1px solid var(--grout);
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
  user-select: none;
  flex-shrink: 0;
}
.phone-group input[type=tel] {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  flex: 1 1 auto;
  min-width: 0;
}
.phone-group input[type=tel]:focus {
  box-shadow: none;
}
.address-wrap { margin-top: 14px; }
.address-wrap[hidden] { display: none; }

.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.suggest button {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  border: 1px dashed var(--line);
  background: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}
.suggest button:hover { border-color: var(--ink); background: var(--surface); }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

/* Inline Rails-style validation errors */
.field-error {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
}
.field-error[hidden] { display: none; }

.has-error input[type=text],
.has-error input[type=tel],
.has-error input[type=date],
.has-error input[type=time],
.has-error textarea,
.has-error .phone-group,
.has-error .upload-box {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.has-error .phone-group input[type=tel] {
  border-color: transparent;
  background: transparent;
}
.has-error .phone-prefix {
  border-right-color: rgba(198, 40, 40, 0.25);
  background: #fceaea;
}
.has-error .options:not(.color-options) span {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.has-error .color-options span {
  border-color: var(--danger);
}
.has-error .step-title,
.has-error > label {
  color: var(--danger);
}

/* Photo reference upload */
.upload-box {
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color .15s ease, background .15s ease;
}
.upload-box.dragover { border-color: var(--glaze); background: var(--glaze-soft); }
.upload-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 12px;
  cursor: pointer;
  text-align: center;
}
.upload-trigger[hidden] { display: none; }
.upload-trigger span { font-weight: 600; font-size: 14px; color: var(--ink); }
.upload-trigger small { font-size: 12px; color: var(--muted); }
.upload-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.upload-preview[hidden] { display: none; }
.upload-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--grout);
  flex-shrink: 0;
}
.upload-preview img[hidden] { display: none; }
.upload-file-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border-radius: 6px;
  border: 1px solid var(--grout);
  background: #fff;
  flex-shrink: 0;
}
.upload-file-icon[hidden] { display: none; }
.upload-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.upload-meta strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-meta small { font-size: 12px; color: var(--muted); }
.btn-clear {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-clear:hover { color: var(--danger); border-color: var(--danger); }

/* Sticky checkout bar */
.total {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--grout);
}
.total-sum { display: flex; flex-direction: column; line-height: 1.2; }
.total-sum small { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.total-sum b { font-size: 20px; }

.errors { color: var(--danger); white-space: pre-line; margin: 10px 0 0; font-size: 14px; }

/* Confirmation panel (reuses .bill layout) */
.confirm-card { padding: 8px 0 24px; }
.confirm-header { margin-bottom: 4px; }
.confirm-header h2 { margin: 0 0 4px; font-size: 22px; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.order-details > div[hidden] { display: none; }

/* Status & checkout pages */
body.status-body {
  min-height: 100vh;
  background-color: #ffffff;
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.14) 0px, rgba(255, 255, 255, 0.92) 440px, #ffffff 480px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M44 0H0v44' fill='none' stroke='%23d4d8dc' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 100% 100%, 44px 44px;
  background-repeat: no-repeat, repeat;
}
.status-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 36px 20px 32px;
}
.status-sheet {
  padding: 0 0 8px;
}
.status-header {
  text-align: center;
  margin-bottom: 24px;
}
.status-header .brand-logo {
  margin: 0 auto 20px;
}
.status-logo-link {
  display: inline-block;
}
.status-title-paid {
  font-family: "Pacifico", cursive;
  font-weight: 400;
  font-size: clamp(24px, 5.5vw, 30px);
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 10px;
}
.status-title {
  font-size: clamp(22px, 5vw, 28px);
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 10px;
}
.status-lead {
  color: #3a3d40;
  max-width: 440px;
  margin: 0 auto 12px;
}
.order-ref {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 6px;
}
.order-ref strong {
  color: var(--ink);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.status-card {
  padding: 12px 0;
  text-align: center;
}
.status-card h1 { margin: 8px 0 12px; font-size: clamp(22px, 5vw, 28px); line-height: 1.2; }
.big-price { font-size: 32px; font-weight: 700; margin: 12px 0; }
.badge-test {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--glaze-dark);
  background: var(--glaze-soft);
  border: 1px solid #f2cfd9;
  border-radius: 6px;
  padding: 4px 10px;
  margin: 6px 0 4px;
}
.status-actions, .mock-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 24px 0 8px;
}

.bill {
  margin-top: 20px;
}
.bill-section {
  padding: 16px 0 6px;
  border-top: 1px solid var(--grout);
}
.bill-section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.order-details {
  margin: 0;
}
.order-details > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 6px 0;
}
.order-details dt { color: var(--muted); flex: 0 0 auto; font-size: 15px; }
.order-details dd { margin: 0; text-align: right; word-break: break-word; font-size: 15px; }
.bill-photo-row {
  align-items: flex-start !important;
  padding-top: 8px !important;
}
.bill-photo-link {
  display: inline-block;
  line-height: 0;
}
.bill-photo {
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--grout);
}
.nowrap { white-space: nowrap; }
.bill-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0 4px;
  margin-top: 10px;
  border-top: 2px solid var(--grout);
  font-size: 18px;
}
.bill-total span { color: var(--muted); font-weight: 600; }
.bill-total strong { font-size: 20px; color: var(--ink); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 28px 20px;
  border-top: 1px solid var(--grout);
}

@media (max-width: 480px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .total { flex-wrap: wrap; }
}
