/* Import Pico.css from CDN */
@import "https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css";

/* Custom styles & Overrides */
:root {
  /* Typography */
  --pico-font-family: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  --pico-font-size: 100%;
  --pico-line-height: 1.6;

  /* Color Palette (Slate/Indigo inspired) */
  --pico-primary: #3b82f6; /* Blue 500 */
  --pico-primary-background: #3b82f6;
  --pico-primary-hover: #2563eb; /* Blue 600 */
  --pico-primary-underline: rgba(59, 130, 246, 0.5);
  
  --pico-border-radius: 12px;
  --pico-form-element-spacing-vertical: 0.5rem;
  --pico-form-element-spacing-horizontal: 1rem;
}

/* Header Styling */
body > header {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  background-color: var(--pico-background-color);
  position: sticky;
  top: 0;
  z-index: 99;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.85); /* Light mode translucent */
}

@media (prefers-color-scheme: dark) {
  body > header {
    background-color: rgba(19, 23, 31, 0.85); /* Dark mode translucent */
  }
}

body > header nav ul li strong a {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--pico-color);
  text-decoration: none;
}

main.container {
  padding-top: 3rem;
  padding-bottom: 4rem;
}



/* View Switcher Controls */
.view-switcher {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0;
  gap: 0.25rem;
}

.view-switcher button {
  padding: 0.5rem;
  font-size: 0.85rem;
  width: auto;
  margin-bottom: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-switcher button svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
}

.view-switcher button.active {
  background-color: var(--pico-primary);
  color: var(--pico-primary-inverse);
  border-color: var(--pico-primary);
}

/* Post List Container */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Common Article Styles */
article.post-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background-color: var(--pico-card-background-color);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

article.post-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* List View Styles */
.post-list.list-view article.post-item {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  align-items: flex-start;
  padding: 1.5rem;
}

@media (max-width: 768px) {
  .post-list.list-view article.post-item {
    flex-direction: column;
    gap: 1rem;
  }
  .post-list.list-view .post-featured-image {
    width: 100% !important;
    height: 200px !important;
  }
}

.post-list.list-view .post-featured-image {
  display: block;
  flex-shrink: 0;
  width: 240px;
  height: 150px;
  overflow: hidden;
  border-radius: var(--pico-border-radius);
  background-color: var(--pico-secondary-background);
}

.post-list.list-view .post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-list.list-view .post-content-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0; /* Prevent flex child overflow */
  overflow-wrap: break-word; /* Ensure long text wraps */
}

.post-list.list-view .post-excerpt {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

/* Grid View Styles */
.post-list.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.post-list.grid-view article.post-item {
  height: 100%;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: none;
}

.post-list.grid-view .post-content-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-list.grid-view article header {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding: 0 1.5rem;
}

.post-list.grid-view article h3 {
  margin-top: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
}

.post-list.grid-view article h3 a {
  text-decoration: underline;
  color: var(--pico-h1-color);
}

.post-list.grid-view article h3 a:hover {
  color: var(--pico-primary);
}

.post-list.grid-view article .post-excerpt {
  padding: 0 1.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--pico-muted-color);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-list.grid-view article footer {
  padding: 1rem 1.5rem 1.5rem;
  margin-top: auto;
  background-color: transparent;
}

.post-list.grid-view .post-featured-image {
  display: block;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background-color: var(--pico-secondary-background);
}

.post-list.grid-view .post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-list.grid-view article:hover .post-featured-image img {
  transform: scale(1.05);
}

/* Pagination */
#pagination button {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

#pagination button.outline {
  border: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color);
}

#pagination button:not(.outline) {
  background-color: var(--pico-primary);
  border-color: var(--pico-primary);
  color: white;
}

/* Theme Switcher Active State */
[data-theme-switcher][aria-current="true"] {
  font-weight: bold;
  color: var(--pico-primary);
  position: relative;
}

[data-theme-switcher][aria-current="true"]::before {
  content: "✓";
  position: absolute;
  left: -1.25rem;
  font-weight: bold;
}

[dir="rtl"] [data-theme-switcher][aria-current="true"]::before {
  left: auto;
  right: -1.25rem;
}
