/* ---------------------------------------------------------------------------
   My Worklocker — POC styling.
   Workwear palette taken from the Shopify theme: black ground, #ffc600 mark,
   #b59677 as the warm accent. Deliberately restrained — Figma owns the design
   direction, this only has to look credible on a phone.
   --------------------------------------------------------------------------- */

:root {
  /*
    Brand values taken from the source artwork, not eyeballed:
    --accent is sampled from the official logo PNG (100% of its opaque pixels
    are #FDC300 — note that is NOT the #FFC600 in the Shopify theme settings),
    and --ink is the black used by the brand guidelines' own page graphics.
  */
  --accent: #fdc300;
  --ink: #231f20;

  --ink-deep: #141212;
  --ink-2: #2c2727;
  --ink-3: #3a3433;
  --line: #443d3c;
  --paper: #f7f7f7;
  --text: #f6f4f2;
  --text-dim: #a49d9b;
  --warm: #b59677;
  --danger: #ec0101;
  --ok: #4caf50;

  --radius: 14px;
  --gap: 16px;

  /* Safe-area insets matter once display:standalone removes browser chrome —
     without them content sits under the notch and the home indicator. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/*
  Author `display` rules (`.view--auth`, `.tabbar`, `.purchase-list`) beat the
  UA stylesheet's `[hidden] { display: none }`, which would render every view
  at once. This has to win outright, so `!important` is correct here rather
  than lazy — the app toggles visibility with `el.hidden`.
*/
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  /* A vignette off brand black gives the flat colour some depth on a phone
     without introducing any colour that isn't in the palette. */
  background:
    radial-gradient(70% 40% at 10% 0%, #2a2423 0%, rgba(42, 36, 35, 0) 55%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%)
    var(--ink);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 20px) var(--gap) calc(var(--safe-bottom) + 96px);
}

h1 {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0;
}

h2 {
  font-size: 1.05rem;
  margin: 0;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.muted {
  color: var(--text-dim);
  margin: 4px 0 0;
  font-size: 0.9rem;
}

.lede {
  color: var(--text-dim);
  margin: 8px 0 24px;
}

.fineprint {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 24px;
}

/* --------------------------------- Views --------------------------------- */

.view--auth {
  display: flex;
  /* dvh so the iOS URL bar collapsing doesn't shift the composition; vh is
     the fallback for browsers without it. */
  min-height: calc(100vh - 150px);
  min-height: calc(100dvh - 150px);
  align-items: center;
}

/*
  The signed-in layout reserves room for the tab bar. The auth screens have no
  tab bar, so that reservation just becomes dead space under the composition.
*/
body.is-auth #app {
  padding-bottom: calc(var(--safe-bottom) + 26px);
}

.auth {
  width: 100%;
}

/*
  Clear space. The brand guidelines nominate the coin locker (the keyhole "o")
  as the unit for measuring clear space, so the mark gets a full mark-width of
  room beneath it and nothing crowds it.
*/
.auth-brand {
  position: relative;
  display: flex;
  /* Hug the mark, so the glow's `left: 50%` centres on the MARK rather than on
     a full-width container — which was pushing the bloom off to the side. */
  width: fit-content;
  /* ~half a mark width: comfortably clear, without floating the mark away
     from the words it belongs to. */
  margin-bottom: 44px;
}

.auth-brand--sm {
  margin-bottom: 30px;
}

.auth-mark {
  display: block;
  position: relative;
  z-index: 1;
}

/*
  A warm bloom behind the mark, so a flat yellow disc on flat black reads as
  lit rather than pasted on. Purely background — the logo itself is untouched,
  which the guidelines require.
*/
.auth-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 210px;
  height: 210px;
  transform: translate(-50%, -50%);
  /* Tight and centred on the mark. A wider, softer glow overlapped the page
     vignette and read as a lens flare smeared across the corner. */
  background: radial-gradient(circle, rgba(253, 195, 0, 0.22) 0%, rgba(253, 195, 0, 0) 62%);
  pointer-events: none;
}

.eyebrow--accent {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.16em;
}

.auth-title {
  font-size: clamp(2.1rem, 11vw, 2.9rem);
  font-weight: 800;
  /* Tight tracking at display size, echoing the logo's own weight without
     imitating its letterforms — recreating those is expressly not allowed. */
  letter-spacing: -0.028em;
  line-height: 1.02;
  margin: 6px 0 0;
}

.auth-title--sm {
  font-size: clamp(1.7rem, 8vw, 2.2rem);
}

.auth-lede {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.55;
  margin: 14px 0 32px;
  max-width: 34ch;
}

.auth-foot {
  margin: 28px 0 0;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 36ch;
}

/*
  Hi-vis hazard band. Workwear language rather than brand furniture — the
  guidelines forbid using the logo decoratively, so this uses the palette
  only.
*/
/* Bottom band: frames the auth screens against the top one. Hidden once the
   tab bar owns the bottom of the screen. */
.hazard--bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  padding-bottom: var(--safe-bottom);
  z-index: 4;
}

