/*
Theme Name: Canva Codes
Version: 1.0.0
*/

/* ---------------------------
   0) Base Reset + Typography
---------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-main);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
button, input { font: inherit; }

/* ---------------------------
   1) Theme Variables
---------------------------- */
:root{
  --bg: #0b0b0f;
  --card: #141421;
  --text-main: #ffffff;
  --text-meta: rgba(255,255,255,.7);
  --accent: #6d28d9;
  --border: rgba(255,255,255,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.20);
}

body[data-theme="light"]{
  --bg: #ffffff;
  --card: #ffffff;
  --text-main: #111827;
  --text-meta: rgba(17,24,39,.65);
  --accent: #6d28d9;
  --border: rgba(17,24,39,.12);
  --shadow: 0 12px 30px rgba(17,24,39,.12);
}

body[data-theme="dark"]{
  background: var(--bg);
  color: var(--text-main);
}

/* ---------------------------
   2) Layout Containers
---------------------------- */
.container{
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 18px;
}

.main-wrapper{
  padding: 18px 0 40px;
}

/* ---------------------------
   3) Header / Nav
---------------------------- */
.site-header{
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 0;
  gap: 16px;
}

.logo a{
  color: var(--text-main);
  font-weight: 900;
  letter-spacing: .2px;
  font-size: 18px;
}

.nav-menu ul{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  align-items:center;
  gap: 14px;
}

.nav-menu a{
  color: var(--text-main);
  opacity:.9;
  font-weight: 600;
  font-size: 14px;
}

.nav-menu a:hover{ opacity: 1; }

.header-actions{
  display:flex;
  align-items:center;
  gap: 10px;
}

.icon-btn{
  border:1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.icon-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.06);
}
body[data-theme="light"] .icon-btn:hover{
  background: rgba(17,24,39,.04);
}

/* ---------------------------
   4) Hero
---------------------------- */
.hero-section{
  padding: 28px 0 10px;
}
.hero-title{
  margin: 0;
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1.2;
}
.hero-subtitle{
  margin: 8px 0 0;
  color: var(--text-meta);
  max-width: 70ch;
}

/* ---------------------------
   5) Grid Cards
---------------------------- */
.items-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 18px 0 10px;
  align-items: stretch;
}

.grid-card{
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.grid-card > a{
  display:flex;
  flex-direction: column;
  position: relative;
  flex: 1;
}

.grid-thumb{
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: rgba(255,255,255,.06);
}

.grid-info{
  padding: 12px 12px 10px;
}

.grid-title{
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text-main);
  font-weight: 800;
}

.grid-meta{
  display:flex;
  justify-content:space-between;
  color: var(--text-meta);
  font-size: 12px;
}

/* Badges */
.badge{
  position:absolute;
  top: 10px;
  left: 10px;
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 999px;
  color:#fff;
  font-weight: 900;
  letter-spacing: .3px;
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
}
.badge-pro{ background:#ef4444; }
.badge-free{ background:#10b981; }

/* Copy Button */
.grid-copy-btn{
  width: calc(100% - 16px);
  margin: 0 8px 12px;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 11px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
  transition: transform .12s ease, opacity .12s ease;
}
.grid-copy-btn:hover{ transform: translateY(-1px); }
.grid-copy-btn:disabled{ opacity:.6; cursor:not-allowed; transform:none; }

/* ---------------------------
   6) Pagination
---------------------------- */
.blog-pager{
  display:flex;
  justify-content:center;
  padding: 16px 0 28px;
}

.blog-pager .nav-links{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
}

.blog-pager a, .blog-pager span{
  border:1px solid var(--border);
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration:none;
  color: var(--text-main);
  font-weight: 700;
  background: transparent;
}

.blog-pager .current{
  background: var(--accent);
  color:#fff;
  border-color: var(--accent);
}

/* ---------------------------
   7) Footer
---------------------------- */
.site-footer{
  border-top: 1px solid var(--border);
  padding: 26px 0;
  margin-top: 22px;
  background: var(--bg);
}

.footer-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  align-items: start;
}

.footer-col h3{
  margin: 0 0 10px;
  font-weight: 900;
}

.footer-col p{
  margin: 0;
  color: var(--text-meta);
}

.site-footer ul{
  list-style:none;
  margin:0;
  padding:0;
}
.site-footer a{
  color: var(--text-main);
  opacity: .9;
  font-weight: 700;
}
.site-footer a:hover{ opacity: 1; }

.copyright{
  margin-top: 18px;
  color: var(--text-meta);
  font-size: 13px;
}

/* ---------------------------
   8) Native Ad Card
---------------------------- */
.cc-native-ad{
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
}
.cc-native-inner{
  padding: 18px;
  width: 100%;
}
.cc-sponsored-label{
  font-size: 12px;
  color: var(--text-meta);
  display:block;
  margin-bottom: 8px;
}

/* ---------------------------
   9) Toast
---------------------------- */
#toast-notification{
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  font-weight: 900;
}

