/* ==========================================================================
   SAMPLE — offline-first courier app
   ==========================================================================
   The only phone-shaped application in the set, and the only one whose whole
   argument is about what happens when the network is not there. A courier in
   a basement car park, a lift, or a village with one bar of signal is the
   normal case for this software, not the edge case — so the app is built to
   assume the network is absent and be pleasantly surprised when it appears.

   Scoped under .cur.
   ========================================================================== */

.cur {
  --bg:     #0c1116;
  --bg-2:   #131a22;
  --panel:  #1a232d;
  --panel-2:#232f3b;
  --line:   #2b3846;
  --line-2: #3c4d5f;
  --ink:    #eef4fa;
  --ink-2:  #a8b9c9;
  --ink-3:  #8697a8;

  --brand:  #38bdf8;
  --go:     #34d399;
  --warn:   #fbbf24;
  --stop:   #fb7185;
  --queued: #c084fc;

  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.cur *, .cur *::before, .cur *::after { box-sizing: border-box; }
.cur svg { display: block; }
.cur a { color: var(--brand); }
.cur :focus-visible { outline-color: var(--brand); }

.cur-wrap { width: 100%; max-width: 82rem; margin-inline: auto; padding: 0 clamp(1rem, 3vw, 2rem) 5rem; }

/* ------------------------------------------------------------------ head --- */

.cur-hero { padding-block: clamp(2.5rem, 6vw, 4rem) 1.5rem; max-width: 44rem; }
.cur-hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.02;
  font-weight: 800;
}
.cur-hero h1 em { font-style: normal; color: var(--brand); }
.cur-hero p { margin: 1rem 0 0; color: var(--ink-2); line-height: 1.7; }

/* --------------------------------------------------------------- layout --- */

.cur-cols {
  display: grid; gap: clamp(1.2rem, 4vw, 2.5rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 62rem) { .cur-cols { grid-template-columns: auto minmax(0, 1fr); } }

.cur-stage { display: grid; justify-items: center; gap: 1rem; }

/* The handset from the shared shell, sized for a working app rather than a
   one-second splash. */
/* Fixed at 300px the handset plus the page gutter overflows a 320px screen,
   so it gives way to the viewport on the narrowest phones. */
.cur .phone { --phone-w: min(300px, calc(100vw - 2.75rem)); }
.cur .phone__screen { background: var(--bg-2); display: block; }

/* ----------------------------------------------------------------- app --- */

.app-shell { display: flex; flex-direction: column; height: 100%; }

.app-bar {
  flex: none;
  padding: 30px 14px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.app-bar__row { display: flex; align-items: center; gap: .5rem; }
.app-bar h2 { margin: 0; font-size: .95rem; font-weight: 700; letter-spacing: -0.01em; }
.app-bar .sp { margin-left: auto; }

/* The connection pill is the most important thing on the screen, so it is the
   only thing that ever changes colour in the bar. */
.app-net {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--mono); font-size: .58rem;
  letter-spacing: .1em; text-transform: uppercase;
  padding: .2rem .45rem; border-radius: 99px;
  border: 1px solid currentColor;
}
.app-net i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.app-net[data-net="on"]  { color: var(--go); }
.app-net[data-net="off"] { color: var(--stop); }
.app-net[data-net="on"] i { animation: cur-pulse 2s ease-in-out infinite; }
@keyframes cur-pulse { 50% { opacity: .3; } }

.app-queue {
  margin-top: .5rem;
  display: flex; align-items: center; gap: .4rem;
  font-size: .68rem; color: var(--ink-3);
}
.app-queue b { color: var(--queued); font-family: var(--mono); }
.app-queue[hidden] { display: none; }

.app-list { flex: 1; overflow-y: auto; padding: .6rem; display: grid; gap: .5rem; align-content: start; }

.job {
  width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--c, var(--line-2));
  border-radius: 10px; padding: .6rem .7rem;
  cursor: pointer;
  display: grid; gap: .15rem;
  transition: border-color .15s, transform .1s, background .15s;
}
.job:hover { background: var(--panel-2); }
.job:active { transform: scale(.985); }
.job[data-s="picked"]    { --c: var(--warn); }
.job[data-s="delivered"] { --c: var(--go); }
.job[data-s="failed"]    { --c: var(--stop); }
.job[data-pending="1"]   { border-style: dashed; }

.job__top { display: flex; align-items: baseline; gap: .4rem; }
.job__id { font-family: var(--mono); font-size: .62rem; color: var(--ink-3); }
.job__st {
  margin-left: auto;
  font-family: var(--mono); font-size: .56rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--c, var(--ink-3));
}
.job__who  { font-size: .82rem; font-weight: 600; }
.job__addr { font-size: .7rem; color: var(--ink-2); }
.job__tag {
  display: inline-flex; align-items: center; gap: .25rem;
  margin-top: .2rem;
  font-family: var(--mono); font-size: .55rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--queued);
}
.job__tag[hidden] { display: none; }

