/* ============================================================
   Equitable Futures — tag.css
   Tag page = one direction of work (loaded only on tag pages).
   Classes are prefixed "dir-" on purpose: WordPress adds
   "tag-{slug}" to posts, so a "tag-" prefix could collide with a slug.
   ============================================================ */

/* Ornament tiles (inline, no extra requests). Stroke colour = --ef-blue. */
.dir-hero, .dir-tabs, .dir-panels {
  --dir-meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='10' viewBox='0 0 24 10'%3E%3Cpath d='M0 8H3V2H9V8H15V2H21V8H24' fill='none' stroke='%23c8962e' stroke-width='2' stroke-linejoin='miter'/%3E%3C/svg%3E");
  /* staff.css .staff-rail / .staff-sweep tiles in blue */
  --dir-rail: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='60'%3E%3Cpath d='M5 0.5 L9.5 6 L5 11.5 L0.5 6 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.35'/%3E%3Cpath d='M5 12.5 L9.5 18 L5 23.5 L0.5 18 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='1'/%3E%3Cpath d='M5 24.5 L9.5 30 L5 35.5 L0.5 30 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.15'/%3E%3Cpath d='M5 36.5 L9.5 42 L5 47.5 L0.5 42 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.7'/%3E%3Cpath d='M5 48.5 L9.5 54 L5 59.5 L0.5 54 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.5'/%3E%3C/svg%3E");
  --dir-sweep: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='10'%3E%3Cpath d='M6 0.5 L11.5 5 L6 9.5 L0.5 5 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.9'/%3E%3Cpath d='M18 0.5 L23.5 5 L18 9.5 L12.5 5 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.3'/%3E%3Cpath d='M30 0.5 L35.5 5 L30 9.5 L24.5 5 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.6'/%3E%3Cpath d='M42 0.5 L47.5 5 L42 9.5 L36.5 5 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.15'/%3E%3Cpath d='M54 0.5 L59.5 5 L54 9.5 L48.5 5 Z' fill='none' stroke='%231f4e8c' stroke-width='0.8' stroke-opacity='0.75'/%3E%3C/svg%3E");
  --dir-marker: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='14' viewBox='0 0 12 14'%3E%3Cpath d='M6 0.5 L11.5 7 L6 13.5 L0.5 7 Z' fill='%231f4e8c' stroke='%231f4e8c' stroke-width='1' stroke-linejoin='miter'/%3E%3C/svg%3E");
}

/* ── Header ── */
.dir-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 40px;
  padding: 30px 34px 28px;
}
.dir-hero:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06); }
.dir-hero-title { font-family: var(--f-head); font-weight: 700; font-size: 42px; line-height: 1.1; text-wrap: balance; }
.dir-hero-desc { max-width: 480px; margin-top: 8px; font-size: 15px; line-height: 1.55; color: var(--c-text-2); }
.dir-hero-desc > * + * { margin-top: 8px; }

.dir-stats { display: flex; gap: 26px; list-style: none; }
.dir-stats li { text-align: center; }
.dir-stats b { display: block; font-family: var(--f-head); font-weight: 700; font-size: 40px; line-height: 1; color: #1d2b5a; }
.dir-stats span { font-weight: 800; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--c-text-3); }

/* ── Filter tabs (hexagons; radios do the work, no JS) ── */
.dir-filter { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dir-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.dir-tabs label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 32px;
  background: var(--ef-tint);
  color: var(--ef-blue);
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);
  transition: background 0.2s;
}
.dir-tabs label:hover { background: #d3e4ea; }
.dir-tabs em { font-weight: 700; font-size: 12px; font-style: normal; opacity: 0.75; }
#dir-filter-all:checked ~ .dir-tabs label[for="dir-filter-all"],
#dir-filter-projects:checked ~ .dir-tabs label[for="dir-filter-projects"],
#dir-filter-stories:checked ~ .dir-tabs label[for="dir-filter-stories"] { background: var(--ef-blue); color: #FFFFFF; }
.dir-filter:focus-visible ~ .dir-tabs { outline: 3px solid var(--c-text); outline-offset: 6px; }
#dir-filter-projects:checked ~ .dir-panels .dir-section--stories,
#dir-filter-stories:checked ~ .dir-panels .dir-section--projects { display: none; }

.dir-panels { display: flex; flex-direction: column; gap: 30px; }

.dir-section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 20px;
}
.dir-section-title::after {
  content: '';
  flex: 1;
  height: 10px;
  background: var(--dir-meander) repeat-x center;
  background-size: 24px 10px;
}

