/* The look of the home page only. Shared colours, the logo and the .btn button are in styles.css.
   Sections below are in page order: settings, top bar, hero, diagram, footer, Sign in window. */

/* ---------- Home page settings ---------- */
.page-home {
  --page-width: 1160px;                /* the widest the home page content gets */
  --wire: var(--brand-orange);         /* the connector lines in the diagram */
  --dot: var(--brand-orange-dark);     /* the small dots where lines meet a box or card */
  --ink: #564e48;                      /* body text: a little darker than --muted, for reading over the map */
}

/* Screen-reader-only text: read aloud, but not shown */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Top bar: logo left, Sign in right ---------- */
.site-header {
  max-width: var(--page-width);
  gap: 12px;
}
.brand:focus-visible {
  outline: 3px solid var(--brand-orange-dark);
  outline-offset: 4px;
  border-radius: 6px;
}
.btn-signin {
  --accent: var(--brand-teal);
  margin-top: 0;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  white-space: nowrap;
}
.btn-signin svg { width: 18px; height: 18px; }

/* ---------- Hero, with the dotted world map behind it ---------- */
.page-home main {
  display: block;                      /* styles.css centres everything; the home page flows top to bottom */
  overflow-x: clip;                    /* nothing decorative may make the page scroll sideways */
  padding: 0 16px 48px;
  background: url("/img/world-dots.svg") 50% 8px / min(1480px, 175%) auto no-repeat;
}
.hero {
  position: relative;
  isolation: isolate;
  max-width: 820px;
  margin: 0 auto;
  padding: 44px 0 48px;
  text-align: center;
}
/* A soft cream glow behind the words, so the map shows at the sides but never under the text */
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -24px -8%;
  background: radial-gradient(closest-side, var(--bg) 62%, rgba(248, 244, 239, 0));
}
.eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--brand-orange-dark);
}
.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(32px, 5.2vw, 56px);
  line-height: 1.08;
  letter-spacing: -1px;
  color: var(--brand-teal);
  text-wrap: balance;
}
.hero h1 .hl { color: var(--brand-orange-dark); }   /* "in one place" in the logo orange */
.hero .lead {
  max-width: 640px;
  margin: 0 auto 28px;
  font-size: clamp(16px, 1.9vw, 19px);
  line-height: 1.55;
  color: var(--ink);
  text-wrap: pretty;
}
.btn-primary {
  --accent: var(--brand-orange-dark);
  margin-top: 0;
  min-height: 48px;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 17px;
  box-shadow: 0 10px 24px rgba(176, 74, 47, 0.28);
}