/* --------------------------------------------------------------- detail --- */

.app-detail {
  position: absolute; inset: 0;
  background: var(--bg-2);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.16,1,.3,1);
  z-index: 4;
}
.app-detail.is-on { transform: none; }
.app-detail__head { flex: none; padding: 30px 14px 10px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .5rem; }
.app-detail__head h3 { margin: 0; font-size: .9rem; font-weight: 700; }
.app-back {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: none; color: var(--ink); cursor: pointer;
}
.app-back svg { width: 14px; height: 14px; }

.app-detail__body { flex: 1; overflow-y: auto; padding: .8rem; display: grid; gap: .7rem; align-content: start; }
.app-kv { display: grid; gap: .35rem; font-size: .74rem; }
.app-kv div { display: flex; justify-content: space-between; gap: .8rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.app-kv dt { color: var(--ink-3); }
.app-kv dd { margin: 0; text-align: right; }

.app-acts { flex: none; padding: .7rem; border-top: 1px solid var(--line); display: grid; gap: .4rem; background: var(--panel); }

.cbtn {
  font: inherit; font-size: .78rem; font-weight: 600;
  padding: .6rem .9rem; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  cursor: pointer; width: 100%;
  transition: background .15s, border-color .15s, transform .1s;
}
.cbtn:hover { background: #2b3948; }
.cbtn:active { transform: scale(.98); }
.cbtn[disabled] { opacity: .4; cursor: not-allowed; }
.cbtn--go   { background: var(--go);   border-color: var(--go);   color: #052e21; }
.cbtn--warn { background: var(--warn); border-color: var(--warn); color: #2a1c00; }
.cbtn--stop { background: transparent; border-color: var(--stop); color: var(--stop); }

/* ------------------------------------------------------------- controls --- */

.cur-ctl { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; max-width: 24rem; }
.cur-ctl .cbtn { width: auto; font-size: .74rem; padding: .45rem .8rem; }
.cur-ctl .cbtn--net { border-color: var(--stop); color: var(--stop); background: transparent; }
.cur-ctl .cbtn--net[data-net="off"] { background: var(--stop); color: #2b0d13; }

/* ------------------------------------------------------------- the log --- */

.cur-side { display: grid; gap: 1rem; align-content: start; }

.cur-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cur-card__head {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.cur-card__head h3 { margin: 0; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.cur-card__head .sp { margin-left: auto; }
.cur-card__body { padding: .8rem .9rem; }

.cur-log { margin: 0; padding: 0; list-style: none; display: grid; gap: .3rem; font-family: var(--mono); font-size: .68rem; max-height: 19rem; overflow-y: auto; }
.cur-log li {
  display: grid; grid-template-columns: auto auto 1fr; gap: .5rem;
  padding: .3rem .1rem; border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  animation: cur-in .25s ease-out;
}
@keyframes cur-in { from { opacity: 0; transform: translateY(-3px); } }
.cur-log time { color: var(--ink-3); }
.cur-log b { font-weight: 600; }
.cur-log[data-empty] li { border: 0; }
.cur-log .k-queued  { color: var(--queued); }
.cur-log .k-sent    { color: var(--go); }
.cur-log .k-retry   { color: var(--warn); }
.cur-log .k-dropped { color: var(--ink-3); }
.cur-log .k-conflict{ color: var(--stop); }
.cur-empty { color: var(--ink-3); font-size: .74rem; }

.cur-server { display: grid; gap: .3rem; font-family: var(--mono); font-size: .7rem; }
.cur-server div { display: flex; justify-content: space-between; gap: .8rem; padding: .25rem 0; border-bottom: 1px solid var(--line); }
.cur-server dt { color: var(--ink-3); }
.cur-server dd { margin: 0; }
.cur-server .s-delivered { color: var(--go); }
.cur-server .s-picked    { color: var(--warn); }
.cur-server .s-failed    { color: var(--stop); }
.cur-server .s-waiting   { color: var(--ink-3); }

/* --------------------------------------------------------------- notes --- */

.cur-note {
  margin-top: 2rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: clamp(1.1rem, 3vw, 2rem);
}
.cur-note h2 { margin: 0 0 .8rem; font-size: 1.25rem; letter-spacing: -0.02em; }
.cur-note h3 { margin: 1.6rem 0 .4rem; font-size: .95rem; }
.cur-note p  { margin: 0 0 .7rem; color: var(--ink-2); line-height: 1.7; max-width: 46rem; }
.cur-note code {
  font-family: var(--mono); font-size: .86em;
  background: #101820; border-radius: 4px; padding: .1em .35em; color: var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  .cur *, .cur *::before, .cur *::after {
    transition-duration: .01ms !important; animation-duration: .01ms !important;
  }
}
