/*
Theme Name: SAMIEI
Theme URI: https://samiei.co.uk
Description: Child theme of GeneratePress for SAMIEI — open-source investigations on Iran. Carries the evidence-grade chip system, source list, document figure and correction notice components.
Author: SAMIEI
Template: generatepress
Version: 1.3.0
Text Domain: samiei
*/

/* ==========================================================================
   1. Tokens
   These mirror the GeneratePress Global Colors set in the Customizer.
   Set both — the Customizer values style the theme's own controls, these
   style the custom components below.
   ========================================================================== */

:root {
  --ink:       #16283c;
  --paper:     #f2f4f6;
  --white:     #ffffff;
  --turquoise: #0b6b6b;
  --saffron:   #b87400;
  --claret:    #96242f;
  --slate:     #5a6b7a;
  --rule:      #c9d2d8;

  --measure:    66ch;
  --measure-fa: 62ch;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Vazirmatn", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ==========================================================================
   2. Reading surface
   ========================================================================== */

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

.inside-article,
.sidebar .widget,
.comments-area {
  background: var(--white);
}

.single .entry-content > p,
.single .entry-content > ul,
.single .entry-content > ol,
.single .entry-content > blockquote,
.single .entry-content > h2,
.single .entry-content > h3,
.page .entry-content > p,
.page .entry-content > ul,
.page .entry-content > ol,
.page .entry-content > h2,
.page .entry-content > h3 {
  max-width: var(--measure);
}

/* Evidence breaks the measure: documents, imagery, tables, maps */
.entry-content > figure,
.entry-content > .doc-figure,
.entry-content > .table-wrap,
.entry-content > .wp-block-table {
  max-width: 100%;
}

.entry-content > h2 { margin-top: 2.4em; }
.entry-content > h3 { margin-top: 1.8em; }

.entry-content a {
  color: var(--turquoise);
  text-decoration: underline;
  text-underline-offset: 0.14em;
  text-decoration-thickness: 1px;
}
.entry-content a:hover { text-decoration-thickness: 2px; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 2px;
}

/* ==========================================================================
   3. Evidence-grade chips — the one loud thing on the site
   ========================================================================== */

.eg {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 0.42em 0.62em;
  border: 1px solid currentColor;
  border-radius: 2px;
  white-space: nowrap;
  vertical-align: baseline;
}

.eg::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  transform: translateY(-1px);
}

.eg--documented   { color: var(--turquoise); }

.eg--corroborated { color: var(--turquoise); }
.eg--corroborated::before { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }

.eg--reported     { color: var(--saffron); }
.eg--reported::before { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }

.eg--contested    { color: var(--claret); }
.eg--contested::before { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }

.eg--debunked {
  background: var(--claret);
  color: var(--white);
  border-color: var(--claret);
}
.eg--debunked::before { background: var(--white); }

/* Inline grade on a single claim in body text */
.eg--inline {
  font-size: 11px;
  padding: 0.28em 0.45em;
  margin-inline-start: 0.35em;
  transform: translateY(-0.15em);
}

/* Article header: grade + source count + last checked */
.eg-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.9rem 0;
  margin: 0 0 2rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--slate);
}
.eg-header strong { color: var(--ink); font-weight: 500; }

/* Grade shown on archive cards, from the taxonomy term */
.entry-meta .eg { font-size: 12px; }

/* ==========================================================================
   4. Sources
   ========================================================================== */

.src-list {
  max-width: var(--measure);
  margin: 3rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 2px solid var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}
.src-list h2 {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 1rem;
}
.src-list ol { margin: 0; padding-inline-start: 1.6em; }
.src-list li { margin-bottom: 0.7em; }
.src-list li::marker { color: var(--slate); }

.src-archive {
  font-size: 13px;
  color: var(--slate);
  margin-inline-start: 0.4em;
}

/* ==========================================================================
   5. Documents and imagery
   ========================================================================== */

.doc-figure {
  margin: 2.5rem 0;
  background: var(--white);
  border: 1px solid var(--rule);
}
.doc-figure img { display: block; width: 100%; height: auto; }
.doc-figure figcaption {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--slate);
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--rule);
}
.doc-figure figcaption b { color: var(--ink); font-weight: 500; }

