/* ============================================================
   Shot List form — styles
   One cool palette: every section tint is a low-saturation
   sibling of the brand blue (azure → indigo → teal → violet →
   steel), so the card reads as a single system.
   ============================================================ */

:root {
  /* brand */
  --brand-900: #152940;
  --brand-700: #1f4468;
  --brand-600: #2a5d8c;
  --brand-500: #3a76ad;
  --brand-100: #e1ecf6;
  --brand-50: #f1f6fb;

  /* section palette — background / stroke / accent ink */
  --sec-azure-bg: #e7f1fb;   --sec-azure-line: #bdd8f0;   --sec-azure-ink: #1d4a75;
  --sec-indigo-bg: #e9ecfb;  --sec-indigo-line: #c5cdee;  --sec-indigo-ink: #2f3d80;
  --sec-indigo-deep: #2a2166; /* darker purple, for small text on the indigo tint */
  --sec-teal-bg: #e2f2f5;    --sec-teal-line: #b2d7de;    --sec-teal-ink: #14545f;
  --sec-violet-bg: #eeebfb;  --sec-violet-line: #cdc6ed;  --sec-violet-ink: #483d8c;
  --sec-steel-bg: #e8eef6;   --sec-steel-line: #c0cddd;   --sec-steel-ink: #2d4a72;
  --sec-plain-bg: #f5f7fa;   --sec-plain-line: #dbe3ec;   --sec-plain-ink: #3d4a5a;

  --ink: #232830;
  --ink-soft: #5b6572;
  --line: #d6dee6;
  --danger: #b3432f;
  --amber: #9c7016;
  --paper: #ffffff;
  --bg: #f4f7fa;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(21, 41, 64, 0.08), 0 4px 14px rgba(21, 41, 64, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

/* ---------------- top bar ---------------- */
.topbar {
  background: var(--brand-700);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}

.topbar__inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap; /* the badge drops below the title on phones */
}

.topbar__brand { display: flex; align-items: center; gap: 14px; }

.topbar__icon {
  width: 46px;
  height: 36px;
  fill: none;
  stroke: #cddcec;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.topbar h1 { margin: 0; font-size: 1.2rem; letter-spacing: 0.02em; }

.topbar__status { display: flex; align-items: center; gap: 10px; }

.autosave-status {
  font-size: 0.78rem;
  color: #cfe0f2;
  white-space: nowrap;
}

.autosave-status[hidden] { display: none; }

.autosave-status--error { color: #ffc9bd; }

.shot-count-badge {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ---------------- layout ---------------- */
.page {
  max-width: 1060px;
  margin: 0 auto;
  padding: 18px 20px 80px;
}

.draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--sec-azure-bg);
  border: 1px solid var(--sec-azure-line);
  border-left: 4px solid var(--brand-600);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--sec-azure-ink);
}

.draft-banner[hidden] { display: none; }

.draft-banner__actions { display: flex; gap: 8px; flex: none; }

