/* ==========================================================================
   home.css — AlterCPA Home Page
   Standalone. Only the skin accent palette ties to theme.css.
   Hooks into clean class names defined in skin/tpl/home.tpl.
   ========================================================================== */


/* ==========================================================================
   1. TOKENS
   ========================================================================== */
:root {
  color-scheme: light dark;

  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Ubuntu, Cantarell, Roboto, "Helvetica Neue", "Noto Sans", "Open Sans", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", ui-monospace, monospace;

  /* Surfaces — light mode */
  --bg:        #f6f8fb;
  --surface:   #ffffff;
  --surface-2: #f3f5fa;
  --border:    #e6eaf0;
  --border-2:  #d3d9e2;

  --text:        #161e34;
  --text-2:      #4a5573;
  --text-muted:  #6b7790;
  --text-subtle: #9aa3b8;

  /* Semantic — used by news category text-* classes */
  --c-muted:   #6b7790;
  --c-primary: #2563eb;
  --c-info:    #0891b2;
  --c-success: #16a34a;
  --c-warning: #d97706;
  --c-danger:  #dc2626;

  /* Shape */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow:    0 8px 24px -8px rgba(15, 23, 42, .12), 0 3px 8px -3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 44px -14px rgba(15, 23, 42, .22), 0 8px 16px -8px rgba(15, 23, 42, .1);

  /* Easing */
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Default accent (overridden per .skin-*) */
  --accent:        #4a5568;
  --accent-hover:  #2d3748;
  --accent-active: #1a202c;
  --accent-light:  rgba(74, 85, 104, .12);
}

/* Skin accents — same palette as theme.css */
.skin-red,    .skin-red-light    { --accent:#e53e3e; --accent-hover:#c53030; --accent-active:#9b2c2c; --accent-light:rgba(229,62,62,.12); }
.skin-blue,   .skin-blue-light   { --accent:#3182ce; --accent-hover:#2b6cb0; --accent-active:#2c5282; --accent-light:rgba(49,130,206,.12); }
.skin-green,  .skin-green-light  { --accent:#38a169; --accent-hover:#2f855a; --accent-active:#276749; --accent-light:rgba(56,161,105,.12); }
.skin-black,  .skin-black-light  { --accent:#4a5568; --accent-hover:#2d3748; --accent-active:#1a202c; --accent-light:rgba(74,85,104,.12); }
.skin-purple, .skin-purple-light { --accent:#805ad5; --accent-hover:#6b46c1; --accent-active:#553c9a; --accent-light:rgba(128,90,213,.12); }
.skin-yellow, .skin-yellow-light { --accent:#d69e2e; --accent-hover:#b7791f; --accent-active:#975a16; --accent-light:rgba(214,158,46,.12); }
.skin-pink,   .skin-pink-light   { --accent:#d81b60; --accent-hover:#be1656; --accent-active:#a3114a; --accent-light:rgba(216,27,96,.12); }

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0b1120;
    --surface:   #131b2e;
    --surface-2: #1a2238;
    --border:    rgba(255, 255, 255, .08);
    --border-2:  rgba(255, 255, 255, .14);

    --text:        #e7ecf5;
    --text-2:      #c1c9da;
    --text-muted:  #98a3b9;
    --text-subtle: #6c7791;

    --c-muted:   #98a3b9;
    --c-primary: #60a5fa;
    --c-info:    #38bdf8;
    --c-success: #4ade80;
    --c-warning: #fbbf24;
    --c-danger:  #f87171;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow:    0 8px 24px -6px rgba(0, 0, 0, .5), 0 3px 8px -3px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 50px -16px rgba(0, 0, 0, .65), 0 8px 16px -8px rgba(0, 0, 0, .4);
  }
}


/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; color: var(--text); letter-spacing: -.015em; line-height: 1.25; }
p   { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
img { display: block; max-width: 100%; height: auto; }
ul  { margin: 0; padding: 0; list-style: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}


/* ==========================================================================
   3. LAYOUT
   ========================================================================== */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}

section { background: var(--bg); }
section + section { padding-top: 0; }


/* ==========================================================================
   4. BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 28px;
  font: 600 15px/1 var(--font);
  letter-spacing: .005em;
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition: transform .18s var(--ease), background .15s, color .15s, border-color .15s, box-shadow .18s;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }


/* ==========================================================================
   5. HERO
   ========================================================================== */
.hero {
  position: relative;
  padding: 120px 0 130px;
  text-align: center;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--accent-active);
  background-image:
    radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px),
    radial-gradient(ellipse 60% 80% at 100% 0%, rgba(255, 255, 255, .12), transparent 60%),
    radial-gradient(ellipse 50% 70% at 0% 100%, rgba(0, 0, 0, .22),       transparent 60%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-active) 100%);
  background-size: 22px 22px, auto, auto, auto;
}

.hero-title {
  font-size: clamp(40px, 6.5vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.03em;
  color: #fff;
  margin: 0 0 20px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .12);
}
.hero-text {
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.55;
  margin: 0 auto 36px;
  max-width: 620px;
  color: rgba(255, 255, 255, .9);
}

.hero-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.hero .btn-primary {
  background: #fff;
  color: var(--accent);
  border: none;
  box-shadow: 0 14px 30px -8px rgba(0, 0, 0, .35);
}
.hero .btn-primary:hover {
  color: var(--accent-active);
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .42);
}
.hero .btn-ghost {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.hero .btn-ghost:hover {
  background: rgba(255, 255, 255, .18);
  border-color: #fff;
  color: #fff;
  transform: translateY(-2px);
}


/* ==========================================================================
   6. INTRO TEXT
   ========================================================================== */
.intro {
  padding: 88px 0 64px;
  background: var(--bg);
}
.intro::before {
  content: "";
  display: block;
  width: 48px; height: 3px;
  margin: 0 auto 32px;
  background: var(--accent);
  border-radius: 2px;
  opacity: .85;
}
.intro-body {
  max-width: 720px;
  margin: 0 auto;
}
.intro-body p {
  font-size: 18px;
  line-height: 1.7;
  text-align: center;
  color: var(--text);
  margin: 0 0 16px;
}
.intro-body p:last-child { margin-bottom: 0; }


/* ==========================================================================
   7. OFFER GRID
   ========================================================================== */
.offers {
  padding: 64px 0 88px;
  background: var(--bg);
}

.offer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
/* Adapt column count to the number of offers so 3 or 5 don't leave an orphan.
   :has() is supported in Chrome 105+ / Safari 15.4+ / Firefox 121+; older
   browsers fall back to the default 4-col layout. */
.offer-grid:has(> .offer:nth-child(3):last-child) { grid-template-columns: repeat(3, 1fr); }
.offer-grid:has(> .offer:nth-child(5):last-child) { grid-template-columns: repeat(5, 1fr); }
.offer-grid:has(> .offer:nth-child(6):last-child) { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1023px) {
  /* Tablet: 4, 5, 6 all fold to 2 cols. 3 stays 3 (slightly tighter but consistent). */
  .offer-grid,
  .offer-grid:has(> .offer:nth-child(5):last-child),
  .offer-grid:has(> .offer:nth-child(6):last-child) {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 539px) {
  /* Mobile: everything stacks. */
  .offer-grid,
  .offer-grid:has(> .offer:nth-child(3):last-child),
  .offer-grid:has(> .offer:nth-child(5):last-child),
  .offer-grid:has(> .offer:nth-child(6):last-child) {
    grid-template-columns: 1fr;
  }
}

.offer {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s ease;
}
.offer:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.offer-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}
.offer-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .55s var(--ease);
}
.offer:hover .offer-media img { transform: scale(1.06); }

