:root {
  --ink: #14213D;
  --ink-soft: #46536E;
  --paper: #FFFFFF;
  --mist: #E9EEF2;
  --teal: #0E7C86;
  --teal-dark: #0A5D65;
  --kraft: #B98B5E;
  --kraft-dark: #9C7148;
  --tape: #F2B705;
  --error: #B42318;
  --success: #0A6B4F;
  --radius: 6px;
  --font: "Rubik", system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body { margin: 0; background: var(--mist); color: var(--ink); font-family: var(--font); font-size: 1.0625rem; line-height: 1.6; }
a { color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { display: flex; align-items: center; gap: 20px; max-width: 1200px; margin: 0 auto; padding: 18px 24px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.logo-mark { width: 26px; height: 26px; border: 3px solid var(--ink); border-radius: 3px; position: relative; flex: none; }
.logo-mark::after { content: ""; position: absolute; inset-inline: -3px; top: 7px; height: 3px; background: var(--ink); }
.logo-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.header-phone { margin-inline-start: auto; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.language-toggle { font: inherit; font-weight: 700; font-size: .9rem; background: transparent; color: var(--ink); border: 2px solid var(--ink); border-radius: 4px; padding: 4px 10px; cursor: pointer; }
.language-toggle:hover { background: var(--ink); color: #fff; }

/* Hero */
.hero { display: grid; grid-template-columns: 1fr minmax(0, 520px); gap: 56px; align-items: start; max-width: 1200px; margin: 0 auto; padding: 40px 24px 48px; }
.hero-copy { padding-top: 40px; }
h1 { font-weight: 900; font-size: clamp(2.5rem, 5.6vw, 4.6rem); line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 24px; max-width: 11ch; }
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 38ch; margin: 0; }

/* The label: a thermal shipping label on a kraft box */
.label-wrap { padding: 18px 0 0; }
.label {
  position: relative; background: var(--paper); border: 3px solid var(--ink); border-radius: 4px; padding: 0 0 20px;
  box-shadow: 0 0 0 18px var(--kraft), 0 0 0 19px var(--kraft-dark); transform: rotate(0.8deg);
}
.label::before {
  content: ""; position: absolute; top: -26px; left: 50%; width: 46%; height: 38px; transform: translateX(-50%) rotate(-1.4deg);
  background: color-mix(in srgb, var(--tape) 78%, transparent); border-inline: 2px dashed rgba(0,0,0,.08);
}
.label-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; background: var(--ink); color: #fff; padding: 12px 18px; }
.label-logo { font-weight: 800; direction: ltr; }
.label-title { font-weight: 600; font-size: .95rem; opacity: .9; }

.label-row { border: 0; margin: 0; padding: 14px 18px 16px; padding-inline-start: 120px; position: relative; border-bottom: 2px solid var(--ink); display: flex; flex-wrap: wrap; gap: 12px 14px; min-width: 0; }
.label-row > legend, .row-legend { position: absolute; inset-inline-start: 18px; top: 16px; width: 92px; padding: 0; font-weight: 800; font-size: .98rem; line-height: 1.2; }
.field { display: grid; gap: 4px; flex: 1 1 150px; min-width: 0; }
.field-wide { flex-basis: 100%; }
.field-weight { flex: 0 1 120px; }
.field-hint { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.label input, .label select {
  width: 100%; min-width: 0; font: inherit; font-size: 1rem; color: var(--ink); border: 0; border-bottom: 2px solid #C5CED9; border-radius: 0; background: transparent; padding: 6px 2px;
}
.label select { cursor: pointer; }
.label input::placeholder { color: #9AA6B8; }
.label input:focus, .label select:focus { outline: none; border-bottom-color: var(--teal); background: #F3F8F9; }
.input-unit { display: flex; align-items: center; gap: 6px; }
.input-unit span { font-weight: 700; }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; direction: ltr; }

.segmented { display: flex; gap: 0; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; width: 100%; }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; text-align: center; padding: 8px 10px; font-weight: 700; font-size: .95rem; }
.segmented input:checked + span { background: var(--ink); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--teal); outline-offset: -3px; }

.label-foot { padding: 16px 18px 4px; }
.barcode { height: 50px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 7px, transparent 7px 9px, var(--ink) 9px 10px, transparent 10px 13px); opacity: .9; }

.button { font: inherit; font-weight: 800; font-size: 1.05rem; border: 0; border-radius: var(--radius); padding: 13px 22px; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: var(--teal-dark); }
.button:disabled { opacity: .6; cursor: progress; }
.label-submit { display: block; width: calc(100% - 36px); margin: 16px 18px 0; }

/* Results */
.results-section { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.results:empty { display: none; }
.results { padding: 8px 0 56px; }
.loading { font-weight: 600; color: var(--ink-soft); }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.quote-card { display: grid; gap: 10px; align-content: start; background: #fff; border: 3px solid var(--ink); border-radius: 4px; padding: 20px; }
.quote-card.featured { border-color: var(--teal); }
.quote-card h3 { margin: 0; font-size: 1.2rem; }
.quote-card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.quote-card .tagline { font-weight: 700; color: var(--teal-dark); }
.price { font-size: 2.2rem; font-weight: 900; letter-spacing: -0.02em; direction: ltr; text-align: start; }
.result-note { color: var(--ink-soft); font-size: .9rem; margin: 14px 0 0; }
.error-card { background: #fff; border: 3px solid var(--ink); border-radius: 4px; padding: 20px; display: grid; gap: 12px; justify-items: start; }
.error-card p { margin: 0; font-weight: 600; }

/* Tracking */
.section { max-width: 1200px; margin: 0 auto; padding: 64px 24px; }
.tracking-section { border-top: 2px solid var(--ink); }
.tracking-section h2 { font-weight: 900; font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.1; margin: 0 0 10px; }
.tracking-section > p { margin: 0 0 20px; color: var(--ink-soft); max-width: 50ch; }
.tracking-form { display: flex; gap: 10px; max-width: 620px; }
.tracking-form input { flex: 1; min-width: 0; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 1.1rem; padding: 13px 14px; border: 2px solid var(--ink); border-radius: var(--radius); background: #fff; color: var(--ink); }
.form-status { margin: 10px 0 0; font-weight: 600; }
.form-status:empty { display: none; }
.form-status.error { color: var(--error); }
.form-status.success { color: var(--success); }

.site-footer { max-width: 1200px; margin: 0 auto; padding: 32px 24px 120px; border-top: 2px solid var(--ink); display: flex; flex-wrap: wrap; gap: 8px 32px; color: var(--ink-soft); font-size: .95rem; }
.site-footer p { margin: 0; }
.site-footer a { margin-inline-end: 16px; }

/* Chat */
.chat-toggle { position: fixed; inset-inline-start: 20px; bottom: 20px; z-index: 5; font: inherit; font-weight: 800; background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 14px 22px; cursor: pointer; box-shadow: 0 8px 24px rgba(20,33,61,.28); }
.chat-toggle[hidden] { display: none; }
.chat-panel { position: fixed; inset-inline-start: 20px; bottom: 20px; z-index: 6; width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 40px)); display: flex; flex-direction: column; background: #fff; border: 3px solid var(--ink); border-radius: 8px; overflow: hidden; box-shadow: 0 18px 50px rgba(20,33,61,.3); }
.chat-panel[hidden] { display: none; }
.chat-panel > header { display: flex; justify-content: space-between; align-items: start; gap: 12px; background: var(--ink); color: #fff; padding: 14px 16px; }
.chat-panel > header strong { display: block; font-size: 1.05rem; }
.chat-panel > header small { color: #C9D2E0; }
.chat-panel > header button { font: inherit; font-size: 1.4rem; line-height: 1; background: transparent; color: #fff; border: 2px solid #fff; border-radius: 4px; width: 34px; height: 34px; cursor: pointer; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--mist); }
.message { max-width: 85%; padding: 10px 13px; border-radius: 10px; white-space: pre-wrap; font-size: .97rem; line-height: 1.45; }
.message.assistant { background: #fff; border: 1px solid #D3DBE5; align-self: flex-start; }
.message.user { background: var(--teal); color: #fff; align-self: flex-end; }
.message.typing { display: flex; gap: 4px; }
.message.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: blink 1s infinite; }
.message.typing i:nth-child(2) { animation-delay: .15s; }
.message.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; } }
.compact-quote { display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #C5CED9; }
.compact-quote span { direction: ltr; text-align: start; font-weight: 700; }
.compact-quote .button { padding: 9px 14px; font-size: .95rem; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 2px solid var(--ink); }
.chat-form input { flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 10px 12px; border: 2px solid #C5CED9; border-radius: 6px; }
.chat-form input:focus { outline: none; border-color: var(--teal); }
.chat-form button { font: inherit; font-weight: 800; background: var(--teal); color: #fff; border: 0; border-radius: 6px; padding: 0 16px; cursor: pointer; }

/* Booking dialog */
.booking-dialog { border: 3px solid var(--ink); border-radius: 8px; padding: 0; width: min(480px, calc(100vw - 32px)); color: var(--ink); }
.booking-dialog::backdrop { background: rgba(20,33,61,.55); }
.booking-dialog form { display: grid; gap: 14px; padding: 22px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.dialog-heading h2 { margin: 0; font-size: 1.4rem; font-weight: 900; }
.icon-button { font: inherit; font-size: 1.4rem; line-height: 1; background: transparent; color: var(--ink); border: 2px solid var(--ink); border-radius: 4px; width: 34px; height: 34px; cursor: pointer; }
.booking-summary { background: var(--mist); border-radius: 4px; padding: 12px 14px; font-size: .95rem; }
.booking-dialog .field label { font-weight: 700; font-size: .9rem; }
.booking-dialog input, .booking-dialog textarea { font: inherit; font-size: 1rem; padding: 10px 12px; border: 2px solid #C5CED9; border-radius: 6px; width: 100%; }
.booking-dialog input:focus, .booking-dialog textarea:focus { outline: none; border-color: var(--teal); }

/* Phone */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 36px; }
  .hero-copy { padding-top: 8px; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .site-header { padding: 14px 16px; gap: 12px; }
  .header-phone { font-size: .9rem; }
  .hero, .section, .results-section, .site-footer { padding-left: 16px; padding-right: 16px; }
  .label { transform: none; box-shadow: 0 0 0 10px var(--kraft), 0 0 0 11px var(--kraft-dark); margin: 26px 11px 0; }
  .label-row { padding: 14px; }
  .label-row > legend, .row-legend { position: static; width: auto; flex-basis: 100%; margin-bottom: -4px; }
  .label-head, .label-foot { padding-left: 14px; padding-right: 14px; }
  .label-submit { width: calc(100% - 28px); margin: 14px 14px 0; }
  .tracking-form { flex-direction: column; }
  .chat-panel { inset-inline-start: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100vh - 16px); }
}
