/* Henry's Blog - Minimalist Black & White */
:root {
  --black: #111;
  --white: #fff;
  --gray: #666;
  --light-gray: #f5f5f5;
  --border: #e0e0e0;
  --bg: #fff;
  --text: #111;
  --text-secondary: #666;
}

[data-theme="dark"] {
  --black: #fff;
  --white: #111;
  --gray: #aaa;
  --light-gray: #222;
  --border: #333;
  --bg: #0d0d0d;
  --text: #f0f0f0;
  --text-secondary: #aaa;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  transition: background 0.3s, color 0.3s;
}

/* Theme Toggle - Cute Style */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 60px;
  height: 30px;
  border-radius: 15px;
  border: none;
  background: linear-gradient(to bottom, #1a1a2e, #16213e);
  cursor: pointer;
  padding: 3px;
  transition: all 0.4s ease;
  z-index: 100;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

.theme-toggle::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f9d71c;
  left: 3px;
  top: 3px;
  transition: all 0.4s ease;
  box-shadow: 0 0 10px #f9d71c;
}

.theme-toggle::after {
  content: '☆';
  position: absolute;
  right: 10px;
  top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  transition: all 0.3s;
}

[data-theme="dark"] .theme-toggle {
  background: linear-gradient(to bottom, #87CEEB, #E0F6FF);
}

[data-theme="dark"] .theme-toggle::before {
  left: 33px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,0.8);
}

[data-theme="dark"] .theme-toggle::after {
  content: '☁';
  color: rgba(255,255,255,0.9);
  right: auto;
  left: 8px;
}

.theme-toggle:hover {
  transform: scale(1.05);
}

.theme-toggle:active::before {
  width: 28px;
}

a {
  color: var(--black);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s;
}

a:hover {
  border-color: var(--black);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

header .title {
  font-size: 1.1rem;
  color: var(--gray);
  margin-bottom: 16px;
}

header .bio {
  color: var(--gray);
  max-width: 500px;
}

header .links {
  margin-top: 20px;
}

header .links a {
  margin-right: 20px;
  font-size: 0.9rem;
}

/* Section */
section {
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
}

section:last-child {
  border-bottom: none;
}

section h2 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gray);
  margin-bottom: 30px;
}

/* Experience */
.experience-item {
  margin-bottom: 36px;
}

.experience-item:last-child {
  margin-bottom: 0;
}

.experience-item .company {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.experience-item .role {
  color: var(--gray);
  margin-bottom: 4px;
}

.experience-item .period {
  font-size: 0.9rem;
  color: var(--gray);
  margin-bottom: 12px;
}

.experience-item .description {
  color: var(--black);
}

/* Posts */
.post-item {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.post-item .post-title {
  font-size: 1.1rem;
}

.post-item .post-date {
  font-size: 0.85rem;
  color: var(--gray);
  flex-shrink: 0;
  margin-left: 20px;
}

/* Footer */
footer {
  padding: 40px 0;
  text-align: center;
  color: var(--gray);
  font-size: 0.85rem;
}

/* Post Page */
.post-header {
  padding: 60px 0 30px;
}

.post-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.post-header .date {
  color: var(--gray);
  font-size: 0.9rem;
}

.post-content {
  padding: 30px 0;
}

.post-content h1, .post-content h2, .post-content h3 {
  margin: 30px 0 15px;
  font-weight: 600;
}

.post-content p {
  margin-bottom: 20px;
}

.post-content code {
  background: var(--light-gray);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

.post-content pre {
  background: var(--black);
  color: var(--white);
  padding: 20px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 20px 0;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* Admin Styles */
.admin-header {
  background: var(--black);
  color: var(--white);
  padding: 20px 0;
}

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

.admin-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

.admin-header a {
  color: var(--white);
  border-color: rgba(255,255,255,0.3);
}

.admin-nav {
  border-bottom: 1px solid var(--border);
  padding: 15px 0;
}

.admin-nav a {
  margin-right: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid transparent;
}

.admin-nav a.active {
  border-bottom-color: var(--black);
}

.admin-section {
  padding: 30px 0;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--black);
}

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

.btn {
  display: inline-block;
  padding: 12px 24px;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.8;
}

.btn-outline {
  background: transparent;
  color: var(--black);
  border: 1px solid var(--border);
}

.btn-danger {
  background: #dc3545;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.card-title {
  font-weight: 600;
}

.card-actions button {
  margin-left: 8px;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 100%;
  max-width: 360px;
  padding: 40px;
}

.login-box h1 {
  font-size: 1.5rem;
  margin-bottom: 30px;
  text-align: center;
}

.alert {
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.alert-error {
  background: #fee;
  color: #c00;
}

.alert-success {
  background: #efe;
  color: #060;
}

/* Skills */
.skills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-tag {
  display: inline-block;
  padding: 8px 16px;
  background: var(--light-gray);
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.2s;
}

.skill-tag:hover {
  background: var(--text);
  color: var(--bg);
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  background: var(--light-gray);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  font-size: 0.85rem;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-caption {
  color: white;
  margin-top: 15px;
  font-size: 1rem;
  text-align: center;
}

/* Admin image upload */
.image-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  margin: 15px 0;
  cursor: pointer;
  transition: border-color 0.2s;
}

.image-upload-zone:hover {
  border-color: var(--gray);
}

.image-upload-zone.dragover {
  border-color: var(--black);
  background: var(--light-gray);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.image-grid-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 6px;
  overflow: hidden;
  background: var(--light-gray);
}

.image-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-grid-item .delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 24px;
}

.image-grid-item .delete-btn:hover {
  background: #dc3545;
}

/* Responsive */
@media (max-width: 600px) {
  header h1 {
    font-size: 2rem;
  }
  
  .post-item {
    flex-direction: column;
  }
  
  .post-item .post-date {
    margin-left: 0;
    margin-top: 4px;
  }
  
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