.intro-strip {
  margin: 0 0 18px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: var(--brand-50);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 16px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 26px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1.02rem;
  color: var(--brand-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------------- fields ---------------- */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 12px 18px;
  margin-bottom: 4px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field--wide { grid-column: 1 / -1; }

.field-grid--two { grid-template-columns: 1fr 1fr; }

.field__label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.field__label em { color: var(--danger); font-style: normal; }

input[type="text"],
input[type="email"],
input[type="url"],
input[type="date"],
textarea {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(58, 118, 173, 0.18);
}

textarea { resize: vertical; }

.invalid,
input.invalid,
textarea.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(179, 67, 47, 0.14); }

div.invalid { border: 1px solid var(--danger); border-radius: var(--radius); padding: 6px; }

/* ---------------- multi-SKU shots ---------------- */
.sku-field { gap: 6px; }

.sku-single { display: flex; flex-direction: column; gap: 5px; }
.sku-single[hidden] { display: none; }

/* deliberately quiet — single-SKU stays the path of least resistance */
.linkish {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.76rem;
  color: var(--brand-600);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.linkish:hover { color: var(--brand-700); }
.linkish[hidden] { display: none; }

.sku-multi { display: flex; flex-direction: column; gap: 5px; }
.sku-multi[hidden] { display: none; }

.sku-multi textarea { font-size: 0.9rem; line-height: 1.35; }

.sku-multi__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sku-count { font-size: 0.78rem; font-weight: 600; color: var(--brand-700); }

.sku-multi__help,
.sku-nudge {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.sku-nudge {
  color: var(--amber);
  font-weight: 600;
}
.sku-nudge[hidden] { display: none; }

/* ---------------- shot sections & pickers ---------------- */
.picker {
  border: none;
  margin: 22px 0 0;
  padding: 0;
  min-inline-size: 0;
}

.picker legend,
.picker__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  padding: 0;
  float: left;      /* lets a legend sit inside a boxed fieldset */
  width: 100%;
}

/* Grid/flex boxes shrink to avoid floats, so everything after a
   floated legend must clear it or it collapses to one column. */
.picker > :not(legend):not(.picker__title) { clear: both; }

.picker legend em { color: var(--danger); font-style: normal; }

.legend-hint { font-weight: 400; font-size: 0.78rem; color: var(--ink-soft); }

.angle-nudge {
  margin: 10px 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--sec-indigo-deep);
}
.angle-nudge[hidden] { display: none; }


/* -------- boxed sections: stroke + tinted background -------- */
.sec-box {
  border: 1px solid var(--sec-line, var(--line));
  background: var(--sec-bg, #fff);
  border-radius: 10px;
  padding: 13px 14px 12px;
  margin-top: 0;
}

.sec-box legend,
.sec-box .picker__title { color: var(--sec-ink, var(--ink)); }

.sec-box .tile { border-color: rgba(255, 255, 255, 0.9); }
.sec-box .tile:hover { border-color: var(--sec-ink, var(--brand-500)); }
.sec-box .tile__art { color: var(--sec-ink, var(--brand-600)); }

.sec-box .tile:has(.tile__input:checked) {
  border-color: var(--sec-ink, var(--brand-600));
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--sec-ink, var(--brand-600));
}

.sec-box .tile:has(.tile__input:checked)::after { background: var(--sec-ink, var(--brand-600)); }

.sec-box .tile-group__label { color: var(--sec-ink, var(--brand-600)); opacity: 0.85; }

.sec-box--type    { --sec-bg: var(--sec-azure-bg);  --sec-line: var(--sec-azure-line);  --sec-ink: var(--sec-azure-ink); }
.sec-box--angle   { --sec-bg: var(--sec-indigo-bg); --sec-line: var(--sec-indigo-line); --sec-ink: var(--sec-indigo-ink); }
.sec-box--orient  { --sec-bg: var(--sec-teal-bg);   --sec-line: var(--sec-teal-line);   --sec-ink: var(--sec-teal-ink); }
.sec-box--use     { --sec-bg: var(--sec-violet-bg); --sec-line: var(--sec-violet-line); --sec-ink: var(--sec-violet-ink); }
.sec-box--priority{ --sec-bg: var(--sec-steel-bg);  --sec-line: var(--sec-steel-line);  --sec-ink: var(--sec-steel-ink); }
.sec-box--notes   { --sec-bg: var(--sec-plain-bg);  --sec-line: var(--sec-plain-line);  --sec-ink: var(--sec-plain-ink); }

/* -------- "all uses apply" shortcut -------- */
/* Rides on the legend line so the tiles in Orientation, Intended use,
   and Priority all start at the same height. */
.all-uses {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sec-ink, var(--ink));
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  vertical-align: baseline;
}

.all-uses input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--sec-ink, var(--brand-600));
  cursor: pointer;
}

/* -------- side-by-side Shot type / Angle columns -------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 22px;
}

.split__col { margin: 0; }

/* shot type groups */
.tile-groups { display: flex; flex-direction: column; gap: 12px; }

.tile-group__label {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-600);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 7px;
}

.tile-grid--small { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 5px 7px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s, background 0.12s, transform 0.06s;
  user-select: none;
}

.tile:hover { border-color: var(--brand-500); background: var(--brand-50); }
.tile:active { transform: scale(0.98); }

.tile__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tile__art { display: block; width: 50px; height: 38px; color: var(--brand-600); }

.tile__art svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile__art svg .fill { fill: currentColor; stroke: none; }

.tile__label { font-size: 0.76rem; font-weight: 600; line-height: 1.2; }

.tile:has(.tile__input:checked) {
  border-color: var(--brand-600);
  background: var(--brand-100);
  box-shadow: inset 0 0 0 1px var(--brand-600);
}

.tile:has(.tile__input:checked)::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  font-weight: 700;
}

