/* ===========================================================================
   Owlery Knits - one stylesheet.

   The hand: an undyed wool ground with navy ink, a brick red reserved for the
   active row and the live rail letter, and a moss green used only on figures.
   Everything is square. Tables are ruled like a workshop chart sheet - hairlines
   between rows, no fills, no shadows, no rounding. The single rounded shape in
   the file is the button, and it is rounded on the left only, the way a ball
   band sits on a skein.
   =========================================================================== */

:root {
  --yarn-loft: #f2ece1;      /* the paper */
  --yarn-dye: #23324a;       /* navy ink */
  --yarn-brick: #c0553f;     /* brick accent */
  --yarn-moss: #6f7d5a;      /* moss, figures only */
  --yarn-grey: #8b8578;      /* secondary text */
  --yarn-rule: #d6cdbd;      /* hairline */
  --yarn-rule-soft: #e5ded1;
  --gauge-rule: 1px solid var(--yarn-rule);
  --gauge-face: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  --yarn-face: "Lora", "Iowan Old Style", "Palatino Linotype", Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --plain-face: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --measure: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--yarn-loft);
  color: var(--yarn-dye);
  font-family: var(--plain-face);
  font-size: 16px;
  line-height: 1.62;
  background-image: linear-gradient(var(--yarn-rule-soft) 1px, transparent 1px);
  background-size: 100% 32px;
}

a { color: var(--yarn-dye); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--yarn-brick); }
img { max-width: 100%; height: auto; }

.gauge-fig {
  font-family: var(--gauge-face);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--yarn-dye); color: var(--yarn-loft);
  padding: 10px 16px; z-index: 40;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--yarn-brick); outline-offset: 2px; }

/* --------------------------------------------------------------- top bar -- */

.yarn-bar {
  display: flex; flex-wrap: wrap; gap: 12px 24px;
  align-items: baseline; justify-content: space-between;
  max-width: var(--measure); margin: 0 auto;
  padding: 22px 20px 14px;
  border-bottom: var(--gauge-rule);
}
.bar-brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.brand-mark { display: inline-flex; align-items: baseline; gap: 9px; text-decoration: none; }
.brand-owl { color: var(--yarn-brick); font-size: 15px; }
.brand-name { font-family: var(--yarn-face); font-size: 25px; letter-spacing: -0.01em; }
.brand-tag { color: var(--yarn-grey); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; }

.bar-tools { display: flex; align-items: baseline; gap: 18px; }
.search-form { display: flex; align-items: baseline; gap: 8px; position: relative; }
.search-label { position: absolute; left: -9999px; }
.search-input {
  font: inherit; font-size: 14px;
  background: transparent; color: var(--yarn-dye);
  border: 0; border-bottom: var(--gauge-rule);
  padding: 4px 2px; width: 190px; border-radius: 0;
}
.search-input::placeholder { color: var(--yarn-grey); }
.search-out {
  position: absolute; top: 100%; right: 0; margin: 6px 0 0;
  min-width: 250px; max-width: 340px;
  background: var(--yarn-loft); border: var(--gauge-rule);
  font-size: 13.5px; padding: 0; z-index: 30;
}
.search-out:empty { display: none; border: 0; }
.search-out a { display: block; padding: 7px 11px; text-decoration: none; border-bottom: var(--gauge-rule-soft); }
.search-out a:last-child { border-bottom: 0; }
.search-out a:hover { background: #eae2d3; color: var(--yarn-brick); }
.search-out .so-none { display: block; padding: 8px 11px; color: var(--yarn-grey); }
.lang-swap {
  font-size: 13px; letter-spacing: 0.05em; text-decoration: none;
  border-bottom: 2px solid var(--yarn-brick); padding-bottom: 1px;
}

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

.yarn-layout {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  max-width: var(--measure); margin: 0 auto;
  padding: 0 20px;
}

.letter-rail {
  position: sticky; top: 0; align-self: start;
  padding: 26px 0 40px;
  border-right: var(--gauge-rule);
  margin-right: 26px;
}
.rail-cap {
  margin: 0 0 12px; font-family: var(--gauge-face);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--yarn-grey);
}
.rail-list { list-style: none; margin: 0; padding: 0; }
.rail-item { line-height: 1; margin-bottom: 3px; }
.rail-letter {
  display: block; font-family: var(--gauge-face); font-size: 13px;
  padding: 3px 0; color: var(--yarn-rule);
}
.rail-link { display: flex; align-items: baseline; gap: 5px; text-decoration: none; }
.rail-link .rail-letter { color: var(--yarn-dye); }
.rail-link:hover .rail-letter { color: var(--yarn-brick); }
.rail-count { font-family: var(--gauge-face); font-size: 9.5px; color: var(--yarn-moss); }
.rail-hint {
  margin: 20px 14px 0 0; font-size: 10.5px; line-height: 1.45;
  color: var(--yarn-grey); writing-mode: vertical-rl; max-height: 200px;
}

