* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif; color: #111; background: #fafafa; }
a { color: inherit; text-decoration: none; }
.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.site-header { background: #fff; border-bottom: 1px solid #eee; position: sticky; top: 0; z-index: 10; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.site-title { font-size: 1.25rem; margin: 0; }
.site-title a { font-weight: 700; }

.site-footer { margin-top: 4rem; padding: 2rem 0; color: #666; font-size: 0.9rem; }

.flash-wrap { margin: 1rem 0; }
.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 0.5rem; border: 1px solid transparent; }
.flash.success { background: #eafaf1; border-color: #b7f0cf; }
.flash.error { background: #fdecea; border-color: #f5c2c0; }
.flash.warning { background: #fff8e6; border-color: #ffe2a8; }
.flash.info { background: #eef5ff; border-color: #c8dcff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }

.card { position: relative; background: #fff; border: 1px solid #eee; border-radius: 12px; padding: 0.5rem; box-shadow: 0 1px 1px rgba(0,0,0,0.03); cursor: pointer; transition: transform 0.05s ease, box-shadow 0.1s ease; overflow: hidden; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card .iframe-wrap { border-radius: 8px; overflow: hidden; }
.card .link-card { padding: 1rem; display: grid; gap: 0.25rem; }
.card .card-link { position: absolute; inset: 0; z-index: 5; text-indent: -9999px; /* accessible label, visually hidden */ }
.card .card-link:focus { outline: none; box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.35); border-radius: 12px; }
.card > * { transition: opacity 0.24s ease; }
.card.is-loading {
  pointer-events: none;
  min-height: 340px;
  min-height: var(--card-skeleton-height, 340px);
  height: var(--card-skeleton-height, 340px);
}
.card.is-loading > * { opacity: 0; }
.card.is-loading::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(115deg, #f0f0f0 0%, #f7f7f7 45%, #f0f0f0 100%); background-size: 200% 100%; animation: card-skeleton-shimmer 1.6s ease-in-out infinite; z-index: 1; }
.card.is-loading::after { content: ""; position: absolute; width: 3.1rem; height: 3.1rem; top: 50%; left: 50%; margin: -1.55rem 0 0 -1.55rem; border-radius: 50%; border: 3px solid rgba(17,17,17,0.15); border-top-color: rgba(17,17,17,0.55); background: conic-gradient(from 90deg, rgba(17,17,17,0.55), rgba(17,17,17,0)); mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px)); box-shadow: 0 0 0 4px rgba(255,255,255,0.7); animation: card-skeleton-spin 0.9s linear infinite; z-index: 2; box-sizing: border-box; }
.card[data-embed-type="twitter_blockquote"] { --card-skeleton-height: 420px; }
.card[data-embed-type="linkedin_iframe"] { --card-skeleton-height: 520px; }

@keyframes card-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes card-skeleton-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .card.is-loading::before { animation-duration: 0.01ms; animation-iteration-count: 1; background: #f3f3f3; }
  .card.is-loading::after { animation: none; }
}

.link-platform { font-size: 0.8rem; color: #666; text-transform: uppercase; letter-spacing: .04em; }
.link-url { word-break: break-word; }
.link-cta { font-weight: 700; }

.form { display: grid; gap: 0.5rem; max-width: 720px; }
.form input[type="url"], .form input[type="password"] { padding: 0.6rem 0.75rem; border-radius: 8px; border: 1px solid #ddd; font-size: 1rem; background: #fff; }
.form button { padding: 0.6rem 0.9rem; border: 0; border-radius: 8px; font-weight: 700; background: #111; color: #fff; cursor: pointer; }
.form button.danger { background: #b3261e; }

.hint { color: #666; font-size: 0.95rem; }

.table { width: 100%; background: #fff; border: 1px solid #eee; border-radius: 8px; border-collapse: collapse; overflow: hidden; }
.table th, .table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid #f0f0f0; text-align: left; vertical-align: top; font-size: 0.95rem; }
.table thead th { background: #fafafa; font-weight: 700; }
.table .cell-actions { width: 1%; white-space: nowrap; }
.table .cell-url { max-width: 520px; overflow-wrap: anywhere; }
.table .cell-reorder { width: 1%; white-space: nowrap; cursor: grab; }

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-right: 0.25rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: #f4f4f4;
  color: #555;
  cursor: grab;
  font-size: 1rem;
  line-height: 1;
}

.drag-handle:focus-visible {
  outline: 3px solid rgba(0, 102, 255, 0.35);
  outline-offset: 2px;
}

.drag-handle:active {
  cursor: grabbing;
}

.reorder-btn {
  appearance: none;
  border: 1px solid #d0d0d0;
  background: #f8f8f8;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: 0.25rem;
}

.reorder-btn:hover {
  background: #ececec;
}

.table tbody tr.dragging {
  opacity: 0.6;
}

.table tbody tr.drop-target {
  outline: 2px dashed #909090;
  outline-offset: -6px;
}

.reorder-form {
  margin-top: 0.75rem;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.reorder-form button {
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  border: 0;
  background: #111;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* Make tweets align nicely within cards */
.twitter-tweet { margin: 0 auto !important; }