/* ============================================================
   Project card
   ============================================================ */
.dir-projects { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; container-type: inline-size; }

.dir-project {
  position: relative;
  overflow: hidden;
  border-left: 6px solid var(--c-accent);
}
.dir-project.is-active { border-left-color: var(--c-green); }

.dir-project-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 28px;
  align-items: center;
  padding: 24px 28px;
}
.dir-project-text { display: flow-root; min-width: 0; }

/* Photo: uncropped, floated, same behaviour as the project archive card */
.dir-project-cover {
  float: left;
  display: block;
  width: clamp(120px, 28%, 230px);
  margin: 4px 24px 10px 0;
  border-radius: 8px;
  overflow: hidden;
}
.dir-project-cover img { display: block; width: 100%; height: auto; }

.dir-project-title { font-family: var(--f-head); font-weight: 700; font-size: 22px; line-height: 1.25; }
.dir-project-title a { color: var(--c-text); text-decoration: none; transition: color 0.3s ease; }
.dir-project-title a:hover { color: var(--c-accent-dark); }

.dir-project-meta { display: flex; flex-wrap: wrap; align-items: center; margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--c-text-2); }
.dir-project-meta b { font-weight: 600; color: var(--c-text); }
.dir-sep { margin: 0 8px; color: var(--c-text-3); }
.dir-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  background: var(--c-green);
  transform: rotate(45deg);
  vertical-align: 1px;
}
.dir-dot.is-ended { background: var(--c-accent); }

.dir-project-goal { margin-top: 14px; font-size: 16px; line-height: 1.6; color: var(--c-text-2); }
.dir-project-goal > * + * { margin-top: 10px; }

.dir-project-actions { clear: both; display: flex; align-items: center; gap: 20px; margin-top: 16px; }
.dir-support {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 22px;
  border-radius: 6px;
  background: var(--coral);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
}
.dir-support:hover { background: var(--c-accent-dark); }
.dir-project-go { font-weight: 800; font-size: 14px; color: var(--c-green); text-decoration: none; }
.dir-project-go:hover { text-decoration: underline; }

/* ============================================================
   The rhomb (stories control)
   Button:  filled rhomb, count inside, its two BOTTOM edges are a bright arrow.
            Click: the edges take the rhomb's colour and the rhomb turns 45° into a square.
   Link:    no stories yet. Unfilled rhomb, chevron inside, its two RIGHT edges are the arrow;
            hover lights the rhomb and the project title in the same colour.

   Animation note: scale (hover) and rotation (open) live on two different
   elements, so each has its own transition. When they shared one `transform`,
   un-hovering while the rotation was running retargeted the whole transition
   and restarted it from a slow ease-in: that was the visible lag.
   ============================================================ */
.dir-rh {
  --rh-c: var(--ef-blue);
  --rh-arrow: var(--coral);
  --s: 1;                      /* scale of the figure: hover / open both just set this */
  display: grid;
  justify-items: center;
  gap: 7px;
  width: 96px;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  color: var(--rh-c);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dir-rh-fig { position: relative; display: block; width: 64px; height: 64px; }

/* outer element: scale only (fast, independent of the rotation) */
.dir-rh-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: scale(var(--s));
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}
/* inner element: rotation only */
.dir-rh-g {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.dir-rh-body {
  fill: var(--rh-c);
  stroke: var(--rh-c);
  stroke-width: 3.5;
  stroke-linejoin: miter;
  transition: fill 0.4s ease, stroke 0.3s ease;
}
.dir-rh-arrow {
  fill: none;
  stroke: var(--rh-arrow);
  stroke-width: 3.5;
  stroke-linejoin: miter;
  stroke-linecap: butt;
  transition: stroke 0.4s ease;
}
.dir-rh-n {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-bottom: 1px;
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  color: #FFFFFF;
  transition: color 0.3s ease;
}
.dir-rh-label { font-weight: 800; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--c-text-3); }
.dir-rh:focus-visible { outline: 3px solid var(--c-text); outline-offset: 4px; border-radius: 6px; }

