/* ===========================================================
   Design tokens — modern light theme, indigo/violet accents
   =========================================================== */
:root {
  --bg: #FBFBFE;
  --card: #FFFFFF;
  --ink: #191A2B;
  --ink-soft: #5B5D74;
  --ink-faint: #9B9CB3;
  --line: #E7E7F2;
  --line-strong: #D6D6EC;

  --indigo: #5B54E8;
  --indigo-dark: #4453c4;
  --violet: #5c9af6;
  --sky: #38BDF8;
  --grad: linear-gradient(135deg, var(--indigo), var(--violet));

  --gold: #C9992E;
  --gold-bg: #FDF4E2;
  --danger: #E24C4B;
  --danger-bg: #FDEEEE;
  --sage-bg: #EAF6F0;
  --sage-line: #34A876;

  --shadow-card: 0 1px 2px rgba(24,20,70,0.04), 0 10px 30px -14px rgba(24,20,70,0.14);
  --shadow-hover: 0 18px 40px -16px rgba(91,84,232,0.28);
  --shadow-modal: 0 30px 70px -20px rgba(24,20,70,0.35);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --font-display: 'Rubik', system-ui, sans-serif;
  --font-body: 'Heebo', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
}

:focus-visible { outline: 2.5px solid var(--indigo); outline-offset: 2px; }
button { font-family: inherit; cursor: pointer; }

/* soft modern gradient blobs in the background */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.bg-blob-1 { width: 520px; height: 520px; top: -180px; left: -160px; background: radial-gradient(circle, var(--sky), transparent 70%); }
.bg-blob-2 { width: 480px; height: 480px; top: 260px; right: -200px; background: radial-gradient(circle, var(--violet), transparent 70%); }

header, main, footer, .modal-overlay { position: relative; z-index: 1; }

/* ===========================================================
   Masthead
   =========================================================== */
.masthead-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-mark {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tagline {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.user-chip { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.user-chip img { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line-strong); }
.user-chip .signout {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
  background: none; border: none; text-decoration: underline; padding: 0;
}

/* ===========================================================
   Hero
   =========================================================== */
.hero { max-width: 780px; margin: 0 auto; padding: 60px 24px 56px; text-align: center; }
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--indigo); background: rgba(91,84,232,0.08);
  padding: 5px 14px; border-radius: var(--radius-pill); margin: 0 0 20px;
}
.hero-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(32px, 5vw, 50px); line-height: 1.18; margin: 0 0 18px;
}
.hero-sub { color: var(--ink-soft); font-size: 17px; max-width: 560px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ===========================================================
   Buttons
   =========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; font-size: 15px; font-weight: 600;
  border-radius: var(--radius-sm); border: 1.5px solid transparent;
  text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -10px rgba(91,84,232,0.55); }
.btn-primary:hover { opacity: 0.92; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--indigo); color: var(--indigo); }
.btn-line { border: 1.3px solid var(--line-strong); background: transparent; color: var(--ink-soft); }
.btn-danger { border: 1.3px solid var(--danger); background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-small { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===========================================================
   Feed
   =========================================================== */
.feed-section { max-width: 1080px; margin: 0 auto; padding: 20px 24px 80px; }
.feed-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 28px;
}
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 26px; margin: 0; }
.feed-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }
.feed-loading, .feed-empty {
  text-align: center; color: var(--ink-faint); padding: 60px 20px;
  font-family: var(--font-mono); font-size: 14px;
}

.feed-grid {
  column-width: 280px;
  column-gap: 22px;
}

.item-card {
  break-inside: avoid;
  margin-bottom: 22px;
  background: var(--card);
  border: 1.3px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex; flex-direction: column; gap: 12px;
}
.item-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--line-strong); }

.item-card-thumb {
  width: 100%; max-height: 260px; height: auto; object-fit: contain;
  border-radius: var(--radius-sm); background: var(--bg); display: block;
}