/* ---------- The orchestration diagram (laid out like the business card) ---------- */
/* Five equal columns. The box sits over columns 2-4; lines run from it down to every card. */
.layer {
  max-width: var(--page-width);
  margin: 0 auto;
}
.diagram {
  --gap: 18px;     /* space between the five cards */
  --inset: 44px;   /* the box starts this far inside column 2 and ends this far inside column 4 */
  --drop: 48px;    /* the height of the line area between the box and the cards */
  --line: 2px;     /* line thickness */
  --b: 2px;        /* border thickness of the box and the cards */
}
.layer-box {
  position: relative;
  /* one column + one gap + the inset, on each side */
  margin: 0 calc((100% - 4 * var(--gap)) / 5 + var(--gap) + var(--inset));
  padding: 22px 20px 26px;
  border: var(--b) solid var(--wire);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #fdf5ee);
  box-shadow: var(--shadow);
  /* the width of one column, worked out from the box width (used by the lines below) */
  --col: calc((100% + 2 * var(--b) - 2 * var(--gap) + 2 * var(--inset)) / 3);
}
/* "ORCHESTRATION LAYER" with a short line and a dot on each side */
.layer-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--brand-teal);
}
.layer-title::before,
.layer-title::after {
  content: "";
  flex: 0 0 56px;
  height: 10px;
  background:
    radial-gradient(circle closest-side, var(--dot) 90%, transparent) 0 50% / 10px 10px no-repeat,
    linear-gradient(var(--wire), var(--wire)) 0 50% / 100% 2px no-repeat;
}
.layer-title::after { transform: scaleX(-1); margin-left: -3px; }   /* mirror it: dot on the outer end */
.layer-tiles {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tile {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  background: var(--surface);
  border: var(--b) solid var(--wire);
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(92, 38, 25, 0.08);
}
.tile svg { width: 42px; height: 42px; }

/* The connector lines (all decoration). Sizes come from the variables on .diagram. */
.wire { position: absolute; }
.wire-left,
.wire-right {          /* from the side of the box, across, then down to card 1 or card 5 */
  top: 50%;
  height: calc(50% + var(--b) + var(--drop));
  width: calc(var(--col) / 2 + var(--gap) + var(--inset) + var(--line) / 2);
  border-top: var(--line) solid var(--wire);
}
.wire-left {
  right: calc(100% + var(--b));
  border-left: var(--line) solid var(--wire);
  border-top-left-radius: 16px;
}
.wire-right {
  left: calc(100% + var(--b));
  border-right: var(--line) solid var(--wire);
  border-top-right-radius: 16px;
}
.wire-stem {           /* from the bottom middle of the box down to the bar */
  left: 50%;
  top: calc(100% + var(--b));
  height: calc(var(--drop) / 2);
  border-left: var(--line) solid var(--wire);
  transform: translateX(calc(var(--line) / -2));
}
.wire-bus {            /* the bar that feeds cards 2, 3 and 4 */
  left: calc(var(--col) / 2 - var(--inset) - var(--b) - var(--line) / 2);
  right: calc(var(--col) / 2 - var(--inset) - var(--b) - var(--line) / 2);
  top: calc(100% + var(--b) + var(--drop) / 2 - var(--line) / 2);
  border-top: var(--line) solid var(--wire);
}
/* dots where the lines leave the box */
.wire-left::before,
.wire-right::before,
.wire-stem::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
}
.wire-left::before { right: -5px; top: calc(var(--line) / -2 - 5px); }
.wire-right::before { left: -5px; top: calc(var(--line) / -2 - 5px); }
.wire-stem::before { top: -5px; left: calc(var(--line) / -2 - 5px); }

/* The five module cards */
.modules {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap);
  margin: var(--drop) 0 0;
  padding: 0;
  list-style: none;
}
.module {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 7px 7px 12px;
  background: var(--surface);
  border: var(--b) solid var(--wire);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.module img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}
.module h3 {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6em;
  margin: 12px 4px 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-align: center;
  color: var(--brand-teal);
}
/* the short line from the bar down to cards 2, 3 and 4 */
.module::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  height: calc(var(--drop) / 2 + var(--b));
  border-left: var(--line) solid var(--wire);
  transform: translateX(-50%);
}
.module:first-child::before,
.module:last-child::before { display: none; }   /* cards 1 and 5 get their line from the box sides */
/* the dot where a line meets a card */
.module::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(-1 * var(--b) - 5px);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
  transform: translateX(-50%);
}

/* ---------- Tablet and phone: a simpler diagram ---------- */
/* Below 900px the five cards wrap, so the branching lines would cross the cards. The box becomes
   full width with one line down to the cards, and the cards sit in rows of 3, then rows of 2. */
