/* ==========================================================================
   GG10 Blog — brand layer over Blocksy
   --------------------------------------------------------------------------
   Every colour here is copied from the GG10 brand book (gg10_landing/src/app/
   brand.css) and must stay in step with it. Nothing invents a new colour.

   The blog is a SEPARATE surface from the app: it is a reading experience,
   not a product UI. So it borrows the brand's palette, typeface and angular
   corner-cut, but not the app's density — long-form text gets generous line
   height, a measured column width and real vertical rhythm.
   ========================================================================== */

:root {
  /* ---- 01. Primary ---- */
  --gg-primary: #d90251;
  --gg-primary-shade-3: #48011b;
  --gg-primary-shade-1: #a9023f;
  --gg-primary-tint-3: #ff317c;
  --gg-primary-tint-0: #ffdfeb;

  /* ---- 02. Neutral ---- */
  --gg-bg: #131313;
  --gg-bg-2: #212121;
  --gg-grey-7: #161616;
  --gg-grey-6: #1f1f1f;
  --gg-grey-5: #262626;
  --gg-grey-4: #454545;
  --gg-grey-3: #717171;
  --gg-grey-2: #8a8a8a;
  --gg-grey-1: #a4a4a4;
  --gg-grey-0: #d0d0d0;
  --gg-white: #ffffff;

  --gg-primary-rgb: 217 2 81;
  --gg-white-rgb: 255 255 255;

  /* ---- Geometry: the brand's angular language ---- */
  --gg-edge: 10px;      /* corner cut on cards and panels */
  --gg-radius-btn: 8px; /* buttons/inputs are rounded, never cut */

  /* ---- Reading measure ---- */
  --gg-measure: 44rem;
}

/* ==========================================================================
   Blocksy palette override
   --------------------------------------------------------------------------
   Blocksy renders its whole UI from eight --theme-palette-color-* variables,
   emitted inline in <head> from ITS OWN option store (not plain theme mods).
   Setting those mods via WP-CLI does not reach that store, so the site kept
   rendering Blocksy's default blue-on-white.

   Rather than reverse-engineer that store, we redefine the variables here.
   This is the more robust place for them anyway: it survives a theme-options
   reset, a Blocksy update, and its dynamic-CSS cache, and it keeps every
   colour in ONE file that maps straight onto the brand book above.

   The selector is `html:root`, not `:root`: Blocksy prints its inline <style>
   AFTER this file, and at equal specificity the later rule wins. Adding the
   element selector makes ours heavier so source order stops mattering.

   The mapping keeps Blocksy's own semantics (1 = accent, 8 = page ground):
     1 primary      2 primary-shade-1   3 body text     4 headings
     5 border       6 card/footer       7 page ground   8 deepest ground
   ========================================================================== */
html:root {
  --theme-palette-color-1: var(--gg-primary);
  --theme-palette-color-2: var(--gg-primary-tint-3);
  --theme-palette-color-3: var(--gg-grey-0);
  --theme-palette-color-4: var(--gg-white);
  --theme-palette-color-5: rgb(var(--gg-white-rgb) / 0.12);
  --theme-palette-color-6: var(--gg-grey-6);
  --theme-palette-color-7: var(--gg-bg);
  --theme-palette-color-8: var(--gg-grey-7);

  --theme-text-color: var(--gg-grey-0);
  --theme-headings-color: var(--gg-white);
  --theme-link-initial-color: var(--gg-primary-tint-3);
  --theme-link-hover-color: var(--gg-primary);
  --theme-border-color: rgb(var(--gg-white-rgb) / 0.12);
  --theme-selection-text-color: var(--gg-white);
  --theme-selection-background-color: var(--gg-primary);

  --theme-button-background-initial-color: var(--gg-primary);
  --theme-button-background-hover-color: var(--gg-primary-shade-1);
  --theme-button-text-initial-color: var(--gg-white);
  --theme-button-text-hover-color: var(--gg-white);

  /* Blocksy sets its own heading sizes in px; scale them for a blog and for
     Persian, which needs a slightly larger optical size than Latin. */
  --theme-normal-container-max-width: 1200px;
  --theme-narrow-container-max-width: 760px;
}

