/* 
 * PoetrySad Theme - Main CSS
 * Complete standalone stylesheet matching the exact visual design, typography, colors, and layout.
 */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,500&family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap');

/* CSS Variables */
:root {
  --bg-primary: #FAF7F2;
  --bg-secondary: #F5F1E9;
  --bg-card: #FFFFFF;
  --bg-dark: #1C1818;
  --bg-dark-quote: #241F1F;
  --text-main: #242120;
  --text-body: #57514E;
  --text-muted: #8C847E;
  --text-light: #FAF7F2;
  --accent-burgundy: #781D2E;
  --accent-burgundy-hover: #5E1422;
  --accent-burgundy-light: rgba(120, 29, 46, 0.08);
  --border-subtle: #EADBCE;
  --border-light: #E5DDD0;
  --border-dark: #332C2B;
  --font-serif: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  --font-poem: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset & Global Defaults */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1 0 auto;
}

/* Typography Utility Classes */
.font-serif {
  font-family: var(--font-serif);
}

.font-poem {
  font-family: var(--font-poem);
}

.font-sans {
  font-family: var(--font-sans);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Layout Utilities */
.container,
.max-w-7xl {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container, .max-w-7xl {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container, .max-w-7xl {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.max-w-6xl { max-width: 72rem; margin-left: auto; margin-right: auto; }
.max-w-5xl { max-width: 64rem; margin-left: auto; margin-right: auto; }
.max-w-4xl { max-width: 56rem; margin-left: auto; margin-right: auto; }
.max-w-3xl { max-width: 48rem; margin-left: auto; margin-right: auto; }
.max-w-2xl { max-width: 42rem; }
.max-w-xl { max-width: 36rem; }
.max-w-lg { max-width: 32rem; }
.max-w-md { max-width: 28rem; }

/* Grid Systems */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .lg\:col-span-4 { grid-column: span 4 / span 4; }
  .lg\:col-span-5 { grid-column: span 5 / span 5; }
  .lg\:col-span-7 { grid-column: span 7 / span 7; }
  .lg\:col-span-8 { grid-column: span 8 / span 8; }
}

.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }
.gap-16 { gap: 4rem; }

/* Flexbox Utilities */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.shrink-0 { flex-shrink: 0; }
.flex-1 { flex: 1 1 0%; }

/* Spacing */
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.p-12 { padding: 3rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-7 { padding-left: 1.75rem; padding-right: 1.75rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-3\.5 { padding-top: 0.875rem; padding-bottom: 0.875rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }
.py-32 { padding-top: 8rem; padding-bottom: 8rem; }
.pt-16 { padding-top: 4rem; }
.pb-12 { padding-bottom: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mb-14 { margin-bottom: 3.5rem; }
.mb-16 { margin-bottom: 4rem; }
.mb-20 { margin-bottom: 5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }

/* Borders & Rounded */
.border { border-width: 1px; border-style: solid; border-color: var(--border-subtle); }
.border-t { border-top-width: 1px; border-top-style: solid; border-top-color: var(--border-subtle); }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: var(--border-subtle); }
.border-l { border-left-width: 1px; border-left-style: solid; border-left-color: var(--border-subtle); }
.border-r { border-right-width: 1px; border-right-style: solid; border-right-color: var(--border-subtle); }
.rounded-none { border-radius: 0; }
.rounded-xs { border-radius: 0.125rem; }
.rounded-sm { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }

/* Colors */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-white { background-color: #ffffff; }
.bg-dark { background-color: var(--bg-dark); }
.bg-burgundy { background-color: var(--accent-burgundy); }
.text-main { color: var(--text-main); }
.text-body { color: var(--text-body); }
.text-muted { color: var(--text-muted); }
.text-white { color: #ffffff; }
.text-burgundy { color: var(--accent-burgundy); }

/* Buttons */
.btn-burgundy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--accent-burgundy);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.625rem 1.25rem;
  border-radius: 0.125rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

.btn-burgundy:hover {
  background-color: var(--accent-burgundy-hover);
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-burgundy:active {
  transform: scale(0.98);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid #D5CCC0;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1.75rem;
  border-radius: 0.125rem;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background-color: #F6F2EB;
  border-color: var(--text-main);
}

/* Header & Sticky Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgba(250, 247, 242, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}

.site-header.is-scrolled {
  background-color: rgba(250, 247, 242, 0.98);
  border-bottom-color: var(--border-light);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.site-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  transition: height 0.3s ease;
}

.site-header.is-scrolled .header-inner {
  height: 66px;
}

/* Nav Links */
.nav-link {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.025em;
  color: #504A47;
  padding: 0.25rem 0;
  position: relative;
  transition: color 0.2s ease;
  white-space: nowrap;
}

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

.nav-link.is-active,
.current-menu-item > .nav-link {
  color: var(--accent-burgundy);
  font-weight: 600;
}

.nav-link.is-active::after,
.current-menu-item > .nav-link::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 1.5px;
  background-color: var(--accent-burgundy);
  border-radius: 9999px;
}

/* Mobile Drawer */
.mobile-nav-drawer {
  display: none;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-primary);
  padding: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.mobile-nav-drawer.is-open {
  display: block;
  animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Poetry Card */
.poetry-card {
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0.125rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
  text-align: left;
}

@media (min-width: 640px) {
  .poetry-card { padding: 1.75rem; }
}

.poetry-card:hover {
  border-color: #CBBFB2;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

.poetry-card-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.25;
  transition: color 0.2s ease;
}

.poetry-card:hover .poetry-card-title {
  color: var(--accent-burgundy);
}

.poetry-card-excerpt {
  font-family: var(--font-poem);
  font-size: 1rem;
  color: var(--text-body);
  font-style: italic;
  line-height: 1.6;
  margin-top: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Category Card */
.category-card {
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0.125rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
  text-align: left;
}

.category-card:hover {
  border-color: #CBBFB2;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

.category-card-img-wrap {
  aspect-ratio: 16 / 10;
  width: 100%;
  position: relative;
  overflow: hidden;
  background-color: #EFECE6;
}

.category-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.category-card:hover .category-card-img-wrap img {
  transform: scale(1.05);
}

/* Poet Card */
.poet-card {
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 0.125rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
}

@media (min-width: 640px) {
  .poet-card { padding: 1.75rem; }
}

.poet-card:hover {
  border-color: #CBBFB2;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

.poet-avatar-wrap {
  width: 6rem;
  height: 6rem;
  border-radius: 9999px;
  overflow: hidden;
  padding: 0.25rem;
  border: 2px solid var(--border-subtle);
  transition: border-color 0.2s ease;
  margin-bottom: 1rem;
}

.poet-card:hover .poet-avatar-wrap {
  border-color: var(--accent-burgundy);
}

.poet-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.poet-card:hover .poet-avatar-wrap img {
  transform: scale(1.05);
}

/* Search Modal */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(30, 25, 25, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 3rem;
  overflow-y: auto;
}

.search-modal-backdrop.is-open {
  display: flex;
}

.search-modal-box {
  background-color: var(--bg-primary);
  border: 1px solid #D5CCC0;
  border-radius: 0.125rem;
  width: 100%;
  max-width: 42rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
  text-align: left;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Toast Notification */
.poetrysad-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 60;
  background-color: var(--bg-dark);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.poetrysad-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Single Poem Reading View */
.poem-reading-container {
  max-width: 46rem;
  margin-left: auto;
  margin-right: auto;
  padding: 3rem 1.5rem 5rem;
  text-align: center;
}

.poem-stanzas {
  font-family: var(--font-poem);
  color: var(--text-main);
  line-height: 2;
  letter-spacing: 0.01em;
  margin: 3rem 0;
}

.poem-stanzas.size-sm { font-size: 1.125rem; }
.poem-stanzas.size-md { font-size: 1.375rem; }
.poem-stanzas.size-lg { font-size: 1.625rem; }
.poem-stanzas.size-xl { font-size: 1.875rem; }

.poem-stanzas p {
  margin-bottom: 1.75rem;
}

/* Responsive Hide/Show Helpers */
.hidden { display: none !important; }
@media (max-width: 1023px) {
  .lg\:hidden { display: block; }
  .hidden.lg\:flex { display: none; }
}
@media (min-width: 1024px) {
  .lg\:hidden { display: none !important; }
  .lg\:flex { display: flex !important; }
  .lg\:block { display: block !important; }
}
@media (min-width: 640px) {
  .sm\:flex { display: flex !important; }
  .sm\:block { display: block !important; }
  .sm\:inline-block { display: inline-block !important; }
}

/* Footer Styling */
.site-footer {
  background-color: var(--bg-dark);
  color: #D8D0C8;
  border-top: 1px solid var(--border-dark);
  padding-top: 4rem;
  padding-bottom: 3rem;
  margin-top: auto;
}
