/* Shared alignment rules for cards and action areas across all language pages. */
.cards {
  align-items: stretch;
}

/* Regional guide request and download */
.guide-form {
  margin-top: 32px;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(42, 31, 103, .09);
}
.guide-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 24px;
}
.guide-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}
.guide-form label.full { grid-column: 1 / -1; }
.guide-form input,
.guide-form select {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid #cfd6e8;
  border-radius: 12px;
  background: #fff;
  color: #17142d;
  font: inherit;
  font-weight: 500;
}
.guide-form input:focus,
.guide-form select:focus {
  outline: 3px solid rgba(8, 125, 246, .18);
  border-color: var(--blue);
}
.guide-form .actions { margin-top: 24px; }
.guide-result {
  margin-top: 28px;
  padding: 26px;
  border: 2px solid rgba(56, 42, 114, .18);
  border-radius: 22px;
  background: linear-gradient(135deg, #f5f1ff, #eef9ff);
}
.guide-result[hidden] { display: none; }
.guide-result h2 { margin-top: 0; }
.guide-result .actions { align-items: center; }
.guide-privacy {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--pink);
  background: #faf8ff;
  color: var(--muted);
  font-size: .92rem;
}
.guide-contact {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafbff;
}
.guide-contact summary {
  cursor: pointer;
  color: var(--purple);
  font-weight: 850;
}
.guide-contact[open] summary { margin-bottom: 18px; }
.guide-result [data-guide-edition] { color: var(--purple); }
.guide-result [data-guide-review] {
  padding: 14px 16px;
  border-left: 4px solid var(--pink);
  border-radius: 0 12px 12px 0;
  background: #fff;
  color: #443963;
  font-weight: 700;
}
@media (max-width: 720px) {
  .guide-form-grid { grid-template-columns: 1fr; }
  .guide-form label.full { grid-column: auto; }
  .guide-form .button,
  .guide-result .button { width: 100%; }
}

/* Keep the complete navigation visible on normal desktop and notebook widths.
   The compact Menu is reserved for tablets and phones. */
@media (min-width: 901px) {
  .nav {
    min-height: 84px;
    padding: 0;
    flex-wrap: nowrap;
  }

  .menu-button {
    display: none;
  }

  .links {
    display: flex;
    order: initial;
    width: auto;
    margin-left: auto;
    padding: 0;
    flex-direction: row;
    align-items: center;
    gap: clamp(8px, 1vw, 15px);
  }

  .links > a {
    width: auto;
    min-height: auto;
    text-align: left;
  }

  .language {
    margin-left: 0;
  }
}

@media (min-width: 901px) and (max-width: 1050px) {
  .brand { width: 205px; }
  .links { gap: 7px; font-size: .8rem; }
  .links > a.button { padding: 8px 11px; }
  .language a { padding: 4px 6px; font-size: .64rem; }
}

/* Navigation icons use currentColor so active, default and primary states stay consistent. */
.links > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38em;
  min-height: 40px;
  white-space: nowrap;
  line-height: 1.2;
}

.links > a::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 1em;
  background: currentColor;
  -webkit-mask: var(--nav-icon) center / contain no-repeat;
  mask: var(--nav-icon) center / contain no-repeat;
}

.links > a[href="index.html"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11 12 4l9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1Z'/%3E%3C/svg%3E");
}

.links > a[href="alliance.html"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E");
}

.links > a[href="membership.html"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='9' r='2.5'/%3E%3Cpath d='M3.5 20c.5-4 2.4-6 5.5-6s5 2 5.5 6M14 15c3-.8 5.4.9 6 4'/%3E%3C/svg%3E");
}

.links > a[href="programmes.html"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18M7 14h3M14 14h3M7 18h3'/%3E%3C/svg%3E");
}

.links > a[href="collaboration.html"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h11l-3-3M18 7l-3 3M17 17H6l3-3M6 17l3 3'/%3E%3C/svg%3E");
}