.yarn-main { padding: 30px 0 60px; min-width: 0; }

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

.sheet-head { border-bottom: 3px double var(--yarn-dye); padding-bottom: 20px; margin-bottom: 26px; }
.sheet-title {
  font-family: var(--yarn-face); font-weight: 600;
  font-size: clamp(28px, 4.4vw, 44px); line-height: 1.14;
  margin: 0 0 14px; letter-spacing: -0.015em;
}
.sheet-lede {
  margin: 0 0 18px; max-width: 68ch;
  font-size: 17px; color: #3c4a5f;
}
.tally { display: flex; flex-wrap: wrap; gap: 0 34px; margin: 0; }
.tally-cell { display: flex; align-items: baseline; gap: 8px; }
.tally-cell dt { font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--yarn-grey); }
.tally-cell dd { margin: 0; font-size: 20px; color: var(--yarn-moss); }

/* ---------------------------------------------------------------- tables -- */

.table-scroll { overflow-x: auto; }

.legend-sheet, .chart-grid, .measure-table, .yarn-table {
  width: 100%; border-collapse: collapse; margin: 0 0 8px;
  font-size: 14.5px;
}
.legend-sheet caption, .chart-grid caption, .measure-table caption, .yarn-table caption {
  caption-side: top; text-align: left;
  font-family: var(--gauge-face); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--yarn-grey);
  padding: 0 0 8px;
}
.legend-sheet th, .chart-grid th, .measure-table th, .yarn-table th {
  text-align: left; font-weight: 600; font-size: 11.5px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--yarn-grey);
  border-top: var(--gauge-rule); border-bottom: var(--gauge-rule);
  padding: 8px 12px 8px 0;
}
.legend-sheet td, .chart-grid td, .measure-table td, .yarn-table td {
  border-bottom: var(--gauge-rule-soft); padding: 11px 12px 11px 0;
  vertical-align: top;
}
.legend-sheet tbody tr:hover, .chart-grid tbody tr:hover { background: #ece4d6; }

.cell-sym { width: 54px; }
.sym-glyph {
  display: inline-block; min-width: 30px; text-align: center;
  font-family: var(--gauge-face); font-size: 19px; color: var(--yarn-brick); line-height: 1;
}
.cell-thumb { width: 82px; }
/* content-box so the 1px rule and 3px mount sit outside the figure's own
   width/height attributes instead of shrinking the drawing. */
.swatch-thumb { display: block; box-sizing: content-box; border: var(--gauge-rule-soft); background: #fffdf8; padding: 3px; }
.cell-name { min-width: 220px; }
.row-link { font-family: var(--yarn-face); font-size: 17.5px; text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.row-abbr { display: block; font-family: var(--gauge-face); font-size: 11.5px; color: var(--yarn-grey); margin-top: 2px; }
.cell-kind { width: 90px; }
.cell-family, .cell-level { width: 108px; font-size: 13.5px; color: #4a5769; }
.cell-date { width: 104px; }
.cell-date time { font-family: var(--gauge-face); font-size: 12px; color: var(--yarn-grey); }

.kind-tag {
  display: inline-block; font-family: var(--gauge-face); font-size: 10.5px;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px;
  border: 1px solid currentColor;
}
.kind-stitch .kind-tag, .kind-tag.kind-stitch { color: var(--yarn-dye); }
.kind-pattern .kind-tag, .kind-tag.kind-pattern { color: var(--yarn-brick); }
.kind-tutorial .kind-tag, .kind-tag.kind-tutorial { color: var(--yarn-moss); }

.chart-grid .cg-step { width: auto; }
.chart-grid .cg-round, .chart-grid .cg-count, .measure-table .gauge-fig, .yarn-table .gauge-fig {
  text-align: right; white-space: nowrap;
}
.cg-text { display: block; }
.cg-note { display: block; font-size: 12.5px; color: var(--yarn-grey); margin-top: 3px; }

/* ----------------------------------------------------------------- prose -- */

.prose-band { margin: 34px 0 0; max-width: 74ch; }
.prose-head {
  font-family: var(--yarn-face); font-weight: 600; font-size: 22px;
  margin: 0 0 10px; padding-bottom: 6px; border-bottom: var(--gauge-rule);
}
.prose-p { margin: 0 0 14px; }

.block-head {
  font-family: var(--gauge-face); font-size: 11.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--yarn-grey);
  margin: 34px 0 10px; padding-bottom: 6px; border-bottom: var(--gauge-rule);
}
.block-spec .block-head { margin-top: 0; }

.spec-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 24px; }
.spec-item { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: var(--gauge-rule-soft); }
.spec-key { flex: 0 0 78px; font-family: var(--gauge-face); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--yarn-grey); }
.spec-val { font-size: 14px; }

/* ------------------------------------------------------------- legend band */

.stitch-band {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 20px;
  border-top: 3px double var(--yarn-dye); border-bottom: 3px double var(--yarn-dye);
  padding: 12px 0; margin: 0 0 26px;
  background: repeating-linear-gradient(90deg, transparent 0 23px, #e8e0d1 23px 24px);
}
.band-cap { font-family: var(--gauge-face); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--yarn-grey); background: var(--yarn-loft); padding-right: 8px; }
.band-cells { list-style: none; display: flex; flex-wrap: wrap; gap: 0 18px; margin: 0; padding: 0; }
.band-cell { display: flex; align-items: baseline; gap: 6px; background: var(--yarn-loft); padding: 0 6px; }
.band-glyph { font-family: var(--gauge-face); font-size: 19px; color: var(--yarn-brick); line-height: 1; }
.band-word { font-size: 13px; color: var(--yarn-grey); }
.band-abbr { margin-left: auto; font-family: var(--gauge-face); font-size: 12px; color: var(--yarn-dye); background: var(--yarn-loft); padding-left: 8px; }

/* ------------------------------------------------------------------ misc -- */

.crumb { margin: 0 0 18px; }
.crumb-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0 10px; margin: 0; padding: 0; font-size: 12.5px; }
.crumb-list li + li::before { content: "/"; color: var(--yarn-rule); margin-right: 10px; }
.crumb-list a { color: var(--yarn-grey); text-decoration: none; }
.crumb-list a:hover { color: var(--yarn-brick); text-decoration: underline; }
.crumb-here { color: var(--yarn-dye); }

