/*
Theme Name: Spiderpasianssi
Theme URI: https://spiderpasianssi.fi/
Author: Sakke
Author URI: https://spiderpasianssi.fi/
Description: Suomen paras Spider-pasianssi — kolme vaikeustasoa, ei mainoksia. Itsenäinen teema perustuen pasianssipeli.fi:n toimivaan spider-peliin.
Version: 1.1.4
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: Proprietary
Text Domain: spiderpasianssi
*/

/* ===== BRÄNDIN VÄRIT — override game-base.css:n :root arvoihin ===== */
:root {
  --felt: #0f3d2e !important;           /* Metsävihreä */
  --gold: #f0c040 !important;           /* Kultainen */
}

/* Override game-base.css:n body-tausta kun käytetään hämähäkkiverkko-taustaa */
body {
  background: #0f3d2e !important;
  background-image: url('assets/images/bg-spider-web.png') !important;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

/* Tiivis sivun otsikko (pelin yläpuolella) */
.sp-page-header {
  text-align: center;
  padding: 18px 20px 14px;
  color: #fff;
}
.sp-page-header h1 {
  font-family: 'Righteous', cursive;
  font-size: clamp(22px, 3.5vw, 32px);
  color: var(--gold);
  margin-bottom: 4px;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  line-height: 1.2;
}
.sp-page-header .sp-subtitle {
  font-size: clamp(13px, 1.8vw, 15px);
  color: rgba(255,255,255,0.7);
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.2px;
}
@media (max-width: 600px) {
  .sp-page-header {
    padding: 12px 16px 10px;
  }
}

/* Sääntö-sivu (ei pelialuetta) */
.sp-article {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  color: rgba(255,255,255,0.92);
  font-size: 16px;
  line-height: 1.75;
}
.sp-article h1 {
  font-family: 'Righteous', cursive;
  font-size: clamp(28px, 5vw, 48px);
  color: var(--gold);
  margin-bottom: 18px;
  text-align: center;
}
.sp-article h2 {
  font-family: 'Righteous', cursive;
  font-size: clamp(20px, 3vw, 28px);
  color: var(--gold);
  margin: 28px 0 12px;
}
.sp-article h3 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin: 20px 0 8px;
}
.sp-article p, .sp-article li {
  margin-bottom: 12px;
}
.sp-article ul, .sp-article ol {
  padding-left: 24px;
  margin-bottom: 16px;
}
.sp-article strong {
  color: #fff;
}
.sp-article a {
  color: var(--gold);
  text-decoration: underline;
}
.sp-article .faq details {
  background: rgba(255,255,255,0.05);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(240,192,64,0.15);
}
.sp-article .faq summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--gold);
  font-size: 16px;
}
.sp-article .faq summary:hover {
  color: #fff;
}

/* Skip-link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus {
  left: 10px;
  top: 10px;
  background: var(--gold);
  color: #0f3d2e;
  padding: 10px 16px;
  border-radius: 6px;
  z-index: 999;
}

/* Pelitoimintopalkki (toolbar) */
.sp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px 16px;
  margin: 0 auto 8px;
  max-width: 1200px;
}
.sp-tb-btn {
  background: rgba(0,0,0,0.35);
  color: #fff;
  border: 1px solid rgba(240,192,64,0.35);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.sp-tb-btn:hover:not(:disabled) {
  background: rgba(240,192,64,0.18);
  border-color: var(--gold);
  color: #fff;
}
.sp-tb-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.sp-tb-btn.sp-tb-primary {
  background: var(--gold);
  color: #0f3d2e;
  border-color: var(--gold);
  font-weight: 600;
}
.sp-tb-btn.sp-tb-primary:hover:not(:disabled) {
  background: #ffd558;
}
@media (max-width: 600px) {
  .sp-toolbar { gap: 6px; padding: 8px; }
  .sp-tb-btn { padding: 8px 12px; font-size: 13px; }
}

/* ===== ETUSIVU/LANDING NAV OVERRIDE ===== */
#site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,61,46,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(240,192,64,0.2);
}

