/*
Theme Name: GGScope
Theme URI: https://ggscope.io/
Author: GGScope
Author URI: https://ggscope.io/
Description: Editorial magazine layout for gaming news aggregation. Block theme. Requires the GGScope Aggregator plugin to provide the data layer.
Version: 0.1.0
Requires at least: 6.4
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ggscope
Tags: full-site-editing, block-theme, news, dark-mode, magazine
*/

/* ------------------------------------------------------------------
   GGScope · Global stylesheet
   theme.json owns most tokens. This file holds CSS that can't be
   expressed in theme.json: light-mode override, dark-mode toggle
   transition, custom block patterns' extras, body wrap settings.
   ------------------------------------------------------------------ */

/* Smooth color transitions when dark/light is toggled */
:root,
body,
.wp-block-button__link,
.wp-block-group {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

/* Light-mode override — class added to body by inline JS toggle */
body.is-light-mode {
  --wp--preset--color--bg:        #f6f4ef;
  --wp--preset--color--surface:   #ffffff;
  --wp--preset--color--surface-2: #ecebe5;
  --wp--preset--color--text:      #13110d;
  --wp--preset--color--dim:       #5a5448;
  --wp--preset--color--faint:     #9c968a;
  --wp--preset--color--border:    rgba(0,0,0,0.12);
  --wp--preset--color--rule:      rgba(0,0,0,0.25);
  --wp--preset--color--on-accent: #ffffff;
  background-color: var(--wp--preset--color--bg);
  color: var(--wp--preset--color--text);
}

/* Headline text-wrap improvements (theme.json doesn't expose text-wrap) */
h1, h2, h3, .wp-block-post-title { text-wrap: balance; }
p, li, .wp-block-post-excerpt { text-wrap: pretty; }

/* Mono uppercase metadata helper class — for use in patterns */
.gg-mono-meta {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--wp--preset--color--faint);
}
.gg-mono-meta--accent { color: var(--wp--preset--color--accent); }

/* Accent rule — used under section heads */
.gg-rule {
  border-top: 2px solid var(--wp--preset--color--rule);
  height: 0;
  margin: 0;
}

/* "Read on source" CTA — block style, also used inline in patterns */
.gg-cta {
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--border);
  padding: 36px;
  position: relative;
  overflow: hidden;
}
.gg-cta::before {
  content: "";
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--wp--preset--color--accent);
}
.gg-cta__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.gg-cta__button {
  background: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--on-accent);
  text-decoration: none;
  padding: 18px 28px;
  font-family: var(--wp--preset--font-family--sans);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 12px;
  white-space: nowrap;
}
.gg-cta__button:hover {
  background: color-mix(in oklch, var(--wp--preset--color--accent) 80%, white);
}

/* Source badge — three styles, controlled by class on the wrapper */
.gg-source-badge {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--wp--preset--color--accent);
}
.gg-source-badge--bracket::before { content: "[ "; }
.gg-source-badge--bracket::after  { content: " ]"; }
.gg-source-badge--badge {
  background: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--on-accent);
  padding: 3px 7px;
}

/* Header — theme toggle button */
.gg-theme-toggle {
  color: var(--wp--preset--color--dim);
}
.gg-theme-toggle .wp-element-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--wp--preset--color--border);
  background: transparent;
  color: inherit;
}
.gg-theme-toggle:hover,
.gg-theme-toggle:hover .wp-element-button {
  color: var(--wp--preset--color--accent);
  border-color: var(--wp--preset--color--accent);
}
.gg-theme-toggle .gg-icon-moon { display: none; }
body.is-light-mode .gg-theme-toggle .gg-icon-sun  { display: none; }
body.is-light-mode .gg-theme-toggle .gg-icon-moon { display: inline; }

.gg-chip-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gg-chip-strip--end {
  margin-left: auto;
}

.gg-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--wp--preset--color--border);
  background: var(--wp--preset--color--surface);
  color: var(--wp--preset--color--dim);
  text-decoration: none;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gg-chip.is-active,
.gg-chip:hover {
  color: var(--wp--preset--color--text);
  border-color: var(--wp--preset--color--accent);
}

.gg-source-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 24px;
}

.gg-source-card {
  display: block;
  padding: 20px;
  border: 1px solid var(--wp--preset--color--border);
  background: var(--wp--preset--color--surface);
  text-decoration: none;
}

.gg-source-card__short {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--wp--preset--color--accent);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.gg-source-card__name {
  font-family: var(--wp--preset--font-family--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--wp--preset--color--text);
  margin-bottom: 10px;
}

.gg-most-read-list .wp-block-post-template {
  counter-reset: gg-rank;
}

.gg-most-read-list .gg-rank {
  margin: 0;
  font-size: 0;
  line-height: 0;
}

.gg-most-read-list .gg-rank::before {
  counter-increment: gg-rank;
  content: counter(gg-rank, decimal-leading-zero);
  display: block;
  font-family: var(--wp--preset--font-family--serif);
  font-size: 36px;
  font-style: italic;
  font-weight: 500;
  line-height: 0.9;
  color: var(--wp--preset--color--accent);
}

@media (max-width: 900px) {
  .gg-source-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gg-chip-strip--end {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .gg-source-strip {
    grid-template-columns: 1fr;
  }
}

/* Hide WP admin bar offset on front (theme aesthetic) */
html.wp-toolbar { scroll-padding-top: 32px; }

/* Editor-side: keep blocks looking right while editing */
.editor-styles-wrapper {
  background: var(--wp--preset--color--bg);
  color: var(--wp--preset--color--text);
}
