/* Fairytale Collection — Custom Styles */

/* Site-wide Literata font */
:root {
  --pico-font-family: 'Literata', Georgia, 'Times New Roman', serif;
  --pico-font-size: 16px;
}
body {
  font-family: 'Literata', Georgia, 'Times New Roman', serif;
}
h1, h2, h3, h4, h5, h6 {
  font-family: 'Literata', Georgia, serif;
}

/* Brand logo + name */
.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.brand-link strong {
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.brand-icon {
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
}
.brand-link:hover .brand-icon {
  opacity: 1;
  transform: scale(1.05);
}

/* Nav Literata consistency */
nav {
  font-family: 'Literata', Georgia, serif;
}
nav a {
  font-weight: 500;
}

.portrait-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.portrait-grid a {
  text-align: center;
  text-decoration: none;
  display: block;
}

.portrait-grid img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.2s;
}

.portrait-grid img:hover {
  transform: scale(1.03);
}

.portrait-grid small, .portrait-grid span {
  display: block;
  margin-top: 0.3rem;
  text-transform: capitalize;
  font-size: 0.85rem;
}

.portrait-full {
  width: 100%;
  max-width: 500px;
  border-radius: 8px;
}

.portrait-card {
  text-decoration: none;
}

.author-card {
  text-decoration: none;
}

/* Fix Pico .grid putting all cards in one row */
.grid.author-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
}
.author-grid .author-card article {
  padding: 0.5rem 0.8rem;
  margin: 0;
  border: none;
  box-shadow: none;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
}
.author-grid .author-card article header {
  padding: 0;
  margin: 0 0 0.2rem;
  border: none;
  background: none;
}
.author-grid .author-card article p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

.story-content {
  line-height: 1.8;
  max-width: 70ch;
}

.story-content h1, .story-content h2, .story-content h3 {
  margin-top: 2rem;
}

.error {
  color: var(--pico-del-color, #c62828);
}

.overflow-auto {
  overflow-x: auto;
}

nav[aria-label="breadcrumb"] ul {
  padding: 0;
  list-style: none;
  display: flex;
  gap: 0.5rem;
}

nav[aria-label="breadcrumb"] ul li:not(:last-child)::after {
  content: " / ";
  margin-left: 0.5rem;
  opacity: 0.5;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
}

footer.container {
  margin-top: 3rem;
  padding: 1rem 0;
  text-align: center;
  opacity: 0.6;
}

/* Story Flat View — header */
.story-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.story-header h1 {
  margin-bottom: 0;
}
.story-header .story-count {
  opacity: 0.6;
  font-size: 0.95rem;
  white-space: nowrap;
}

/* Story Flat View — compact filter bar */
.story-filters {
  margin-bottom: 1.5rem;
}
.story-filters .filter-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: nowrap;
}
.story-filters .filter-search {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}
.story-filters .filter-author {
  flex: 0 1 180px;
  min-width: 100px;
  margin-bottom: 0;
}
.story-filters .filter-btn {
  flex: 0 0 auto;
  margin-bottom: 0;
  white-space: nowrap;
  --pico-box-shadow: none;
  box-shadow: none !important;
  outline: none !important;
}
.story-filters .filter-btn:focus,
.story-filters .filter-btn:active {
  --pico-box-shadow: none;
  box-shadow: none !important;
  outline: none !important;
}
.story-filters .filter-clear {
  flex: 0 0 auto;
  margin-bottom: 0;
  white-space: nowrap;
  font-size: 0.85rem;
}

/* Autocomplete dropdown */
.autocomplete-wrap {
  position: relative;
  flex: 0 1 180px;
  min-width: 100px;
}
.autocomplete-wrap input {
  width: 100%;
  margin-bottom: 0;
}
.autocomplete-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  background: var(--pico-card-background-color, #1a1a2e);
  border: 1px solid var(--pico-muted-border-color, #333);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.autocomplete-list.open {
  display: block;
}
.autocomplete-list li {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
}
.autocomplete-list li:hover,
.autocomplete-list li.active {
  background: var(--pico-primary-focus, rgba(99,102,241,0.2));
}
.autocomplete-list li .ac-count {
  opacity: 0.5;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}