/* Override v119:n #page-wrapper joka olettaa fixed-nav:ia — meillä nav on sticky */
#page-wrapper {
  padding-top: 0 !important;
  min-height: auto !important;
  margin: 0 auto 40px !important;
}
#game {
  min-height: auto !important;
  overflow: visible !important;
  padding: 14px 10px 28px !important;
  flex: 0 0 auto !important;
  /* Pelialue erottuu kevyesti muusta sisällöstä */
  background: rgba(0, 0, 0, 0.08) !important;
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.15);
}
#game::before,
#game::after {
  /* Piilota v119:n koristetut tausta-efektit — aiheuttavat layout-ongelmia */
  display: none !important;
}
#game-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  flex: 0 0 auto !important;
}
/* Tableau ei saa venyttää loputtomasti */
#tableau-row {
  flex: 0 0 auto !important;
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}
.nav-brand:hover { color: var(--gold); }
.brand-text {
  font-family: 'Righteous', cursive;
  color: var(--gold);
  letter-spacing: 0.3px;
}
.nav-links {
  display: flex;
  gap: 18px;
  margin-left: auto;
}
.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-links a:hover {
  color: var(--gold);
  background: rgba(240,192,64,0.1);
}
.nav-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 6px;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}
.nav-menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}
@media (max-width: 640px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(15,61,46,0.98);
    border-bottom: 1px solid rgba(240,192,64,0.2);
    padding: 8px 0;
    display: none;
  }
  .nav-links.mobile-open { display: flex; }
  .nav-links a {
    padding: 12px 20px;
    border-radius: 0;
  }
  .nav-menu-toggle { display: flex; }
}

/* ===== FOOTER ===== */
#site-footer {
  margin-top: 60px;
  background: rgba(0,0,0,0.4);
  padding: 40px 20px 20px;
  border-top: 1px solid rgba(240,192,64,0.2);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
}
.footer-col h3 {
  color: var(--gold);
  font-family: 'Righteous', cursive;
  font-size: 16px;
  margin-bottom: 10px;
}
.footer-col ul {
  list-style: none;
  padding: 0;
}
.footer-col li {
  margin-bottom: 6px;
}
.footer-col a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px;
}
.footer-col a:hover { color: var(--gold); }
.footer-bottom {
  max-width: 1200px;
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
}

/* ===== KORTINSELKÄ-PICKER ===== */
#cb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

#cb-dialog {
  background: linear-gradient(160deg, #164a37 0%, #0a2d1f 100%);
  border: 2px solid #f0c040;
  border-radius: 18px;
  padding: 28px 28px 24px;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow-y: auto;
  color: #fff;
  box-shadow:
    0 20px 60px rgba(0,0,0,.7),
    0 0 40px rgba(240,192,64,0.15);
}

#cb-dialog h2 {
  font-family: 'Righteous', cursive;
  color: var(--gold);
  font-size: clamp(20px, 3.5vw, 26px);
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 0.3px;
}

#cb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
  /* Pakota kaikki rivit samankorkuisiksi */
  grid-auto-rows: 1fr;
}

@media (max-width: 480px) {
  #cb-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

.cb-item {
  cursor: pointer;
  text-align: center;
  padding: 10px 8px 12px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.08);
  transition: all 0.2s;
  background: rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cb-item:hover {
  border-color: rgba(240,192,64,0.4);
  background: rgba(240,192,64,0.06);
  transform: translateY(-2px);
}
.cb-item.cb-active {
  border-color: var(--gold);
  background: rgba(240,192,64,0.12);
  box-shadow: 0 0 20px rgba(240,192,64,0.2);
}

.cb-preview {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  border: 2px solid;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  /* KRIITTINEN: background tulee inline-tyylistä, älä override */
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  box-sizing: border-box;
}

.cb-label {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.2px;
  line-height: 1.3;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#cb-close {
  display: block;
  margin: 0 auto;
  background: var(--gold);
  color: #0f3d2e;
  border: none;
  padding: 12px 40px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: all 0.15s;
}
#cb-close:hover {
  background: #ffd558;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(240,192,64,0.35);
}
