/* Wrangler sample styles.

   Deliberately small and unopinionated — enough structure to be readable and
   usable, not a design system. Every colour is a custom property below, so
   retheming is usually a matter of editing :root and nothing else.

   The one idea worth keeping if you restyle: a ticket is half written by a
   person and half generated by the system. Prose is set in the sans face;
   anything the system produced — reference, status, timestamp — is set in the
   mono face. A reader can tell at a glance which parts they wrote and which
   parts happened to them. */

:root {
  --wr-paper:     #f2f3f5;
  --wr-surface:   #ffffff;
  --wr-ink:       #16181d;
  --wr-ink-soft:  #596070;
  --wr-rule:      #dcdfe5;
  --wr-rule-firm: #b6bcc7;
  --wr-blue:      #23346b;
  --wr-blue-lift: #32498f;

  --wr-new:       #4a5364;
  --wr-open:      #1c6b48;
  --wr-pending:   #8a5a00;
  --wr-closed:    #7b828d;

  --wr-error:     #96261f;
  --wr-error-bg:  #fcf3f2;
  --wr-staff-bg:  #f8f9fb;

  /* Small rather than absent: a form field, not a card and not a newspaper. */
  --wr-radius: 3px;

  /* No webfont is loaded anywhere in these templates, so naming a face we do
     not ship would just be a slower way of getting the system font. */
  --wr-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wr-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

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

body.wr {
  margin: 0;
  padding: 2rem 1.25rem 4rem;
  background: var(--wr-paper);
  color: var(--wr-ink);
  font: 16px/1.6 var(--wr-sans);
  -webkit-font-smoothing: antialiased;
}

.wr-shell { max-width: 46rem; margin: 0 auto; }

.wr a { color: var(--wr-blue); text-underline-offset: .18em; }
.wr a:hover { color: var(--wr-blue-lift); }

/* Always visible, never removed — keyboard users need to see where they are. */
.wr :focus-visible { outline: 2px solid var(--wr-blue); outline-offset: 2px; border-radius: 2px; }

/* --- header --------------------------------------------------------- */

/* alt="" in the markup is deliberate. The logo sits directly above an <h1>
   that already names the page, so giving it alt text would make a screen
   reader announce the brand twice before reaching the heading. */
.wr-logo {margin: 2.5rem 0 4rem 0; text-align: center;  }
.wr-logo img { display: block; width: 200px; height: auto; margin-left: auto; margin-right: auto; }

.wr-header { margin-bottom: 2.75rem;}
.wr-header h1 { margin: 0 0 .4rem; font-size: 1.5rem; line-height: 1.25; letter-spacing: -.015em; font-weight: 650; }
.wr-header p  { margin: 0; color: var(--wr-ink-soft); }

.wr-card {
  background: var(--wr-surface);
  border: 1px solid var(--wr-rule);
  border-radius: var(--wr-radius);
  box-shadow: 0 4px 8px -1px rgba(0, 0, 0, 0.2);
}

.wr-card-top {
  padding: 3.5rem 3.5rem 0 3.5rem;
  border-bottom: 1px solid var(--wr-rule);
  background-color: #dfe8ea;
}

.wr-card-bottom {
  padding: 3.5rem;
}

/* --- forms ----------------------------------------------------------- */

.wr-field { margin-bottom: 1.15rem; }
.wr-field:last-of-type { margin-bottom: 0; }

/* Labels are mono and letterspaced so a long form reads as a set of discrete
   slots to fill rather than a wall of bold sans. */
.wr-field label {
  display: block;
  margin-bottom: .4rem;
  font: 600 .72rem/1.4 var(--wr-mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--wr-ink-soft);
}
.wr-field small { display: block; margin-top: .4rem; color: var(--wr-ink-soft); font-size: .85rem; }

.wr-input, .wr-textarea, .wr-select {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--wr-rule-firm);
  border-radius: var(--wr-radius);
  background: var(--wr-surface);
  color: inherit;
  font: inherit;
}
.wr-textarea { resize: vertical; min-height: 8rem; }
.wr-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--wr-ink-soft) 50%), linear-gradient(135deg, var(--wr-ink-soft) 50%, transparent 50%); background-position: right 1rem center, right .75rem center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }

