/* Shared styles for tmrt.uk. Linked from every page that uses the shared header. */

:root { --navy: #00308f; --ink: #1c2330; --muted: #5b6577; --line: #d9deea; --tint: #f3f6fc; }
* { box-sizing: border-box; }
body { margin: 0; font: 18px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: #fff; }
main { max-width: 42rem; margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }

/* ---------- Header: logos and menu (markup in _header.html) ---------- */
.logos { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.logos a { display: block; line-height: 0; }
.logos img, .logos svg { display: block; height: 100px; width: auto; }
.menu { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 2.25rem; padding: .5rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .95rem; font-weight: 600; }
.menu a { display: flex; align-items: center; justify-content: center; min-height: 44px; text-align: center; text-decoration: none; }
.menu a:not(.cta) { border-bottom: 3px solid transparent; }
.menu a:not(.cta):hover { border-bottom-color: var(--line); }
.menu a[aria-current="page"] { border-bottom-color: var(--navy); }
.menu .cta { margin-left: auto; padding: 0 1.1rem; }

/* ---------- Text ---------- */
h1 { font-size: 2.1rem; line-height: 1.2; color: var(--navy); margin: 0 0 .75rem; }
h2 { font-size: 1.3rem; color: var(--navy); margin: 2.5rem 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--navy); }
ol, ul { padding-left: 1.3rem; margin: 0 0 1rem; }
li { margin-bottom: .6rem; }
.lede { font-size: 1.2rem; }
.more { font-weight: 600; }
.note { border-left: 4px solid var(--navy); background: var(--tint); padding: .8rem 1rem; }
.refs { font-size: .92rem; }
footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

/* ---------- Buttons ---------- */
.cta { display: inline-block; font: inherit; font-weight: 600; color: #fff; background: var(--navy); border: 0; border-radius: 8px; padding: .7rem 1.4rem; cursor: pointer; text-decoration: none; }
.cta:disabled { opacity: .6; cursor: default; }
.link { font: inherit; color: var(--navy); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* ---------- Tables and figures ---------- */
table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .92rem; line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: .6rem .6rem; border-bottom: 1px solid var(--line); }
th { color: var(--navy); border-bottom: 2px solid var(--navy); }
td:first-child { width: 35%; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; width: auto; font-weight: 400; }
figure { margin: 1.5rem 0; }
figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
figcaption { margin-top: .5rem; font-size: .9rem; color: var(--muted); }

/* ---------- Home page: "How it works" flow diagram ---------- */
.flow { display: flex; align-items: stretch; gap: .4rem; margin: 1.5rem 0; font-size: .9rem; line-height: 1.3; text-align: center; }
.box { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: .7rem .4rem; border: 2px solid var(--navy); border-radius: 8px; background: #fff; }
.box.key { background: var(--navy); color: #fff; }
.flow small { display: block; opacity: .8; }
.flow span { align-self: center; color: var(--navy); font-weight: 700; }
.inside { border: 2px dashed #9aa8c7; border-radius: 10px; background: var(--tint); position: relative; }
.inside::before { content: "Inside the Trust"; position: absolute; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.flow .inside { flex: 3.6; display: flex; align-items: stretch; gap: .4rem; padding: 1.7rem .5rem .5rem; }
.flow .inside::before { top: .35rem; left: .7rem; }

/* ---------- Home page: registration dialog ---------- */
dialog { width: min(28rem, calc(100vw - 2rem)); border: 0; border-radius: 12px; padding: 1.5rem; color: var(--ink); box-shadow: 0 10px 40px rgba(0, 20, 60, .3); }
dialog::backdrop { background: rgba(0, 20, 60, .5); }
dialog h2 { margin: 0 0 .5rem; }
dialog label { display: block; font-size: .9rem; font-weight: 600; margin-top: .8rem; }
dialog input, dialog select { display: block; width: 100%; font: inherit; color: inherit; background: #fff; padding: .5rem .6rem; margin-top: .2rem; border: 1px solid #9aa8c7; border-radius: 6px; }
.hp { position: absolute; left: -9999px; }
.error { color: #b3261e; font-size: .95rem; margin: .8rem 0 0; }
.actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.2rem; }

/* ---------- Federation page: the CAP choice ---------- */
.choice { display: flex; gap: .6rem; margin: 1.25rem 0; font-size: .92rem; line-height: 1.4; }
.choice div { flex: 1; padding: .8rem .9rem; border: 2px solid var(--navy); border-radius: 8px; }
.choice strong { display: block; color: var(--navy); margin-bottom: .2rem; }

/* ---------- Architecture page: layer diagram ---------- */
.stack { margin: 1.5rem 0 2rem; font-size: .95rem; line-height: 1.35; }
.layer { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border: 2px solid var(--navy); border-radius: 8px; background: #fff; }
.layer.key { background: var(--navy); color: #fff; }
.layer.side { border-style: dashed; }
.layer b { display: block; }
.layer small { display: block; font-size: .85rem; opacity: .85; }
.n { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; font-size: .9rem; display: flex; align-items: center; justify-content: center; }
.key .n { background: #fff; color: var(--navy); }
.down { text-align: center; color: var(--navy); font-weight: 700; line-height: 1; padding: .3rem 0; }
.stack .inside { padding: 2rem .7rem .7rem; }
.stack .inside::before { top: .5rem; left: .9rem; }
.pair { display: flex; align-items: stretch; gap: .5rem; }
.pair .layer:first-child { flex: 3; }
.pair .layer:last-child { flex: 2; }
.pair > span { align-self: center; color: var(--navy); font-weight: 700; }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  body { font-size: 17px; }
  main { padding-top: 1.25rem; }
  h1 { font-size: 1.7rem; }

  /* Smaller logos, and the menu as a 2 x 2 grid of large tap targets. No hamburger. */
  .logos { margin-bottom: .9rem; }
  .logos img, .logos svg { height: 52px; }
  .menu { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1.75rem; padding: 0; border: 0; font-size: .9rem; }
  .menu a, .menu a:not(.cta) { min-height: 46px; padding: .3rem .5rem; line-height: 1.2; border: 1px solid var(--line); border-radius: 8px; }
  .menu a[aria-current="page"] { border: 2px solid var(--navy); background: var(--tint); }
  .menu .cta { margin-left: 0; border-color: var(--navy); }

  .flow, .flow .inside, .choice, .pair { flex-direction: column; }
  .flow span, .pair > span { transform: rotate(90deg); }
}
