/*
 * Blog da Plain: the one stylesheet shared by /blog and every post.
 *
 * The pages read fine without it. It only sets the measure, the type and the
 * colours, and follows the system light/dark setting through
 * prefers-color-scheme: no script, no toggle, no stored preference.
 *
 * Colours are copied from the Customers App (PlainChrome/PlainInk for light,
 * its Material 3 dark scheme seeded with #2B4FE0 for dark). The README's blog
 * section explains how to re-derive them if the app palette changes.
 */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/blog/fonts/poppins-regular.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/blog/fonts/poppins-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/blog/fonts/poppins-semibold.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/blog/fonts/poppins-bold.woff2") format("woff2");
}

:root {
  color-scheme: light dark;

  --page: #ffffff;
  --surface: #f4f6fa;
  --text: #181d34;
  --text-secondary: #444654;
  --link: #2b4fe0;
  --hairline: rgb(24 29 52 / 8%);
  --callout: #eaefff;
  --callout-text: #181d34;
  --warning: #ba1a1a;
  --on-link: #ffffff;

  --radius: 20px;
  --measure: 42rem;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #11131c;
    --surface: #282934;
    --text: #e2e1ef;
    --text-secondary: #c5c5d6;
    --link: #b9c3ff;
    --hairline: #444654;
    --callout: #33343f;
    --callout-text: #e2e1ef;
    --warning: #ffb4ab;
    --on-link: #11131c;
  }
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

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

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

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

strong,
b {
  font-weight: 600;
}

small {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

h1,
h2,
h3 {
  line-height: 1.25;
  font-weight: 600;
  margin: 2em 0 0.6em;
}

h1 {
  font-size: clamp(1.875rem, 1.35rem + 2.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}

h2 {
  font-size: 1.375rem;
}

h3 {
  font-size: 1.125rem;
}

p,
ul,
ol,
dl,
figure,
table {
  margin: 0 0 1.1em;
}

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

li + li {
  margin-top: 0.4em;
}

img {
  max-width: 100%;
  height: auto;
}

/* Skip link: hidden until it receives keyboard focus. */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 1;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--link);
  color: var(--on-link);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* Page frame */

.site-header,
main,
.site-footer {
  max-width: calc(var(--measure) + 2.5rem);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--hairline);
}

.wordmark {
  color: var(--text);
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  text-decoration: none;
}

.wordmark span {
  color: var(--link);
}

.nav-link {
  font-weight: 600;
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
}

main {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.site-footer {
  padding-bottom: 2.5rem;
}

.site-footer p {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Index */

.lede {
  font-size: 1.1875rem;
  color: var(--text-secondary);
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
}

.post-list > li + li {
  margin-top: 1rem;
}

.post-card {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}

.post-card h2 {
  font-size: 1.1875rem;
  margin: 0 0 0.25em;
}

.post-card h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-card h2 a:hover {
  color: var(--link);
  text-decoration: underline;
}

.post-card p {
  margin: 0;
}

.post-card .post-meta {
  margin-bottom: 0.5em;
}

/* Post */

.post-meta {
  margin: 0 0 0.75em;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.post-header {
  margin-bottom: 2rem;
}

.subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.1875rem;
}

.post-body > :first-child {
  margin-top: 0;
}

.callout {
  margin: 1.5em 0;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  background: var(--callout);
  color: var(--callout-text);
}

.callout.warning {
  box-shadow: inset 4px 0 0 var(--warning);
}

.callout > :last-child,
.compare dd:last-child,
.steps li > :last-child {
  margin-bottom: 0;
}

.compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
}

.compare > div {
  padding: 1rem 1.25rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}

.compare dt {
  font-weight: 600;
}

.compare dd {
  margin: 0.25em 0 0;
}

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
}

.steps > li {
  position: relative;
  padding-left: 2.75rem;
  counter-increment: step;
}

.steps > li + li {
  margin-top: 1rem;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 50%;
  background: var(--link);
  color: var(--on-link);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.875rem;
  text-align: center;
}