.item-card-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; margin: 0; overflow-wrap: anywhere; }
.item-card-desc {
  color: var(--ink-soft); font-size: 14px; margin: 0; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line);
}
.item-card-owner { font-size: 12.5px; color: var(--ink-faint); }
.item-card-links { display: flex; flex-direction: column; gap: 4px; }
.item-card-link {
  font-size: 12.5px; color: var(--indigo-dark);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-card-link:hover { text-decoration: underline; }

/* ===========================================================
   Rating ring — signature element
   =========================================================== */
.rating-ring-wrap { display: inline-flex; align-items: center; gap: 8px; cursor: default; }
.rating-ring-track { fill: none; stroke: var(--line); }
.rating-ring-fill { fill: none; stroke: url(#ringGradient); stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.rating-ring-num {
  font-family: var(--font-mono); font-weight: 700; fill: var(--ink);
  text-anchor: middle; dominant-baseline: central;
}
.rating-ring-label { font-size: 11.5px; color: var(--ink-faint); font-family: var(--font-mono); }
.rating-ring-empty { color: var(--ink-faint); font-size: 12.5px; font-family: var(--font-mono); }

/* ===========================================================
   Modals
   =========================================================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,18,50,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100; backdrop-filter: blur(3px);
}
.modal-overlay[hidden] { display: none; }

.modal-sheet {
  background: var(--bg); border-radius: 18px;
  max-width: 520px; width: 100%; max-height: 88vh; overflow-y: auto;
  padding: 32px; position: relative;
  box-shadow: var(--shadow-modal); border: 1px solid var(--line);
}
.modal-sheet-wide { max-width: 700px; }

.modal-close {
  position: absolute; top: 16px; left: 16px; width: 32px; height: 32px; border-radius: 50%;
  border: 1.3px solid var(--line-strong); background: var(--card); font-size: 14px; color: var(--ink-soft);
}
.modal-close:hover { border-color: var(--indigo); color: var(--indigo); }

.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 23px; margin: 0 0 6px; }
.modal-hint { color: var(--ink-faint); font-size: 13.5px; margin: 0 0 22px; }

/* ===========================================================
   Form fields
   =========================================================== */
.field-label { display: block; font-size: 13px; font-weight: 600; margin: 18px 0 6px; color: var(--ink-soft); }
.field-input {
  width: 100%; padding: 11px 13px; font-size: 15px;
  border: 1.3px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font-family: inherit;
}
.field-input:focus { border-color: var(--indigo); }
.field-textarea { min-height: 100px; resize: vertical; }

.links-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; }
.link-row button {
  border: 1.3px solid var(--line-strong); background: var(--card);
  border-radius: var(--radius-sm); padding: 0 12px; color: var(--ink-faint);
}
.link-row button:hover { color: var(--danger); border-color: var(--danger); }

.form-error {
  color: #A83232; background: var(--danger-bg); border: 1px solid var(--danger);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; margin: 16px 0 0;
}

/* ===========================================================
   Image upload zone (imgbb widget)
   =========================================================== */
.upload-zone { margin-top: 4px; }

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

.upload-trigger-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.3px dashed var(--line-strong); background: var(--card); color: var(--ink-soft);
  padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
}
.upload-trigger-btn:hover, .upload-trigger-btn:focus-visible { border-color: var(--indigo); color: var(--indigo); }

.upload-hint { font-size: 11.5px; color: var(--ink-faint); margin: 6px 0 10px; line-height: 1.5; }

.image-previews { display: flex; flex-wrap: wrap; gap: 10px; }
.image-preview { position: relative; width: 74px; height: 74px; border-radius: var(--radius-sm); overflow: hidden; border: 1.3px solid var(--line-strong); }
.image-preview.is-primary { border: 2.5px solid var(--indigo); }
.image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-preview button.remove-img {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(25,26,43,0.72); color: #fff; border: none; font-size: 11px; line-height: 1;
}
.image-preview .primary-badge {
  position: absolute; bottom: 0; right: 0; left: 0;
  background: var(--indigo); color: #fff; font-size: 9.5px; font-weight: 700;
  text-align: center; padding: 2px 0;
}
.image-preview button.set-primary {
  position: absolute; bottom: 0; right: 0; left: 0;
  background: rgba(25,26,43,0.72); color: #fff; border: none;
  font-size: 9.5px; padding: 3px 0; font-weight: 600;
}
.image-preview button.set-primary:hover { background: var(--indigo); }

/* ===========================================================
   Item detail modal content
   =========================================================== */