.doc-warning {
  font-family: var(--sans);
  font-size: 14px;
  padding: 0.75rem 1rem;
  border-inline-start: 3px solid var(--claret);
  background: var(--white);
  margin: 2rem 0 0;
}

/* ==========================================================================
   6. Corrections
   ========================================================================== */

.correction-notice {
  max-width: var(--measure);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  padding: 1rem 1.15rem;
  margin: 0 0 2rem;
  background: var(--paper);
  border-inline-start: 3px solid var(--claret);
}
.correction-notice b { color: var(--claret); }

/* ==========================================================================
   7. Archive listings
   ========================================================================== */

.entry-title { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
.entry-title a { color: var(--ink); text-decoration: none; }
.entry-title a:hover { text-decoration: underline; }

.entry-meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--slate);
}
.entry-meta a { color: var(--slate); }
.entry-meta a:hover { color: var(--turquoise); }

.generate-columns .inside-article {
  border: 1px solid var(--rule);
  padding: 28px 26px 26px;
}

/* No card shadows anywhere — separation comes from rules and space */
.inside-article,
.sidebar .widget { box-shadow: none; }

/* ==========================================================================
   8. Header, navigation, footer
   Header stays light: the page should open on a headline, not a slab of
   colour. The ink goes in the footer.
   ========================================================================== */

.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--ink);
}

.main-navigation,
.main-navigation .main-nav ul li a {
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 500;
}
.main-navigation .main-nav ul li:hover > a,
.main-navigation .main-nav ul li.current-menu-item > a {
  color: var(--turquoise);
  background: var(--white);
}

.main-title a { font-family: var(--serif); font-weight: 600; color: var(--ink); }
.site-description { font-family: var(--sans); color: var(--slate); }

.site-footer,
.site-info {
  background: var(--ink);
  color: rgba(242, 244, 246, 0.82);
}
.site-footer a, .site-info a { color: var(--paper); }
.site-footer a:hover, .site-info a:hover { color: #6fd0d0; }
.site-footer .widget-title {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
}

/* Language switch — text, never a flag */
.lang-switch,
.pll-parent-menu-item > a {
  font-family: var(--sans);
  font-size: 14px;
}

/* ==========================================================================
   9. Persian / RTL
   ========================================================================== */

html[lang^="fa"] body,
[dir="rtl"] .entry-content {
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.95;
  text-align: right;
}

[dir="rtl"] .single .entry-content > p,
[dir="rtl"] .single .entry-content > ul,
[dir="rtl"] .single .entry-content > ol,
[dir="rtl"] .single .entry-content > blockquote {
  max-width: var(--measure-fa);
  text-align: right;   /* never justify Persian on the web */
}

html[lang^="fa"] h1,
html[lang^="fa"] h2,
html[lang^="fa"] h3,
html[lang^="fa"] h4,
html[lang^="fa"] .entry-title {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.5;    /* Persian headings need more than Latin ones */
}

html[lang^="fa"] .src-list,
html[lang^="fa"] .eg-header { direction: rtl; }

/* ==========================================================================
   10. Tables
   ========================================================================== */

.table-wrap { overflow-x: auto; margin: 2.5rem 0; }

.entry-content table,
.entry-content .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 15px;
  background: var(--white);
}
.entry-content th {
  text-align: start;
  font-weight: 600;
  border-bottom: 2px solid var(--ink);
  padding: 0.7rem 0.8rem;
}
.entry-content td {
  border-bottom: 1px solid var(--rule);
  padding: 0.7rem 0.8rem;
  vertical-align: top;
}

/* ==========================================================================
   11. Buttons and forms
   ========================================================================== */

.wp-block-button__link,
button, .button,
input[type="submit"] {
  background: var(--turquoise);
  color: var(--white);
  border-radius: 2px;
  font-family: var(--sans);
  font-weight: 500;
}
.wp-block-button__link:hover,
button:hover, .button:hover,
input[type="submit"]:hover { background: var(--ink); color: var(--white); }

