/* Frog & Finish — design rules (Derek, 2026-11-01):
   VERY clean. White / soft-neutral surfaces, lots of whitespace, thin
   dividers styled like stitching (dashed seams), exactly ONE accent
   (soft frog green) used sparingly. Project photos provide the color. */

:root {
  --green: #5da464;          /* the one accent */
  --green-dark: #4a8a51;
  --ink: #2b2b28;
  --muted: #7a7a72;
  --line: #d9d9d0;           /* stitched divider color */
  --surface: #ffffff;
  --bg: #fafaf7;
  --card: #ffffff;
  --radius: 14px;
}
html { font-size: 16px; }
html.large-text { font-size: 20px; }   /* Large Print toggle: everything is in rem */

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  padding-bottom: 5.5rem; /* room for bottom nav */
}

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.1rem 0.7rem;
  background: var(--surface);
  border-bottom: 2px dashed var(--line); /* stitched seam */
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-icon { width: 2.6rem; height: 2.6rem; }
.brand h1 { font-size: 1.35rem; margin: 0; font-weight: 700; letter-spacing: 0.01em; }
.tagline { margin: 0; color: var(--muted); font-size: 0.85rem; }
.ghost-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  font-size: 1rem; padding: 0.45rem 0.7rem; cursor: pointer; color: var(--ink);
}
.ghost-btn .big-a { font-size: 1.3rem; font-weight: 700; color: var(--green-dark); }

main { max-width: 30rem; margin: 0 auto; padding: 1rem 1.1rem 0.5rem; }
.hidden { display: none !important; }
.view h2 { font-size: 1.25rem; margin: 0.4rem 0 0.8rem; }
.view h3 { font-size: 1.05rem; margin: 1.1rem 0 0.5rem; }

/* cards + stitched dividers */
.card {
  background: var(--card); border: 1px solid #ecece5; border-radius: var(--radius);
  padding: 1rem; margin-bottom: 0.9rem;
}
.seam { border: none; border-top: 2px dashed var(--line); margin: 1rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* buttons: big, tappable, only the green is loud */
.btn {
  display: inline-block; border: none; cursor: pointer; text-align: center;
  background: var(--green); color: #fff; font-weight: 600;
  font-size: 1rem; padding: 0.8rem 1.2rem; border-radius: 12px; width: 100%;
}
.btn:active { background: var(--green-dark); }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--surface); color: #a33; border: 1px solid #e3c2c2; }
.btn-row { display: flex; gap: 0.6rem; }
.btn-row .btn { flex: 1; }
.btn[disabled] { opacity: 0.55; cursor: default; }
a.btn { text-decoration: none; }
.btn.dl { width: auto; flex: none; font-size: 0.92rem; padding: 0.55rem 0.9rem; border-radius: 10px; }
.yarnline.dlrow { display: flex; align-items: center; gap: 0.7rem; }
.yarnline.dlrow .grow { flex: 1; min-width: 0; }

/* lists */
.item {
  display: flex; gap: 0.8rem; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid #ecece5; border-radius: var(--radius);
  padding: 0.8rem; margin-bottom: 0.6rem; cursor: pointer; font: inherit; color: inherit;
}
.item img.thumb { width: 3.6rem; height: 3.6rem; object-fit: cover; border-radius: 10px; flex: none; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--green-dark); border: 1px solid var(--green); border-radius: 999px;
  padding: 0.08rem 0.5rem; vertical-align: middle; text-transform: uppercase;
}
.badge.gray { color: var(--muted); border-color: var(--line); }

/* progress */
.progress { height: 0.55rem; background: #eef0ea; border-radius: 999px; overflow: hidden; margin: 0.5rem 0; }
.progress > div { height: 100%; background: var(--green); }

/* forms */
label.field { display: block; margin-bottom: 0.8rem; font-weight: 600; font-size: 0.92rem; }
label.field span { display: block; margin-bottom: 0.3rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.7rem; background: #fff;
}
textarea { min-height: 4.5rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.yarn-row { border: 1px solid #ecece5; border-radius: 12px; padding: 0.7rem; margin-bottom: 0.6rem; background: #fff; }

/* tracker */
.row-display { text-align: center; padding: 1rem 0 0.4rem; }
.row-display .big { font-size: 3.2rem; font-weight: 800; line-height: 1; }
.row-display .of { color: var(--muted); font-size: 1.05rem; }

/* library filters */
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.8rem; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 0.45rem 0.85rem; font: inherit; font-size: 0.92rem; cursor: pointer;
}
.chip.active { border-color: var(--green); color: var(--green-dark); font-weight: 700; }
.searchbox { margin-bottom: 0.8rem; }

/* pattern detail */
.detail-img { width: 100%; border-radius: var(--radius); margin-bottom: 0.9rem; }
table.spec { width: 100%; border-collapse: collapse; }
table.spec th, table.spec td { text-align: left; padding: 0.45rem 0.2rem; vertical-align: top; }
table.spec tr + tr th, table.spec tr + tr td { border-top: 2px dashed var(--line); }
table.spec th { color: var(--muted); font-weight: 600; width: 42%; }

/* bottom nav: 5 big tappable items */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--surface);
  border-top: 2px dashed var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; border: none; background: none; cursor: pointer; font: inherit;
  font-size: 0.78rem; color: var(--muted); padding: 0.55rem 0 0.7rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  min-height: 3.6rem;
}
.nav-btn .nav-ico { font-size: 1.35rem; line-height: 1; }
.nav-btn.active { color: var(--green-dark); font-weight: 700; }

