/* Veil Gallery — Claude Design System */
:root {
  --primary: #cc785c;
  --primary-active: #a9583e;
  --canvas: #faf9f5;
  --surface-card: #efe9de;
  --surface-white: #ffffff;
  --surface-dark: #181715;
  --surface-dark-soft: #1f1e1b;
  --ink: #141413;
  --body: #3d3d3a;
  --muted: #6c6a64;
  --on-dark: #faf9f5;
  --on-dark-soft: #a09d96;
  --hairline: #e6dfd8;
  --accent-teal: #5db8a6;
  --accent-amber: #e8a55a;
  --font-display: 'Cormorant Garamond', Garamond, serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
  --radius-card: 12px;
  --radius-btn: 8px;
  --shadow-card: 0 1px 2px rgba(20, 20, 19, 0.05), 0 4px 16px rgba(20, 20, 19, 0.06);
  --shadow-lift: 0 2px 4px rgba(20, 20, 19, 0.07), 0 12px 32px rgba(20, 20, 19, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--canvas);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ─── Nav ─── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 249, 245, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand img { width: 26px; height: 26px; }
.brand .brand-sub { font-family: var(--font-body); font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--body);
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: rgba(204, 120, 92, 0.1); color: var(--primary-active); }
.nav-links a.is-active { background: var(--surface-dark); color: var(--on-dark); }

/* ─── Hero ─── */
.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  text-align: center;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
}
.hero p {
  margin-top: 14px;
  font-size: 15px;
  color: var(--muted);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--hairline);
  background: var(--surface-white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary-active); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-active); border-color: var(--primary-active); color: #fff; }
.btn-dark { background: var(--surface-dark); border-color: var(--surface-dark); color: var(--on-dark); }
.btn-dark:hover { background: var(--surface-dark-soft); color: var(--on-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Masonry ─── */
.masonry {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 64px;
  columns: 5 260px;
  column-gap: 20px;
}
.card {
  break-inside: avoid;
  margin-bottom: 20px;
  background: var(--surface-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s, box-shadow 0.18s;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card-img-wrap { position: relative; background: var(--surface-card); }
.card-img-wrap img {
  width: 100%;
  height: auto;
  min-height: 120px;
}
.card-img-wrap .card-count {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(24, 23, 21, 0.72);
  color: var(--on-dark);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.card-body { padding: 12px 14px 14px; }
.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 37px;
}
.card-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-meta .cat {
  font-size: 11px;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  padding: 2px 8px;
  border-radius: 999px;
}
.fav-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 2px 4px;
  filter: grayscale(1);
  opacity: 0.55;
  transition: all 0.15s;
}
.fav-btn:hover { opacity: 1; filter: grayscale(0); transform: scale(1.12); }
.fav-btn.is-fav { filter: none; opacity: 1; }

/* ─── Loader / sentinel ─── */
.sentinel { height: 1px; }
.loader-line {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--hairline);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 8px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toolbar ─── */
.toolbar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search-input {
  padding: 9px 16px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--hairline);
  background: var(--surface-white);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  min-width: 240px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--primary); }
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface-white);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--body);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary-active); }
.chip.is-active { background: var(--surface-dark); border-color: var(--surface-dark); color: var(--on-dark); }

/* ─── Tag Cloud ─── */
.tag-cloud {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 24px 40px;
  text-align: center;
  line-height: 2.3;
}
.tag-cloud a {
  display: inline-block;
  margin: 0 6px;
  padding: 2px 4px;
  color: var(--body);
  font-weight: 500;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}
.tag-cloud a:hover { color: var(--primary-active); background: rgba(204, 120, 92, 0.12); }
.tag-cloud a.s1 { font-size: 13px; color: var(--muted); }
.tag-cloud a.s2 { font-size: 15px; }
.tag-cloud a.s3 { font-size: 18px; }
.tag-cloud a.s4 { font-size: 22px; color: var(--ink); }
.tag-cloud a.s5 { font-size: 27px; color: var(--primary); font-family: var(--font-display); letter-spacing: -0.01em; }

/* ─── Tag list ─── */
.letters {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}
.letter {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
}
.letter:hover { background: rgba(204, 120, 92, 0.12); color: var(--primary-active); }
.letter.is-active { background: var(--surface-dark); color: var(--on-dark); }
.tag-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 64px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.tag-card {
  background: var(--surface-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-card);
}
.tag-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.tag-card.is-selected { border-color: var(--primary); background: rgba(204, 120, 92, 0.07); }
.tag-name { font-size: 14px; font-weight: 500; color: var(--ink); }
.tag-meta { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ─── Detail ─── */
.detail { max-width: 1080px; margin: 0 auto; padding: 24px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-head h1 {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.2;
  max-width: 760px;
}
.detail-meta { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.detail-meta .cat { font-size: 12px; color: var(--muted); background: var(--surface-card); padding: 3px 10px; border-radius: 999px; }
.detail-tags { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.detail-tags a { font-size: 12px; color: var(--primary-active); background: rgba(204, 120, 92, 0.1); padding: 3px 10px; border-radius: 999px; }
.detail-actions { display: flex; gap: 10px; margin-top: 18px; }
.detail-grid { margin-top: 28px; columns: 4 240px; column-gap: 16px; }
.detail-grid .card { margin-bottom: 16px; }

/* ─── Favorites ─── */
.empty-state {
  max-width: 1280px;
  margin: 60px auto;
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state .big { font-family: var(--font-display); font-size: 34px; color: var(--ink); letter-spacing: -0.01em; }
.empty-state p { margin-top: 10px; }

/* ─── Footer ─── */
.footer {
  margin-top: auto;
  background: var(--surface-dark);
  color: var(--on-dark-soft);
  padding: 40px 24px;
  text-align: center;
  font-size: 13px;
}
.footer .brand { justify-content: center; color: var(--on-dark); margin-bottom: 8px; }
.footer a { color: var(--on-dark-soft); border-bottom: 1px solid rgba(250,249,245,0.2); }
.footer a:hover { color: var(--on-dark); }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-dark);
  color: var(--on-dark);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 100;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Responsive ─── */
@media (max-width: 720px) {
  .nav-inner { padding: 0 16px; }
  .brand .brand-sub { display: none; }
  .nav-links a { padding: 7px 10px; font-size: 12.5px; }
  .hero { padding: 40px 16px 28px; }
  .masonry, .detail-grid { padding-left: 16px; padding-right: 16px; }
  .toolbar { padding: 8px 16px 16px; }
  .search-input { min-width: 100%; }
}
