/*
Theme Name: SWR LAB
Theme URI: https://swr-lab.com/
Author: SWR LAB
Description: Custom child theme for SWR LAB news site (games, tech, articles)
Template: hello-elementor
Version: 1.0.0
Text Domain: swr-lab
*/

:root, :root[data-theme="dark"] {
  --bg: #0e0f10; --bg-elev: #15171a; --bg-soft: #1c1e21;
  --text: #f2f2f2; --text-muted: #9c9c9c; --text-dim: #7a7a7a;
  --border: #1f2125; --border-soft: #25272b;
  --accent: #2ECC71; --accent-text: #0a3a1d;
  --header-bg: #0e0f10;
}
:root[data-theme="light"] {
  --bg: #ffffff; --bg-elev: #fafaf8; --bg-soft: #f3f3f1;
  --text: #111418; --text-muted: #666666; --text-dim: #999999;
  --border: #ececec; --border-soft: #efefef;
  --accent: #2ECC71; --accent-text: #0a3a1d;
  --header-bg: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; line-height: 1.6; transition: background 0.2s, color 0.2s; }
a { color: inherit; text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { color: var(--text); font-weight: 500; }

.swr-container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* Header */
.swr-header { background: var(--header-bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.swr-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; position: relative; }
.swr-logo { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 500; letter-spacing: 0.02em; color: var(--text); }
.swr-logo:hover { color: var(--text); }
.swr-logo img { width: 36px; height: 36px; border-radius: 8px; }

.swr-nav { display: flex; align-items: center; gap: 8px; }
.swr-nav ul.menu, .swr-nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; align-items: center; }
.swr-nav ul.menu > li { position: relative; }
.swr-nav ul.menu > li > a { color: var(--text); font-weight: 400; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; padding: 8px 0; }
.swr-nav ul.menu > li.menu-item-has-children > a::after { content: '\25BE'; font-size: 10px; color: var(--text-muted); margin-left: 2px; }
.swr-nav ul.sub-menu { display: none; position: absolute; top: 100%; left: -14px; min-width: 210px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 0; list-style: none; margin: 0; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
@media (hover: hover) { .swr-nav ul.menu > li:hover > ul.sub-menu, .swr-nav ul.menu > li:focus-within > ul.sub-menu { display: block; } }
.swr-nav ul.sub-menu li a { display: block; padding: 9px 16px; font-size: 14px; color: var(--text); }
.swr-nav ul.sub-menu li a:hover { background: var(--bg-soft); color: var(--accent); }

.swr-header-tools { display: flex; align-items: center; gap: 10px; margin-left: 16px; padding-left: 16px; border-left: 1px solid var(--border); color: var(--text-muted); }
.swr-header-tools button { background: none; border: none; cursor: pointer; color: inherit; font-size: 18px; padding: 6px; display: flex; align-items: center; border-radius: 6px; }
.swr-header-tools button:hover { color: var(--accent); background: var(--bg-soft); }

/* Badges */
.swr-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 500; padding: 4px 9px; border-radius: 4px; letter-spacing: 0.01em; }
.swr-badge.swr-badge-article { background: var(--text); color: var(--bg); }

/* Featured row */
.swr-featured { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 28px 0 8px; }
.swr-featured-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s, border-color 0.15s; }
.swr-featured-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.swr-featured-card .swr-image { height: 170px; background: var(--bg-soft); background-size: cover; background-position: center; position: relative; }
.swr-featured-card .swr-badge { position: absolute; left: 10px; top: 10px; }
.swr-featured-card .swr-marker { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,0.55); color: #ddd; font-size: 10px; padding: 2px 7px; border-radius: 3px; }
:root[data-theme="light"] .swr-featured-card .swr-marker { background: rgba(255,255,255,0.92); color: #444; }
.swr-featured-card .swr-body { padding: 14px 16px 18px; flex: 1; }
.swr-featured-card .swr-card-title { font-size: 15px; font-weight: 500; line-height: 1.35; color: var(--text); margin: 0; }

/* Feed */
.swr-feed-title { font-size: 22px; font-weight: 500; margin: 40px 0 20px; color: var(--text); }
.swr-feed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 40px; }
.swr-feed-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s, border-color 0.15s; }
.swr-feed-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.swr-feed-card .swr-image { height: 220px; background: var(--bg-soft); background-size: cover; background-position: center; position: relative; }
.swr-feed-card .swr-badge { position: absolute; left: 12px; top: 12px; }
.swr-feed-card .swr-body { padding: 16px 18px 14px; flex: 1; display: flex; flex-direction: column; }
.swr-feed-card .swr-card-title { font-size: 17px; font-weight: 500; line-height: 1.35; margin: 0 0 10px; color: var(--text); }
.swr-feed-card .swr-excerpt { font-size: 14px; color: var(--text-muted); line-height: 1.55; margin: 0 0 14px; }
.swr-feed-card .swr-meta { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--text-dim); margin-top: auto; }
.swr-feed-card .swr-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* Single */
.swr-single { max-width: 760px; margin: 0 auto; padding: 32px 0; }
.swr-single-title { font-size: 34px; font-weight: 500; line-height: 1.2; margin: 16px 0 16px; color: var(--text); }
.swr-single-meta { display: flex; gap: 18px; font-size: 13px; color: var(--text-dim); margin-bottom: 28px; align-items: center; flex-wrap: wrap; }
.swr-single-meta span { display: inline-flex; align-items: center; gap: 5px; }
.swr-single-image { width: 100%; border-radius: 10px; margin-bottom: 24px; max-height: 460px; object-fit: cover; }
.swr-single-content { font-size: 17px; line-height: 1.75; color: var(--text); }
.swr-single-content p { margin: 0 0 1.2em; }
.swr-single-content h2 { font-size: 24px; margin: 1.6em 0 0.6em; }
.swr-single-content h3 { font-size: 19px; margin: 1.4em 0 0.5em; }
.swr-single-content a { color: var(--accent); }
.swr-single-content img { border-radius: 10px; margin: 1.2em 0; }
.swr-single-content blockquote { margin: 1.5em 0; padding: 12px 20px; border-left: 3px solid var(--accent); color: var(--text-muted); font-style: italic; }

