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

:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --bg: #fafafa;
  --bg-alt: #f0f0f0;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #f59e0b;
  --border: #e5e7eb;
  --danger: #ef4444;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --max-width: 900px;
  --nav-height: 60px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

.hidden {
  display: none !important;
}

/* Navigation */
.navbar {
  position: sticky;
  top: 0;
  height: var(--nav-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links a.active {
  color: var(--primary);
}

/* Hero */
.hero {
  padding: 100px 0 80px;
  text-align: center;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  background: var(--bg-alt);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: var(--text);
}

/* Sections */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

/* Blog Cards */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.blog-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.blog-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.blog-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.blog-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* About */
.about-content {
  max-width: 640px;
}

.about-text p {
  margin-bottom: 1rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

/* Contact */
.contact-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 480px;
}

.contact-form input,
.contact-form textarea {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: white;
}

.contact-form textarea {
  min-height: 120px;
  resize: vertical;
}

.contact-form input:disabled,
.contact-form textarea:disabled {
  background: var(--bg-alt);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Footer */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Password Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal-content h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.modal-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.password-form input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-sans);
  text-align: center;
  letter-spacing: 0.15em;
  transition: border-color 0.2s;
}

.password-form input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
}

.error-message {
  color: var(--danger);
  font-size: 0.85rem;
}

/* Notebook */
#notebook {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

#notebook:not(.hidden) {
  animation: slideUp 0.3s ease-out;
}

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

.notebook-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  flex-shrink: 0;
}

.notebook-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notebook-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.notebook-actions {
  display: flex;
  gap: 0.75rem;
}

.notebook-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Note List Sidebar */
.note-list {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: white;
}

.note-list-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.note-list-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

#notes-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 1rem;
}

.note-item {
  padding: 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
}

.note-item:hover {
  background: var(--bg-alt);
}

.note-item.active {
  background: var(--primary);
  color: white;
}

.note-item.active .note-item-date {
  color: rgba(255,255,255,0.7);
}

.note-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item.active .note-item-preview {
  color: rgba(255,255,255,0.7);
}

.note-item-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Note Editor */
.note-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  overflow-y: auto;
}

.editor-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.editor-title {
  width: 100%;
  font-size: 1.8rem;
  font-weight: 700;
  border: none;
  background: transparent;
  padding: 0 0 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  font-family: var(--font-sans);
  color: var(--text);
  outline: none;
  letter-spacing: -0.02em;
}

.editor-title:focus {
  border-bottom-color: var(--primary);
}

.editor-content {
  flex: 1;
  width: 100%;
  min-height: 300px;
  border: none;
  background: transparent;
  font-size: 1rem;
  line-height: 1.8;
  resize: none;
  outline: none;
  font-family: var(--font-sans);
  color: var(--text);
  padding: 0;
}

.editor-content::placeholder {
  color: var(--text-muted);
}

.editor-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.save-indicator {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
}

/* Responsive */
@media (max-width: 640px) {
  .hero h1 { font-size: 2.5rem; }
  .hero { padding: 60px 0 40px; }
  .blog-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 1rem; }
  .nav-links a { font-size: 0.8rem; }
  .note-list { width: 200px; min-width: 200px; }
  .notebook-body { flex-direction: column; }
  .note-list { width: 100%; min-width: auto; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
}