.wr-input:hover, .wr-textarea:hover, .wr-select:hover { border-color: var(--wr-ink-soft); }

.wr-actions { margin-top: 1.5rem; }

.wr-btn {
  display: inline-block;
  padding: .62rem 1.3rem;
  border: 1px solid var(--wr-blue);
  border-radius: var(--wr-radius);
  background: var(--wr-blue);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.wr-btn:hover { background: var(--wr-blue-lift); border-color: var(--wr-blue-lift); }

/* --- alerts ---------------------------------------------------------- */

.wr-alert {
  margin: 0 0 1.25rem;
  padding: .75rem 1rem;
  border: 1px solid var(--wr-rule);
  border-left: 3px solid var(--wr-rule-firm);
  border-radius: var(--wr-radius);
  background: var(--wr-surface);
}
.wr-alert--error { background: var(--wr-error-bg); border-color: #e3c4c1; border-left-color: var(--wr-error); color: var(--wr-error); }

/* --- status ---------------------------------------------------------- */

/* Stamped rather than filled. Status is the one thing on a ticket page a
   reader actually hunts for, so it is the only element allowed any colour;
   everything else stays greyscale and lets it win. */
.wr-pill {
  display: inline-block;
  padding: .1rem .45rem;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: none;
  color: var(--wr-new);
  font: 600 .68rem/1.5 var(--wr-mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  vertical-align: .06em;
}
.wr-pill--open    { color: var(--wr-open); }
.wr-pill--pending { color: var(--wr-pending); }
.wr-pill--closed  { color: var(--wr-closed); }

/* --- ticket meta + thread -------------------------------------------- */

/* Reference numbers and dates are machine output, so they take the mono face. */
.wr-meta { margin: .6rem 0 0; color: var(--wr-ink-soft); font: .8rem/1.6 var(--wr-mono); }
.wr-meta > * + *::before { content: "/"; margin: 0 .5rem; color: var(--wr-rule-firm); }

.wr-thread { margin: 1.75rem 0; display: grid; gap: 0; }

/* Messages hang off one continuous rule instead of sitting in separate boxes.
   A thread is one conversation, and a stack of identical cards does not say so. */
.wr-msg {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0 1.25rem;
  padding: 1.1rem 0 1.1rem 1.15rem;
  border-left: 2px solid var(--wr-rule);
}
.wr-msg + .wr-msg { border-top: 1px solid var(--wr-rule); }

/* Staff replies get the firm rule and a tint. The weight of the rule carries
   the distinction, so the message body does not need to be indented away. */
.wr-msg--staff { border-left-color: var(--wr-blue); background: var(--wr-staff-bg); }

.wr-msg__head { grid-column: 1; }
.wr-msg__author { margin: 0 0 .15rem; font-size: .88rem; font-weight: 650; line-height: 1.35; }
.wr-msg__time { display: block; color: var(--wr-ink-soft); font: .72rem/1.5 var(--wr-mono); }
.wr-msg__body { grid-column: 2; white-space: pre-wrap; overflow-wrap: anywhere; }

/* --- ticket list ------------------------------------------------------ */

.wr-list { display: grid; gap: 0; margin: 1.5rem 0; border-top: 1px solid var(--wr-rule); }
.wr-list__item {
  padding: 1rem .25rem;
  border-bottom: 1px solid var(--wr-rule);
}
.wr-list__item h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.wr-list__item h2 a { text-decoration: none; }
.wr-list__item h2 a:hover { text-decoration: underline; }

.wr-empty { color: var(--wr-ink-soft); }

.wr-back { display: inline-block; margin-top: 1.75rem; font: .78rem/1.5 var(--wr-mono); letter-spacing: .04em; }

@media (max-width: 34rem) {
  body.wr { padding: 1.25rem .9rem 3rem; }
  .wr-card { padding: 1.15rem; }
  /* The gutter stops paying for itself below this width — the author line
     moves above the message instead. */
  .wr-msg { grid-template-columns: 1fr; gap: .5rem; }
  .wr-msg__head, .wr-msg__body { grid-column: 1; }
  .wr-msg__author { display: inline; margin-right: .5rem; }
  .wr-msg__time { display: inline; }
}
