/*
Theme Name: Extensions Magazine
Theme URI: https://www.gelyda.org/extensions
Author: Up With It
Description: A publication theme for Extensions Magazine by GELYDA. Supports periodic issues via categories, a custom Section taxonomy (Create / Connect / Catalyse), and a Contributors CPT.
Version: 1.0.0
Requires at least: 6.3
Tested up to: 6.7
Requires PHP: 8.0
License: Proprietary
Text Domain: extensions
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --ink:      #1a1a1a;
  --ink-2:    #3a3a3a;
  --paper:    #ffffff;
  --paper-2:  #f5f5f5;
  --rule:     #e3e3e3;
  --rule-2:   #cdcdcd;
  --muted:    #6b6b6b;
  --muted-2:  #8a8a85;
  --create:   #e8521e;
  --connect:  #1f7a8c;
  --catalyse: #9b2d8f;
  --accent:   #e8521e;
  --maxw:     1240px;
  --display:  "Barlow Condensed", "Oswald", "Archivo Narrow", sans-serif;
  --serif:    "Source Serif 4", Georgia, serif;
  --sans:     "Archivo", -apple-system, sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a     { color: inherit; text-decoration: none; }
img   { display: block; max-width: 100%; height: auto; }

/* ============================================================
   TOPBAR (article pages)
   ============================================================ */
.topbar {
  border-bottom: 1px solid var(--rule);
  background: #eae951;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  min-height: 88px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-weight: 800;
  letter-spacing: .18em;
  font-size: .78rem;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  align-self: flex-start;
}
.brand img          { height: 74px; width: auto; display: block; background: #fff; padding: 0 12px; border-radius: 0 0 6px 6px; box-shadow: 0 4px 12px -6px rgba(0,0,0,.3); }
.brand .sep         { color: var(--rule); font-weight: 400; letter-spacing: 0; font-size: 1.1rem; line-height: 1; }
.brand .mag         { color: var(--ink); font-style: italic; font-weight: 500; letter-spacing: .005em; text-transform: uppercase; font-size: 1.45rem; font-family: var(--display); line-height: 1; }
.back               { font-family: var(--sans); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-decoration: none; transition: color .2s; }
.back:hover         { color: var(--ink); }

/* ============================================================
   FRONT PAGE — HERO TAKEOVER
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 680px;
  max-height: 1020px;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-color: #0c1116;
  color: #fff;
  overflow: hidden;
}
/* Top scrim */
.hero::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.18) 60%, rgba(0,0,0,0) 100%);
  pointer-events: none;
  z-index: 5;
}
/* Bottom scrim */
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 55%;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.4) 50%, rgba(0,0,0,.82) 100%);
  pointer-events: none;
  z-index: 5;
}

