/*
 * app.css — customer pages (search form and results).
 * Mobile first: the base styles are for phones; the @media block at the end widens things for
 * larger screens. Brand colours and font come from the spec.
 */

:root {
  --brand: #d81f14;
  --brand-dark: #a81710;
  --rule: #808080;
  --invert-bg: #000;
  --invert-fg: #eee;
  --text: #111;
  --muted: #555;          /* 7.4:1 on white */
  --grey-icon: #767676;   /* 4.5:1 on white: still visible when "greyed out" */
  --box-bg: #f6f6f6;
  --error-bg: #fdecea;
  font-family: 'museo-sans', Arial, Helvetica, sans-serif;
  font-weight: 500;
  color: #111;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;        /* the spec asks for a white background */
}

body {
  font-size: 1rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.ot-wrap {
  max-width: 40rem;
  padding: 1rem;
}

/* Read by screen readers, never shown (e.g. the search form's heading). */
.ot-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ot-heading {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

p { margin: 0 0 0.75rem; }

a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--brand); }

/* Visible keyboard focus everywhere (WCAG 2.2: focus visible / not obscured). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* ---------- Form ---------- */
.ot-intro { margin-bottom: 1rem; }

.ot-field { margin: 0 0 1.25rem; }

.ot-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.ot-optional { font-weight: 500; color: var(--muted); }

.ot-hint {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0 0 0.5rem;
}

.ot-input {
  display: block;
  width: 100%;
  max-width: 20rem;
  min-height: 2.75rem;               /* comfortable touch target */
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 1.0625rem;              /* >= 16px stops iOS zooming in */
  color: var(--text);
  background: #fff;
  border: 2px solid var(--rule);
  border-radius: 4px;
  text-transform: uppercase;
}

.ot-input-short { max-width: 12rem; }

.ot-input[aria-invalid="true"] { border-color: var(--brand); }

/* "Please enter your order number." under an empty box */
.ot-field-error {
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.9375rem;
  margin: 0.375rem 0 0;
}
.ot-field-error[hidden] { display: none; }

.ot-button {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.6rem 1.5rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border: 2px solid var(--brand);
  border-radius: 4px;
  cursor: pointer;
}
.ot-button:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.ot-button[disabled] { opacity: 0.7; cursor: progress; }

.ot-turnstile { margin: 0 0 1.25rem; }

/* ---------- Error messages ---------- */
.ot-error {
  border-left: 4px solid var(--brand);
  background: var(--error-bg);
  padding: 0.75rem 1rem;
  margin: 0 0 1.25rem;
}
.ot-error[hidden] { display: none; }

/* ---------- Results ---------- */
.ot-shipment {
  border: 1px solid #d0d0d0;
  border-left: 4px solid var(--brand);
  background: var(--box-bg);
  border-radius: 4px;
  padding: 0.875rem 1rem 0.25rem;
  margin: 0 0 1rem;
}

