/*
 * The Eco Laundry — order page (order.php)
 * Loaded after styles.css and reuses its tokens: Georgia headings, Arial body,
 * ink #142f21, body text #354d3d, accent #48674e, hairlines #dce4d8.
 * Mobile first: base rules target small screens, media queries widen.
 */

:root {
  --order-ink: #142f21;
  --order-text: #354d3d;
  --order-accent: #48674e;
  --order-accent-hover: #34553b;
  --order-focus: #3d7753;
  --order-line: #dce4d8;
  --order-input-border: #6b7b66; /* 4.5:1 on white, meets non-text contrast */
  --order-card: #f8faf6;
  --order-error: #b3261e;
  --order-container: 880px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The fixed header is always visible on this page (see .eco-order-page in styles.css). */
.order-main:focus {
  outline: none;
}

/* ---------- Soft header ---------- */
.order-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  min-height: clamp(220px, 30vh, 280px);
  padding: calc(76px + 32px) 22px 32px;
  overflow: hidden;
  background: #e9eee4 url('../images/own-linen-bedroom.jpg') center 58% / cover no-repeat;
}

/* Light overlay keeps the heading well above WCAG AA contrast on any part of the photo. */
.order-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.8);
}

.order-hero-inner {
  width: min(100%, var(--order-container));
  margin-inline: auto;
}

.order-hero h1 {
  margin: 0 0 10px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(42px, 11vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  color: var(--order-ink);
}

.order-hero-sub {
  margin: 0;
  max-width: 34ch;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 500;
  color: #294330;
}

/* ---------- Page body ---------- */
.order-body {
  padding: 40px 22px 72px;
}

.order-body > * {
  max-width: var(--order-container);
  margin-inline: auto;
}

.order-intro.lead {
  margin-top: 0;
  margin-bottom: 28px;
  max-width: var(--order-container);
}

/* ---------- Cards and groups ---------- */
.order-card {
  min-width: 0;
  margin: 0 0 20px;
  padding: 22px 18px 24px;
  border: 1px solid var(--order-line);
  border-radius: 14px;
  background: var(--order-card);
}

/* Floated legend sits inside the card instead of on its border. */
.order-legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 18px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--order-ink);
}

.order-legend + * {
  clear: both;
}

.order-section-title {
  max-width: none;
  margin: 40px 0 8px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--order-ink);
}

.order-hint {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--order-text);
}

.order-hint a,
.order-confirmation a:not(.primary-cta):not(.quiet-cta) {
  color: var(--order-ink);
  text-underline-offset: 3px;
}

/* ---------- Fields ---------- */
.details-grid,
.qty-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.qty-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}

.form-field {
  min-width: 0;
}

.form-label {
  display: block;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--order-ink);
}

.form-field--qty .form-label {
  font-weight: 400;
}

.form-input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 11px 14px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  line-height: 1.4;
  color: var(--order-ink);
  background: #fff;
  border: 1px solid var(--order-input-border);
  border-radius: 6px;
  box-shadow: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.form-input:hover {
  border-color: var(--order-accent);
}

.form-input:focus {
  outline: 3px solid var(--order-focus);
  outline-offset: 1px;
  border-color: var(--order-focus);
}

.form-input--date {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}

.form-input--date::-webkit-date-and-time-value {
  text-align: left;
}

.form-input--qty {
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
}

.char-count {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--order-text);
}

/* ---------- Errors ---------- */
.field-error {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--order-error);
}

.form-field.has-error {
  padding-left: 12px;
  border-left: 4px solid var(--order-error);
}

.form-field.has-error .form-input,
.form-input[aria-invalid='true'] {
  border: 2px solid var(--order-error);
}

.order-items > .field-error {
  padding-left: 12px;
  border-left: 4px solid var(--order-error);
  margin-bottom: 18px;
}

.error-summary {
  margin: 0 0 32px;
  padding: 22px 20px;
  border: 3px solid var(--order-error);
  border-radius: 10px;
  background: #fff;
}

.error-summary:focus {
  outline: 3px solid var(--order-focus);
  outline-offset: 3px;
}