/* GELYDA badge */
.hero-badge             { position: relative; z-index: 20; padding: 0 0 12px; text-align: center; }
.hero-badge a           { display: inline-flex; align-items: center; justify-content: center; line-height: 0; background: #ffffff; border-radius: 0 0 4px 4px; box-shadow: 0 8px 20px -10px rgba(0,0,0,.55); overflow: hidden; width: 132px; height: 116px; padding: 0; }
.hero-badge img         { height: 130px; width: 130px; display: block; object-fit: contain; }

/* Hero nav */
.hero-nav               { position: relative; z-index: 20; margin-top: 8px; background: rgba(0,0,0,.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.hero-nav-inner         { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; padding: 14px 28px; gap: 8px 32px; font-family: var(--sans); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .18em; color: rgba(255,255,255,.94); }
.hero-nav-inner > .nav-item { position: relative; }
.hero-nav-inner > .nav-item.first { color: #fff; font-weight: 800; letter-spacing: .2em; }
.hero-nav-inner > .nav-item > a { color: inherit; transition: color .15s; padding: 6px 0; display: inline-block; white-space: nowrap; }
.hero-nav-inner > .nav-item > a:hover { color: #fff; }
.hero-nav-inner > .nav-item.has-menu > a::after { content: " \25BE"; font-size: .65em; margin-left: 5px; opacity: .75; }

/* Dropdown submenu */
.submenu                { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); display: none; min-width: 380px; background: rgba(15,15,15,.97); border: 1px solid rgba(255,255,255,.12); padding: 14px 0; z-index: 60; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .86rem; color: rgba(255,255,255,.9); }
.submenu a              { display: block; padding: 7px 22px; color: rgba(255,255,255,.88); font-family: var(--serif); line-height: 1.35; transition: background .12s, color .12s; }
.submenu a:hover        { background: rgba(255,255,255,.08); color: #fff; }
.nav-item:hover .submenu,
.nav-item:focus-within .submenu { display: block; }

/* Featured story overlay */
.hero-feature           { position: absolute; left: 0; right: 0; bottom: 6%; z-index: 15; text-align: center; padding: 0 28px; }
.hero-feature a         { color: #fff; }
.hero-feature .ftag     { display: inline-block; font-family: var(--sans); font-weight: 800; text-transform: uppercase; letter-spacing: .22em; font-size: .72rem; color: rgba(255,255,255,.92); margin-bottom: 18px; padding: 5px 14px; border: 1px solid rgba(255,255,255,.45); }
.hero-feature h2        { font-family: var(--sans); font-weight: 800; font-size: clamp(1.8rem, 4vw, 3.2rem); line-height: 1.05; letter-spacing: -.015em; max-width: 24ch; margin: 0 auto; text-shadow: 0 2px 14px rgba(0,0,0,.55); }
.hero-feature h2 a      { transition: opacity .2s; }
.hero-feature h2 a:hover { opacity: .85; }
.hero-feature .fbyline  { margin-top: 14px; font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.88); }

/* ============================================================
   FRONT PAGE — ISSUE HEADING & ARTICLE GRID
   ============================================================ */
.issue-head             { max-width: var(--maxw); margin: 0 auto; padding: 54px 28px 8px; border-bottom: 1px solid var(--rule); }
.issue-head h2          { font-family: var(--sans); font-weight: 900; text-transform: uppercase; font-size: clamp(1.7rem, 3.4vw, 2.3rem); line-height: 1; letter-spacing: .01em; padding-bottom: 24px; }

.section                { max-width: var(--maxw); margin: 0 auto; padding: 32px 28px 8px; }
.section-title          { font-family: var(--sans); font-weight: 900; text-transform: uppercase; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: .02em; line-height: 1; padding-bottom: 18px; margin-bottom: 34px; border-bottom: 2px solid var(--ink); }

/* Article cards */
.grid                   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 30px; padding-bottom: 48px; }
.card                   { display: flex; flex-direction: column; cursor: pointer; }
.card .thumb            { overflow: hidden; border-radius: 2px; background: var(--paper-2); margin-bottom: 16px; }
.card .thumb img        { width: 100%; aspect-ratio: 3/2; object-fit: cover; transition: transform .5s ease; }
.card:hover .thumb img  { transform: scale(1.05); }
.card.no-img            { padding-top: 4px; border-top: 1px solid var(--rule); }
.card.no-img .thumb     { display: none; }
.card h4                { font-family: var(--sans); font-weight: 700; font-size: 1.18rem; line-height: 1.18; letter-spacing: -.01em; margin-bottom: 8px; }
.card .auth             { font-family: var(--sans); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.card .ex               { font-size: .98rem; color: #444; line-height: 1.5; }
.card .readmore         { font-family: var(--sans); font-size: .74rem; font-weight: 700; color: var(--ink); margin-top: auto; padding-top: 14px; letter-spacing: .06em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; border-bottom: 1px solid transparent; transition: gap .2s, border-color .15s; align-self: flex-start; }
.card .readmore:hover   { gap: 10px; border-bottom-color: var(--accent); color: var(--accent); }

/* Section color accents on cards */
.card .section-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.card[data-section]            .section-dot { background: var(--section-color, var(--ink)); }

/* ============================================================
   ARTICLE PAGE — HEAD
   ============================================================ */
.article-head           { max-width: 760px; margin: 0 auto; padding: 64px 28px 0; }
.section-tag            { font-family: var(--sans); font-weight: 800; text-transform: uppercase; letter-spacing: .18em; font-size: .76rem; margin-bottom: 22px; display: inline-block; }
/* section-tag color is set inline via --section-color on the element */
.article-head h1        { font-family: var(--sans); font-weight: 800; font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -.018em; margin-bottom: 24px; }
.article-head .meta     { font-family: var(--sans); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding-bottom: 30px; border-bottom: 2px solid var(--ink); }

/* Hero image */
.hero-img               { max-width: 1000px; margin: 40px auto 0; padding: 0 28px; }
.hero-img img           { width: 100%; max-height: 560px; object-fit: cover; border-radius: 2px; }
.hero-img figcaption    { font-family: var(--sans); font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 10px; text-align: right; }

/* ============================================================
   ARTICLE PAGE — BODY
   ============================================================ */
.article-body           { max-width: 680px; margin: 0 auto; padding: 50px 28px 20px; font-size: 1.18rem; }
.article-body p         { margin-bottom: 1.5rem; }
.article-body p:first-of-type::first-letter {
  font-family: var(--sans);
  font-weight: 900;
  float: left;
  font-size: 4.6rem;
  line-height: .78;
  padding: 6px 14px 0 0;
  color: var(--ink);
}
.article-body.section-colored p:first-of-type::first-letter { color: var(--section-color, var(--ink)); }

.article-body h2        { font-family: var(--sans); font-weight: 800; font-size: 1.5rem; margin: 2.6rem 0 1rem; letter-spacing: -.01em; }
.article-body blockquote { margin: 2.4rem 0; padding-left: 24px; border-left: 3px solid var(--ink); font-style: italic; font-size: 1.4rem; line-height: 1.4; color: #2a2a2a; }
.article-body.section-colored blockquote { border-color: var(--section-color, var(--ink)); }
.article-body ul        { margin: 0 0 1.5rem 1.4rem; }
.article-body li        { margin-bottom: .6rem; }

.poem                   { font-style: italic; font-size: 1.25rem; line-height: 1.9; margin: 2rem 0; white-space: pre-line; }
.pullnote               { font-family: var(--sans); font-size: .8rem; color: var(--muted); font-style: normal; }

/* ============================================================
   ARTICLE PAGE — FOOT
   ============================================================ */
.article-foot           { max-width: 680px; margin: 30px auto 0; padding: 30px 28px 0; border-top: 1px solid var(--rule); clear: both; }
.article-foot .src-note { font-family: var(--sans); font-size: .78rem; color: var(--muted); line-height: 1.6; }

/* About the Author */
.article-authors            { max-width: 680px; margin: 40px auto 0; padding: 0 28px; }
.author-bio-block           { background: var(--wash); padding: 28px 32px; margin-bottom: 16px; }
.author-bio-label           { font-family: var(--sans); font-weight: 800; text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--muted); margin-bottom: 14px; }
.author-bio-text            { font-family: var(--serif); font-size: 1rem; line-height: 1.65; color: var(--ink); }
.author-bio-text p          { margin: 0 0 .75em; }
.author-bio-text p:last-child { margin-bottom: 0; }
.author-contact             { list-style: none; padding: 0; margin: 14px 0 0; font-family: var(--serif); font-size: 1rem; line-height: 1.8; }
.author-contact a           { color: var(--ink); text-decoration: underline; }
.author-contact a:hover     { color: var(--muted); }

/* Selected References */
.article-references         { max-width: 680px; margin: 50px auto 0; padding: 0 28px 60px; }
.article-references-title   { font-family: var(--sans); font-weight: 800; text-transform: uppercase; letter-spacing: .14em; font-size: .82rem; color: var(--ink); padding-bottom: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--ink); }
.references-list            { list-style: none; padding: 0; margin: 0; }
.references-list li         { font-family: var(--serif); font-size: .95rem; line-height: 1.6; color: #444; padding: 12px 0 12px 2em; text-indent: -2em; border-bottom: 1px solid var(--rule); }
.references-list li:last-child { border-bottom: 0; }

/* Inset figures within article body */
.article-body figure.inset              { margin: 2.6rem 0; width: 100%; }
.article-body figure.inset img          { width: 100%; height: auto; border-radius: 2px; display: block; }
.article-body figure.inset figcaption  { font-family: var(--sans); font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 10px; line-height: 1.45; }
.article-body figure.inset.wide        { margin-left: -60px; margin-right: -60px; width: calc(100% + 120px); }
.article-body figure.inset.right       { float: right; width: 48%; margin: .8rem 0 1.2rem 1.6rem; }
.article-body figure.inset.left        { float: left;  width: 48%; margin: .8rem 1.6rem 1.2rem 0; }
.article-body figure.inset.right figcaption,
.article-body figure.inset.left figcaption { text-align: left; }

/* ============================================================
   "MORE IN THIS ISSUE" RAIL
   ============================================================ */
.more                   { max-width: 1000px; margin: 60px auto 0; padding: 0 28px; }
.more h3                { font-family: var(--sans); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: .9rem; color: var(--muted); padding-bottom: 18px; border-bottom: 2px solid var(--ink); margin-bottom: 30px; }
.more-grid              { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; padding-bottom: 60px; }
.more-grid a            { text-decoration: none; }
.more-grid .cat         { font-family: var(--sans); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: .66rem; margin-bottom: 6px; }
.more-grid h4           { font-family: var(--sans); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.more-grid .mc-item .cat { color: var(--section-color, var(--ink)); }

/* ============================================================
   CONTRIBUTORS PAGE
   ============================================================ */
.contrib-intro          { max-width: 760px; margin: 30px auto 0; padding: 0 28px; font-size: 1.1rem; color: #333; line-height: 1.65; }
.contrib-intro p        { margin-bottom: 1rem; }

.contrib-group          { max-width: 1100px; margin: 60px auto 0; padding: 0 28px; }
.contrib-group-title    { font-family: var(--sans); font-weight: 900; text-transform: uppercase; font-size: 1.05rem; letter-spacing: .18em; color: var(--ink); padding-bottom: 14px; border-bottom: 2px solid var(--ink); }

.contrib-grid           { max-width: 1100px; margin: 50px auto 0; padding: 0 28px 30px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px 36px; }
.contrib                { display: flex; flex-direction: column; }
.contrib .portrait      { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; background: var(--paper-2); margin-bottom: 16px; flex-shrink: 0; border: 1px solid var(--rule); }
.contrib .portrait img  { width: 100%; height: 100%; object-fit: cover; display: block; }
.contrib .portrait.placeholder { display: flex; align-items: center; justify-content: center; font-family: var(--sans); font-weight: 900; font-size: 2.2rem; color: var(--muted); background: var(--paper-2); letter-spacing: .02em; }
.contrib .name          { font-family: var(--sans); font-weight: 800; font-size: 1.05rem; line-height: 1.2; margin-bottom: 4px; color: var(--ink); }
.contrib .role          { font-family: var(--sans); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; line-height: 1.35; }
.contrib .role .country { display: block; font-style: normal; color: var(--ink); margin-bottom: 3px; }
.contrib .quote         { font-family: var(--serif); font-style: italic; font-size: .98rem; line-height: 1.5; color: #2a2a2a; padding-left: 14px; border-left: 2px solid var(--ink); }

/* ============================================================
   CATEGORY / ISSUE ARCHIVE PAGE
   ============================================================ */
.archive-head           { max-width: var(--maxw); margin: 0 auto; padding: 54px 28px 24px; border-bottom: 1px solid var(--rule); }
.archive-head .kicker   { font-family: var(--sans); font-weight: 800; text-transform: uppercase; letter-spacing: .18em; font-size: .76rem; color: var(--muted); margin-bottom: 12px; display: block; }
.archive-head h1        { font-family: var(--sans); font-weight: 900; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.015em; margin-bottom: 14px; }
.archive-head .archive-desc { font-family: var(--serif); font-size: 1.1rem; color: #444; max-width: 60ch; line-height: 1.6; }

.archive-section        { max-width: var(--maxw); margin: 0 auto; padding: 40px 28px 8px; }
.archive-section-title  { font-family: var(--sans); font-weight: 900; text-transform: uppercase; font-size: clamp(1.1rem, 2vw, 1.5rem); letter-spacing: .04em; line-height: 1; padding-bottom: 16px; margin-bottom: 30px; border-bottom: 2px solid var(--ink); }
.archive-section-title { border-color: var(--section-color, var(--ink)); color: var(--section-color, var(--ink)); }

.archive-pagination     { max-width: var(--maxw); margin: 20px auto 60px; padding: 0 28px; display: flex; gap: 12px; align-items: center; }
.archive-pagination a,
.archive-pagination span { font-family: var(--sans); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; padding: 8px 16px; border: 1px solid var(--rule-2); color: var(--muted); transition: color .15s, border-color .15s; }
.archive-pagination a:hover { color: var(--ink); border-color: var(--ink); }
.archive-pagination .current { color: var(--ink); border-color: var(--ink); }

/* ============================================================
   FOOTER
   ============================================================ */
footer                  { border-top: 1px solid var(--rule); background: var(--paper); margin-top: 20px; }
.footer-inner           { max-width: var(--maxw); margin: 0 auto; padding: 40px 28px 28px; text-align: center; }
.footer-logo            { font-family: var(--sans); font-weight: 900; text-transform: uppercase; font-size: 1.6rem; letter-spacing: .04em; color: var(--ink); margin-bottom: 6px; }
.footer-logo em         { font-style: italic; }
.footer-sub             { font-family: var(--serif); font-style: italic; font-size: .9rem; color: var(--muted); margin-bottom: 26px; }
.footer-back            { display: inline-block; font-family: var(--sans); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); border: 1px solid var(--rule-2); padding: 8px 16px; margin-bottom: 24px; transition: color .15s, border-color .15s; }
.footer-back:hover      { color: var(--ink); border-color: var(--ink); }
.footer-social          { display: flex; justify-content: center; gap: 22px; margin-bottom: 22px; }
.footer-social a        { font-family: var(--sans); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); transition: color .15s; }
.footer-social a:hover  { color: var(--ink); }
.footer-copy            { font-family: var(--sans); font-size: .7rem; color: var(--muted-2); letter-spacing: .06em; padding-top: 18px; border-top: 1px solid var(--rule); }
.footer-copy a          { color: #999; }

/* Simple dark footer variant used on article pages */
.footer-base            { text-align: center; padding: 30px; font-family: var(--sans); font-size: .72rem; color: #888; letter-spacing: .06em; }
.footer-base a          { color: #bbb; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .hero               { height: 96vh; min-height: 600px; background-position: center top; }
  .hero-nav-inner     { justify-content: flex-start; gap: 6px 22px; font-size: .66rem; letter-spacing: .14em; overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .hero-nav-inner::-webkit-scrollbar { display: none; }
  .submenu            { display: none !important; }
  .nav-item.has-menu > a::after { display: none; }
  .hero-feature       { bottom: 5%; }
  .grid               { grid-template-columns: repeat(2, 1fr); gap: 30px 24px; }
  .contrib-grid       { grid-template-columns: repeat(2, 1fr); gap: 40px 28px; }
  .more-grid          { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 760px) {
  .article-body figure.inset.wide  { margin-left: 0; margin-right: 0; width: 100%; }
  .article-body figure.inset.right,
  .article-body figure.inset.left  { float: none; width: 100%; margin: 2rem 0; }
}
@media (max-width: 560px) {
  .issue-head         { padding: 34px 22px 4px; }
  .section            { padding: 24px 22px 4px; }
  .grid               { grid-template-columns: 1fr; }
  .contrib-grid       { grid-template-columns: 1fr; gap: 36px; }
  .contrib .portrait  { width: 100px; height: 100px; }
  .hero-badge img     { height: 84px; }
  .hero-feature .ftag { font-size: .62rem; }
  .article-body       { font-size: 1.08rem; }
}
