/* ==========================================================================
   LinkedIn Post Previewer
   Design system + LinkedIn feed replica
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Brand */
  --brand: #0a66c2;        /* LinkedIn blue */
  --brand-dark: #084d92;
  --brand-soft: #e8f0fc;
  --accent: #057642;       /* LinkedIn green for "good" */
  --warn: #b24020;         /* LinkedIn red-ish for warnings */

  /* Neutrals */
  --bg: #f3f2ef;           /* LinkedIn page bg */
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e0e0e0;
  --border-strong: #c9c9c9;
  --text: #000000e6;       /* LinkedIn primary text */
  --text-2: #00000099;     /* secondary */
  --text-3: #00000066;     /* tertiary */

  /* LinkedIn card tokens (matched to actual feed) */
  --li-card-bg: #ffffff;
  --li-border: rgba(0,0,0,0.08);
  --li-radius: 8px;
  --li-name: #000000e6;
  --li-headline: #00000099;
  --li-meta: #00000099;
  --li-body: #000000e6;
  --li-see-more: #00000099;
  --li-action: #00000099;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 1px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);

  /* Layout */
  --container: 1200px;
  --header-h: 64px;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(22px, 2.5vw, 30px); font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--s-5); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -40px; left: 0; padding: var(--s-2) var(--s-4);
  background: var(--brand); color: white; z-index: 100;
}
.skip-link:focus { top: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; gap: var(--s-6);
}
.logo { display: flex; align-items: center; gap: var(--s-2); color: var(--text); font-weight: 700; font-size: 18px; }
.logo:hover { text-decoration: none; }
.logo-mark { color: var(--brand); font-size: 22px; line-height: 1; }
.site-nav { display: flex; gap: var(--s-5); }
.site-nav a { color: var(--text-2); font-weight: 500; font-size: 14px; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  padding: var(--s-10) 0 var(--s-12);
  background:
    radial-gradient(ellipse at top, var(--brand-soft) 0%, transparent 60%),
    var(--bg);
}
.eyebrow {
  display: inline-block;
  padding: var(--s-1) var(--s-3);
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: var(--s-4);
}
.accent { color: var(--brand); }
.hero-sub {
  margin-top: var(--s-4);
  font-size: 17px; color: var(--text-2);
  max-width: 720px; line-height: 1.55;
}

/* ---------- Tool Grid ---------- */
.tool-grid {
  margin-top: var(--s-8);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
  align-items: start;
}
@media (max-width: 900px) {
  .tool-grid { grid-template-columns: 1fr; }
}

.pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.pane-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  gap: var(--s-3);
  flex-wrap: wrap;
}
.pane-title { font-size: 14px; font-weight: 600; color: var(--text); }
.pane-subtitle { color: var(--text-3); font-weight: 400; font-size: 13px; }

.device-toggle { display: flex; gap: var(--s-1); background: var(--bg); padding: 3px; border-radius: var(--r-md); }
.device-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
}
.device-btn:hover { color: var(--text); }
.device-btn.is-active { background: white; color: var(--brand); box-shadow: var(--shadow-sm); }