input[type="text"], input[type="email"], input[type="url"],
input[type="search"], textarea, select {
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--white);
  font-family: var(--sans);
}

/* ==========================================================================
   12. Responsive and accessibility floor
   ========================================================================== */

@media (max-width: 768px) {
  html[lang^="fa"] body { font-size: 18px; }
  .eg-header { font-size: 13px; gap: 0.5rem 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header, .site-footer, .site-info, .lang-switch { display: none; }
  body { background: #fff; font-size: 11pt; }
  .entry-content a::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    word-break: break-all;
  }
}

/* ==========================================================================
   13. Utility bar
   Ink, matching the footer — so the white logo band between them reads as
   deliberate rather than as an empty grey strip.
   ========================================================================== */

.samiei-topbar {
  background: var(--ink);
  color: rgba(242, 244, 246, 0.78);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1;
}

.samiei-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
  min-height: 42px;
}

.samiei-tagline {
  margin: 0;
  color: rgba(242, 244, 246, 0.78);
  font-size: 13px;
}

.samiei-topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: none;
}

.samiei-topbar a { color: var(--paper); text-decoration: none; }
.samiei-topbar a:hover { color: #6fd0d0; }

/* Utility nav: About, Contact */
.samiei-utility-menu {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.samiei-utility-menu li { margin: 0; }
.samiei-utility-menu a { font-size: 13px; }

/* Language switcher — text, never a flag */
.samiei-lang ul {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.samiei-lang li {
  margin: 0;
  padding: 0;
  font-size: 13px;
  list-style: none;
  display: inline-flex;
  align-items: center;
}
.samiei-lang li::marker { content: none; }
.samiei-lang li:not(:last-child)::after {
  content: "/";
  margin: 0 8px;
  color: rgba(242, 244, 246, 0.35);
}
.samiei-lang a { white-space: nowrap; }
.samiei-lang .current-lang a { color: rgba(242, 244, 246, 0.5); }
.samiei-lang .lang-item img { display: none; }

.samiei-social { display: flex; align-items: center; gap: 12px; }
.samiei-social a { display: inline-flex; }

/* Search lives here, not on the menu row — the menu row is full */
.samiei-search { display: flex; align-items: center; }
.samiei-search input[type="search"] {
  width: 168px;
  height: 28px;
  padding: 0 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--paper);
  background: rgba(242, 244, 246, 0.09);
  border: 1px solid rgba(242, 244, 246, 0.22);
  border-right: 0;
  border-radius: 2px 0 0 2px;
}
.samiei-search input[type="search"]::placeholder { color: rgba(242, 244, 246, 0.5); }
.samiei-search input[type="search"]:focus {
  background: rgba(242, 244, 246, 0.16);
  outline: none;
  border-color: #6fd0d0;
}
.samiei-search button {
  height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  color: var(--paper);
  background: rgba(242, 244, 246, 0.09);
  border: 1px solid rgba(242, 244, 246, 0.22);
  border-radius: 0 2px 2px 0;
}
.samiei-search button:hover { background: rgba(242, 244, 246, 0.2); color: var(--paper); }

@media (max-width: 900px) {
  .samiei-topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 20px; }
  .samiei-tagline { flex: 1 1 100%; }
  .samiei-search input[type="search"] { width: 130px; }
}
@media (max-width: 600px) {
  .samiei-tagline { display: none; }
  .samiei-topbar-right { width: 100%; justify-content: space-between; gap: 12px; }
}

/* ==========================================================================
   14. Footer
   ========================================================================== */

.samiei-footer {
  font-family: var(--sans);
  text-align: center;
  padding: 8px 20px;
}

.samiei-footer-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.samiei-footer-menu li { margin: 0; }
.samiei-footer-menu a {
  font-size: 14px;
  color: var(--paper);
  text-decoration: none;
}
.samiei-footer-menu a:hover { color: #6fd0d0; text-decoration: underline; }

.samiei-footer-reuse {
  font-size: 14px;
  color: rgba(242, 244, 246, 0.82);
  margin: 0 0 14px;
}

.samiei-footer-legal {
  max-width: 74ch;
  margin: 0 auto 14px;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(242, 244, 246, 0.55);
}

.samiei-footer-credit {
  font-size: 13px;
  color: rgba(242, 244, 246, 0.72);
  margin: 0;
}

[dir="rtl"] .samiei-topbar-inner,
[dir="rtl"] .samiei-footer { direction: rtl; }

/* ==========================================================================
   15. Homepage
   ========================================================================== */

.samiei-home { max-width: 1180px; margin: 0 auto; padding: 0 24px 64px; }

/* --- Lead mosaic: one large, three supporting --- */

.samiei-lead {
  display: grid;
  grid-template-columns: 3fr 2fr;
  grid-template-rows: auto auto;
  gap: 20px;
  margin: 32px 0 56px;
}
.samiei-lead .samiei-card--lead-main { grid-row: span 2; }

.samiei-card { background: var(--white); border: 1px solid var(--rule); }
.samiei-card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.samiei-card img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16 / 9; }
.samiei-card--lead-main img { aspect-ratio: 4 / 3; }

.samiei-card-body { padding: 18px 20px 20px; }

.samiei-card-cats {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--turquoise);
  margin: 0 0 6px;
}