/* body's background-color is set by Blocksy to palette-7 — now our near-black.
   The card colour (palette-8) is deliberately the LIGHTER grey-7 so cards lift
   off the page rather than disappearing into it. */

/* ==========================================================================
   Base surfaces
   ========================================================================== */
/* html body, for the same source-order reason as the palette block above:
   Blocksy's inline style sets body{background-color:var(--theme-palette-color-7)}
   after this file. */
html body {
  background-color: var(--gg-bg);
  color: var(--gg-grey-0);
  -webkit-font-smoothing: antialiased;
}

/* A faint tactical grid, the same motif the landing footer uses. Fixed so it
   reads as a backdrop the content moves over, not a texture glued to a card. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image:
    linear-gradient(to right, #fff 1px, transparent 1px),
    linear-gradient(to bottom, #fff 1px, transparent 1px);
  background-size: 48px 48px;
}
#main-container { position: relative; z-index: 1; }

/* ==========================================================================
   Typography — Vazirmatn, self-hosted (Google Fonts is unreliable from Iran,
   and a blocked webfont silently falls back to Tahoma).
   ========================================================================== */
body,
button, input, select, optgroup, textarea,
.entry-content, h1, h2, h3, h4, h5, h6 {
  font-family: "Vazirmatn", "Vazir", Tahoma, system-ui, sans-serif;
}

h1, h2, h3, h4, h5, h6 { color: var(--gg-white); font-weight: 800; letter-spacing: -0.01em; }
h1 { line-height: 1.35; }
h2, h3 { line-height: 1.45; }

.entry-content p,
.entry-content li {
  line-height: 2.1;          /* Persian needs more leading than Latin */
  color: var(--gg-grey-0);
  font-size: 1.05rem;
}