/* Category pill — overlay on top of image (top-left) */
.offer-cat {
  position: absolute;
  top: 12px; left: 12px;
  padding: 6px 11px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  white-space: nowrap;
  transition: background .2s ease;
}
.offer:hover .offer-cat { background: var(--accent); }

.offer-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 18px 20px;
  flex: 1;
}

.offer-name {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.005em;
  color: var(--text);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;  /* reserve 2 lines */
}

.offer-pay {
  display: flex;
  flex-direction: column;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.offer-pay-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.offer-pay-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--accent);
  line-height: 1.1;
  margin-top: 2px;
}
.offer-pay-value i {
  font-size: 16px;
  margin-left: 4px;
  opacity: .8;
}


/* ==========================================================================
   8. CARD (shared by tops + news)
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border-bottom: 1px solid var(--border);
}
.card-dot {
  flex-shrink: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.005em;
  margin: 0;
}

/* Card footer — used as a CTA link in news */
.card-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  transition: background .15s ease, color .15s ease;
}
.card-foot:hover {
  background: var(--accent-light);
  color: var(--accent-hover);
}
.card-foot-arrow {
  display: inline-block;
  transition: transform .22s var(--ease);
}
.card-foot:hover .card-foot-arrow { transform: translateX(4px); }


/* ==========================================================================
   9. TOPS / LEADERBOARDS
   ========================================================================== */
.tops {
  padding: 64px 0;
  background: var(--bg);
}

.tops-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
@media (max-width: 899px) { .tops-grid { grid-template-columns: 1fr; } }