.ot-shipment-title {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.ot-track a { font-weight: 700; }

.ot-products {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.ot-products li {
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  background: var(--box-bg);
  padding: 0.625rem 0.875rem;
  margin: 0 0 0.5rem;
}
.ot-product-name { display: block; font-weight: 700; }
.ot-product-eta { display: block; }

/* ---------- Footer and feedback ---------- */
.ot-footer {
  border-top: 1px solid var(--rule);
  margin-top: 1.5rem;
  padding-top: 1rem;
  font-size: 0.9375rem;
}
.ot-footer a { overflow-wrap: anywhere; }

/* "(Information correct as of …)": the very last line, in small print, two blank lines below
   "Search again?" (two lines of body text = 2 x 1.5rem). */
.ot-asof { color: var(--muted); font-size: 0.75rem; margin: 3rem 0 0; }

.ot-thumbs { display: flex; gap: 0.75rem; margin: 0.25rem 0 0.25rem; }

.ot-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;                       /* 48px target: above the WCAG 2.2 minimum */
  padding: 0;
  color: var(--text);
  background: #fff;
  border: 2px solid var(--rule);
  border-radius: 50%;
  cursor: pointer;
}
.ot-thumb:hover { border-color: var(--text); }
.ot-thumb[aria-pressed="true"] { color: var(--brand); border-color: var(--brand); }
.ot-feedback.is-answered .ot-thumb[aria-pressed="false"] { color: var(--grey-icon); border-color: #c4c4c4; }
.ot-thumb[disabled] { cursor: not-allowed; opacity: 0.6; }

/* ---------- Feedback box under the thumbs (version 1.2) ---------- */
.ot-drawer {
  margin: 0.75rem 0 0;
  padding: 0.125rem 0 0.25rem 0.875rem;
  border-left: 3px solid var(--rule);
  max-width: 33rem;
}
.ot-drawer.is-down { border-left-color: var(--brand); }
.ot-drawer[hidden], .ot-comment[hidden], .ot-escalate[hidden], .ot-drawer-status[hidden] { display: none; }
.ot-drawer-prompt { display: block; font-weight: 700; margin: 0 0 0.375rem; }

.ot-textarea {
  display: block;
  width: 100%;
  min-height: 5rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 1.0625rem;              /* >= 16px stops iOS zooming in */
  line-height: 1.4;
  color: var(--text);
  background: #fff;
  border: 2px solid var(--rule);
  border-radius: 4px;
  resize: vertical;
}
.ot-textarea[aria-invalid="true"] { border-color: var(--brand); }

.ot-comment-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0.5rem 0 0; }
.ot-counter { color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.ot-button-small { min-height: 2.5rem; padding: 0.45rem 1.1rem; font-size: 0.9375rem; }
.ot-button-small[disabled] { cursor: not-allowed; opacity: 0.55; }

.ot-drawer-status { font-weight: 700; margin: 0.25rem 0 0; }
.ot-drawer-status:focus { outline: none; }

.ot-escalate { border-top: 1px solid #d0d0d0; margin: 0.875rem 0 0; padding: 0.625rem 0 0; }

/* A button that looks like a link ("Want to get in touch with us?", "Cancel") */
.ot-linkbutton {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--brand-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.ot-linkbutton:hover { color: var(--brand); }
.ot-linkbutton[hidden] { display: none; }

/* ---------- "Get in touch with Customer Services" pop-up (version 1.2) ----------
   A native <dialog>: the rest of the page cannot be used while it is open, Escape closes it and
   keyboard focus stays inside it. Inside the iframe the page does not scroll, so app.js places it
   next to the link that opened it. */
.ot-dialog {
  position: fixed;
  inset: auto 0;
  top: 24px;
  margin: 0 auto;
  width: calc(100% - 24px);
  max-width: 480px;
  max-height: none;
  padding: 0;
  border: 0;
  border-top: 4px solid #CC0000;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: visible;
}
/* Opened as a page of its own (not in the iframe): never taller than the window; the contents
   scroll inside it, so the Send button can always be reached (app.js keeps it inside the window). */
.ot-dialog.is-window {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ot-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.ot-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem 0.25rem; }
.ot-dialog-title { font-size: 1.25rem; line-height: 1.3; font-weight: 700; margin: 0; }
.ot-dialog-x {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: -0.375rem -0.625rem 0 0;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.ot-dialog-x:hover { background: var(--box-bg); }
.ot-dialog-body { padding: 0.25rem 1.25rem 1.25rem; }
.ot-dialog-body[hidden] { display: none; }
.ot-dialog-intro { color: var(--muted); }
.ot-dialog .ot-field { margin: 0 0 1rem; }
.ot-dialog .ot-error { margin-bottom: 1rem; }
.ot-input-wide { max-width: none; text-transform: none; }
.ot-input-prefilled { background: #F5F5F5; }
.ot-fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.ot-fieldset legend { padding: 0; }
.ot-fieldset .ot-hint { margin-top: 0.125rem; }
.ot-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }
.ot-two .ot-field { margin: 0; }
.ot-label-small { font-size: 0.9375rem; }
.ot-req { color: var(--brand-dark); }
.ot-dialog .ot-counter { display: block; text-align: right; margin-top: 0.25rem; }
.ot-dialog-actions { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-top: 0.25rem; }
.ot-dialog-done-title { font-size: 1.125rem; margin: 0.5rem 0; }
.ot-dialog-done-title:focus { outline: none; }
/* The "honeypot" box: never seen by people */
.ot-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 30rem) {
  .ot-two { grid-template-columns: 1fr; }
  .ot-two .ot-field + .ot-field { margin-top: 0.75rem; }
}

/* "Search again?" — a small link under the results */
.ot-again {
  font-size: 0.875rem;
  margin: 1rem 0 0;
}

.ot-not-in-iframe[hidden] { display: none; }

@media (min-width: 48rem) {
  .ot-wrap { padding: 1.25rem 0.375rem; } /* a little side room so focus outlines are not clipped by the iframe */
  .ot-heading { font-size: 1.75rem; }
}

/* The search form starts at the very top of the page: no space above the first line of text. */
body[data-page="form"] .ot-wrap { padding-top: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