.tile:has(.tile__input:focus-visible) {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* priority keeps its semantic tones */
.sec-box--priority .tile--high .tile__art { color: var(--danger); }
.sec-box--priority .tile--mid .tile__art { color: var(--amber); }
.sec-box--priority .tile--low .tile__art { color: var(--ink-soft); }

/* 290px keeps the "Intended use / All uses apply" legend on one line —
   it needs ~266px — so the tiles in all three boxes start level. Below
   that the row drops to two columns rather than letting a legend wrap. */
.picker-row {
  display: grid;
  /* min() lets the track shrink below 290px on very narrow screens
     instead of forcing the page to scroll sideways */
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: 14px;
  margin-top: 16px;
}

/* -------- reference image uploads -------- */
.ref-upload { margin-top: 7px; }

.ref-hint { margin-left: 8px; font-size: 0.72rem; color: var(--ink-soft); }

.ref-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }

.ref-thumb {
  position: relative;
  width: 72px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  flex: none;
}

.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ref-thumb__del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 17px;
  height: 17px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(21, 41, 64, 0.75);
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  cursor: pointer;
}
.ref-thumb__del:hover { background: var(--danger); }

/* ---------------- shot cards ---------------- */
.shot-card { border-top: 4px solid var(--brand-500); }

.shot-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.shot-number {
  margin: 0;
  font-size: 1rem;
  color: var(--brand-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.shot-card__tools { display: flex; gap: 8px; flex-wrap: wrap; }

.shot-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* the honest cost of a card's selections, shown before they submit */
.shot-yield {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.shot-yield--big { color: var(--amber); }

/* -------- collapsed shot: thin at-a-glance bar -------- */
.shot-card--collapsed {
  padding: 0;
  margin-bottom: 10px;
  border-top-width: 2px;
}

.shot-card--collapsed .shot-card__body { display: none; }

.shot-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.shot-summary[hidden] { display: none; }

/* brief highlight on a bar that just folded up, as confirmation */
@keyframes shot-collapsed-flash {
  from { box-shadow: 0 0 0 3px rgba(42, 93, 140, 0.5); }
  to   { box-shadow: 0 0 0 3px rgba(42, 93, 140, 0); }
}

.shot-card--flash { animation: shot-collapsed-flash 1.4s ease-out; }

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

.shot-summary:hover { background: var(--brand-50); }

.shot-summary__num {
  flex: none;
  background: var(--brand-600);
  color: #fff;
  border-radius: 999px;
  padding: 2px 11px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.shot-summary__title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34%;
}

.shot-summary__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--ink-soft);
  min-width: 0;
}

.shot-summary__meta .dot { color: var(--line); }

.shot-summary__edit {
  margin-left: auto;
  flex: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-600);
}

/* ---------------- buttons ---------------- */
.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 9px;
  border: 1.5px solid transparent;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--brand-600);
  color: #fff;
}
.btn--primary:hover { background: var(--brand-700); }

.btn--ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--brand-700);
}
.btn--ghost:hover { border-color: var(--brand-500); background: var(--brand-50); }

.btn--add {
  display: block;
  width: 100%;
  padding: 13px;
  border-style: dashed;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.btn--tiny {
  padding: 5px 11px;
  font-size: 0.76rem;
  background: #fff;
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn--tiny:hover { border-color: var(--brand-500); color: var(--brand-700); }

/* declared after .btn--tiny so the filled style wins on the banner */
.btn--restore {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}
.btn--restore:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }

.btn--danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------------- action bar & errors ---------------- */
.actionbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.actionbar__tools { display: flex; gap: 8px; flex-wrap: wrap; }

.actionbar .btn--primary { flex: 1; max-width: 420px; margin-left: auto; padding: 14px 22px; font-size: 1rem; }

.error-box {
  background: #fdf1ee;
  border: 1px solid #ecc4bb;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.error-box ul { margin: 8px 0 0; padding-left: 20px; }

/* ---------------- success overlay ---------------- */
.overlay[hidden] { display: none; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 26, 38, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.overlay__panel { max-width: 460px; width: 100%; margin: 0; }

.overlay__panel h2 { text-transform: none; letter-spacing: 0; font-size: 1.2rem; }

.overlay__file {
  background: var(--brand-100);
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
  word-break: break-all;
}

.overlay__hint { font-size: 0.85rem; color: var(--ink-soft); }

.overlay__panel .btn { width: 100%; margin-top: 6px; }

/* ---------------- small screens ---------------- */
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .field-grid--two { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .card { padding: 16px 14px; }
  .topbar__inner { padding: 10px 14px; }
  .topbar h1 { font-size: 1.02rem; }
  .topbar__icon { width: 36px; height: 28px; }
  .shot-count-badge { font-size: 0.78rem; padding: 4px 11px; }
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .actionbar .btn--primary { max-width: none; width: 100%; }
  .shot-summary__title { max-width: none; }
  .shot-summary__meta { display: none; }
}