figure {
  margin: 1.5em 0;
}

figure img {
  display: block;
  margin: 0 auto;
  border-radius: 12px;
}

figcaption {
  margin-top: 0.5em;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

/* An animation is opt-in: it only shows, and plays, while opened. */
.animation {
  margin: 1.5em 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}

.animation > summary {
  padding: 1rem 1.25rem;
  color: var(--link);
  font-weight: 600;
  cursor: pointer;
}

.animation > summary:focus-visible {
  border-radius: var(--radius);
}

.animation[open] > summary {
  border-bottom: 1px solid var(--hairline);
}

.animation figure {
  margin: 0;
  padding: 1rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 1.5em 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.table-wrap table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table-wrap th,
.table-wrap td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
}

.table-wrap thead th {
  background: var(--surface);
  font-weight: 600;
}

.table-wrap tbody tr:last-child > * {
  border-bottom: 0;
}

.series {
  margin: 2.5rem 0 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}

.series h2 {
  margin: 0 0 0.5em;
  font-size: 1rem;
}

.series ol {
  margin: 0;
}

.series [aria-current="page"] {
  font-weight: 600;
}

sup {
  line-height: 0;
}

sup a {
  text-decoration: none;
}

.notes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.notes h2 {
  margin-top: 0;
  font-size: 1rem;
  color: var(--text);
}

.notes li:target {
  color: var(--text);
}

.back-link {
  margin: 3rem 0 0;
  font-weight: 600;
}

.back-link a {
  text-decoration: none;
}

.back-link a:hover {
  text-decoration: underline;
}

/*
 * The cookie choice (blog.js): a banner at the foot of the screen, shown
 * only until the visitor chooses, here or on the landing page, and the
 * "Preferências" and "Detalhes" dialogs. Accepting and rejecting weigh the
 * same.
 */

.consent-banner {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  box-shadow: 0 -8px 24px rgb(0 0 0 / 12%);
}

.consent-banner-content {
  max-width: calc(var(--measure) + 2.5rem);
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

.consent-banner h2,
.consent-dialog h2 {
  margin: 0 0 0.5em;
  font-size: 1.125rem;
}

.consent-banner p {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.consent-actions button {
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border: 1px solid var(--link);
  border-radius: 999px;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.consent-actions button:hover {
  background: var(--callout);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.link-button:hover {
  text-decoration-thickness: 2px;
}

.consent-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  padding: 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--page);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.consent-dialog::backdrop {
  background: rgb(0 0 0 / 50%);
}

.consent-dialog h3 {
  margin: 1.25em 0 0.5em;
  color: var(--link);
  font-size: 1rem;
}

.consent-dialog ul {
  margin: 0;
  padding-left: 1.25rem;
}

.consent-dialog li {
  margin-bottom: 0.5rem;
}

.consent-category {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--hairline);
}

.consent-category label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
}

.consent-category p {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
}

.consent-dialog .consent-actions {
  margin-top: 1.25rem;
}

/* A switch: the knob on the left when off, on the right when on. */
.consent-category input[role="switch"] {
  flex: none;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0;
  border: 2px solid var(--text-secondary);
  border-radius: 999px;
  background: radial-gradient(circle, var(--text-secondary) 0.375rem, transparent 0.4375rem) left 0.0625rem center / 1.125rem 1.125rem no-repeat;
  appearance: none;
  cursor: pointer;
}

.consent-category input[role="switch"]:checked {
  border-color: var(--link);
  background: radial-gradient(circle, var(--on-link) 0.375rem, transparent 0.4375rem) right 0.0625rem center / 1.125rem 1.125rem no-repeat var(--link);
}

.consent-category input[role="switch"]:disabled {
  cursor: not-allowed;
}

@media (forced-colors: active) {
  .consent-category input[role="switch"] {
    appearance: auto;
  }
}

@media print {
  .consent-banner,
  .consent-footer {
    display: none;
  }
}
