:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --ink: #171b21;
  --muted: #5b616b;
  --line: #e2e6eb;
  --accent: #e2543a;
  --accent-dark: #c8401f;
  --blue: #2a6db5;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(18, 22, 30, .08);
  --checker-a: #fafbfc;
  --checker-b: #ffffff;
  --stage-checker-a: #f4f6f8;
}

[data-theme="dark"] {
  --bg: #12151a;
  --surface: #1c2129;
  --ink: #e8eaee;
  --muted: #98a1ad;
  --line: #2b323d;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --checker-a: #20262e;
  --checker-b: #1c2129;
  --stage-checker-a: #232a33;
}
[data-theme="dark"] .site-header { background: rgba(20,24,30,.9); }
[data-theme="dark"] .how { background: var(--surface); }
[data-theme="dark"] .hero-card { background: var(--surface); }
[data-theme="dark"] .lib-item.active { background: #3a2b26; box-shadow: inset 2.5px 0 0 var(--accent); }
[data-theme="dark"] .lib-item:hover { background: #252c35; }
[data-theme="dark"] .lib-del:hover { background: #4a2f28; color: #ff8a70; }
[data-theme="dark"] .filters button:hover { background: #252c35; color: var(--ink); }
[data-theme="dark"] .toast { background: #e8eaee; color: #12151a; }
[data-theme="dark"] .unit-toggle .seg button,
[data-theme="dark"] .seg-ctl button { background: var(--surface); }
[data-theme="dark"] .unit-toggle .seg button.active,
[data-theme="dark"] .seg-ctl button.active { background: var(--ink); color: var(--bg); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.logo { font-size: 20px; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
.logo-mark { margin-right: 2px; }
.site-header nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.site-header nav a:hover { color: var(--ink); }
.net-size { font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--muted); }

.btn {
  display: inline-block; border: 0; cursor: pointer;
  padding: 11px 20px; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; text-decoration: none;
  transition: .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(226,84,58,.35); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px #b9bec6; }
.btn-sm { padding: 7px 14px; font-size: 13.5px; }

.hero {
  min-height: calc(100svh - 62px);
  display: grid; align-items: center;
}
.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: 48px; align-items: center;
  padding: 60px 0;
}
.hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.06; letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { max-width: 520px; margin: 20px 0 28px; color: var(--muted); font-size: 18px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 40px; margin-top: 46px; flex-wrap: wrap; }
.hero-stats strong { display: block; font-size: 26px; letter-spacing: -.02em; }
.hero-stats span { color: var(--muted); font-size: 13.5px; }

.hero-art { position: relative; min-height: 420px; }
.hero-card {
  position: absolute; width: 62%;
  background: var(--surface); border: 1.5px solid #000;
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px;
}
.hero-card svg { display: block; width: 100%; height: auto; }
.hero-card figcaption { margin-top: 8px; font-size: 12.5px; color: var(--muted); text-align: center; }
.hero-card:nth-child(1) { top: 0; left: 0; transform: rotate(-4deg); z-index: 1; }
.hero-card:nth-child(2) { top: 14%; right: 0; transform: rotate(3deg); z-index: 2; }
.hero-card:nth-child(3) { bottom: 0; left: 16%; transform: rotate(-2deg); z-index: 3; }

.section-pad { padding: 80px 0; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head-title { display: flex; align-items: center; gap: 14px; }
.gallery-section h2, .how h2, .faq h2, .tools-sec h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.025em; }
#search {
  width: 280px; max-width: 100%; padding: 10px 15px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14px; background: var(--surface); outline: none;
}
#search:focus { border-color: var(--accent); }

.chips {
  position: sticky; top: 62px; z-index: 40;
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 0; margin-bottom: 22px;
  background: linear-gradient(var(--bg) 82%, transparent);
}
.chip {
  border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 7px 17px; font-size: 13.5px;
  cursor: pointer; color: var(--muted); font-weight: 500;
  transition: .13s ease;
}
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-thumb {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  padding: 18px; background: var(--surface);
}
.card-thumb svg { width: 100%; height: 100%; }
.card-body { padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.card-body h3 { font-size: 15.5px; }
.card-meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.card-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  color: var(--accent); text-transform: uppercase;
}

.how { background: var(--surface); border-block: 1px solid var(--line); }
.steps { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; margin-top: 26px; }
.step-num {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  background: var(--accent); color: #fff; border-radius: 50%;
  font-weight: 700; margin-bottom: 12px;
}
.steps h3 { font-size: 17px; margin-bottom: 6px; }
.steps p { color: var(--muted); font-size: 14.5px; }

.faq { max-width: 760px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; padding: 15px 19px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { margin-top: 8px; color: var(--muted); font-size: 14.5px; }

.tools-sec .tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; margin-top: 26px; }
.tool-tile {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; text-decoration: none; color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tool-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.tool-tile strong { font-size: 17px; }
.tool-tile span { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }
.tool-icon { font-size: 28px; display: block; margin-bottom: 10px; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); font-size: 13.5px; }

.editor-page { overflow: hidden; }

.app-header-inner {
  max-width: none;
  display: flex; align-items: center; gap: 26px;
  height: 62px; padding: 0 20px;
}
.app-nav { display: flex; gap: 18px; }
.app-nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.app-nav a:hover { color: var(--ink); }
.header-downloads { margin-left: auto; display: flex; gap: 8px; }

.app {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 320px;
  gap: 14px;
  height: calc(100dvh - 62px);
  padding: 14px 16px;
}

.library-panel, .params-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-y: auto; scrollbar-width: thin;
  padding: 16px;
  display: flex; flex-direction: column; gap: 13px;
}
.panel-title { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

#lib-search {
  padding: 9px 12px; border: 1.5px solid var(--line);
  border-radius: 9px; font-size: 13.5px; outline: none;
}
#lib-search:focus { border-color: var(--accent); }

.lib-group { margin-bottom: 6px; }
.lib-cat {
  font-size: 11px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
  margin: 10px 0 6px;
}
.lib-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 9px;
  padding: 8px 10px; cursor: pointer;
}
.lib-item strong { display: block; font-size: 13.5px; color: var(--ink); font-weight: 600; }
.lib-item span { font-size: 11.5px; color: var(--muted); }
.lib-item:hover { background: #f3f5f8; }
.lib-item.active { background: #fdeeea; box-shadow: inset 2.5px 0 0 var(--accent); }
.lib-del {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 11px; padding: 4px; border-radius: 5px;
}
.lib-item { position: relative; }
.lib-del:hover { background: #fde2dd; color: var(--accent-dark); }

.check-field { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.check-field input { width: 16px; height: 16px; accent-color: var(--accent); }
.check-label { font-size: 13.5px; font-weight: 600; text-transform: none; letter-spacing: 0; }

.theme-btn {
  border: 1.5px solid var(--line); background: transparent;
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  font-size: 15px; color: var(--muted);
}
.theme-btn:hover { color: var(--ink); box-shadow: inset 0 0 0 1.5px #b9bec6; }

#measure-tip {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--ink); color: #fff; padding: 4px 10px;
  border-radius: 7px; font-size: 12px; font-weight: 600;
  display: none; white-space: nowrap;
}
.stage.measuring { cursor: crosshair; }

.canvas-panel {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0;
}
.canvas-toolbar { display: flex; align-items: center; gap: 10px; }
.toolbar-spacer { flex: 1; }
.zoom-level { font-size: 12.5px; color: var(--muted); min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }

.stage {
  flex: 1; min-height: 0;
  display: flex;
  background: #ffffff; border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  overflow: auto;
  scrollbar-width: thin;
}
#zoombox { margin: auto; transition: width .12s ease; }
#zoombox svg { display: block; width: 100%; height: auto; }
.stage canvas { display: block; max-width: 100%; max-height: 100%; }
.fallback { color: var(--muted); font-size: 14px; text-align: center; max-width: 340px; }

.spec-table { width: 100%; border-collapse: collapse; }
.spec-table td { padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.spec-table td:first-child { color: var(--muted); width: 45%; }
.spec-table td:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }

.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em; }
.field select, .field input[type=number] {
  width: 100%; padding: 9px 11px; font-size: 14.5px;
  border: 1.5px solid var(--line); border-radius: 9px; background: #fff;
}
.field select:focus, .field input:focus { outline: none; border-color: var(--accent); }
.dim-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

.unit-toggle .seg, .seg-ctl { display: inline-flex; border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; }
.unit-toggle .seg button, .seg-ctl button {
  border: 0; background: #fff; padding: 7px 16px; cursor: pointer; font-size: 13.5px; color: var(--muted); font-weight: 600;
}
.unit-toggle .seg button.active, .seg-ctl button.active { background: var(--ink); color: #fff; }

#grain-ctl { display: flex; width: 100%; }
#grain-ctl button { flex: 1; padding: 7px 6px; }

.structural-panel {
  border: 1.5px solid #f0c8ab; background: #fef6ee;
  border-radius: 10px; padding: 10px 12px;
}
[data-theme="dark"] .structural-panel { border-color: #4a3a24; background: #26200f; }
.structural-panel .panel-title { color: var(--accent-dark); margin-bottom: 6px; }
[data-theme="dark"] .structural-panel .panel-title { color: #e8a06f; }
.structural-panel ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.structural-panel li { font-size: 12.5px; color: var(--ink); line-height: 1.4; padding-left: 18px; position: relative; }
.structural-panel li::before { content: "⚠"; position: absolute; left: 0; top: -1px; color: var(--accent-dark); }
.structural-panel li.info::before { content: "ℹ"; color: var(--blue); }

.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.swatch { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid; vertical-align: middle; margin-right: 6px; }
.swatch.cut { border-color: #d63a2f; }
.swatch.fold { border-top-style: dashed; border-color: var(--blue); }

.params-panel h3 { font-size: 14px; margin-top: 4px; }
.params-panel h3 small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; }
.project-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.note { font-size: 12px; color: var(--muted); }

#art-file { font-size: 13px; color: var(--muted); }
#art-controls { border: 0; display: flex; flex-direction: column; gap: 6px; }
#art-controls:disabled { opacity: .45; }
.art-row { display: grid; grid-template-columns: 58px 1fr 42px; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.art-row em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }

.fill-add-row { display: grid; grid-template-columns: 1fr 40px auto; gap: 8px; align-items: center; }
.fill-add-row select { padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.fill-add-row input[type=color] { width: 40px; height: 34px; padding: 2px; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.fill-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.fill-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.fill-item .fill-swatch { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); flex: none; }
.fill-item span { flex: 1; color: var(--ink); }
.fill-item button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 6px; }
.fill-item button:hover { background: #f3f5f8; color: var(--accent-dark); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px;
  border-radius: 999px; font-size: 13.5px; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.toast.show { opacity: 1; }

.gallery-layout {
  display: grid; grid-template-columns: 230px minmax(0, 1fr);
  gap: 30px; align-items: start;
}
.filters { position: sticky; top: 84px; }
.filters .filter-title {
  font-size: 11.5px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px;
}
.filters button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 8px;
  font-size: 14px; color: var(--muted); font-weight: 500;
}
.filters button:hover { background: #e9ecf0; color: var(--ink); }
.filters button.active { background: var(--ink); color: #fff; font-weight: 600; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; padding: 44px 0; }
  .hero-art { min-height: 320px; }
  .app { grid-template-columns: 1fr; height: auto; }
  .canvas-panel { height: 70vh; }
  .gallery-layout { grid-template-columns: 1fr; }
  .filters { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
}

/* ---- iOS-inspired refresh ---- */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #86868b;
  --line: rgba(0, 0, 0, .07);
  --accent: #0071e3;
  --accent-dark: #0077ed;
  --radius: 18px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .05);
}
[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --ink: #f5f5f7;
  --muted: #98989d;
  --line: rgba(255, 255, 255, .14);
}
body { -webkit-font-smoothing: antialiased; }
h1, h2, h3 { letter-spacing: -.04em; }

.btn { border-radius: 980px; font-weight: 600; }
.btn-primary { background: var(--accent); box-shadow: none; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: rgba(120, 120, 128, .08); box-shadow: none; color: var(--ink); }
.btn-ghost:hover { box-shadow: none; background: rgba(120, 120, 128, .16); }
[data-theme="dark"] .btn-ghost { background: rgba(120, 120, 128, .2); }

.site-header {
  background: rgba(251, 251, 253, .78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
[data-theme="dark"] .site-header { background: rgba(22, 22, 23, .72); }
.logo { font-weight: 800; letter-spacing: -.03em; }
.logo span { color: var(--ink); }

.card { border-radius: var(--radius); border-color: transparent; box-shadow: 0 2px 16px rgba(0, 0, 0, .05); }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 34px rgba(0, 0, 0, .08); }
.tool-tile { border-radius: var(--radius); box-shadow: none; }
.library-panel, .params-panel, .controls,
.compare-col, .tool-panel, .cal-sheet, .detail-preview { border-radius: 22px; }

.field select, .field input[type=number], #lib-search, #search, input[type=file] {
  background: var(--bg);
  border-color: transparent;
  border-radius: 12px;
}
.field select:focus, .field input:focus, #lib-search:focus, #search:focus {
  border-color: var(--accent);
  outline: none;
}

.unit-toggle .seg, .seg-ctl {
  background: rgba(120, 120, 128, .14);
  border: 0;
  border-radius: 10px;
  padding: 2px;
}
[data-theme="dark"] .unit-toggle .seg,
[data-theme="dark"] .seg-ctl { background: rgba(120, 120, 128, .24); }
.unit-toggle .seg button, .seg-ctl button { background: transparent; border-radius: 8px; font-weight: 600; }
.unit-toggle .seg button.active, .seg-ctl button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .14);
}
[data-theme="dark"] .unit-toggle .seg button.active,
[data-theme="dark"] .seg-ctl button.active { background: #5a5a5e; color: #fff; }

.chip, .filters button { border-radius: 980px; }
.filters button { border-radius: 10px; }
.filters button.active, .chip.active { background: var(--ink); }

.toast {
  background: rgba(28, 28, 30, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
}
.viewbar { border-radius: 12px; }

/* ---- full-bleed layout + motion (v12) ---- */
.wrap { max-width: 1720px; }
.hero { min-height: calc(100svh - 62px); }
.hero-grid { padding: clamp(20px, 3.5vh, 56px) 0; }
.hero-art { max-height: calc(100svh - 120px); }

.btn, .theme-btn, .chip, .filters button, .lib-item {
  transition: transform .15s ease, box-shadow .15s ease,
              background-color .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(0, 113, 227, .35); }
.btn:active, .theme-btn:active, .chip:active { transform: scale(.96); }
.theme-btn:hover { transform: none; }
.btn:focus-visible, .theme-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .3);
}
.lib-item:active { transform: scale(.985); }
.card:active { transform: scale(.99); }


/* ---- 3D detail preview (v13, kept) ---- */
.detail-3dwrap { margin-top: 16px; text-align: center; }
.detail-3d {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  min-height: 260px; display: grid; place-items: center; overflow: hidden;
}
.detail-3d img { width: 100%; max-width: 480px; height: auto; }
.detail-3dlabel { font-size: 12.5px; color: var(--muted); margin-top: 8px; }


/* ---- category cards section (v15) ---- */
.cats { padding-top: 64px; }
.cats-head { display: flex; align-items: center; gap: 14px; margin-bottom: 36px; }
.arr-ico { color: var(--accent); font-size: clamp(28px, 3vw, 40px); font-weight: 800; line-height: 1; }
.cats-head h2 { font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -.04em; }
.cats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.cat-card {
  display: grid; grid-template-columns: 1.05fr 1fr; grid-template-rows: auto 1fr;
  gap: 8px 12px;
  background: var(--surface); border: 1.5px solid #000;
  border-radius: 16px; padding: 20px; min-height: 195px;
  cursor: pointer; text-decoration: none; color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0, 0, 0, .08); }
.cat-title { font-weight: 650; font-size: 16.5px; line-height: 1.35; letter-spacing: -.01em; }
.cat-thumb { grid-column: 2; grid-row: 1 / 3; display: grid; place-items: center; }
.cat-thumb svg { width: 100%; max-height: 130px; height: auto; }
.cat-card svg .cut { stroke: #c6cbd4; }
.cat-card svg .fold { stroke: #dfe3e9; }
.cat-arrow { grid-column: 1; align-self: end; font-size: 21px; }
.cat-card:hover .cat-arrow { transform: translateX(4px); }
.cat-arrow { transition: transform .15s ease; }
.btn-dark { background: var(--ink); color: #fff; border-radius: 980px; padding: 15px 30px; font-weight: 600; }
.btn-dark:hover { opacity: .88; transform: translateY(-1px); }
.cats-cta { margin-top: 34px; }
@media (max-width: 1100px) { .cats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .cats-grid { grid-template-columns: 1fr; } }

/* ---- browse grid matched to category-card style (v16) ---- */
#templates .section-head h2 { font-size: clamp(26px, 3vw, 38px); letter-spacing: -.04em; }
#templates .card { border-radius: 16px; border: 1.5px solid #000; box-shadow: none; }
#templates .card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0, 0, 0, .08); }
#templates .card-thumb { padding: 22px; }
#templates .card svg .cut { stroke: #c6cbd4; }
#templates .card svg .fold { stroke: #dfe3e9; }
#templates .card-body { border-top-color: var(--line); padding: 15px 16px 16px; }
#templates .card-tag { color: var(--muted); font-weight: 600; letter-spacing: .06em; }
#templates .card-body h3 { font-weight: 650; letter-spacing: -.01em; font-size: 15px; }
.hero-card svg .cut { stroke: #c6cbd4; }
.hero-card svg .fold { stroke: #dfe3e9; }

/* ---- browse cards sized to match category cards (v17) ---- */
#templates .grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
#templates .card {
  min-height: 195px;
  display: grid;
  grid-template-rows: 1fr auto;
}
#templates .card-thumb {
  aspect-ratio: auto;
  padding: 16px 18px;
  min-height: 0;
}
#templates .card-thumb svg {
  max-height: 118px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}
#templates .card-body { padding: 12px 16px 13px; }
#templates .card-meta { margin-top: 2px; font-size: 12px; }
@media (max-width: 1100px) { #templates .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { #templates .grid { grid-template-columns: 1fr; } }

/* ---- colored outlines on landing previews (v18) ---- */
.cat-card svg .cut,
#templates .card svg .cut,
.hero-card svg .cut { stroke: #d63a2f; }
.cat-card svg .fold,
#templates .card svg .fold,
.hero-card svg .fold { stroke: #2a6db5; }


/* ---- sample product thumbnails: 3D primary, dieline on hover (v29) ---- */
#templates .card-thumb,
.cat-thumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #fbfbfc, #eef0f3);
}
[data-theme="dark"] #templates .card-thumb,
[data-theme="dark"] .cat-thumb {
  background: linear-gradient(180deg, #232a33, #1b2027);
}

#templates .card-thumb svg,
.cat-thumb svg {
  opacity: 1;
  transition: opacity .3s ease;
}

.card-3d {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 15%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.card-3d img {
  max-width: 100%; max-height: 100%; width: auto; height: auto; display: block;
  filter: drop-shadow(0 12px 18px rgba(20, 22, 28, .16));
}

#templates .card-thumb.has-3d svg, .cat-thumb.has-3d svg { opacity: 0; }
#templates .card-thumb.has-3d .card-3d, .cat-thumb.has-3d .card-3d { opacity: 1; }

#templates .card:hover .card-thumb.has-3d svg,
#templates .card:focus-within .card-thumb.has-3d svg,
.cat-card:hover .cat-thumb.has-3d svg,
.cat-card:focus-within .cat-thumb.has-3d svg { opacity: 1; }

#templates .card:hover .card-thumb.has-3d .card-3d,
#templates .card:focus-within .card-thumb.has-3d .card-3d,
.cat-card:hover .cat-thumb.has-3d .card-3d,
.cat-card:focus-within .cat-thumb.has-3d .card-3d { opacity: 0; }

@media (hover: none) {
  .card-thumb.has-3d svg, .cat-thumb.has-3d svg { opacity: 0; }
  .card-thumb.has-3d .card-3d, .cat-thumb.has-3d .card-3d { opacity: 1; }
}