@media (max-width: 899px) {
  .layer-box { margin: 0; }
  .wire-left, .wire-right, .wire-bus, .module::before, .module::after { display: none; }
  .wire-stem { height: calc(var(--drop) - 5px); }
  .wire-stem::after {
    content: "";
    position: absolute;
    left: calc(var(--line) / -2 - 5px);
    bottom: -5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dot);
  }
  .modules {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  .module { flex: 0 0 calc((100% - 2 * var(--gap)) / 3); }
}
@media (max-width: 599px) {
  .diagram { --drop: 36px; }
  .layer-box { padding: 18px 14px 20px; }
  .layer-title { font-size: 12px; letter-spacing: 2px; gap: 10px; }
  .layer-title::before, .layer-title::after { flex-basis: 28px; }
  .layer-tiles { gap: 12px; }
  .tile { width: 56px; height: 56px; border-radius: 12px; }
  .tile svg { width: 32px; height: 32px; }
  .module { flex-basis: calc((100% - var(--gap)) / 2); }
  .module h3 { font-size: 13px; letter-spacing: 0.4px; }
}
/* The title's side lines shrink first when there is no room */
.layer-title::before, .layer-title::after { flex-shrink: 1; min-width: 16px; }

/* ---------- Footer: the web address between two lines, like the card ---------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 20px 16px 30px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--brand-teal);
}
.site-footer::before,
.site-footer::after {
  content: "";
  flex: 0 1 180px;
  height: 10px;
  background:
    radial-gradient(circle closest-side, var(--dot) 90%, transparent) 100% 50% / 10px 10px no-repeat,
    linear-gradient(var(--wire), var(--wire)) 0 50% / 100% 2px no-repeat;
}
.site-footer::after { transform: scaleX(-1); }   /* mirror: dot next to the text on both sides */

/* ---------- The Sign in window (a <dialog>) with the five account-type cards ---------- */
.chooser {
  width: min(100% - 32px, 1000px);
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(10, 67, 67, 0.35);
  overflow-y: auto;
}
.chooser::backdrop { background: rgba(10, 67, 67, 0.55); }   /* the dark teal veil over the page */
.chooser-inner {
  position: relative;
  padding: 28px;
}
.chooser-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chooser-close svg { width: 22px; height: 22px; }
.chooser-close:hover { background: var(--export-soft); color: var(--text); }
.chooser-close:focus-visible { outline: 3px solid var(--brand-orange-dark); outline-offset: 2px; }
.chooser .eyebrow { margin-bottom: 8px; padding-right: 44px; }
.chooser h2 {
  margin: 0 0 6px;
  padding-right: 44px;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.3px;
  color: var(--brand-teal);
}
.chooser .lead {
  margin: 0 0 18px;
  color: var(--ink);
  line-height: 1.5;
}

/* The two role cards. The colour of each card (--accent) is used by .icon, .tag, .features and .btn in styles.css. */
.role-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.role-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.role-card::before {            /* the coloured strip along the top */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--accent);
}
.role-card:hover,
.role-card:focus-within {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}
.role-card.exporter { --accent: var(--export); --accent-soft: var(--export-soft); }
.role-card.importer { --accent: var(--import); --accent-soft: var(--import-soft); }
.role-card.service { --accent: #2c6b69; --accent-soft: #e2eeed; }   /* a lighter teal for the service providers */
/* "I trade goods" and "I provide trade services" */
.group-title {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}
.chooser .lead + .group-title { margin-top: 0; }
.role-cards.services { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
/* Service cards are shorter (icon beside the title), so the window fits a laptop screen */
.role-card.service {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px 14px;
  align-items: start;
}
.role-card.service .icon { width: 44px; height: 44px; border-radius: 12px; }
.role-card.service .icon svg { width: 24px; height: 24px; }
.role-card.service .tag { margin-bottom: 2px; }
.role-card.service h4 { font-size: 20px; }
.role-card.service p,
.role-card.service .btn { grid-column: 1 / -1; }
.role-card.service .btn { align-self: end; margin-top: 0; font-size: 14px; }
.role-card h4 { margin: 0; font-size: 22px; letter-spacing: -0.2px; }
.role-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 15px; }

@media (max-width: 479px) {
  .chooser-inner { padding: 22px 18px; }
  .role-card { padding: 20px; }
}
/* A short fade-in for the window, only for people who have not turned animations off */
@media (prefers-reduced-motion: no-preference) {
  .chooser[open] { animation: chooser-in 180ms ease-out; }
  @keyframes chooser-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
  }
}
