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

body {
  font-family: 'Patrick Hand', cursive, sans-serif;
  background: #faf8f0;
  color: #333;
  min-height: 100vh;
}

/* subtle paper texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle, #e8e4d8 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
}

a { color: inherit; }

/* === Header === */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  border-bottom: 3px solid #ccc;
}

header h1 {
  font-size: 2.2rem;
  letter-spacing: 1px;
}

.back {
  font-size: 1.3rem;
  text-decoration: none;
}

.back:hover { text-decoration: underline; }

.logout {
  font-size: 1rem;
  text-decoration: none;
  color: #999;
}

.logout:hover { color: #666; }

/* === Filter bar === */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.8rem 2rem;
  background: #f5f2e8;
  border-bottom: 2px solid #d4cfc0;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.8rem;
  color: #999;
  margin-right: 0.2rem;
  user-select: none;
}

.filter-btn {
  font-family: 'Patrick Hand', cursive;
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border: 1.5px solid #d4cfc0;
  border-radius: 3px;
  background: #eae6da;
  color: #999;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: #bbb;
}

.filter-btn.active {
  background: #fffef5;
  color: #333;
  border-color: var(--filter-color, #aaa);
  box-shadow: 1px 1px 3px rgba(0,0,0,0.08);
}

.filter-btn.solo {
  background: #fff8dc;
  color: #333;
  border-color: #c9b458;
  box-shadow: 0 0 0 2px #c9b458, 1px 1px 3px rgba(0,0,0,0.08);
  font-weight: bold;
}

/* === Achievement Ribbon === */
.achievements {
  padding: 1rem 2rem;
  border-bottom: 2px solid #c9b458;
  background: linear-gradient(180deg, #faf8f0 0%, #f5f0e0 100%);
}

.achievements-title {
  font-size: 1.3rem;
  color: #6b6232;
  margin-bottom: 0.6rem;
}

.achievements-title::before {
  content: '\2605  ';
  color: #c9b458;
}

.achievement-strip {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.achievement-strip::-webkit-scrollbar {
  height: 4px;
}

.achievement-strip::-webkit-scrollbar-thumb {
  background: #c9b458;
  border-radius: 2px;
}

.achievement-card {
  flex-shrink: 0;
  background: linear-gradient(135deg, #f8f5e6 0%, #f0edd5 100%);
  border: 1.5px solid #c9b458;
  border-left: 4px solid var(--cat-color, #c9b458);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  text-decoration: none;
  color: #333;
  transition: transform 0.15s, box-shadow 0.15s;
}

.achievement-card:hover {
  transform: translateY(-2px);
  box-shadow: 2px 3px 8px rgba(201, 180, 88, 0.25);
}

/* Scope-based sizing for achievement cards */
.achievement-card.scope-tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.achievement-card.scope-small {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.achievement-card.scope-medium {
  padding: 0.4rem 0.7rem;
}

.achievement-card.scope-large {
  padding: 0.5rem 0.9rem;
  border-width: 2px;
  border-left-width: 6px;
}

.achievement-card.scope-huge {
  padding: 0.6rem 1rem;
  border-width: 2.5px;
  border-left-width: 7px;
  font-size: 1.05rem;
}

.achievement-card.scope-insane {
  padding: 0.7rem 1.1rem;
  border-width: 3px;
  border-left-width: 9px;
  font-size: 1.1rem;
}

.achievement-header {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.achievement-star {
  color: #c9b458;
  font-size: 1rem;
}

.achievement-name {
  font-weight: bold;
  white-space: nowrap;
}

.achievement-meta {
  display: flex;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: #999;
  margin-top: 0.15rem;
}

.achievement-cat {
  font-style: italic;
}

.achievement-tags {
  display: flex;
  gap: 0.2rem;
  margin-top: 0.15rem;
}

.achievement-tags .tag {
  font-size: 0.6rem;
}

/* === Board === */
.board {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 2rem;
  align-items: flex-start;
}

.category {
  flex: 1 1 300px;
  min-width: 280px;
  max-width: 500px;
}

.category h2 {
  font-size: 1.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 3px solid;
  margin-bottom: 1rem;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-height: 60px;
}

/* === Cards === */
.card {
  background: #fffef5;
  border: 2px solid #d4cfc0;
  border-radius: 4px;
  padding: 0.8rem 1rem;
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  border-left: 5px solid var(--cat-color, #ccc);
}

.card:hover {
  transform: rotate(-0.5deg) translateY(-2px);
  box-shadow: 3px 4px 8px rgba(0,0,0,0.1);
}

.card:active { cursor: grabbing; }

.card-ghost {
  opacity: 0.3;
  transform: rotate(2deg);
}

/* Scope → card size */
.card.scope-tiny { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.card.scope-tiny .card-summary { display: none; }
.card.scope-tiny .card-footer { display: none; }

.card.scope-small { padding: 0.5rem 0.8rem; }
.card.scope-small .card-summary { display: none; }

.card.scope-large {
  padding: 1rem 1.2rem;
  border-width: 3px;
  border-left-width: 7px;
}

.card.scope-huge {
  padding: 1.2rem 1.4rem;
  border-width: 4px;
  border-left-width: 9px;
  font-size: 1.1rem;
}

.card.scope-insane {
  padding: 1.4rem 1.6rem;
  border-width: 4px;
  border-left-width: 11px;
  font-size: 1.15rem;
  background: linear-gradient(135deg, #fffef5 0%, #f5f0e0 100%);
}

/* Status → visual treatment */
.card.status-active { background: #fffef5; }

.card.status-ongoing {
  background: #f0f5ff;
  border-left-color: #6fa8dc !important;
}

.card.status-shelved {
  background: #f5f0e8;
  opacity: 0.8;
  border-left-color: #c4a97d !important;
}

.card.status-blocked {
  background: #f5ece8;
  opacity: 0.8;
  border-left-color: #c47d7d !important;
}

.card.status-done {
  background: linear-gradient(135deg, #f8f5e6 0%, #f0edd5 100%);
  border-color: #c9b458;
  border-left-color: #c9b458 !important;
}

.card.status-done .card-title {
  color: #6b6232;
}

.card-star {
  color: #c9b458;
  font-size: 1.2rem;
  margin-right: 0.3rem;
  flex-shrink: 0;
}

.card.status-archive {
  background: #eee;
  opacity: 0.5;
  font-style: italic;
}

.card.status-delete {
  background: #f5e0e0;
  opacity: 0.4;
  text-decoration: line-through;
}

/* Priority → color-coded emphasis */
.card.priority-1 {
  box-shadow: 2px 3px 8px rgba(180,40,40,0.15);
  transform: rotate(-0.3deg);
}
.card.priority-1 .card-priority { color: #c0392b; font-weight: bold; }
.card.priority-1 .card-title { font-weight: bold; }

.card.priority-2 .card-priority { color: #e67e22; }

.card.priority-3 .card-priority { color: #f1c40f; }

.card.priority-4 .card-priority { color: #95a5a6; }

.card.priority-5 .card-priority { color: #bdc3c7; }
.card.priority-5 { opacity: 0.65; }

/* Card elements */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.3rem;
}

.card-title {
  font-size: 1.2rem;
  text-decoration: none;
}

.card-title:hover { text-decoration: underline; }

.card-priority {
  font-size: 0.85rem;
  color: #888;
  cursor: pointer;
  user-select: none;
}

.card-priority:hover { color: #333; }

/* Subprojects */
.card.subproject {
  margin-left: 1.5rem;
  border-left-width: 3px;
}

.subproject-indicator {
  color: #aaa;
  font-size: 1rem;
  margin-right: 0.2rem;
  flex-shrink: 0;
}

/* Expand chevron */
.card-chevron {
  font-size: 0.7rem;
  color: #ccc;
  transition: transform 0.2s, color 0.2s;
  cursor: pointer;
  user-select: none;
  margin-left: 0.3rem;
  flex-shrink: 0;
}

.card:hover .card-chevron { color: #999; }
.card.expanded .card-chevron { transform: rotate(180deg); color: #666; }

.card-summary {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.card-footer {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.card-status {
  font-size: 0.8rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: #e8e4d8;
  cursor: pointer;
  user-select: none;
}

.card-status:hover { background: #d4cfc0; }

.card-scope {
  font-size: 0.75rem;
  color: #aaa;
}

.tag {
  font-size: 0.7rem;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  background: #e8e4d8;
  color: #777;
}

/* === Inline Expand === */
.card-expand {
  display: none;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #d4cfc0;
}

.card.expanded .card-summary,
.card.expanded .card-footer {
  display: flex !important;
}

.expand-summary {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.expand-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.expand-link {
  font-size: 0.85rem;
  color: #6fa8dc;
  text-decoration: none;
  margin-left: auto;
}

.expand-link:hover { text-decoration: underline; }

/* === Detail page === */
.detail {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.detail-header {
  border-left: 6px solid;
  padding-left: 1.2rem;
  margin-bottom: 2rem;
}

.detail-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.detail-meta {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.detail-meta .card-status {
  font-size: 0.9rem;
  padding: 0.15rem 0.5rem;
}

.status-active { background: #d5ecd5; }
.status-ongoing { background: #d5ddef; }
.status-shelved { background: #e8dfd0; }
.status-blocked { background: #e8d5d0; }
.status-delete { background: #f5d5d5; }

.card-eta {
  font-size: 0.75rem;
  color: #999;
  font-style: italic;
}

.detail-category {
  font-size: 0.85rem;
  color: #999;
}

.detail-summary {
  font-size: 1.1rem;
  color: #555;
  line-height: 1.4;
}

.detail-tags {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.4rem;
}

.detail-content {
  line-height: 1.6;
  font-size: 1.05rem;
}

.detail-content h1, .detail-content h2, .detail-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.detail-content p { margin-bottom: 0.8rem; }

.detail-content code {
  background: #e8e4d8;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
}

.detail-content pre {
  background: #f0ece0;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.detail-content pre code {
  background: none;
  padding: 0;
}

.detail-content ul, .detail-content ol {
  margin-left: 1.5rem;
  margin-bottom: 0.8rem;
}

.detail-empty {
  color: #999;
  font-style: italic;
  padding: 2rem 0;
}

.detail-empty code {
  display: block;
  margin-top: 0.5rem;
  font-family: monospace;
  font-style: normal;
  color: #666;
}

/* === Login === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-card {
  background: #fffef5;
  border: 2px solid #d4cfc0;
  border-radius: 4px;
  padding: 2.5rem;
  text-align: center;
  box-shadow: 3px 4px 8px rgba(0,0,0,0.08);
}

.login-card h1 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
}

.login-card input {
  display: block;
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 0.8rem;
  border: 2px solid #d4cfc0;
  border-radius: 4px;
  font-family: 'Patrick Hand', cursive;
  font-size: 1.1rem;
  background: #faf8f0;
}

.login-card button {
  padding: 0.6rem 2rem;
  border: 2px solid #d4cfc0;
  border-radius: 4px;
  background: #e8e4d8;
  font-family: 'Patrick Hand', cursive;
  font-size: 1.1rem;
  cursor: pointer;
}

.login-card button:hover { background: #d4cfc0; }

.error {
  color: #c0392b;
  margin-bottom: 1rem;
}
