/* =========================================================
   Stardew Valley Wiki — lightweight base
   (replaces flatsome.css + WP globals; hand-authored)
   ========================================================= */

:root {
  --primary-color: #077bea;
  --secondary-color: #8b4513;
  --success-color: #2e8b57;
  --alert-color: #af1717;
  --link-color: #077bea;
  --link-hover: #2e8b57;
  --text-color: #202122;
  --header-bg: #ffffff;
  --header-bottom-bg: #fbf9f8;
  --footer-bg: #2e8b57;
  --content-max: 1140px;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--footer-bg);
  background-image: url('/images/bg.jpg');
  background-attachment: fixed;
  background-size: cover;
}
img { max-width: 100%; height: auto; }
h1, h2, h3, h4, h5, h6 { color: var(--text-color); line-height: 1.25; }
a { color: var(--link-color); text-decoration: none; }
a:hover { color: var(--link-hover); }
/* content links underline by class, so they're consistent regardless of container
   (the intro sits in .wiki-lead, a sibling of .main-content, for the infobox grid) */
.wiki-link { text-decoration: underline; }

/* ---- page frame ---- */
.site-wrap { max-width: 1200px; margin: 0 auto; background: #fff; box-shadow: 0 0 20px rgba(0,0,0,.25); }
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 15px; }