.error-summary-title {
  max-width: none;
  margin: 0 0 12px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--order-ink);
}

.error-summary-general {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--order-ink);
}

.error-summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.error-summary-list li + li {
  margin-top: 6px;
}

.error-summary-list a {
  display: inline-block;
  padding: 4px 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--order-error);
  text-underline-offset: 3px;
}

/* ---------- Honeypot (hidden from people, visible to naive bots) ---------- */
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Actions ---------- */
.order-turnstile {
  margin-top: 24px;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: 32px;
}

.order-actions .order-hint {
  margin: 0;
}

.order-actions .order-hint a {
  display: inline-block;
  padding-block: 12px; /* 44px touch target */
}

.order-submit {
  justify-content: space-between;
  gap: 28px;
  min-height: 52px;
  padding: 16px 26px;
  border: 0;
  border-radius: 6px;
  background: var(--order-accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.order-submit:hover {
  background: var(--order-accent-hover);
}

.order-submit[aria-disabled='true'] {
  cursor: progress;
  opacity: 0.75;
  transform: none;
}

/* ---------- Thank-you state ---------- */
.order-confirmation {
  padding: 26px 20px 30px;
  border: 1px solid var(--order-line);
  border-radius: 14px;
  background: var(--order-card);
}

.order-confirmation:focus {
  outline: none;
}

.order-confirmation--problem {
  border-left: 4px solid var(--order-error);
}

.order-confirmation-title {
  max-width: 26ch;
  margin: 0 0 18px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--order-ink);
}

.order-confirmation .lead {
  margin: 0 0 12px;
  max-width: 62ch;
}

.order-ref {
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.order-summary {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--order-line);
}

.order-summary-title {
  margin: 24px 0 10px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.3;
  color: var(--order-ink);
}

.order-summary-list {
  margin: 0;
}

.order-summary-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--order-line);
}

.order-summary-list dt {
  font-size: 13px;
  font-weight: 700;
  color: var(--order-text);
}

.order-summary-list dd,
.order-summary-items li,
.order-summary-notes {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--order-ink);
  overflow-wrap: anywhere;
}

.order-summary-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-summary-items li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--order-line);
}

.order-confirmation .hero-actions {
  margin-top: 32px;
}

/* ---------- Wider screens ---------- */
@media (min-width: 600px) {
  .details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 22px;
  }
  .form-field--wide {
    grid-column: 1 / -1;
  }
  .order-summary-list > div {
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 16px;
  }
}

@media (min-width: 768px) {
  .order-hero {
    min-height: clamp(300px, 38vh, 420px);
    padding: calc(88px + 48px) 32px 48px;
  }
  .order-hero h1 {
    font-size: clamp(56px, 7vw, 84px);
  }
  .order-hero-sub {
    max-width: none;
    font-size: 18px;
  }
  .order-body {
    padding: 64px 32px 100px;
  }
  .order-card {
    padding: 30px 32px 32px;
    border-radius: 18px;
  }
  .order-legend {
    font-size: 28px;
  }
  .order-section-title {
    margin-top: 48px;
    font-size: 32px;
  }
  .error-summary {
    padding: 28px 30px;
  }
  .order-confirmation {
    padding: 40px 40px 44px;
    border-radius: 18px;
  }
}

/* 4 columns once there is room: the 4-item groups fill a single row. */
@media (min-width: 700px) {
  .qty-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px 18px;
  }
}

/* The header is 76px tall up to 760px wide (styles.css). */
@media (min-width: 761px) and (max-width: 767px) {
  .order-hero {
    padding-top: calc(88px + 32px);
  }
}

@media (max-height: 540px) and (orientation: landscape) {
  .order-hero {
    min-height: 0;
  }
}

@media (hover: none) {
  .order-submit:hover {
    transform: none;
  }
}

@media print {
  .order-hero {
    min-height: 0;
    padding: 24px 0;
    background: none;
  }
  .order-hero::before,
  .order-actions,
  .error-summary[hidden] {
    display: none;
  }
}
