/*
 * 2earl.com
 * Same identity as login.2earl.com: the mark's four facets run as one band along the top edge,
 * and the mark itself sits at its normal size in the header. Content takes the full width of the
 * screen, centred; the rest stays neutral so the brand colours carry the page.
 * Tokens match login.2earl.com's app.css.
 */

@font-face {
  font-family: 'Readex Pro';
  src: url('/fonts/readex-pro-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* The mark's four facets */
  --red: #ed1c24;
  --vermilion: #f15a24;
  --orange: #f7931e;
  --amber: #fbb03b;

  /* Light scheme (text pairs checked for WCAG AA) */
  --bg: #f7f7f8;
  --fg: #1c1b1f;
  --muted: #5c5a60; /* 6.4:1 on --bg */
  --rule: #e2e1e5;
  --link: #b23a0c; /* 5.6:1 on --bg */
  --focus: #b23a0c;
  --surface: #ffffff;

  --display: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;

  accent-color: var(--vermilion);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141315;
    --fg: #f2f1f3;
    --muted: #a19fa6; /* 7.1:1 */
    --rule: #2c2a2f;
    --link: #fbb03b; /* 10:1 */
    --focus: #fbb03b;
    --surface: #1c1b1f;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.65 var(--body);
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Page: the mark's band + one centred column ------------------------------------------ */

/* The four facets in the mark's order, as one band along the top edge of every page. */
body::before {
  content: '';
  display: block;
  height: 0.375rem;
  background: linear-gradient(
    90deg,
    var(--red) 0 25%,
    var(--vermilion) 25% 50%,
    var(--orange) 50% 75%,
    var(--amber) 75%
  );
}

.page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 0.375rem);
  min-height: calc(100dvh - 0.375rem);
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
  padding: 1.5rem clamp(1.25rem, 5vw, 3rem) 2rem;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  align-self: flex-start;
  color: var(--fg);
  text-decoration: none;
}

.brand svg {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
}

.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand-sub {
  padding-left: 0.75rem;
  border-left: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5rem;
}

.header-action {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.625rem;
  color: var(--fg);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.header-action:hover {
  border-color: var(--muted);
}

.main {
  width: 100%;
  padding: clamp(2.5rem, 7vw, 5rem) 0 3rem;
}

footer.site {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

footer.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

footer.site a {
  color: var(--muted);
}

footer.site a[aria-current='page'] {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

footer.site p {
  margin: 0;
}

/* ---- Type ---------------------------------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 500;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.875rem, 3.4vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 0.75rem;
}

.lede {
  margin: 0 0 2.5rem;
  color: var(--muted);
  font-size: 1.125rem;
  text-wrap: pretty;
}

/* ---- Start page ------------------------------------------------------------------------------ */

.intro {
  max-width: 44rem;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.hero {
  font-size: clamp(2.25rem, 5.5vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  margin-bottom: 1.25rem;
}

.intro .lede {
  max-width: 38rem;
  margin: 0;
}

/* The services side by side on wide screens, stacked on narrow ones. */
.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 0 0 3rem;
  padding: 0;
  list-style: none;
}

/* Each service carries one facet colour on its top edge, in the mark's order. */
.service {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.5rem 1.25rem;
  border: 1px solid var(--rule);
  border-top: 0.375rem solid var(--vermilion);
  border-radius: 0.75rem;
  background: var(--surface);
}

.service-gateway {
  border-top-color: var(--orange);
}

.service-promptshare {
  border-top-color: var(--amber);
}

.service-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.375rem;
}

.service h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

.status {
  padding: 0.0625rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
}

.status-live {
  background: var(--amber);
  color: #1c1b1f;
}

.status-soon {
  border: 1px solid var(--muted);
  color: var(--muted);
}

.service p {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

/* The link sits at the bottom, so links line up across cards of different lengths. */
.service-link,
.service-host {
  margin-top: auto;
}

.service-link {
  font-weight: 600;
  font-size: 0.9375rem;
}

.service-host {
  color: var(--muted);
  font-size: 0.875rem;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

.source {
  max-width: 44rem;
}

.source h2 {
  margin: 0 0 0.375rem;
  font-size: 1.125rem;
}

.source p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---- Legal pages ----------------------------------------------------------------------------- */

.prose {
  max-width: 42rem;
}

.prose h1 {
  margin-bottom: 0.25rem;
}

.meta {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.toc {
  margin: 0 0 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  background: var(--surface);
  font-size: 0.9375rem;
}

.toc h2 {
  margin: 0 0 0.375rem;
  font-size: 0.8125rem;
  font-family: var(--body);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2 14rem;
  column-gap: 2rem;
}

.toc li {
  break-inside: avoid;
}

.prose > h2 {
  margin: 2.5rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 1.375rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  scroll-margin-top: 1rem;
}

.prose > h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.0625rem;
}

.prose p,
.prose ul,
.prose ol,
.prose address {
  margin: 0 0 1rem;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.375rem;
}

address {
  font-style: normal;
  padding: 0.875rem 1.125rem;
  border-left: 3px solid var(--vermilion);
  background: var(--surface);
  border-radius: 0 0.5rem 0.5rem 0;
}

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.625rem;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* ---- Narrow screens ----------------------------------------------------------------------- */

@media (max-width: 30rem) {
  .brand-sub {
    display: none;
  }
}

/* ---- Forced colours: keep boundaries visible ------------------------------------------------ */

@media (forced-colors: active) {
  body::before {
    display: none;
  }

  .service {
    border-top-width: 1px;
  }
}

@media print {
  body::before,
  .header-action,
  .toc {
    display: none;
  }

  .page {
    display: block;
    max-width: none;
    min-height: 0;
  }
}
