/* design: v2 */
/* knittingpatterngenerator.com, design v2 board B "On the needles" (James's pick, 5 Dec 2026; design/home-v2-B.png).
   The page is a walnut table seen from above in window light (Blender renders in /img, renders/table.py). Cards lie on
   it: the tool on oat linen, a chart on knitter's graph paper (cells wider than tall), buttons and shape labels as paper
   tags. Cream text on the wood, walnut ink on paper. Madder rose for actions, moss and teal as quiet accents. Crete Round
   for headings, Alegreya Sans for text. A table in daylight does not invert, so dark mode keeps these colours. */

@font-face { font-family: "Crete Round"; src: url(/fonts/crete-round-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url(/fonts/alegreya-sans-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url(/fonts/alegreya-sans-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #3b2417;
  --brand: #b65f70;
  --text: #f3e7d7;
  --muted: #dccab2;
  --line: rgba(243, 231, 215, 0.28);
  --card: #efe4d0;
  --link: #f6c9a8;
  --ink: #2e1d12;
  --ink-soft: #5b4636;
  --linen: #efe4d0;
  --paper: #fbf8f1;
  --tag: #f4ead8;
  --rose: #8a3a4b;
  --rose-deep: #6e2d3b;
  --moss: #6b7f4e;
  --teal: #3f6f73;
  --shadow: 0 2px 3px rgba(20, 10, 4, 0.35), 0 14px 30px rgba(20, 10, 4, 0.35);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #3b2417; --text: #f3e7d7; --muted: #dccab2; --line: rgba(243, 231, 215, 0.28); --card: #efe4d0; --link: #f6c9a8; color-scheme: light; }
}

/* the table: a plain walnut render tiled down the page (no props), so every page lies on the same wood */
html { background: var(--bg); }
body {
  font: 18px/1.6 "Alegreya Sans", system-ui, sans-serif; color: var(--text);
  background: var(--bg) url(/img/table-1600.webp) center top / 100% auto repeat-y;
}
@media (min-width: 1700px) { body { background-image: url(/img/table-2400.webp); } }
h1, h2, h3, .wordmark, .tag, .btn, .drop-big { font-family: "Crete Round", Georgia, serif; font-weight: 400; letter-spacing: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; text-shadow: 0 2px 10px rgba(20, 10, 4, 0.55); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2; }
.wrap { max-width: 1180px; padding: 0 20px; }
a { color: var(--link); }
.small, small { font-size: 0.92rem; color: var(--muted); }

/* paper and linen: anything inside one takes walnut ink */
.linen, .tool-form, .page-body, .toc, .maker, .pattern, .chart-figure {
  --text: var(--ink); --muted: var(--ink-soft); --line: #cdb894; --link: var(--rose);
  color: var(--ink);
}
.linen, .tool-form, .page-body, .toc {
  background-color: var(--linen);
  background-image:
    repeating-linear-gradient(0deg, rgba(110, 84, 50, 0.07) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(110, 84, 50, 0.06) 0 1px, transparent 1px 4px);
  box-shadow: var(--shadow); border-radius: 4px;
}
.graph, .tool-out {
  --text: var(--ink); --muted: var(--ink-soft); --line: #c9cfd8; --link: var(--rose);
  color: var(--ink); background-color: var(--paper);
  background-image: linear-gradient(rgba(63, 95, 140, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(63, 95, 140, 0.16) 1px, transparent 1px);
  background-size: 14px 10px; box-shadow: var(--shadow); border-radius: 2px;
}

/* header and footer lie straight on the wood */
.site-header { background: transparent; border: 0; }
.site-header .brand, .main-nav a, .menu-btn { color: var(--text); }
.main-nav { font-size: 1.05rem; }
.main-nav a[aria-current="page"], .main-nav a:hover { color: #fff; }
.menu-btn { border-color: var(--line); }
.logo-mark { width: 34px; height: 34px; }
.wordmark { font-size: 1.2rem; }
.site-footer { border: 0; color: var(--muted); margin-top: 0; }
.site-footer a, .footer-col h2, .footer-brand .brand { color: var(--text); }
.footer-legal::before { border-color: var(--line); }

/* buttons: madder rose for the main action, paper tags for the rest */
.btn { display: inline-block; background: var(--rose); color: #fff; border: 0; border-radius: 4px; padding: 0.55em 1.1em; font-size: 1.02rem; cursor: pointer; text-decoration: none; box-shadow: 0 2px 0 rgba(20, 10, 4, 0.3); }
.btn:hover { background: var(--rose-deep); }
.btn-quiet { background: var(--tag); color: var(--ink); box-shadow: inset 0 0 0 1px #b9a27c, 0 2px 0 rgba(20, 10, 4, 0.18); }
.btn-quiet:hover { background: #fff6e6; color: var(--ink); }
.note { border-left: 4px solid var(--rose); background: rgba(255, 250, 240, 0.85); color: var(--ink); padding: 10px 14px; border-radius: 0 4px 4px 0; }
.callout, .warning { background: #f7edd9; color: var(--ink); }
.callout a, .warning a { color: var(--rose); }

/* ---------- the home page ---------- */
.page-home .site-header { position: relative; z-index: 2; }
.table-hero { position: relative; }
.hero-photo img { display: block; width: 100%; height: auto; }
.hero-inner { position: relative; z-index: 1; padding: 0 20px 28px; }
.hero-words { max-width: 640px; }
.hero-words h1 { margin: 18px 0 8px; }
.hero-sub { font-size: 1.12rem; color: var(--text); text-shadow: 0 1px 6px rgba(20, 10, 4, 0.6); margin: 0 0 22px; }

.tool { display: grid; gap: 22px; background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
.tool > noscript { grid-column: 1 / -1; }
.tool-form { padding: 20px 22px; transform: rotate(-0.6deg); }
.tool-out { padding: 18px 20px; min-width: 0; }
.tool-form label, .maker label { display: block; font-weight: 700; margin: 0 0 12px; }
.tool-form select, .tool-form input[type=number], .maker input, .maker select {
  display: block; width: 100%; margin-top: 4px; padding: 7px 10px; font: inherit; color: var(--ink);
  background: #fffaf1; border: 1px solid #b9a27c; border-radius: 4px; }
.tool-form input[type=range] { width: 100%; accent-color: var(--rose); }
.tool-form output { float: right; font-variant-numeric: tabular-nums; color: var(--rose); font-weight: 700; }
.tool-form fieldset, .maker fieldset { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.tool-form legend, .maker legend { font-weight: 700; width: 100%; padding: 0; margin-bottom: 4px; }
.gauge-row label { flex: 1; margin: 0; }
label.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }
label.check input { width: auto; margin: 0; accent-color: var(--moss); }
.drop { position: relative; display: grid; place-items: center; text-align: center; min-height: 150px; border: 2px dashed #9c8662; border-radius: 6px; padding: 16px; cursor: pointer; margin-bottom: 16px; background: rgba(255, 250, 241, 0.6); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--teal); outline-offset: 2px; }
.drop.over { background: #fff6e6; }
.drop.has-photo { min-height: 80px; }
.drop-big { font-size: 1.4rem; color: var(--rose); }
.drop-small { display: block; font-size: 0.95rem; color: var(--ink-soft); }
.tool-empty { color: var(--ink-soft); padding: 30px 10px; text-align: center; }
.chart-size { margin: 0 0 6px; }
.example-note { margin: 0 0 10px; color: var(--ink-soft); font-size: 0.98rem; }
.chart-scroll { overflow: auto; max-height: 75vh; border: 1px solid #c9cfd8; background: #fff; }
.chart-scroll svg { display: block; min-width: 100%; height: auto; }
.chart-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-out h3 { margin: 16px 0 6px; font-size: 1.15rem; }
.row-one { font-family: "Crete Round", Georgia, serif; font-size: 1.05rem; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; }
.legend li { display: flex; gap: 8px; align-items: center; }
.swatch { display: inline-grid; place-items: center; width: 26px; height: 22px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.3); font-size: 14px; flex: none; }
.hex { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 0.9rem; }
.rows { font-variant-numeric: tabular-nums; padding-left: 0; list-style: none; }
.rows li { padding: 3px 0; border-bottom: 1px dotted #c9cfd8; }
.rows-box summary { cursor: pointer; font-weight: 700; color: var(--rose); margin: 10px 0; }

/* desktop: the hero render lies under the cards; its plain wood is where the headline and the two cards sit */
@media (min-width: 900px) {
  .table-hero { max-width: 1700px; margin: -78px auto 0; }
  /* the render starts under the headline so the swatch, balls and tape lie in the gap between the two cards */
  .hero-photo { position: absolute; top: 120px; left: 0; right: 0; pointer-events: none;
    -webkit-mask-image: linear-gradient(transparent, #000 8%, #000 88%, transparent);
    mask-image: linear-gradient(transparent, #000 8%, #000 88%, transparent); }
  .hero-inner { padding: 96px 4% 40px; }
  .hero-words { max-width: 58%; }
  .tool { grid-template-columns: 36% minmax(0, 1fr) 40%; align-items: start; }
  .tool-form { grid-column: 1; margin-top: 8px; }
  .tool-out { grid-column: 3; margin-top: -40px; transform: rotate(0.8deg); }
}
@media (min-width: 1700px) { .table-hero { max-width: none; } }

/* the shapes: knitted things on the table, each with a paper label */
.shapes-inner, .adds-inner { max-width: 1180px; margin: 0 auto; padding: 28px 20px 10px; }
.section-sub { color: var(--muted); max-width: 64ch; margin-top: 0; }
.shape-row { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: end; }
.shape a { display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none; color: var(--text); }
.shape img { width: 100%; height: auto; filter: drop-shadow(0 10px 14px rgba(20, 10, 4, 0.45)); transition: transform 0.2s; }
.shape a:hover img { transform: translateY(-4px) rotate(-1deg); }
.tag { position: relative; display: inline-block; margin-top: -26px; background: var(--tag); color: var(--ink); padding: 4px 18px 4px 24px; font-size: 1.15rem; border-radius: 3px; box-shadow: 0 3px 6px rgba(20, 10, 4, 0.4); transform: rotate(-4deg); }
.tag::before { content: ""; position: absolute; left: 8px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--bg); }
.shape:nth-child(2n) .tag { transform: rotate(3deg); }
.shape:nth-child(3n) .tag { transform: rotate(-2deg); }
.shape a:hover .tag { background: #fff6e6; }
.shape-what { display: block; margin-top: 10px; font-size: 0.98rem; color: var(--muted); max-width: 22ch; }
@media (max-width: 760px) {
  .shape-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .shape-cowl { grid-column: 1 / -1; max-width: 60%; justify-self: center; }
}

.adds-inner h2 { margin-bottom: 8px; }
.adds-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 6px 30px; }
.adds-list li { position: relative; padding-left: 22px; }
.adds-list li::before { content: ""; position: absolute; left: 0; top: 1.05em; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.adds-list h3 { margin: 0.7em 0 0.2em; }
.adds-list p { margin: 0; color: var(--muted); }
.weights-note { color: var(--muted); font-size: 0.95rem; margin-top: 22px; max-width: 90ch; }

/* ---------- inner pages: a close crop of the table, then the text on a linen card ---------- */
.crumbs, .crumbs a { color: var(--muted); }
.page-head.has-art { position: relative; display: block; min-height: clamp(230px, 27vw, 340px); margin: 0 0 26px; padding: 34px 32px; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px rgba(20, 10, 4, 0.4); background: #2f1c11; }
.page-head.has-art .page-head-art { position: absolute; inset: 0; width: auto; }
.page-head.has-art .page-head-art img { width: 100%; height: 100%; object-fit: cover; object-position: right center; }
.page-head.has-art::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(36, 20, 11, 0.82) 0, rgba(36, 20, 11, 0.55) 38%, transparent 62%); }
.page-head.has-art .page-head-text { position: relative; z-index: 2; max-width: 52%; }
.page-head h1 { margin-top: 0; }
.page-head .lede, .byline, .byline a { color: var(--text); }
.byline { opacity: 0.9; margin-bottom: 0; }
.page-body { padding: 8px 32px 26px; }
.toc { padding: 16px 20px; }
.toc a { color: var(--rose); }
.page-body h2:first-child { margin-top: 0.8em; }
@media (max-width: 760px) {
  .page-head.has-art { display: flex; flex-direction: column-reverse; padding: 0; min-height: 0; background: none; box-shadow: none; overflow: visible; }
  .page-head.has-art::before { display: none; }
  .page-head.has-art .page-head-art { position: static; margin: 0 -20px 16px; height: 190px; }
  .page-head.has-art .page-head-text { max-width: none; }
  .page-body { padding: 4px 18px 20px; margin: 0 -8px; }
}

/* pattern makers and the written pattern */
.maker { background: #fffaf1; border: 1px solid #cdb894; border-radius: 4px; padding: 18px; margin: 18px 0; }
.maker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 18px; }
.maker small { display: block; font-weight: 400; margin-top: 3px; }
.pattern { background: #fffdf7; border: 1px solid #cdb894; border-left: 8px solid var(--moss); border-radius: 4px; padding: 6px 22px 16px; }
.pattern-size, .gauge-line { color: var(--ink-soft); }
.pattern ol li { margin-bottom: 6px; }
.chart-figure { margin: 0; background: #fff; border: 1px solid #c9cfd8; padding: 10px; }
.chart-figure svg { width: 100%; height: auto; display: block; }
.chart-figure figcaption { color: var(--ink-soft); font-size: 0.92rem; padding-top: 6px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid #cdb894; }
caption { text-align: left; font-weight: 700; padding-bottom: 6px; }
.two-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.share { margin-top: 24px; }
.share-box { width: 100%; margin-top: 6px; }

@media (max-width: 899px) {
  .tool-form, .tool-out { transform: none; }
}
@media print {
  .site-header, .site-footer, .no-print, .tool-form, .hero-words, .hero-photo, .shapes, .adds-up, .share, .maker, nav, .crumbs, .byline, .page-head-art { display: none !important; }
  body, .tool, .tool-out, .pattern, .page-body { background: #fff !important; color: #000 !important; box-shadow: none !important; border: 0; transform: none !important; }
  .page-head.has-art { min-height: 0; padding: 0; box-shadow: none; background: none; }
  .page-head.has-art::before { display: none; }
  .page-head h1 { color: #000; text-shadow: none; }
  .tool { display: block; }
  .chart-scroll { max-height: none; overflow: visible; border: 0; }
  details > :not(summary) { display: block; }
}