.preview-stats { display: flex; gap: var(--s-4); font-size: 12px; color: var(--text-2); }
.stat { display: flex; align-items: center; gap: 4px; }
.stat-num { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Editor ---------- */
.editor-toolbar {
  display: flex; align-items: center; gap: var(--s-1);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.format-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition: all 0.12s ease;
}
.format-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.format-btn strong, .format-btn em, .format-btn code { font-style: normal; font-family: var(--font-sans); }
.format-btn code { font-family: var(--font-mono); font-size: 12px; }
.toolbar-sep {
  width: 1px; height: 20px;
  background: var(--border);
  margin: 0 var(--s-2);
}
.template-select {
  margin-left: auto;
  padding: 6px 10px;
  font-size: 12px; color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.template-select:hover { border-color: var(--border-strong); }

.post-input {
  display: block;
  width: 100%;
  min-height: 360px;
  padding: var(--s-4) var(--s-5);
  font-family: var(--font-sans);
  font-size: 15px; line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 0;
  outline: 0;
  resize: vertical;
}
.post-input::placeholder { color: var(--text-3); }

.editor-footer {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.char-count { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.count-num { font-weight: 700; color: var(--text); }
.char-count.is-warn .count-num { color: var(--warn); }
.char-count.is-good .count-num { color: var(--accent); }

.fold-warnings { font-size: 12px; color: var(--warn); font-weight: 500; }
.editor-actions { display: flex; gap: var(--s-2); }
.btn-primary, .btn-secondary {
  padding: 7px 14px;
  font-size: 13px; font-weight: 600;
  border-radius: var(--r-md);
  transition: all 0.12s ease;
}
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-secondary.is-success { background: var(--accent); color: white; border-color: var(--accent); }

/* ---------- LinkedIn Card (preview) ---------- */
.preview-stage {
  padding: var(--s-5);
  display: flex;
  justify-content: center;
  background:
    repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--bg) 10px, var(--bg) 20px);
}
.li-card {
  background: var(--li-card-bg);
  border: 1px solid var(--li-border);
  border-radius: var(--li-radius);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
  width: 100%;
  max-width: 360px;
  transition: max-width 0.2s ease;
  font-family: var(--font-sans);
  overflow: hidden;
}
.li-card[data-device="desktop"] { max-width: 552px; }

.li-card-header {
  display: flex; align-items: flex-start; gap: var(--s-2);
  padding: var(--s-3) var(--s-4) 0;
}
.li-avatar {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a66c2 0%, #057642 100%);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 18px;
}
.li-avatar::after { content: "YN"; }
.li-author { flex: 1; min-width: 0; }
.li-name { font-size: 14px; font-weight: 600; color: var(--li-name); }
.li-headline { font-size: 12px; color: var(--li-headline); margin-top: 2px; }
.li-meta { font-size: 12px; color: var(--li-meta); margin-top: 2px; }
.li-more { color: var(--li-meta); font-size: 18px; padding: 4px 8px; }

.li-content {
  padding: var(--s-3) var(--s-4) var(--s-4);
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.5;
  color: var(--li-body);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.li-card[data-device="mobile"] .li-content { font-size: 14px; }
.li-text-visible { display: inline; }
.li-see-more {
  color: var(--li-see-more);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  margin-left: 4px;
  cursor: pointer;
}
.li-see-more:hover { text-decoration: underline; }

.li-reactions {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-4) var(--s-2);
  font-size: 12px;
  color: var(--li-meta);
  flex-wrap: wrap;
}
.li-reaction-icons {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 16px;
  background: linear-gradient(90deg, #0a66c2 0%, #0a66c2 50%, #057642 50%, #915907 100%);
  border-radius: 8px;
  color: transparent;
  font-size: 10px;
}
.li-comments-count { margin-left: auto; }

.li-actions {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--li-border);
  padding: 4px 0;
}
.li-action {
  padding: 10px 4px;
  font-size: 13px; font-weight: 600;
  color: var(--li-action);
  text-align: center;
  border-radius: var(--r-sm);
  transition: background 0.1s;
}
.li-action:hover { background: var(--surface-2); }

.preview-note {
  padding: 0 var(--s-5) var(--s-4);
  font-size: 12px; color: var(--text-3);
  text-align: center;
}

/* ---------- Long-form guide ---------- */
.guide-section, .faq-section {
  padding: var(--s-12) 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.section-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto var(--s-10);
}
.section-sub { margin-top: var(--s-3); color: var(--text-2); font-size: 16px; }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-5);
}
.guide-card {
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: all 0.2s ease;
}
.guide-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.guide-card h3 { margin-bottom: var(--s-3); color: var(--brand); }
.guide-card p { color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.guide-card p + p { margin-top: var(--s-3); }

/* ---------- FAQ ---------- */
.faq-list { max-width: 760px; margin: 0 auto; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  margin-bottom: var(--s-3);
  overflow: hidden;
}
.faq-item summary {
  padding: var(--s-4) var(--s-5);
  font-weight: 600; font-size: 15px;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 48px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: var(--s-5); top: 50%;
  transform: translateY(-50%);
  font-size: 22px; font-weight: 300;
  color: var(--text-2);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding: 0 var(--s-5) var(--s-5); color: var(--text-2); line-height: 1.6; }

/* ---------- Footer ---------- */
.site-footer {
  background: #1a1a1a;
  color: #999;
  padding: var(--s-8) 0;
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--s-4);
}
.footer-brand { display: flex; align-items: center; gap: var(--s-2); color: white; font-weight: 700; }
.footer-brand .logo-mark { color: var(--brand); font-size: 22px; }
.footer-note { font-size: 13px; max-width: 360px; }
.footer-nav { display: flex; gap: var(--s-5); }
.footer-nav a { color: #ccc; font-size: 13px; }
.footer-nav a:hover { color: white; text-decoration: none; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .site-nav { display: none; }
  .hero { padding: var(--s-6) 0 var(--s-8); }
  .editor-footer { flex-direction: column; align-items: stretch; }
  .editor-actions { justify-content: stretch; }
  .editor-actions button { flex: 1; }
  .li-card { max-width: 100%; }
  .li-card[data-device="desktop"] .li-content { font-size: 15px; }
}

/* ---------- Performance: reduce CLS ---------- */
.li-content { min-height: 80px; }
.preview-stage { min-height: 420px; }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.post-input:focus-visible { outline: 0; }
