/* ===================================================
   Claw Job — the builder feed
   Dark, offbeat, hacker-culture vibes
   =================================================== */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Dark theme (default) */
:root {
  --bg:        #0a0a0c;
  --bg-raised: #111114;
  --bg-hover:  #18181c;
  --border:    #1e1e24;
  --text:      #e4e4e7;
  --text-dim:  #71717a;
  --text-muted:#52525b;
  --accent:    #f97316;
  --accent-dim:rgba(249, 115, 22, 0.15);
  --green:     #22c55e;
  --blue:      #3b82f6;
  --purple:    #a855f7;
  --pink:      #ec4899;
  --yellow:    #eab308;
  --cyan:      #06b6d4;
  --mono:      'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --sans:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light theme */
[data-theme="light"] {
  --bg:        #fafafa;
  --bg-raised: #ffffff;
  --bg-hover:  #f4f4f5;
  --border:    #e4e4e7;
  --text:      #18181b;
  --text-dim:  #52525b;
  --text-muted:#a1a1aa;
  --accent:    #ea580c;
  --accent-dim:rgba(234, 88, 12, 0.1);
}

/* Light theme tag overrides for readability */
[data-theme="light"] .feed-tag-claude-native {
  background: rgba(234, 88, 12, 0.1);
  color: #c2410c;
}
[data-theme="light"] .feed-tag-mcp {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}
[data-theme="light"] .feed-tag-integrates-with-claude {
  background: rgba(147, 51, 234, 0.1);
  color: #7c3aed;
}
[data-theme="light"] .feed-tag-web3 {
  background: rgba(8, 145, 178, 0.1);
  color: #0e7490;
}
[data-theme="light"] .feed-tag-framework {
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
}
[data-theme="light"] .feed-tag-community {
  background: rgba(202, 138, 4, 0.1);
  color: #a16207;
}

[data-theme="light"] .tag-pill:hover {
  border-color: #d4d4d8;
}

[data-theme="light"] .upvote-arrow {
  border-bottom-color: #a1a1aa;
}

[data-theme="light"] .upvote-btn.upvoted .upvote-arrow {
  filter: drop-shadow(0 0 4px rgba(234, 88, 12, 0.3));
}

[data-theme="light"] .new-badge {
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
}

html { font-size: 15px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== Header ===== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.logo-claw {
  font-family: var(--mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

.logo-text {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-stat {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Submit button */
.submit-btn {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.625rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.submit-btn:hover {
  background: var(--accent-dim);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-dim);
  transition: all 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Show moon in dark mode, sun in light mode */
.theme-icon-light { display: none; }
.theme-icon-dark  { display: inline; }

[data-theme="light"] .theme-icon-light { display: inline; }
[data-theme="light"] .theme-icon-dark  { display: none; }

@media (max-width: 640px) {
  .tagline { display: none; }
}

/* ===== Controls Bar ===== */
.controls-bar {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 53px;
  z-index: 90;
}

.controls-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.625rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Search */
.search-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8125rem;
  padding: 0.4rem 0.625rem;
  padding-right: 2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
}

.search-hint {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.625rem;
  padding: 0.0625rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  background: var(--bg-raised);
  pointer-events: none;
}

.search-input:focus ~ .search-hint {
  opacity: 0;
}

/* Tags */
.tag-filters {
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.tag-filters::-webkit-scrollbar { display: none; }

.tag-pill {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}

.tag-pill:hover {
  color: var(--text);
  border-color: #3f3f46;
  background: var(--bg-hover);
}

.tag-pill.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Time + Sort Row */
.time-sort {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.time-filters {
  display: flex;
  gap: 0.125rem;
  background: var(--bg);
  border-radius: 6px;
  padding: 2px;
}

.time-btn {
  font-family: var(--mono);
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.time-btn:hover {
  color: var(--text-dim);
}

.time-btn.active {
  color: var(--text);
  background: var(--bg-hover);
}

.sort-select {
  font-family: var(--mono);
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  appearance: auto;
}
.sort-select:focus { outline: 1px solid var(--accent); }

/* ===== Feed ===== */
.feed-container {
  flex: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

.feed-list {
  list-style: none;
  counter-reset: feed;
}

/* ===== Feed Item ===== */
.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  counter-increment: feed;
  transition: background 0.15s;
}

.feed-item:first-child {
  padding-top: 1rem;
}

.feed-item:hover {
  background: var(--bg-raised);
  margin: 0 -0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  border-radius: 6px;
}

/* Upvoted accent border */
.feed-item.user-upvoted {
  border-left: 2px solid var(--accent);
  padding-left: 0.625rem;
}

.feed-item.user-upvoted:hover {
  padding-left: calc(0.75rem + 0.625rem);
}

/* Rank number */
.feed-rank {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-width: 1.5rem;
  text-align: right;
  padding-top: 0.125rem;
  user-select: none;
}

/* Upvote */
.upvote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  padding: 0.25rem;
  border: none;
  background: none;
  cursor: pointer;
  min-width: 2rem;
  transition: transform 0.15s;
}

.upvote-btn:hover { transform: scale(1.15); }
.upvote-btn:active { transform: scale(0.95); }

.upvote-arrow {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 9px solid var(--text-muted);
  transition: border-color 0.15s;
}

.upvote-btn:hover .upvote-arrow {
  border-bottom-color: var(--accent);
}

.upvote-btn.upvoted .upvote-arrow {
  border-bottom-color: var(--accent);
  filter: drop-shadow(0 0 4px rgba(249, 115, 22, 0.4));
}

.upvote-count {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s;
}

.upvote-btn.upvoted .upvote-count {
  color: var(--accent);
}

/* Content */
.feed-content {
  flex: 1;
  min-width: 0;
}

.feed-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.feed-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
}

.feed-title:hover {
  color: var(--accent);
}

.feed-domain {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.feed-desc {
  font-size: 0.8125rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 0.25rem;
}

.feed-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

/* Tag badges in feed items */
.feed-tag {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: opacity 0.15s;
}

.feed-tag:hover {
  opacity: 0.75;
}

.feed-tag-claude-native {
  background: rgba(249, 115, 22, 0.12);
  color: #fb923c;
}
.feed-tag-mcp {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}
.feed-tag-integrates-with-claude {
  background: rgba(168, 85, 247, 0.12);
  color: #c4b5fd;
}
.feed-tag-web3 {
  background: rgba(6, 182, 212, 0.12);
  color: #67e8f9;
}
.feed-tag-framework {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}
.feed-tag-community {
  background: rgba(234, 179, 8, 0.12);
  color: #fde047;
}

.feed-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* New badge */
.new-badge {
  font-family: var(--mono);
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  vertical-align: middle;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.empty-state p {
  font-family: var(--mono);
  font-size: 0.8125rem;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem;
}

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.footer-dot {
  opacity: 0.3;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: -0.375rem;
}

.form-input,
.form-textarea {
  font-family: var(--mono);
  font-size: 0.8125rem;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
}

.form-textarea {
  resize: vertical;
  min-height: 4rem;
}

.form-fieldset {
  border: none;
  padding: 0;
}

.form-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.form-tag-check {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.form-tag-check input[type="checkbox"] {
  accent-color: var(--accent);
}

.form-submit {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 0.25rem;
}

.form-submit:hover {
  opacity: 0.9;
}

.form-hint {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: -0.25rem;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Animations ===== */
@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.upvote-pop {
  animation: pop 0.25s ease;
}

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

.feed-item-enter {
  animation: feedSlideIn 0.25s ease both;
}

/* ===== Focus ===== */
.feed-title:focus-visible,
.upvote-btn:focus-visible,
.tag-pill:focus-visible,
.time-btn:focus-visible,
.submit-btn:focus-visible,
.search-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  html { font-size: 14px; }

  .controls-inner {
    padding: 0.5rem 0.75rem;
  }

  .feed-container {
    padding: 0 0.75rem 2rem;
  }

  .feed-rank {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.25rem;
  }

  .footer-dot { display: none; }

  .header-stat { font-size: 0.6875rem; }

  .submit-btn { font-size: 0.6875rem; padding: 0.25rem 0.5rem; }
}
