/* ============ nexCMS Base Styles ============ */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e8eaed;
  --text-primary: #1a1f36;
  --text-secondary: #4a5568;
  --text-muted: #8492a6;
  --accent: #4a6cf7;
  --accent-hover: #3a5ce5;
  --accent-light: #eef2ff;
  --shadow-sm: 0 1px 2px rgba(26,31,54,0.04);
  --shadow-md: 0 4px 12px rgba(26,31,54,0.07);
  --shadow-lg: 0 12px 32px rgba(26,31,54,0.1);
  --radius: 10px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

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

body { font-family: var(--font-body); font-size: 15px; line-height: 1.6; color: var(--text-primary); background: var(--bg); -webkit-font-smoothing: antialiased; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 32px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-left { display: flex; align-items: center; gap: 14px; }
.site-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.site-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }
.site-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 1px; }
.header-nav { display: flex; align-items: center; gap: 12px; }
.theme-toggle { width: 36px; height: 36px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-secondary); cursor: pointer; display: grid; place-items: center; transition: all 150ms; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Layout - WIDENED 3-COLUMN */
.main-layout { flex: 1; display: grid; grid-template-columns: 260px 1fr 280px; gap: 24px; max-width: 1800px; width: 96%; margin: 0 auto; align-items: start; padding: 24px 0; }
.board-area { padding: 0; }
.board-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.board-header h2 { font-size: 1.125rem; font-weight: 700; }
.board-filters { display: flex; gap: 6px; }
.filter-btn { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 0.75rem; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 100ms; }
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Post-it Board - STRICTLY 4-WIDE */
.postit-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; min-height: 400px; align-items: start; }
.postit-note { padding: 20px; border-radius: var(--radius); cursor: pointer; transition: all 200ms cubic-bezier(0.22,1,0.36,1); position: relative; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-height: 160px; }
.postit-note:hover { transform: translateY(-4px) rotate(-0.5deg); box-shadow: var(--shadow-lg); }
.postit-note::before { content: ''; position: absolute; top: 0; left: 20px; width: 40px; height: 6px; background: rgba(0,0,0,0.08); border-radius: 0 0 3px 3px; }
.postit-title { font-size: 0.9375rem; font-weight: 700; color: rgba(0,0,0,0.8); margin-bottom: 8px; line-height: 1.3; }
.postit-excerpt { font-size: 0.8125rem; color: rgba(0,0,0,0.55); line-height: 1.5; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.postit-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,0.06); }
.postit-category { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(0,0,0,0.4); }
.postit-date { font-size: 0.6875rem; color: rgba(0,0,0,0.35); }
.postit-pin { position: absolute; top: -4px; right: 16px; font-size: 1rem; }

/* Sidebars (Both Left & Right) */
.sidebar, .sidebar-left { padding: 20px; background: var(--surface); display: flex; flex-direction: column; gap: 20px; border-radius: var(--radius); border: 1px solid var(--border); }
.widget { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.widget-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.widget-header h3 { font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }

/* Left Sidebar Specifics (Clock & Audio) */
.clock-display { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 700; text-align: center; color: var(--accent); margin-bottom: 4px; }
.clock-date { text-align: center; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.audio-player-container { padding: 10px 0; display: flex; justify-content: center; }
.audio-player-container audio { width: 100%; height: 40px; border-radius: 6px; }

/* Calendar - OVERFLOW FIXED */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 0.75rem; width: 100%; box-sizing: border-box; }
.cal-header { font-weight: 700; color: var(--text-muted); padding: 4px 0; font-size: 0.6875rem; }
.cal-day { aspect-ratio: 1 / 1; width: 100%; display: grid; place-items: center; border-radius: 6px; margin: 0 auto; font-weight: 500; color: var(--text-secondary); position: relative; }
.cal-day.today { background: var(--accent); color: #fff; font-weight: 700; }
.cal-day.has-post::after { content: ''; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: #00b894; }
.cal-day.today.has-post::after { background: #fff; }
.cal-day.empty { color: transparent; }

/* Todo */
.todo-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.todo-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.todo-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.todo-item-text { font-size: 0.8125rem; color: var(--text-primary); flex: 1; }
.todo-item.done .todo-item-text { text-decoration: line-through; opacity: 0.5; }
.todo-count { font-size: 0.6875rem; font-weight: 700; background: var(--accent-light); color: var(--accent); padding: 2px 6px; border-radius: 10px; }
.todo-add { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.todo-add input { flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.8125rem; font-family: inherit; background: var(--surface); color: var(--text-primary); }
.todo-add input:focus { outline: none; border-color: var(--accent); }
.todo-add button { width: 28px; height: 28px; border: none; border-radius: 6px; background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer; display: grid; place-items: center; }

/* Footer */
.site-footer { padding: 20px 32px; border-top: 1px solid var(--border); background: var(--surface); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.footer-pgp { display: flex; align-items: center; gap: 16px; }
.pgp-block { display: flex; flex-direction: column; gap: 2px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-secondary); }
.pgp-label { font-weight: 700; color: var(--text-primary); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; }
.pgp-line { color: var(--text-muted); }
.pgp-fingerprint { font-weight: 600; color: var(--text-primary); letter-spacing: 0.02em; }
.pgp-qr { width: 50px; height: 50px; border-radius: 6px; opacity: 0.8; }
.footer-colophon { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.6; max-width: 400px; }
.footer-powered { text-align: right; font-size: 0.75rem; opacity: 0.6; width: 100%; margin-top: 10px; }

/* Page Modal */
.page-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; place-items: center; z-index: 1000; padding: 24px; backdrop-filter: blur(4px); }
.page-modal.open { display: grid; }
.page-modal-content { background: var(--surface); border-radius: 14px; padding: 40px; width: 100%; max-width: 700px; max-height: 85vh; overflow-y: auto; position: relative; box-shadow: 0 24px 48px rgba(0,0,0,0.2); animation: modalSlide 250ms cubic-bezier(0.22,1,0.36,1); }
@keyframes modalSlide { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
.modal-close { position: absolute; top: 16px; right: 20px; width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 8px; font-size: 1.25rem; cursor: pointer; display: grid; place-items: center; color: var(--text-muted); }
.modal-close:hover { background: var(--border); color: var(--text-primary); }
.page-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin-bottom: 24px; line-height: 1.3; letter-spacing: -0.02em; }
.page-body { font-size: 0.9375rem; line-height: 1.7; color: var(--text-secondary); max-width: 65ch; }
.page-body p { margin-bottom: 16px; }
.page-body strong { color: var(--text-primary); }
.page-body code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.8125rem; }
.page-tags { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; gap: 6px; flex-wrap: wrap; }
.page-tag { padding: 3px 10px; border-radius: 12px; font-size: 0.6875rem; font-weight: 600; background: var(--accent-light); color: var(--accent); }

/* Responsive Adjustments */
@media (max-width: 1200px) {
  .postit-board { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr 280px; }
  .sidebar-left { display: none; }
  .postit-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar, .sidebar-left { flex-direction: row; flex-wrap: wrap; }
  .widget { flex: 1; min-width: 240px; }
}
@media (max-width: 600px) {
  .site-header { padding: 16px 20px; }
  .board-area { padding: 20px 0; }
  .postit-board { grid-template-columns: 1fr; }
  .board-header { flex-direction: column; gap: 12px; align-items: flex-start; }
}