body.is-auth .hazard--bottom {
  display: block;
}

.hazard {
  height: 4px;
  background: repeating-linear-gradient(
    115deg,
    var(--accent) 0 12px,
    var(--ink) 12px 24px
  );
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

/* --------------------------------- Forms --------------------------------- */

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
}

input {
  width: 100%;
  padding: 17px 18px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(180deg, var(--ink-2), #262121);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 120ms ease, box-shadow 120ms ease;
  /* 16px+ font size stops iOS Safari zooming the viewport on focus. */
}

input::placeholder {
  color: #6f6867;
  font-weight: 500;
}

input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 3px rgba(253, 195, 0, 0.22);
}

.code-input {
  letter-spacing: 0.42em;
  text-indent: 0.42em; /* balances the trailing letter-spaced gap */
  text-align: center;
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.field-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 8px 0 0;
}

/* -------------------------------- Buttons -------------------------------- */

.btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 15px 18px;
  font: inherit;
  font-weight: 650;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  /* 48px min target — thumb-sized, and the trade counter is not a quiet room. */
  min-height: 48px;
}

.btn--primary {
  background: linear-gradient(180deg, #ffcf24, var(--accent));
  color: var(--ink);
  letter-spacing: 0.01em;
  box-shadow: 0 8px 22px -10px rgba(253, 195, 0, 0.55);
}

.btn--primary:active {
  transform: translateY(1px);
  box-shadow: 0 4px 14px -10px rgba(253, 195, 0, 0.5);
}

.btn--primary:disabled {
  background: var(--ink-3);
  color: var(--text-dim);
  cursor: default;
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn--ghost:disabled {
  color: var(--text-dim);
  cursor: default;
}

.btn-back,
.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}

.btn-back {
  margin-bottom: 20px;
  display: block;
  color: var(--text-dim);
}

.link {
  font-size: 0.88rem;
}

.btn-icon {
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
  cursor: pointer;
  flex: 0 0 auto;
}

/* ------------------------------ Points card ------------------------------ */

.points-card {
  background: linear-gradient(150deg, var(--ink-3), var(--ink-2));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 28px;
}

.points-value {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  margin: 6px 0 10px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.points-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.88rem;
  color: var(--warm);
}

.badge {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.badge--sample {
  background: rgba(236, 1, 1, 0.16);
  color: #ff8f8f;
  border: 1px solid rgba(236, 1, 1, 0.4);
}

/* -------------------------------- Panels --------------------------------- */

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ------------------------------- Purchases ------------------------------- */

.purchase-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.purchase {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 140ms ease;
}

.purchase.is-open {
  border-color: #5c5250;
}

.purchase-head {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 14px 16px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.purchase-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.purchase-where {
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}

.purchase-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.purchase-tags {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.chip {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Where it was bought is the distinction a member cares about. Both are
   neutral: neither is a warning. */
.chip--store {
  color: var(--text-dim);
  border-color: var(--line);
}

.chip--online {
  color: #9fd0c4;
  border-color: #3b544d;
}

.chip--refund {
  color: var(--warm);
  border-color: #5a4a3a;
}

.chip--processing {
  color: var(--accent);
  border-color: #5d4d13;
}

/* --- expanded item detail --- */

.purchase-body {
  padding: 2px 16px 14px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}

.purchase-line {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.purchase-line-qty {
  flex: 0 0 auto;
  min-width: 2.2em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.purchase-line-desc {
  flex: 1 1 auto;
  min-width: 0;
}

.purchase-line-amount {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.purchase-nolines {
  margin: 10px 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.purchase-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
}

.purchase-ref {
  font-size: 0.75rem;
  color: #7d7472;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.purchase-actions {
  display: flex;
  gap: 14px;
  flex: 0 0 auto;
}

.purchase-doc {
  font-weight: 650;
  white-space: nowrap;
}

/* ------------------------------ Detail list ------------------------------ */

.detail-list {
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-list > div {
  background: var(--ink-2);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.detail-list dt {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.detail-list dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

/* --------------------------------- Tabbar -------------------------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: rgba(17, 17, 17, 0.96);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  /* backdrop-filter is a progressive nicety; the solid rgba above is the
     fallback where it isn't supported. */
  backdrop-filter: blur(12px);
}

.tab {
  flex: 1;
  background: none;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.72rem;
  padding: 10px 4px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  min-height: 56px;
}

.tab span {
  font-size: 1.1rem;
  line-height: 1;
}

.tab.is-active {
  color: var(--accent);
}

/* ------------------------------ Banner/toast ----------------------------- */

.banner {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--warm);
  color: var(--ink);
  text-align: center;
  padding: calc(var(--safe-top) + 8px) 12px 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 76px);
  max-width: 90vw;
  background: var(--paper);
  color: var(--ink);
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.empty {
  color: var(--text-dim);
  padding: 24px 4px;
  text-align: center;
}

.skeleton {
  height: 68px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--ink-2), var(--ink-3), var(--ink-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }

  .btn--primary:active {
    transform: none;
  }
}