.samiei-card-title {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 21px;
}
.samiei-card--lead-main .samiei-card-title { font-size: 32px; }
.samiei-card-link:hover .samiei-card-title { text-decoration: underline; }

.samiei-card-meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--slate);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* No featured image: the headline carries the card */
.samiei-card--noimage .samiei-card-body { padding: 26px 22px; }
.samiei-card--noimage { border-left: 3px solid var(--turquoise); }

/* --- Section rails --- */

.samiei-section { margin: 0 0 56px; }

.samiei-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 22px;
}
.samiei-section-head h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  margin: 0;
}
.samiei-section-head a {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--turquoise);
  text-decoration: none;
  white-space: nowrap;
}
.samiei-section-head a:hover { text-decoration: underline; }

.samiei-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* --- Open source in short --- */

.samiei-short-list { list-style: none; margin: 0; padding: 0; }
.samiei-short-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}
.samiei-short-list a {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.samiei-short-list a:hover { text-decoration: underline; }
.samiei-short-meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--slate);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Community band --- */

.samiei-community {
  background: var(--ink);
  color: var(--paper);
  padding: 40px 36px 44px;
  margin: 0 0 56px;
}
.samiei-community h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--white);
  margin: 0 0 8px;
}
.samiei-community-intro {
  font-family: var(--sans);
  font-size: 15px;
  color: rgba(242, 244, 246, 0.75);
  margin: 0 0 28px;
  max-width: 60ch;
}
.samiei-community-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.samiei-community-card {
  display: block;
  padding: 20px;
  background: rgba(242, 244, 246, 0.07);
  border: 1px solid rgba(242, 244, 246, 0.18);
  border-radius: 2px;
  text-decoration: none;
}
.samiei-community-card:hover { background: rgba(242, 244, 246, 0.14); border-color: #6fd0d0; }
.samiei-community-card h3 {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  margin: 0 0 8px;
}
.samiei-community-card p {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: rgba(242, 244, 246, 0.72);
  margin: 0;
}

/* --- Persian --- */

html[lang^="fa"] .samiei-card-title,
html[lang^="fa"] .samiei-section-head h2,
html[lang^="fa"] .samiei-community h2,
html[lang^="fa"] .samiei-short-list a {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.5;
}

/* --- Responsive --- */

@media (max-width: 900px) {
  .samiei-lead { grid-template-columns: 1fr; }
  .samiei-lead .samiei-card--lead-main { grid-row: auto; }
  .samiei-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .samiei-community-grid { grid-template-columns: repeat(2, 1fr); }
  .samiei-card--lead-main .samiei-card-title { font-size: 26px; }
}
@media (max-width: 600px) {
  .samiei-home { padding: 0 16px 40px; }
  .samiei-grid-3, .samiei-community-grid { grid-template-columns: 1fr; }
  .samiei-community { padding: 28px 20px 32px; }
  .samiei-short-list li { flex-direction: column; gap: 6px; }
}