.entry-kicker { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 0 0 12px; font-size: 13px; color: var(--yarn-grey); }
.kicker-sep { color: var(--yarn-rule); }
.entry-dates { display: flex; flex-wrap: wrap; gap: 6px 30px; margin: 0; font-size: 13px; }
.date-cap { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--yarn-grey); margin-right: 6px; }

.entry-figure { margin: 30px 0 0; }
.entry-figure img { border: var(--gauge-rule); background: #fffdf8; padding: 10px; max-width: 100%; }
.fig-cap { font-size: 12.5px; color: var(--yarn-grey); margin-top: 8px; max-width: 70ch; }

.entry-prose { margin-top: 34px; }
.entry-prose .prose-band { margin-top: 22px; }

.note-band { margin: 40px 0 0; padding: 16px 18px; border: var(--gauge-rule); border-left: 4px solid var(--yarn-moss); background: #f6f1e7; max-width: 78ch; }
.note-cap { margin: 0 0 6px; font-family: var(--gauge-face); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--yarn-moss); }
.note-body { margin: 0; font-size: 13.5px; color: #46536a; }

.kind-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 30px; margin-bottom: 34px; }
.kind-block { border-top: var(--gauge-rule); padding: 12px 0 18px; }
.kind-cap { font-family: var(--yarn-face); font-size: 19px; font-weight: 600; margin: 0; display: inline-block; }
.kind-num { display: block; font-size: 26px; color: var(--yarn-moss); margin: 2px 0 8px; }
.kind-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.kind-list li { padding: 4px 0; border-bottom: var(--gauge-rule-soft); }
.kind-list a { text-decoration: none; }
.kind-list a:hover { text-decoration: underline; }
.kind-empty, .letter-none { color: var(--yarn-grey); font-size: 13px; margin: 0; padding: 6px 0; }

.letter-block { margin-bottom: 30px; }
.letter-block.is-empty { opacity: 0.55; }
.letter-cap { display: flex; align-items: baseline; gap: 12px; margin: 0 0 10px; padding-bottom: 5px; border-bottom: 2px solid var(--yarn-dye); }
.letter-mark { font-family: var(--yarn-face); font-size: 27px; font-weight: 600; }
.letter-count { font-size: 13px; color: var(--yarn-moss); }

.related-list { list-style: none; margin: 0; padding: 0; }
.related-item { padding: 11px 0; border-bottom: var(--gauge-rule-soft); }
.related-link { font-family: var(--yarn-face); font-size: 17px; text-decoration: none; }
.related-link:hover { text-decoration: underline; }
.related-meta { display: block; font-size: 12.5px; color: var(--yarn-grey); margin-top: 2px; }
.related-more { margin: 16px 0 0; font-size: 14px; }

.legal-updated { font-size: 13px; color: var(--yarn-grey); margin: 0 0 24px; }
.legal-prose { max-width: 76ch; }
.legal-prose h2 { font-family: var(--yarn-face); font-size: 20px; font-weight: 600; margin: 30px 0 8px; padding-bottom: 5px; border-bottom: var(--gauge-rule); }
.legal-prose p { margin: 0 0 14px; }
.legal-prose ul { margin: 0 0 16px; padding-left: 20px; }
.legal-prose li { margin-bottom: 7px; }
.legal-contact { margin-top: 34px; padding-top: 14px; border-top: var(--gauge-rule); max-width: 76ch; font-size: 14px; }

.lost-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 34px; }
.button {
  display: inline-block; text-decoration: none;
  background: var(--yarn-dye); color: var(--yarn-loft);
  padding: 9px 20px 9px 18px;
  border-radius: 0 999px 999px 0;
  font-size: 14px; letter-spacing: 0.02em;
}
.button:hover { background: var(--yarn-brick); color: #fff; }
.button-quiet { background: transparent; color: var(--yarn-dye); border: 1px solid var(--yarn-dye); border-radius: 999px 0 0 999px; }
.button-quiet:hover { background: var(--yarn-dye); color: var(--yarn-loft); }

/* ------------------------------------------------------------------ foot -- */

.yarn-foot {
  border-top: 3px double var(--yarn-dye);
  max-width: var(--measure); margin: 40px auto 0;
  padding: 28px 20px 44px;
}
.foot-note { max-width: 78ch; font-size: 13.5px; color: #4a5769; margin-bottom: 26px; }
.foot-note p { margin: 0; }
.foot-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 22px 30px; }
.foot-cap { font-family: var(--gauge-face); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--yarn-grey); margin: 0 0 10px; padding-bottom: 5px; border-bottom: var(--gauge-rule); }
.foot-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.foot-list li { padding: 3px 0; }
.foot-list a { text-decoration: none; }
.foot-list a:hover { text-decoration: underline; }
.foot-family { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.fam-chip { display: inline-flex; align-items: baseline; gap: 6px; border: var(--gauge-rule); padding: 3px 9px; font-size: 12.5px; }
.fam-num { font-family: var(--gauge-face); font-size: 11px; color: var(--yarn-moss); }
.foot-legal { margin: 30px 0 0; padding-top: 14px; border-top: var(--gauge-rule); font-size: 12.5px; color: var(--yarn-grey); }

/* ------------------------------------------------------------ narrow view -- */

@media (max-width: 820px) {
  .yarn-layout { grid-template-columns: minmax(0, 1fr); }
  .letter-rail {
    position: static; border-right: 0; border-bottom: var(--gauge-rule);
    margin: 0 0 8px; padding: 14px 0;
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  }
  .rail-cap { margin: 0 10px 0 0; }
  .rail-list { display: flex; flex-wrap: wrap; gap: 2px 9px; }
  .rail-item { margin: 0; }
  .rail-link { gap: 3px; }
  .rail-hint { writing-mode: horizontal-tb; max-height: none; margin: 0; }
  .search-input { width: 130px; }
  .band-abbr { margin-left: 0; }
  .legend-sheet .cell-date, .legend-sheet .cell-family { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