/* hover: only on devices that really hover */
@media (hover: hover) {
  button.dir-rh:hover { --s: 1.08; }
  button.dir-rh:hover .dir-rh-arrow { stroke: #ff826f; }
}

/* open: arrow edges take the rhomb's colour, the rhomb turns into a square (and is enlarged to keep its visual weight) */
button.dir-rh[aria-expanded="true"] { --s: 1.14; }
button.dir-rh[aria-expanded="true"] .dir-rh-g { transform: rotate(45deg); }
button.dir-rh[aria-expanded="true"] .dir-rh-arrow { stroke: var(--rh-c); }
@media (hover: hover) {
  button.dir-rh[aria-expanded="true"]:hover { --s: 1.23; }
  button.dir-rh[aria-expanded="true"]:hover .dir-rh-arrow { stroke: var(--rh-c); }
}

/* link variant: no stories */
.dir-rh--go .dir-rh-body { fill: transparent; }
.dir-rh--go .dir-rh-n { color: var(--rh-c); }
.dir-rh-chev { width: 24px; height: 24px; margin-left: 3px; overflow: visible; transition: transform 0.3s ease; }
.dir-rh-chev polyline { fill: none; stroke: currentColor; stroke-width: 3; stroke-linejoin: miter; stroke-linecap: butt; }

.dir-rh--go:focus-visible { --rh-c: var(--c-accent-dark); --rh-arrow: var(--c-accent-dark); }
.dir-project:has(.dir-rh--go:focus-visible) .dir-project-title a { color: var(--c-accent-dark); }
@media (hover: hover) {
  .dir-rh--go:hover { --rh-c: var(--c-accent-dark); --rh-arrow: var(--c-accent-dark); --s: 1.08; }
  .dir-rh--go:hover .dir-rh-chev { transform: translateX(3px); }
  /* ...and the other way round: hovering the title lights the rhomb */
  .dir-project:has(.dir-project-title a:hover) .dir-rh--go { --rh-c: var(--c-accent-dark); --rh-arrow: var(--c-accent-dark); --s: 1.08; }
  .dir-project:has(.dir-project-title a:hover) .dir-rh--go .dir-rh-chev { transform: translateX(3px); }
  .dir-project:has(.dir-rh--go:hover) .dir-project-title a { color: var(--c-accent-dark); }
}

/* ── Sweep line + drawer (staff.css pattern) ── */
.dir-sweep { position: relative; z-index: 2; height: 0; }
.dir-sweep::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -5px;
  height: 10px;
  opacity: 0.5;
  background: var(--dir-sweep) repeat-x;
  background-size: 60px 10px;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.dir-project.is-open .dir-sweep::before { clip-path: inset(0 0 0 0); }

.dir-drawer {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  background: #f3f7fa;
  transition: grid-template-rows 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.5s;
}
.dir-project.is-open .dir-drawer {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
}
/* No JS: drawers stay open, the button has nothing to do */
html:not(.js) .dir-drawer { grid-template-rows: 1fr; visibility: visible; }
html:not(.js) button.dir-rh { pointer-events: none; }
.dir-drawer-clip { min-height: 0; overflow: hidden; }
.dir-drawer-pad { padding: 20px 28px 10px 30px; }
.dir-drawer-title { margin-bottom: 2px; font-weight: 800; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ef-blue); }

/* Stories on the rail: faint rhomb column, the SOLID rhomb sits at the level of the title,
   the faint ones fade out above and beneath it.
   Geometry: padding 18 + date line 14 + gap 5 = title top 37; first title line (22px) centre = 48.
   The rail tile is shifted 6px so one of its rhombs is centred on that same 48. */