.app-footer { max-width: 30rem; margin: 0 auto; padding: 0.4rem 1.1rem 1rem; color: var(--muted); font-size: 0.8rem; }
a { color: var(--green-dark); }
.steps { padding-left: 1.3rem; }
.steps li { margin-bottom: 0.35rem; }
.video-link { display: block; padding: 0.4rem 0; }

/* Pattern detail designed sections (2026-11-02 design rule) */
.band {
  background: var(--green); color: #fff; font-weight: 700;
  padding: 0.45rem 0.8rem; border-radius: 10px; letter-spacing: 0.01em;
}
.swatch {
  display: inline-block; width: 0.95em; height: 0.95em; border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.25); vertical-align: -0.12em; margin-right: 0.45em;
}

/* yarn color chips (scan.js) — the at-a-glance color square */
.color-chip {
  display: inline-block; width: 1.05em; height: 1.05em; border-radius: 5px;
  border: 1px solid rgba(0,0,0,0.28); vertical-align: -0.18em; margin-right: 0.45em;
  background: #fff;
}
.color-chip--empty {
  background: repeating-linear-gradient(45deg, #fff 0 4px, #ecece5 4px 8px);
  border-style: dashed; border-color: var(--line);
}
/* color name + picker side by side in yarn forms */
.color-field { display: flex; align-items: center; gap: 0.6rem; }
.color-field input[type="color"] {
  width: 3.2rem; height: 2.6rem; flex: none; padding: 0.2rem; cursor: pointer;
}
.color-preview { display: inline-flex; align-items: center; font-weight: 400; font-size: 0.92rem; }

/* barcode scanner overlay (scan.js) */
.scan-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(30, 32, 28, 0.92);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.scan-box { width: 100%; max-width: 26rem; text-align: center; }
.scan-title { color: #fff; font-weight: 700; margin: 0 0 0.8rem; }
.scan-video {
  width: 100%; border-radius: var(--radius); background: #000;
  border: 2px dashed var(--line); aspect-ratio: 4 / 3; object-fit: cover;
}
.scan-hint { color: #d8d8d0; font-size: 0.9rem; margin: 0.8rem 0; }
.scan-cancel { max-width: 12rem; margin: 0 auto; }
.yarnline { padding: 0.3rem 0; }
.yarnline + .yarnline { border-top: 2px dashed var(--line); }
.tagchip {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.1rem 0.6rem; margin: 0.15rem 0.25rem 0.15rem 0; font-size: 0.85em; color: var(--muted);
}

.scan-status { color: #ffe9b8; font-size: 0.95rem; font-weight: 600; margin: 0.8rem 0 0; }
.scan-manual { display: flex; gap: 0.5rem; justify-content: center; margin: 0.6rem auto 0.8rem; max-width: 22rem; }
.scan-manual-input { flex: 1; min-width: 0; padding: 0.55rem 0.7rem; border-radius: 0.6rem; border: 1px solid #555; font-size: 1rem; }
.scan-manual-btn { white-space: nowrap; }

.pattern-reader h4 { margin: 1rem 0 0.4rem; }
.pattern-reader h4:first-of-type { margin-top: 0.4rem; }
.pattern-reader .prow { margin: 0 0 0.55rem; line-height: 1.55; }

/* Pattern reader: edition switcher above the in-app PDF pages */
.pdf-editions { display: flex; flex-wrap: wrap; gap: .45rem; margin: .6rem 0 .2rem; }
.pdf-editions .edtab { width: auto; padding: .55rem .9rem; }
#pdf-pages canvas { border-radius: 4px; }
