/* ============================================================
   FLASKHUB — STYLESHEET
   ============================================================ */

:root {
  --bg:           #0c0c0f;
  --surface:      #161619;
  --surface2:     #1e1e23;
  --border:       rgba(255,255,255,0.07);
  --border-hi:    rgba(255,255,255,0.13);
  --text:         #e4e4e9;
  --text-dim:     #8b8b98;
  --text-muted:   #4a4a56;
  --accent:       #f59e0b;
  --accent-dim:   rgba(245,158,11,0.10);
  --accent-glow:  rgba(245,158,11,0.20);
  --green:        #22c55e;
  --green-dim:    rgba(34,197,94,0.12);
  --radius-sm:    8px;
  --radius:       14px;
  --max-w:        640px;
  --header-h:     54px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Menlo', 'Consolas', monospace;
}

/* ── Reset ────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button  { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; background: none; border: none; outline: none; }
a       { color: inherit; text-decoration: none; }
img     { display: block; max-width: 100%; }
textarea { resize: vertical; }

/* ── Scan banner ──────────────────────────────────────────── */

.scan-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  background: rgba(8, 8, 10, 0.96);
  border-bottom: 1px solid var(--green);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.10em;
  color: var(--green);
  backdrop-filter: blur(8px);
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.scan-banner.visible { transform: translateY(0); }

.scan-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: blink 1.1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* ── Header ───────────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 20px;
  background: rgba(12, 12, 15, 0.90);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  user-select: none;
}

.compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  transition: opacity 0.15s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.compose-btn:hover { opacity: 0.88; }

.compose-btn.open {
  transform: rotate(45deg);
  background: var(--surface2);
  color: var(--text-dim);
}

/* ── Composer ─────────────────────────────────────────────── */

.composer {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border-bottom: 1px solid transparent;
}

.composer.open {
  max-height: 560px;
  border-bottom-color: var(--border);
}

.composer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.type-tabs {
  display: flex;
  gap: 3px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}

.type-tab {
  padding: 6px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all 0.15s;
}

.type-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.composer-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  min-height: 96px;
  transition: border-color 0.15s;
}

.composer-textarea.small { min-height: 56px; }
.composer-textarea:focus  { border-color: var(--border-hi); }
.composer-textarea::placeholder { color: var(--text-muted); }

.composer-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
}

.composer-input:focus { border-color: var(--border-hi); }
.composer-input::placeholder { color: var(--text-muted); }

.composer-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
}

.name-input { flex: 1; min-width: 110px; }

.composer-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235c5c68' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.submit-btn {
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.01em;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.submit-btn:hover    { opacity: 0.85; }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Image drop zone */

.image-drop-zone {
  border: 1.5px dashed var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.image-drop-zone:hover,
.image-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-dim);
}

.image-preview {
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.image-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.remove-image {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s;
}

.remove-image:hover { background: rgba(0,0,0,0.9); }

/* ── Feed ─────────────────────────────────────────────────── */

.feed {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feed-status {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 56px 0;
  letter-spacing: 0.05em;
}

/* ── Post card ────────────────────────────────────────────── */

.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: postIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* Post meta row */

.post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
}

.post-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.post-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.post-tag.hidden { display: none; }

.post-author {
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-author::before { content: '@ '; opacity: 0.45; }

.post-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Post body */

.post-body {
  padding: 2px 0 4px;
}

.post-text {
  padding: 4px 16px 14px;
  font-size: 15px;
  line-height: 1.68;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Image posts */

.post-image-wrap {
  line-height: 0;
}

.post-image-wrap img {
  width: 100%;
  max-height: 540px;
  object-fit: cover;
  display: block;
}

.post-caption {
  padding: 10px 16px 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* Link posts */

.post-link {
  display: block;
  margin: 4px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--surface2);
  transition: border-color 0.15s;
}

.post-link:hover { border-color: var(--border-hi); }

.post-link-title {
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}

.post-link-host {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.post-link-desc {
  margin-top: 9px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dim);
  word-break: break-word;
}

/* ── Post footer — reactions + notes ─────────────────────── */

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 14px 14px;
}

.reactions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 14px;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  user-select: none;
  -webkit-user-select: none;
}

.reaction-btn:hover {
  border-color: var(--border-hi);
}

.reaction-btn:active {
  transform: scale(1.18);
}

.reaction-btn.pop {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.reaction-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  min-width: 10px;
  transition: color 0.15s;
}

.reaction-count.zero { color: var(--text-muted); }

.notes-toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  padding: 4px 2px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
}

.notes-toggle:hover { color: var(--text-dim); }

/* ── Comments / notes ─────────────────────────────────────── */

.comments-section {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.comments-list:empty { margin-bottom: 0; }

.comment {
  display: flex;
  gap: 9px;
  align-items: baseline;
}

.comment-author-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.comment-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
  word-break: break-word;
}

.comment-form {
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.comment-name {
  width: 90px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text-dim);
  transition: border-color 0.15s;
}

.comment-name:focus { border-color: var(--border-hi); }
.comment-name::placeholder { color: var(--text-muted); }

.comment-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
}

.comment-input:focus { border-color: var(--border-hi); }
.comment-input::placeholder { color: var(--text-muted); }

.comment-submit {
  font-size: 18px;
  color: var(--accent);
  padding: 2px 4px;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.comment-submit:hover { opacity: 0.7; transform: translateX(2px); }

/* ── Site footer ──────────────────────────────────────────── */

.site-footer {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 20px 40px;
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ── Utilities ────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 480px) {
  .feed            { padding: 16px 10px 32px; gap: 10px; }
  .composer-inner  { padding: 16px 14px 20px; }
  .post-meta       { padding: 12px 14px 8px; }
  .composer-meta   { gap: 8px; }
  .name-input      { width: 100%; }

  .comment-name    { width: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