.swr-archive-title { font-size: 28px; font-weight: 500; margin: 32px 0 24px; color: var(--text); }

/* Footer */
.swr-footer { background: var(--bg-elev); border-top: 1px solid var(--border); padding: 32px 0; margin-top: 60px; color: var(--text-muted); font-size: 13px; }
.swr-footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; align-items: center; }
.swr-footer a { color: var(--text-muted); }
.swr-footer a:hover { color: var(--accent); }

/* Scroll to top */
.swr-scrolltop { position: fixed; right: 24px; bottom: 24px; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-text); border: none; opacity: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 22px; z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,0.25); transition: opacity 0.2s, transform 0.15s; }
:root[data-theme="light"] .swr-scrolltop { background: var(--text); color: var(--bg); }
.swr-scrolltop:hover { transform: translateY(-2px); }
.swr-scrolltop.visible { opacity: 1; pointer-events: auto; }

.swr-mobile-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text); font-size: 26px; padding: 4px; }

@media (max-width: 900px) {
  .swr-featured { grid-template-columns: 1fr; }
  .swr-feed-grid { grid-template-columns: 1fr; }
  .swr-mobile-toggle { display: flex; }
  .swr-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--header-bg); border-bottom: 1px solid var(--border); padding: 16px 24px; flex-direction: column; align-items: stretch; }
  .swr-nav.open { display: flex; }
  .swr-nav ul.menu { flex-direction: column; gap: 8px; align-items: stretch; }
  .swr-nav ul.menu > li > a { padding: 10px 0; }
  .swr-nav ul.sub-menu { display: block; position: static; box-shadow: none; border: none; padding: 4px 0 4px 18px; margin: 0; background: transparent; }
  .swr-header-tools { margin-left: 0; padding-left: 0; border-left: none; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; justify-content: flex-start; }
  .swr-logo { font-size: 18px; }
  .swr-logo img { width: 30px; height: 30px; }
  .swr-single-title { font-size: 26px; }
  .swr-single-content { font-size: 16px; }
}


/* ===== Mobile: submenu collapsed by default, tap to expand ===== */
@media (max-width: 900px) {
  .swr-nav ul.sub-menu { display: none; }
  .swr-nav ul.menu > li.swr-open > ul.sub-menu { display: block; }
  .swr-nav ul.menu > li.menu-item-has-children > a {
    justify-content: space-between;
    width: 100%;
  }
  .swr-nav ul.menu > li.menu-item-has-children > a::after {
    transition: transform 0.2s;
    margin-left: auto;
    font-size: 12px;
  }
  .swr-nav ul.menu > li.swr-open > a::after {
    transform: rotate(180deg);
  }
}


/* Visually hidden — accessible to screen readers and search engines, invisible to users */
.swr-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ============================================================
   404 Page
   ============================================================ */
.swr-404 {
  text-align: center;
  padding: 80px 20px;
  max-width: 560px;
  margin: 0 auto;
}
.swr-404-code {
  font-size: 120px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent, #e53e3e);
  margin-bottom: 16px;
}
.swr-404-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 12px;
}
.swr-404-desc {
  font-size: 16px;
  color: var(--color-text-secondary, #888);
  margin: 0 0 32px;
}
.swr-btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent, #e53e3e);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: opacity 0.15s ease;
}
.swr-btn:hover { opacity: 0.85; }
.swr-404-recent {
  margin-top: 48px;
  text-align: left;
}
.swr-404-recent-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-secondary, #888);
  margin: 0 0 12px;
}
.swr-404-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.swr-404-list li {
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
  padding: 10px 0;
}
.swr-404-list li:last-child { border-bottom: none; }
.swr-404-list a {
  font-size: 15px;
  text-decoration: none;
  color: var(--color-text-primary, #fff);
  transition: color 0.15s ease;
}
.swr-404-list a:hover { color: var(--accent, #e53e3e); }