/* ---- header ---- */
.site-header { background: var(--header-bg); border-bottom: 1px solid #ececec; position: relative; }
.header-inner {
  max-width: var(--content-max); margin: 0 auto; padding: 0 15px;
  display: flex; align-items: center; justify-content: space-between; min-height: 80px;
}
.site-logo { display: flex; align-items: center; padding: 12px 0; }
.site-logo img { display: block; max-height: 56px; width: auto; }
.main-nav ul { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.main-nav > ul > li { position: relative; }
.main-nav a { display: block; padding: 10px 14px; color: var(--text-color); font-weight: 400; }
.main-nav a:hover, .main-nav li.active > a { color: var(--success-color); }
.main-nav .has-dropdown > a::after { content: " ▾"; font-size: .8em; }

/* dropdown */
.main-nav .dropdown {
  position: absolute; top: 100%; right: 0; z-index: 50;
  display: none; grid-template-columns: repeat(3, 1fr); width: 560px; max-width: 90vw;
  background: #fff; border: 1px solid #e2e2e2; box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: 8px; border-radius: 6px;
}
.main-nav .has-dropdown:hover .dropdown,
.main-nav .has-dropdown:focus-within .dropdown { display: grid; }
.main-nav .dropdown a { font-weight: 400; padding: 8px 12px; border-radius: 4px; }
.main-nav .dropdown a:hover { background: #f4f4f4; }

/* ---- header search ---- */
.header-search { flex: 1 1 auto; max-width: 340px; margin: 0 24px; position: relative; }
.search-form { margin: 0; }
#search-input {
  width: 100%; padding: 9px 14px; font-size: 15px;
  border: 1px solid #ccc; border-radius: 20px; background: #fff; color: var(--text-color);
  outline: none;
}
#search-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(7,123,234,.15); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 300;
  background: #fff; border: 1px solid #ddd; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 70vh; overflow-y: auto;
}
.search-results a {
  display: block; padding: 10px 14px; color: var(--text-color);
  border-bottom: 1px solid #f0f0f0; line-height: 1.3;
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: #f4f6f4; color: var(--success-color); }
.search-results .search-hint { padding: 12px 14px; color: #777; font-size: 14px; }

/* mobile menu toggle — full 44x44 tap target (icon centered) */
.menu-toggle {
  display: none; background: none; border: 0; cursor: pointer; color: var(--text-color);
  width: 44px; height: 44px; padding: 0; align-items: center; justify-content: center; flex: none;
}
.menu-toggle .bars { display: inline-block; width: 22px; height: 2px; background: currentColor; position: relative; }
.menu-toggle .bars::before, .menu-toggle .bars::after { content: ""; position: absolute; left: 0; width: 22px; height: 2px; background: currentColor; }
.menu-toggle .bars::before { top: -7px; } .menu-toggle .bars::after { top: 7px; }

/* mobile drawer */
.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 330px; max-width: 88vw; z-index: 1000;
  background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,.3);
  transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; padding: 20px;
}
.mobile-drawer.open { transform: translateX(0); }
.drawer-close {
  position: absolute; top: 6px; right: 10px; z-index: 1;
  background: none; border: 0; cursor: pointer; padding: 2px 10px;
  font-size: 30px; line-height: 1; color: var(--text-color);
}
.drawer-close:hover { color: var(--success-color); }
.mobile-drawer ul { list-style: none; margin: 0; padding: 0; }
.mobile-drawer > ul { margin-top: 26px; } /* clear the close button */
.mobile-drawer a { display: block; padding: 11px 4px; color: var(--text-color); font-weight: 400; font-size: 16px; border-bottom: 1px solid #eee; }
/* categories as a compact 2-column grid of tappable chips (shorter, all visible) */
.mobile-drawer .children {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 6px;
}
.mobile-drawer .children a {
  text-transform: none; font-weight: 500; font-size: 14px; line-height: 1.25;
  padding: 11px 10px; border: 1px solid #e0d6c4; border-radius: 8px;
  background: #fbf6ee; color: #654321;
}
.mobile-drawer .children a:hover { background: #f3ead9; color: var(--success-color); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; display: none; }
.drawer-backdrop.open { display: block; }

/* ---- main content shell ---- */
/* (#main needs no background — the .site-wrap is already solid white) */
.page-wrapper { padding: 15px 0 50px; }
.content-inner { max-width: var(--content-max); margin: 0 auto; padding: 0 15px; }
.rank-math-breadcrumb { font-size: .95rem; margin-bottom: 10px; }
.rank-math-breadcrumb p { margin: 0; }
.rank-math-breadcrumb .separator { color: #999; }

/* prev / next post nav */
.navigation-post { margin-top: 40px; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }
.next-prev-nav { display: flex; padding: 15px 0; }
.next-prev-nav .nav-prev { flex: 1; text-align: left; }
.next-prev-nav .nav-next { flex: 1; text-align: right; }

/* category footer meta */
.entry-meta { text-align: center; font-size: 1.05rem; margin-top: 30px; color: #333; }

/* ---- footer ---- */
.site-footer { background: var(--footer-bg); color: #f0f0f0; padding: 24px 0; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-inner { max-width: var(--content-max); margin: 0 auto; padding: 0 15px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; align-items: center; }
.footer-nav { list-style: none; display: flex; gap: 16px; margin: 0 0 8px; padding: 0; text-transform: uppercase; font-size: .9rem; }
.footer-disclaimer { font-size: .85rem; max-width: 620px; }
.copyright-footer { font-size: .85rem; }

/* ---- back to top ---- */
.back-to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid #fff;
  background: rgba(0,0,0,.4); color: #fff; font-size: 20px; line-height: 40px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.back-to-top.show { opacity: 1; pointer-events: auto; }

/* ---- custom list bullets (replaces flatsome fl-icons font) ---- */
/* these bullet lists reserve their own left space via the li, so drop the
   browser's default ~40px ul indent that otherwise pushes the marker right */
.wiki-sdw-list { list-style: none; margin: 0; padding-left: 0; }
li.bullet-arrow, li.bullet-checkmark, li.bullet-cross, li.bullet-star {
  list-style: none;
  border-bottom: 1px solid #ececec;
  margin: 0;
  padding: 7px 0 7px 25px;
  position: relative;
}
li.bullet-arrow::before, li.bullet-checkmark::before,
li.bullet-cross::before, li.bullet-star::before {
  position: absolute;
  left: 0;
  top: 7px;
  color: var(--success-color);
  font-size: 16px;
  line-height: inherit;
  font-weight: bold;
}
li.bullet-arrow::before { content: "\203A"; }    /* › */
li.bullet-checkmark::before { content: "\2713"; } /* ✓ */
li.bullet-cross::before { content: "\2715"; }     /* ✕ */
li.bullet-star::before { content: "\2605"; }      /* ★ */

/* ---- make whole grid/subcategory cards clickable, not just the image ---- */
.wiki-post-card, .wiki-subcategory-card { position: relative; }
.wiki-post-title a::after, .wiki-subcategory-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ---- responsive header ---- */
@media (max-width: 849px) {
  .main-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  /* search shown inline between the logo and the burger */
  .header-search { flex: 1 1 auto; max-width: none; margin: 0 8px; }
  #search-input { border-radius: 6px; padding: 8px 12px; }
}


/* ===== original wiki / infobox styles (preserved) ===== */
.wiki-sdw-categories a {
	text-decoration: none !important;
}

.wiki-sdw-categories {
  column-count: 3;     /* 3 columns on desktop */
  column-gap: 20px;    /* space between columns */
}

@media (max-width: 767px) {
  .wiki-sdw-categories {
    column-count: 1;   /* 1 column on mobile */
  }
}

.wiki-sdw-column {
  display: inline-block; /* let them flow like newspaper columns */
  width: 100%;
  margin: 0 0 20px;
  background: #f9f9f9;
  padding: 15px;
  border: 2px solid #8B4513;
  border-radius: 6px;
  box-sizing: border-box;
}

.main-content a {
	text-decoration: underline;
}

.entry-meta.text-center {
	font-size: 1.125rem;
}
.wiki-content p,
.wiki-content li,
.wiki-content ol,
.wiki-content ul {
   font-size: 1.125rem;
}

/* Main title (combines H1 and overview) */
.wiki-main-title {
    font-size: 2rem;
    color: #202122;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid #00000040;
    font-weight: bold;
}
/* Main content area */
.wiki-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}
.main-content {
    flex: 1;
}
/* Stardew Valley Wiki Infobox Styles */
.sdv-infobox {
    width: 320px;
    flex-shrink: 0;
    border: 2px solid #8B4513;
    border-radius: 8px;
    background: linear-gradient(135deg, #F5DEB3 0%, #DEB887 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-size: 15px;
    overflow: hidden;
    height: fit-content;
    position: sticky;
    top: 20px;
}
.sdv-infobox-header {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: white;
    padding: 15px;
    text-align: center;
    border-bottom: 2px solid #654321;
}
.sdv-item-image {
    display: block;
    margin: 0 auto 10px auto;
    border: 2px solid #DDD;
    border-radius: 4px;
    background: white;
    padding: 2px;
}
.sdv-item-name {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
    color: #fff;
}
.sdv-infobox-content {
    padding: 15px;
}
.sdv-info-row {
    display: flex;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(139, 69, 19, 0.2);
}
.sdv-info-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
}
.sdv-label {
    font-weight: bold;
    color: #654321;
    min-width: 90px;
    flex-shrink: 0;
}
.sdv-value {
    color: #333;
    flex-grow: 1;
    padding-left: 10px;
}
/* Main content styling */
.content-section {
    margin-bottom: 30px;
}
.wiki-section-title {
    font-size: 1.5rem;
    color: #202122;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #00000040;
    font-weight: bold;
	  margin-top: 40px;
}


.content-text {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 15px;
}
/* Tables */
.wiki-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.wiki-table th {
    background: linear-gradient(135deg, #2E8B57 0%, #3CB371 100%);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: bold;
}
.wiki-table td {
    padding: 12px;
    border-bottom: 1px solid #F0F0F0;
	  color: #202122;
	  font-size: 1rem;
}
.wiki-table tr:hover {
    background: #F8F9FA;
}
/* Quality stars */
.quality-stars {
    color: #FFD700;
    font-size: 18px;
}
/* Lists */
.wiki-list {
    margin: 15px 0;
    padding-left: 20px;
}
.wiki-list li {
    margin-bottom: 8px;
}
/* Special highlights */
.highlight-box {
    background: #E8F5E8;
    border: 1px solid #2E8B57;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #2E8B57;
}
.tip-box {
    background: #FFF3CD;
    border: 1px solid #FFC107;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #FFC107;
}

/* ============================================
   CATEGORY/ARCHIVE PAGE GRID STYLES (NEW)
   ============================================ */

/* Wiki Posts Grid Layout */
.wiki-posts-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin: 30px 0;
}

/* Individual Post Cards */
.wiki-post-card {
    background: white;
    border: 2px solid #8B4513;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wiki-post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.wiki-card-inner {
    padding: 15px;
    text-align: center;
    background: linear-gradient(135deg, #F5DEB3 0%, #DEB887 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Featured Image Styling */
.wiki-post-image {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}

.wiki-featured-img {
    object-fit: cover;
}

/* Placeholder for posts without images */
.wiki-placeholder-img {
    width: 48px;
    height: 48px;
    background: white;
    border: 2px solid #DDD;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #8B4513;
}

/* Post Content */
.wiki-post-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.wiki-post-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.wiki-post-title a {
    color: #654321;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wiki-post-title a:hover {
    color: #2E8B57;
    text-decoration: none;
}

.wiki-post-excerpt {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    margin: 0 0 10px 0;
    flex-grow: 1;
}

.wiki-post-meta {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(139, 69, 19, 0.2);
}

.wiki-post-category {
    background: #8B4513;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

/* Hide default post classes that might interfere */
.wiki-post-card .entry-header,
.wiki-post-card .entry-content,
.wiki-post-card .entry-footer {
    display: none;
}

/* Pagination Styling */
.flatsome-pagination {
    margin-top: 40px;
    text-align: center;
}

/* ============================================
   SUBCATEGORIES SECTION STYLES (NEW ADDITION)
   ============================================ */

/* Subcategories Section */
.wiki-subcategories {
    margin-bottom: 30px;
    padding: 0 0 30px 0;
}

.wiki-subcategories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 15px;
}

.wiki-subcategory-card {
    background: white;
    border: 2px solid #8B4513;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wiki-subcategory-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.wiki-subcategory-inner {
    padding: 20px;
    background: linear-gradient(135deg, #F5DEB3 0%, #DEB887 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.wiki-subcategory-title {
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1.3;
}

.wiki-subcategory-title a {
    color: #654321;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wiki-subcategory-title a:hover {
    color: #2E8B57;
}

.wiki-subcategory-description {
    margin: 0 0 15px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
    flex-grow: 1;
}

.wiki-subcategory-meta {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 13px;
    color: #777;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(139, 69, 19, 0.2);
}

.wiki-post-count {
    background: #8B4513;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
}

/* Responsive design */
@media (max-width: 1200px) {
    .wiki-posts-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 18px;
    }
}

@media (max-width: 992px) {
    .wiki-posts-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    
    .wiki-card-inner {
        padding: 12px;
    }
    
    .wiki-post-title {
        font-size: 15px;
    }
    
    .wiki-subcategories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
    }
}

@media (max-width: 768px) {
	
    /* Wiki content responsive (existing) */
    .wiki-content {
        flex-direction: column;
        gap: 20px;
    }
    .sdv-infobox {
        width: 100%;
        position: static;
    }
    
    /* Category grid responsive (new) */
    .wiki-posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
    
    .wiki-post-title {
        font-size: 14px;
    }
    
    .wiki-post-excerpt {
        font-size: 12px;
    }
    
    .wiki-subcategories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .wiki-subcategory-inner {
        padding: 16px;
    }
}

@media (max-width: 576px) {
    .wiki-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .wiki-card-inner {
        padding: 10px;
    }
    

    
    .wiki-subcategory-inner {
        padding: 14px;
    }
    
    .wiki-subcategory-title {
        font-size: 1.1rem;
    }
}


/* ============================================================
   Infobox layout — pure CSS (no JS), zero layout shift.
   Desktop: sticky right sidebar. Mobile: dropped in right after
   the intro paragraph. DOM order stays h1 -> article -> infobox
   (SEO-friendly); CSS Grid + flex order handle the visual placement.
   Scoped to .has-infobox so pages without an infobox are untouched.
   Appended after the original wiki styles so it wins the cascade.
   ============================================================ */
.wiki-content.has-infobox {
  display: grid;
  grid-template-columns: 1fr 320px;
  column-gap: 30px;
  row-gap: 0;
  align-items: start;
}
.wiki-content.has-infobox > .wiki-lead    { grid-column: 1; grid-row: 1; margin-bottom: 0; }
.wiki-content.has-infobox > .main-content { grid-column: 1; grid-row: 2; }
.wiki-content.has-infobox > .sdv-infobox  { grid-column: 2; grid-row: 1 / span 2; }

@media (max-width: 768px) {
  .wiki-content.has-infobox {
    display: flex;
    flex-direction: column;
  }
  .wiki-content.has-infobox > .wiki-lead    { order: 1; }
  .wiki-content.has-infobox > .sdv-infobox  { order: 2; }
  .wiki-content.has-infobox > .main-content { order: 3; }
}


/* ============================================================
   Overrides — applied AFTER the original wiki styles so they win.
   ============================================================ */
/* the h1 already has padding-bottom + border; the extra margin-bottom is redundant */
.wiki-main-title { margin-bottom: 0; }
