/*
 * Copperplate's site (smfahim.com). Ergonomc's reading-page style: site/BRAND-BRIEF.md
 * "Reading page", site/src/styles/brand.css (colours, type, focus ring) and
 * site/src/components/pages/legal/LegalDoc.astro (short version, "On this page", tables).
 * Fonts are self-hosted next to this file (SIL OFL 1.1, licences in fonts/).
 * Nothing on this site loads from another host.
 */

@font-face {
  font-family: "Source Serif 4 Display";
  src: url("fonts/source-serif-4-display.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Libre Franklin";
  src: url("fonts/libre-franklin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* Metric-matched local fallbacks (values from site/src/styles/fonts.css): the swap barely moves the text. */
@font-face {
  font-family: "Source Serif 4 Display Fallback";
  src: local("Georgia");
  size-adjust: 91.68%;
  ascent-override: 113.01%;
  descent-override: 36.54%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Libre Franklin Fallback";
  src: local("Arial");
  size-adjust: 105.58%;
  ascent-override: 91.49%;
  descent-override: 23.3%;
  line-gap-override: 0%;
}

:root {
  --warm: #f6f3ef;
  --ink: #101418;
  --ink-2: #4b5563;       /* 6.8:1 on --warm, 7.6:1 on white */
  --line: #e4dfd7;
  --line-strong: #b9b1a5;
  --white: #ffffff;
  --accent-ink: #2c56d6;  /* links and focus ring: 5.6:1 on --warm, 6.2:1 on white */
  --accent-hover: #2348b8;
  --serif: "Source Serif 4 Display", "Source Serif 4 Display Fallback", Georgia, serif;
  --sans: "Libre Franklin", "Libre Franklin Fallback", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--warm);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 28px;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, p, ul, ol, table, address { margin: 0; }

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

a { color: var(--accent-ink); }

/* ---- One column: 820px, 24px gutters, 16px on phones ---- */
.wrap {
  width: min(100% - 48px, 820px);
  margin-left: auto;
  margin-right: auto;
}

/* ---- Skip link: hidden until focused ---- */
.skip {
  position: absolute;
  left: 16px;
  top: -200px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--white);
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  text-decoration: none;
}

.skip:focus { top: 12px; }

/* ---- Header: the name on the left, the maker on the right ---- */
.site-header { border-bottom: 1px solid var(--line); }

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 72px;
  padding: 12px 0;
}

.wordmark {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 32px;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-decoration: none;
}

.by {
  font-size: 16px;
  line-height: 24px;
  color: var(--ink-2);
  text-decoration: none;
}

.wordmark:hover,
.by:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ---- Type ---- */
main {
  padding: 80px 0 112px;
  color: var(--ink-2);
}

h1, h2, h3 {
  color: var(--ink);
  font-weight: 400;
  text-wrap: balance;
}

h1 {
  font-family: var(--serif);
  font-size: 56px;
  line-height: 62px;
  letter-spacing: -0.012em;
}

h2 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 42px;
  letter-spacing: -0.01em;
}

p, li { text-wrap: pretty; }

strong {
  font-weight: 600;
  color: var(--ink);
}

.lead {
  margin-top: 24px;
  font-size: 20px;
  line-height: 31px;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

/* Links in running text are underlined: colour alone doesn't set them apart. */
main a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

a[href^="tel:"] { white-space: nowrap; }

/* ---- Blocks: generous space between, one link or button at the end of each ---- */
.block + .block { margin-top: 96px; }
.block > * + * { margin-top: 16px; }
.block > h2 + * { margin-top: 20px; }
.block > .lead { margin-top: 24px; }
.block > .go { margin-top: 32px; }

.go a {
  font-size: 17px;
  line-height: 24px;
  font-weight: 600;
  text-decoration: none;
}

.go a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.go a svg {
  width: 16px;
  height: 16px;
  margin-left: 8px;
  vertical-align: -2px;
}

.go .btn {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--accent-ink);
  color: var(--white);
  font-size: 16px;
  line-height: 20px;
}