.detail-owner { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); margin: 0 0 4px; }
.detail-title { font-family: var(--font-display); font-weight: 700; font-size: 27px; margin: 0 0 14px; overflow-wrap: anywhere; }
.detail-desc { color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 18px; }

.detail-images { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 18px; }
.detail-images img { height: 150px; border-radius: var(--radius-sm); border: 1.3px solid var(--line-strong); flex-shrink: 0; }

.detail-links { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 6px; }
.detail-links a { color: var(--indigo-dark); font-size: 14px; word-break: break-all; }

.detail-rating-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }

.owner-actions { margin-bottom: 22px; }

.divider { border: none; border-top: 1px dashed var(--line); margin: 24px 0; }

.lightbox-inner { position: relative; max-width: 92vw; max-height: 88vh; }
.lightbox-inner img { max-width: 92vw; max-height: 88vh; border-radius: 10px; display: block; object-fit: contain; }
.lightbox-inner .modal-close { top: -14px; left: -14px; background: #fff; }

.clickable-img { cursor: zoom-in; }

/* review form */
.review-form-box { background: var(--card); border: 1.3px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 26px; }
.review-form-title { font-weight: 700; font-size: 15px; margin: 0 0 12px; }

.star-picker { display: flex; flex-direction: row-reverse; gap: 6px; margin-bottom: 14px; justify-content: flex-end; }
.star-picker button {
  background: none; border: none; font-size: 30px; line-height: 1; color: var(--line-strong);
  transition: color 0.1s, transform 0.1s; padding: 0 2px;
}
.star-picker button.active { color: var(--gold); }
.star-picker button:hover { transform: scale(1.1); }

.owner-note, .signin-note {
  font-size: 13.5px; color: var(--ink-soft); background: var(--sage-bg);
  border: 1.3px solid var(--sage-line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 26px;
}
.owner-note p { margin: 0 0 10px; }

/* reviews list */
.reviews-title { font-weight: 700; font-size: 15px; margin: 0 0 14px; }
.review-item { border: 1.3px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: var(--card); }
.review-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.review-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--line); flex-shrink: 0; }
.review-avatar-fallback {
  width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.review-head-text { flex: 1; min-width: 0; }
.review-author { font-weight: 600; font-size: 14px; display: block; }
.review-time { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.review-stars { color: var(--gold); font-size: 14px; letter-spacing: 1px; margin-bottom: 6px; }
.review-comment { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-images { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.review-images img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1.3px solid var(--line-strong); }
.reviews-empty { color: var(--ink-faint); font-size: 13.5px; font-family: var(--font-mono); }

.review-actions { display: flex; align-items: center; justify-content: space-between; }
.reaction-group { display: flex; align-items: center; gap: 8px; }

.like-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1.3px solid var(--line-strong); background: var(--card); color: var(--ink-faint);
  border-radius: var(--radius-pill); padding: 6px 13px; font-size: 12.5px; font-weight: 600;
}
.like-btn:hover:not(:disabled) { border-color: var(--indigo); color: var(--indigo); }
.like-btn.liked { border-color: var(--indigo); background: rgba(91,84,232,0.08); color: var(--indigo); }
.dislike-btn:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.dislike-btn.liked { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.like-btn:disabled { opacity: 0.45; cursor: default; }

.delete-review-btn {
  background: none; border: none; color: var(--ink-faint);
  font-size: 12.5px; text-decoration: underline; padding: 0;
}
.delete-review-btn:hover { color: var(--danger); }

/* ===========================================================
   Toast
   =========================================================== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: var(--radius-pill);
  font-size: 14px; z-index: 200; box-shadow: var(--shadow-modal);
}
.toast[hidden] { display: none; }
.toast.toast-error { background: var(--danger); }

/* ===========================================================
   Footer
   =========================================================== */
.site-footer { text-align: center; padding: 30px 20px 50px; color: var(--ink-faint); font-family: var(--font-mono); font-size: 11.5px; }

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 640px) {
  .masthead-inner { padding: 20px 18px 14px; }
  .hero { padding: 44px 18px 40px; }
  .feed-section { padding: 16px 16px 60px; }
  .modal-sheet { padding: 22px; max-height: 92vh; }
}