.links > a[href="apply.html"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E");
}

/* Keep the shared header calm and balanced across Chinese, English and Thai. */
.nav {
  gap: clamp(10px, 1.15vw, 17px);
}

.brand {
  width: clamp(220px, 18vw, 250px);
}

.links {
  gap: clamp(10px, 1.15vw, 17px);
  font-size: .88rem;
}

.links > a.button {
  padding: 9px 15px;
}

.language {
  flex: 0 0 auto;
  padding: 2px;
}

.language a {
  padding: 4px 7px;
  font-size: .7rem;
  line-height: 1.25;
}

/* Switch to the tidy menu before long English or Thai labels can wrap. */
@media (max-width: 1180px) {
  .nav {
    min-height: 72px;
    padding: 10px 0;
    flex-wrap: wrap;
  }

  .brand {
    width: 225px;
  }

  .menu-button {
    display: block;
    margin-left: auto;
  }

  .links {
    display: none;
    order: 4;
    width: 100%;
    margin: 0;
    padding: 12px 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .links.open {
    display: flex;
  }

  .links > a {
    width: 100%;
    min-height: 42px;
    text-align: center;
  }

  .language {
    margin-left: 0;
  }
}

.cards > .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card > h2,
.card > h3 {
  line-height: 1.35;
}

.card > p {
  margin-top: .4em;
}

.cards > .card > h3 {
  text-wrap: balance;
}

/* Shared card rhythm: align title blocks and body starting points within each row. */
@media (min-width: 651px) {
  .cards:not(.field-cards) > .card:not(:has(> .form-link)) > h3:first-child {
    min-height: 2.7em;
  }

  /* Programme cards use a shared status row, two-line title row and bottom action row. */
  .cards:has(> .card > .status) > .card:not(.accent) {
    border-top: 4px solid transparent;
  }

  .cards:has(> .card > .status) > .card:not(:has(> .status))::before {
    content: "";
    display: block;
    min-height: 27px;
  }

  .cards:has(> .card > .status) > .card > h3 {
    min-height: 2.7em;
  }

  /* Homepage first-cycle cards include a subtitle on two cards; reserve the same row for all. */
  body[data-locale="zh"] .cards:has(> .card.accent > a:last-child):not(:has(> .card > .status)) > .card > h3 {
    min-height: 3.35em;
  }

  body[data-locale="en"] .cards:has(> .card.accent > a:last-child):not(:has(> .card > .status)) > .card > h3,
  body[data-locale="th"] .cards:has(> .card.accent > a:last-child):not(:has(> .card > .status)) > .card > h3 {
    min-height: 5.6em;
  }
}

/* Membership tier cards: align title, descriptor and body baselines. */
.cards.four:not(.field-cards) > .card > h3:first-child {
  min-height: 2.7em;
  margin-bottom: .5em;
}

.cards.four:not(.field-cards) > .card > strong {
  display: flex;
  align-items: flex-start;
  min-height: 4.5em;
  line-height: 1.5;
  margin-bottom: .55em;
}

.cards.four:not(.field-cards) > .card > p {
  margin-top: 0;
}

/* Application cards: reserve matching title and description rows. */
.cards > .card:has(> .form-link) > h3 {
  min-height: 4.15em;
  margin-bottom: .65em;
}

.cards > .card:has(> .form-link) > p {
  min-height: 4.2em;
  margin: 0 0 1em;
}

.cards > .card > a:last-child,
.cards > .card > .button:last-child,
.cards > .card > .form-link:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin-top: auto;
  min-height: 44px;
  padding: 10px 17px;
  border-radius: 999px;
  background: linear-gradient(90deg, #382a72, #6550c7 55%, #d8258a);
  color: #fff !important;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 9px 22px rgba(56, 42, 114, .2);
  text-decoration: none !important;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.cards > .card > p + a:last-child,
.cards > .card > p + .button:last-child,
.cards > .card > p + .form-link:last-child {
  margin-top: auto;
}

.cards > .card > a:last-child:hover,
.cards > .card > a:last-child:focus-visible,
.cards > .card > .button:last-child:hover,
.cards > .card > .button:last-child:focus-visible,
.cards > .card > .form-link:last-child:hover,
.cards > .card > .form-link:last-child:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 13px 28px rgba(56, 42, 114, .3);
  filter: saturate(1.12);
}

.actions {
  align-items: stretch;
}

.actions .button {
  min-width: 188px;
  text-align: center;
  line-height: 1.35;
}

.actions .button:only-child {
  min-width: 250px;
}

/* Homepage hero actions: clear hierarchy with two equally inviting choices. */
.hero .actions {
  gap: 14px;
  align-items: stretch;
}

.hero .actions .button {
  min-height: 52px;
  min-width: 226px;
  padding: 12px 24px;
  border-width: 2px;
  font-size: 1.04rem;
  font-weight: 900;
  letter-spacing: .01em;
  box-shadow: 0 11px 26px rgba(56, 42, 114, .18);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.hero .actions .button::after {
  content: "→";
  margin-left: .5em;
  font-size: 1.08em;
  line-height: 1;
}

.hero .actions .button.primary {
  background: linear-gradient(90deg, #30206f, #624cc7 58%, #7a52d8);
  color: #fff;
  border-color: transparent;
}

.hero .actions .button.ghost {
  border: 2px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(90deg, #ea2b91, #087df6, #00b9d7) border-box;
  color: #30206f;
  box-shadow: 0 11px 28px rgba(8, 125, 246, .15);
}

.hero .actions .button:hover,
.hero .actions .button:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(56, 42, 114, .26);
  filter: saturate(1.08);
  text-decoration: none;
}

/* Responsive MADE network visual: keep the node diagram separate from the copy. */
.made-visual {
  display: grid;
  grid-template-rows: auto minmax(154px, 1fr) auto;
  align-content: stretch;
  justify-content: initial;
  gap: 10px;
  min-height: 390px;
}

.made-visual__kicker {
  align-self: start;
}

.made-visual__routes {
  position: relative;
  inset: auto;
  width: 100%;
  min-height: 154px;
  margin: 2px 0 0;
}

.made-visual__routes svg {
  inset: 4px 0;
  height: calc(100% - 8px);
}

.made-visual__routes path {
  stroke: rgba(255, 255, 255, .42);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.made-node {
  width: 44px;
  height: 44px;
}

.node-m {
  left: 3%;
  top: 56%;
}

.node-a {
  left: 29%;
  top: 7%;
}

.node-d {
  right: 27%;
  top: 57%;
}

.node-e {
  right: 3%;
  top: 6%;
}

.made-visual__copy {
  align-self: end;
  gap: 5px;
  padding: 10px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  text-shadow: 0 3px 14px rgba(20, 10, 72, .38);
}

.made-visual__copy::before {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  margin-bottom: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f5c964, #ea2b91, #00c5df);
  box-shadow: 0 4px 14px rgba(0, 197, 223, .22);
}

.made-visual__copy strong {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  text-wrap: balance;
}

.made-visual__copy b {
  font-size: .98rem;
}

.made-visual__copy span {
  font-size: .8rem;
  line-height: 1.55;
  max-width: 100%;
}

/* Featured event announcement strip. */
.event-strip {
  position: relative;
  padding: 23px 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 20%, rgba(0, 197, 223, .25), transparent 30%),
    linear-gradient(100deg, #21104f 0%, #3a247e 52%, #075aa6 100%);
  border-top: 3px solid #ea2b91;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 12px 30px rgba(25, 15, 77, .16);
}

.event-strip::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0 68%, rgba(255,255,255,.08) 68% 69%, transparent 69% 100%);
}

.event-strip-grid {
  position: relative;
  z-index: 1;
  gap: 24px;
}

.event-strip-grid strong {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: #fff;
  font-size: 1.13rem;
  font-weight: 950;
  letter-spacing: .015em;
}

.event-strip-grid strong::before {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f5c964, #f08c41);
  color: #241550;
  font-size: .7rem;
  font-weight: 950;
  letter-spacing: .08em;
  box-shadow: 0 7px 16px rgba(0,0,0,.16);
}

body[data-locale="zh"] .event-strip-grid strong::before {
  content: "重点活动";
}

body[data-locale="en"] .event-strip-grid strong::before {
  content: "FEATURED EVENT";
}

body[data-locale="th"] .event-strip-grid strong::before {
  content: "กิจกรรมเด่น";
}

.event-strip-grid > span {
  color: #fff;
  font-size: 1.12rem;
  font-weight: 850;
  line-height: 1.45;
}

.event-strip .home-priority-link {
  min-height: 46px;
  padding: 10px 18px;
  font-size: 1.05rem;
}

.callout .actions,
.decision-path .actions {
  justify-content: flex-start;
}

.participation-grid,
.architecture-grid,
.field-detail-grid,
.document-grid,
.timeline {
  align-items: stretch;
}

.participation-grid > article,
.architecture-grid > article,
.field-detail-grid > article,
.document-grid > article,
.timeline > article {
  height: 100%;
}

@media (max-width: 650px) {
  .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .cards.four:not(.field-cards) > .card > h3:first-child,
  .cards:not(.field-cards) > .card:not(:has(> .form-link)) > h3:first-child,
  .cards:has(> .card > .status) > .card > h3,
  body[data-locale] .cards:has(> .card.accent > a:last-child):not(:has(> .card > .status)) > .card > h3,
  .cards.four:not(.field-cards) > .card > strong,
  .cards > .card:has(> .form-link) > h3,
  .cards > .card:has(> .form-link) > p {
    min-height: 0;
  }

  .cards:has(> .card > .status) > .card:not(.accent) {
    border-top-width: 1px;
  }

  .cards:has(> .card > .status) > .card:not(:has(> .status))::before {
    display: none;
  }

  .actions .button,
  .actions .button:only-child,
  .cards > .card > a:last-child,
  .cards > .card > .button:last-child,
  .cards > .card > .form-link:last-child {
    width: 100%;
    min-width: 0;
  }

  .hero .actions .button {
    width: 100%;
    min-height: 54px;
  }

  .made-visual {
    grid-template-rows: auto 142px auto;
    min-height: 360px;
    padding: 24px;
  }

  .made-visual__routes {
    min-height: 142px;
  }

  .made-node {
    width: 40px;
    height: 40px;
  }

  .made-visual__copy {
    padding: 8px 0 0;
  }

  .made-visual__copy strong {
    font-size: 1.72rem;
  }

  .event-strip {
    padding: 20px 0;
  }

  .event-strip-grid {
    gap: 13px;
  }

  .event-strip-grid strong,
  .event-strip-grid > span {
    font-size: 1.02rem;
  }
}

/* Final desktop navigation override: keep all items visible above 900px. */
@media (min-width: 901px) {
  .nav {
    min-height: 84px;
    padding: 0;
    flex-wrap: nowrap;
  }

  .menu-button { display: none; }

  .links {
    display: flex;
    order: initial;
    width: auto;
    margin-left: auto;
    padding: 0;
    flex-direction: row;
    align-items: center;
    gap: clamp(8px, 1vw, 15px);
  }

  .links > a {
    width: auto;
    min-height: auto;
    text-align: left;
  }

  .language { margin-left: 0; }
}

@media (min-width: 901px) and (max-width: 1050px) {
  .brand { width: 205px; }
  .links { gap: 7px; font-size: .8rem; }
  .links > a.button { padding: 8px 11px; }
  .language a { padding: 4px 6px; font-size: .64rem; }
}
