/* ============================================
   HOMEPAGE - "Where we work"

   Six "Greetings from…" postcards fanned in an arc. Each has a blurred flag
   as its photo, a flag stamp, a ruled description and a framework / service
   count footer; hovering lifts a card out of the fan. Below 1180px the fan
   becomes a grid. Type comes from css/theme.css.
   Markup: tools/home_countries.py.
   ============================================ */

/* The tilted cards may poke past the edges; never let them cause sideways scroll */
.ctry { background: #ffffff; overflow-x: clip; }

.ctry-tone--pink  { --tone-b: #fdeaef; }
.ctry-tone--lilac { --tone-b: #ece9fc; }
.ctry-tone--sky   { --tone-b: #eaf4fd; }
.ctry-tone--peach { --tone-b: #fdeddf; }
.ctry-tone--grey  { --tone-b: #f0f0f4; }
.ctry-tone--rose  { --tone-b: #f4eafb; }

/* ---------- Fan ---------- */
/* --spread is the distance between neighbouring cards; they sit side by side,
   just touching, so no text is hidden under a neighbour */
.ctry-fan { --spread: 226px; position: relative; height: 470px; }

.ctry-post {
  position: absolute;
  top: 34px;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: 218px;
  padding: 10px 10px 14px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 30px 50px -30px rgba(35, 13, 79, 0.45), 0 0 0 1px rgba(35, 13, 79, 0.05);
  text-decoration: none;
  transform: translateX(-50%) translateX(calc(var(--spread) * var(--n))) translateY(calc(abs(var(--n)) * 12px)) rotate(calc(var(--n) * 4deg));
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease;
}

/* Browsers without CSS abs() skip the arc's vertical dip */
@supports not (width: calc(abs(-1px))) {
  .ctry-post { transform: translateX(-50%) translateX(calc(var(--spread) * var(--n))) rotate(calc(var(--n) * 4deg)); }
}

.ctry-post:hover,
.ctry-post:focus-visible {
  z-index: 10;
  box-shadow: 0 40px 70px -30px rgba(35, 13, 79, 0.55), 0 0 0 1px rgba(35, 13, 79, 0.05);
  transform: translateX(-50%) translateX(calc(var(--spread) * var(--n))) translateY(-26px) rotate(0deg) scale(1.04);
}

.ctry-post:focus-visible { outline: 3px solid #3230e0; outline-offset: 4px; }

/* ---------- Card ---------- */
.ctry-post__photo {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 180px;
  padding: 16px;
  overflow: hidden;
  isolation: isolate;
  border-radius: 12px;
  background: var(--tone-b);
}

/* The flag, blurred into a soft "photo" */
.ctry-post__bg {
  position: absolute;
  inset: -15%;
  z-index: -2;
  width: 130%;
  height: 130%;
  filter: blur(10px) saturate(1.1);
  opacity: 0.85;
}

.ctry-post__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.88) 100%);
}

.ctry-post__greet { font: italic 500 14px/1.2 var(--font-display); color: var(--ink-muted); }
.ctry-post__name { font: 500 22px/1.15 var(--font-display); color: var(--heading-strong); }

.ctry-post__stamp {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 54px;
  border: 2px dashed rgba(35, 13, 79, 0.25);
  border-radius: 4px;
  background: #ffffff;
  transform: rotate(6deg);
}

.ctry-post__stamp svg { width: 32px; height: 22px; border-radius: 2px; }

/* Three ruled lines, like writing on the back of a postcard */
.ctry-post__blurb {
  display: -webkit-box;
  margin: 14px 6px 12px;
  overflow: hidden;
  font-size: 14px;
  line-height: 24px;
  color: #3a2c55;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  background: repeating-linear-gradient(180deg, transparent 0 23px, #efedf5 23px 24px);
}

.ctry-post__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: auto 6px 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.ctry-post__arrow {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--heading-strong);
  box-shadow: 0 6px 14px -8px rgba(35, 13, 79, 0.4);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.ctry-post__arrow svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctry-post:hover .ctry-post__arrow { background: #3230e0; color: #ffffff; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .ctry-fan { --spread: 186px; }
  .ctry-post { width: 180px; }
  .ctry-post__photo { height: 160px; padding: 14px; }
  .ctry-post__name { font-size: 19px; }
  .ctry-post__blurb { font-size: 13px; }
  .ctry-post__foot { gap: 6px; font-size: 11px; letter-spacing: 0.02em; white-space: nowrap; }
  .ctry-post__arrow { width: 30px; height: 30px; }
}

/* Too narrow for the fan: lay the postcards out in a grid, barely tilted */
@media (max-width: 1180px) {
  .ctry-fan { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; height: auto; }
  .ctry-post,
  .ctry-post:hover,
  .ctry-post:focus-visible { position: static; width: auto; transform: rotate(calc(var(--n) * 0.8deg)); }
}

@media (max-width: 1024px) {
  .ctry-fan { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .ctry { --section-pad-top: 0px; }
  .ctry-fan { grid-template-columns: minmax(0, 1fr); }
  .ctry-post,
  .ctry-post:hover,
  .ctry-post:focus-visible { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ctry-post,
  .ctry-post__arrow { transition: none; }
}