.go .btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

/* Plain lists as ruled rows (b-checks) */
.ruled {
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.ruled li {
  padding: 12px 0 13px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

/* ---- Tables: ruled rows; on phones each row stacks into label and value lines ---- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 24px;
}

.table th,
.table td {
  padding: 12px 20px 13px 0;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.table th:last-child,
.table td:last-child { padding-right: 0; }

.table thead th {
  padding-top: 0;
  border-top: 0;
  border-bottom: 1px solid var(--line-strong);
  font-weight: 600;
  color: var(--ink);
}

.table tbody th {
  font-weight: 600;
  color: var(--ink);
}

.table tbody tr:last-child > * { border-bottom: 1px solid var(--line); }

.table tbody tr:first-child > * { border-top: 0; }

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- The privacy policy ---- */
.policy h2 {
  font-size: 30px;
  line-height: 38px;
}

.policy [id] { scroll-margin-top: 24px; }

.effective {
  margin-top: 16px;
  font-size: 16px;
  line-height: 24px;
}

.effective time {
  font-weight: 600;
  color: var(--ink);
}

.policy ul,
.policy ol { padding-left: 1.4em; }

.policy li + li { margin-top: 6px; }

.policy li::marker { color: var(--ink-2); }

.sec { margin-top: 72px; }
.sec > * + * { margin-top: 16px; }
.sec > h2 + * { margin-top: 20px; }

/* The short version: a white panel above section 1, ruled rows with bold lead-ins */
.summary {
  margin-top: 48px;
  padding: 28px 32px 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.policy .summary ul {
  margin-top: 12px;
  padding: 0;
  list-style: none;
}

.policy .summary li {
  margin: 0;
  padding: 14px 0 15px;
  border-top: 1px solid var(--line);
}

.policy .summary li:first-child { border-top: 0; }

.policy .summary li:last-child { padding-bottom: 0; }

/* On this page: a plain list of links under a small heading */
.toc { margin-top: 56px; }

.policy .toc h2 {
  font-size: 22px;
  line-height: 30px;
}

.policy .toc ul {
  margin-top: 12px;
  padding: 0;
  list-style: none;
}

.policy .toc li { margin: 0; padding: 3px 0; }

.toc a { text-decoration: none; }

.toc a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

address { font-style: normal; }

address p + p { margin-top: 4px; }

/* ---- Footer ---- */
.site-footer {
  padding: 40px 0 56px;
  border-top: 1px solid var(--line);
  font-size: 16px;
  line-height: 24px;
  color: var(--ink-2);
}

.site-footer .wrap > * + * { margin-top: 12px; }

.site-footer a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  padding: 0;
  list-style: none;
}

.footer-note {
  font-size: 14px;
  line-height: 20px;
}

/* ---- Phones ---- */
@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }

  .site-header .wrap { min-height: 60px; }

  .wordmark { font-size: 23px; line-height: 28px; }

  main { padding: 48px 0 80px; }

  h1 { font-size: 40px; line-height: 46px; }

  h2 { font-size: 27px; line-height: 34px; }

  .policy h2 { font-size: 25px; line-height: 32px; }

  .lead { font-size: 19px; line-height: 29px; }

  .block + .block { margin-top: 64px; }

  .sec { margin-top: 56px; }

  .summary { margin-top: 36px; padding: 20px 18px 22px; }

  .table,
  .table tbody,
  .table tr,
  .table th,
  .table td { display: block; }

  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .table tbody tr {
    padding: 14px 0 15px;
    border-top: 1px solid var(--line);
  }

  .table tbody tr:first-child { border-top: 1px solid var(--line-strong); }

  .table tbody tr:last-child { border-bottom: 1px solid var(--line); }

  .table tbody th,
  .table tbody td,
  .table tbody tr:last-child > *,
  .table tbody tr:first-child > * {
    padding: 0;
    border: 0;
  }

  .table td { margin-top: 10px; }

  .table td::before {
    content: attr(data-label);
    display: block;
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    color: var(--ink);
  }
}