.lb {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.lb thead th {
  padding: 12px 22px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.lb th.lb-num { text-align: center; width: 90px; }

.lb tbody { counter-reset: rank; }
.lb tbody tr { counter-increment: rank; transition: background .12s ease; }
.lb tbody tr:hover { background: var(--accent-light); }
.lb tbody td {
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.lb tbody tr:last-child td { border-bottom: none; }

.lb td.lb-name {
  position: relative;
  padding-left: 64px;
  font-weight: 500;
}
.lb td.lb-name::before {
  content: counter(rank, decimal-leading-zero);
  position: absolute;
  left: 22px; top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-subtle);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
/* Top 3 — accent-tinted chip */
.lb tbody tr:nth-child(-n+3) td.lb-name::before {
  color: var(--accent);
  background: var(--accent-light);
  border-color: transparent;
}

.lb td.lb-name a {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.lb td.lb-name a:hover { color: var(--accent); }

.lb td.lb-num {
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-muted);
}


/* ==========================================================================
   10. NEWS
   ========================================================================== */
.news {
  padding: 64px 0 88px;
  background: var(--bg);
}

.newslist > li {
  border-bottom: 1px solid var(--border);
}
.newslist > li:last-child { border-bottom: none; }

.newslist > li > a {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px 24px;
  color: var(--text);
  text-decoration: none;
  position: relative;
  transition: background .15s ease, padding-left .25s var(--ease);
}
.newslist > li > a:hover {
  background: var(--accent-light);
  color: var(--text);
  padding-left: 32px;
}
.newslist > li > a::before {
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .22s var(--ease);
}
.newslist > li > a:hover::before { transform: scaleY(1); }

/* News category icon — colored square w/ icon. Uses .text-* tinting. */
.news-cat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(127, 138, 160, .14);
  color: var(--c-muted);
  font-size: 15px;
  flex-shrink: 0;
}
.news-cat i { display: block; line-height: 1; }

/* News title */
.news-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: -.005em;
}

/* News category tag — small pill with category name */
.news-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(127, 138, 160, .14);
  color: var(--c-muted);
  white-space: nowrap;
}

/* News date */
.news-date {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-subtle);
  white-space: nowrap;
}

/* Color tinting via the original {news.color} class (text-muted / -info / -primary etc.) */
.news-cat.text-muted,   .news-tag.text-muted   { background: rgba(127, 138, 160, .14); color: var(--c-muted);   }
.news-cat.text-primary, .news-tag.text-primary { background: rgba(37, 99, 235, .14);   color: var(--c-primary); }
.news-cat.text-info,    .news-tag.text-info    { background: rgba(8, 145, 178, .14);   color: var(--c-info);    }
.news-cat.text-success, .news-tag.text-success { background: rgba(22, 163, 74, .14);   color: var(--c-success); }
.news-cat.text-warning, .news-tag.text-warning { background: rgba(217, 119, 6, .14);   color: var(--c-warning); }
.news-cat.text-danger,  .news-tag.text-danger  { background: rgba(220, 38, 38, .14);   color: var(--c-danger);  }


/* ==========================================================================
   11. FOOTER
   ========================================================================== */
.site-foot {
  padding: 36px 0 40px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  position: relative;
}
.site-foot::before {
  content: "";
  display: block;
  width: 36px; height: 3px;
  margin: 0 auto 18px;
  background: var(--accent);
  border-radius: 2px;
  opacity: .8;
}
.site-foot a { color: var(--text-2); }
.site-foot a:hover { color: var(--accent); }


/* ==========================================================================
   12. RESPONSIVE
   ========================================================================== */
@media (max-width: 959px) {
  .container { padding: 0 22px; }
  .hero { padding: 92px 0 100px; }
  .intro { padding: 64px 0 48px; }
  .offers, .tops, .news { padding-top: 48px; padding-bottom: 64px; }
  .intro-body p { font-size: 17px; }
  .card-head { padding: 18px 22px; }
  .lb thead th, .lb tbody td { padding: 11px 18px; }
  .lb td.lb-name { padding-left: 58px; }
  .lb td.lb-name::before { left: 18px; }
  .newslist > li > a { padding: 14px 22px; gap: 14px; }
}

@media (max-width: 699px) {
  /* News stacks vertically on small screens */
  .newslist > li > a {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 6px 14px;
    padding: 14px 22px;
  }
  .news-cat { grid-row: 1 / span 2; }
  .news-title { grid-column: 2 / span 2; grid-row: 1; }
  .news-tag { grid-column: 2; grid-row: 2; }
  .news-date { grid-column: 3; grid-row: 2; }
}

@media (max-width: 539px) {
  body { font-size: 14px; }
  .container { padding: 0 18px; }
  .hero { padding: 72px 0 84px; }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }
  .hero .btn { width: 100%; }
  .intro { padding: 56px 0 40px; }
  .intro::before { width: 40px; margin-bottom: 26px; }
  .intro-body p { font-size: 16px; line-height: 1.65; }
  .offers { padding: 40px 0 56px; }
  .tops { padding: 40px 0; }
  .news { padding: 40px 0 56px; }
  .lb thead th, .lb tbody td { padding: 10px 14px; font-size: 13px; }
  .lb td.lb-name { padding-left: 50px; }
  .lb td.lb-name::before { left: 14px; width: 28px; height: 20px; font-size: 10.5px; }
  .lb th.lb-num { width: 70px; }
}


/* ==========================================================================
   13. DARK MODE TWEAKS
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  .card-head { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
  .site-foot { background: var(--surface); }
  .hero .btn-primary { box-shadow: 0 14px 30px -8px rgba(0, 0, 0, .55); }
  .lb thead th { background: var(--surface-2); }
}
