/* Kitdir preview-v2 — cream editorial table directory */

:root {
  --cream: #f7f4ee;
  --cream-deep: #efe9df;
  --paper: #faf8f3;
  --ink: #1c1b19;
  --ink-soft: #3a3834;
  --muted: #7a756c;
  --line: #e2dcd0;
  --line-strong: #cfc7b8;
  --sage: #5f7a5a;
  --sage-deep: #4a6346;
  --sage-wash: rgba(95, 122, 90, 0.14);
  --sage-wash-strong: rgba(95, 122, 90, 0.22);
  --crimson: #c43c3c;
  --crimson-deep: #8f2a2a;
  --shadow: 0 6px 18px rgba(40, 36, 28, 0.06);
  --radius: 10px;
  --header-h: 64px;
  --banner-h: 28px;
  --sidebar-w: 220px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font-serif: "Instrument Serif", "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-sans: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img, svg { display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--cream); padding: 8px 12px;
}
.skip:focus { left: 8px; top: 8px; }

.hidden { display: none !important; }

/* —— Preview banner —— */
.preview-banner {
  height: var(--banner-h);
  display: flex; align-items: center; justify-content: center;
  background: #ebe4d8;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #c5d0be;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  justify-self: start;
}

.brand-flower {
  align-self: center;
  flex-shrink: 0;
  transition: transform 280ms var(--ease);
  transform-origin: 50% 50%;
}
.brand:hover .brand-flower {
  transform: rotate(18deg) scale(1.08);
}
.brand:hover .flower-petals {
  filter: brightness(1.05);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
  margin-left: 2px;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  gap: 28px;
  justify-self: center;
}

.nav-link {
  position: relative;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 6px 2px 8px;
  transition: color 160ms ease;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--sage);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 200ms var(--ease);
}
.nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after { transform: scaleX(1); }
.nav-link:hover { color: var(--ink); }

.search {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(320px, 100%);
  height: 40px;
  padding: 0 14px 0 12px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search:focus-within {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(95, 122, 90, 0.18);
}
.search-icon { color: var(--muted); flex-shrink: 0; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
}
.search input::placeholder { color: #9a948a; }
.search-kbd {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--cream-deep);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  line-height: 1.3;
}

/* —— Layout —— */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 28px 64px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

/* —— Sidebar —— */
.sidebar {
  position: sticky;
  top: calc(var(--banner-h) + var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: calc(100vh - var(--banner-h) - var(--header-h) - 80px);
}

.nav-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: none;
}

.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-item {
  position: relative;
  display: block;
  padding: 9px 12px 9px 14px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14.5px;
  font-weight: 500;
  transition: color 160ms ease, background 160ms ease;
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
}
.cat-item::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2.5px;
  border-radius: 2px;
  background: var(--crimson);
  transform: scaleY(0);
  transition: transform 200ms var(--ease);
}
.cat-item:hover { background: rgba(0,0,0,0.03); color: var(--ink); }
.cat-item.is-active {
  color: var(--ink);
  font-weight: 600;
  background: transparent;
}
.cat-item.is-active::before { transform: scaleY(1); }

.filters { display: flex; flex-direction: column; gap: 8px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.check-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  position: relative;
  flex-shrink: 0;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms var(--ease);
}
.check-box::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 180ms var(--ease);
}
.check input:checked + .check-box {
  background: var(--sage);
  border-color: var(--sage);
}
.check input:checked + .check-box::after {
  transform: rotate(45deg) scale(1);
}
.check:active .check-box { transform: scale(0.92); }
.check:hover .check-box { border-color: var(--sage); }

.side-foot {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-top: 24px;
}
.foot-flower { flex-shrink: 0; opacity: 0.95; }
.foot-mark {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding-bottom: 4px;
}

/* —— Main —— */
.main { min-width: 0; }

.main-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.main-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.title-count {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  color: var(--muted);
}
.main-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

.sort-wrap { flex-shrink: 0; padding-top: 8px; }
.sort-select {
  appearance: none;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%237a756c' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 2px center;
  border: 0;
  padding: 6px 22px 6px 8px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: background 140ms ease;
}
.sort-select:hover,
.sort-select:focus {
  background-color: rgba(0,0,0,0.04);
  outline: none;
}

