/* Golden Shovel Composer — only what's unique to it. Tokens, body, top-bar,
   header, kicker and note live in /lib/composer-base.css. The button and
   archive rules mirror the .haiku-* family under a .shovel-* prefix. */

.shovel-root {
  min-height: calc(100vh - 48px);
  padding: 0 24px 120px;
}

.shovel-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 0 40px;
}

/* Small mono label — field names inside the seed block. */
.shovel-label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.shovel-label--field {
  display: block;
  margin-top: 14px;
  margin-bottom: 4px;
}

/* ── Seed: the borrowed line + attribution ─────────────────────────── */
.shovel-seed {
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.shovel-seed--open { background: var(--bg-card-hit); }

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

.shovel-seed-count {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 1px;
  color: var(--ink-faint);
}

/* Collapsed: the line itself is poem text, so serif italic is allowed. */
.shovel-seed-line {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.4;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.shovel-seed-after {
  margin-top: 4px;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.shovel-source,
.shovel-attribution {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 2px 0 4px;
  font-family: var(--font-serif);
  color: var(--ink);
  outline: none;
}
.shovel-source {
  font-size: 1.2rem;
  line-height: 1.4;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.shovel-attribution { font-size: 1rem; line-height: 1.3; }
.shovel-source:focus,
.shovel-attribution:focus { border-bottom-color: rgba(26, 23, 20, 0.55); }
.shovel-source::placeholder,
.shovel-attribution::placeholder { color: var(--ink-faint); }
.shovel-source::placeholder { font-style: italic; }

.shovel-seed-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 14px;
}

/* ── Bar: progress readout + Write / Read ──────────────────────────── */
.shovel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

.shovel-progress {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: var(--ink-mute);
}
.shovel-held { color: var(--over); cursor: help; }

.shovel-switch {
  display: inline-flex;
  background: rgba(26, 23, 20, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.shovel-switch button {
  background: transparent;
  border: 0;
  padding: 6px 14px;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: #4a453e;
  cursor: pointer;
  border-radius: 2px;
}
.shovel-switch button.is-on {
  background: var(--ink);
  color: var(--bg-page);
}

/* ── Write: title + spine rows ─────────────────────────────────────── */
.shovel-title {
  display: block;
  width: 100%;
  margin-top: 18px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 2px 0 4px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.3;
  color: var(--ink);
  outline: none;
}
.shovel-title:hover { border-bottom-color: var(--line); }
.shovel-title:focus { border-bottom-color: rgba(26, 23, 20, 0.55); }
.shovel-title::placeholder { color: var(--ink-faint); font-weight: 400; }

/* One grid for the whole poem; each row is a subgrid of it, so the end-word
   column is as wide as the longest end-word and every end-word starts at
   the same x. That vertical run down the right is the borrowed line. */
.shovel-rows {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 6px;
}

.shovel-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto; /* no-subgrid fallback */
  grid-template-columns: subgrid;
  align-items: end;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 160ms ease, background 160ms ease;
}
.shovel-row:focus-within {
  border-color: var(--line-strong);
  background: var(--bg-card-hit);
}

/* Stanza gap — where the borrowed line had a line break. */
.shovel-row--gap { margin-top: 20px; }

.shovel-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
  text-align: right;
  color: var(--ink-faint);
  padding-bottom: 10px;
  user-select: none;
}

/* Lead-in, end-word and punctuation share one set of metrics so their
   baselines agree when the row is bottom-aligned (a wrapped lead-in meets
   the end-word on its LAST visual line). */
.shovel-lead,
.shovel-word,
.shovel-punct {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.3;
  padding: 2px 0 4px;
  color: var(--ink);
}

.shovel-lead {
  display: block;
  width: 100%;
  min-width: 0;
  text-align: right;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.shovel-lead:focus { border-bottom-color: rgba(26, 23, 20, 0.55); }
.shovel-lead::placeholder { color: var(--ink-faint); font-style: italic; }

.shovel-end {
  display: flex;
  align-items: flex-end;
  white-space: nowrap;
}

/* The fixed end-word. Marked by weight, never italic. Never wraps; a
   pathologically long token is clipped rather than breaking the row. */
.shovel-word {
  display: block;
  max-width: min(16em, 46vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  cursor: default;
}

.shovel-punct {
  width: 2.2em;
  flex: 0 0 auto;
  margin-left: 1px;
  background: transparent;
  border: 0;
  border-bottom: 1px dotted var(--line-strong);
  border-radius: 0;
  outline: none;
}
.shovel-punct:focus { border-bottom: 1px solid rgba(26, 23, 20, 0.55); }

/* ── Read: the local draft, set clean ──────────────────────────────── */
.shovel-read {
  margin-top: 18px;
  padding: 32px 32px 36px;
  background: var(--bg-card-hit);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.shovel-read-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.2px;
  margin-bottom: 20px;
  overflow-wrap: anywhere;
}

.shovel-poem {
  font-family: var(--font-serif);
  color: var(--ink);
}
.shovel-poem-line {
  /* hanging indent for lines that wrap */
  padding-left: 1.5em;
  text-indent: -1.5em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.shovel-poem-line--gap { margin-top: 1.1em; }
.shovel-poem-word { font-weight: 600; }

.shovel-read .shovel-poem {
  font-size: 1.25rem;
  line-height: 1.55;
}

.shovel-read-after {
  margin-top: 24px;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

/* ── Actions ───────────────────────────────────────────────────────── */
.shovel-actions {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}

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

.shovel-btn {
  background: transparent;
  border: 1px solid rgba(26, 23, 20, 0.25);
  color: rgba(26, 23, 20, 0.75);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.shovel-btn:hover:not(:disabled) {
  background: rgba(26, 23, 20, 0.06);
  color: var(--ink);
  border-color: rgba(26, 23, 20, 0.5);
}
.shovel-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.shovel-btn--primary {
  border-color: rgba(26, 23, 20, 0.55);
  color: var(--ink);
}
.shovel-btn--primary:hover:not(:disabled) {
  background: var(--ink);
  color: var(--bg-page);
  border-color: var(--ink);
}
.shovel-btn--primary.is-glow {
  border-color: rgba(42, 77, 51, 0.7);
  color: var(--ok);
  background: var(--ok-wash);
}
.shovel-btn--primary.is-glow:hover:not(:disabled) {
  background: rgba(42, 77, 51, 0.9);
  color: var(--bg-page);
  border-color: rgba(42, 77, 51, 0.95);
}

.shovel-link {
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-mute);
  cursor: pointer;
}
.shovel-link:hover { color: var(--ink); }

/* ── Archive ───────────────────────────────────────────────────────── */
.shovel-archive {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

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

.shovel-archive-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.shovel-archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shovel-archive-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.shovel-archive-text {
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--ink);
}
.shovel-archive-title {
  font-weight: 500;
  font-size: 1.15rem;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.shovel-archive-after {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.shovel-archive-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
}

.shovel-archive-counts {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  color: var(--ink-mute);
}
.shovel-archive-counts--done { color: var(--ok); }

.shovel-archive-buttons {
  display: flex;
  gap: 10px;
}

/* ── Mobile ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .shovel-root { padding: 0 14px 80px; }
  .shovel-page { padding: 32px 0 24px; }
  .compose-head h1 { font-size: 1.7rem; }
  .section-note { font-size: 0.9rem; }

  .shovel-seed { padding: 12px; }
  .shovel-seed-line,
  .shovel-source { font-size: 1.1rem; }

  .shovel-rows {
    grid-template-columns: 16px minmax(0, 1fr) auto;
    column-gap: 8px;
  }
  .shovel-row { padding: 8px 10px; }
  .shovel-num { font-size: 0.62rem; padding-bottom: 9px; }

  /* 1rem floor: anything smaller makes iOS zoom the page on focus. */
  .shovel-lead,
  .shovel-word,
  .shovel-punct { font-size: 1.05rem; }
  .shovel-punct { width: 1.9em; }
  .shovel-title { font-size: 1.25rem; }

  .shovel-read { padding: 22px 18px 26px; }
  .shovel-read .shovel-poem { font-size: 1.1rem; }

  .shovel-actions { flex-wrap: wrap; gap: 8px; }
  .shovel-buttons { width: 100%; justify-content: flex-end; }
  .shovel-btn { padding: 6px 10px; font-size: 0.68rem; }

  .shovel-archive { margin-top: 40px; }
  .shovel-archive-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }
  .shovel-archive-text { font-size: 1rem; }
  .shovel-archive-meta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}