/* Persian numerals sit better with tabular figures in meta rows. */
.entry-meta, .post-meta { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   The angular corner-cut — the single strongest brand signal after the red.
   Applied to cards and media, never to buttons (brand rule).
   ========================================================================== */
/* Applied to the CARD, not to the media inside it. Clipping the media
   container separately let the image escape the card's own rounding and
   overflow its edges; one cut on the outer box is both correct and cleaner.
   overflow:hidden makes the child media follow that cut. */
.entry-card,
.wp-block-image img,
.entry-content > figure img {
  clip-path: polygon(
    var(--gg-edge) 0, 100% 0, 100% calc(100% - var(--gg-edge)),
    calc(100% - var(--gg-edge)) 100%, 0 100%, 0 var(--gg-edge)
  );
}

/* Card media must fill the card's width and keep a consistent ratio, or the
   1600x900 covers set their own heights and the grid rows go ragged. */
.entry-card { overflow: hidden; }
.entry-card .ct-media-container,
.entry-card .ct-image-container {
  width: 100%;
  margin: 0;
}
.entry-card .ct-media-container img,
.entry-card .ct-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   Cards (archive/blog listing)
   ========================================================================== */
.entry-card {
  background: var(--gg-grey-6);
  border: 1px solid rgb(var(--gg-white-rgb) / 0.08);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.entry-card:hover {
  transform: translateY(-4px);
  border-color: rgb(var(--gg-primary-rgb) / 0.55);
  box-shadow: 0 12px 34px -12px rgb(var(--gg-primary-rgb) / 0.45);
}
.entry-card .entry-title a { color: var(--gg-white); }
.entry-card:hover .entry-title a { color: var(--gg-primary-tint-3); }

/* Category pills — solid brand red, the way the app tags a lobby. */
.entry-card .entry-meta a[rel~="category"],
.entry-meta .ct-meta-categories a {
  background: rgb(var(--gg-primary-rgb) / 0.15);
  color: var(--gg-primary-tint-3);
  border: 1px solid rgb(var(--gg-primary-rgb) / 0.35);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}

/* ==========================================================================
   Links & buttons
   ========================================================================== */
.entry-content a:not(.wp-block-button__link) {
  color: var(--gg-primary-tint-3);
  text-decoration-color: rgb(var(--gg-primary-rgb) / 0.45);
  text-underline-offset: 4px;
}
.entry-content a:not(.wp-block-button__link):hover { color: var(--gg-primary-tint-0); }

.wp-block-button__link,
.ct-button,
button.ct-button {
  background: var(--gg-primary);
  color: var(--gg-white);
  border-radius: var(--gg-radius-btn);
  font-weight: 700;
  transition: background .2s ease, transform .2s ease;
}
.wp-block-button__link:hover,
.ct-button:hover { background: var(--gg-primary-shade-1); transform: translateY(-1px); }

/* ==========================================================================
   Pull-quotes and callouts
   ========================================================================== */
.entry-content blockquote {
  background: linear-gradient(90deg, rgb(var(--gg-primary-rgb) / 0.10), transparent 70%);
  border-right: 3px solid var(--gg-primary);   /* RTL: the accent is on the right */
  border-left: 0;
  padding: 1.1rem 1.4rem;
  margin-inline: 0;
  color: var(--gg-grey-0);
}
.entry-content blockquote p:last-child { margin-bottom: 0; }

/* Inline code / kbd — mission-briefing feel, matching the app's mono chips. */
.entry-content code {
  background: var(--gg-grey-5);
  color: var(--gg-primary-tint-0);
  padding: .15em .45em;
  border-radius: 4px;
  font-size: .92em;
}

/* Tables read as data panels, not documents. */
.entry-content table { border-collapse: collapse; width: 100%; }
.entry-content th {
  background: var(--gg-grey-5);
  color: var(--gg-white);
  font-weight: 700;
}
.entry-content th, .entry-content td {
  border: 1px solid rgb(var(--gg-white-rgb) / 0.10);
  padding: .7rem .9rem;
}
.entry-content tbody tr:hover { background: rgb(var(--gg-white-rgb) / 0.03); }

/* ==========================================================================
   Header & footer
   ========================================================================== */
header#header .ct-header {
  background: rgb(19 19 19 / 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(var(--gg-white-rgb) / 0.08);
}

/* The hairline red gradient that separates every major band on the landing. */
footer.ct-footer { border-top: 1px solid rgb(var(--gg-white-rgb) / 0.10); position: relative; }
footer.ct-footer::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(to left, transparent, rgb(var(--gg-primary-rgb) / 0.5), transparent);
}

/* ==========================================================================
   Single post — a readable column, with the title given real presence.
   ========================================================================== */
.single .entry-header .entry-title { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.9rem); }

.single .entry-content > *:not(.alignwide):not(.alignfull):not(figure) {
  max-width: var(--gg-measure);
  margin-inline: auto;
}

/* First paragraph of a post reads as a standfirst. */
.single .entry-content > p:first-of-type {
  font-size: 1.18rem;
  color: var(--gg-grey-0);
  line-height: 2;
}

/* Section headings get the small rotated square from the landing footer. */
.entry-content h2::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-inline-end: .6rem;
  transform: rotate(45deg);
  background: var(--gg-primary);
  vertical-align: middle;
}

/* ==========================================================================
   Scrollbar + selection — small touches that keep the surface on-brand.
   ========================================================================== */
::selection { background: rgb(var(--gg-primary-rgb) / 0.35); color: var(--gg-white); }
* { scrollbar-color: var(--gg-grey-4) transparent; }

/* Respect reduced-motion: the hover lifts are decorative only. */
@media (prefers-reduced-motion: reduce) {
  .entry-card, .wp-block-button__link, .ct-button { transition: none; }
  .entry-card:hover { transform: none; }
}