/* ---------------------------
   10) Search Overlay
---------------------------- */
#search-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#search-overlay form{
  width: min(520px, 100%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.search-input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  outline: none;
}

.search-input:focus{
  border-color: rgba(109,40,217,.55);
  box-shadow: 0 0 0 3px rgba(109,40,217,.18);
}

.search-close-btn{
  margin-top: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  font-weight: 800;
}

/* ---------------------------
   11) Single Post
---------------------------- */
.single-title{
  text-align: center;
  font-size: clamp(22px, 2vw, 34px);
  margin: 0 0 12px;
  font-weight: 900;
}

.single-badges{
  display:flex;
  justify-content:center;
  gap: 10px;
  margin-bottom: 16px;
}

.breadcrumbs{
  color: var(--text-meta);
  margin-bottom: 14px;
  font-size: 13px;
}
.breadcrumbs a{
  color: var(--text-main);
  opacity: .9;
  font-weight: 700;
}
.crumb-current{ opacity: .8; }

.item-code{
  position: relative;
  max-width: 920px;
  margin: 0 auto 14px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.item-code pre{
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.code-label{
  position:absolute;
  top:-10px;
  right: 10px;
  background: var(--accent);
  color:#fff;
  padding: 2px 8px;
  font-size: 10px;
  border-radius: 8px;
  font-weight: 900;
}

.action-buttons{
  display:flex;
  justify-content:center;
  margin-bottom: 18px;
}

.btn{
  border: 0;
  padding: 11px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
}
.btn-primary{ background: var(--accent); color:#fff; }

.post-body{
  max-width: 920px;
  margin: 0 auto;
  color: var(--text-main);
}
.post-body p{ margin: 0 0 12px; }

/* ---------------------------
   12) Redirect Page
---------------------------- */
.cc-redirect-wrap{ padding: 30px 0; }
.cc-container{ width: min(820px, 100%); margin: 0 auto; padding: 0 16px; }
.cc-redirect-title{ margin: 0 0 8px; font-weight: 900; }
.cc-redirect-sub{ margin: 0 0 16px; color: var(--text-meta); }
.cc-native-ad-block{
  border:1px solid var(--border);
  border-radius:18px;
  padding:16px;
  margin:16px 0;
  background:var(--card);
  box-shadow: var(--shadow);
}
.cc-redirect-actions{ display:flex; gap: 10px; flex-wrap: wrap; }
.cc-btn{
  display:inline-block;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration:none;
  border: 1px solid var(--border);
  font-weight: 900;
}
.cc-btn-primary{ background: var(--accent); color:#fff; border-color: var(--accent); }
.cc-btn-ghost{ color: var(--text-main); }
.cc-redirect-note{ margin-top: 14px; color: var(--text-meta); }

/* ---------------------------
   13) Small screens
---------------------------- */
@media (max-width: 480px){
  .nav-menu{ display:none; }
  .items-grid{ grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