.dir-rail { list-style: none; }
.dir-rail li { position: relative; padding: 18px 0 18px 36px; }
.dir-rail li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  background: var(--dir-rail) 0 6px repeat-y;
  background-size: 10px 60px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 48px, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 48px, transparent 100%);
}
.dir-rail li::after { content: ''; position: absolute; left: -1px; top: 41px; width: 12px; height: 14px; background: var(--dir-marker) no-repeat; }
.dir-rail time { display: block; font-weight: 800; font-size: 11px; line-height: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ef-blue); }
.dir-rail a { display: inline-block; margin-top: 5px; font-family: var(--f-head); font-weight: 700; font-size: 17px; line-height: 22px; color: var(--c-text); text-decoration: none; }
.dir-rail a:hover { color: var(--c-accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.dir-project.is-open .dir-rail li { animation: dir-rail-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i) * 90ms + 180ms); }
@keyframes dir-rail-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ── Responsive: follows the CARD width (like staff.css), so it is the same with or without the sidebar ── */
@container (max-width: 700px) {
  .dir-project-main { gap: 16px 20px; padding: 22px; }
  .dir-project-cover { width: clamp(110px, 26%, 190px); margin-right: 20px; }
  .dir-project-title { font-size: 21px; }
  .dir-rh { width: 80px; }
  .dir-rh-fig { width: 56px; height: 56px; }
  .dir-rh-n { font-size: 19px; }
  .dir-rh-chev { width: 20px; height: 20px; }
  .dir-drawer-pad { padding: 18px 22px 8px 24px; }
}
/* Mobile: the rhomb leaves the right column and sits centred at the bottom of the card */
@container (max-width: 520px) {
  .dir-project-main { grid-template-columns: minmax(0, 1fr); padding: 20px 20px 18px; }
  .dir-project-main .dir-rh { justify-self: center; width: auto; min-width: 96px; margin-top: 6px; }
  .dir-project-cover { width: 112px; margin-right: 16px; }
  .dir-project-title { font-size: 19px; }
  .dir-project-goal { font-size: 15px; }
  .dir-project-actions { flex-wrap: wrap; gap: 12px 18px; }
  .dir-drawer-pad { padding: 16px 18px 6px 20px; }
  .dir-rail a { font-size: 16px; }
}
@container (max-width: 340px) {
  .dir-project-cover { float: none; width: 100%; margin: 0 0 14px; }
}

/* ============================================================
   Loose stories
   ============================================================ */
.dir-stories {
  list-style: none;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.dir-story {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--c-border);
}
.dir-story:last-child { border-bottom: 0; }
.dir-date {
  display: grid;
  place-items: center;
  align-content: center;
  width: 68px;
  height: 68px;
  background: var(--ef-blue);
  color: #FFFFFF;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  text-align: center;
  font-weight: 800;
  font-size: 10px;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dir-date b { font-family: var(--f-head); font-weight: 700; font-size: 17px; line-height: 1; letter-spacing: 0; color: #f0d9a0; }
.dir-story-title { font-family: var(--f-head); font-weight: 700; font-size: 18px; line-height: 1.3; }
.dir-story-title a { color: var(--c-text); text-decoration: none; }
.dir-story-title a:hover { color: var(--c-accent-dark); }
.dir-story-excerpt {
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dir-story-from { display: inline-block; margin-top: 6px; font-weight: 700; font-size: 12px; color: var(--ef-blue); text-decoration: none; }
.dir-story-from:hover { text-decoration: underline; }
.dir-section--stories .pagination { margin-top: 20px; }

@media (max-width: 600px) {
  .dir-hero { padding: 24px 22px 22px; }
  .dir-hero-title { font-size: 32px; }
  .dir-story { grid-template-columns: 56px minmax(0, 1fr); gap: 14px; padding: 14px 16px; }
  .dir-date { width: 56px; height: 56px; font-size: 9px; }
  .dir-date b { font-size: 15px; }
  .dir-story-title { font-size: 17px; }
}