/* —— Table —— */
.table-wrap {
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.tool-table thead th {
  padding: 12px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.col-num { width: 48px; }
.col-tool { width: 18%; }
.col-fit { width: 34%; }
.col-price { width: 12%; }
.col-tags { width: 22%; }
.col-go { width: 44px; }

.tool-row {
  cursor: pointer;
  transition:
    background 150ms ease,
    transform 150ms var(--ease),
    box-shadow 150ms ease;
  position: relative;
}
.tool-row td {
  padding: 16px 10px;
  border-bottom: 1px solid #ebe6dc;
  vertical-align: middle;
}
.tool-row:hover {
  background: var(--sage-wash);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  z-index: 1;
}
.tool-row.is-pressing {
  transform: scale(0.995);
  background: var(--sage-wash-strong);
}

.cell-num {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #a39d92;
  font-weight: 500;
}

.cell-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.tool-icon-slot {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}
.tool-icon-slot > .tool-icon[hidden],
.tool-icon-slot > .tool-icon.is-fallback-hidden {
  display: none !important;
}
.tool-icon-slot > .tool-icon-img[hidden] {
  display: none !important;
}

.tool-icon-slot.lg {
  width: 52px;
  height: 52px;
}
.tool-icon-img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
}
.tool-icon-img.lg {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  padding: 6px;
  border-color: color-mix(in srgb, var(--sage) 55%, var(--line));
}
.tool-icon,
.tool-icon.mono {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--tile, #fff);
  border: 1px solid color-mix(in srgb, var(--sage) 70%, var(--line));
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink, var(--ink-soft));
  flex-shrink: 0;
  line-height: 1;
  font-variant-emoji: none;
  font-style: normal;
  user-select: none;
}
.tool-icon.mono.lg {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
}
.tool-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-fit {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-label {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}
.tag-list .sep { margin: 0 5px; opacity: 0.55; }

.ext-btn {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 160ms var(--ease), color 160ms ease, background 160ms ease;
}
.ext-btn:hover {
  color: var(--sage-deep);
  background: rgba(95,122,90,0.12);
  transform: scale(1.12);
}
.ext-btn:active { transform: scale(0.96); }

/* Row enter stagger */
.tool-row.enter {
  animation: rowIn 380ms var(--ease) both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— Pagination —— */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px 0;
  border-top: 1px solid var(--line);
  margin-top: 0;
  flex-wrap: wrap;
}
.page-status {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}
.page-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.page-btn {
  position: relative;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, transform 120ms var(--ease);
}
.page-btn::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px; bottom: 4px;
  height: 3px;
  border-radius: 2px;
  background: var(--sage);
  transform: scaleX(0);
  transition: transform 200ms var(--ease);
}
.page-btn.is-active {
  color: var(--ink);
  font-weight: 600;
}
.page-btn.is-active::after { transform: scaleX(1); }
.page-btn:hover:not(.is-active) { background: rgba(0,0,0,0.04); }
.page-btn:active { transform: scale(0.96); }
.page-btn.is-next,
.page-btn.is-prev {
  padding: 0 10px;
  color: var(--ink-soft);
}
.page-btn.is-next::after,
.page-btn.is-prev::after { display: none; }
.page-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.empty {
  margin: 48px 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* —— Ripple —— */
#ripple-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(95,122,90,0.35) 0%, rgba(95,122,90,0.08) 55%, transparent 70%);
  transform: scale(0);
  animation: rippleOut 520ms ease-out forwards;
}
@keyframes rippleOut {
  to { transform: scale(1); opacity: 0; }
}

/* —— Detail —— */
.detail {
  animation: fadeUp 280ms var(--ease) both;
}
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 140ms ease;
}
.detail-back:hover { color: var(--sage-deep); }

.detail-hero {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.detail-icon {
  /* legacy class kept for safety; prefer .tool-icon.mono.lg / .tool-icon-img.lg */
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--tile, #fff);
  border: 1px solid color-mix(in srgb, var(--sage) 70%, var(--line));
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink, var(--ink-soft));
  flex-shrink: 0;
  line-height: 1;
  font-variant-emoji: none;
}
.detail-hero h1 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.detail-oneliner {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 24px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
}

.detail-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.detail-section:last-of-type { border-bottom: 0; }
.detail-section h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.detail-section p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}
.use-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.use-list li {
  position: relative;
  padding-left: 22px;
  color: var(--ink-soft);
}
.use-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 12px; height: 12px;
  border-radius: 3px;
  border: 1.5px solid var(--sage);
  background:
    linear-gradient(var(--sage), var(--sage)) center/7px 2px no-repeat,
    linear-gradient(var(--sage), var(--sage)) center/2px 7px no-repeat;
  background-color: rgba(95,122,90,0.12);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 18px;
  background: var(--sage);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  border: 0;
  cursor: pointer;
  transition: transform 160ms var(--ease), background 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 4px 14px rgba(95,122,90,0.25);
}
.cta:hover {
  background: var(--sage-deep);
  transform: translateY(-1px);
}
.cta:active { transform: scale(0.98); }

/* —— About —— */
.about {
  max-width: 640px;
  animation: fadeUp 280ms var(--ease) both;
}
.about h1 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 400;
}
.about p {
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0 0 14px;
}
.about .note {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--cream-deep);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tool-row,
  .tool-row:hover,
  .ext-btn,
  .brand-flower,
  .cat-item::before,
  .page-btn,
  .cta,
  .check-box,
  .nav-link::after {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
  .tool-row.enter,
  .detail,
  .about,
  .ripple {
    animation: none !important;
  }
  .tool-row:hover {
    background: var(--sage-wash);
    box-shadow: none;
  }
}

/* —— Responsive —— */
@media (max-width: 960px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    padding: 12px 18px;
    gap: 12px;
  }
  .brand { grid-column: 1; }
  .top-nav { grid-column: 2; justify-self: end; }
  .search { grid-column: 1 / -1; width: 100%; justify-self: stretch; }
  .brand-sub { display: none; }
  .layout {
    grid-template-columns: 1fr;
    padding: 20px 16px 48px;
    gap: 20px;
  }
  .sidebar {
    position: static;
    min-height: 0;
    gap: 16px;
  }
  .side-foot { display: none; }
  .cat-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .cat-item {
    padding: 7px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
  }
  .cat-item::before { display: none; }
  .cat-item.is-active {
    background: var(--sage-wash);
    border-color: var(--sage);
    color: var(--sage-deep);
  }
  .filters { flex-direction: row; flex-wrap: wrap; gap: 12px 18px; }
  .col-fit, .col-tags { width: auto; }
  .main-title { font-size: 28px; }
}

@media (max-width: 720px) {
  .col-tags, .col-price, thead .col-fit { display: none; }
  .tool-table td.col-tags,
  .tool-table td.col-price,
  .tool-table td.col-fit { display: none; }
  .col-tool { width: auto; }
  .cell-fit { display: none; }
}

